id
int32 0
165k
| repo
stringlengths 7
58
| path
stringlengths 12
218
| func_name
stringlengths 3
140
| original_string
stringlengths 73
34.1k
| language
stringclasses 1
value | code
stringlengths 73
34.1k
| code_tokens
list | docstring
stringlengths 3
16k
| docstring_tokens
list | sha
stringlengths 40
40
| url
stringlengths 105
339
|
|---|---|---|---|---|---|---|---|---|---|---|---|
155,400
|
pip-services3-java/pip-services3-commons-java
|
src/org/pipservices3/commons/config/NameResolver.java
|
NameResolver.resolve
|
public static String resolve(ConfigParams config, String defaultName) {
// If name is not defined get is from name property
String name = config.getAsNullableString("name");
name = name != null ? name : config.getAsNullableString("id");
// Or get name from descriptor
if (name == null) {
String descriptorStr = config.getAsNullableString("descriptor");
try {
Descriptor descriptor = Descriptor.fromString(descriptorStr);
name = descriptor != null ? descriptor.getName() : null;
} catch (Exception ex) {
// Ignore...
}
}
return name != null ? name : defaultName;
}
|
java
|
public static String resolve(ConfigParams config, String defaultName) {
// If name is not defined get is from name property
String name = config.getAsNullableString("name");
name = name != null ? name : config.getAsNullableString("id");
// Or get name from descriptor
if (name == null) {
String descriptorStr = config.getAsNullableString("descriptor");
try {
Descriptor descriptor = Descriptor.fromString(descriptorStr);
name = descriptor != null ? descriptor.getName() : null;
} catch (Exception ex) {
// Ignore...
}
}
return name != null ? name : defaultName;
}
|
[
"public",
"static",
"String",
"resolve",
"(",
"ConfigParams",
"config",
",",
"String",
"defaultName",
")",
"{",
"// If name is not defined get is from name property",
"String",
"name",
"=",
"config",
".",
"getAsNullableString",
"(",
"\"name\"",
")",
";",
"name",
"=",
"name",
"!=",
"null",
"?",
"name",
":",
"config",
".",
"getAsNullableString",
"(",
"\"id\"",
")",
";",
"// Or get name from descriptor",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"String",
"descriptorStr",
"=",
"config",
".",
"getAsNullableString",
"(",
"\"descriptor\"",
")",
";",
"try",
"{",
"Descriptor",
"descriptor",
"=",
"Descriptor",
".",
"fromString",
"(",
"descriptorStr",
")",
";",
"name",
"=",
"descriptor",
"!=",
"null",
"?",
"descriptor",
".",
"getName",
"(",
")",
":",
"null",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"// Ignore...",
"}",
"}",
"return",
"name",
"!=",
"null",
"?",
"name",
":",
"defaultName",
";",
"}"
] |
Resolves a component name from configuration parameters. The name can be
stored in "id", "name" fields or inside a component descriptor. If name
cannot be determined it returns a defaultName.
@param config configuration parameters that may contain a component
name.
@param defaultName (optional) a default component name.
@return resolved name or default name if the name cannot be determined.
|
[
"Resolves",
"a",
"component",
"name",
"from",
"configuration",
"parameters",
".",
"The",
"name",
"can",
"be",
"stored",
"in",
"id",
"name",
"fields",
"or",
"inside",
"a",
"component",
"descriptor",
".",
"If",
"name",
"cannot",
"be",
"determined",
"it",
"returns",
"a",
"defaultName",
"."
] |
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
|
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/config/NameResolver.java#L34-L51
|
155,401
|
SimiaCryptus/utilities
|
java-util/src/main/java/com/simiacryptus/util/FastRandom.java
|
FastRandom.random
|
public double random() {
long z = next();
int exponentMag = 4;
double resolution = 1e8;
double x = ((z / 2) % resolution) / resolution;
double y = z % exponentMag - exponentMag / 2;
while (y > 1) {
y--;
x = 2;
}
while (y < -1) {
y++;
x /= 2;
}
return x;
}
|
java
|
public double random() {
long z = next();
int exponentMag = 4;
double resolution = 1e8;
double x = ((z / 2) % resolution) / resolution;
double y = z % exponentMag - exponentMag / 2;
while (y > 1) {
y--;
x = 2;
}
while (y < -1) {
y++;
x /= 2;
}
return x;
}
|
[
"public",
"double",
"random",
"(",
")",
"{",
"long",
"z",
"=",
"next",
"(",
")",
";",
"int",
"exponentMag",
"=",
"4",
";",
"double",
"resolution",
"=",
"1e8",
";",
"double",
"x",
"=",
"(",
"(",
"z",
"/",
"2",
")",
"%",
"resolution",
")",
"/",
"resolution",
";",
"double",
"y",
"=",
"z",
"%",
"exponentMag",
"-",
"exponentMag",
"/",
"2",
";",
"while",
"(",
"y",
">",
"1",
")",
"{",
"y",
"--",
";",
"x",
"=",
"2",
";",
"}",
"while",
"(",
"y",
"<",
"-",
"1",
")",
"{",
"y",
"++",
";",
"x",
"/=",
"2",
";",
"}",
"return",
"x",
";",
"}"
] |
Random double.
@return the double
|
[
"Random",
"double",
"."
] |
b5a5e73449aae57de7dbfca2ed7a074432c5b17e
|
https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/util/FastRandom.java#L46-L61
|
155,402
|
SimiaCryptus/utilities
|
java-util/src/main/java/com/simiacryptus/util/FastRandom.java
|
FastRandom.next
|
public long next() {
long x = xorshift(this.x);
this.x = y;
y = z;
z = this.x ^ x ^ y;
return z;
}
|
java
|
public long next() {
long x = xorshift(this.x);
this.x = y;
y = z;
z = this.x ^ x ^ y;
return z;
}
|
[
"public",
"long",
"next",
"(",
")",
"{",
"long",
"x",
"=",
"xorshift",
"(",
"this",
".",
"x",
")",
";",
"this",
".",
"x",
"=",
"y",
";",
"y",
"=",
"z",
";",
"z",
"=",
"this",
".",
"x",
"^",
"x",
"^",
"y",
";",
"return",
"z",
";",
"}"
] |
Next long.
@return the long
|
[
"Next",
"long",
"."
] |
b5a5e73449aae57de7dbfca2ed7a074432c5b17e
|
https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/util/FastRandom.java#L68-L74
|
155,403
|
BellaDati/belladati-sdk-java
|
src/main/java/com/belladati/sdk/impl/BellaDatiClient.java
|
BellaDatiClient.buildClient
|
private CloseableHttpClient buildClient(boolean trustSelfSigned) {
try {
// if required, define custom SSL context allowing self-signed certs
SSLContext sslContext = !trustSelfSigned ? SSLContexts.createSystemDefault()
: SSLContexts.custom().loadTrustMaterial(null, new TrustSelfSignedStrategy()).build();
// set timeouts for the HTTP client
int globalTimeout = readFromProperty("bdTimeout", 100000);
int connectTimeout = readFromProperty("bdConnectTimeout", globalTimeout);
int connectionRequestTimeout = readFromProperty("bdConnectionRequestTimeout", globalTimeout);
int socketTimeout = readFromProperty("bdSocketTimeout", globalTimeout);
RequestConfig requestConfig = RequestConfig.copy(RequestConfig.DEFAULT).setConnectTimeout(connectTimeout)
.setSocketTimeout(socketTimeout).setConnectionRequestTimeout(connectionRequestTimeout).build();
// configure caching
CacheConfig cacheConfig = CacheConfig.copy(CacheConfig.DEFAULT).setSharedCache(false).setMaxCacheEntries(1000)
.setMaxObjectSize(2 * 1024 * 1024).build();
// configure connection pooling
PoolingHttpClientConnectionManager connManager = new PoolingHttpClientConnectionManager(RegistryBuilder
.<ConnectionSocketFactory> create().register("http", PlainConnectionSocketFactory.getSocketFactory())
.register("https", new SSLConnectionSocketFactory(sslContext)).build());
int connectionLimit = readFromProperty("bdMaxConnections", 40);
// there's only one server to connect to, so max per route matters
connManager.setMaxTotal(connectionLimit);
connManager.setDefaultMaxPerRoute(connectionLimit);
// create the HTTP client
return CachingHttpClientBuilder.create().setCacheConfig(cacheConfig).setDefaultRequestConfig(requestConfig)
.setConnectionManager(connManager).build();
} catch (GeneralSecurityException e) {
throw new InternalConfigurationException("Failed to set up SSL context", e);
}
}
|
java
|
private CloseableHttpClient buildClient(boolean trustSelfSigned) {
try {
// if required, define custom SSL context allowing self-signed certs
SSLContext sslContext = !trustSelfSigned ? SSLContexts.createSystemDefault()
: SSLContexts.custom().loadTrustMaterial(null, new TrustSelfSignedStrategy()).build();
// set timeouts for the HTTP client
int globalTimeout = readFromProperty("bdTimeout", 100000);
int connectTimeout = readFromProperty("bdConnectTimeout", globalTimeout);
int connectionRequestTimeout = readFromProperty("bdConnectionRequestTimeout", globalTimeout);
int socketTimeout = readFromProperty("bdSocketTimeout", globalTimeout);
RequestConfig requestConfig = RequestConfig.copy(RequestConfig.DEFAULT).setConnectTimeout(connectTimeout)
.setSocketTimeout(socketTimeout).setConnectionRequestTimeout(connectionRequestTimeout).build();
// configure caching
CacheConfig cacheConfig = CacheConfig.copy(CacheConfig.DEFAULT).setSharedCache(false).setMaxCacheEntries(1000)
.setMaxObjectSize(2 * 1024 * 1024).build();
// configure connection pooling
PoolingHttpClientConnectionManager connManager = new PoolingHttpClientConnectionManager(RegistryBuilder
.<ConnectionSocketFactory> create().register("http", PlainConnectionSocketFactory.getSocketFactory())
.register("https", new SSLConnectionSocketFactory(sslContext)).build());
int connectionLimit = readFromProperty("bdMaxConnections", 40);
// there's only one server to connect to, so max per route matters
connManager.setMaxTotal(connectionLimit);
connManager.setDefaultMaxPerRoute(connectionLimit);
// create the HTTP client
return CachingHttpClientBuilder.create().setCacheConfig(cacheConfig).setDefaultRequestConfig(requestConfig)
.setConnectionManager(connManager).build();
} catch (GeneralSecurityException e) {
throw new InternalConfigurationException("Failed to set up SSL context", e);
}
}
|
[
"private",
"CloseableHttpClient",
"buildClient",
"(",
"boolean",
"trustSelfSigned",
")",
"{",
"try",
"{",
"// if required, define custom SSL context allowing self-signed certs",
"SSLContext",
"sslContext",
"=",
"!",
"trustSelfSigned",
"?",
"SSLContexts",
".",
"createSystemDefault",
"(",
")",
":",
"SSLContexts",
".",
"custom",
"(",
")",
".",
"loadTrustMaterial",
"(",
"null",
",",
"new",
"TrustSelfSignedStrategy",
"(",
")",
")",
".",
"build",
"(",
")",
";",
"// set timeouts for the HTTP client",
"int",
"globalTimeout",
"=",
"readFromProperty",
"(",
"\"bdTimeout\"",
",",
"100000",
")",
";",
"int",
"connectTimeout",
"=",
"readFromProperty",
"(",
"\"bdConnectTimeout\"",
",",
"globalTimeout",
")",
";",
"int",
"connectionRequestTimeout",
"=",
"readFromProperty",
"(",
"\"bdConnectionRequestTimeout\"",
",",
"globalTimeout",
")",
";",
"int",
"socketTimeout",
"=",
"readFromProperty",
"(",
"\"bdSocketTimeout\"",
",",
"globalTimeout",
")",
";",
"RequestConfig",
"requestConfig",
"=",
"RequestConfig",
".",
"copy",
"(",
"RequestConfig",
".",
"DEFAULT",
")",
".",
"setConnectTimeout",
"(",
"connectTimeout",
")",
".",
"setSocketTimeout",
"(",
"socketTimeout",
")",
".",
"setConnectionRequestTimeout",
"(",
"connectionRequestTimeout",
")",
".",
"build",
"(",
")",
";",
"// configure caching",
"CacheConfig",
"cacheConfig",
"=",
"CacheConfig",
".",
"copy",
"(",
"CacheConfig",
".",
"DEFAULT",
")",
".",
"setSharedCache",
"(",
"false",
")",
".",
"setMaxCacheEntries",
"(",
"1000",
")",
".",
"setMaxObjectSize",
"(",
"2",
"*",
"1024",
"*",
"1024",
")",
".",
"build",
"(",
")",
";",
"// configure connection pooling",
"PoolingHttpClientConnectionManager",
"connManager",
"=",
"new",
"PoolingHttpClientConnectionManager",
"(",
"RegistryBuilder",
".",
"<",
"ConnectionSocketFactory",
">",
"create",
"(",
")",
".",
"register",
"(",
"\"http\"",
",",
"PlainConnectionSocketFactory",
".",
"getSocketFactory",
"(",
")",
")",
".",
"register",
"(",
"\"https\"",
",",
"new",
"SSLConnectionSocketFactory",
"(",
"sslContext",
")",
")",
".",
"build",
"(",
")",
")",
";",
"int",
"connectionLimit",
"=",
"readFromProperty",
"(",
"\"bdMaxConnections\"",
",",
"40",
")",
";",
"// there's only one server to connect to, so max per route matters",
"connManager",
".",
"setMaxTotal",
"(",
"connectionLimit",
")",
";",
"connManager",
".",
"setDefaultMaxPerRoute",
"(",
"connectionLimit",
")",
";",
"// create the HTTP client",
"return",
"CachingHttpClientBuilder",
".",
"create",
"(",
")",
".",
"setCacheConfig",
"(",
"cacheConfig",
")",
".",
"setDefaultRequestConfig",
"(",
"requestConfig",
")",
".",
"setConnectionManager",
"(",
"connManager",
")",
".",
"build",
"(",
")",
";",
"}",
"catch",
"(",
"GeneralSecurityException",
"e",
")",
"{",
"throw",
"new",
"InternalConfigurationException",
"(",
"\"Failed to set up SSL context\"",
",",
"e",
")",
";",
"}",
"}"
] |
Builds the HTTP client to connect to the server.
@param trustSelfSigned <tt>true</tt> if the client should accept
self-signed certificates
@return a new client instance
|
[
"Builds",
"the",
"HTTP",
"client",
"to",
"connect",
"to",
"the",
"server",
"."
] |
1a732a57ebc825ddf47ce405723cc958adb1a43f
|
https://github.com/BellaDati/belladati-sdk-java/blob/1a732a57ebc825ddf47ce405723cc958adb1a43f/src/main/java/com/belladati/sdk/impl/BellaDatiClient.java#L94-L127
|
155,404
|
BellaDati/belladati-sdk-java
|
src/main/java/com/belladati/sdk/impl/BellaDatiClient.java
|
BellaDatiClient.buildException
|
private BellaDatiRuntimeException buildException(int code, byte[] content, boolean hasToken) {
try {
HttpParameters oauthParams = OAuth.decodeForm(new ByteArrayInputStream(content));
if (oauthParams.containsKey("oauth_problem")) {
String problem = oauthParams.getFirst("oauth_problem");
if ("missing_consumer".equals(problem) || "invalid_consumer".equals(problem)) {
return new AuthorizationException(Reason.CONSUMER_KEY_UNKNOWN);
} else if ("invalid_signature".equals(problem) || "signature_invalid".equals(problem)) {
return new AuthorizationException(hasToken ? Reason.TOKEN_INVALID : Reason.CONSUMER_SECRET_INVALID);
} else if ("domain_expired".equals(problem)) {
return new AuthorizationException(Reason.DOMAIN_EXPIRED);
} else if ("missing_token".equals(problem) || "invalid_token".equals(problem)) {
return new AuthorizationException(Reason.TOKEN_INVALID);
} else if ("unauthorized_token".equals(problem)) {
return new AuthorizationException(Reason.TOKEN_UNAUTHORIZED);
} else if ("token_expired".equals(problem)) {
return new AuthorizationException(Reason.TOKEN_EXPIRED);
} else if ("x_auth_disabled".equals(problem)) {
return new AuthorizationException(Reason.X_AUTH_DISABLED);
} else if ("piccolo_not_enabled".equals(problem)) {
return new AuthorizationException(Reason.BD_MOBILE_DISABLED);
} else if ("missing_username".equals(problem) || "missing_password".equals(problem)
|| "invalid_credentials".equals(problem) || "permission_denied".equals(problem)) {
return new AuthorizationException(Reason.USER_CREDENTIALS_INVALID);
} else if ("account_locked".equals(problem) || "user_not_active".equals(problem)) {
return new AuthorizationException(Reason.USER_ACCOUNT_LOCKED);
} else if ("domain_restricted".equals(problem)) {
return new AuthorizationException(Reason.USER_DOMAIN_MISMATCH);
} else if ("timestamp_refused".equals(problem)) {
String acceptable = oauthParams.getFirst("oauth_acceptable_timestamps");
if (acceptable != null && acceptable.contains("-")) {
return new InvalidTimestampException(Long.parseLong(acceptable.split("-")[0]),
Long.parseLong(acceptable.split("-")[1]));
}
}
return new AuthorizationException(Reason.OTHER, problem);
}
return new UnexpectedResponseException(code, new String(content));
} catch (IOException e) {
throw new UnexpectedResponseException(code, new String(content), e);
}
}
|
java
|
private BellaDatiRuntimeException buildException(int code, byte[] content, boolean hasToken) {
try {
HttpParameters oauthParams = OAuth.decodeForm(new ByteArrayInputStream(content));
if (oauthParams.containsKey("oauth_problem")) {
String problem = oauthParams.getFirst("oauth_problem");
if ("missing_consumer".equals(problem) || "invalid_consumer".equals(problem)) {
return new AuthorizationException(Reason.CONSUMER_KEY_UNKNOWN);
} else if ("invalid_signature".equals(problem) || "signature_invalid".equals(problem)) {
return new AuthorizationException(hasToken ? Reason.TOKEN_INVALID : Reason.CONSUMER_SECRET_INVALID);
} else if ("domain_expired".equals(problem)) {
return new AuthorizationException(Reason.DOMAIN_EXPIRED);
} else if ("missing_token".equals(problem) || "invalid_token".equals(problem)) {
return new AuthorizationException(Reason.TOKEN_INVALID);
} else if ("unauthorized_token".equals(problem)) {
return new AuthorizationException(Reason.TOKEN_UNAUTHORIZED);
} else if ("token_expired".equals(problem)) {
return new AuthorizationException(Reason.TOKEN_EXPIRED);
} else if ("x_auth_disabled".equals(problem)) {
return new AuthorizationException(Reason.X_AUTH_DISABLED);
} else if ("piccolo_not_enabled".equals(problem)) {
return new AuthorizationException(Reason.BD_MOBILE_DISABLED);
} else if ("missing_username".equals(problem) || "missing_password".equals(problem)
|| "invalid_credentials".equals(problem) || "permission_denied".equals(problem)) {
return new AuthorizationException(Reason.USER_CREDENTIALS_INVALID);
} else if ("account_locked".equals(problem) || "user_not_active".equals(problem)) {
return new AuthorizationException(Reason.USER_ACCOUNT_LOCKED);
} else if ("domain_restricted".equals(problem)) {
return new AuthorizationException(Reason.USER_DOMAIN_MISMATCH);
} else if ("timestamp_refused".equals(problem)) {
String acceptable = oauthParams.getFirst("oauth_acceptable_timestamps");
if (acceptable != null && acceptable.contains("-")) {
return new InvalidTimestampException(Long.parseLong(acceptable.split("-")[0]),
Long.parseLong(acceptable.split("-")[1]));
}
}
return new AuthorizationException(Reason.OTHER, problem);
}
return new UnexpectedResponseException(code, new String(content));
} catch (IOException e) {
throw new UnexpectedResponseException(code, new String(content), e);
}
}
|
[
"private",
"BellaDatiRuntimeException",
"buildException",
"(",
"int",
"code",
",",
"byte",
"[",
"]",
"content",
",",
"boolean",
"hasToken",
")",
"{",
"try",
"{",
"HttpParameters",
"oauthParams",
"=",
"OAuth",
".",
"decodeForm",
"(",
"new",
"ByteArrayInputStream",
"(",
"content",
")",
")",
";",
"if",
"(",
"oauthParams",
".",
"containsKey",
"(",
"\"oauth_problem\"",
")",
")",
"{",
"String",
"problem",
"=",
"oauthParams",
".",
"getFirst",
"(",
"\"oauth_problem\"",
")",
";",
"if",
"(",
"\"missing_consumer\"",
".",
"equals",
"(",
"problem",
")",
"||",
"\"invalid_consumer\"",
".",
"equals",
"(",
"problem",
")",
")",
"{",
"return",
"new",
"AuthorizationException",
"(",
"Reason",
".",
"CONSUMER_KEY_UNKNOWN",
")",
";",
"}",
"else",
"if",
"(",
"\"invalid_signature\"",
".",
"equals",
"(",
"problem",
")",
"||",
"\"signature_invalid\"",
".",
"equals",
"(",
"problem",
")",
")",
"{",
"return",
"new",
"AuthorizationException",
"(",
"hasToken",
"?",
"Reason",
".",
"TOKEN_INVALID",
":",
"Reason",
".",
"CONSUMER_SECRET_INVALID",
")",
";",
"}",
"else",
"if",
"(",
"\"domain_expired\"",
".",
"equals",
"(",
"problem",
")",
")",
"{",
"return",
"new",
"AuthorizationException",
"(",
"Reason",
".",
"DOMAIN_EXPIRED",
")",
";",
"}",
"else",
"if",
"(",
"\"missing_token\"",
".",
"equals",
"(",
"problem",
")",
"||",
"\"invalid_token\"",
".",
"equals",
"(",
"problem",
")",
")",
"{",
"return",
"new",
"AuthorizationException",
"(",
"Reason",
".",
"TOKEN_INVALID",
")",
";",
"}",
"else",
"if",
"(",
"\"unauthorized_token\"",
".",
"equals",
"(",
"problem",
")",
")",
"{",
"return",
"new",
"AuthorizationException",
"(",
"Reason",
".",
"TOKEN_UNAUTHORIZED",
")",
";",
"}",
"else",
"if",
"(",
"\"token_expired\"",
".",
"equals",
"(",
"problem",
")",
")",
"{",
"return",
"new",
"AuthorizationException",
"(",
"Reason",
".",
"TOKEN_EXPIRED",
")",
";",
"}",
"else",
"if",
"(",
"\"x_auth_disabled\"",
".",
"equals",
"(",
"problem",
")",
")",
"{",
"return",
"new",
"AuthorizationException",
"(",
"Reason",
".",
"X_AUTH_DISABLED",
")",
";",
"}",
"else",
"if",
"(",
"\"piccolo_not_enabled\"",
".",
"equals",
"(",
"problem",
")",
")",
"{",
"return",
"new",
"AuthorizationException",
"(",
"Reason",
".",
"BD_MOBILE_DISABLED",
")",
";",
"}",
"else",
"if",
"(",
"\"missing_username\"",
".",
"equals",
"(",
"problem",
")",
"||",
"\"missing_password\"",
".",
"equals",
"(",
"problem",
")",
"||",
"\"invalid_credentials\"",
".",
"equals",
"(",
"problem",
")",
"||",
"\"permission_denied\"",
".",
"equals",
"(",
"problem",
")",
")",
"{",
"return",
"new",
"AuthorizationException",
"(",
"Reason",
".",
"USER_CREDENTIALS_INVALID",
")",
";",
"}",
"else",
"if",
"(",
"\"account_locked\"",
".",
"equals",
"(",
"problem",
")",
"||",
"\"user_not_active\"",
".",
"equals",
"(",
"problem",
")",
")",
"{",
"return",
"new",
"AuthorizationException",
"(",
"Reason",
".",
"USER_ACCOUNT_LOCKED",
")",
";",
"}",
"else",
"if",
"(",
"\"domain_restricted\"",
".",
"equals",
"(",
"problem",
")",
")",
"{",
"return",
"new",
"AuthorizationException",
"(",
"Reason",
".",
"USER_DOMAIN_MISMATCH",
")",
";",
"}",
"else",
"if",
"(",
"\"timestamp_refused\"",
".",
"equals",
"(",
"problem",
")",
")",
"{",
"String",
"acceptable",
"=",
"oauthParams",
".",
"getFirst",
"(",
"\"oauth_acceptable_timestamps\"",
")",
";",
"if",
"(",
"acceptable",
"!=",
"null",
"&&",
"acceptable",
".",
"contains",
"(",
"\"-\"",
")",
")",
"{",
"return",
"new",
"InvalidTimestampException",
"(",
"Long",
".",
"parseLong",
"(",
"acceptable",
".",
"split",
"(",
"\"-\"",
")",
"[",
"0",
"]",
")",
",",
"Long",
".",
"parseLong",
"(",
"acceptable",
".",
"split",
"(",
"\"-\"",
")",
"[",
"1",
"]",
")",
")",
";",
"}",
"}",
"return",
"new",
"AuthorizationException",
"(",
"Reason",
".",
"OTHER",
",",
"problem",
")",
";",
"}",
"return",
"new",
"UnexpectedResponseException",
"(",
"code",
",",
"new",
"String",
"(",
"content",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"UnexpectedResponseException",
"(",
"code",
",",
"new",
"String",
"(",
"content",
")",
",",
"e",
")",
";",
"}",
"}"
] |
Builds an exception based on the given content, assuming that it has been
returned as an error from the server.
@param code response code returned by the server
@param content content returned by the server
@param hasToken <tt>true</tt> if the request was made using a request or
access token
@return an exception to throw for the given content
|
[
"Builds",
"an",
"exception",
"based",
"on",
"the",
"given",
"content",
"assuming",
"that",
"it",
"has",
"been",
"returned",
"as",
"an",
"error",
"from",
"the",
"server",
"."
] |
1a732a57ebc825ddf47ce405723cc958adb1a43f
|
https://github.com/BellaDati/belladati-sdk-java/blob/1a732a57ebc825ddf47ce405723cc958adb1a43f/src/main/java/com/belladati/sdk/impl/BellaDatiClient.java#L352-L394
|
155,405
|
BellaDati/belladati-sdk-java
|
src/main/java/com/belladati/sdk/impl/BellaDatiClient.java
|
BellaDatiClient.readObject
|
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
try {
Field client = getClass().getDeclaredField("client");
client.setAccessible(true);
client.set(this, buildClient(trustSelfSigned));
} catch (NoSuchFieldException e) {
throw new InternalConfigurationException("Failed to set client fields", e);
} catch (IllegalAccessException e) {
throw new InternalConfigurationException("Failed to set client fields", e);
} catch (SecurityException e) {
throw new InternalConfigurationException("Failed to set client fields", e);
} catch (IllegalArgumentException e) {
throw new InternalConfigurationException("Failed to set client fields", e);
}
}
|
java
|
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
try {
Field client = getClass().getDeclaredField("client");
client.setAccessible(true);
client.set(this, buildClient(trustSelfSigned));
} catch (NoSuchFieldException e) {
throw new InternalConfigurationException("Failed to set client fields", e);
} catch (IllegalAccessException e) {
throw new InternalConfigurationException("Failed to set client fields", e);
} catch (SecurityException e) {
throw new InternalConfigurationException("Failed to set client fields", e);
} catch (IllegalArgumentException e) {
throw new InternalConfigurationException("Failed to set client fields", e);
}
}
|
[
"private",
"void",
"readObject",
"(",
"ObjectInputStream",
"in",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"in",
".",
"defaultReadObject",
"(",
")",
";",
"try",
"{",
"Field",
"client",
"=",
"getClass",
"(",
")",
".",
"getDeclaredField",
"(",
"\"client\"",
")",
";",
"client",
".",
"setAccessible",
"(",
"true",
")",
";",
"client",
".",
"set",
"(",
"this",
",",
"buildClient",
"(",
"trustSelfSigned",
")",
")",
";",
"}",
"catch",
"(",
"NoSuchFieldException",
"e",
")",
"{",
"throw",
"new",
"InternalConfigurationException",
"(",
"\"Failed to set client fields\"",
",",
"e",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"e",
")",
"{",
"throw",
"new",
"InternalConfigurationException",
"(",
"\"Failed to set client fields\"",
",",
"e",
")",
";",
"}",
"catch",
"(",
"SecurityException",
"e",
")",
"{",
"throw",
"new",
"InternalConfigurationException",
"(",
"\"Failed to set client fields\"",
",",
"e",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
"{",
"throw",
"new",
"InternalConfigurationException",
"(",
"\"Failed to set client fields\"",
",",
"e",
")",
";",
"}",
"}"
] |
Deserialization. Sets up an HTTP client instance.
@param in Input stream of object to be de-serialized
@throws IOException Thrown if IO error occurs during class reading
@throws ClassNotFoundException Thrown if desired class does not exist
|
[
"Deserialization",
".",
"Sets",
"up",
"an",
"HTTP",
"client",
"instance",
"."
] |
1a732a57ebc825ddf47ce405723cc958adb1a43f
|
https://github.com/BellaDati/belladati-sdk-java/blob/1a732a57ebc825ddf47ce405723cc958adb1a43f/src/main/java/com/belladati/sdk/impl/BellaDatiClient.java#L413-L428
|
155,406
|
foundation-runtime/service-directory
|
1.2/sd-api/src/main/java/com/cisco/oss/foundation/directory/registration/DirectoryRegistrationService.java
|
DirectoryRegistrationService.registerService
|
public void registerService(ProvidedServiceInstance serviceInstance,
OperationalStatus status) {
serviceInstance.setStatus(status);
registerService(serviceInstance);
}
|
java
|
public void registerService(ProvidedServiceInstance serviceInstance,
OperationalStatus status) {
serviceInstance.setStatus(status);
registerService(serviceInstance);
}
|
[
"public",
"void",
"registerService",
"(",
"ProvidedServiceInstance",
"serviceInstance",
",",
"OperationalStatus",
"status",
")",
"{",
"serviceInstance",
".",
"setStatus",
"(",
"status",
")",
";",
"registerService",
"(",
"serviceInstance",
")",
";",
"}"
] |
Register a ProvidedServiceInstance with the OperationalStatus.
@param serviceInstance
the ProvidedServiceInstance.
@param status
the OperationalStatus of the ProvidedServiceInstance.
|
[
"Register",
"a",
"ProvidedServiceInstance",
"with",
"the",
"OperationalStatus",
"."
] |
a7bdefe173dc99e75eff4a24e07e6407e62f2ed4
|
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/1.2/sd-api/src/main/java/com/cisco/oss/foundation/directory/registration/DirectoryRegistrationService.java#L96-L101
|
155,407
|
foundation-runtime/service-directory
|
1.2/sd-api/src/main/java/com/cisco/oss/foundation/directory/registration/DirectoryRegistrationService.java
|
DirectoryRegistrationService.updateServiceUri
|
public void updateServiceUri(String serviceName, String providerAddress,
String uri) {
getServiceDirectoryClient().updateInstanceUri(serviceName, providerAddress,
uri, disableOwnerError);
}
|
java
|
public void updateServiceUri(String serviceName, String providerAddress,
String uri) {
getServiceDirectoryClient().updateInstanceUri(serviceName, providerAddress,
uri, disableOwnerError);
}
|
[
"public",
"void",
"updateServiceUri",
"(",
"String",
"serviceName",
",",
"String",
"providerAddress",
",",
"String",
"uri",
")",
"{",
"getServiceDirectoryClient",
"(",
")",
".",
"updateInstanceUri",
"(",
"serviceName",
",",
"providerAddress",
",",
"uri",
",",
"disableOwnerError",
")",
";",
"}"
] |
Update the uri attribute of the ProvidedServiceInstance
The ProvidedServiceInstance is uniquely identified by serviceName and providerAddress
@param serviceName
the serviceName of the ProvidedServiceInstance.
@param providerAddress
the providerAddress of the ProvidedServiceInstance.
@param uri
the new uri.
|
[
"Update",
"the",
"uri",
"attribute",
"of",
"the",
"ProvidedServiceInstance",
"The",
"ProvidedServiceInstance",
"is",
"uniquely",
"identified",
"by",
"serviceName",
"and",
"providerAddress"
] |
a7bdefe173dc99e75eff4a24e07e6407e62f2ed4
|
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/1.2/sd-api/src/main/java/com/cisco/oss/foundation/directory/registration/DirectoryRegistrationService.java#L130-L134
|
155,408
|
foundation-runtime/service-directory
|
1.2/sd-api/src/main/java/com/cisco/oss/foundation/directory/registration/DirectoryRegistrationService.java
|
DirectoryRegistrationService.updateServiceOperationalStatus
|
public void updateServiceOperationalStatus(String serviceName,
String providerAddress, OperationalStatus status) {
getServiceDirectoryClient().updateInstanceStatus(serviceName,
providerAddress, status, disableOwnerError);
}
|
java
|
public void updateServiceOperationalStatus(String serviceName,
String providerAddress, OperationalStatus status) {
getServiceDirectoryClient().updateInstanceStatus(serviceName,
providerAddress, status, disableOwnerError);
}
|
[
"public",
"void",
"updateServiceOperationalStatus",
"(",
"String",
"serviceName",
",",
"String",
"providerAddress",
",",
"OperationalStatus",
"status",
")",
"{",
"getServiceDirectoryClient",
"(",
")",
".",
"updateInstanceStatus",
"(",
"serviceName",
",",
"providerAddress",
",",
"status",
",",
"disableOwnerError",
")",
";",
"}"
] |
Update the OperationalStatus of the ProvidedServiceInstance
The ProvidedServiceInstance is uniquely identified by serviceName and providerAddress
@param serviceName
the serviceName of the ProvidedServiceInstance.
@param providerAddress
the providerAddress of the ProvidedServiceInstance.
@param status
the new OperationalStatus of the ProvidedServiceInstance.
|
[
"Update",
"the",
"OperationalStatus",
"of",
"the",
"ProvidedServiceInstance",
"The",
"ProvidedServiceInstance",
"is",
"uniquely",
"identified",
"by",
"serviceName",
"and",
"providerAddress"
] |
a7bdefe173dc99e75eff4a24e07e6407e62f2ed4
|
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/1.2/sd-api/src/main/java/com/cisco/oss/foundation/directory/registration/DirectoryRegistrationService.java#L147-L152
|
155,409
|
foundation-runtime/service-directory
|
1.2/sd-api/src/main/java/com/cisco/oss/foundation/directory/registration/DirectoryRegistrationService.java
|
DirectoryRegistrationService.updateServiceMetadata
|
public void updateServiceMetadata(String serviceName, String providerAddress,
Map<String, String> metadata) {
getServiceDirectoryClient().updateInstanceMetadata(serviceName, providerAddress,
metadata, disableOwnerError);
}
|
java
|
public void updateServiceMetadata(String serviceName, String providerAddress,
Map<String, String> metadata) {
getServiceDirectoryClient().updateInstanceMetadata(serviceName, providerAddress,
metadata, disableOwnerError);
}
|
[
"public",
"void",
"updateServiceMetadata",
"(",
"String",
"serviceName",
",",
"String",
"providerAddress",
",",
"Map",
"<",
"String",
",",
"String",
">",
"metadata",
")",
"{",
"getServiceDirectoryClient",
"(",
")",
".",
"updateInstanceMetadata",
"(",
"serviceName",
",",
"providerAddress",
",",
"metadata",
",",
"disableOwnerError",
")",
";",
"}"
] |
Update the metadata attribute of the ProvidedServiceInstance
The ProvidedServiceInstance is uniquely identified by serviceName and providerAddress
@param serviceName
the serviceName of the ProvidedServiceInstance.
@param providerAddress
The IP address or FQDN that the instance is running on.
@param metadata
the meta data.
|
[
"Update",
"the",
"metadata",
"attribute",
"of",
"the",
"ProvidedServiceInstance",
"The",
"ProvidedServiceInstance",
"is",
"uniquely",
"identified",
"by",
"serviceName",
"and",
"providerAddress"
] |
a7bdefe173dc99e75eff4a24e07e6407e62f2ed4
|
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/1.2/sd-api/src/main/java/com/cisco/oss/foundation/directory/registration/DirectoryRegistrationService.java#L167-L171
|
155,410
|
foundation-runtime/service-directory
|
1.2/sd-api/src/main/java/com/cisco/oss/foundation/directory/registration/DirectoryRegistrationService.java
|
DirectoryRegistrationService.unregisterService
|
public void unregisterService(String serviceName, String providerAddress) {
getServiceDirectoryClient().unregisterInstance(serviceName, providerAddress, disableOwnerError);
}
|
java
|
public void unregisterService(String serviceName, String providerAddress) {
getServiceDirectoryClient().unregisterInstance(serviceName, providerAddress, disableOwnerError);
}
|
[
"public",
"void",
"unregisterService",
"(",
"String",
"serviceName",
",",
"String",
"providerAddress",
")",
"{",
"getServiceDirectoryClient",
"(",
")",
".",
"unregisterInstance",
"(",
"serviceName",
",",
"providerAddress",
",",
"disableOwnerError",
")",
";",
"}"
] |
Unregister a ProvidedServiceInstance
The ProvidedServiceInstance is uniquely identified by serviceName and providerAddress
@param serviceName
the serviceName of ProvidedServiceInstance.
@param providerAddress
the provierAddress of ProvidedServiceInstance.
|
[
"Unregister",
"a",
"ProvidedServiceInstance",
"The",
"ProvidedServiceInstance",
"is",
"uniquely",
"identified",
"by",
"serviceName",
"and",
"providerAddress"
] |
a7bdefe173dc99e75eff4a24e07e6407e62f2ed4
|
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/1.2/sd-api/src/main/java/com/cisco/oss/foundation/directory/registration/DirectoryRegistrationService.java#L195-L197
|
155,411
|
konvergeio/cofoja
|
src/main/java/com/google/java/contract/core/apt/ContractJavaCompiler.java
|
ContractJavaCompiler.getTask
|
@Requires({
"files != null",
"diagnostics != null"
})
@Ensures("result != null")
public CompilationTask getTask(List<? extends JavaFileObject> files,
DiagnosticListener<JavaFileObject> diagnostics) {
return javaCompiler.getTask(null, fileManager, diagnostics,
OPTIONS, null, files);
}
|
java
|
@Requires({
"files != null",
"diagnostics != null"
})
@Ensures("result != null")
public CompilationTask getTask(List<? extends JavaFileObject> files,
DiagnosticListener<JavaFileObject> diagnostics) {
return javaCompiler.getTask(null, fileManager, diagnostics,
OPTIONS, null, files);
}
|
[
"@",
"Requires",
"(",
"{",
"\"files != null\"",
",",
"\"diagnostics != null\"",
"}",
")",
"@",
"Ensures",
"(",
"\"result != null\"",
")",
"public",
"CompilationTask",
"getTask",
"(",
"List",
"<",
"?",
"extends",
"JavaFileObject",
">",
"files",
",",
"DiagnosticListener",
"<",
"JavaFileObject",
">",
"diagnostics",
")",
"{",
"return",
"javaCompiler",
".",
"getTask",
"(",
"null",
",",
"fileManager",
",",
"diagnostics",
",",
"OPTIONS",
",",
"null",
",",
"files",
")",
";",
"}"
] |
Returns a new compilation task.
|
[
"Returns",
"a",
"new",
"compilation",
"task",
"."
] |
6ded58fa05eb5bf85f16353c8dd4c70bee59121a
|
https://github.com/konvergeio/cofoja/blob/6ded58fa05eb5bf85f16353c8dd4c70bee59121a/src/main/java/com/google/java/contract/core/apt/ContractJavaCompiler.java#L93-L102
|
155,412
|
pip-services3-java/pip-services3-commons-java
|
src/org/pipservices3/commons/run/Executor.java
|
Executor.executeOne
|
public static Object executeOne(String correlationId, Object component, Parameters args)
throws ApplicationException {
if (component instanceof IExecutable)
return ((IExecutable) component).execute(correlationId, args);
else
return null;
}
|
java
|
public static Object executeOne(String correlationId, Object component, Parameters args)
throws ApplicationException {
if (component instanceof IExecutable)
return ((IExecutable) component).execute(correlationId, args);
else
return null;
}
|
[
"public",
"static",
"Object",
"executeOne",
"(",
"String",
"correlationId",
",",
"Object",
"component",
",",
"Parameters",
"args",
")",
"throws",
"ApplicationException",
"{",
"if",
"(",
"component",
"instanceof",
"IExecutable",
")",
"return",
"(",
"(",
"IExecutable",
")",
"component",
")",
".",
"execute",
"(",
"correlationId",
",",
"args",
")",
";",
"else",
"return",
"null",
";",
"}"
] |
Executes specific component.
To be executed components must implement IExecutable interface. If they don't
the call to this method has no effect.
@param correlationId (optional) transaction id to trace execution through
call chain.
@param component the component that is to be executed.
@param args execution arguments.
@return execution result.
@throws ApplicationException when errors occured.
@see IExecutable
@see Parameters
|
[
"Executes",
"specific",
"component",
"."
] |
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
|
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/run/Executor.java#L29-L36
|
155,413
|
pip-services3-java/pip-services3-commons-java
|
src/org/pipservices3/commons/run/Executor.java
|
Executor.execute
|
public static List<Object> execute(String correlationId, Iterable<Object> components, Parameters args)
throws ApplicationException {
List<Object> results = new ArrayList<Object>();
if (components == null)
return results;
for (Object component : components) {
if (component instanceof IExecutable)
results.add(executeOne(correlationId, component, args));
}
return results;
}
|
java
|
public static List<Object> execute(String correlationId, Iterable<Object> components, Parameters args)
throws ApplicationException {
List<Object> results = new ArrayList<Object>();
if (components == null)
return results;
for (Object component : components) {
if (component instanceof IExecutable)
results.add(executeOne(correlationId, component, args));
}
return results;
}
|
[
"public",
"static",
"List",
"<",
"Object",
">",
"execute",
"(",
"String",
"correlationId",
",",
"Iterable",
"<",
"Object",
">",
"components",
",",
"Parameters",
"args",
")",
"throws",
"ApplicationException",
"{",
"List",
"<",
"Object",
">",
"results",
"=",
"new",
"ArrayList",
"<",
"Object",
">",
"(",
")",
";",
"if",
"(",
"components",
"==",
"null",
")",
"return",
"results",
";",
"for",
"(",
"Object",
"component",
":",
"components",
")",
"{",
"if",
"(",
"component",
"instanceof",
"IExecutable",
")",
"results",
".",
"add",
"(",
"executeOne",
"(",
"correlationId",
",",
"component",
",",
"args",
")",
")",
";",
"}",
"return",
"results",
";",
"}"
] |
Executes multiple components.
To be executed components must implement IExecutable interface. If they don't
the call to this method has no effect.
@param correlationId (optional) transaction id to trace execution through
call chain.
@param components a list of components that are to be executed.
@param args execution arguments.
@return execution result.
@throws ApplicationException when errors occured.
@see #executeOne(String, Object, Parameters)
@see IExecutable
@see Parameters
|
[
"Executes",
"multiple",
"components",
"."
] |
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
|
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/run/Executor.java#L55-L68
|
155,414
|
rainu/dbc
|
src/main/java/de/raysha/lib/dbc/meta/MetadataManager.java
|
MetadataManager.getTableMetadata
|
public TableMetadata getTableMetadata(String tableName){
if(tableName == null) return null;
try {
tableMetadataStatement.setInt(1, tableName.hashCode());
ResultSet set = tableMetadataStatement.executeQuery();
return transformToTableMetadata(set);
} catch (SQLException e) {
throw new BackendException("Could not get TableMetadata for table '" + tableName + "'", e);
}
}
|
java
|
public TableMetadata getTableMetadata(String tableName){
if(tableName == null) return null;
try {
tableMetadataStatement.setInt(1, tableName.hashCode());
ResultSet set = tableMetadataStatement.executeQuery();
return transformToTableMetadata(set);
} catch (SQLException e) {
throw new BackendException("Could not get TableMetadata for table '" + tableName + "'", e);
}
}
|
[
"public",
"TableMetadata",
"getTableMetadata",
"(",
"String",
"tableName",
")",
"{",
"if",
"(",
"tableName",
"==",
"null",
")",
"return",
"null",
";",
"try",
"{",
"tableMetadataStatement",
".",
"setInt",
"(",
"1",
",",
"tableName",
".",
"hashCode",
"(",
")",
")",
";",
"ResultSet",
"set",
"=",
"tableMetadataStatement",
".",
"executeQuery",
"(",
")",
";",
"return",
"transformToTableMetadata",
"(",
"set",
")",
";",
"}",
"catch",
"(",
"SQLException",
"e",
")",
"{",
"throw",
"new",
"BackendException",
"(",
"\"Could not get TableMetadata for table '\"",
"+",
"tableName",
"+",
"\"'\"",
",",
"e",
")",
";",
"}",
"}"
] |
Liefert die Metadaten der gegebenen Tabelle.
@param tableName Name der Tabelle, deren Metadaten ermitetelt werden soll.
@return <b>Null</b> wenn keine Daten gefunden werden konnten. ANdernfals die entsprechenden Metadaten.
|
[
"Liefert",
"die",
"Metadaten",
"der",
"gegebenen",
"Tabelle",
"."
] |
bdf1d1945ccaa8db8ed0b91bd08d5ef9802777f7
|
https://github.com/rainu/dbc/blob/bdf1d1945ccaa8db8ed0b91bd08d5ef9802777f7/src/main/java/de/raysha/lib/dbc/meta/MetadataManager.java#L87-L98
|
155,415
|
rainu/dbc
|
src/main/java/de/raysha/lib/dbc/meta/MetadataManager.java
|
MetadataManager.updateMetadata
|
public void updateMetadata(String tableName, String metadata){
try {
updateStatement.setString(1, metadata);
updateStatement.setLong(2, tableName.hashCode());
updateStatement.executeUpdate();
} catch (SQLException e) {
throw new BackendException("Could not update metadata for table '" + tableName + "'", e);
}
}
|
java
|
public void updateMetadata(String tableName, String metadata){
try {
updateStatement.setString(1, metadata);
updateStatement.setLong(2, tableName.hashCode());
updateStatement.executeUpdate();
} catch (SQLException e) {
throw new BackendException("Could not update metadata for table '" + tableName + "'", e);
}
}
|
[
"public",
"void",
"updateMetadata",
"(",
"String",
"tableName",
",",
"String",
"metadata",
")",
"{",
"try",
"{",
"updateStatement",
".",
"setString",
"(",
"1",
",",
"metadata",
")",
";",
"updateStatement",
".",
"setLong",
"(",
"2",
",",
"tableName",
".",
"hashCode",
"(",
")",
")",
";",
"updateStatement",
".",
"executeUpdate",
"(",
")",
";",
"}",
"catch",
"(",
"SQLException",
"e",
")",
"{",
"throw",
"new",
"BackendException",
"(",
"\"Could not update metadata for table '\"",
"+",
"tableName",
"+",
"\"'\"",
",",
"e",
")",
";",
"}",
"}"
] |
Aktualisiert die Metadaten eines Eintrages.
@param tableName Name der Tabelle
@param metadata Metadaten die eingetragen werden sollen.
|
[
"Aktualisiert",
"die",
"Metadaten",
"eines",
"Eintrages",
"."
] |
bdf1d1945ccaa8db8ed0b91bd08d5ef9802777f7
|
https://github.com/rainu/dbc/blob/bdf1d1945ccaa8db8ed0b91bd08d5ef9802777f7/src/main/java/de/raysha/lib/dbc/meta/MetadataManager.java#L159-L167
|
155,416
|
JM-Lab/utils-java8
|
src/main/java/kr/jm/utils/JMIconFactory.java
|
JMIconFactory.buildBufferedImageOfIconInOS
|
public BufferedImage buildBufferedImageOfIconInOS(Path path) {
path = JMOptional
.getNullableAndFilteredOptional(path, JMPath.NotExistFilter)
.flatMap(JMPathOperation::createTempFilePathAsOpt).orElse(path);
Icon iconInOS = os.getIcon(path.toFile());
BufferedImage bufferedImage = new BufferedImage(iconInOS.getIconWidth(),
iconInOS.getIconHeight(), BufferedImage.TYPE_INT_ARGB);
iconInOS.paintIcon(null, bufferedImage.getGraphics(), 0, 0);
return bufferedImage;
}
|
java
|
public BufferedImage buildBufferedImageOfIconInOS(Path path) {
path = JMOptional
.getNullableAndFilteredOptional(path, JMPath.NotExistFilter)
.flatMap(JMPathOperation::createTempFilePathAsOpt).orElse(path);
Icon iconInOS = os.getIcon(path.toFile());
BufferedImage bufferedImage = new BufferedImage(iconInOS.getIconWidth(),
iconInOS.getIconHeight(), BufferedImage.TYPE_INT_ARGB);
iconInOS.paintIcon(null, bufferedImage.getGraphics(), 0, 0);
return bufferedImage;
}
|
[
"public",
"BufferedImage",
"buildBufferedImageOfIconInOS",
"(",
"Path",
"path",
")",
"{",
"path",
"=",
"JMOptional",
".",
"getNullableAndFilteredOptional",
"(",
"path",
",",
"JMPath",
".",
"NotExistFilter",
")",
".",
"flatMap",
"(",
"JMPathOperation",
"::",
"createTempFilePathAsOpt",
")",
".",
"orElse",
"(",
"path",
")",
";",
"Icon",
"iconInOS",
"=",
"os",
".",
"getIcon",
"(",
"path",
".",
"toFile",
"(",
")",
")",
";",
"BufferedImage",
"bufferedImage",
"=",
"new",
"BufferedImage",
"(",
"iconInOS",
".",
"getIconWidth",
"(",
")",
",",
"iconInOS",
".",
"getIconHeight",
"(",
")",
",",
"BufferedImage",
".",
"TYPE_INT_ARGB",
")",
";",
"iconInOS",
".",
"paintIcon",
"(",
"null",
",",
"bufferedImage",
".",
"getGraphics",
"(",
")",
",",
"0",
",",
"0",
")",
";",
"return",
"bufferedImage",
";",
"}"
] |
Build buffered image of icon in os buffered image.
@param path the path
@return the buffered image
|
[
"Build",
"buffered",
"image",
"of",
"icon",
"in",
"os",
"buffered",
"image",
"."
] |
9e407b3f28a7990418a1e877229fa8344f4d78a5
|
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/JMIconFactory.java#L61-L70
|
155,417
|
JM-Lab/utils-java8
|
src/main/java/kr/jm/utils/JMIconFactory.java
|
JMIconFactory.getCachedBufferedImageOfIconInOS
|
public BufferedImage getCachedBufferedImageOfIconInOS(Path path) {
return getSpecialPathAsOpt(path)
.map(getCachedBufferedImageFunction(path))
.orElseGet(() -> buildCachedBufferedImageOfFileIconInOS(path));
}
|
java
|
public BufferedImage getCachedBufferedImageOfIconInOS(Path path) {
return getSpecialPathAsOpt(path)
.map(getCachedBufferedImageFunction(path))
.orElseGet(() -> buildCachedBufferedImageOfFileIconInOS(path));
}
|
[
"public",
"BufferedImage",
"getCachedBufferedImageOfIconInOS",
"(",
"Path",
"path",
")",
"{",
"return",
"getSpecialPathAsOpt",
"(",
"path",
")",
".",
"map",
"(",
"getCachedBufferedImageFunction",
"(",
"path",
")",
")",
".",
"orElseGet",
"(",
"(",
")",
"->",
"buildCachedBufferedImageOfFileIconInOS",
"(",
"path",
")",
")",
";",
"}"
] |
Gets cached buffered image of icon in os.
@param path the path
@return the cached buffered image of icon in os
|
[
"Gets",
"cached",
"buffered",
"image",
"of",
"icon",
"in",
"os",
"."
] |
9e407b3f28a7990418a1e877229fa8344f4d78a5
|
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/JMIconFactory.java#L78-L82
|
155,418
|
james-hu/jabb-core
|
src/main/java/net/sf/jabb/cache/AbstractCachedKeyValueRepositoriesNotifier.java
|
AbstractCachedKeyValueRepositoriesNotifier.onChange
|
public void onChange(String valueScope, Object key){
notifyLocalRepositories(valueScope, key);
notifyRemoteRepositories(valueScope, key);
}
|
java
|
public void onChange(String valueScope, Object key){
notifyLocalRepositories(valueScope, key);
notifyRemoteRepositories(valueScope, key);
}
|
[
"public",
"void",
"onChange",
"(",
"String",
"valueScope",
",",
"Object",
"key",
")",
"{",
"notifyLocalRepositories",
"(",
"valueScope",
",",
"key",
")",
";",
"notifyRemoteRepositories",
"(",
"valueScope",
",",
"key",
")",
";",
"}"
] |
Notify both local and remote repositories about the value change
@param valueScope value scope
@param key the key
|
[
"Notify",
"both",
"local",
"and",
"remote",
"repositories",
"about",
"the",
"value",
"change"
] |
bceed441595c5e5195a7418795f03b69fa7b61e4
|
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/cache/AbstractCachedKeyValueRepositoriesNotifier.java#L31-L34
|
155,419
|
morimekta/utils
|
config-util/src/main/java/net/morimekta/config/format/PropertiesConfigParser.java
|
PropertiesConfigParser.parse
|
public static Config parse(Properties properties) {
ConfigBuilder config = new SimpleConfig();
for (Object o : new TreeSet<>(properties.keySet())) {
String key = o.toString();
if (isPositional(key)) {
String entryKey = entryKey(key);
if (config.containsKey(entryKey)) {
config.getCollection(entryKey).add(properties.getProperty(key));
} else {
ArrayList<Object> sequence = new ArrayList<>();
sequence.add(properties.getProperty(key));
config.putCollection(entryKey, sequence);
}
} else {
config.put(key, properties.getProperty(key));
}
}
return ImmutableConfig.copyOf(config);
}
|
java
|
public static Config parse(Properties properties) {
ConfigBuilder config = new SimpleConfig();
for (Object o : new TreeSet<>(properties.keySet())) {
String key = o.toString();
if (isPositional(key)) {
String entryKey = entryKey(key);
if (config.containsKey(entryKey)) {
config.getCollection(entryKey).add(properties.getProperty(key));
} else {
ArrayList<Object> sequence = new ArrayList<>();
sequence.add(properties.getProperty(key));
config.putCollection(entryKey, sequence);
}
} else {
config.put(key, properties.getProperty(key));
}
}
return ImmutableConfig.copyOf(config);
}
|
[
"public",
"static",
"Config",
"parse",
"(",
"Properties",
"properties",
")",
"{",
"ConfigBuilder",
"config",
"=",
"new",
"SimpleConfig",
"(",
")",
";",
"for",
"(",
"Object",
"o",
":",
"new",
"TreeSet",
"<>",
"(",
"properties",
".",
"keySet",
"(",
")",
")",
")",
"{",
"String",
"key",
"=",
"o",
".",
"toString",
"(",
")",
";",
"if",
"(",
"isPositional",
"(",
"key",
")",
")",
"{",
"String",
"entryKey",
"=",
"entryKey",
"(",
"key",
")",
";",
"if",
"(",
"config",
".",
"containsKey",
"(",
"entryKey",
")",
")",
"{",
"config",
".",
"getCollection",
"(",
"entryKey",
")",
".",
"add",
"(",
"properties",
".",
"getProperty",
"(",
"key",
")",
")",
";",
"}",
"else",
"{",
"ArrayList",
"<",
"Object",
">",
"sequence",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"sequence",
".",
"add",
"(",
"properties",
".",
"getProperty",
"(",
"key",
")",
")",
";",
"config",
".",
"putCollection",
"(",
"entryKey",
",",
"sequence",
")",
";",
"}",
"}",
"else",
"{",
"config",
".",
"put",
"(",
"key",
",",
"properties",
".",
"getProperty",
"(",
"key",
")",
")",
";",
"}",
"}",
"return",
"ImmutableConfig",
".",
"copyOf",
"(",
"config",
")",
";",
"}"
] |
Parse the properties instance into a config.
@param properties The properties to parse.
@return The config instance.
|
[
"Parse",
"the",
"properties",
"instance",
"into",
"a",
"config",
"."
] |
dc987485902f1a7d58169c89c61db97425a6226d
|
https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/config-util/src/main/java/net/morimekta/config/format/PropertiesConfigParser.java#L56-L74
|
155,420
|
james-hu/jabb-core
|
src/main/java/net/sf/jabb/cjtsd/PlainCJTSD.java
|
PlainCJTSD.toRawList
|
public List<RawEntry> toRawList(){
if (t == null || t.size() == 0){
return Collections.emptyList();
}
List<RawEntry> result = new ArrayList<RawEntry>(t.size());
int lastDuration = 0;
for (int i = 0; i < t.size(); i ++){
long timestamp = t.get(i);
int duration = -1;
if (i < d.size()){
duration = d.get(i);
}
if (duration == -1){
duration = lastDuration;
}
lastDuration = duration;
long timestampMillis;
long durationMillis;
if (u == null || u.equals("m")){
timestampMillis = 1000L * 60 * timestamp;
durationMillis = 1000L * 60 * duration;
}else if (u.equals("s")){
timestampMillis = 1000L * timestamp;
durationMillis = 1000L * duration;
}else if (u.equals("S")){
timestampMillis = timestamp;
durationMillis = duration;
}else{
throw new IllegalArgumentException("Unit not supported: " + u);
}
result.add(new RawEntry(timestampMillis, durationMillis,
c == null || i >= c.size() ? null : c.get(i),
s == null || i >= s.size() ? null : s.get(i),
a == null || i >= a.size() ? null : a.get(i),
m == null || i >= m.size() ? null : m.get(i),
x == null || i >= x.size() ? null : x.get(i),
n == null || i >= n.size() ? null : n.get(i),
o == null || i >= o.size() ? null : o.get(i)
));
}
return result;
}
|
java
|
public List<RawEntry> toRawList(){
if (t == null || t.size() == 0){
return Collections.emptyList();
}
List<RawEntry> result = new ArrayList<RawEntry>(t.size());
int lastDuration = 0;
for (int i = 0; i < t.size(); i ++){
long timestamp = t.get(i);
int duration = -1;
if (i < d.size()){
duration = d.get(i);
}
if (duration == -1){
duration = lastDuration;
}
lastDuration = duration;
long timestampMillis;
long durationMillis;
if (u == null || u.equals("m")){
timestampMillis = 1000L * 60 * timestamp;
durationMillis = 1000L * 60 * duration;
}else if (u.equals("s")){
timestampMillis = 1000L * timestamp;
durationMillis = 1000L * duration;
}else if (u.equals("S")){
timestampMillis = timestamp;
durationMillis = duration;
}else{
throw new IllegalArgumentException("Unit not supported: " + u);
}
result.add(new RawEntry(timestampMillis, durationMillis,
c == null || i >= c.size() ? null : c.get(i),
s == null || i >= s.size() ? null : s.get(i),
a == null || i >= a.size() ? null : a.get(i),
m == null || i >= m.size() ? null : m.get(i),
x == null || i >= x.size() ? null : x.get(i),
n == null || i >= n.size() ? null : n.get(i),
o == null || i >= o.size() ? null : o.get(i)
));
}
return result;
}
|
[
"public",
"List",
"<",
"RawEntry",
">",
"toRawList",
"(",
")",
"{",
"if",
"(",
"t",
"==",
"null",
"||",
"t",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"}",
"List",
"<",
"RawEntry",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"RawEntry",
">",
"(",
"t",
".",
"size",
"(",
")",
")",
";",
"int",
"lastDuration",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"t",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"long",
"timestamp",
"=",
"t",
".",
"get",
"(",
"i",
")",
";",
"int",
"duration",
"=",
"-",
"1",
";",
"if",
"(",
"i",
"<",
"d",
".",
"size",
"(",
")",
")",
"{",
"duration",
"=",
"d",
".",
"get",
"(",
"i",
")",
";",
"}",
"if",
"(",
"duration",
"==",
"-",
"1",
")",
"{",
"duration",
"=",
"lastDuration",
";",
"}",
"lastDuration",
"=",
"duration",
";",
"long",
"timestampMillis",
";",
"long",
"durationMillis",
";",
"if",
"(",
"u",
"==",
"null",
"||",
"u",
".",
"equals",
"(",
"\"m\"",
")",
")",
"{",
"timestampMillis",
"=",
"1000L",
"*",
"60",
"*",
"timestamp",
";",
"durationMillis",
"=",
"1000L",
"*",
"60",
"*",
"duration",
";",
"}",
"else",
"if",
"(",
"u",
".",
"equals",
"(",
"\"s\"",
")",
")",
"{",
"timestampMillis",
"=",
"1000L",
"*",
"timestamp",
";",
"durationMillis",
"=",
"1000L",
"*",
"duration",
";",
"}",
"else",
"if",
"(",
"u",
".",
"equals",
"(",
"\"S\"",
")",
")",
"{",
"timestampMillis",
"=",
"timestamp",
";",
"durationMillis",
"=",
"duration",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unit not supported: \"",
"+",
"u",
")",
";",
"}",
"result",
".",
"add",
"(",
"new",
"RawEntry",
"(",
"timestampMillis",
",",
"durationMillis",
",",
"c",
"==",
"null",
"||",
"i",
">=",
"c",
".",
"size",
"(",
")",
"?",
"null",
":",
"c",
".",
"get",
"(",
"i",
")",
",",
"s",
"==",
"null",
"||",
"i",
">=",
"s",
".",
"size",
"(",
")",
"?",
"null",
":",
"s",
".",
"get",
"(",
"i",
")",
",",
"a",
"==",
"null",
"||",
"i",
">=",
"a",
".",
"size",
"(",
")",
"?",
"null",
":",
"a",
".",
"get",
"(",
"i",
")",
",",
"m",
"==",
"null",
"||",
"i",
">=",
"m",
".",
"size",
"(",
")",
"?",
"null",
":",
"m",
".",
"get",
"(",
"i",
")",
",",
"x",
"==",
"null",
"||",
"i",
">=",
"x",
".",
"size",
"(",
")",
"?",
"null",
":",
"x",
".",
"get",
"(",
"i",
")",
",",
"n",
"==",
"null",
"||",
"i",
">=",
"n",
".",
"size",
"(",
")",
"?",
"null",
":",
"n",
".",
"get",
"(",
"i",
")",
",",
"o",
"==",
"null",
"||",
"i",
">=",
"o",
".",
"size",
"(",
")",
"?",
"null",
":",
"o",
".",
"get",
"(",
"i",
")",
")",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Convert into raw list form.
@return the list containing entries of data points
|
[
"Convert",
"into",
"raw",
"list",
"form",
"."
] |
bceed441595c5e5195a7418795f03b69fa7b61e4
|
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/cjtsd/PlainCJTSD.java#L57-L102
|
155,421
|
PureSolTechnologies/commons
|
misc/src/main/java/com/puresoltechnologies/commons/misc/io/FileUtilities.java
|
FileUtilities.copy
|
public static void copy(File sourceFile, File targetFile) throws IOException {
FileInputStream in = new FileInputStream(sourceFile);
try {
FileOutputStream out = new FileOutputStream(targetFile);
try {
copy(in, out);
} finally {
out.close();
}
} finally {
in.close();
}
}
|
java
|
public static void copy(File sourceFile, File targetFile) throws IOException {
FileInputStream in = new FileInputStream(sourceFile);
try {
FileOutputStream out = new FileOutputStream(targetFile);
try {
copy(in, out);
} finally {
out.close();
}
} finally {
in.close();
}
}
|
[
"public",
"static",
"void",
"copy",
"(",
"File",
"sourceFile",
",",
"File",
"targetFile",
")",
"throws",
"IOException",
"{",
"FileInputStream",
"in",
"=",
"new",
"FileInputStream",
"(",
"sourceFile",
")",
";",
"try",
"{",
"FileOutputStream",
"out",
"=",
"new",
"FileOutputStream",
"(",
"targetFile",
")",
";",
"try",
"{",
"copy",
"(",
"in",
",",
"out",
")",
";",
"}",
"finally",
"{",
"out",
".",
"close",
"(",
")",
";",
"}",
"}",
"finally",
"{",
"in",
".",
"close",
"(",
")",
";",
"}",
"}"
] |
This method performs a simple copy of sourceFile to targetFile.
@param sourceFile
is the source file where it is to be copied from.
@param targetFile
is the file to which everything is to be copied to.
@throws IOException
is thrown in cases of IO issues.
|
[
"This",
"method",
"performs",
"a",
"simple",
"copy",
"of",
"sourceFile",
"to",
"targetFile",
"."
] |
f98c23d8841a1ff61632ff17fe7d24f99dbc1d44
|
https://github.com/PureSolTechnologies/commons/blob/f98c23d8841a1ff61632ff17fe7d24f99dbc1d44/misc/src/main/java/com/puresoltechnologies/commons/misc/io/FileUtilities.java#L42-L54
|
155,422
|
PureSolTechnologies/commons
|
misc/src/main/java/com/puresoltechnologies/commons/misc/io/FileUtilities.java
|
FileUtilities.isUpdateRequired
|
public static boolean isUpdateRequired(File sourceFile, File targetFile) {
if (targetFile.exists()) {
if (targetFile.lastModified() > sourceFile.lastModified()) {
return false;
}
}
return true;
}
|
java
|
public static boolean isUpdateRequired(File sourceFile, File targetFile) {
if (targetFile.exists()) {
if (targetFile.lastModified() > sourceFile.lastModified()) {
return false;
}
}
return true;
}
|
[
"public",
"static",
"boolean",
"isUpdateRequired",
"(",
"File",
"sourceFile",
",",
"File",
"targetFile",
")",
"{",
"if",
"(",
"targetFile",
".",
"exists",
"(",
")",
")",
"{",
"if",
"(",
"targetFile",
".",
"lastModified",
"(",
")",
">",
"sourceFile",
".",
"lastModified",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
This method checks for the requirement for an update.
If a the target file exists and the modification time is greater than the
modification time of the source file, we do not need to analyze something.
@param sourceFile
is the source file where it is intended to be copied from.
@param targetFile
is the file to which everything is to be copied to.
@return <code>true</code> is returned in case of a required update.
<code>false</code> is returned otherwise.
|
[
"This",
"method",
"checks",
"for",
"the",
"requirement",
"for",
"an",
"update",
"."
] |
f98c23d8841a1ff61632ff17fe7d24f99dbc1d44
|
https://github.com/PureSolTechnologies/commons/blob/f98c23d8841a1ff61632ff17fe7d24f99dbc1d44/misc/src/main/java/com/puresoltechnologies/commons/misc/io/FileUtilities.java#L80-L87
|
155,423
|
PureSolTechnologies/commons
|
misc/src/main/java/com/puresoltechnologies/commons/misc/io/FileUtilities.java
|
FileUtilities.writeFile
|
public static boolean writeFile(File directory, File fileName, String text) {
try {
File destination = new File(directory, fileName.getPath());
File parent = destination.getParentFile();
if (!parent.exists()) {
if (!parent.mkdirs()) {
return false;
}
}
RandomAccessFile ra = new RandomAccessFile(destination, "rw");
try {
ra.setLength(0);
ra.writeBytes(text);
} finally {
ra.close();
}
return true;
} catch (FileNotFoundException e) {
logger.error(e.getMessage(), e);
return false;
} catch (IOException e) {
logger.error(e.getMessage(), e);
return false;
}
}
|
java
|
public static boolean writeFile(File directory, File fileName, String text) {
try {
File destination = new File(directory, fileName.getPath());
File parent = destination.getParentFile();
if (!parent.exists()) {
if (!parent.mkdirs()) {
return false;
}
}
RandomAccessFile ra = new RandomAccessFile(destination, "rw");
try {
ra.setLength(0);
ra.writeBytes(text);
} finally {
ra.close();
}
return true;
} catch (FileNotFoundException e) {
logger.error(e.getMessage(), e);
return false;
} catch (IOException e) {
logger.error(e.getMessage(), e);
return false;
}
}
|
[
"public",
"static",
"boolean",
"writeFile",
"(",
"File",
"directory",
",",
"File",
"fileName",
",",
"String",
"text",
")",
"{",
"try",
"{",
"File",
"destination",
"=",
"new",
"File",
"(",
"directory",
",",
"fileName",
".",
"getPath",
"(",
")",
")",
";",
"File",
"parent",
"=",
"destination",
".",
"getParentFile",
"(",
")",
";",
"if",
"(",
"!",
"parent",
".",
"exists",
"(",
")",
")",
"{",
"if",
"(",
"!",
"parent",
".",
"mkdirs",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"RandomAccessFile",
"ra",
"=",
"new",
"RandomAccessFile",
"(",
"destination",
",",
"\"rw\"",
")",
";",
"try",
"{",
"ra",
".",
"setLength",
"(",
"0",
")",
";",
"ra",
".",
"writeBytes",
"(",
"text",
")",
";",
"}",
"finally",
"{",
"ra",
".",
"close",
"(",
")",
";",
"}",
"return",
"true",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"return",
"false",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"return",
"false",
";",
"}",
"}"
] |
This method writes the content of a String into a file specified by a
directory and its fileName.
@param directory
is the output directory.
@param fileName
is the file name of the target file.
@param text
is the text to be written into the file.
@return <code>true</code> is returned in case of success. <code>false</code>
is returned otherwise.
|
[
"This",
"method",
"writes",
"the",
"content",
"of",
"a",
"String",
"into",
"a",
"file",
"specified",
"by",
"a",
"directory",
"and",
"its",
"fileName",
"."
] |
f98c23d8841a1ff61632ff17fe7d24f99dbc1d44
|
https://github.com/PureSolTechnologies/commons/blob/f98c23d8841a1ff61632ff17fe7d24f99dbc1d44/misc/src/main/java/com/puresoltechnologies/commons/misc/io/FileUtilities.java#L102-L126
|
155,424
|
PureSolTechnologies/commons
|
misc/src/main/java/com/puresoltechnologies/commons/misc/io/FileUtilities.java
|
FileUtilities.deleteFileOrDir
|
public static void deleteFileOrDir(File file) throws IOException {
if (file.isDirectory()) {
File[] children = file.listFiles();
if (children != null) {
for (File child : children) {
deleteFileOrDir(child);
}
}
}
if (!file.delete()) {
throw new IOException("Could not remove '" + file + "'!");
}
}
|
java
|
public static void deleteFileOrDir(File file) throws IOException {
if (file.isDirectory()) {
File[] children = file.listFiles();
if (children != null) {
for (File child : children) {
deleteFileOrDir(child);
}
}
}
if (!file.delete()) {
throw new IOException("Could not remove '" + file + "'!");
}
}
|
[
"public",
"static",
"void",
"deleteFileOrDir",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"if",
"(",
"file",
".",
"isDirectory",
"(",
")",
")",
"{",
"File",
"[",
"]",
"children",
"=",
"file",
".",
"listFiles",
"(",
")",
";",
"if",
"(",
"children",
"!=",
"null",
")",
"{",
"for",
"(",
"File",
"child",
":",
"children",
")",
"{",
"deleteFileOrDir",
"(",
"child",
")",
";",
"}",
"}",
"}",
"if",
"(",
"!",
"file",
".",
"delete",
"(",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Could not remove '\"",
"+",
"file",
"+",
"\"'!\"",
")",
";",
"}",
"}"
] |
Utility method used to delete the profile directory when run as a stand-alone
application.
@param file
The file to recursively delete.
@throws IOException
is thrown in case of IO issues.
|
[
"Utility",
"method",
"used",
"to",
"delete",
"the",
"profile",
"directory",
"when",
"run",
"as",
"a",
"stand",
"-",
"alone",
"application",
"."
] |
f98c23d8841a1ff61632ff17fe7d24f99dbc1d44
|
https://github.com/PureSolTechnologies/commons/blob/f98c23d8841a1ff61632ff17fe7d24f99dbc1d44/misc/src/main/java/com/puresoltechnologies/commons/misc/io/FileUtilities.java#L159-L171
|
155,425
|
PureSolTechnologies/commons
|
misc/src/main/java/com/puresoltechnologies/commons/misc/io/FileUtilities.java
|
FileUtilities.createHumanReadableSizeString
|
public static String createHumanReadableSizeString(long size) {
DecimalFormat format = new DecimalFormat("#.##");
BinaryPrefix prefix = BinaryPrefix.getSuitablePrefix(size);
double doubleSize = size / prefix.getBinaryFactor().doubleValue();
return format.format(doubleSize) + prefix.getUnit() + "B";
}
|
java
|
public static String createHumanReadableSizeString(long size) {
DecimalFormat format = new DecimalFormat("#.##");
BinaryPrefix prefix = BinaryPrefix.getSuitablePrefix(size);
double doubleSize = size / prefix.getBinaryFactor().doubleValue();
return format.format(doubleSize) + prefix.getUnit() + "B";
}
|
[
"public",
"static",
"String",
"createHumanReadableSizeString",
"(",
"long",
"size",
")",
"{",
"DecimalFormat",
"format",
"=",
"new",
"DecimalFormat",
"(",
"\"#.##\"",
")",
";",
"BinaryPrefix",
"prefix",
"=",
"BinaryPrefix",
".",
"getSuitablePrefix",
"(",
"size",
")",
";",
"double",
"doubleSize",
"=",
"size",
"/",
"prefix",
".",
"getBinaryFactor",
"(",
")",
".",
"doubleValue",
"(",
")",
";",
"return",
"format",
".",
"format",
"(",
"doubleSize",
")",
"+",
"prefix",
".",
"getUnit",
"(",
")",
"+",
"\"B\"",
";",
"}"
] |
This method converts a size in bytes into a string which can be used to be
put into UI.
For example: 1024 will be converted into '1kB', 1024*1024 bytes into '1MB'
and so forth.
@param size
is the size of the file in Byte to be converted into a
{@link String}.
@return A {@link String} is returned.
|
[
"This",
"method",
"converts",
"a",
"size",
"in",
"bytes",
"into",
"a",
"string",
"which",
"can",
"be",
"used",
"to",
"be",
"put",
"into",
"UI",
"."
] |
f98c23d8841a1ff61632ff17fe7d24f99dbc1d44
|
https://github.com/PureSolTechnologies/commons/blob/f98c23d8841a1ff61632ff17fe7d24f99dbc1d44/misc/src/main/java/com/puresoltechnologies/commons/misc/io/FileUtilities.java#L193-L198
|
155,426
|
SimiaCryptus/utilities
|
java-util/src/main/java/com/simiacryptus/text/CompressionUtil.java
|
CompressionUtil.decodeLZToString
|
public static String decodeLZToString(byte[] data, String dictionary) {
try {
return new String(decodeLZ(data), "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
|
java
|
public static String decodeLZToString(byte[] data, String dictionary) {
try {
return new String(decodeLZ(data), "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
|
[
"public",
"static",
"String",
"decodeLZToString",
"(",
"byte",
"[",
"]",
"data",
",",
"String",
"dictionary",
")",
"{",
"try",
"{",
"return",
"new",
"String",
"(",
"decodeLZ",
"(",
"data",
")",
",",
"\"UTF-8\"",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}"
] |
Decode lz to string string.
@param data the data
@param dictionary the dictionary
@return the string
|
[
"Decode",
"lz",
"to",
"string",
"string",
"."
] |
b5a5e73449aae57de7dbfca2ed7a074432c5b17e
|
https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/text/CompressionUtil.java#L143-L149
|
155,427
|
james-hu/jabb-core
|
src/main/java/net/sf/jabb/quartz/SchedulerUtility.java
|
SchedulerUtility.getSchedulerNames
|
public static Map<String, String> getSchedulerNames(){
Map<String, String> schedulerNames = new HashMap<String, String>();
MySchedule mySchedule = MySchedule.getInstance();
for(String settingsName: mySchedule.getSchedulerSettingsNames()){
SchedulerSettings settings = mySchedule.getSchedulerSettings(settingsName);
schedulerNames.put(settingsName, settings.getSchedulerFullName());
}
return schedulerNames;
}
|
java
|
public static Map<String, String> getSchedulerNames(){
Map<String, String> schedulerNames = new HashMap<String, String>();
MySchedule mySchedule = MySchedule.getInstance();
for(String settingsName: mySchedule.getSchedulerSettingsNames()){
SchedulerSettings settings = mySchedule.getSchedulerSettings(settingsName);
schedulerNames.put(settingsName, settings.getSchedulerFullName());
}
return schedulerNames;
}
|
[
"public",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"getSchedulerNames",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"schedulerNames",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"MySchedule",
"mySchedule",
"=",
"MySchedule",
".",
"getInstance",
"(",
")",
";",
"for",
"(",
"String",
"settingsName",
":",
"mySchedule",
".",
"getSchedulerSettingsNames",
"(",
")",
")",
"{",
"SchedulerSettings",
"settings",
"=",
"mySchedule",
".",
"getSchedulerSettings",
"(",
"settingsName",
")",
";",
"schedulerNames",
".",
"put",
"(",
"settingsName",
",",
"settings",
".",
"getSchedulerFullName",
"(",
")",
")",
";",
"}",
"return",
"schedulerNames",
";",
"}"
] |
Get the settings names and full names of all schedulers defined in myschedule.
@return Map of <settings name, full name>
|
[
"Get",
"the",
"settings",
"names",
"and",
"full",
"names",
"of",
"all",
"schedulers",
"defined",
"in",
"myschedule",
"."
] |
bceed441595c5e5195a7418795f03b69fa7b61e4
|
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/quartz/SchedulerUtility.java#L28-L36
|
155,428
|
james-hu/jabb-core
|
src/main/java/net/sf/jabb/quartz/SchedulerUtility.java
|
SchedulerUtility.getSchedulers
|
public static Map<String, SchedulerTemplate> getSchedulers(){
Map<String, SchedulerTemplate> schedulers = new HashMap<String, SchedulerTemplate>();
MySchedule mySchedule = MySchedule.getInstance();
for(String settingsName: mySchedule.getSchedulerSettingsNames()){
SchedulerTemplate schedulerTemplate = mySchedule.getScheduler(settingsName);
schedulers.put(settingsName, schedulerTemplate);
}
return schedulers;
}
|
java
|
public static Map<String, SchedulerTemplate> getSchedulers(){
Map<String, SchedulerTemplate> schedulers = new HashMap<String, SchedulerTemplate>();
MySchedule mySchedule = MySchedule.getInstance();
for(String settingsName: mySchedule.getSchedulerSettingsNames()){
SchedulerTemplate schedulerTemplate = mySchedule.getScheduler(settingsName);
schedulers.put(settingsName, schedulerTemplate);
}
return schedulers;
}
|
[
"public",
"static",
"Map",
"<",
"String",
",",
"SchedulerTemplate",
">",
"getSchedulers",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"SchedulerTemplate",
">",
"schedulers",
"=",
"new",
"HashMap",
"<",
"String",
",",
"SchedulerTemplate",
">",
"(",
")",
";",
"MySchedule",
"mySchedule",
"=",
"MySchedule",
".",
"getInstance",
"(",
")",
";",
"for",
"(",
"String",
"settingsName",
":",
"mySchedule",
".",
"getSchedulerSettingsNames",
"(",
")",
")",
"{",
"SchedulerTemplate",
"schedulerTemplate",
"=",
"mySchedule",
".",
"getScheduler",
"(",
"settingsName",
")",
";",
"schedulers",
".",
"put",
"(",
"settingsName",
",",
"schedulerTemplate",
")",
";",
"}",
"return",
"schedulers",
";",
"}"
] |
Get the settings names and corresponding schedulers of all schedulers defined in myschedule.
@return Map of <settings name, scheduler>
|
[
"Get",
"the",
"settings",
"names",
"and",
"corresponding",
"schedulers",
"of",
"all",
"schedulers",
"defined",
"in",
"myschedule",
"."
] |
bceed441595c5e5195a7418795f03b69fa7b61e4
|
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/quartz/SchedulerUtility.java#L42-L50
|
155,429
|
james-hu/jabb-core
|
src/main/java/net/sf/jabb/quartz/SchedulerUtility.java
|
SchedulerUtility.convertTextToDataMap
|
public static Map<String, Object> convertTextToDataMap(String text) throws IOException{
Map<String, Object> dataMap = null;
Properties p = new Properties();
p.load(new StringReader(text));
dataMap = new HashMap<String, Object>();
for (Entry<Object, Object> entry: p.entrySet()){
dataMap.put((String)entry.getKey(), entry.getValue());
}
return dataMap;
}
|
java
|
public static Map<String, Object> convertTextToDataMap(String text) throws IOException{
Map<String, Object> dataMap = null;
Properties p = new Properties();
p.load(new StringReader(text));
dataMap = new HashMap<String, Object>();
for (Entry<Object, Object> entry: p.entrySet()){
dataMap.put((String)entry.getKey(), entry.getValue());
}
return dataMap;
}
|
[
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"convertTextToDataMap",
"(",
"String",
"text",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"dataMap",
"=",
"null",
";",
"Properties",
"p",
"=",
"new",
"Properties",
"(",
")",
";",
"p",
".",
"load",
"(",
"new",
"StringReader",
"(",
"text",
")",
")",
";",
"dataMap",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"for",
"(",
"Entry",
"<",
"Object",
",",
"Object",
">",
"entry",
":",
"p",
".",
"entrySet",
"(",
")",
")",
"{",
"dataMap",
".",
"put",
"(",
"(",
"String",
")",
"entry",
".",
"getKey",
"(",
")",
",",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"return",
"dataMap",
";",
"}"
] |
Convert a text in properties file format to DataMap that can be used by Quartz
@param text the text in properties file format
@return a Map that can be used as JobDataMap by Quartz
@throws IOException if the text is not in proper properties file format
|
[
"Convert",
"a",
"text",
"in",
"properties",
"file",
"format",
"to",
"DataMap",
"that",
"can",
"be",
"used",
"by",
"Quartz"
] |
bceed441595c5e5195a7418795f03b69fa7b61e4
|
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/quartz/SchedulerUtility.java#L58-L68
|
155,430
|
james-hu/jabb-core
|
src/main/java/net/sf/jabb/quartz/SchedulerUtility.java
|
SchedulerUtility.convertDataMapToText
|
public static String convertDataMapToText(Map<String, Object> dataMap){
StringBuilder sb = new StringBuilder();
for (Entry<String, Object> entry: dataMap.entrySet()){
sb.append(entry.getKey()).append("=").append(entry.getValue());
sb.append('\n');
}
return sb.toString();
}
|
java
|
public static String convertDataMapToText(Map<String, Object> dataMap){
StringBuilder sb = new StringBuilder();
for (Entry<String, Object> entry: dataMap.entrySet()){
sb.append(entry.getKey()).append("=").append(entry.getValue());
sb.append('\n');
}
return sb.toString();
}
|
[
"public",
"static",
"String",
"convertDataMapToText",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"dataMap",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"Object",
">",
"entry",
":",
"dataMap",
".",
"entrySet",
"(",
")",
")",
"{",
"sb",
".",
"append",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
".",
"append",
"(",
"\"=\"",
")",
".",
"append",
"(",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"sb",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] |
Convert JobDataMap into text in properties file format
@param dataMap the JobDataMap
@return a text in properties file format
|
[
"Convert",
"JobDataMap",
"into",
"text",
"in",
"properties",
"file",
"format"
] |
bceed441595c5e5195a7418795f03b69fa7b61e4
|
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/quartz/SchedulerUtility.java#L75-L82
|
155,431
|
pip-services3-java/pip-services3-commons-java
|
src/org/pipservices3/commons/commands/Command.java
|
Command.execute
|
@Override
public Object execute(String correlationId, Parameters args) throws ApplicationException {
if (_schema != null)
_schema.validateAndThrowException(correlationId, args);
try {
return _function.execute(correlationId, args);
} catch (Throwable ex) {
throw new InvocationException(correlationId, "EXEC_FAILED", "Execution " + _name + " failed: " + ex)
.withDetails("command", _name).wrap(ex);
}
}
|
java
|
@Override
public Object execute(String correlationId, Parameters args) throws ApplicationException {
if (_schema != null)
_schema.validateAndThrowException(correlationId, args);
try {
return _function.execute(correlationId, args);
} catch (Throwable ex) {
throw new InvocationException(correlationId, "EXEC_FAILED", "Execution " + _name + " failed: " + ex)
.withDetails("command", _name).wrap(ex);
}
}
|
[
"@",
"Override",
"public",
"Object",
"execute",
"(",
"String",
"correlationId",
",",
"Parameters",
"args",
")",
"throws",
"ApplicationException",
"{",
"if",
"(",
"_schema",
"!=",
"null",
")",
"_schema",
".",
"validateAndThrowException",
"(",
"correlationId",
",",
"args",
")",
";",
"try",
"{",
"return",
"_function",
".",
"execute",
"(",
"correlationId",
",",
"args",
")",
";",
"}",
"catch",
"(",
"Throwable",
"ex",
")",
"{",
"throw",
"new",
"InvocationException",
"(",
"correlationId",
",",
"\"EXEC_FAILED\"",
",",
"\"Execution \"",
"+",
"_name",
"+",
"\" failed: \"",
"+",
"ex",
")",
".",
"withDetails",
"(",
"\"command\"",
",",
"_name",
")",
".",
"wrap",
"(",
"ex",
")",
";",
"}",
"}"
] |
Executes the command. Before execution is validates Parameters args using the
defined schema. The command execution intercepts ApplicationException raised
by the called function and throws them.
@param correlationId optional transaction id to trace calls across
components.
@param args the parameters (arguments) to pass to this command for
execution.
@return execution result.
@throws ApplicationException when execution fails for whatever reason.
@see Parameters
|
[
"Executes",
"the",
"command",
".",
"Before",
"execution",
"is",
"validates",
"Parameters",
"args",
"using",
"the",
"defined",
"schema",
".",
"The",
"command",
"execution",
"intercepts",
"ApplicationException",
"raised",
"by",
"the",
"called",
"function",
"and",
"throws",
"them",
"."
] |
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
|
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/commands/Command.java#L85-L96
|
155,432
|
pip-services3-java/pip-services3-commons-java
|
src/org/pipservices3/commons/commands/Command.java
|
Command.validate
|
@Override
public List<ValidationResult> validate(Parameters args) {
if (_schema != null)
return _schema.validate(args);
return new ArrayList<ValidationResult>();
}
|
java
|
@Override
public List<ValidationResult> validate(Parameters args) {
if (_schema != null)
return _schema.validate(args);
return new ArrayList<ValidationResult>();
}
|
[
"@",
"Override",
"public",
"List",
"<",
"ValidationResult",
">",
"validate",
"(",
"Parameters",
"args",
")",
"{",
"if",
"(",
"_schema",
"!=",
"null",
")",
"return",
"_schema",
".",
"validate",
"(",
"args",
")",
";",
"return",
"new",
"ArrayList",
"<",
"ValidationResult",
">",
"(",
")",
";",
"}"
] |
Validates the command Parameters args before execution using the defined
schema.
@param args the parameters (arguments) to validate using this command's
schema.
@return a list ValidationResults or an empty list (if no schema is set).
@see Parameters
@see ValidationResult
|
[
"Validates",
"the",
"command",
"Parameters",
"args",
"before",
"execution",
"using",
"the",
"defined",
"schema",
"."
] |
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
|
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/commands/Command.java#L109-L115
|
155,433
|
PureSolTechnologies/commons
|
misc/src/main/java/com/puresoltechnologies/commons/misc/io/FileSearch.java
|
FileSearch.find
|
public static List<File> find(File directory, String pattern) {
pattern = wildcardsToRegExp(pattern);
List<File> files = findFilesInDirectory(directory,
Pattern.compile(pattern), true);
List<File> result = new ArrayList<File>();
for (File file : files) {
String fileString = file.getPath().substring(
directory.getPath().length());
result.add(new File(fileString));
}
return result;
}
|
java
|
public static List<File> find(File directory, String pattern) {
pattern = wildcardsToRegExp(pattern);
List<File> files = findFilesInDirectory(directory,
Pattern.compile(pattern), true);
List<File> result = new ArrayList<File>();
for (File file : files) {
String fileString = file.getPath().substring(
directory.getPath().length());
result.add(new File(fileString));
}
return result;
}
|
[
"public",
"static",
"List",
"<",
"File",
">",
"find",
"(",
"File",
"directory",
",",
"String",
"pattern",
")",
"{",
"pattern",
"=",
"wildcardsToRegExp",
"(",
"pattern",
")",
";",
"List",
"<",
"File",
">",
"files",
"=",
"findFilesInDirectory",
"(",
"directory",
",",
"Pattern",
".",
"compile",
"(",
"pattern",
")",
",",
"true",
")",
";",
"List",
"<",
"File",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"File",
">",
"(",
")",
";",
"for",
"(",
"File",
"file",
":",
"files",
")",
"{",
"String",
"fileString",
"=",
"file",
".",
"getPath",
"(",
")",
".",
"substring",
"(",
"directory",
".",
"getPath",
"(",
")",
".",
"length",
"(",
")",
")",
";",
"result",
".",
"add",
"(",
"new",
"File",
"(",
"fileString",
")",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
This method searches a directory recursively. A pattern specifies which
files are to be put into the output list.
@param directory
is the directory where the recursive search is to be started.
@param pattern
is a Apache like pattern to specify the files which are to be
put into the output list.
@return
|
[
"This",
"method",
"searches",
"a",
"directory",
"recursively",
".",
"A",
"pattern",
"specifies",
"which",
"files",
"are",
"to",
"be",
"put",
"into",
"the",
"output",
"list",
"."
] |
f98c23d8841a1ff61632ff17fe7d24f99dbc1d44
|
https://github.com/PureSolTechnologies/commons/blob/f98c23d8841a1ff61632ff17fe7d24f99dbc1d44/misc/src/main/java/com/puresoltechnologies/commons/misc/io/FileSearch.java#L67-L78
|
155,434
|
PureSolTechnologies/commons
|
misc/src/main/java/com/puresoltechnologies/commons/misc/io/FileSearch.java
|
FileSearch.findFilesInDirectory
|
private static List<File> findFilesInDirectory(File directory,
Pattern pattern, boolean scanRecursive) {
List<File> files = new ArrayList<File>();
String[] filesInDirectory = directory.list();
if (filesInDirectory == null) {
return files;
}
for (String fileToCheck : filesInDirectory) {
File file = new File(directory, fileToCheck);
if (file.isFile()) {
if (pattern.matcher(fileToCheck).matches()) {
files.add(file);
}
} else if (file.isDirectory()) {
if (scanRecursive) {
files.addAll(findFilesInDirectory(file, pattern,
scanRecursive));
}
}
}
return files;
}
|
java
|
private static List<File> findFilesInDirectory(File directory,
Pattern pattern, boolean scanRecursive) {
List<File> files = new ArrayList<File>();
String[] filesInDirectory = directory.list();
if (filesInDirectory == null) {
return files;
}
for (String fileToCheck : filesInDirectory) {
File file = new File(directory, fileToCheck);
if (file.isFile()) {
if (pattern.matcher(fileToCheck).matches()) {
files.add(file);
}
} else if (file.isDirectory()) {
if (scanRecursive) {
files.addAll(findFilesInDirectory(file, pattern,
scanRecursive));
}
}
}
return files;
}
|
[
"private",
"static",
"List",
"<",
"File",
">",
"findFilesInDirectory",
"(",
"File",
"directory",
",",
"Pattern",
"pattern",
",",
"boolean",
"scanRecursive",
")",
"{",
"List",
"<",
"File",
">",
"files",
"=",
"new",
"ArrayList",
"<",
"File",
">",
"(",
")",
";",
"String",
"[",
"]",
"filesInDirectory",
"=",
"directory",
".",
"list",
"(",
")",
";",
"if",
"(",
"filesInDirectory",
"==",
"null",
")",
"{",
"return",
"files",
";",
"}",
"for",
"(",
"String",
"fileToCheck",
":",
"filesInDirectory",
")",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"directory",
",",
"fileToCheck",
")",
";",
"if",
"(",
"file",
".",
"isFile",
"(",
")",
")",
"{",
"if",
"(",
"pattern",
".",
"matcher",
"(",
"fileToCheck",
")",
".",
"matches",
"(",
")",
")",
"{",
"files",
".",
"add",
"(",
"file",
")",
";",
"}",
"}",
"else",
"if",
"(",
"file",
".",
"isDirectory",
"(",
")",
")",
"{",
"if",
"(",
"scanRecursive",
")",
"{",
"files",
".",
"addAll",
"(",
"findFilesInDirectory",
"(",
"file",
",",
"pattern",
",",
"scanRecursive",
")",
")",
";",
"}",
"}",
"}",
"return",
"files",
";",
"}"
] |
This class is the recursive part of the file search.
@param directory
@param pattern
@param scanRecursive
@return
|
[
"This",
"class",
"is",
"the",
"recursive",
"part",
"of",
"the",
"file",
"search",
"."
] |
f98c23d8841a1ff61632ff17fe7d24f99dbc1d44
|
https://github.com/PureSolTechnologies/commons/blob/f98c23d8841a1ff61632ff17fe7d24f99dbc1d44/misc/src/main/java/com/puresoltechnologies/commons/misc/io/FileSearch.java#L88-L109
|
155,435
|
JM-Lab/utils-java8
|
src/main/java/kr/jm/utils/time/JMTimeUtil.java
|
JMTimeUtil.getCurrentTimestamp
|
public static String getCurrentTimestamp(String timeFormat, String zoneId) {
return getTime(System.currentTimeMillis(), timeFormat, zoneId);
}
|
java
|
public static String getCurrentTimestamp(String timeFormat, String zoneId) {
return getTime(System.currentTimeMillis(), timeFormat, zoneId);
}
|
[
"public",
"static",
"String",
"getCurrentTimestamp",
"(",
"String",
"timeFormat",
",",
"String",
"zoneId",
")",
"{",
"return",
"getTime",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
",",
"timeFormat",
",",
"zoneId",
")",
";",
"}"
] |
Gets current timestamp.
@param timeFormat the time format
@param zoneId the zone id
@return the current timestamp
|
[
"Gets",
"current",
"timestamp",
"."
] |
9e407b3f28a7990418a1e877229fa8344f4d78a5
|
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/time/JMTimeUtil.java#L178-L180
|
155,436
|
JM-Lab/utils-java8
|
src/main/java/kr/jm/utils/time/JMTimeUtil.java
|
JMTimeUtil.getDateTimeFormatter
|
public static DateTimeFormatter getDateTimeFormatter(String timeFormat) {
return JMMap
.getOrPutGetNew(dateTimeFormatterCache, timeFormat,
() -> DateTimeFormatter.ofPattern(timeFormat));
}
|
java
|
public static DateTimeFormatter getDateTimeFormatter(String timeFormat) {
return JMMap
.getOrPutGetNew(dateTimeFormatterCache, timeFormat,
() -> DateTimeFormatter.ofPattern(timeFormat));
}
|
[
"public",
"static",
"DateTimeFormatter",
"getDateTimeFormatter",
"(",
"String",
"timeFormat",
")",
"{",
"return",
"JMMap",
".",
"getOrPutGetNew",
"(",
"dateTimeFormatterCache",
",",
"timeFormat",
",",
"(",
")",
"->",
"DateTimeFormatter",
".",
"ofPattern",
"(",
"timeFormat",
")",
")",
";",
"}"
] |
Gets date time formatter.
@param timeFormat the time format
@return the date time formatter
|
[
"Gets",
"date",
"time",
"formatter",
"."
] |
9e407b3f28a7990418a1e877229fa8344f4d78a5
|
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/time/JMTimeUtil.java#L308-L312
|
155,437
|
JM-Lab/utils-java8
|
src/main/java/kr/jm/utils/time/JMTimeUtil.java
|
JMTimeUtil.getZoneId
|
public static ZoneId getZoneId(String zoneId) {
return JMMap
.getOrPutGetNew(zoneIdCache, zoneId, () -> ZoneId.of(zoneId));
}
|
java
|
public static ZoneId getZoneId(String zoneId) {
return JMMap
.getOrPutGetNew(zoneIdCache, zoneId, () -> ZoneId.of(zoneId));
}
|
[
"public",
"static",
"ZoneId",
"getZoneId",
"(",
"String",
"zoneId",
")",
"{",
"return",
"JMMap",
".",
"getOrPutGetNew",
"(",
"zoneIdCache",
",",
"zoneId",
",",
"(",
")",
"->",
"ZoneId",
".",
"of",
"(",
"zoneId",
")",
")",
";",
"}"
] |
Gets zone id.
@param zoneId the zone id
@return the zone id
|
[
"Gets",
"zone",
"id",
"."
] |
9e407b3f28a7990418a1e877229fa8344f4d78a5
|
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/time/JMTimeUtil.java#L320-L323
|
155,438
|
JM-Lab/utils-java8
|
src/main/java/kr/jm/utils/time/JMTimeUtil.java
|
JMTimeUtil.getSimpleDateFormat
|
public static SimpleDateFormat getSimpleDateFormat(String dateFormat,
String zoneId) {
return JMMap.getOrPutGetNew(simpleDateFormatMap,
buildSimpleDateFormatKey(dateFormat, zoneId),
newSimpleDateFormatBuilder.apply(dateFormat, zoneId));
}
|
java
|
public static SimpleDateFormat getSimpleDateFormat(String dateFormat,
String zoneId) {
return JMMap.getOrPutGetNew(simpleDateFormatMap,
buildSimpleDateFormatKey(dateFormat, zoneId),
newSimpleDateFormatBuilder.apply(dateFormat, zoneId));
}
|
[
"public",
"static",
"SimpleDateFormat",
"getSimpleDateFormat",
"(",
"String",
"dateFormat",
",",
"String",
"zoneId",
")",
"{",
"return",
"JMMap",
".",
"getOrPutGetNew",
"(",
"simpleDateFormatMap",
",",
"buildSimpleDateFormatKey",
"(",
"dateFormat",
",",
"zoneId",
")",
",",
"newSimpleDateFormatBuilder",
".",
"apply",
"(",
"dateFormat",
",",
"zoneId",
")",
")",
";",
"}"
] |
Gets simple date format.
@param dateFormat the date format
@param zoneId the zone id
@return the simple date format
|
[
"Gets",
"simple",
"date",
"format",
"."
] |
9e407b3f28a7990418a1e877229fa8344f4d78a5
|
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/time/JMTimeUtil.java#L534-L539
|
155,439
|
JM-Lab/utils-java8
|
src/main/java/kr/jm/utils/time/JMTimeUtil.java
|
JMTimeUtil.changeTimestampToIsoInstant
|
public static String changeTimestampToIsoInstant(String dateFormat,
String timestamp) {
return getTime(changeTimestampToLong(getSimpleDateFormat(dateFormat),
timestamp), ISO_INSTANT_Z, UTC_ZONE_ID);
}
|
java
|
public static String changeTimestampToIsoInstant(String dateFormat,
String timestamp) {
return getTime(changeTimestampToLong(getSimpleDateFormat(dateFormat),
timestamp), ISO_INSTANT_Z, UTC_ZONE_ID);
}
|
[
"public",
"static",
"String",
"changeTimestampToIsoInstant",
"(",
"String",
"dateFormat",
",",
"String",
"timestamp",
")",
"{",
"return",
"getTime",
"(",
"changeTimestampToLong",
"(",
"getSimpleDateFormat",
"(",
"dateFormat",
")",
",",
"timestamp",
")",
",",
"ISO_INSTANT_Z",
",",
"UTC_ZONE_ID",
")",
";",
"}"
] |
Change timestamp to iso instant string.
@param dateFormat the date format
@param timestamp the timestamp
@return the string
|
[
"Change",
"timestamp",
"to",
"iso",
"instant",
"string",
"."
] |
9e407b3f28a7990418a1e877229fa8344f4d78a5
|
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/time/JMTimeUtil.java#L665-L669
|
155,440
|
JM-Lab/utils-java8
|
src/main/java/kr/jm/utils/time/JMTimeUtil.java
|
JMTimeUtil.getTimeMillisWithNano
|
public static long getTimeMillisWithNano(int year, int month,
int dayOfMonth, int hour, int minute, int second, int nanoOfSecond,
String zoneId) {
return ZonedDateTime.of(year, month, dayOfMonth, hour, minute, second,
nanoOfSecond, getZoneId(zoneId)).toInstant().toEpochMilli();
}
|
java
|
public static long getTimeMillisWithNano(int year, int month,
int dayOfMonth, int hour, int minute, int second, int nanoOfSecond,
String zoneId) {
return ZonedDateTime.of(year, month, dayOfMonth, hour, minute, second,
nanoOfSecond, getZoneId(zoneId)).toInstant().toEpochMilli();
}
|
[
"public",
"static",
"long",
"getTimeMillisWithNano",
"(",
"int",
"year",
",",
"int",
"month",
",",
"int",
"dayOfMonth",
",",
"int",
"hour",
",",
"int",
"minute",
",",
"int",
"second",
",",
"int",
"nanoOfSecond",
",",
"String",
"zoneId",
")",
"{",
"return",
"ZonedDateTime",
".",
"of",
"(",
"year",
",",
"month",
",",
"dayOfMonth",
",",
"hour",
",",
"minute",
",",
"second",
",",
"nanoOfSecond",
",",
"getZoneId",
"(",
"zoneId",
")",
")",
".",
"toInstant",
"(",
")",
".",
"toEpochMilli",
"(",
")",
";",
"}"
] |
Gets time millis with nano.
@param year the year
@param month the month
@param dayOfMonth the day of month
@param hour the hour
@param minute the minute
@param second the second
@param nanoOfSecond the nano of second
@param zoneId the zone id
@return the time millis with nano
|
[
"Gets",
"time",
"millis",
"with",
"nano",
"."
] |
9e407b3f28a7990418a1e877229fa8344f4d78a5
|
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/time/JMTimeUtil.java#L716-L721
|
155,441
|
JM-Lab/utils-java8
|
src/main/java/kr/jm/utils/time/JMTimeUtil.java
|
JMTimeUtil.getZonedDataTime
|
public static ZonedDateTime getZonedDataTime(long timestamp,
String zoneId) {
return Instant.ofEpochMilli(timestamp).atZone(getZoneId(zoneId));
}
|
java
|
public static ZonedDateTime getZonedDataTime(long timestamp,
String zoneId) {
return Instant.ofEpochMilli(timestamp).atZone(getZoneId(zoneId));
}
|
[
"public",
"static",
"ZonedDateTime",
"getZonedDataTime",
"(",
"long",
"timestamp",
",",
"String",
"zoneId",
")",
"{",
"return",
"Instant",
".",
"ofEpochMilli",
"(",
"timestamp",
")",
".",
"atZone",
"(",
"getZoneId",
"(",
"zoneId",
")",
")",
";",
"}"
] |
Gets zoned data time.
@param timestamp the timestamp
@param zoneId the zone id
@return the zoned data time
|
[
"Gets",
"zoned",
"data",
"time",
"."
] |
9e407b3f28a7990418a1e877229fa8344f4d78a5
|
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/time/JMTimeUtil.java#L816-L819
|
155,442
|
JM-Lab/utils-java8
|
src/main/java/kr/jm/utils/time/JMTimeUtil.java
|
JMTimeUtil.getOffsetDateTime
|
public static OffsetDateTime getOffsetDateTime(long timestamp,
ZoneOffset zoneOffset) {
return Instant.ofEpochMilli(timestamp).atOffset(zoneOffset);
}
|
java
|
public static OffsetDateTime getOffsetDateTime(long timestamp,
ZoneOffset zoneOffset) {
return Instant.ofEpochMilli(timestamp).atOffset(zoneOffset);
}
|
[
"public",
"static",
"OffsetDateTime",
"getOffsetDateTime",
"(",
"long",
"timestamp",
",",
"ZoneOffset",
"zoneOffset",
")",
"{",
"return",
"Instant",
".",
"ofEpochMilli",
"(",
"timestamp",
")",
".",
"atOffset",
"(",
"zoneOffset",
")",
";",
"}"
] |
Gets offset date time.
@param timestamp the timestamp
@param zoneOffset the zone offset
@return the offset date time
|
[
"Gets",
"offset",
"date",
"time",
"."
] |
9e407b3f28a7990418a1e877229fa8344f4d78a5
|
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/time/JMTimeUtil.java#L838-L841
|
155,443
|
JM-Lab/utils-java8
|
src/main/java/kr/jm/utils/time/JMTimeUtil.java
|
JMTimeUtil.getZoneOffset
|
public static ZoneOffset getZoneOffset(String zoneOffsetId) {
return JMMap.getOrPutGetNew(zoneOffsetCache, zoneOffsetId,
() -> ZoneOffset.of(zoneOffsetId));
}
|
java
|
public static ZoneOffset getZoneOffset(String zoneOffsetId) {
return JMMap.getOrPutGetNew(zoneOffsetCache, zoneOffsetId,
() -> ZoneOffset.of(zoneOffsetId));
}
|
[
"public",
"static",
"ZoneOffset",
"getZoneOffset",
"(",
"String",
"zoneOffsetId",
")",
"{",
"return",
"JMMap",
".",
"getOrPutGetNew",
"(",
"zoneOffsetCache",
",",
"zoneOffsetId",
",",
"(",
")",
"->",
"ZoneOffset",
".",
"of",
"(",
"zoneOffsetId",
")",
")",
";",
"}"
] |
Gets zone offset.
@param zoneOffsetId the zone offset id
@return the zone offset
|
[
"Gets",
"zone",
"offset",
"."
] |
9e407b3f28a7990418a1e877229fa8344f4d78a5
|
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/time/JMTimeUtil.java#L861-L864
|
155,444
|
james-hu/jabb-core
|
src/main/java/net/sf/jabb/util/stat/ImmutableNumberStatistics.java
|
ImmutableNumberStatistics.copyOf
|
public static <T extends Number> ImmutableNumberStatistics<T> copyOf(NumberStatistics<? extends T> statistics){
return new ImmutableNumberStatistics<T>(statistics);
}
|
java
|
public static <T extends Number> ImmutableNumberStatistics<T> copyOf(NumberStatistics<? extends T> statistics){
return new ImmutableNumberStatistics<T>(statistics);
}
|
[
"public",
"static",
"<",
"T",
"extends",
"Number",
">",
"ImmutableNumberStatistics",
"<",
"T",
">",
"copyOf",
"(",
"NumberStatistics",
"<",
"?",
"extends",
"T",
">",
"statistics",
")",
"{",
"return",
"new",
"ImmutableNumberStatistics",
"<",
"T",
">",
"(",
"statistics",
")",
";",
"}"
] |
Create an immutable copy of another NumberStatistics
@param statistics the original object
@return the immutable copy
|
[
"Create",
"an",
"immutable",
"copy",
"of",
"another",
"NumberStatistics"
] |
bceed441595c5e5195a7418795f03b69fa7b61e4
|
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/stat/ImmutableNumberStatistics.java#L32-L34
|
155,445
|
Sonoport/freesound-java
|
src/main/java/com/sonoport/freesound/FreesoundClient.java
|
FreesoundClient.buildAuthorisationCredential
|
private String buildAuthorisationCredential(final Query<?, ?> query) {
String credential = null;
if (query instanceof OAuthQuery) {
final String oauthToken = ((OAuthQuery) query).getOauthToken();
credential = String.format("Bearer %s", oauthToken);
} else if (query instanceof AccessTokenQuery) {
// Don't set the Authorization header
} else {
credential = String.format("Token %s", clientSecret);
}
return credential;
}
|
java
|
private String buildAuthorisationCredential(final Query<?, ?> query) {
String credential = null;
if (query instanceof OAuthQuery) {
final String oauthToken = ((OAuthQuery) query).getOauthToken();
credential = String.format("Bearer %s", oauthToken);
} else if (query instanceof AccessTokenQuery) {
// Don't set the Authorization header
} else {
credential = String.format("Token %s", clientSecret);
}
return credential;
}
|
[
"private",
"String",
"buildAuthorisationCredential",
"(",
"final",
"Query",
"<",
"?",
",",
"?",
">",
"query",
")",
"{",
"String",
"credential",
"=",
"null",
";",
"if",
"(",
"query",
"instanceof",
"OAuthQuery",
")",
"{",
"final",
"String",
"oauthToken",
"=",
"(",
"(",
"OAuthQuery",
")",
"query",
")",
".",
"getOauthToken",
"(",
")",
";",
"credential",
"=",
"String",
".",
"format",
"(",
"\"Bearer %s\"",
",",
"oauthToken",
")",
";",
"}",
"else",
"if",
"(",
"query",
"instanceof",
"AccessTokenQuery",
")",
"{",
"// Don't set the Authorization header",
"}",
"else",
"{",
"credential",
"=",
"String",
".",
"format",
"(",
"\"Token %s\"",
",",
"clientSecret",
")",
";",
"}",
"return",
"credential",
";",
"}"
] |
Build the credential that will be passed in the 'Authorization' HTTP header as part of the API call. The nature
of the credential will depend on the query being made.
@param query The query being made
@return The string to pass in the Authorization header (or null if none)
|
[
"Build",
"the",
"credential",
"that",
"will",
"be",
"passed",
"in",
"the",
"Authorization",
"HTTP",
"header",
"as",
"part",
"of",
"the",
"API",
"call",
".",
"The",
"nature",
"of",
"the",
"credential",
"will",
"depend",
"on",
"the",
"query",
"being",
"made",
"."
] |
ab029e25de068c6f8cc028bc7f916938fd97c036
|
https://github.com/Sonoport/freesound-java/blob/ab029e25de068c6f8cc028bc7f916938fd97c036/src/main/java/com/sonoport/freesound/FreesoundClient.java#L189-L201
|
155,446
|
Sonoport/freesound-java
|
src/main/java/com/sonoport/freesound/FreesoundClient.java
|
FreesoundClient.redeemAuthorisationCodeForAccessToken
|
public Response<AccessTokenDetails> redeemAuthorisationCodeForAccessToken(final String authorisationCode)
throws FreesoundClientException {
final OAuth2AccessTokenRequest tokenRequest =
new OAuth2AccessTokenRequest(clientId, clientSecret, authorisationCode);
return executeQuery(tokenRequest);
}
|
java
|
public Response<AccessTokenDetails> redeemAuthorisationCodeForAccessToken(final String authorisationCode)
throws FreesoundClientException {
final OAuth2AccessTokenRequest tokenRequest =
new OAuth2AccessTokenRequest(clientId, clientSecret, authorisationCode);
return executeQuery(tokenRequest);
}
|
[
"public",
"Response",
"<",
"AccessTokenDetails",
">",
"redeemAuthorisationCodeForAccessToken",
"(",
"final",
"String",
"authorisationCode",
")",
"throws",
"FreesoundClientException",
"{",
"final",
"OAuth2AccessTokenRequest",
"tokenRequest",
"=",
"new",
"OAuth2AccessTokenRequest",
"(",
"clientId",
",",
"clientSecret",
",",
"authorisationCode",
")",
";",
"return",
"executeQuery",
"(",
"tokenRequest",
")",
";",
"}"
] |
Redeem an authorisation code received from freesound.org for an access token that can be used to make calls to
OAuth2 protected resources.
@param authorisationCode The authorisation code received
@return Details of the access token returned
@throws FreesoundClientException Any exception thrown during call
|
[
"Redeem",
"an",
"authorisation",
"code",
"received",
"from",
"freesound",
".",
"org",
"for",
"an",
"access",
"token",
"that",
"can",
"be",
"used",
"to",
"make",
"calls",
"to",
"OAuth2",
"protected",
"resources",
"."
] |
ab029e25de068c6f8cc028bc7f916938fd97c036
|
https://github.com/Sonoport/freesound-java/blob/ab029e25de068c6f8cc028bc7f916938fd97c036/src/main/java/com/sonoport/freesound/FreesoundClient.java#L248-L254
|
155,447
|
Sonoport/freesound-java
|
src/main/java/com/sonoport/freesound/FreesoundClient.java
|
FreesoundClient.refreshAccessToken
|
public Response<AccessTokenDetails> refreshAccessToken(final String refreshToken) throws FreesoundClientException {
final RefreshOAuth2AccessTokenRequest tokenRequest =
new RefreshOAuth2AccessTokenRequest(clientId, clientSecret, refreshToken);
return executeQuery(tokenRequest);
}
|
java
|
public Response<AccessTokenDetails> refreshAccessToken(final String refreshToken) throws FreesoundClientException {
final RefreshOAuth2AccessTokenRequest tokenRequest =
new RefreshOAuth2AccessTokenRequest(clientId, clientSecret, refreshToken);
return executeQuery(tokenRequest);
}
|
[
"public",
"Response",
"<",
"AccessTokenDetails",
">",
"refreshAccessToken",
"(",
"final",
"String",
"refreshToken",
")",
"throws",
"FreesoundClientException",
"{",
"final",
"RefreshOAuth2AccessTokenRequest",
"tokenRequest",
"=",
"new",
"RefreshOAuth2AccessTokenRequest",
"(",
"clientId",
",",
"clientSecret",
",",
"refreshToken",
")",
";",
"return",
"executeQuery",
"(",
"tokenRequest",
")",
";",
"}"
] |
Retrieve a new OAuth2 access token using a refresh token.
@param refreshToken The refresh token to present
@return Details of the access token returned
@throws FreesoundClientException Any exception thrown during call
|
[
"Retrieve",
"a",
"new",
"OAuth2",
"access",
"token",
"using",
"a",
"refresh",
"token",
"."
] |
ab029e25de068c6f8cc028bc7f916938fd97c036
|
https://github.com/Sonoport/freesound-java/blob/ab029e25de068c6f8cc028bc7f916938fd97c036/src/main/java/com/sonoport/freesound/FreesoundClient.java#L263-L268
|
155,448
|
konvergeio/cofoja
|
src/main/java/com/google/java/contract/core/apt/TypeBuilder.java
|
TypeBuilder.fetchSourceDependency
|
@Requires({
"sourceDependencyLoader != null",
"type != null"
})
@Ensures({
"importNames != null",
"rootLineNumberIterator != null"
})
@SuppressWarnings("unchecked")
protected void fetchSourceDependency() throws IOException {
String fileName = type.getName().getBinaryName()
+ JavaUtils.SOURCE_DEPENDENCY_EXTENSION;
InputStream in =
sourceDependencyLoader.getResourceAsStream(fileName);
if (in == null) {
throw new FileNotFoundException();
}
ObjectInputStream oin = new ObjectInputStream(in);
try {
importNames = (Set<String>) oin.readObject();
rootLineNumberIterator = ((List<Long>) oin.readObject()).iterator();
} catch (ClassNotFoundException e) {
throw new IOException(e);
}
oin.close();
}
|
java
|
@Requires({
"sourceDependencyLoader != null",
"type != null"
})
@Ensures({
"importNames != null",
"rootLineNumberIterator != null"
})
@SuppressWarnings("unchecked")
protected void fetchSourceDependency() throws IOException {
String fileName = type.getName().getBinaryName()
+ JavaUtils.SOURCE_DEPENDENCY_EXTENSION;
InputStream in =
sourceDependencyLoader.getResourceAsStream(fileName);
if (in == null) {
throw new FileNotFoundException();
}
ObjectInputStream oin = new ObjectInputStream(in);
try {
importNames = (Set<String>) oin.readObject();
rootLineNumberIterator = ((List<Long>) oin.readObject()).iterator();
} catch (ClassNotFoundException e) {
throw new IOException(e);
}
oin.close();
}
|
[
"@",
"Requires",
"(",
"{",
"\"sourceDependencyLoader != null\"",
",",
"\"type != null\"",
"}",
")",
"@",
"Ensures",
"(",
"{",
"\"importNames != null\"",
",",
"\"rootLineNumberIterator != null\"",
"}",
")",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"void",
"fetchSourceDependency",
"(",
")",
"throws",
"IOException",
"{",
"String",
"fileName",
"=",
"type",
".",
"getName",
"(",
")",
".",
"getBinaryName",
"(",
")",
"+",
"JavaUtils",
".",
"SOURCE_DEPENDENCY_EXTENSION",
";",
"InputStream",
"in",
"=",
"sourceDependencyLoader",
".",
"getResourceAsStream",
"(",
"fileName",
")",
";",
"if",
"(",
"in",
"==",
"null",
")",
"{",
"throw",
"new",
"FileNotFoundException",
"(",
")",
";",
"}",
"ObjectInputStream",
"oin",
"=",
"new",
"ObjectInputStream",
"(",
"in",
")",
";",
"try",
"{",
"importNames",
"=",
"(",
"Set",
"<",
"String",
">",
")",
"oin",
".",
"readObject",
"(",
")",
";",
"rootLineNumberIterator",
"=",
"(",
"(",
"List",
"<",
"Long",
">",
")",
"oin",
".",
"readObject",
"(",
")",
")",
".",
"iterator",
"(",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"e",
")",
"{",
"throw",
"new",
"IOException",
"(",
"e",
")",
";",
"}",
"oin",
".",
"close",
"(",
")",
";",
"}"
] |
Fetches source dependency information from the system class
loader.
|
[
"Fetches",
"source",
"dependency",
"information",
"from",
"the",
"system",
"class",
"loader",
"."
] |
6ded58fa05eb5bf85f16353c8dd4c70bee59121a
|
https://github.com/konvergeio/cofoja/blob/6ded58fa05eb5bf85f16353c8dd4c70bee59121a/src/main/java/com/google/java/contract/core/apt/TypeBuilder.java#L301-L326
|
155,449
|
konvergeio/cofoja
|
src/main/java/com/google/java/contract/core/apt/TypeBuilder.java
|
TypeBuilder.addMethod
|
protected void addMethod(String k, ExecutableElement e, MethodModel exec) {
ArrayList<ContractableMethod> list = methodMap.get(k);
if (list == null) {
list = new ArrayList<ContractableMethod>();
methodMap.put(k, list);
}
list.add(new ContractableMethod(e, exec));
}
|
java
|
protected void addMethod(String k, ExecutableElement e, MethodModel exec) {
ArrayList<ContractableMethod> list = methodMap.get(k);
if (list == null) {
list = new ArrayList<ContractableMethod>();
methodMap.put(k, list);
}
list.add(new ContractableMethod(e, exec));
}
|
[
"protected",
"void",
"addMethod",
"(",
"String",
"k",
",",
"ExecutableElement",
"e",
",",
"MethodModel",
"exec",
")",
"{",
"ArrayList",
"<",
"ContractableMethod",
">",
"list",
"=",
"methodMap",
".",
"get",
"(",
"k",
")",
";",
"if",
"(",
"list",
"==",
"null",
")",
"{",
"list",
"=",
"new",
"ArrayList",
"<",
"ContractableMethod",
">",
"(",
")",
";",
"methodMap",
".",
"put",
"(",
"k",
",",
"list",
")",
";",
"}",
"list",
".",
"add",
"(",
"new",
"ContractableMethod",
"(",
"e",
",",
"exec",
")",
")",
";",
"}"
] |
Adds an association to the method map.
|
[
"Adds",
"an",
"association",
"to",
"the",
"method",
"map",
"."
] |
6ded58fa05eb5bf85f16353c8dd4c70bee59121a
|
https://github.com/konvergeio/cofoja/blob/6ded58fa05eb5bf85f16353c8dd4c70bee59121a/src/main/java/com/google/java/contract/core/apt/TypeBuilder.java#L417-L424
|
155,450
|
konvergeio/cofoja
|
src/main/java/com/google/java/contract/core/apt/TypeBuilder.java
|
TypeBuilder.scanSuper
|
protected void scanSuper(TypeElement e) {
TypeElement superElement =
(TypeElement) utils.typeUtils.asElement(e.getSuperclass());
if (superElement != null) {
superElement.accept(new ContractExtensionBuilder(), type);
}
for (TypeMirror iface : e.getInterfaces()) {
TypeElement ifaceElement =
(TypeElement) utils.typeUtils.asElement(iface);
ifaceElement.accept(new ContractExtensionBuilder(), type);
}
}
|
java
|
protected void scanSuper(TypeElement e) {
TypeElement superElement =
(TypeElement) utils.typeUtils.asElement(e.getSuperclass());
if (superElement != null) {
superElement.accept(new ContractExtensionBuilder(), type);
}
for (TypeMirror iface : e.getInterfaces()) {
TypeElement ifaceElement =
(TypeElement) utils.typeUtils.asElement(iface);
ifaceElement.accept(new ContractExtensionBuilder(), type);
}
}
|
[
"protected",
"void",
"scanSuper",
"(",
"TypeElement",
"e",
")",
"{",
"TypeElement",
"superElement",
"=",
"(",
"TypeElement",
")",
"utils",
".",
"typeUtils",
".",
"asElement",
"(",
"e",
".",
"getSuperclass",
"(",
")",
")",
";",
"if",
"(",
"superElement",
"!=",
"null",
")",
"{",
"superElement",
".",
"accept",
"(",
"new",
"ContractExtensionBuilder",
"(",
")",
",",
"type",
")",
";",
"}",
"for",
"(",
"TypeMirror",
"iface",
":",
"e",
".",
"getInterfaces",
"(",
")",
")",
"{",
"TypeElement",
"ifaceElement",
"=",
"(",
"TypeElement",
")",
"utils",
".",
"typeUtils",
".",
"asElement",
"(",
"iface",
")",
";",
"ifaceElement",
".",
"accept",
"(",
"new",
"ContractExtensionBuilder",
"(",
")",
",",
"type",
")",
";",
"}",
"}"
] |
Visits the superclass and interfaces of the specified
TypeElement with a ContractExtensionBuilder.
|
[
"Visits",
"the",
"superclass",
"and",
"interfaces",
"of",
"the",
"specified",
"TypeElement",
"with",
"a",
"ContractExtensionBuilder",
"."
] |
6ded58fa05eb5bf85f16353c8dd4c70bee59121a
|
https://github.com/konvergeio/cofoja/blob/6ded58fa05eb5bf85f16353c8dd4c70bee59121a/src/main/java/com/google/java/contract/core/apt/TypeBuilder.java#L430-L441
|
155,451
|
pip-services3-java/pip-services3-commons-java
|
src/org/pipservices3/commons/config/OptionResolver.java
|
OptionResolver.resolve
|
public static ConfigParams resolve(ConfigParams config, boolean configAsDefault) {
ConfigParams options = config.getSection("options");
if (options.size() == 0 && configAsDefault)
options = config;
return options;
}
|
java
|
public static ConfigParams resolve(ConfigParams config, boolean configAsDefault) {
ConfigParams options = config.getSection("options");
if (options.size() == 0 && configAsDefault)
options = config;
return options;
}
|
[
"public",
"static",
"ConfigParams",
"resolve",
"(",
"ConfigParams",
"config",
",",
"boolean",
"configAsDefault",
")",
"{",
"ConfigParams",
"options",
"=",
"config",
".",
"getSection",
"(",
"\"options\"",
")",
";",
"if",
"(",
"options",
".",
"size",
"(",
")",
"==",
"0",
"&&",
"configAsDefault",
")",
"options",
"=",
"config",
";",
"return",
"options",
";",
"}"
] |
Resolves an "options" configuration section from component configuration
parameters.
@param config configuration parameters
@param configAsDefault (optional) When set true the method returns the entire
parameter set when "options" section is not found.
Default: false
@return configuration parameters from "options" section
|
[
"Resolves",
"an",
"options",
"configuration",
"section",
"from",
"component",
"configuration",
"parameters",
"."
] |
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
|
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/config/OptionResolver.java#L30-L37
|
155,452
|
ludovicianul/selenium-on-steroids
|
src/main/java/com/insidecoding/sos/db/DBUtils.java
|
DBUtils.doSelect
|
public List<List<String>> doSelect(final String sql) throws SQLException {
List<List<String>> results = new ArrayList<List<String>>();
LOG.info("Connecting to: " + this.dbString + " with " + this.usr
+ " and " + this.pwd);
LOG.info("Executing: " + sql);
Connection connection = null;
Statement st = null;
ResultSet rs = null;
try {
connection = DriverManager.getConnection(this.dbString, this.usr,
this.pwd);
st = connection.createStatement();
rs = st.executeQuery(sql);
while (rs.next()) {
ResultSetMetaData meta = rs.getMetaData();
List<String> lines = new ArrayList<String>();
for (int col = 1; col < meta.getColumnCount() + 1; col++) {
lines.add(rs.getString(col));
}
results.add(lines);
}
} finally {
if (rs != null) {
rs.close();
}
if (st != null) {
st.close();
}
if (connection != null) {
connection.close();
}
}
LOG.info("Result returned after running " + sql + " is: " + results);
return results;
}
|
java
|
public List<List<String>> doSelect(final String sql) throws SQLException {
List<List<String>> results = new ArrayList<List<String>>();
LOG.info("Connecting to: " + this.dbString + " with " + this.usr
+ " and " + this.pwd);
LOG.info("Executing: " + sql);
Connection connection = null;
Statement st = null;
ResultSet rs = null;
try {
connection = DriverManager.getConnection(this.dbString, this.usr,
this.pwd);
st = connection.createStatement();
rs = st.executeQuery(sql);
while (rs.next()) {
ResultSetMetaData meta = rs.getMetaData();
List<String> lines = new ArrayList<String>();
for (int col = 1; col < meta.getColumnCount() + 1; col++) {
lines.add(rs.getString(col));
}
results.add(lines);
}
} finally {
if (rs != null) {
rs.close();
}
if (st != null) {
st.close();
}
if (connection != null) {
connection.close();
}
}
LOG.info("Result returned after running " + sql + " is: " + results);
return results;
}
|
[
"public",
"List",
"<",
"List",
"<",
"String",
">",
">",
"doSelect",
"(",
"final",
"String",
"sql",
")",
"throws",
"SQLException",
"{",
"List",
"<",
"List",
"<",
"String",
">>",
"results",
"=",
"new",
"ArrayList",
"<",
"List",
"<",
"String",
">",
">",
"(",
")",
";",
"LOG",
".",
"info",
"(",
"\"Connecting to: \"",
"+",
"this",
".",
"dbString",
"+",
"\" with \"",
"+",
"this",
".",
"usr",
"+",
"\" and \"",
"+",
"this",
".",
"pwd",
")",
";",
"LOG",
".",
"info",
"(",
"\"Executing: \"",
"+",
"sql",
")",
";",
"Connection",
"connection",
"=",
"null",
";",
"Statement",
"st",
"=",
"null",
";",
"ResultSet",
"rs",
"=",
"null",
";",
"try",
"{",
"connection",
"=",
"DriverManager",
".",
"getConnection",
"(",
"this",
".",
"dbString",
",",
"this",
".",
"usr",
",",
"this",
".",
"pwd",
")",
";",
"st",
"=",
"connection",
".",
"createStatement",
"(",
")",
";",
"rs",
"=",
"st",
".",
"executeQuery",
"(",
"sql",
")",
";",
"while",
"(",
"rs",
".",
"next",
"(",
")",
")",
"{",
"ResultSetMetaData",
"meta",
"=",
"rs",
".",
"getMetaData",
"(",
")",
";",
"List",
"<",
"String",
">",
"lines",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"int",
"col",
"=",
"1",
";",
"col",
"<",
"meta",
".",
"getColumnCount",
"(",
")",
"+",
"1",
";",
"col",
"++",
")",
"{",
"lines",
".",
"add",
"(",
"rs",
".",
"getString",
"(",
"col",
")",
")",
";",
"}",
"results",
".",
"add",
"(",
"lines",
")",
";",
"}",
"}",
"finally",
"{",
"if",
"(",
"rs",
"!=",
"null",
")",
"{",
"rs",
".",
"close",
"(",
")",
";",
"}",
"if",
"(",
"st",
"!=",
"null",
")",
"{",
"st",
".",
"close",
"(",
")",
";",
"}",
"if",
"(",
"connection",
"!=",
"null",
")",
"{",
"connection",
".",
"close",
"(",
")",
";",
"}",
"}",
"LOG",
".",
"info",
"(",
"\"Result returned after running \"",
"+",
"sql",
"+",
"\" is: \"",
"+",
"results",
")",
";",
"return",
"results",
";",
"}"
] |
Runs a select query against the DB and get the results in a list of
lists. Each item in the list will be a list of items corresponding to a
row returned by the select.
@param sql
a SELECT sql that will be executed
@return a list with the result from the DB
@throws SQLException
if something goes wrong while accessing the Database
|
[
"Runs",
"a",
"select",
"query",
"against",
"the",
"DB",
"and",
"get",
"the",
"results",
"in",
"a",
"list",
"of",
"lists",
".",
"Each",
"item",
"in",
"the",
"list",
"will",
"be",
"a",
"list",
"of",
"items",
"corresponding",
"to",
"a",
"row",
"returned",
"by",
"the",
"select",
"."
] |
f89d91c59f686114f94624bfc55712f278005bfa
|
https://github.com/ludovicianul/selenium-on-steroids/blob/f89d91c59f686114f94624bfc55712f278005bfa/src/main/java/com/insidecoding/sos/db/DBUtils.java#L83-L123
|
155,453
|
ludovicianul/selenium-on-steroids
|
src/main/java/com/insidecoding/sos/db/DBUtils.java
|
DBUtils.getValuesOfColumn
|
public List<String> getValuesOfColumn(final int columnNumber,
final String sqlQuery) throws SQLException {
LOG.info("Connecting to: " + this.dbString + " with " + this.usr
+ " and " + this.pwd);
LOG.info("Executing: " + sqlQuery);
List<String> result = new ArrayList<String>();
List<List<String>> allResults = this.doSelect(sqlQuery);
for (List<String> list : allResults) {
result.add(list.get(columnNumber));
}
LOG.info("Result returned after running " + sqlQuery + " is: " + result);
return result;
}
|
java
|
public List<String> getValuesOfColumn(final int columnNumber,
final String sqlQuery) throws SQLException {
LOG.info("Connecting to: " + this.dbString + " with " + this.usr
+ " and " + this.pwd);
LOG.info("Executing: " + sqlQuery);
List<String> result = new ArrayList<String>();
List<List<String>> allResults = this.doSelect(sqlQuery);
for (List<String> list : allResults) {
result.add(list.get(columnNumber));
}
LOG.info("Result returned after running " + sqlQuery + " is: " + result);
return result;
}
|
[
"public",
"List",
"<",
"String",
">",
"getValuesOfColumn",
"(",
"final",
"int",
"columnNumber",
",",
"final",
"String",
"sqlQuery",
")",
"throws",
"SQLException",
"{",
"LOG",
".",
"info",
"(",
"\"Connecting to: \"",
"+",
"this",
".",
"dbString",
"+",
"\" with \"",
"+",
"this",
".",
"usr",
"+",
"\" and \"",
"+",
"this",
".",
"pwd",
")",
";",
"LOG",
".",
"info",
"(",
"\"Executing: \"",
"+",
"sqlQuery",
")",
";",
"List",
"<",
"String",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"List",
"<",
"List",
"<",
"String",
">",
">",
"allResults",
"=",
"this",
".",
"doSelect",
"(",
"sqlQuery",
")",
";",
"for",
"(",
"List",
"<",
"String",
">",
"list",
":",
"allResults",
")",
"{",
"result",
".",
"add",
"(",
"list",
".",
"get",
"(",
"columnNumber",
")",
")",
";",
"}",
"LOG",
".",
"info",
"(",
"\"Result returned after running \"",
"+",
"sqlQuery",
"+",
"\" is: \"",
"+",
"result",
")",
";",
"return",
"result",
";",
"}"
] |
Returns all the values corresponding to a specific column returned by
executing the supplied sql.
@param columnNumber
the column number to be returned
@param sqlQuery
the query to be executed
@return a list with all the values corresponding to the supplied column
number
@throws SQLException
if something goes wrong while accessing the Database
|
[
"Returns",
"all",
"the",
"values",
"corresponding",
"to",
"a",
"specific",
"column",
"returned",
"by",
"executing",
"the",
"supplied",
"sql",
"."
] |
f89d91c59f686114f94624bfc55712f278005bfa
|
https://github.com/ludovicianul/selenium-on-steroids/blob/f89d91c59f686114f94624bfc55712f278005bfa/src/main/java/com/insidecoding/sos/db/DBUtils.java#L138-L151
|
155,454
|
ludovicianul/selenium-on-steroids
|
src/main/java/com/insidecoding/sos/db/DBUtils.java
|
DBUtils.getQueryClauses
|
private String getQueryClauses(final Map<String, Object> params,
final Map<String, Object> orderParams) {
final StringBuffer queryString = new StringBuffer();
if ((params != null) && !params.isEmpty()) {
queryString.append(" where ");
for (final Iterator<Map.Entry<String, Object>> it = params
.entrySet().iterator(); it.hasNext();) {
final Map.Entry<String, Object> entry = it.next();
if (entry.getValue() instanceof Boolean) {
queryString.append(entry.getKey()).append(" is ")
.append(entry.getValue()).append(" ");
} else {
if (entry.getValue() instanceof Number) {
queryString.append(entry.getKey()).append(" = ")
.append(entry.getValue());
} else {
// string equality
queryString.append(entry.getKey()).append(" = '")
.append(entry.getValue()).append("'");
}
}
if (it.hasNext()) {
queryString.append(" and ");
}
}
}
if ((orderParams != null) && !orderParams.isEmpty()) {
queryString.append(" order by ");
for (final Iterator<Map.Entry<String, Object>> it = orderParams
.entrySet().iterator(); it.hasNext();) {
final Map.Entry<String, Object> entry = it.next();
queryString.append(entry.getKey()).append(" ");
if (entry.getValue() != null) {
queryString.append(entry.getValue());
}
if (it.hasNext()) {
queryString.append(", ");
}
}
}
return queryString.toString();
}
|
java
|
private String getQueryClauses(final Map<String, Object> params,
final Map<String, Object> orderParams) {
final StringBuffer queryString = new StringBuffer();
if ((params != null) && !params.isEmpty()) {
queryString.append(" where ");
for (final Iterator<Map.Entry<String, Object>> it = params
.entrySet().iterator(); it.hasNext();) {
final Map.Entry<String, Object> entry = it.next();
if (entry.getValue() instanceof Boolean) {
queryString.append(entry.getKey()).append(" is ")
.append(entry.getValue()).append(" ");
} else {
if (entry.getValue() instanceof Number) {
queryString.append(entry.getKey()).append(" = ")
.append(entry.getValue());
} else {
// string equality
queryString.append(entry.getKey()).append(" = '")
.append(entry.getValue()).append("'");
}
}
if (it.hasNext()) {
queryString.append(" and ");
}
}
}
if ((orderParams != null) && !orderParams.isEmpty()) {
queryString.append(" order by ");
for (final Iterator<Map.Entry<String, Object>> it = orderParams
.entrySet().iterator(); it.hasNext();) {
final Map.Entry<String, Object> entry = it.next();
queryString.append(entry.getKey()).append(" ");
if (entry.getValue() != null) {
queryString.append(entry.getValue());
}
if (it.hasNext()) {
queryString.append(", ");
}
}
}
return queryString.toString();
}
|
[
"private",
"String",
"getQueryClauses",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"params",
",",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"orderParams",
")",
"{",
"final",
"StringBuffer",
"queryString",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"if",
"(",
"(",
"params",
"!=",
"null",
")",
"&&",
"!",
"params",
".",
"isEmpty",
"(",
")",
")",
"{",
"queryString",
".",
"append",
"(",
"\" where \"",
")",
";",
"for",
"(",
"final",
"Iterator",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"Object",
">",
">",
"it",
"=",
"params",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"final",
"Map",
".",
"Entry",
"<",
"String",
",",
"Object",
">",
"entry",
"=",
"it",
".",
"next",
"(",
")",
";",
"if",
"(",
"entry",
".",
"getValue",
"(",
")",
"instanceof",
"Boolean",
")",
"{",
"queryString",
".",
"append",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
".",
"append",
"(",
"\" is \"",
")",
".",
"append",
"(",
"entry",
".",
"getValue",
"(",
")",
")",
".",
"append",
"(",
"\" \"",
")",
";",
"}",
"else",
"{",
"if",
"(",
"entry",
".",
"getValue",
"(",
")",
"instanceof",
"Number",
")",
"{",
"queryString",
".",
"append",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
".",
"append",
"(",
"\" = \"",
")",
".",
"append",
"(",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"else",
"{",
"// string equality",
"queryString",
".",
"append",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
".",
"append",
"(",
"\" = '\"",
")",
".",
"append",
"(",
"entry",
".",
"getValue",
"(",
")",
")",
".",
"append",
"(",
"\"'\"",
")",
";",
"}",
"}",
"if",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"queryString",
".",
"append",
"(",
"\" and \"",
")",
";",
"}",
"}",
"}",
"if",
"(",
"(",
"orderParams",
"!=",
"null",
")",
"&&",
"!",
"orderParams",
".",
"isEmpty",
"(",
")",
")",
"{",
"queryString",
".",
"append",
"(",
"\" order by \"",
")",
";",
"for",
"(",
"final",
"Iterator",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"Object",
">",
">",
"it",
"=",
"orderParams",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"final",
"Map",
".",
"Entry",
"<",
"String",
",",
"Object",
">",
"entry",
"=",
"it",
".",
"next",
"(",
")",
";",
"queryString",
".",
"append",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
".",
"append",
"(",
"\" \"",
")",
";",
"if",
"(",
"entry",
".",
"getValue",
"(",
")",
"!=",
"null",
")",
"{",
"queryString",
".",
"append",
"(",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"if",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"queryString",
".",
"append",
"(",
"\", \"",
")",
";",
"}",
"}",
"}",
"return",
"queryString",
".",
"toString",
"(",
")",
";",
"}"
] |
This method returns approapiate query clauses to be executed within a SQL
statement.
@param params
the list of parameters - name value
@param orderParams
the name of the parameters that will be used to sort the
result and also the sorting order. Each entry will be (column,
sortingOrder).
@return the where and order by clause for a SQL statement
|
[
"This",
"method",
"returns",
"approapiate",
"query",
"clauses",
"to",
"be",
"executed",
"within",
"a",
"SQL",
"statement",
"."
] |
f89d91c59f686114f94624bfc55712f278005bfa
|
https://github.com/ludovicianul/selenium-on-steroids/blob/f89d91c59f686114f94624bfc55712f278005bfa/src/main/java/com/insidecoding/sos/db/DBUtils.java#L201-L242
|
155,455
|
pip-services3-java/pip-services3-commons-java
|
src/org/pipservices3/commons/reflect/TypeReflector.java
|
TypeReflector.getType
|
public static Class<?> getType(String name, String library) {
try {
// Load module
if (library != null && !library.isEmpty()) {
URL moduleUrl = new File(library).toURI().toURL();
URLClassLoader child = new URLClassLoader(new URL[] { moduleUrl }, ClassLoader.getSystemClassLoader());
return Class.forName(name, true, child);
} else {
return Class.forName(name);
}
} catch (Exception ex) {
return null;
}
}
|
java
|
public static Class<?> getType(String name, String library) {
try {
// Load module
if (library != null && !library.isEmpty()) {
URL moduleUrl = new File(library).toURI().toURL();
URLClassLoader child = new URLClassLoader(new URL[] { moduleUrl }, ClassLoader.getSystemClassLoader());
return Class.forName(name, true, child);
} else {
return Class.forName(name);
}
} catch (Exception ex) {
return null;
}
}
|
[
"public",
"static",
"Class",
"<",
"?",
">",
"getType",
"(",
"String",
"name",
",",
"String",
"library",
")",
"{",
"try",
"{",
"// Load module",
"if",
"(",
"library",
"!=",
"null",
"&&",
"!",
"library",
".",
"isEmpty",
"(",
")",
")",
"{",
"URL",
"moduleUrl",
"=",
"new",
"File",
"(",
"library",
")",
".",
"toURI",
"(",
")",
".",
"toURL",
"(",
")",
";",
"URLClassLoader",
"child",
"=",
"new",
"URLClassLoader",
"(",
"new",
"URL",
"[",
"]",
"{",
"moduleUrl",
"}",
",",
"ClassLoader",
".",
"getSystemClassLoader",
"(",
")",
")",
";",
"return",
"Class",
".",
"forName",
"(",
"name",
",",
"true",
",",
"child",
")",
";",
"}",
"else",
"{",
"return",
"Class",
".",
"forName",
"(",
"name",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"return",
"null",
";",
"}",
"}"
] |
Gets object type by its name and library where it is defined.
@param name an object type name.
@param library a library where the type is defined
@return the object type or null is the type wasn't found.
|
[
"Gets",
"object",
"type",
"by",
"its",
"name",
"and",
"library",
"where",
"it",
"is",
"defined",
"."
] |
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
|
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/reflect/TypeReflector.java#L42-L55
|
155,456
|
pip-services3-java/pip-services3-commons-java
|
src/org/pipservices3/commons/reflect/TypeReflector.java
|
TypeReflector.getTypeByDescriptor
|
public static Class<?> getTypeByDescriptor(TypeDescriptor type) {
if (type == null)
throw new NullPointerException("Type descriptor cannot be null");
return getType(type.getName(), type.getLibrary());
}
|
java
|
public static Class<?> getTypeByDescriptor(TypeDescriptor type) {
if (type == null)
throw new NullPointerException("Type descriptor cannot be null");
return getType(type.getName(), type.getLibrary());
}
|
[
"public",
"static",
"Class",
"<",
"?",
">",
"getTypeByDescriptor",
"(",
"TypeDescriptor",
"type",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"Type descriptor cannot be null\"",
")",
";",
"return",
"getType",
"(",
"type",
".",
"getName",
"(",
")",
",",
"type",
".",
"getLibrary",
"(",
")",
")",
";",
"}"
] |
Gets object type by type descriptor.
@param type a type descriptor that points to an object type
@return the object type or null is the type wasn't found.
@see #getType(String, String)
@see TypeDescriptor
|
[
"Gets",
"object",
"type",
"by",
"type",
"descriptor",
"."
] |
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
|
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/reflect/TypeReflector.java#L76-L81
|
155,457
|
pip-services3-java/pip-services3-commons-java
|
src/org/pipservices3/commons/reflect/TypeReflector.java
|
TypeReflector.createInstanceByType
|
public static Object createInstanceByType(Class<?> type, Object... args) throws Exception {
if (args.length == 0) {
Constructor<?> constructor = type.getConstructor();
return constructor.newInstance();
} else {
throw new UnsupportedException(null, "NOT_SUPPORTED", "Constructors with parameters are not supported");
}
}
|
java
|
public static Object createInstanceByType(Class<?> type, Object... args) throws Exception {
if (args.length == 0) {
Constructor<?> constructor = type.getConstructor();
return constructor.newInstance();
} else {
throw new UnsupportedException(null, "NOT_SUPPORTED", "Constructors with parameters are not supported");
}
}
|
[
"public",
"static",
"Object",
"createInstanceByType",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"Object",
"...",
"args",
")",
"throws",
"Exception",
"{",
"if",
"(",
"args",
".",
"length",
"==",
"0",
")",
"{",
"Constructor",
"<",
"?",
">",
"constructor",
"=",
"type",
".",
"getConstructor",
"(",
")",
";",
"return",
"constructor",
".",
"newInstance",
"(",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"UnsupportedException",
"(",
"null",
",",
"\"NOT_SUPPORTED\"",
",",
"\"Constructors with parameters are not supported\"",
")",
";",
"}",
"}"
] |
Creates an instance of an object type.
@param type an object type (factory function) to create.
@param args arguments for the object constructor.
@return the created object instance.
@throws Exception when constructors with parameters are not supported
|
[
"Creates",
"an",
"instance",
"of",
"an",
"object",
"type",
"."
] |
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
|
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/reflect/TypeReflector.java#L91-L98
|
155,458
|
pip-services3-java/pip-services3-commons-java
|
src/org/pipservices3/commons/reflect/TypeReflector.java
|
TypeReflector.createInstance
|
public static Object createInstance(String name, String library, Object... args) throws Exception {
Class<?> type = getType(name, library);
if (type == null)
throw new NotFoundException(null, "TYPE_NOT_FOUND", "Type " + name + "," + library + " was not found")
.withDetails("type", name).withDetails("library", library);
return createInstanceByType(type, args);
}
|
java
|
public static Object createInstance(String name, String library, Object... args) throws Exception {
Class<?> type = getType(name, library);
if (type == null)
throw new NotFoundException(null, "TYPE_NOT_FOUND", "Type " + name + "," + library + " was not found")
.withDetails("type", name).withDetails("library", library);
return createInstanceByType(type, args);
}
|
[
"public",
"static",
"Object",
"createInstance",
"(",
"String",
"name",
",",
"String",
"library",
",",
"Object",
"...",
"args",
")",
"throws",
"Exception",
"{",
"Class",
"<",
"?",
">",
"type",
"=",
"getType",
"(",
"name",
",",
"library",
")",
";",
"if",
"(",
"type",
"==",
"null",
")",
"throw",
"new",
"NotFoundException",
"(",
"null",
",",
"\"TYPE_NOT_FOUND\"",
",",
"\"Type \"",
"+",
"name",
"+",
"\",\"",
"+",
"library",
"+",
"\" was not found\"",
")",
".",
"withDetails",
"(",
"\"type\"",
",",
"name",
")",
".",
"withDetails",
"(",
"\"library\"",
",",
"library",
")",
";",
"return",
"createInstanceByType",
"(",
"type",
",",
"args",
")",
";",
"}"
] |
Creates an instance of an object type specified by its name and library where
it is defined.
@param name an object type name.
@param library a library (module) where object type is defined.
@param args arguments for the object constructor.
@return the created object instance.
@throws Exception when type of instance not found
@see #getType(String, String)
@see #createInstanceByType(Class, Object...)
|
[
"Creates",
"an",
"instance",
"of",
"an",
"object",
"type",
"specified",
"by",
"its",
"name",
"and",
"library",
"where",
"it",
"is",
"defined",
"."
] |
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
|
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/reflect/TypeReflector.java#L113-L120
|
155,459
|
pip-services3-java/pip-services3-commons-java
|
src/org/pipservices3/commons/reflect/TypeReflector.java
|
TypeReflector.createInstance
|
public static Object createInstance(String name, Object... args) throws Exception {
return createInstance(name, (String) null, args);
}
|
java
|
public static Object createInstance(String name, Object... args) throws Exception {
return createInstance(name, (String) null, args);
}
|
[
"public",
"static",
"Object",
"createInstance",
"(",
"String",
"name",
",",
"Object",
"...",
"args",
")",
"throws",
"Exception",
"{",
"return",
"createInstance",
"(",
"name",
",",
"(",
"String",
")",
"null",
",",
"args",
")",
";",
"}"
] |
Creates an instance of an object type specified by its name.
@param name an object type name.
@param args arguments for the object constructor.
@return the created object instance.
@throws Exception when type of instance not found
@see #getType(String, String)
@see #createInstanceByType(Class, Object...)
|
[
"Creates",
"an",
"instance",
"of",
"an",
"object",
"type",
"specified",
"by",
"its",
"name",
"."
] |
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
|
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/reflect/TypeReflector.java#L133-L135
|
155,460
|
pip-services3-java/pip-services3-commons-java
|
src/org/pipservices3/commons/reflect/TypeReflector.java
|
TypeReflector.createInstanceByDescriptor
|
public static Object createInstanceByDescriptor(TypeDescriptor type, Object... args) throws Exception {
if (type == null)
throw new NullPointerException("Type descriptor cannot be null");
return createInstance(type.getName(), type.getLibrary(), args);
}
|
java
|
public static Object createInstanceByDescriptor(TypeDescriptor type, Object... args) throws Exception {
if (type == null)
throw new NullPointerException("Type descriptor cannot be null");
return createInstance(type.getName(), type.getLibrary(), args);
}
|
[
"public",
"static",
"Object",
"createInstanceByDescriptor",
"(",
"TypeDescriptor",
"type",
",",
"Object",
"...",
"args",
")",
"throws",
"Exception",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"Type descriptor cannot be null\"",
")",
";",
"return",
"createInstance",
"(",
"type",
".",
"getName",
"(",
")",
",",
"type",
".",
"getLibrary",
"(",
")",
",",
"args",
")",
";",
"}"
] |
Creates an instance of an object type specified by type descriptor.
@param type a type descriptor that points to an object type
@param args arguments for the object constructor.
@return the created object instance.
@throws Exception when type of instance not found
@see #createInstance(String, String, Object...)
@see TypeDescriptor
|
[
"Creates",
"an",
"instance",
"of",
"an",
"object",
"type",
"specified",
"by",
"type",
"descriptor",
"."
] |
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
|
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/reflect/TypeReflector.java#L148-L153
|
155,461
|
pip-services3-java/pip-services3-commons-java
|
src/org/pipservices3/commons/reflect/TypeReflector.java
|
TypeReflector.isPrimitive
|
public static boolean isPrimitive(Object value) {
TypeCode typeCode = TypeConverter.toTypeCode(value);
return typeCode == TypeCode.String || typeCode == TypeCode.Enum || typeCode == TypeCode.Boolean
|| typeCode == TypeCode.Integer || typeCode == TypeCode.Long || typeCode == TypeCode.Float
|| typeCode == TypeCode.Double || typeCode == TypeCode.DateTime || typeCode == TypeCode.Duration;
}
|
java
|
public static boolean isPrimitive(Object value) {
TypeCode typeCode = TypeConverter.toTypeCode(value);
return typeCode == TypeCode.String || typeCode == TypeCode.Enum || typeCode == TypeCode.Boolean
|| typeCode == TypeCode.Integer || typeCode == TypeCode.Long || typeCode == TypeCode.Float
|| typeCode == TypeCode.Double || typeCode == TypeCode.DateTime || typeCode == TypeCode.Duration;
}
|
[
"public",
"static",
"boolean",
"isPrimitive",
"(",
"Object",
"value",
")",
"{",
"TypeCode",
"typeCode",
"=",
"TypeConverter",
".",
"toTypeCode",
"(",
"value",
")",
";",
"return",
"typeCode",
"==",
"TypeCode",
".",
"String",
"||",
"typeCode",
"==",
"TypeCode",
".",
"Enum",
"||",
"typeCode",
"==",
"TypeCode",
".",
"Boolean",
"||",
"typeCode",
"==",
"TypeCode",
".",
"Integer",
"||",
"typeCode",
"==",
"TypeCode",
".",
"Long",
"||",
"typeCode",
"==",
"TypeCode",
".",
"Float",
"||",
"typeCode",
"==",
"TypeCode",
".",
"Double",
"||",
"typeCode",
"==",
"TypeCode",
".",
"DateTime",
"||",
"typeCode",
"==",
"TypeCode",
".",
"Duration",
";",
"}"
] |
Checks if value has primitive type.
Primitive types are: numbers, strings, booleans, date and time. Complex
(non-primitive types are): objects, maps and arrays
@param value a value to check
@return true if the value has primitive type and false if value type is
complex.
@see TypeConverter#toTypeCode(Object)
@see TypeCode
|
[
"Checks",
"if",
"value",
"has",
"primitive",
"type",
"."
] |
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
|
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/reflect/TypeReflector.java#L168-L173
|
155,462
|
PureSolTechnologies/parsers
|
parsers/src/main/java/com/puresoltechnologies/parsers/lexer/TokenStream.java
|
TokenStream.getCodeSample
|
public String getCodeSample(int position) {
StringBuffer buffer = new StringBuffer();
int startPosition = Math.max(0, position - 10);
if (startPosition >= size()) {
startPosition = 0;
}
int stopPosition = Math.min(size() - 1, startPosition + 20);
if (startPosition > 0) {
buffer.append("[...]");
}
for (int i = startPosition; i <= stopPosition; i++) {
if (i == position) {
buffer.append(" >>> ");
}
buffer.append(get(i).getText());
if (i == position) {
buffer.append(" <<< ");
}
}
if (stopPosition < size() - 1) {
buffer.append("[...]");
}
return buffer.toString();
}
|
java
|
public String getCodeSample(int position) {
StringBuffer buffer = new StringBuffer();
int startPosition = Math.max(0, position - 10);
if (startPosition >= size()) {
startPosition = 0;
}
int stopPosition = Math.min(size() - 1, startPosition + 20);
if (startPosition > 0) {
buffer.append("[...]");
}
for (int i = startPosition; i <= stopPosition; i++) {
if (i == position) {
buffer.append(" >>> ");
}
buffer.append(get(i).getText());
if (i == position) {
buffer.append(" <<< ");
}
}
if (stopPosition < size() - 1) {
buffer.append("[...]");
}
return buffer.toString();
}
|
[
"public",
"String",
"getCodeSample",
"(",
"int",
"position",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"int",
"startPosition",
"=",
"Math",
".",
"max",
"(",
"0",
",",
"position",
"-",
"10",
")",
";",
"if",
"(",
"startPosition",
">=",
"size",
"(",
")",
")",
"{",
"startPosition",
"=",
"0",
";",
"}",
"int",
"stopPosition",
"=",
"Math",
".",
"min",
"(",
"size",
"(",
")",
"-",
"1",
",",
"startPosition",
"+",
"20",
")",
";",
"if",
"(",
"startPosition",
">",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"\"[...]\"",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"startPosition",
";",
"i",
"<=",
"stopPosition",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
"==",
"position",
")",
"{",
"buffer",
".",
"append",
"(",
"\" >>> \"",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"get",
"(",
"i",
")",
".",
"getText",
"(",
")",
")",
";",
"if",
"(",
"i",
"==",
"position",
")",
"{",
"buffer",
".",
"append",
"(",
"\" <<< \"",
")",
";",
"}",
"}",
"if",
"(",
"stopPosition",
"<",
"size",
"(",
")",
"-",
"1",
")",
"{",
"buffer",
".",
"append",
"(",
"\"[...]\"",
")",
";",
"}",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}"
] |
This method prepares a code sample out of a position defined by parameter
position. This code sample marks the position and prints code around it.
@param position
is the token id which is to be highlighted. The code around it
is printed, too, to give the user a glue where to find the
position in the source.
@return A {@link String} is returned containing a code sample from the
stream.
|
[
"This",
"method",
"prepares",
"a",
"code",
"sample",
"out",
"of",
"a",
"position",
"defined",
"by",
"parameter",
"position",
".",
"This",
"code",
"sample",
"marks",
"the",
"position",
"and",
"prints",
"code",
"around",
"it",
"."
] |
61077223b90d3768ff9445ae13036343c98b63cd
|
https://github.com/PureSolTechnologies/parsers/blob/61077223b90d3768ff9445ae13036343c98b63cd/parsers/src/main/java/com/puresoltechnologies/parsers/lexer/TokenStream.java#L24-L47
|
155,463
|
xebia-france/xebia-logfilter-extras
|
src/main/java/fr/xebia/extras/filters/logfilters/RequestLoggerFilter.java
|
RequestLoggerFilter.doFilter
|
@Override
public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse, final FilterChain filterChain) throws IOException, ServletException {
ServletRequest request = servletRequest;
ServletResponse response = servletResponse;
int id = 0;
// Generate the identifier if dumping is enabled for request and/or response
if (LOG_REQUEST.isDebugEnabled() || LOG_RESPONSE.isDebugEnabled()) {
id = counter.incrementAndGet();
}
// Dumping of the request is enabled so build the RequestWrapper and dump the request
if (LOG_REQUEST.isDebugEnabled()) {
request = new HttpServletRequestLoggingWrapper((HttpServletRequest) servletRequest, maxDumpSizeInKB);
dumpRequest((HttpServletRequestLoggingWrapper) request, id);
}
if (LOG_RESPONSE.isDebugEnabled()) { // Dumping of the response is enabled so build the wrapper, handle the chain, dump the response, and write it to the outpuStream.
response = new HttpServletResponseLoggingWrapper((HttpServletResponse) servletResponse, maxDumpSizeInKB);
filterChain.doFilter(request, response);
dumpResponse((HttpServletResponseLoggingWrapper) response, id);
} else {
// Dumping of the response is not needed so we just handle the chain
filterChain.doFilter(request, response);
}
}
|
java
|
@Override
public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse, final FilterChain filterChain) throws IOException, ServletException {
ServletRequest request = servletRequest;
ServletResponse response = servletResponse;
int id = 0;
// Generate the identifier if dumping is enabled for request and/or response
if (LOG_REQUEST.isDebugEnabled() || LOG_RESPONSE.isDebugEnabled()) {
id = counter.incrementAndGet();
}
// Dumping of the request is enabled so build the RequestWrapper and dump the request
if (LOG_REQUEST.isDebugEnabled()) {
request = new HttpServletRequestLoggingWrapper((HttpServletRequest) servletRequest, maxDumpSizeInKB);
dumpRequest((HttpServletRequestLoggingWrapper) request, id);
}
if (LOG_RESPONSE.isDebugEnabled()) { // Dumping of the response is enabled so build the wrapper, handle the chain, dump the response, and write it to the outpuStream.
response = new HttpServletResponseLoggingWrapper((HttpServletResponse) servletResponse, maxDumpSizeInKB);
filterChain.doFilter(request, response);
dumpResponse((HttpServletResponseLoggingWrapper) response, id);
} else {
// Dumping of the response is not needed so we just handle the chain
filterChain.doFilter(request, response);
}
}
|
[
"@",
"Override",
"public",
"void",
"doFilter",
"(",
"final",
"ServletRequest",
"servletRequest",
",",
"final",
"ServletResponse",
"servletResponse",
",",
"final",
"FilterChain",
"filterChain",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"ServletRequest",
"request",
"=",
"servletRequest",
";",
"ServletResponse",
"response",
"=",
"servletResponse",
";",
"int",
"id",
"=",
"0",
";",
"// Generate the identifier if dumping is enabled for request and/or response",
"if",
"(",
"LOG_REQUEST",
".",
"isDebugEnabled",
"(",
")",
"||",
"LOG_RESPONSE",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"id",
"=",
"counter",
".",
"incrementAndGet",
"(",
")",
";",
"}",
"// Dumping of the request is enabled so build the RequestWrapper and dump the request",
"if",
"(",
"LOG_REQUEST",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"request",
"=",
"new",
"HttpServletRequestLoggingWrapper",
"(",
"(",
"HttpServletRequest",
")",
"servletRequest",
",",
"maxDumpSizeInKB",
")",
";",
"dumpRequest",
"(",
"(",
"HttpServletRequestLoggingWrapper",
")",
"request",
",",
"id",
")",
";",
"}",
"if",
"(",
"LOG_RESPONSE",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"// Dumping of the response is enabled so build the wrapper, handle the chain, dump the response, and write it to the outpuStream.",
"response",
"=",
"new",
"HttpServletResponseLoggingWrapper",
"(",
"(",
"HttpServletResponse",
")",
"servletResponse",
",",
"maxDumpSizeInKB",
")",
";",
"filterChain",
".",
"doFilter",
"(",
"request",
",",
"response",
")",
";",
"dumpResponse",
"(",
"(",
"HttpServletResponseLoggingWrapper",
")",
"response",
",",
"id",
")",
";",
"}",
"else",
"{",
"// Dumping of the response is not needed so we just handle the chain",
"filterChain",
".",
"doFilter",
"(",
"request",
",",
"response",
")",
";",
"}",
"}"
] |
This is where the work is done.
@param servletRequest
@param servletResponse
@param filterChain
@throws IOException
@throws ServletException
|
[
"This",
"is",
"where",
"the",
"work",
"is",
"done",
"."
] |
b1112329816d7f28fdba214425da8f15338a7157
|
https://github.com/xebia-france/xebia-logfilter-extras/blob/b1112329816d7f28fdba214425da8f15338a7157/src/main/java/fr/xebia/extras/filters/logfilters/RequestLoggerFilter.java#L106-L131
|
155,464
|
xebia-france/xebia-logfilter-extras
|
src/main/java/fr/xebia/extras/filters/logfilters/RequestLoggerFilter.java
|
RequestLoggerFilter.dumpResponse
|
private void dumpResponse(final HttpServletResponseLoggingWrapper response, final int id) {
final StringWriter stringWriter = new StringWriter();
final PrintWriter printWriter = new PrintWriter(stringWriter);
printWriter.print("-- ID: ");
printWriter.println(id);
printWriter.println(response.getStatusCode());
if (LOG_HEADERS.isDebugEnabled()) {
final Map<String, List<String>> headers = response.headers;
for (Map.Entry<String, List<String>> header : headers.entrySet()) {
printWriter.print(header.getKey());
printWriter.print(": ");
Iterator<String> values = header.getValue().iterator();
while (values.hasNext()) {
printWriter.print(values.next());
printWriter.println();
if (values.hasNext()) {
printWriter.print(' ');
}
}
}
}
printWriter.println("-- Begin response body");
final String body = response.getContentAsInputString();
if (body == null || body.length() == 0) {
printWriter.println("-- NO BODY WRITTEN IN RESPONSE");
} else {
printWriter.println(body);
}
printWriter.println();
printWriter.println("-- End response body");
printWriter.flush();
LOG_RESPONSE.debug(stringWriter.toString());
}
|
java
|
private void dumpResponse(final HttpServletResponseLoggingWrapper response, final int id) {
final StringWriter stringWriter = new StringWriter();
final PrintWriter printWriter = new PrintWriter(stringWriter);
printWriter.print("-- ID: ");
printWriter.println(id);
printWriter.println(response.getStatusCode());
if (LOG_HEADERS.isDebugEnabled()) {
final Map<String, List<String>> headers = response.headers;
for (Map.Entry<String, List<String>> header : headers.entrySet()) {
printWriter.print(header.getKey());
printWriter.print(": ");
Iterator<String> values = header.getValue().iterator();
while (values.hasNext()) {
printWriter.print(values.next());
printWriter.println();
if (values.hasNext()) {
printWriter.print(' ');
}
}
}
}
printWriter.println("-- Begin response body");
final String body = response.getContentAsInputString();
if (body == null || body.length() == 0) {
printWriter.println("-- NO BODY WRITTEN IN RESPONSE");
} else {
printWriter.println(body);
}
printWriter.println();
printWriter.println("-- End response body");
printWriter.flush();
LOG_RESPONSE.debug(stringWriter.toString());
}
|
[
"private",
"void",
"dumpResponse",
"(",
"final",
"HttpServletResponseLoggingWrapper",
"response",
",",
"final",
"int",
"id",
")",
"{",
"final",
"StringWriter",
"stringWriter",
"=",
"new",
"StringWriter",
"(",
")",
";",
"final",
"PrintWriter",
"printWriter",
"=",
"new",
"PrintWriter",
"(",
"stringWriter",
")",
";",
"printWriter",
".",
"print",
"(",
"\"-- ID: \"",
")",
";",
"printWriter",
".",
"println",
"(",
"id",
")",
";",
"printWriter",
".",
"println",
"(",
"response",
".",
"getStatusCode",
"(",
")",
")",
";",
"if",
"(",
"LOG_HEADERS",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"headers",
"=",
"response",
".",
"headers",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"header",
":",
"headers",
".",
"entrySet",
"(",
")",
")",
"{",
"printWriter",
".",
"print",
"(",
"header",
".",
"getKey",
"(",
")",
")",
";",
"printWriter",
".",
"print",
"(",
"\": \"",
")",
";",
"Iterator",
"<",
"String",
">",
"values",
"=",
"header",
".",
"getValue",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"values",
".",
"hasNext",
"(",
")",
")",
"{",
"printWriter",
".",
"print",
"(",
"values",
".",
"next",
"(",
")",
")",
";",
"printWriter",
".",
"println",
"(",
")",
";",
"if",
"(",
"values",
".",
"hasNext",
"(",
")",
")",
"{",
"printWriter",
".",
"print",
"(",
"'",
"'",
")",
";",
"}",
"}",
"}",
"}",
"printWriter",
".",
"println",
"(",
"\"-- Begin response body\"",
")",
";",
"final",
"String",
"body",
"=",
"response",
".",
"getContentAsInputString",
"(",
")",
";",
"if",
"(",
"body",
"==",
"null",
"||",
"body",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"printWriter",
".",
"println",
"(",
"\"-- NO BODY WRITTEN IN RESPONSE\"",
")",
";",
"}",
"else",
"{",
"printWriter",
".",
"println",
"(",
"body",
")",
";",
"}",
"printWriter",
".",
"println",
"(",
")",
";",
"printWriter",
".",
"println",
"(",
"\"-- End response body\"",
")",
";",
"printWriter",
".",
"flush",
"(",
")",
";",
"LOG_RESPONSE",
".",
"debug",
"(",
"stringWriter",
".",
"toString",
"(",
")",
")",
";",
"}"
] |
This method handles the dumping of the reponse body, status code and headers if needed
@param response ResponseWrapper that handled the response populated by the webapp
@param id Generated unique identifier for the request/response couple
|
[
"This",
"method",
"handles",
"the",
"dumping",
"of",
"the",
"reponse",
"body",
"status",
"code",
"and",
"headers",
"if",
"needed"
] |
b1112329816d7f28fdba214425da8f15338a7157
|
https://github.com/xebia-france/xebia-logfilter-extras/blob/b1112329816d7f28fdba214425da8f15338a7157/src/main/java/fr/xebia/extras/filters/logfilters/RequestLoggerFilter.java#L140-L173
|
155,465
|
xebia-france/xebia-logfilter-extras
|
src/main/java/fr/xebia/extras/filters/logfilters/RequestLoggerFilter.java
|
RequestLoggerFilter.dumpRequest
|
private void dumpRequest(final HttpServletRequestLoggingWrapper request, final int id) {
final StringWriter stringWriter = new StringWriter();
final PrintWriter printWriter = new PrintWriter(stringWriter);
if ((request.getRemoteUser() == null) || (request.getRemoteUser().trim().length() == 0)) {
printWriter.print("Not authenticated");
} else {
printWriter.print("Authenticated as ");
printWriter.println(request.getRemoteUser());
}
printWriter.print("-- ID: ");
printWriter.println(id);
printWriter.print(request.getMethod());
printWriter.print(" ");
printWriter.print(request.getRequestURL());
printWriter.print(" ");
printWriter.println(request.getProtocol());
if (LOG_HEADERS.isDebugEnabled()) {
@SuppressWarnings("unchecked")
final Enumeration<String> headerNames = request.getHeaderNames();
while (headerNames.hasMoreElements()) {
final String key = headerNames.nextElement();
@SuppressWarnings("unchecked")
final Enumeration<String> headerValues = request.getHeaders(key);
printWriter.print(key);
printWriter.print(": ");
while (headerValues.hasMoreElements()) {
printWriter.print(headerValues.nextElement());
printWriter.println();
if (headerValues.hasMoreElements()) {
printWriter.print(' ');
}
}
}
}
printWriter.println("-- Begin request body");
final String body = request.getBody();
if (body == null || body.length() == 0) {
printWriter.println("-- NO BODY FOUND IN REQUEST");
} else {
printWriter.println(body);
}
printWriter.println("-- End request body");
printWriter.flush();
LOG_REQUEST.debug(stringWriter.toString());
}
|
java
|
private void dumpRequest(final HttpServletRequestLoggingWrapper request, final int id) {
final StringWriter stringWriter = new StringWriter();
final PrintWriter printWriter = new PrintWriter(stringWriter);
if ((request.getRemoteUser() == null) || (request.getRemoteUser().trim().length() == 0)) {
printWriter.print("Not authenticated");
} else {
printWriter.print("Authenticated as ");
printWriter.println(request.getRemoteUser());
}
printWriter.print("-- ID: ");
printWriter.println(id);
printWriter.print(request.getMethod());
printWriter.print(" ");
printWriter.print(request.getRequestURL());
printWriter.print(" ");
printWriter.println(request.getProtocol());
if (LOG_HEADERS.isDebugEnabled()) {
@SuppressWarnings("unchecked")
final Enumeration<String> headerNames = request.getHeaderNames();
while (headerNames.hasMoreElements()) {
final String key = headerNames.nextElement();
@SuppressWarnings("unchecked")
final Enumeration<String> headerValues = request.getHeaders(key);
printWriter.print(key);
printWriter.print(": ");
while (headerValues.hasMoreElements()) {
printWriter.print(headerValues.nextElement());
printWriter.println();
if (headerValues.hasMoreElements()) {
printWriter.print(' ');
}
}
}
}
printWriter.println("-- Begin request body");
final String body = request.getBody();
if (body == null || body.length() == 0) {
printWriter.println("-- NO BODY FOUND IN REQUEST");
} else {
printWriter.println(body);
}
printWriter.println("-- End request body");
printWriter.flush();
LOG_REQUEST.debug(stringWriter.toString());
}
|
[
"private",
"void",
"dumpRequest",
"(",
"final",
"HttpServletRequestLoggingWrapper",
"request",
",",
"final",
"int",
"id",
")",
"{",
"final",
"StringWriter",
"stringWriter",
"=",
"new",
"StringWriter",
"(",
")",
";",
"final",
"PrintWriter",
"printWriter",
"=",
"new",
"PrintWriter",
"(",
"stringWriter",
")",
";",
"if",
"(",
"(",
"request",
".",
"getRemoteUser",
"(",
")",
"==",
"null",
")",
"||",
"(",
"request",
".",
"getRemoteUser",
"(",
")",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"{",
"printWriter",
".",
"print",
"(",
"\"Not authenticated\"",
")",
";",
"}",
"else",
"{",
"printWriter",
".",
"print",
"(",
"\"Authenticated as \"",
")",
";",
"printWriter",
".",
"println",
"(",
"request",
".",
"getRemoteUser",
"(",
")",
")",
";",
"}",
"printWriter",
".",
"print",
"(",
"\"-- ID: \"",
")",
";",
"printWriter",
".",
"println",
"(",
"id",
")",
";",
"printWriter",
".",
"print",
"(",
"request",
".",
"getMethod",
"(",
")",
")",
";",
"printWriter",
".",
"print",
"(",
"\" \"",
")",
";",
"printWriter",
".",
"print",
"(",
"request",
".",
"getRequestURL",
"(",
")",
")",
";",
"printWriter",
".",
"print",
"(",
"\" \"",
")",
";",
"printWriter",
".",
"println",
"(",
"request",
".",
"getProtocol",
"(",
")",
")",
";",
"if",
"(",
"LOG_HEADERS",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"final",
"Enumeration",
"<",
"String",
">",
"headerNames",
"=",
"request",
".",
"getHeaderNames",
"(",
")",
";",
"while",
"(",
"headerNames",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"final",
"String",
"key",
"=",
"headerNames",
".",
"nextElement",
"(",
")",
";",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"final",
"Enumeration",
"<",
"String",
">",
"headerValues",
"=",
"request",
".",
"getHeaders",
"(",
"key",
")",
";",
"printWriter",
".",
"print",
"(",
"key",
")",
";",
"printWriter",
".",
"print",
"(",
"\": \"",
")",
";",
"while",
"(",
"headerValues",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"printWriter",
".",
"print",
"(",
"headerValues",
".",
"nextElement",
"(",
")",
")",
";",
"printWriter",
".",
"println",
"(",
")",
";",
"if",
"(",
"headerValues",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"printWriter",
".",
"print",
"(",
"'",
"'",
")",
";",
"}",
"}",
"}",
"}",
"printWriter",
".",
"println",
"(",
"\"-- Begin request body\"",
")",
";",
"final",
"String",
"body",
"=",
"request",
".",
"getBody",
"(",
")",
";",
"if",
"(",
"body",
"==",
"null",
"||",
"body",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"printWriter",
".",
"println",
"(",
"\"-- NO BODY FOUND IN REQUEST\"",
")",
";",
"}",
"else",
"{",
"printWriter",
".",
"println",
"(",
"body",
")",
";",
"}",
"printWriter",
".",
"println",
"(",
"\"-- End request body\"",
")",
";",
"printWriter",
".",
"flush",
"(",
")",
";",
"LOG_REQUEST",
".",
"debug",
"(",
"stringWriter",
".",
"toString",
"(",
")",
")",
";",
"}"
] |
This method handles the dumping of the request body, method, URL and headers if needed
@param request RequestWrapper used to handle the request by the webapp
@param id Generated unique identifier for the request/response couple
|
[
"This",
"method",
"handles",
"the",
"dumping",
"of",
"the",
"request",
"body",
"method",
"URL",
"and",
"headers",
"if",
"needed"
] |
b1112329816d7f28fdba214425da8f15338a7157
|
https://github.com/xebia-france/xebia-logfilter-extras/blob/b1112329816d7f28fdba214425da8f15338a7157/src/main/java/fr/xebia/extras/filters/logfilters/RequestLoggerFilter.java#L181-L225
|
155,466
|
bushidowallet/bushido-java-service
|
bushido-service-lib/src/main/java/com/bccapi/bitlib/model/Address.java
|
Address.isValidAddress
|
public boolean isValidAddress(NetworkParameters network) {
byte version = getVersion();
if (getAllAddressBytes().length != 21) {
return false;
}
return ((byte) (network.getStandardAddressHeader() & 0xFF)) == version
|| ((byte) (network.getMultisigAddressHeader() & 0xFF)) == version;
}
|
java
|
public boolean isValidAddress(NetworkParameters network) {
byte version = getVersion();
if (getAllAddressBytes().length != 21) {
return false;
}
return ((byte) (network.getStandardAddressHeader() & 0xFF)) == version
|| ((byte) (network.getMultisigAddressHeader() & 0xFF)) == version;
}
|
[
"public",
"boolean",
"isValidAddress",
"(",
"NetworkParameters",
"network",
")",
"{",
"byte",
"version",
"=",
"getVersion",
"(",
")",
";",
"if",
"(",
"getAllAddressBytes",
"(",
")",
".",
"length",
"!=",
"21",
")",
"{",
"return",
"false",
";",
"}",
"return",
"(",
"(",
"byte",
")",
"(",
"network",
".",
"getStandardAddressHeader",
"(",
")",
"&",
"0xFF",
")",
")",
"==",
"version",
"||",
"(",
"(",
"byte",
")",
"(",
"network",
".",
"getMultisigAddressHeader",
"(",
")",
"&",
"0xFF",
")",
")",
"==",
"version",
";",
"}"
] |
Validate that an address is a valid address on the specified network
@param network bitcoin network this address is on
@return is valid
|
[
"Validate",
"that",
"an",
"address",
"is",
"a",
"valid",
"address",
"on",
"the",
"specified",
"network"
] |
e1a0157527e57459b509718044d2df44084876a2
|
https://github.com/bushidowallet/bushido-java-service/blob/e1a0157527e57459b509718044d2df44084876a2/bushido-service-lib/src/main/java/com/bccapi/bitlib/model/Address.java#L137-L144
|
155,467
|
simonpercic/CollectionHelper
|
collectionhelper/src/main/java/com/github/simonpercic/collectionhelper/CollectionHelper.java
|
CollectionHelper.filter
|
public static <T> List<T> filter(Collection<T> items, Predicate<T> predicate) {
List<T> result = new ArrayList<>();
if (!isEmpty(items)) {
for (T item : items) {
if (predicate.apply(item)) {
result.add(item);
}
}
}
return result;
}
|
java
|
public static <T> List<T> filter(Collection<T> items, Predicate<T> predicate) {
List<T> result = new ArrayList<>();
if (!isEmpty(items)) {
for (T item : items) {
if (predicate.apply(item)) {
result.add(item);
}
}
}
return result;
}
|
[
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"filter",
"(",
"Collection",
"<",
"T",
">",
"items",
",",
"Predicate",
"<",
"T",
">",
"predicate",
")",
"{",
"List",
"<",
"T",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"!",
"isEmpty",
"(",
"items",
")",
")",
"{",
"for",
"(",
"T",
"item",
":",
"items",
")",
"{",
"if",
"(",
"predicate",
".",
"apply",
"(",
"item",
")",
")",
"{",
"result",
".",
"add",
"(",
"item",
")",
";",
"}",
"}",
"}",
"return",
"result",
";",
"}"
] |
Filters a collection using the given predicate.
@param items source items
@param predicate predicate function
@param <T> type of elements in the source collection
@return a new filtered list
|
[
"Filters",
"a",
"collection",
"using",
"the",
"given",
"predicate",
"."
] |
2425390ac14f3b6c0a7b04464cf5670060f2dc54
|
https://github.com/simonpercic/CollectionHelper/blob/2425390ac14f3b6c0a7b04464cf5670060f2dc54/collectionhelper/src/main/java/com/github/simonpercic/collectionhelper/CollectionHelper.java#L45-L57
|
155,468
|
simonpercic/CollectionHelper
|
collectionhelper/src/main/java/com/github/simonpercic/collectionhelper/CollectionHelper.java
|
CollectionHelper.firstOrNull
|
public static <T> T firstOrNull(Collection<T> items, Predicate<T> predicate) {
if (!isEmpty(items)) {
for (T item : items) {
if (predicate.apply(item)) {
return item;
}
}
}
return null;
}
|
java
|
public static <T> T firstOrNull(Collection<T> items, Predicate<T> predicate) {
if (!isEmpty(items)) {
for (T item : items) {
if (predicate.apply(item)) {
return item;
}
}
}
return null;
}
|
[
"public",
"static",
"<",
"T",
">",
"T",
"firstOrNull",
"(",
"Collection",
"<",
"T",
">",
"items",
",",
"Predicate",
"<",
"T",
">",
"predicate",
")",
"{",
"if",
"(",
"!",
"isEmpty",
"(",
"items",
")",
")",
"{",
"for",
"(",
"T",
"item",
":",
"items",
")",
"{",
"if",
"(",
"predicate",
".",
"apply",
"(",
"item",
")",
")",
"{",
"return",
"item",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}"
] |
Returns the first element from a collection that matches the given predicate or null if no matching element is
found.
@param items source items
@param predicate predicate function
@param <T> type of elements in the source collection
@return the first element that matches the given predicate or null if no matching element is found
|
[
"Returns",
"the",
"first",
"element",
"from",
"a",
"collection",
"that",
"matches",
"the",
"given",
"predicate",
"or",
"null",
"if",
"no",
"matching",
"element",
"is",
"found",
"."
] |
2425390ac14f3b6c0a7b04464cf5670060f2dc54
|
https://github.com/simonpercic/CollectionHelper/blob/2425390ac14f3b6c0a7b04464cf5670060f2dc54/collectionhelper/src/main/java/com/github/simonpercic/collectionhelper/CollectionHelper.java#L89-L99
|
155,469
|
simonpercic/CollectionHelper
|
collectionhelper/src/main/java/com/github/simonpercic/collectionhelper/CollectionHelper.java
|
CollectionHelper.count
|
public static <T> int count(Collection<T> items, Predicate<T> predicate) {
int count = 0;
if (!isEmpty(items)) {
for (T element : items) {
if (predicate.apply(element)) {
count++;
}
}
}
return count;
}
|
java
|
public static <T> int count(Collection<T> items, Predicate<T> predicate) {
int count = 0;
if (!isEmpty(items)) {
for (T element : items) {
if (predicate.apply(element)) {
count++;
}
}
}
return count;
}
|
[
"public",
"static",
"<",
"T",
">",
"int",
"count",
"(",
"Collection",
"<",
"T",
">",
"items",
",",
"Predicate",
"<",
"T",
">",
"predicate",
")",
"{",
"int",
"count",
"=",
"0",
";",
"if",
"(",
"!",
"isEmpty",
"(",
"items",
")",
")",
"{",
"for",
"(",
"T",
"element",
":",
"items",
")",
"{",
"if",
"(",
"predicate",
".",
"apply",
"(",
"element",
")",
")",
"{",
"count",
"++",
";",
"}",
"}",
"}",
"return",
"count",
";",
"}"
] |
Returns the number of elements in a collection matching the given predicate.
@param items source items
@param predicate predicate function
@param <T> type of elements in the source collection
@return the number of elements in a collection matching the given predicate
|
[
"Returns",
"the",
"number",
"of",
"elements",
"in",
"a",
"collection",
"matching",
"the",
"given",
"predicate",
"."
] |
2425390ac14f3b6c0a7b04464cf5670060f2dc54
|
https://github.com/simonpercic/CollectionHelper/blob/2425390ac14f3b6c0a7b04464cf5670060f2dc54/collectionhelper/src/main/java/com/github/simonpercic/collectionhelper/CollectionHelper.java#L263-L275
|
155,470
|
simonpercic/CollectionHelper
|
collectionhelper/src/main/java/com/github/simonpercic/collectionhelper/CollectionHelper.java
|
CollectionHelper.map
|
public static <TSource, TResult> List<TResult> map(Collection<TSource> items, Mapper<TSource, TResult> mapper) {
if (isEmpty(items)) {
return new ArrayList<>();
}
List<TResult> result = new ArrayList<>(items.size());
for (TSource item : items) {
TResult mappedItem = mapper.map(item);
result.add(mappedItem);
}
return result;
}
|
java
|
public static <TSource, TResult> List<TResult> map(Collection<TSource> items, Mapper<TSource, TResult> mapper) {
if (isEmpty(items)) {
return new ArrayList<>();
}
List<TResult> result = new ArrayList<>(items.size());
for (TSource item : items) {
TResult mappedItem = mapper.map(item);
result.add(mappedItem);
}
return result;
}
|
[
"public",
"static",
"<",
"TSource",
",",
"TResult",
">",
"List",
"<",
"TResult",
">",
"map",
"(",
"Collection",
"<",
"TSource",
">",
"items",
",",
"Mapper",
"<",
"TSource",
",",
"TResult",
">",
"mapper",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"items",
")",
")",
"{",
"return",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"}",
"List",
"<",
"TResult",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
"items",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"TSource",
"item",
":",
"items",
")",
"{",
"TResult",
"mappedItem",
"=",
"mapper",
".",
"map",
"(",
"item",
")",
";",
"result",
".",
"add",
"(",
"mappedItem",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Projects each element of a collection into a new collection.
@param items source items
@param mapper mapping function
@param <TSource> type of elements in the source collection
@param <TResult> type of elements in the resulting collection
@return a new collection with projected element values
|
[
"Projects",
"each",
"element",
"of",
"a",
"collection",
"into",
"a",
"new",
"collection",
"."
] |
2425390ac14f3b6c0a7b04464cf5670060f2dc54
|
https://github.com/simonpercic/CollectionHelper/blob/2425390ac14f3b6c0a7b04464cf5670060f2dc54/collectionhelper/src/main/java/com/github/simonpercic/collectionhelper/CollectionHelper.java#L286-L299
|
155,471
|
bushidowallet/bushido-java-service
|
bushido-service-lib/src/main/java/com/bccapi/bitlib/util/Base58.java
|
Base58.decodeChecked
|
public static byte[] decodeChecked(String input) {
byte tmp[] = decode(input);
if (tmp == null || tmp.length < 4) {
return null;
}
byte[] bytes = copyOfRange(tmp, 0, tmp.length - 4);
byte[] checksum = copyOfRange(tmp, tmp.length - 4, tmp.length);
tmp = HashUtils.doubleSha256(bytes);
byte[] hash = copyOfRange(tmp, 0, 4);
if (!Arrays.equals(checksum, hash)) {
return null;
}
return bytes;
}
|
java
|
public static byte[] decodeChecked(String input) {
byte tmp[] = decode(input);
if (tmp == null || tmp.length < 4) {
return null;
}
byte[] bytes = copyOfRange(tmp, 0, tmp.length - 4);
byte[] checksum = copyOfRange(tmp, tmp.length - 4, tmp.length);
tmp = HashUtils.doubleSha256(bytes);
byte[] hash = copyOfRange(tmp, 0, 4);
if (!Arrays.equals(checksum, hash)) {
return null;
}
return bytes;
}
|
[
"public",
"static",
"byte",
"[",
"]",
"decodeChecked",
"(",
"String",
"input",
")",
"{",
"byte",
"tmp",
"[",
"]",
"=",
"decode",
"(",
"input",
")",
";",
"if",
"(",
"tmp",
"==",
"null",
"||",
"tmp",
".",
"length",
"<",
"4",
")",
"{",
"return",
"null",
";",
"}",
"byte",
"[",
"]",
"bytes",
"=",
"copyOfRange",
"(",
"tmp",
",",
"0",
",",
"tmp",
".",
"length",
"-",
"4",
")",
";",
"byte",
"[",
"]",
"checksum",
"=",
"copyOfRange",
"(",
"tmp",
",",
"tmp",
".",
"length",
"-",
"4",
",",
"tmp",
".",
"length",
")",
";",
"tmp",
"=",
"HashUtils",
".",
"doubleSha256",
"(",
"bytes",
")",
";",
"byte",
"[",
"]",
"hash",
"=",
"copyOfRange",
"(",
"tmp",
",",
"0",
",",
"4",
")",
";",
"if",
"(",
"!",
"Arrays",
".",
"equals",
"(",
"checksum",
",",
"hash",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"bytes",
";",
"}"
] |
Uses the checksum in the last 4 bytes of the decoded data to verify the
rest are correct. The checksum is removed from the returned data.
@param input base58 encoded string
@return byte[] representation of input string if checksum matches
|
[
"Uses",
"the",
"checksum",
"in",
"the",
"last",
"4",
"bytes",
"of",
"the",
"decoded",
"data",
"to",
"verify",
"the",
"rest",
"are",
"correct",
".",
"The",
"checksum",
"is",
"removed",
"from",
"the",
"returned",
"data",
"."
] |
e1a0157527e57459b509718044d2df44084876a2
|
https://github.com/bushidowallet/bushido-java-service/blob/e1a0157527e57459b509718044d2df44084876a2/bushido-service-lib/src/main/java/com/bccapi/bitlib/util/Base58.java#L168-L183
|
155,472
|
RogerParkinson/madura-objects-parent
|
madura-objects/src/main/java/nz/co/senanque/validationengine/ValidationUtils.java
|
ValidationUtils.getFieldNameWithJavaCase
|
public static String getFieldNameWithJavaCase(final String name)
{
return name==null?null:Character.toLowerCase(name.charAt(0))+name.substring(1);
}
|
java
|
public static String getFieldNameWithJavaCase(final String name)
{
return name==null?null:Character.toLowerCase(name.charAt(0))+name.substring(1);
}
|
[
"public",
"static",
"String",
"getFieldNameWithJavaCase",
"(",
"final",
"String",
"name",
")",
"{",
"return",
"name",
"==",
"null",
"?",
"null",
":",
"Character",
".",
"toLowerCase",
"(",
"name",
".",
"charAt",
"(",
"0",
")",
")",
"+",
"name",
".",
"substring",
"(",
"1",
")",
";",
"}"
] |
Make the first character lower case and leave the rest alone.
@param name
@return the resulting name
|
[
"Make",
"the",
"first",
"character",
"lower",
"case",
"and",
"leave",
"the",
"rest",
"alone",
"."
] |
9b5385dd0437611f0ce8506f63646e018d06fb8e
|
https://github.com/RogerParkinson/madura-objects-parent/blob/9b5385dd0437611f0ce8506f63646e018d06fb8e/madura-objects/src/main/java/nz/co/senanque/validationengine/ValidationUtils.java#L192-L195
|
155,473
|
PureSolTechnologies/parsers
|
parsers/src/main/java/com/puresoltechnologies/parsers/grammar/GrammarConverter.java
|
GrammarConverter.convert
|
private void convert() throws GrammarException, TreeException {
convertOptions();
convertTokenDefinitions();
convertProductions();
grammar = new Grammar(options, tokenDefinitions, productions);
}
|
java
|
private void convert() throws GrammarException, TreeException {
convertOptions();
convertTokenDefinitions();
convertProductions();
grammar = new Grammar(options, tokenDefinitions, productions);
}
|
[
"private",
"void",
"convert",
"(",
")",
"throws",
"GrammarException",
",",
"TreeException",
"{",
"convertOptions",
"(",
")",
";",
"convertTokenDefinitions",
"(",
")",
";",
"convertProductions",
"(",
")",
";",
"grammar",
"=",
"new",
"Grammar",
"(",
"options",
",",
"tokenDefinitions",
",",
"productions",
")",
";",
"}"
] |
This method converts the read AST from grammar file into a final grammar
ready to be used.
@throws GrammarException
@throws TreeException
|
[
"This",
"method",
"converts",
"the",
"read",
"AST",
"from",
"grammar",
"file",
"into",
"a",
"final",
"grammar",
"ready",
"to",
"be",
"used",
"."
] |
61077223b90d3768ff9445ae13036343c98b63cd
|
https://github.com/PureSolTechnologies/parsers/blob/61077223b90d3768ff9445ae13036343c98b63cd/parsers/src/main/java/com/puresoltechnologies/parsers/grammar/GrammarConverter.java#L90-L95
|
155,474
|
PureSolTechnologies/parsers
|
parsers/src/main/java/com/puresoltechnologies/parsers/grammar/GrammarConverter.java
|
GrammarConverter.convertOptions
|
private void convertOptions() throws TreeException {
options = new Properties();
ParseTreeNode optionList = parserTree.getChild("GrammarOptions").getChild(
"GrammarOptionList");
for (ParseTreeNode option : optionList.getChildren("GrammarOption")) {
String name = option.getChild("PropertyIdentifier").getText();
String value = option.getChild("Literal").getText();
if (value.startsWith("'") || value.startsWith("\"")) {
value = value.substring(1, value.length() - 1);
}
options.put(name, value);
}
// normalizeToBNF = Boolean.valueOf(options.getProperty(
// "grammar.normalize_to_bnf", "true"));
}
|
java
|
private void convertOptions() throws TreeException {
options = new Properties();
ParseTreeNode optionList = parserTree.getChild("GrammarOptions").getChild(
"GrammarOptionList");
for (ParseTreeNode option : optionList.getChildren("GrammarOption")) {
String name = option.getChild("PropertyIdentifier").getText();
String value = option.getChild("Literal").getText();
if (value.startsWith("'") || value.startsWith("\"")) {
value = value.substring(1, value.length() - 1);
}
options.put(name, value);
}
// normalizeToBNF = Boolean.valueOf(options.getProperty(
// "grammar.normalize_to_bnf", "true"));
}
|
[
"private",
"void",
"convertOptions",
"(",
")",
"throws",
"TreeException",
"{",
"options",
"=",
"new",
"Properties",
"(",
")",
";",
"ParseTreeNode",
"optionList",
"=",
"parserTree",
".",
"getChild",
"(",
"\"GrammarOptions\"",
")",
".",
"getChild",
"(",
"\"GrammarOptionList\"",
")",
";",
"for",
"(",
"ParseTreeNode",
"option",
":",
"optionList",
".",
"getChildren",
"(",
"\"GrammarOption\"",
")",
")",
"{",
"String",
"name",
"=",
"option",
".",
"getChild",
"(",
"\"PropertyIdentifier\"",
")",
".",
"getText",
"(",
")",
";",
"String",
"value",
"=",
"option",
".",
"getChild",
"(",
"\"Literal\"",
")",
".",
"getText",
"(",
")",
";",
"if",
"(",
"value",
".",
"startsWith",
"(",
"\"'\"",
")",
"||",
"value",
".",
"startsWith",
"(",
"\"\\\"\"",
")",
")",
"{",
"value",
"=",
"value",
".",
"substring",
"(",
"1",
",",
"value",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"}",
"options",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"}",
"// normalizeToBNF = Boolean.valueOf(options.getProperty(",
"// \"grammar.normalize_to_bnf\", \"true\"));",
"}"
] |
This method converts the options part of the AST.
@throws TreeException
|
[
"This",
"method",
"converts",
"the",
"options",
"part",
"of",
"the",
"AST",
"."
] |
61077223b90d3768ff9445ae13036343c98b63cd
|
https://github.com/PureSolTechnologies/parsers/blob/61077223b90d3768ff9445ae13036343c98b63cd/parsers/src/main/java/com/puresoltechnologies/parsers/grammar/GrammarConverter.java#L102-L116
|
155,475
|
PureSolTechnologies/parsers
|
parsers/src/main/java/com/puresoltechnologies/parsers/grammar/GrammarConverter.java
|
GrammarConverter.convertTokenDefinitions
|
private void convertTokenDefinitions() throws GrammarException,
TreeException {
tokenVisibility.clear();
Map<String, ParseTreeNode> helpers = getHelperTokens();
Map<String, ParseTreeNode> tokens = getTokens();
convertTokenDefinitions(helpers, tokens);
}
|
java
|
private void convertTokenDefinitions() throws GrammarException,
TreeException {
tokenVisibility.clear();
Map<String, ParseTreeNode> helpers = getHelperTokens();
Map<String, ParseTreeNode> tokens = getTokens();
convertTokenDefinitions(helpers, tokens);
}
|
[
"private",
"void",
"convertTokenDefinitions",
"(",
")",
"throws",
"GrammarException",
",",
"TreeException",
"{",
"tokenVisibility",
".",
"clear",
"(",
")",
";",
"Map",
"<",
"String",
",",
"ParseTreeNode",
">",
"helpers",
"=",
"getHelperTokens",
"(",
")",
";",
"Map",
"<",
"String",
",",
"ParseTreeNode",
">",
"tokens",
"=",
"getTokens",
"(",
")",
";",
"convertTokenDefinitions",
"(",
"helpers",
",",
"tokens",
")",
";",
"}"
] |
This method converts the token definitions to the token definition set.
@throws GrammarException
@throws TreeException
|
[
"This",
"method",
"converts",
"the",
"token",
"definitions",
"to",
"the",
"token",
"definition",
"set",
"."
] |
61077223b90d3768ff9445ae13036343c98b63cd
|
https://github.com/PureSolTechnologies/parsers/blob/61077223b90d3768ff9445ae13036343c98b63cd/parsers/src/main/java/com/puresoltechnologies/parsers/grammar/GrammarConverter.java#L124-L130
|
155,476
|
PureSolTechnologies/parsers
|
parsers/src/main/java/com/puresoltechnologies/parsers/grammar/GrammarConverter.java
|
GrammarConverter.getHelperTokens
|
private Map<String, ParseTreeNode> getHelperTokens() throws TreeException {
Map<String, ParseTreeNode> helpers = new HashMap<String, ParseTreeNode>();
ParseTreeNode helperTree = parserTree.getChild("Helper");
ParseTreeNode helperDefinitions = helperTree.getChild("HelperDefinitions");
for (ParseTreeNode helperDefinition : helperDefinitions
.getChildren("HelperDefinition")) {
String identifier = helperDefinition.getChild("IDENTIFIER")
.getText();
helpers.put(identifier, helperDefinition);
}
return helpers;
}
|
java
|
private Map<String, ParseTreeNode> getHelperTokens() throws TreeException {
Map<String, ParseTreeNode> helpers = new HashMap<String, ParseTreeNode>();
ParseTreeNode helperTree = parserTree.getChild("Helper");
ParseTreeNode helperDefinitions = helperTree.getChild("HelperDefinitions");
for (ParseTreeNode helperDefinition : helperDefinitions
.getChildren("HelperDefinition")) {
String identifier = helperDefinition.getChild("IDENTIFIER")
.getText();
helpers.put(identifier, helperDefinition);
}
return helpers;
}
|
[
"private",
"Map",
"<",
"String",
",",
"ParseTreeNode",
">",
"getHelperTokens",
"(",
")",
"throws",
"TreeException",
"{",
"Map",
"<",
"String",
",",
"ParseTreeNode",
">",
"helpers",
"=",
"new",
"HashMap",
"<",
"String",
",",
"ParseTreeNode",
">",
"(",
")",
";",
"ParseTreeNode",
"helperTree",
"=",
"parserTree",
".",
"getChild",
"(",
"\"Helper\"",
")",
";",
"ParseTreeNode",
"helperDefinitions",
"=",
"helperTree",
".",
"getChild",
"(",
"\"HelperDefinitions\"",
")",
";",
"for",
"(",
"ParseTreeNode",
"helperDefinition",
":",
"helperDefinitions",
".",
"getChildren",
"(",
"\"HelperDefinition\"",
")",
")",
"{",
"String",
"identifier",
"=",
"helperDefinition",
".",
"getChild",
"(",
"\"IDENTIFIER\"",
")",
".",
"getText",
"(",
")",
";",
"helpers",
".",
"put",
"(",
"identifier",
",",
"helperDefinition",
")",
";",
"}",
"return",
"helpers",
";",
"}"
] |
This method reads all helpers from AST and returns a map with all of
them.
@return
@throws TreeException
|
[
"This",
"method",
"reads",
"all",
"helpers",
"from",
"AST",
"and",
"returns",
"a",
"map",
"with",
"all",
"of",
"them",
"."
] |
61077223b90d3768ff9445ae13036343c98b63cd
|
https://github.com/PureSolTechnologies/parsers/blob/61077223b90d3768ff9445ae13036343c98b63cd/parsers/src/main/java/com/puresoltechnologies/parsers/grammar/GrammarConverter.java#L139-L150
|
155,477
|
PureSolTechnologies/parsers
|
parsers/src/main/java/com/puresoltechnologies/parsers/grammar/GrammarConverter.java
|
GrammarConverter.getTokens
|
private Map<String, ParseTreeNode> getTokens() throws GrammarException,
TreeException {
Map<String, ParseTreeNode> tokens = new HashMap<String, ParseTreeNode>();
ParseTreeNode tokensTree = parserTree.getChild("Tokens");
ParseTreeNode tokenDefinitions = tokensTree.getChild("TokenDefinitions");
for (ParseTreeNode tokenDefinition : tokenDefinitions
.getChildren("TokenDefinition")) {
// identifier...
String identifier = tokenDefinition.getChild("IDENTIFIER")
.getText();
// token parts...
tokens.put(identifier, tokenDefinition);
// visibility...
ParseTreeNode visibilityAST = tokenDefinition.getChild("Visibility");
if (visibilityAST.hasChild("HIDE")) {
tokenVisibility.put(identifier, Visibility.HIDDEN);
} else if (visibilityAST.hasChild("IGNORE")) {
tokenVisibility.put(identifier, Visibility.IGNORED);
} else {
tokenVisibility.put(identifier, Visibility.VISIBLE);
}
}
return tokens;
}
|
java
|
private Map<String, ParseTreeNode> getTokens() throws GrammarException,
TreeException {
Map<String, ParseTreeNode> tokens = new HashMap<String, ParseTreeNode>();
ParseTreeNode tokensTree = parserTree.getChild("Tokens");
ParseTreeNode tokenDefinitions = tokensTree.getChild("TokenDefinitions");
for (ParseTreeNode tokenDefinition : tokenDefinitions
.getChildren("TokenDefinition")) {
// identifier...
String identifier = tokenDefinition.getChild("IDENTIFIER")
.getText();
// token parts...
tokens.put(identifier, tokenDefinition);
// visibility...
ParseTreeNode visibilityAST = tokenDefinition.getChild("Visibility");
if (visibilityAST.hasChild("HIDE")) {
tokenVisibility.put(identifier, Visibility.HIDDEN);
} else if (visibilityAST.hasChild("IGNORE")) {
tokenVisibility.put(identifier, Visibility.IGNORED);
} else {
tokenVisibility.put(identifier, Visibility.VISIBLE);
}
}
return tokens;
}
|
[
"private",
"Map",
"<",
"String",
",",
"ParseTreeNode",
">",
"getTokens",
"(",
")",
"throws",
"GrammarException",
",",
"TreeException",
"{",
"Map",
"<",
"String",
",",
"ParseTreeNode",
">",
"tokens",
"=",
"new",
"HashMap",
"<",
"String",
",",
"ParseTreeNode",
">",
"(",
")",
";",
"ParseTreeNode",
"tokensTree",
"=",
"parserTree",
".",
"getChild",
"(",
"\"Tokens\"",
")",
";",
"ParseTreeNode",
"tokenDefinitions",
"=",
"tokensTree",
".",
"getChild",
"(",
"\"TokenDefinitions\"",
")",
";",
"for",
"(",
"ParseTreeNode",
"tokenDefinition",
":",
"tokenDefinitions",
".",
"getChildren",
"(",
"\"TokenDefinition\"",
")",
")",
"{",
"// identifier...",
"String",
"identifier",
"=",
"tokenDefinition",
".",
"getChild",
"(",
"\"IDENTIFIER\"",
")",
".",
"getText",
"(",
")",
";",
"// token parts...",
"tokens",
".",
"put",
"(",
"identifier",
",",
"tokenDefinition",
")",
";",
"// visibility...",
"ParseTreeNode",
"visibilityAST",
"=",
"tokenDefinition",
".",
"getChild",
"(",
"\"Visibility\"",
")",
";",
"if",
"(",
"visibilityAST",
".",
"hasChild",
"(",
"\"HIDE\"",
")",
")",
"{",
"tokenVisibility",
".",
"put",
"(",
"identifier",
",",
"Visibility",
".",
"HIDDEN",
")",
";",
"}",
"else",
"if",
"(",
"visibilityAST",
".",
"hasChild",
"(",
"\"IGNORE\"",
")",
")",
"{",
"tokenVisibility",
".",
"put",
"(",
"identifier",
",",
"Visibility",
".",
"IGNORED",
")",
";",
"}",
"else",
"{",
"tokenVisibility",
".",
"put",
"(",
"identifier",
",",
"Visibility",
".",
"VISIBLE",
")",
";",
"}",
"}",
"return",
"tokens",
";",
"}"
] |
This method reads all tokens from AST and returns a map with all of them.
@return
@throws TreeException
|
[
"This",
"method",
"reads",
"all",
"tokens",
"from",
"AST",
"and",
"returns",
"a",
"map",
"with",
"all",
"of",
"them",
"."
] |
61077223b90d3768ff9445ae13036343c98b63cd
|
https://github.com/PureSolTechnologies/parsers/blob/61077223b90d3768ff9445ae13036343c98b63cd/parsers/src/main/java/com/puresoltechnologies/parsers/grammar/GrammarConverter.java#L158-L181
|
155,478
|
PureSolTechnologies/parsers
|
parsers/src/main/java/com/puresoltechnologies/parsers/grammar/GrammarConverter.java
|
GrammarConverter.convertTokenDefinitions
|
private void convertTokenDefinitions(Map<String, ParseTreeNode> helpers,
Map<String, ParseTreeNode> tokens) throws GrammarException,
TreeException {
tokenDefinitions = new TokenDefinitionSet();
for (ParseTreeNode tokenDefinitionAST : parserTree.getChild("Tokens")
.getChild("TokenDefinitions").getChildren("TokenDefinition")) {
TokenDefinition convertedTokenDefinition = getTokenDefinition(
tokenDefinitionAST, helpers, tokens);
tokenDefinitions.addDefinition(convertedTokenDefinition);
}
}
|
java
|
private void convertTokenDefinitions(Map<String, ParseTreeNode> helpers,
Map<String, ParseTreeNode> tokens) throws GrammarException,
TreeException {
tokenDefinitions = new TokenDefinitionSet();
for (ParseTreeNode tokenDefinitionAST : parserTree.getChild("Tokens")
.getChild("TokenDefinitions").getChildren("TokenDefinition")) {
TokenDefinition convertedTokenDefinition = getTokenDefinition(
tokenDefinitionAST, helpers, tokens);
tokenDefinitions.addDefinition(convertedTokenDefinition);
}
}
|
[
"private",
"void",
"convertTokenDefinitions",
"(",
"Map",
"<",
"String",
",",
"ParseTreeNode",
">",
"helpers",
",",
"Map",
"<",
"String",
",",
"ParseTreeNode",
">",
"tokens",
")",
"throws",
"GrammarException",
",",
"TreeException",
"{",
"tokenDefinitions",
"=",
"new",
"TokenDefinitionSet",
"(",
")",
";",
"for",
"(",
"ParseTreeNode",
"tokenDefinitionAST",
":",
"parserTree",
".",
"getChild",
"(",
"\"Tokens\"",
")",
".",
"getChild",
"(",
"\"TokenDefinitions\"",
")",
".",
"getChildren",
"(",
"\"TokenDefinition\"",
")",
")",
"{",
"TokenDefinition",
"convertedTokenDefinition",
"=",
"getTokenDefinition",
"(",
"tokenDefinitionAST",
",",
"helpers",
",",
"tokens",
")",
";",
"tokenDefinitions",
".",
"addDefinition",
"(",
"convertedTokenDefinition",
")",
";",
"}",
"}"
] |
This method starts and controls the process for final conversion of all
tokens from the token and helper skeletons.
@param helpers
@param tokens
@throws GrammarException
@throws TreeException
|
[
"This",
"method",
"starts",
"and",
"controls",
"the",
"process",
"for",
"final",
"conversion",
"of",
"all",
"tokens",
"from",
"the",
"token",
"and",
"helper",
"skeletons",
"."
] |
61077223b90d3768ff9445ae13036343c98b63cd
|
https://github.com/PureSolTechnologies/parsers/blob/61077223b90d3768ff9445ae13036343c98b63cd/parsers/src/main/java/com/puresoltechnologies/parsers/grammar/GrammarConverter.java#L192-L202
|
155,479
|
PureSolTechnologies/parsers
|
parsers/src/main/java/com/puresoltechnologies/parsers/grammar/GrammarConverter.java
|
GrammarConverter.getTokenDefinition
|
private TokenDefinition getTokenDefinition(ParseTreeNode tokenDefinition,
Map<String, ParseTreeNode> helpers, Map<String, ParseTreeNode> tokens)
throws GrammarException, TreeException {
String tokenName = tokenDefinition.getChild("IDENTIFIER").getText();
String pattern = createTokenDefinitionPattern(tokenDefinition, helpers,
tokens);
boolean ignoreCase = Boolean.valueOf((String) options
.get("grammar.ignore-case"));
if (tokenVisibility.get(tokenName) != null) {
return new TokenDefinition(tokenName, pattern,
tokenVisibility.get(tokenName), ignoreCase);
} else {
return new TokenDefinition(tokenName, pattern, ignoreCase);
}
}
|
java
|
private TokenDefinition getTokenDefinition(ParseTreeNode tokenDefinition,
Map<String, ParseTreeNode> helpers, Map<String, ParseTreeNode> tokens)
throws GrammarException, TreeException {
String tokenName = tokenDefinition.getChild("IDENTIFIER").getText();
String pattern = createTokenDefinitionPattern(tokenDefinition, helpers,
tokens);
boolean ignoreCase = Boolean.valueOf((String) options
.get("grammar.ignore-case"));
if (tokenVisibility.get(tokenName) != null) {
return new TokenDefinition(tokenName, pattern,
tokenVisibility.get(tokenName), ignoreCase);
} else {
return new TokenDefinition(tokenName, pattern, ignoreCase);
}
}
|
[
"private",
"TokenDefinition",
"getTokenDefinition",
"(",
"ParseTreeNode",
"tokenDefinition",
",",
"Map",
"<",
"String",
",",
"ParseTreeNode",
">",
"helpers",
",",
"Map",
"<",
"String",
",",
"ParseTreeNode",
">",
"tokens",
")",
"throws",
"GrammarException",
",",
"TreeException",
"{",
"String",
"tokenName",
"=",
"tokenDefinition",
".",
"getChild",
"(",
"\"IDENTIFIER\"",
")",
".",
"getText",
"(",
")",
";",
"String",
"pattern",
"=",
"createTokenDefinitionPattern",
"(",
"tokenDefinition",
",",
"helpers",
",",
"tokens",
")",
";",
"boolean",
"ignoreCase",
"=",
"Boolean",
".",
"valueOf",
"(",
"(",
"String",
")",
"options",
".",
"get",
"(",
"\"grammar.ignore-case\"",
")",
")",
";",
"if",
"(",
"tokenVisibility",
".",
"get",
"(",
"tokenName",
")",
"!=",
"null",
")",
"{",
"return",
"new",
"TokenDefinition",
"(",
"tokenName",
",",
"pattern",
",",
"tokenVisibility",
".",
"get",
"(",
"tokenName",
")",
",",
"ignoreCase",
")",
";",
"}",
"else",
"{",
"return",
"new",
"TokenDefinition",
"(",
"tokenName",
",",
"pattern",
",",
"ignoreCase",
")",
";",
"}",
"}"
] |
This is the method which merges all tokens with their helpers.
@param tokenName
@param helpers
@param tokens
@return
@throws GrammarException
@throws TreeException
|
[
"This",
"is",
"the",
"method",
"which",
"merges",
"all",
"tokens",
"with",
"their",
"helpers",
"."
] |
61077223b90d3768ff9445ae13036343c98b63cd
|
https://github.com/PureSolTechnologies/parsers/blob/61077223b90d3768ff9445ae13036343c98b63cd/parsers/src/main/java/com/puresoltechnologies/parsers/grammar/GrammarConverter.java#L214-L228
|
155,480
|
PureSolTechnologies/parsers
|
parsers/src/main/java/com/puresoltechnologies/parsers/grammar/GrammarConverter.java
|
GrammarConverter.convertProductions
|
private void convertProductions() throws TreeException, GrammarException {
productions = new ProductionSet();
ParseTreeNode productionsTree = parserTree.getChild("Productions");
ParseTreeNode productionDefinitions = productionsTree
.getChild("ProductionDefinitions");
for (ParseTreeNode productionDefinition : productionDefinitions
.getChildren("ProductionDefinition")) {
convertProductionGroup(productionDefinition);
}
}
|
java
|
private void convertProductions() throws TreeException, GrammarException {
productions = new ProductionSet();
ParseTreeNode productionsTree = parserTree.getChild("Productions");
ParseTreeNode productionDefinitions = productionsTree
.getChild("ProductionDefinitions");
for (ParseTreeNode productionDefinition : productionDefinitions
.getChildren("ProductionDefinition")) {
convertProductionGroup(productionDefinition);
}
}
|
[
"private",
"void",
"convertProductions",
"(",
")",
"throws",
"TreeException",
",",
"GrammarException",
"{",
"productions",
"=",
"new",
"ProductionSet",
"(",
")",
";",
"ParseTreeNode",
"productionsTree",
"=",
"parserTree",
".",
"getChild",
"(",
"\"Productions\"",
")",
";",
"ParseTreeNode",
"productionDefinitions",
"=",
"productionsTree",
".",
"getChild",
"(",
"\"ProductionDefinitions\"",
")",
";",
"for",
"(",
"ParseTreeNode",
"productionDefinition",
":",
"productionDefinitions",
".",
"getChildren",
"(",
"\"ProductionDefinition\"",
")",
")",
"{",
"convertProductionGroup",
"(",
"productionDefinition",
")",
";",
"}",
"}"
] |
This method converts all productions from the AST into a ProductionSet.
@throws TreeException
@throws GrammarException
|
[
"This",
"method",
"converts",
"all",
"productions",
"from",
"the",
"AST",
"into",
"a",
"ProductionSet",
"."
] |
61077223b90d3768ff9445ae13036343c98b63cd
|
https://github.com/PureSolTechnologies/parsers/blob/61077223b90d3768ff9445ae13036343c98b63cd/parsers/src/main/java/com/puresoltechnologies/parsers/grammar/GrammarConverter.java#L293-L302
|
155,481
|
PureSolTechnologies/parsers
|
parsers/src/main/java/com/puresoltechnologies/parsers/grammar/GrammarConverter.java
|
GrammarConverter.convertSingleProductions
|
private void convertSingleProductions(String productionName,
ParseTreeNode productionConstructions) throws TreeException,
GrammarException {
for (ParseTreeNode productionConstruction : productionConstructions
.getChildren("ProductionConstruction")) {
convertSingleProduction(productionName, productionConstruction);
}
}
|
java
|
private void convertSingleProductions(String productionName,
ParseTreeNode productionConstructions) throws TreeException,
GrammarException {
for (ParseTreeNode productionConstruction : productionConstructions
.getChildren("ProductionConstruction")) {
convertSingleProduction(productionName, productionConstruction);
}
}
|
[
"private",
"void",
"convertSingleProductions",
"(",
"String",
"productionName",
",",
"ParseTreeNode",
"productionConstructions",
")",
"throws",
"TreeException",
",",
"GrammarException",
"{",
"for",
"(",
"ParseTreeNode",
"productionConstruction",
":",
"productionConstructions",
".",
"getChildren",
"(",
"\"ProductionConstruction\"",
")",
")",
"{",
"convertSingleProduction",
"(",
"productionName",
",",
"productionConstruction",
")",
";",
"}",
"}"
] |
This method converts the list of productions from a group with a given
name into a set of productions.
@param productionName
@param productionConstructions
@throws TreeException
@throws GrammarException
|
[
"This",
"method",
"converts",
"the",
"list",
"of",
"productions",
"from",
"a",
"group",
"with",
"a",
"given",
"name",
"into",
"a",
"set",
"of",
"productions",
"."
] |
61077223b90d3768ff9445ae13036343c98b63cd
|
https://github.com/PureSolTechnologies/parsers/blob/61077223b90d3768ff9445ae13036343c98b63cd/parsers/src/main/java/com/puresoltechnologies/parsers/grammar/GrammarConverter.java#L330-L337
|
155,482
|
PureSolTechnologies/parsers
|
parsers/src/main/java/com/puresoltechnologies/parsers/grammar/GrammarConverter.java
|
GrammarConverter.convertSingleProduction
|
private void convertSingleProduction(String productionName,
ParseTreeNode productionConstruction) throws TreeException,
GrammarException {
ParseTreeNode alternativeIdentifier = productionConstruction
.getChild("AlternativeIdentifier");
Production production;
if (alternativeIdentifier == null) {
production = new Production(productionName);
} else {
ParseTreeNode alternativeIdentifierName = alternativeIdentifier
.getChild("IDENTIFIER");
if (alternativeIdentifierName == null) {
production = new Production(productionName);
} else {
production = new Production(productionName,
alternativeIdentifierName.getText());
}
}
production
.addAllConstructions(getConstructions(productionConstruction));
addOptions(production, productionConstruction);
productions.add(production);
}
|
java
|
private void convertSingleProduction(String productionName,
ParseTreeNode productionConstruction) throws TreeException,
GrammarException {
ParseTreeNode alternativeIdentifier = productionConstruction
.getChild("AlternativeIdentifier");
Production production;
if (alternativeIdentifier == null) {
production = new Production(productionName);
} else {
ParseTreeNode alternativeIdentifierName = alternativeIdentifier
.getChild("IDENTIFIER");
if (alternativeIdentifierName == null) {
production = new Production(productionName);
} else {
production = new Production(productionName,
alternativeIdentifierName.getText());
}
}
production
.addAllConstructions(getConstructions(productionConstruction));
addOptions(production, productionConstruction);
productions.add(production);
}
|
[
"private",
"void",
"convertSingleProduction",
"(",
"String",
"productionName",
",",
"ParseTreeNode",
"productionConstruction",
")",
"throws",
"TreeException",
",",
"GrammarException",
"{",
"ParseTreeNode",
"alternativeIdentifier",
"=",
"productionConstruction",
".",
"getChild",
"(",
"\"AlternativeIdentifier\"",
")",
";",
"Production",
"production",
";",
"if",
"(",
"alternativeIdentifier",
"==",
"null",
")",
"{",
"production",
"=",
"new",
"Production",
"(",
"productionName",
")",
";",
"}",
"else",
"{",
"ParseTreeNode",
"alternativeIdentifierName",
"=",
"alternativeIdentifier",
".",
"getChild",
"(",
"\"IDENTIFIER\"",
")",
";",
"if",
"(",
"alternativeIdentifierName",
"==",
"null",
")",
"{",
"production",
"=",
"new",
"Production",
"(",
"productionName",
")",
";",
"}",
"else",
"{",
"production",
"=",
"new",
"Production",
"(",
"productionName",
",",
"alternativeIdentifierName",
".",
"getText",
"(",
")",
")",
";",
"}",
"}",
"production",
".",
"addAllConstructions",
"(",
"getConstructions",
"(",
"productionConstruction",
")",
")",
";",
"addOptions",
"(",
"production",
",",
"productionConstruction",
")",
";",
"productions",
".",
"add",
"(",
"production",
")",
";",
"}"
] |
This method converts a single production from a list of productions
within a production group into a single production. Some additional
productions might be created during the way due to construction grouping
and quantifiers.
The alternative name for a production is processed here, too.
@param productionName
@param productionConstruction
@throws TreeException
@throws GrammarException
|
[
"This",
"method",
"converts",
"a",
"single",
"production",
"from",
"a",
"list",
"of",
"productions",
"within",
"a",
"production",
"group",
"into",
"a",
"single",
"production",
".",
"Some",
"additional",
"productions",
"might",
"be",
"created",
"during",
"the",
"way",
"due",
"to",
"construction",
"grouping",
"and",
"quantifiers",
"."
] |
61077223b90d3768ff9445ae13036343c98b63cd
|
https://github.com/PureSolTechnologies/parsers/blob/61077223b90d3768ff9445ae13036343c98b63cd/parsers/src/main/java/com/puresoltechnologies/parsers/grammar/GrammarConverter.java#L352-L374
|
155,483
|
PureSolTechnologies/parsers
|
parsers/src/main/java/com/puresoltechnologies/parsers/grammar/GrammarConverter.java
|
GrammarConverter.createNewIdentifier
|
private String createNewIdentifier(ParseTreeNode productionPart, String suffix)
throws TreeException {
String identifier = "";
if (productionPart.hasChild("IDENTIFIER")) {
identifier = productionPart.getChild("IDENTIFIER").getText();
} else if (productionPart.hasChild("STRING_LITERAL")) {
identifier = productionPart.getChild("STRING_LITERAL").getText();
}
return createIdentifierName(identifier, suffix);
}
|
java
|
private String createNewIdentifier(ParseTreeNode productionPart, String suffix)
throws TreeException {
String identifier = "";
if (productionPart.hasChild("IDENTIFIER")) {
identifier = productionPart.getChild("IDENTIFIER").getText();
} else if (productionPart.hasChild("STRING_LITERAL")) {
identifier = productionPart.getChild("STRING_LITERAL").getText();
}
return createIdentifierName(identifier, suffix);
}
|
[
"private",
"String",
"createNewIdentifier",
"(",
"ParseTreeNode",
"productionPart",
",",
"String",
"suffix",
")",
"throws",
"TreeException",
"{",
"String",
"identifier",
"=",
"\"\"",
";",
"if",
"(",
"productionPart",
".",
"hasChild",
"(",
"\"IDENTIFIER\"",
")",
")",
"{",
"identifier",
"=",
"productionPart",
".",
"getChild",
"(",
"\"IDENTIFIER\"",
")",
".",
"getText",
"(",
")",
";",
"}",
"else",
"if",
"(",
"productionPart",
".",
"hasChild",
"(",
"\"STRING_LITERAL\"",
")",
")",
"{",
"identifier",
"=",
"productionPart",
".",
"getChild",
"(",
"\"STRING_LITERAL\"",
")",
".",
"getText",
"(",
")",
";",
"}",
"return",
"createIdentifierName",
"(",
"identifier",
",",
"suffix",
")",
";",
"}"
] |
This method generates a new construction identifier for an automatically
generated BNF production for optionals, optional lists and lists.
@param productionPart
@param suffix
@return
@throws TreeException
|
[
"This",
"method",
"generates",
"a",
"new",
"construction",
"identifier",
"for",
"an",
"automatically",
"generated",
"BNF",
"production",
"for",
"optionals",
"optional",
"lists",
"and",
"lists",
"."
] |
61077223b90d3768ff9445ae13036343c98b63cd
|
https://github.com/PureSolTechnologies/parsers/blob/61077223b90d3768ff9445ae13036343c98b63cd/parsers/src/main/java/com/puresoltechnologies/parsers/grammar/GrammarConverter.java#L499-L508
|
155,484
|
hudson3-plugins/warnings-plugin
|
src/main/java/hudson/plugins/warnings/parser/MsBuildParser.java
|
MsBuildParser.determineFileName
|
private String determineFileName(final Matcher matcher) {
String fileName;
if (StringUtils.isNotBlank(matcher.group(3))) {
fileName = matcher.group(3);
}
else if (StringUtils.isNotBlank(matcher.group(7))) {
fileName = matcher.group(7);
}
else {
fileName = matcher.group(1);
}
if (StringUtils.isBlank(fileName)) {
fileName = StringUtils.substringBetween(matcher.group(6), "'");
}
if (StringUtils.isBlank(fileName)) {
fileName = "unknown.file";
}
return fileName;
}
|
java
|
private String determineFileName(final Matcher matcher) {
String fileName;
if (StringUtils.isNotBlank(matcher.group(3))) {
fileName = matcher.group(3);
}
else if (StringUtils.isNotBlank(matcher.group(7))) {
fileName = matcher.group(7);
}
else {
fileName = matcher.group(1);
}
if (StringUtils.isBlank(fileName)) {
fileName = StringUtils.substringBetween(matcher.group(6), "'");
}
if (StringUtils.isBlank(fileName)) {
fileName = "unknown.file";
}
return fileName;
}
|
[
"private",
"String",
"determineFileName",
"(",
"final",
"Matcher",
"matcher",
")",
"{",
"String",
"fileName",
";",
"if",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"matcher",
".",
"group",
"(",
"3",
")",
")",
")",
"{",
"fileName",
"=",
"matcher",
".",
"group",
"(",
"3",
")",
";",
"}",
"else",
"if",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"matcher",
".",
"group",
"(",
"7",
")",
")",
")",
"{",
"fileName",
"=",
"matcher",
".",
"group",
"(",
"7",
")",
";",
"}",
"else",
"{",
"fileName",
"=",
"matcher",
".",
"group",
"(",
"1",
")",
";",
"}",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"fileName",
")",
")",
"{",
"fileName",
"=",
"StringUtils",
".",
"substringBetween",
"(",
"matcher",
".",
"group",
"(",
"6",
")",
",",
"\"'\"",
")",
";",
"}",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"fileName",
")",
")",
"{",
"fileName",
"=",
"\"unknown.file\"",
";",
"}",
"return",
"fileName",
";",
"}"
] |
Determines the name of the file that is cause of the warning.
@param matcher
the matcher to get the matches from
@return the name of the file with a warning
|
[
"Determines",
"the",
"name",
"of",
"the",
"file",
"that",
"is",
"cause",
"of",
"the",
"warning",
"."
] |
462c9f3dffede9120173935567392b22520b0966
|
https://github.com/hudson3-plugins/warnings-plugin/blob/462c9f3dffede9120173935567392b22520b0966/src/main/java/hudson/plugins/warnings/parser/MsBuildParser.java#L64-L82
|
155,485
|
hudson3-plugins/warnings-plugin
|
src/main/java/hudson/plugins/warnings/parser/MsBuildParser.java
|
MsBuildParser.determinePriority
|
private Priority determinePriority(final Matcher matcher) {
if (isOfType(matcher, "note") || isOfType(matcher, "info")) {
return Priority.LOW;
}
else if (isOfType(matcher, "warning")) {
return Priority.NORMAL;
}
return Priority.HIGH;
}
|
java
|
private Priority determinePriority(final Matcher matcher) {
if (isOfType(matcher, "note") || isOfType(matcher, "info")) {
return Priority.LOW;
}
else if (isOfType(matcher, "warning")) {
return Priority.NORMAL;
}
return Priority.HIGH;
}
|
[
"private",
"Priority",
"determinePriority",
"(",
"final",
"Matcher",
"matcher",
")",
"{",
"if",
"(",
"isOfType",
"(",
"matcher",
",",
"\"note\"",
")",
"||",
"isOfType",
"(",
"matcher",
",",
"\"info\"",
")",
")",
"{",
"return",
"Priority",
".",
"LOW",
";",
"}",
"else",
"if",
"(",
"isOfType",
"(",
"matcher",
",",
"\"warning\"",
")",
")",
"{",
"return",
"Priority",
".",
"NORMAL",
";",
"}",
"return",
"Priority",
".",
"HIGH",
";",
"}"
] |
Determines the priority of the warning.
@param matcher
the matcher to get the matches from
@return the priority of the warning
|
[
"Determines",
"the",
"priority",
"of",
"the",
"warning",
"."
] |
462c9f3dffede9120173935567392b22520b0966
|
https://github.com/hudson3-plugins/warnings-plugin/blob/462c9f3dffede9120173935567392b22520b0966/src/main/java/hudson/plugins/warnings/parser/MsBuildParser.java#L91-L99
|
155,486
|
hudson3-plugins/warnings-plugin
|
src/main/java/hudson/plugins/warnings/parser/MsBuildParser.java
|
MsBuildParser.isOfType
|
private boolean isOfType(final Matcher matcher, final String type) {
return StringUtils.containsIgnoreCase(matcher.group(4), type);
}
|
java
|
private boolean isOfType(final Matcher matcher, final String type) {
return StringUtils.containsIgnoreCase(matcher.group(4), type);
}
|
[
"private",
"boolean",
"isOfType",
"(",
"final",
"Matcher",
"matcher",
",",
"final",
"String",
"type",
")",
"{",
"return",
"StringUtils",
".",
"containsIgnoreCase",
"(",
"matcher",
".",
"group",
"(",
"4",
")",
",",
"type",
")",
";",
"}"
] |
Returns whether the warning type is of the specified type.
@param matcher
the matcher
@param type
the type to match with
@return <code>true</code> if the warning type is of the specified type
|
[
"Returns",
"whether",
"the",
"warning",
"type",
"is",
"of",
"the",
"specified",
"type",
"."
] |
462c9f3dffede9120173935567392b22520b0966
|
https://github.com/hudson3-plugins/warnings-plugin/blob/462c9f3dffede9120173935567392b22520b0966/src/main/java/hudson/plugins/warnings/parser/MsBuildParser.java#L110-L112
|
155,487
|
pip-services3-java/pip-services3-commons-java
|
src/org/pipservices3/commons/convert/DateTimeConverter.java
|
DateTimeConverter.toNullableDateTime
|
public static ZonedDateTime toNullableDateTime(Object value) {
if (value == null)
return null;
if (value instanceof ZonedDateTime)
return (ZonedDateTime) value;
if (value instanceof Calendar) {
Calendar calendar = (Calendar) value;
return ZonedDateTime.ofInstant(calendar.toInstant(), calendar.getTimeZone().toZoneId());
}
if (value instanceof Date)
return ZonedDateTime.ofInstant(((Date) value).toInstant(), ZoneId.systemDefault());
if (value instanceof LocalDate)
return ZonedDateTime.of((LocalDate) value, LocalTime.of(0, 0), ZoneId.systemDefault());
if (value instanceof LocalDateTime)
return ZonedDateTime.of((LocalDateTime) value, ZoneId.systemDefault());
if (value instanceof Integer)
return millisToDateTime((int) value);
if (value instanceof Short)
return millisToDateTime((short) value);
if (value instanceof Long)
return millisToDateTime((long) value);
if (value instanceof Float)
return millisToDateTime((long) ((float) value));
if (value instanceof Double)
return millisToDateTime((long) ((double) value));
if (value instanceof Duration)
return millisToDateTime(((Duration) value).toMillis());
if (value instanceof String) {
try {
return ZonedDateTime.parse((String) value, DateTimeFormatter.ISO_OFFSET_DATE_TIME);
} catch (DateTimeParseException ex) {
}
try {
return ZonedDateTime.of(LocalDateTime.parse((String) value, simpleDateTimeFormatter),
ZoneId.systemDefault());
} catch (DateTimeParseException ex) {
}
try {
return ZonedDateTime.of(LocalDate.parse((String) value, simpleDateFormatter), LocalTime.of(0, 0),
ZoneId.systemDefault());
} catch (DateTimeParseException ex) {
}
}
return null;
}
|
java
|
public static ZonedDateTime toNullableDateTime(Object value) {
if (value == null)
return null;
if (value instanceof ZonedDateTime)
return (ZonedDateTime) value;
if (value instanceof Calendar) {
Calendar calendar = (Calendar) value;
return ZonedDateTime.ofInstant(calendar.toInstant(), calendar.getTimeZone().toZoneId());
}
if (value instanceof Date)
return ZonedDateTime.ofInstant(((Date) value).toInstant(), ZoneId.systemDefault());
if (value instanceof LocalDate)
return ZonedDateTime.of((LocalDate) value, LocalTime.of(0, 0), ZoneId.systemDefault());
if (value instanceof LocalDateTime)
return ZonedDateTime.of((LocalDateTime) value, ZoneId.systemDefault());
if (value instanceof Integer)
return millisToDateTime((int) value);
if (value instanceof Short)
return millisToDateTime((short) value);
if (value instanceof Long)
return millisToDateTime((long) value);
if (value instanceof Float)
return millisToDateTime((long) ((float) value));
if (value instanceof Double)
return millisToDateTime((long) ((double) value));
if (value instanceof Duration)
return millisToDateTime(((Duration) value).toMillis());
if (value instanceof String) {
try {
return ZonedDateTime.parse((String) value, DateTimeFormatter.ISO_OFFSET_DATE_TIME);
} catch (DateTimeParseException ex) {
}
try {
return ZonedDateTime.of(LocalDateTime.parse((String) value, simpleDateTimeFormatter),
ZoneId.systemDefault());
} catch (DateTimeParseException ex) {
}
try {
return ZonedDateTime.of(LocalDate.parse((String) value, simpleDateFormatter), LocalTime.of(0, 0),
ZoneId.systemDefault());
} catch (DateTimeParseException ex) {
}
}
return null;
}
|
[
"public",
"static",
"ZonedDateTime",
"toNullableDateTime",
"(",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"value",
"instanceof",
"ZonedDateTime",
")",
"return",
"(",
"ZonedDateTime",
")",
"value",
";",
"if",
"(",
"value",
"instanceof",
"Calendar",
")",
"{",
"Calendar",
"calendar",
"=",
"(",
"Calendar",
")",
"value",
";",
"return",
"ZonedDateTime",
".",
"ofInstant",
"(",
"calendar",
".",
"toInstant",
"(",
")",
",",
"calendar",
".",
"getTimeZone",
"(",
")",
".",
"toZoneId",
"(",
")",
")",
";",
"}",
"if",
"(",
"value",
"instanceof",
"Date",
")",
"return",
"ZonedDateTime",
".",
"ofInstant",
"(",
"(",
"(",
"Date",
")",
"value",
")",
".",
"toInstant",
"(",
")",
",",
"ZoneId",
".",
"systemDefault",
"(",
")",
")",
";",
"if",
"(",
"value",
"instanceof",
"LocalDate",
")",
"return",
"ZonedDateTime",
".",
"of",
"(",
"(",
"LocalDate",
")",
"value",
",",
"LocalTime",
".",
"of",
"(",
"0",
",",
"0",
")",
",",
"ZoneId",
".",
"systemDefault",
"(",
")",
")",
";",
"if",
"(",
"value",
"instanceof",
"LocalDateTime",
")",
"return",
"ZonedDateTime",
".",
"of",
"(",
"(",
"LocalDateTime",
")",
"value",
",",
"ZoneId",
".",
"systemDefault",
"(",
")",
")",
";",
"if",
"(",
"value",
"instanceof",
"Integer",
")",
"return",
"millisToDateTime",
"(",
"(",
"int",
")",
"value",
")",
";",
"if",
"(",
"value",
"instanceof",
"Short",
")",
"return",
"millisToDateTime",
"(",
"(",
"short",
")",
"value",
")",
";",
"if",
"(",
"value",
"instanceof",
"Long",
")",
"return",
"millisToDateTime",
"(",
"(",
"long",
")",
"value",
")",
";",
"if",
"(",
"value",
"instanceof",
"Float",
")",
"return",
"millisToDateTime",
"(",
"(",
"long",
")",
"(",
"(",
"float",
")",
"value",
")",
")",
";",
"if",
"(",
"value",
"instanceof",
"Double",
")",
"return",
"millisToDateTime",
"(",
"(",
"long",
")",
"(",
"(",
"double",
")",
"value",
")",
")",
";",
"if",
"(",
"value",
"instanceof",
"Duration",
")",
"return",
"millisToDateTime",
"(",
"(",
"(",
"Duration",
")",
"value",
")",
".",
"toMillis",
"(",
")",
")",
";",
"if",
"(",
"value",
"instanceof",
"String",
")",
"{",
"try",
"{",
"return",
"ZonedDateTime",
".",
"parse",
"(",
"(",
"String",
")",
"value",
",",
"DateTimeFormatter",
".",
"ISO_OFFSET_DATE_TIME",
")",
";",
"}",
"catch",
"(",
"DateTimeParseException",
"ex",
")",
"{",
"}",
"try",
"{",
"return",
"ZonedDateTime",
".",
"of",
"(",
"LocalDateTime",
".",
"parse",
"(",
"(",
"String",
")",
"value",
",",
"simpleDateTimeFormatter",
")",
",",
"ZoneId",
".",
"systemDefault",
"(",
")",
")",
";",
"}",
"catch",
"(",
"DateTimeParseException",
"ex",
")",
"{",
"}",
"try",
"{",
"return",
"ZonedDateTime",
".",
"of",
"(",
"LocalDate",
".",
"parse",
"(",
"(",
"String",
")",
"value",
",",
"simpleDateFormatter",
")",
",",
"LocalTime",
".",
"of",
"(",
"0",
",",
"0",
")",
",",
"ZoneId",
".",
"systemDefault",
"(",
")",
")",
";",
"}",
"catch",
"(",
"DateTimeParseException",
"ex",
")",
"{",
"}",
"}",
"return",
"null",
";",
"}"
] |
Converts value into Date or returns null when conversion is not possible.
@param value the value to convert.
@return Date value or null when conversion is not supported.
|
[
"Converts",
"value",
"into",
"Date",
"or",
"returns",
"null",
"when",
"conversion",
"is",
"not",
"possible",
"."
] |
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
|
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/convert/DateTimeConverter.java#L39-L90
|
155,488
|
pip-services3-java/pip-services3-commons-java
|
src/org/pipservices3/commons/convert/DateTimeConverter.java
|
DateTimeConverter.toDateTimeWithDefault
|
public static ZonedDateTime toDateTimeWithDefault(Object value, ZonedDateTime defaultValue) {
ZonedDateTime result = toNullableDateTime(value);
return result != null ? result : defaultValue;
}
|
java
|
public static ZonedDateTime toDateTimeWithDefault(Object value, ZonedDateTime defaultValue) {
ZonedDateTime result = toNullableDateTime(value);
return result != null ? result : defaultValue;
}
|
[
"public",
"static",
"ZonedDateTime",
"toDateTimeWithDefault",
"(",
"Object",
"value",
",",
"ZonedDateTime",
"defaultValue",
")",
"{",
"ZonedDateTime",
"result",
"=",
"toNullableDateTime",
"(",
"value",
")",
";",
"return",
"result",
"!=",
"null",
"?",
"result",
":",
"defaultValue",
";",
"}"
] |
Converts value into Date or returns default when conversion is not possible.
@param value the value to convert.
@param defaultValue the default value.
@return Date value or default when conversion is not supported.
@see DateTimeConverter#toNullableDateTime(Object)
|
[
"Converts",
"value",
"into",
"Date",
"or",
"returns",
"default",
"when",
"conversion",
"is",
"not",
"possible",
"."
] |
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
|
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/convert/DateTimeConverter.java#L114-L117
|
155,489
|
SimiaCryptus/utilities
|
java-util/src/main/java/com/simiacryptus/text/ConvolutionalTrieSerializer.java
|
ConvolutionalTrieSerializer.getUpperBound
|
protected long getUpperBound(TrieNode currentParent, AtomicLong currentChildren, TrieNode godchildNode, int godchildAdjustment) {
return Math.min(
currentParent.getCursorCount() - currentChildren.get(),
godchildNode.getCursorCount() - godchildAdjustment);
}
|
java
|
protected long getUpperBound(TrieNode currentParent, AtomicLong currentChildren, TrieNode godchildNode, int godchildAdjustment) {
return Math.min(
currentParent.getCursorCount() - currentChildren.get(),
godchildNode.getCursorCount() - godchildAdjustment);
}
|
[
"protected",
"long",
"getUpperBound",
"(",
"TrieNode",
"currentParent",
",",
"AtomicLong",
"currentChildren",
",",
"TrieNode",
"godchildNode",
",",
"int",
"godchildAdjustment",
")",
"{",
"return",
"Math",
".",
"min",
"(",
"currentParent",
".",
"getCursorCount",
"(",
")",
"-",
"currentChildren",
".",
"get",
"(",
")",
",",
"godchildNode",
".",
"getCursorCount",
"(",
")",
"-",
"godchildAdjustment",
")",
";",
"}"
] |
Gets upper bound.
@param currentParent the current parent
@param currentChildren the current children
@param godchildNode the godchild node
@param godchildAdjustment the godchild adjustment
@return the upper bound
|
[
"Gets",
"upper",
"bound",
"."
] |
b5a5e73449aae57de7dbfca2ed7a074432c5b17e
|
https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/text/ConvolutionalTrieSerializer.java#L237-L241
|
155,490
|
SimiaCryptus/utilities
|
java-util/src/main/java/com/simiacryptus/util/ArrayUtil.java
|
ArrayUtil.dot
|
public static double dot(@javax.annotation.Nonnull final List<double[]> a, @javax.annotation.Nonnull final List<double[]> b) {
return com.simiacryptus.util.ArrayUtil.sum(com.simiacryptus.util.ArrayUtil.multiply(a, b));
}
|
java
|
public static double dot(@javax.annotation.Nonnull final List<double[]> a, @javax.annotation.Nonnull final List<double[]> b) {
return com.simiacryptus.util.ArrayUtil.sum(com.simiacryptus.util.ArrayUtil.multiply(a, b));
}
|
[
"public",
"static",
"double",
"dot",
"(",
"@",
"javax",
".",
"annotation",
".",
"Nonnull",
"final",
"List",
"<",
"double",
"[",
"]",
">",
"a",
",",
"@",
"javax",
".",
"annotation",
".",
"Nonnull",
"final",
"List",
"<",
"double",
"[",
"]",
">",
"b",
")",
"{",
"return",
"com",
".",
"simiacryptus",
".",
"util",
".",
"ArrayUtil",
".",
"sum",
"(",
"com",
".",
"simiacryptus",
".",
"util",
".",
"ArrayUtil",
".",
"multiply",
"(",
"a",
",",
"b",
")",
")",
";",
"}"
] |
Dot double.
@param a the a
@param b the b
@return the double
|
[
"Dot",
"double",
"."
] |
b5a5e73449aae57de7dbfca2ed7a074432c5b17e
|
https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/util/ArrayUtil.java#L76-L78
|
155,491
|
SimiaCryptus/utilities
|
java-util/src/main/java/com/simiacryptus/util/ArrayUtil.java
|
ArrayUtil.magnitude
|
public static double magnitude(@javax.annotation.Nonnull final double[] a) {
return Math.sqrt(com.simiacryptus.util.ArrayUtil.dot(a, a));
}
|
java
|
public static double magnitude(@javax.annotation.Nonnull final double[] a) {
return Math.sqrt(com.simiacryptus.util.ArrayUtil.dot(a, a));
}
|
[
"public",
"static",
"double",
"magnitude",
"(",
"@",
"javax",
".",
"annotation",
".",
"Nonnull",
"final",
"double",
"[",
"]",
"a",
")",
"{",
"return",
"Math",
".",
"sqrt",
"(",
"com",
".",
"simiacryptus",
".",
"util",
".",
"ArrayUtil",
".",
"dot",
"(",
"a",
",",
"a",
")",
")",
";",
"}"
] |
Magnitude double.
@param a the a
@return the double
|
[
"Magnitude",
"double",
"."
] |
b5a5e73449aae57de7dbfca2ed7a074432c5b17e
|
https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/util/ArrayUtil.java#L86-L88
|
155,492
|
SimiaCryptus/utilities
|
java-util/src/main/java/com/simiacryptus/util/ArrayUtil.java
|
ArrayUtil.mean
|
public static double mean(@javax.annotation.Nonnull final double[] op) {
return com.simiacryptus.util.ArrayUtil.sum(op) / op.length;
}
|
java
|
public static double mean(@javax.annotation.Nonnull final double[] op) {
return com.simiacryptus.util.ArrayUtil.sum(op) / op.length;
}
|
[
"public",
"static",
"double",
"mean",
"(",
"@",
"javax",
".",
"annotation",
".",
"Nonnull",
"final",
"double",
"[",
"]",
"op",
")",
"{",
"return",
"com",
".",
"simiacryptus",
".",
"util",
".",
"ArrayUtil",
".",
"sum",
"(",
"op",
")",
"/",
"op",
".",
"length",
";",
"}"
] |
Mean double.
@param op the op
@return the double
|
[
"Mean",
"double",
"."
] |
b5a5e73449aae57de7dbfca2ed7a074432c5b17e
|
https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/util/ArrayUtil.java#L96-L98
|
155,493
|
SimiaCryptus/utilities
|
java-util/src/main/java/com/simiacryptus/util/ArrayUtil.java
|
ArrayUtil.sum
|
public static double sum(@javax.annotation.Nonnull final List<double[]> a) {
return a.stream().parallel().mapToDouble(x -> Arrays.stream(x).sum()).sum();
}
|
java
|
public static double sum(@javax.annotation.Nonnull final List<double[]> a) {
return a.stream().parallel().mapToDouble(x -> Arrays.stream(x).sum()).sum();
}
|
[
"public",
"static",
"double",
"sum",
"(",
"@",
"javax",
".",
"annotation",
".",
"Nonnull",
"final",
"List",
"<",
"double",
"[",
"]",
">",
"a",
")",
"{",
"return",
"a",
".",
"stream",
"(",
")",
".",
"parallel",
"(",
")",
".",
"mapToDouble",
"(",
"x",
"->",
"Arrays",
".",
"stream",
"(",
"x",
")",
".",
"sum",
"(",
")",
")",
".",
"sum",
"(",
")",
";",
"}"
] |
Sum double.
@param a the a
@return the double
|
[
"Sum",
"double",
"."
] |
b5a5e73449aae57de7dbfca2ed7a074432c5b17e
|
https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/util/ArrayUtil.java#L272-L274
|
155,494
|
iorga-group/iraj
|
iraj/src/main/java/com/iorga/iraj/security/SecurityUtils.java
|
SecurityUtils.generateAccessKeyId
|
public static String generateAccessKeyId() {
// Based on http://stackoverflow.com/a/41156/535203
final char[] accessKeyId = new char[ACCESS_KEY_ID_LENGTH];
for (int i = 0; i < accessKeyId.length; i++) {
accessKeyId[i] = SYMBOLS[SECURE_RANDOM.nextInt(SYMBOLS.length)];
}
return new String(accessKeyId);
}
|
java
|
public static String generateAccessKeyId() {
// Based on http://stackoverflow.com/a/41156/535203
final char[] accessKeyId = new char[ACCESS_KEY_ID_LENGTH];
for (int i = 0; i < accessKeyId.length; i++) {
accessKeyId[i] = SYMBOLS[SECURE_RANDOM.nextInt(SYMBOLS.length)];
}
return new String(accessKeyId);
}
|
[
"public",
"static",
"String",
"generateAccessKeyId",
"(",
")",
"{",
"// Based on http://stackoverflow.com/a/41156/535203",
"final",
"char",
"[",
"]",
"accessKeyId",
"=",
"new",
"char",
"[",
"ACCESS_KEY_ID_LENGTH",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"accessKeyId",
".",
"length",
";",
"i",
"++",
")",
"{",
"accessKeyId",
"[",
"i",
"]",
"=",
"SYMBOLS",
"[",
"SECURE_RANDOM",
".",
"nextInt",
"(",
"SYMBOLS",
".",
"length",
")",
"]",
";",
"}",
"return",
"new",
"String",
"(",
"accessKeyId",
")",
";",
"}"
] |
Generates a 25 length String access key id
@return a 25 length String access key id
|
[
"Generates",
"a",
"25",
"length",
"String",
"access",
"key",
"id"
] |
5fdee26464248f29833610de402275eb64505542
|
https://github.com/iorga-group/iraj/blob/5fdee26464248f29833610de402275eb64505542/iraj/src/main/java/com/iorga/iraj/security/SecurityUtils.java#L175-L182
|
155,495
|
iorga-group/iraj
|
iraj/src/main/java/com/iorga/iraj/security/SecurityUtils.java
|
SecurityUtils.generateSecretAccessKey
|
public static String generateSecretAccessKey() {
final byte[] secretAccessKeyBytes = new byte[30];
SECURE_RANDOM.nextBytes(secretAccessKeyBytes);
return StringUtils.chomp(Base64.encodeBase64String(secretAccessKeyBytes));
}
|
java
|
public static String generateSecretAccessKey() {
final byte[] secretAccessKeyBytes = new byte[30];
SECURE_RANDOM.nextBytes(secretAccessKeyBytes);
return StringUtils.chomp(Base64.encodeBase64String(secretAccessKeyBytes));
}
|
[
"public",
"static",
"String",
"generateSecretAccessKey",
"(",
")",
"{",
"final",
"byte",
"[",
"]",
"secretAccessKeyBytes",
"=",
"new",
"byte",
"[",
"30",
"]",
";",
"SECURE_RANDOM",
".",
"nextBytes",
"(",
"secretAccessKeyBytes",
")",
";",
"return",
"StringUtils",
".",
"chomp",
"(",
"Base64",
".",
"encodeBase64String",
"(",
"secretAccessKeyBytes",
")",
")",
";",
"}"
] |
Generates a 40 length String secret access key
@return a 40 length Base64 encoded String
|
[
"Generates",
"a",
"40",
"length",
"String",
"secret",
"access",
"key"
] |
5fdee26464248f29833610de402275eb64505542
|
https://github.com/iorga-group/iraj/blob/5fdee26464248f29833610de402275eb64505542/iraj/src/main/java/com/iorga/iraj/security/SecurityUtils.java#L188-L192
|
155,496
|
RogerParkinson/madura-objects-parent
|
madura-rules/src/main/java/nz/co/senanque/rulesparser/ParsePackage.java
|
ParsePackage.getRuleName
|
private String getRuleName(RulesTextProvider textProvider)
{
if (!quotedString('"',textProvider))
{
return "R"+(textProvider.incrementRuleCount());
}
return textProvider.getLastToken();
}
|
java
|
private String getRuleName(RulesTextProvider textProvider)
{
if (!quotedString('"',textProvider))
{
return "R"+(textProvider.incrementRuleCount());
}
return textProvider.getLastToken();
}
|
[
"private",
"String",
"getRuleName",
"(",
"RulesTextProvider",
"textProvider",
")",
"{",
"if",
"(",
"!",
"quotedString",
"(",
"'",
"'",
",",
"textProvider",
")",
")",
"{",
"return",
"\"R\"",
"+",
"(",
"textProvider",
".",
"incrementRuleCount",
"(",
")",
")",
";",
"}",
"return",
"textProvider",
".",
"getLastToken",
"(",
")",
";",
"}"
] |
Method getRuleName. The rule name is normally enclosed in quotes
but it might be omitted in which case we generate a unique one.
@return String
@throws ParserException
|
[
"Method",
"getRuleName",
".",
"The",
"rule",
"name",
"is",
"normally",
"enclosed",
"in",
"quotes",
"but",
"it",
"might",
"be",
"omitted",
"in",
"which",
"case",
"we",
"generate",
"a",
"unique",
"one",
"."
] |
9b5385dd0437611f0ce8506f63646e018d06fb8e
|
https://github.com/RogerParkinson/madura-objects-parent/blob/9b5385dd0437611f0ce8506f63646e018d06fb8e/madura-rules/src/main/java/nz/co/senanque/rulesparser/ParsePackage.java#L108-L115
|
155,497
|
RogerParkinson/madura-objects-parent
|
madura-rules/src/main/java/nz/co/senanque/rulesparser/ParsePackage.java
|
ParsePackage.processFormula
|
private AbstractRule processFormula(RulesTextProvider textProvider)
{
log.debug("processFormula");
Formula rule = new Formula();
int start = textProvider.getPos();
LoadCommonRuleData(rule,textProvider);
textProvider.addTOCElement(null, rule.getDescription(), start, textProvider.getPos(), TYPE_FORMULA);
exactOrError("{",textProvider);
Expression expression = processAction(textProvider);
exactOrError("}",textProvider);
rule.addAction(expression);
return rule;
}
|
java
|
private AbstractRule processFormula(RulesTextProvider textProvider)
{
log.debug("processFormula");
Formula rule = new Formula();
int start = textProvider.getPos();
LoadCommonRuleData(rule,textProvider);
textProvider.addTOCElement(null, rule.getDescription(), start, textProvider.getPos(), TYPE_FORMULA);
exactOrError("{",textProvider);
Expression expression = processAction(textProvider);
exactOrError("}",textProvider);
rule.addAction(expression);
return rule;
}
|
[
"private",
"AbstractRule",
"processFormula",
"(",
"RulesTextProvider",
"textProvider",
")",
"{",
"log",
".",
"debug",
"(",
"\"processFormula\"",
")",
";",
"Formula",
"rule",
"=",
"new",
"Formula",
"(",
")",
";",
"int",
"start",
"=",
"textProvider",
".",
"getPos",
"(",
")",
";",
"LoadCommonRuleData",
"(",
"rule",
",",
"textProvider",
")",
";",
"textProvider",
".",
"addTOCElement",
"(",
"null",
",",
"rule",
".",
"getDescription",
"(",
")",
",",
"start",
",",
"textProvider",
".",
"getPos",
"(",
")",
",",
"TYPE_FORMULA",
")",
";",
"exactOrError",
"(",
"\"{\"",
",",
"textProvider",
")",
";",
"Expression",
"expression",
"=",
"processAction",
"(",
"textProvider",
")",
";",
"exactOrError",
"(",
"\"}\"",
",",
"textProvider",
")",
";",
"rule",
".",
"addAction",
"(",
"expression",
")",
";",
"return",
"rule",
";",
"}"
] |
Method processFormula.
Parse a formula which is just one action expression followed by
a semicolon.
@return Rule
@throws ParserException
|
[
"Method",
"processFormula",
".",
"Parse",
"a",
"formula",
"which",
"is",
"just",
"one",
"action",
"expression",
"followed",
"by",
"a",
"semicolon",
"."
] |
9b5385dd0437611f0ce8506f63646e018d06fb8e
|
https://github.com/RogerParkinson/madura-objects-parent/blob/9b5385dd0437611f0ce8506f63646e018d06fb8e/madura-rules/src/main/java/nz/co/senanque/rulesparser/ParsePackage.java#L222-L235
|
155,498
|
RogerParkinson/madura-objects-parent
|
madura-rules/src/main/java/nz/co/senanque/rulesparser/ParsePackage.java
|
ParsePackage.processConstraint
|
private AbstractRule processConstraint(RulesTextProvider textProvider)
throws ParserException
{
log.debug("processConstraint");
Constraint rule = new Constraint();
int start = textProvider.getPos();
LoadCommonRuleData(rule,textProvider);
textProvider.addTOCElement(null, rule.getDescription(), start, textProvider.getPos(), TYPE_CONSTRAINT);
exactOrError("{",textProvider);
Expression condition = processAction(textProvider);
if (condition.isAssign())
{
throw new ParserException("Found an assignment in a condition ",textProvider);
}
exactOrError("}",textProvider);
rule.addCondition(condition);
return rule;
}
|
java
|
private AbstractRule processConstraint(RulesTextProvider textProvider)
throws ParserException
{
log.debug("processConstraint");
Constraint rule = new Constraint();
int start = textProvider.getPos();
LoadCommonRuleData(rule,textProvider);
textProvider.addTOCElement(null, rule.getDescription(), start, textProvider.getPos(), TYPE_CONSTRAINT);
exactOrError("{",textProvider);
Expression condition = processAction(textProvider);
if (condition.isAssign())
{
throw new ParserException("Found an assignment in a condition ",textProvider);
}
exactOrError("}",textProvider);
rule.addCondition(condition);
return rule;
}
|
[
"private",
"AbstractRule",
"processConstraint",
"(",
"RulesTextProvider",
"textProvider",
")",
"throws",
"ParserException",
"{",
"log",
".",
"debug",
"(",
"\"processConstraint\"",
")",
";",
"Constraint",
"rule",
"=",
"new",
"Constraint",
"(",
")",
";",
"int",
"start",
"=",
"textProvider",
".",
"getPos",
"(",
")",
";",
"LoadCommonRuleData",
"(",
"rule",
",",
"textProvider",
")",
";",
"textProvider",
".",
"addTOCElement",
"(",
"null",
",",
"rule",
".",
"getDescription",
"(",
")",
",",
"start",
",",
"textProvider",
".",
"getPos",
"(",
")",
",",
"TYPE_CONSTRAINT",
")",
";",
"exactOrError",
"(",
"\"{\"",
",",
"textProvider",
")",
";",
"Expression",
"condition",
"=",
"processAction",
"(",
"textProvider",
")",
";",
"if",
"(",
"condition",
".",
"isAssign",
"(",
")",
")",
"{",
"throw",
"new",
"ParserException",
"(",
"\"Found an assignment in a condition \"",
",",
"textProvider",
")",
";",
"}",
"exactOrError",
"(",
"\"}\"",
",",
"textProvider",
")",
";",
"rule",
".",
"addCondition",
"(",
"condition",
")",
";",
"return",
"rule",
";",
"}"
] |
Method processConstraint.
A constraint is a list of conditions and an explanation.
@return Rule
@throws ParserException
|
[
"Method",
"processConstraint",
".",
"A",
"constraint",
"is",
"a",
"list",
"of",
"conditions",
"and",
"an",
"explanation",
"."
] |
9b5385dd0437611f0ce8506f63646e018d06fb8e
|
https://github.com/RogerParkinson/madura-objects-parent/blob/9b5385dd0437611f0ce8506f63646e018d06fb8e/madura-rules/src/main/java/nz/co/senanque/rulesparser/ParsePackage.java#L273-L291
|
155,499
|
RogerParkinson/madura-objects-parent
|
madura-rules/src/main/java/nz/co/senanque/rules/RulesPlugin.java
|
RulesPlugin.getClassReferences
|
private List<ClassReference> getClassReferences(String className)
{
List<ClassReference> ret = new ArrayList<ClassReference>();
ClassReference cr = m_classReferenceMap.get(className);
ret.addAll(cr.getChildren());
return ret;
}
|
java
|
private List<ClassReference> getClassReferences(String className)
{
List<ClassReference> ret = new ArrayList<ClassReference>();
ClassReference cr = m_classReferenceMap.get(className);
ret.addAll(cr.getChildren());
return ret;
}
|
[
"private",
"List",
"<",
"ClassReference",
">",
"getClassReferences",
"(",
"String",
"className",
")",
"{",
"List",
"<",
"ClassReference",
">",
"ret",
"=",
"new",
"ArrayList",
"<",
"ClassReference",
">",
"(",
")",
";",
"ClassReference",
"cr",
"=",
"m_classReferenceMap",
".",
"get",
"(",
"className",
")",
";",
"ret",
".",
"addAll",
"(",
"cr",
".",
"getChildren",
"(",
")",
")",
";",
"return",
"ret",
";",
"}"
] |
Figure out which classes extend the named class and return the current class and the extenders
@param className
@param engineMetadata
@return list of class references
|
[
"Figure",
"out",
"which",
"classes",
"extend",
"the",
"named",
"class",
"and",
"return",
"the",
"current",
"class",
"and",
"the",
"extenders"
] |
9b5385dd0437611f0ce8506f63646e018d06fb8e
|
https://github.com/RogerParkinson/madura-objects-parent/blob/9b5385dd0437611f0ce8506f63646e018d06fb8e/madura-rules/src/main/java/nz/co/senanque/rules/RulesPlugin.java#L305-L311
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.