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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
attribyte/acp | src/main/java/org/attribyte/sql/pool/Util.java | Util.createThreadFactoryBuilder | static ThreadFactory createThreadFactoryBuilder(final String baseName, final String componentName) {
StringBuilder buf = new StringBuilder("ACP:");
if(!Strings.isNullOrEmpty(baseName)) {
buf.append(baseName).append(":").append(componentName);
} else {
buf.append(componentName);
... | java | static ThreadFactory createThreadFactoryBuilder(final String baseName, final String componentName) {
StringBuilder buf = new StringBuilder("ACP:");
if(!Strings.isNullOrEmpty(baseName)) {
buf.append(baseName).append(":").append(componentName);
} else {
buf.append(componentName);
... | [
"static",
"ThreadFactory",
"createThreadFactoryBuilder",
"(",
"final",
"String",
"baseName",
",",
"final",
"String",
"componentName",
")",
"{",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
"\"ACP:\"",
")",
";",
"if",
"(",
"!",
"Strings",
".",
"isNul... | Creates a thread factory builder.
@param baseName The (optional) base name.
@param componentName The (required) component name.
@return The thread factory. | [
"Creates",
"a",
"thread",
"factory",
"builder",
"."
] | dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659 | https://github.com/attribyte/acp/blob/dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659/src/main/java/org/attribyte/sql/pool/Util.java#L121-L132 | train |
attribyte/acp | src/main/java/org/attribyte/sql/pool/TypesafeConfig.java | TypesafeConfig.uniquePrefixSet | static final Set<String> uniquePrefixSet(final Config config) {
Set<String> prefixSet = Sets.newHashSet();
for(Map.Entry<String, ConfigValue> entry : config.entrySet()) {
String key = entry.getKey();
int index = key.indexOf('.');
if(index > 0) {
String prefix = key.su... | java | static final Set<String> uniquePrefixSet(final Config config) {
Set<String> prefixSet = Sets.newHashSet();
for(Map.Entry<String, ConfigValue> entry : config.entrySet()) {
String key = entry.getKey();
int index = key.indexOf('.');
if(index > 0) {
String prefix = key.su... | [
"static",
"final",
"Set",
"<",
"String",
">",
"uniquePrefixSet",
"(",
"final",
"Config",
"config",
")",
"{",
"Set",
"<",
"String",
">",
"prefixSet",
"=",
"Sets",
".",
"newHashSet",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"... | Gets all available keys in the config.
@param config The config.
@return The keys. | [
"Gets",
"all",
"available",
"keys",
"in",
"the",
"config",
"."
] | dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659 | https://github.com/attribyte/acp/blob/dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659/src/main/java/org/attribyte/sql/pool/TypesafeConfig.java#L95-L108 | train |
attribyte/acp | src/main/java/org/attribyte/sql/pool/TypesafeConfig.java | TypesafeConfig.segmentFromConfig | static final ConnectionPoolSegment.Initializer segmentFromConfig(String poolName,
String segmentName,
final Config config,
... | java | static final ConnectionPoolSegment.Initializer segmentFromConfig(String poolName,
String segmentName,
final Config config,
... | [
"static",
"final",
"ConnectionPoolSegment",
".",
"Initializer",
"segmentFromConfig",
"(",
"String",
"poolName",
",",
"String",
"segmentName",
",",
"final",
"Config",
"config",
",",
"ConnectionPoolSegment",
".",
"Initializer",
"initializer",
",",
"Map",
"<",
"String",
... | Sets initializer properties from properties.
@param poolName The pool name.
@param segmentName The segment name.
@param config The config.
@param initializer An initializer.
@param connectionMap A map of connection vs. name.
@return The segment initializer.
@throws InitializationException if configuration is invalid. | [
"Sets",
"initializer",
"properties",
"from",
"properties",
"."
] | dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659 | https://github.com/attribyte/acp/blob/dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659/src/main/java/org/attribyte/sql/pool/TypesafeConfig.java#L244-L302 | train |
attribyte/acp | src/main/java/org/attribyte/sql/pool/TypesafeConfig.java | TypesafeConfig.connectionMapFromConfig | static Map<String, JDBConnection> connectionMapFromConfig(Config config) throws InitializationException {
final Config globalPropertyConfig;
if(config.hasPath("acp.property")) {
globalPropertyConfig = config.getObject("acp.property").toConfig();
} else if(config.hasPath("property")) {
... | java | static Map<String, JDBConnection> connectionMapFromConfig(Config config) throws InitializationException {
final Config globalPropertyConfig;
if(config.hasPath("acp.property")) {
globalPropertyConfig = config.getObject("acp.property").toConfig();
} else if(config.hasPath("property")) {
... | [
"static",
"Map",
"<",
"String",
",",
"JDBConnection",
">",
"connectionMapFromConfig",
"(",
"Config",
"config",
")",
"throws",
"InitializationException",
"{",
"final",
"Config",
"globalPropertyConfig",
";",
"if",
"(",
"config",
".",
"hasPath",
"(",
"\"acp.property\""... | Creates a map of connection vs. name from properties.
@return The connection map.
@throws org.attribyte.api.InitializationException if connection could not be initialized. | [
"Creates",
"a",
"map",
"of",
"connection",
"vs",
".",
"name",
"from",
"properties",
"."
] | dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659 | https://github.com/attribyte/acp/blob/dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659/src/main/java/org/attribyte/sql/pool/TypesafeConfig.java#L309-L338 | train |
attribyte/acp | src/main/java/org/attribyte/sql/pool/TypesafeConfig.java | TypesafeConfig.createConnection | static JDBConnection createConnection(final String connectionName,
final Config baseConfig,
final Config globalPropertyConfig) throws InitializationException {
Config connectionRef = ConfigFactory.load().getObject("acp.defaults.con... | java | static JDBConnection createConnection(final String connectionName,
final Config baseConfig,
final Config globalPropertyConfig) throws InitializationException {
Config connectionRef = ConfigFactory.load().getObject("acp.defaults.con... | [
"static",
"JDBConnection",
"createConnection",
"(",
"final",
"String",
"connectionName",
",",
"final",
"Config",
"baseConfig",
",",
"final",
"Config",
"globalPropertyConfig",
")",
"throws",
"InitializationException",
"{",
"Config",
"connectionRef",
"=",
"ConfigFactory",
... | Creates a connection from properties.
@throws InitializationException if required parameters are unspecified. | [
"Creates",
"a",
"connection",
"from",
"properties",
"."
] | dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659 | https://github.com/attribyte/acp/blob/dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659/src/main/java/org/attribyte/sql/pool/TypesafeConfig.java#L344-L378 | train |
attribyte/acp | src/main/java/org/attribyte/sql/pool/TypesafeConfig.java | TypesafeConfig.initDrivers | static void initDrivers(final Config config) throws InitializationException {
for(String driverName : uniquePrefixSet(config)) {
Config driverConfig = config.getObject(driverName).toConfig();
if(driverConfig.hasPath("class")) {
String className = driverConfig.getString("class");
... | java | static void initDrivers(final Config config) throws InitializationException {
for(String driverName : uniquePrefixSet(config)) {
Config driverConfig = config.getObject(driverName).toConfig();
if(driverConfig.hasPath("class")) {
String className = driverConfig.getString("class");
... | [
"static",
"void",
"initDrivers",
"(",
"final",
"Config",
"config",
")",
"throws",
"InitializationException",
"{",
"for",
"(",
"String",
"driverName",
":",
"uniquePrefixSet",
"(",
"config",
")",
")",
"{",
"Config",
"driverConfig",
"=",
"config",
".",
"getObject",... | Initialize JDBC drivers from config.
@throws InitializationException if driver could not be initialized | [
"Initialize",
"JDBC",
"drivers",
"from",
"config",
"."
] | dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659 | https://github.com/attribyte/acp/blob/dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659/src/main/java/org/attribyte/sql/pool/TypesafeConfig.java#L384-L398 | train |
attribyte/acp | src/main/java/org/attribyte/sql/pool/TypesafeConfig.java | TypesafeConfig.buildConnectionString | private static String buildConnectionString(final String connectionString,
final Config config) {
if(config == null) {
return connectionString;
}
StringBuilder buf = new StringBuilder();
Iterator<Map.Entry<String, ConfigValue>> iter = con... | java | private static String buildConnectionString(final String connectionString,
final Config config) {
if(config == null) {
return connectionString;
}
StringBuilder buf = new StringBuilder();
Iterator<Map.Entry<String, ConfigValue>> iter = con... | [
"private",
"static",
"String",
"buildConnectionString",
"(",
"final",
"String",
"connectionString",
",",
"final",
"Config",
"config",
")",
"{",
"if",
"(",
"config",
"==",
"null",
")",
"{",
"return",
"connectionString",
";",
"}",
"StringBuilder",
"buf",
"=",
"n... | Builds a connection string with properties as parameters.
@param connectionString The connection string.
@return The connection string with properties as parameters. | [
"Builds",
"a",
"connection",
"string",
"with",
"properties",
"as",
"parameters",
"."
] | dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659 | https://github.com/attribyte/acp/blob/dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659/src/main/java/org/attribyte/sql/pool/TypesafeConfig.java#L405-L431 | train |
attribyte/acp | src/main/java/org/attribyte/sql/pool/ConnectionPoolConnection.java | ConnectionPoolConnection.logicalOpen | final void logicalOpen() {
openTime = Clock.currTimeMillis;
transactionState = TransactionState.NONE;
if(debug) {
lastTrace = Util.getFilteredStack();
}
} | java | final void logicalOpen() {
openTime = Clock.currTimeMillis;
transactionState = TransactionState.NONE;
if(debug) {
lastTrace = Util.getFilteredStack();
}
} | [
"final",
"void",
"logicalOpen",
"(",
")",
"{",
"openTime",
"=",
"Clock",
".",
"currTimeMillis",
";",
"transactionState",
"=",
"TransactionState",
".",
"NONE",
";",
"if",
"(",
"debug",
")",
"{",
"lastTrace",
"=",
"Util",
".",
"getFilteredStack",
"(",
")",
"... | Sets the connection state to open and records the
open time. No tests are performed. | [
"Sets",
"the",
"connection",
"state",
"to",
"open",
"and",
"records",
"the",
"open",
"time",
".",
"No",
"tests",
"are",
"performed",
"."
] | dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659 | https://github.com/attribyte/acp/blob/dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659/src/main/java/org/attribyte/sql/pool/ConnectionPoolConnection.java#L493-L499 | train |
attribyte/acp | src/main/java/org/attribyte/sql/pool/ConnectionPoolConnection.java | ConnectionPoolConnection.logicalClose | final void logicalClose(final boolean withTest) throws SQLException {
openTime = 0L;
if(debug) {
lastTrace = null;
}
if(logicalCloseException != null) { //Set during close() & thrown here to cause segment to reopen.
Util.throwException(logicalCloseException);
}
... | java | final void logicalClose(final boolean withTest) throws SQLException {
openTime = 0L;
if(debug) {
lastTrace = null;
}
if(logicalCloseException != null) { //Set during close() & thrown here to cause segment to reopen.
Util.throwException(logicalCloseException);
}
... | [
"final",
"void",
"logicalClose",
"(",
"final",
"boolean",
"withTest",
")",
"throws",
"SQLException",
"{",
"openTime",
"=",
"0L",
";",
"if",
"(",
"debug",
")",
"{",
"lastTrace",
"=",
"null",
";",
"}",
"if",
"(",
"logicalCloseException",
"!=",
"null",
")",
... | Prepares the connection for return to the active pool.
@param withTest Should the connection be tested?
@throws SQLException on test error or exception raised (and thrown) during application close. | [
"Prepares",
"the",
"connection",
"for",
"return",
"to",
"the",
"active",
"pool",
"."
] | dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659 | https://github.com/attribyte/acp/blob/dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659/src/main/java/org/attribyte/sql/pool/ConnectionPoolConnection.java#L557-L590 | train |
attribyte/acp | src/main/java/org/attribyte/sql/pool/ConnectionPoolConnection.java | ConnectionPoolConnection.closeStatements | private boolean closeStatements() {
// JDBC API says...
// Calling the method close on a Statement object that is already closed has no effect.
// Note: When a Statement object is closed, its current ResultSet object, if one exists, is also closed.
boolean hasUnclosed = false;
if(openSt... | java | private boolean closeStatements() {
// JDBC API says...
// Calling the method close on a Statement object that is already closed has no effect.
// Note: When a Statement object is closed, its current ResultSet object, if one exists, is also closed.
boolean hasUnclosed = false;
if(openSt... | [
"private",
"boolean",
"closeStatements",
"(",
")",
"{",
"// JDBC API says...",
"// Calling the method close on a Statement object that is already closed has no effect.",
"// Note: When a Statement object is closed, its current ResultSet object, if one exists, is also closed.",
"boolean",
"hasUnc... | Check for unclosed statements.
@return Were any statements unclosed? | [
"Check",
"for",
"unclosed",
"statements",
"."
] | dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659 | https://github.com/attribyte/acp/blob/dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659/src/main/java/org/attribyte/sql/pool/ConnectionPoolConnection.java#L596-L630 | train |
attribyte/acp | src/main/java/org/attribyte/sql/pool/ConnectionPoolConnection.java | ConnectionPoolConnection.setLogicalCloseException | private void setLogicalCloseException(final Throwable t) {
if(logicalCloseException == null) {
logicalCloseException = t;
} else if(!Util.isRuntimeError(logicalCloseException) && Util.isRuntimeError(t)) {
logicalCloseException = t;
}
} | java | private void setLogicalCloseException(final Throwable t) {
if(logicalCloseException == null) {
logicalCloseException = t;
} else if(!Util.isRuntimeError(logicalCloseException) && Util.isRuntimeError(t)) {
logicalCloseException = t;
}
} | [
"private",
"void",
"setLogicalCloseException",
"(",
"final",
"Throwable",
"t",
")",
"{",
"if",
"(",
"logicalCloseException",
"==",
"null",
")",
"{",
"logicalCloseException",
"=",
"t",
";",
"}",
"else",
"if",
"(",
"!",
"Util",
".",
"isRuntimeError",
"(",
"log... | Sets logicalCloseException if null or replaces logicalCloseException
if not null && input is a runtime error.
@param t The throwable | [
"Sets",
"logicalCloseException",
"if",
"null",
"or",
"replaces",
"logicalCloseException",
"if",
"not",
"null",
"&&",
"input",
"is",
"a",
"runtime",
"error",
"."
] | dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659 | https://github.com/attribyte/acp/blob/dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659/src/main/java/org/attribyte/sql/pool/ConnectionPoolConnection.java#L637-L644 | train |
attribyte/acp | src/main/java/org/attribyte/sql/pool/ConnectionPoolConnection.java | ConnectionPoolConnection.resolveIncompleteTransactions | private void resolveIncompleteTransactions() throws SQLException {
switch(transactionState) {
case COMPLETED:
//All we know for certain is that at least one commit/rollback was called. Do nothing.
break;
case STARTED:
//At least one statement was created with... | java | private void resolveIncompleteTransactions() throws SQLException {
switch(transactionState) {
case COMPLETED:
//All we know for certain is that at least one commit/rollback was called. Do nothing.
break;
case STARTED:
//At least one statement was created with... | [
"private",
"void",
"resolveIncompleteTransactions",
"(",
")",
"throws",
"SQLException",
"{",
"switch",
"(",
"transactionState",
")",
"{",
"case",
"COMPLETED",
":",
"//All we know for certain is that at least one commit/rollback was called. Do nothing.",
"break",
";",
"case",
... | Attempt to deal with any transaction problems.
@throws SQLException on invalid state. | [
"Attempt",
"to",
"deal",
"with",
"any",
"transaction",
"problems",
"."
] | dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659 | https://github.com/attribyte/acp/blob/dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659/src/main/java/org/attribyte/sql/pool/ConnectionPoolConnection.java#L720-L746 | train |
attribyte/acp | src/main/java/org/attribyte/sql/pool/ConnectionPool.java | ConnectionPool.closeUnmanagedConnection | public final void closeUnmanagedConnection(final Connection conn) throws SQLException {
activeUnmanagedConnections.dec();
if(!conn.isClosed()) {
conn.close();
}
} | java | public final void closeUnmanagedConnection(final Connection conn) throws SQLException {
activeUnmanagedConnections.dec();
if(!conn.isClosed()) {
conn.close();
}
} | [
"public",
"final",
"void",
"closeUnmanagedConnection",
"(",
"final",
"Connection",
"conn",
")",
"throws",
"SQLException",
"{",
"activeUnmanagedConnections",
".",
"dec",
"(",
")",
";",
"if",
"(",
"!",
"conn",
".",
"isClosed",
"(",
")",
")",
"{",
"conn",
".",
... | Closes an unumanged connection.
@param conn The conneciton.
@throws SQLException If close fails. | [
"Closes",
"an",
"unumanged",
"connection",
"."
] | dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659 | https://github.com/attribyte/acp/blob/dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659/src/main/java/org/attribyte/sql/pool/ConnectionPool.java#L860-L865 | train |
attribyte/acp | src/main/java/org/attribyte/sql/pool/ConnectionPool.java | ConnectionPool.signalActivateSegment | final void signalActivateSegment() throws SQLException {
/*
Note that 'offer' does so only if it can be done
immediately without exceeding the queue capacity.
The queue capacity is '1', so this means that
signals may be ignored. Either way, this message
will never blo... | java | final void signalActivateSegment() throws SQLException {
/*
Note that 'offer' does so only if it can be done
immediately without exceeding the queue capacity.
The queue capacity is '1', so this means that
signals may be ignored. Either way, this message
will never blo... | [
"final",
"void",
"signalActivateSegment",
"(",
")",
"throws",
"SQLException",
"{",
"/*\n Note that 'offer' does so only if it can be done\n immediately without exceeding the queue capacity.\n The queue capacity is '1', so this means that\n signals may be ignored. Eith... | Signals that a new segment should be activated. | [
"Signals",
"that",
"a",
"new",
"segment",
"should",
"be",
"activated",
"."
] | dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659 | https://github.com/attribyte/acp/blob/dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659/src/main/java/org/attribyte/sql/pool/ConnectionPool.java#L950-L970 | train |
attribyte/acp | src/main/java/org/attribyte/sql/pool/ConnectionPool.java | ConnectionPool.shutdownNow | public final void shutdownNow() {
if(isShuttingDown.compareAndSet(false, true)) {
logInfo("Shutting down...");
if(idleSegmentMonitorService != null) {
logInfo("Shutting down idle segment monitor service...");
idleSegmentMonitorService.shutdownNow();
}
... | java | public final void shutdownNow() {
if(isShuttingDown.compareAndSet(false, true)) {
logInfo("Shutting down...");
if(idleSegmentMonitorService != null) {
logInfo("Shutting down idle segment monitor service...");
idleSegmentMonitorService.shutdownNow();
}
... | [
"public",
"final",
"void",
"shutdownNow",
"(",
")",
"{",
"if",
"(",
"isShuttingDown",
".",
"compareAndSet",
"(",
"false",
",",
"true",
")",
")",
"{",
"logInfo",
"(",
"\"Shutting down...\"",
")",
";",
"if",
"(",
"idleSegmentMonitorService",
"!=",
"null",
")",... | Shutdown the pool without waiting for any in-progress
operations to complete. | [
"Shutdown",
"the",
"pool",
"without",
"waiting",
"for",
"any",
"in",
"-",
"progress",
"operations",
"to",
"complete",
"."
] | dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659 | https://github.com/attribyte/acp/blob/dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659/src/main/java/org/attribyte/sql/pool/ConnectionPool.java#L1013-L1045 | train |
attribyte/acp | src/main/java/org/attribyte/sql/pool/JDBConnection.java | JDBConnection.getConnectionDescription | final String getConnectionDescription() {
if(datasource != null) {
return name;
}
String description = connectionString;
int index = connectionString != null ? connectionString.indexOf('?') : 0;
if(index > 0) {
description = connectionString.substring(0, index);
}... | java | final String getConnectionDescription() {
if(datasource != null) {
return name;
}
String description = connectionString;
int index = connectionString != null ? connectionString.indexOf('?') : 0;
if(index > 0) {
description = connectionString.substring(0, index);
}... | [
"final",
"String",
"getConnectionDescription",
"(",
")",
"{",
"if",
"(",
"datasource",
"!=",
"null",
")",
"{",
"return",
"name",
";",
"}",
"String",
"description",
"=",
"connectionString",
";",
"int",
"index",
"=",
"connectionString",
"!=",
"null",
"?",
"con... | Gets a description of the database connection.
@return A description of the connection. | [
"Gets",
"a",
"description",
"of",
"the",
"database",
"connection",
"."
] | dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659 | https://github.com/attribyte/acp/blob/dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659/src/main/java/org/attribyte/sql/pool/JDBConnection.java#L232-L249 | train |
bremersee/comparator | src/main/java/org/bremersee/comparator/ComparatorUtils.java | ComparatorUtils.doSetAscRecursively | public static void doSetAscRecursively(ComparatorItem comparatorItem, boolean asc) {
ComparatorItem tmp = comparatorItem;
while (tmp != null) {
tmp.setAsc(asc);
tmp = tmp.getNextComparatorItem();
}
} | java | public static void doSetAscRecursively(ComparatorItem comparatorItem, boolean asc) {
ComparatorItem tmp = comparatorItem;
while (tmp != null) {
tmp.setAsc(asc);
tmp = tmp.getNextComparatorItem();
}
} | [
"public",
"static",
"void",
"doSetAscRecursively",
"(",
"ComparatorItem",
"comparatorItem",
",",
"boolean",
"asc",
")",
"{",
"ComparatorItem",
"tmp",
"=",
"comparatorItem",
";",
"while",
"(",
"tmp",
"!=",
"null",
")",
"{",
"tmp",
".",
"setAsc",
"(",
"asc",
"... | Sets the sort order of all items.
@param comparatorItem the (root) item
@param asc the new sort order | [
"Sets",
"the",
"sort",
"order",
"of",
"all",
"items",
"."
] | 6958e6e28a62589106705062f8ffc201a87d9b2a | https://github.com/bremersee/comparator/blob/6958e6e28a62589106705062f8ffc201a87d9b2a/src/main/java/org/bremersee/comparator/ComparatorUtils.java#L38-L44 | train |
bremersee/comparator | src/main/java/org/bremersee/comparator/ComparatorUtils.java | ComparatorUtils.doSetIgnoreCaseRecursively | public static void doSetIgnoreCaseRecursively(ComparatorItem comparatorItem, boolean ignoreCase) {
ComparatorItem tmp = comparatorItem;
while (tmp != null) {
tmp.setIgnoreCase(ignoreCase);
tmp = tmp.getNextComparatorItem();
}
} | java | public static void doSetIgnoreCaseRecursively(ComparatorItem comparatorItem, boolean ignoreCase) {
ComparatorItem tmp = comparatorItem;
while (tmp != null) {
tmp.setIgnoreCase(ignoreCase);
tmp = tmp.getNextComparatorItem();
}
} | [
"public",
"static",
"void",
"doSetIgnoreCaseRecursively",
"(",
"ComparatorItem",
"comparatorItem",
",",
"boolean",
"ignoreCase",
")",
"{",
"ComparatorItem",
"tmp",
"=",
"comparatorItem",
";",
"while",
"(",
"tmp",
"!=",
"null",
")",
"{",
"tmp",
".",
"setIgnoreCase"... | Sets whether the sort is case sensitive or not to all items.
@param comparatorItem the (root) item
@param ignoreCase {@code true} if the sort is case sensitive, otherwise {@code false} | [
"Sets",
"whether",
"the",
"sort",
"is",
"case",
"sensitive",
"or",
"not",
"to",
"all",
"items",
"."
] | 6958e6e28a62589106705062f8ffc201a87d9b2a | https://github.com/bremersee/comparator/blob/6958e6e28a62589106705062f8ffc201a87d9b2a/src/main/java/org/bremersee/comparator/ComparatorUtils.java#L52-L58 | train |
bremersee/comparator | src/main/java/org/bremersee/comparator/ComparatorUtils.java | ComparatorUtils.doSetNullIsFirstRecursively | public static void doSetNullIsFirstRecursively(ComparatorItem comparatorItem,
boolean nullIsFirst) {
ComparatorItem tmp = comparatorItem;
while (tmp != null) {
tmp.setNullIsFirst(nullIsFirst);
tmp = tmp.getNextComparatorItem();
}
} | java | public static void doSetNullIsFirstRecursively(ComparatorItem comparatorItem,
boolean nullIsFirst) {
ComparatorItem tmp = comparatorItem;
while (tmp != null) {
tmp.setNullIsFirst(nullIsFirst);
tmp = tmp.getNextComparatorItem();
}
} | [
"public",
"static",
"void",
"doSetNullIsFirstRecursively",
"(",
"ComparatorItem",
"comparatorItem",
",",
"boolean",
"nullIsFirst",
")",
"{",
"ComparatorItem",
"tmp",
"=",
"comparatorItem",
";",
"while",
"(",
"tmp",
"!=",
"null",
")",
"{",
"tmp",
".",
"setNullIsFir... | Sets the sort order of a null value to all items.
@param comparatorItem the (root) item
@param nullIsFirst {@code true} if the sort order of a null value is higher than a non-null
value, otherwise {@code false} | [
"Sets",
"the",
"sort",
"order",
"of",
"a",
"null",
"value",
"to",
"all",
"items",
"."
] | 6958e6e28a62589106705062f8ffc201a87d9b2a | https://github.com/bremersee/comparator/blob/6958e6e28a62589106705062f8ffc201a87d9b2a/src/main/java/org/bremersee/comparator/ComparatorUtils.java#L67-L74 | train |
jenkinsci/mask-passwords-plugin | src/main/java/com/michelin/cio/hudson/plugins/maskpasswords/MaskPasswordsConfig.java | MaskPasswordsConfig.addGlobalVarMaskRegex | public void addGlobalVarMaskRegex(VarMaskRegex varMaskRegex) {
// blank values are forbidden
if(StringUtils.isBlank(varMaskRegex.getRegex())) {
LOGGER.fine("addGlobalVarMaskRegex NOT adding null regex");
return;
}
getGlobalVarMaskRegexesList().add(varMaskRegex);
... | java | public void addGlobalVarMaskRegex(VarMaskRegex varMaskRegex) {
// blank values are forbidden
if(StringUtils.isBlank(varMaskRegex.getRegex())) {
LOGGER.fine("addGlobalVarMaskRegex NOT adding null regex");
return;
}
getGlobalVarMaskRegexesList().add(varMaskRegex);
... | [
"public",
"void",
"addGlobalVarMaskRegex",
"(",
"VarMaskRegex",
"varMaskRegex",
")",
"{",
"// blank values are forbidden",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"varMaskRegex",
".",
"getRegex",
"(",
")",
")",
")",
"{",
"LOGGER",
".",
"fine",
"(",
"\"add... | Adds a regex at the global level.
<p>If regex is blank (as defined per the Commons Lang
library), then the pair is not added.</p>
@since 2.9 | [
"Adds",
"a",
"regex",
"at",
"the",
"global",
"level",
"."
] | 3440b0aa5d2553889245327a9d37a006b4b17c3f | https://github.com/jenkinsci/mask-passwords-plugin/blob/3440b0aa5d2553889245327a9d37a006b4b17c3f/src/main/java/com/michelin/cio/hudson/plugins/maskpasswords/MaskPasswordsConfig.java#L165-L172 | train |
jenkinsci/mask-passwords-plugin | src/main/java/com/michelin/cio/hudson/plugins/maskpasswords/MaskPasswordsConfig.java | MaskPasswordsConfig.reset | @Restricted(NoExternalUse.class)
@VisibleForTesting
public final synchronized void reset() {
// Wipe the data
clear();
// default values for the first time the config is created
addMaskedPasswordParameterDefinition(hudson.model.PasswordParameterDefinition.class.getName()... | java | @Restricted(NoExternalUse.class)
@VisibleForTesting
public final synchronized void reset() {
// Wipe the data
clear();
// default values for the first time the config is created
addMaskedPasswordParameterDefinition(hudson.model.PasswordParameterDefinition.class.getName()... | [
"@",
"Restricted",
"(",
"NoExternalUse",
".",
"class",
")",
"@",
"VisibleForTesting",
"public",
"final",
"synchronized",
"void",
"reset",
"(",
")",
"{",
"// Wipe the data",
"clear",
"(",
")",
";",
"// default values for the first time the config is created",
"addMaskedP... | Resets configuration to the default state. | [
"Resets",
"configuration",
"to",
"the",
"default",
"state",
"."
] | 3440b0aa5d2553889245327a9d37a006b4b17c3f | https://github.com/jenkinsci/mask-passwords-plugin/blob/3440b0aa5d2553889245327a9d37a006b4b17c3f/src/main/java/com/michelin/cio/hudson/plugins/maskpasswords/MaskPasswordsConfig.java#L192-L201 | train |
jenkinsci/mask-passwords-plugin | src/main/java/com/michelin/cio/hudson/plugins/maskpasswords/MaskPasswordsConfig.java | MaskPasswordsConfig.getGlobalVarMaskRegexes | public List<VarMaskRegex> getGlobalVarMaskRegexes() {
List<VarMaskRegex> r = new ArrayList<VarMaskRegex>(getGlobalVarMaskRegexesList().size());
// deep copy
for(VarMaskRegex varMaskRegex: getGlobalVarMaskRegexesList()) {
r.add((VarMaskRegex) varMaskRegex.clone());
}
... | java | public List<VarMaskRegex> getGlobalVarMaskRegexes() {
List<VarMaskRegex> r = new ArrayList<VarMaskRegex>(getGlobalVarMaskRegexesList().size());
// deep copy
for(VarMaskRegex varMaskRegex: getGlobalVarMaskRegexesList()) {
r.add((VarMaskRegex) varMaskRegex.clone());
}
... | [
"public",
"List",
"<",
"VarMaskRegex",
">",
"getGlobalVarMaskRegexes",
"(",
")",
"{",
"List",
"<",
"VarMaskRegex",
">",
"r",
"=",
"new",
"ArrayList",
"<",
"VarMaskRegex",
">",
"(",
"getGlobalVarMaskRegexesList",
"(",
")",
".",
"size",
"(",
")",
")",
";",
"... | Returns the list of regexes defined at the global level.
<p>Modifications broughts to the returned list has no impact on this
configuration (the returned value is a copy). Also, the list can be
empty but never {@code null}.</p>
@since 2.9 | [
"Returns",
"the",
"list",
"of",
"regexes",
"defined",
"at",
"the",
"global",
"level",
"."
] | 3440b0aa5d2553889245327a9d37a006b4b17c3f | https://github.com/jenkinsci/mask-passwords-plugin/blob/3440b0aa5d2553889245327a9d37a006b4b17c3f/src/main/java/com/michelin/cio/hudson/plugins/maskpasswords/MaskPasswordsConfig.java#L260-L269 | train |
jenkinsci/mask-passwords-plugin | src/main/java/com/michelin/cio/hudson/plugins/maskpasswords/MaskPasswordsConfig.java | MaskPasswordsConfig.isMasked | public boolean isMasked(final @CheckForNull ParameterValue value,
final @Nonnull String paramValueClassName) {
// We always mask sensitive variables, the configuration does not matter in such case
if (value != null && value.isSensitive()) {
return true;
}
... | java | public boolean isMasked(final @CheckForNull ParameterValue value,
final @Nonnull String paramValueClassName) {
// We always mask sensitive variables, the configuration does not matter in such case
if (value != null && value.isSensitive()) {
return true;
}
... | [
"public",
"boolean",
"isMasked",
"(",
"final",
"@",
"CheckForNull",
"ParameterValue",
"value",
",",
"final",
"@",
"Nonnull",
"String",
"paramValueClassName",
")",
"{",
"// We always mask sensitive variables, the configuration does not matter in such case",
"if",
"(",
"value",... | Returns true if the specified parameter value class name corresponds to
a parameter definition class name selected in Jenkins' main
configuration screen.
@param value Parameter value. Without it there is a high risk of false negatives.
@param paramValueClassName Class name of the {@link ParameterValue} class implementa... | [
"Returns",
"true",
"if",
"the",
"specified",
"parameter",
"value",
"class",
"name",
"corresponds",
"to",
"a",
"parameter",
"definition",
"class",
"name",
"selected",
"in",
"Jenkins",
"main",
"configuration",
"screen",
"."
] | 3440b0aa5d2553889245327a9d37a006b4b17c3f | https://github.com/jenkinsci/mask-passwords-plugin/blob/3440b0aa5d2553889245327a9d37a006b4b17c3f/src/main/java/com/michelin/cio/hudson/plugins/maskpasswords/MaskPasswordsConfig.java#L349-L380 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/impl/FragmentRedirectStrategy.java | FragmentRedirectStrategy.getLocationURI | @Override
public URI getLocationURI(HttpRequest request, HttpResponse response, HttpContext context) throws ProtocolException {
URI uri = this.redirectStrategy.getLocationURI(request, response, context);
String resultingPageUrl = uri.toString();
DriverRequest driverRequest = ((OutgoingRequ... | java | @Override
public URI getLocationURI(HttpRequest request, HttpResponse response, HttpContext context) throws ProtocolException {
URI uri = this.redirectStrategy.getLocationURI(request, response, context);
String resultingPageUrl = uri.toString();
DriverRequest driverRequest = ((OutgoingRequ... | [
"@",
"Override",
"public",
"URI",
"getLocationURI",
"(",
"HttpRequest",
"request",
",",
"HttpResponse",
"response",
",",
"HttpContext",
"context",
")",
"throws",
"ProtocolException",
"{",
"URI",
"uri",
"=",
"this",
".",
"redirectStrategy",
".",
"getLocationURI",
"... | For local redirects, converts to relative urls.
@param request
must be an {@link OutgoingRequest}. | [
"For",
"local",
"redirects",
"converts",
"to",
"relative",
"urls",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/impl/FragmentRedirectStrategy.java#L78-L96 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/impl/UriMapping.java | UriMapping.matches | public boolean matches(String schemeParam, String hostParam, String uriParam) {
// If URI mapping enforce a host, ensure it is the one used.
if (this.host != null && !this.host.equalsIgnoreCase(schemeParam + "://" + hostParam)) {
return false;
}
if (this.extension != null &&... | java | public boolean matches(String schemeParam, String hostParam, String uriParam) {
// If URI mapping enforce a host, ensure it is the one used.
if (this.host != null && !this.host.equalsIgnoreCase(schemeParam + "://" + hostParam)) {
return false;
}
if (this.extension != null &&... | [
"public",
"boolean",
"matches",
"(",
"String",
"schemeParam",
",",
"String",
"hostParam",
",",
"String",
"uriParam",
")",
"{",
"// If URI mapping enforce a host, ensure it is the one used.",
"if",
"(",
"this",
".",
"host",
"!=",
"null",
"&&",
"!",
"this",
".",
"ho... | Check this matching rule against a request.
@param schemeParam
@param hostParam
@param uriParam
@return true if the rule matches the request | [
"Check",
"this",
"matching",
"rule",
"against",
"a",
"request",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/impl/UriMapping.java#L116-L130 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/http/OutgoingRequestContext.java | OutgoingRequestContext.setAttribute | public void setAttribute(String id, Object obj, boolean save) {
if (save) {
String historyAttribute = id + "history";
Queue<Object> history = (Queue<Object>) getAttribute(historyAttribute);
if (history == null) {
history = new LinkedList<>();
s... | java | public void setAttribute(String id, Object obj, boolean save) {
if (save) {
String historyAttribute = id + "history";
Queue<Object> history = (Queue<Object>) getAttribute(historyAttribute);
if (history == null) {
history = new LinkedList<>();
s... | [
"public",
"void",
"setAttribute",
"(",
"String",
"id",
",",
"Object",
"obj",
",",
"boolean",
"save",
")",
"{",
"if",
"(",
"save",
")",
"{",
"String",
"historyAttribute",
"=",
"id",
"+",
"\"history\"",
";",
"Queue",
"<",
"Object",
">",
"history",
"=",
"... | Set attribute and save previous attribute value
@param id
attribute name
@param obj
value
@param save
save previous attribute value to restore later | [
"Set",
"attribute",
"and",
"save",
"previous",
"attribute",
"value"
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/http/OutgoingRequestContext.java#L92-L105 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/http/OutgoingRequestContext.java | OutgoingRequestContext.removeAttribute | public Object removeAttribute(String id, boolean restore) {
Object value = removeAttribute(id);
if (restore) {
String historyAttribute = id + "history";
Queue<Object> history = (Queue<Object>) getAttribute(historyAttribute);
if (history != null && !history.isEmpty()) ... | java | public Object removeAttribute(String id, boolean restore) {
Object value = removeAttribute(id);
if (restore) {
String historyAttribute = id + "history";
Queue<Object> history = (Queue<Object>) getAttribute(historyAttribute);
if (history != null && !history.isEmpty()) ... | [
"public",
"Object",
"removeAttribute",
"(",
"String",
"id",
",",
"boolean",
"restore",
")",
"{",
"Object",
"value",
"=",
"removeAttribute",
"(",
"id",
")",
";",
"if",
"(",
"restore",
")",
"{",
"String",
"historyAttribute",
"=",
"id",
"+",
"\"history\"",
";... | remove attribute and restore previous attribute value
@param id
attribute name
@param restore
restore previous attribute value
@return attribute value | [
"remove",
"attribute",
"and",
"restore",
"previous",
"attribute",
"value"
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/http/OutgoingRequestContext.java#L116-L127 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/impl/UrlRewriter.java | UrlRewriter.rewriteReferer | public String rewriteReferer(String referer, String baseUrl, String visibleBaseUrl) {
URI uri = UriUtils.createURI(referer);
// Base url should end with /
if (!baseUrl.endsWith("/")) {
baseUrl = baseUrl + "/";
}
URI baseUri = UriUtils.createURI(baseUrl);
// ... | java | public String rewriteReferer(String referer, String baseUrl, String visibleBaseUrl) {
URI uri = UriUtils.createURI(referer);
// Base url should end with /
if (!baseUrl.endsWith("/")) {
baseUrl = baseUrl + "/";
}
URI baseUri = UriUtils.createURI(baseUrl);
// ... | [
"public",
"String",
"rewriteReferer",
"(",
"String",
"referer",
",",
"String",
"baseUrl",
",",
"String",
"visibleBaseUrl",
")",
"{",
"URI",
"uri",
"=",
"UriUtils",
".",
"createURI",
"(",
"referer",
")",
";",
"// Base url should end with /",
"if",
"(",
"!",
"ba... | Fixes a referer url in a request.
@param referer
the url to fix (can be anything found in an html page, relative, absolute, empty...)
@param baseUrl
The base URL selected for this request.
@param visibleBaseUrl
The base URL viewed by the browser.
@return the fixed url. | [
"Fixes",
"a",
"referer",
"url",
"in",
"a",
"request",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/impl/UrlRewriter.java#L87-L113 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/impl/UrlRewriter.java | UrlRewriter.rewriteHtml | public CharSequence rewriteHtml(CharSequence input, String requestUrl, String baseUrlParam, String visibleBaseUrl,
boolean absolute) {
StringBuffer result = new StringBuffer(input.length());
Matcher m = URL_PATTERN.matcher(input);
while (m.find()) {
String url = input.sub... | java | public CharSequence rewriteHtml(CharSequence input, String requestUrl, String baseUrlParam, String visibleBaseUrl,
boolean absolute) {
StringBuffer result = new StringBuffer(input.length());
Matcher m = URL_PATTERN.matcher(input);
while (m.find()) {
String url = input.sub... | [
"public",
"CharSequence",
"rewriteHtml",
"(",
"CharSequence",
"input",
",",
"String",
"requestUrl",
",",
"String",
"baseUrlParam",
",",
"String",
"visibleBaseUrl",
",",
"boolean",
"absolute",
")",
"{",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
"in... | Fixes all resources urls and returns the result.
@param input
The html to be processed.
@param requestUrl
The request URL.
@param baseUrlParam
The base URL selected for this request.
@param visibleBaseUrl
The base URL viewed by the browser.
@param absolute
Should the rewritten urls contain the scheme host and port
@... | [
"Fixes",
"all",
"resources",
"urls",
"and",
"returns",
"the",
"result",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/impl/UrlRewriter.java#L202-L255 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/vars/VarUtils.java | VarUtils.removeSimpleQuotes | public static String removeSimpleQuotes(String s) {
if (s.startsWith("'") && s.endsWith("'")) {
return s.substring(1, s.length() - 1);
}
return s;
} | java | public static String removeSimpleQuotes(String s) {
if (s.startsWith("'") && s.endsWith("'")) {
return s.substring(1, s.length() - 1);
}
return s;
} | [
"public",
"static",
"String",
"removeSimpleQuotes",
"(",
"String",
"s",
")",
"{",
"if",
"(",
"s",
".",
"startsWith",
"(",
"\"'\"",
")",
"&&",
"s",
".",
"endsWith",
"(",
"\"'\"",
")",
")",
"{",
"return",
"s",
".",
"substring",
"(",
"1",
",",
"s",
".... | Removes simple quotes if any.
@param s
input string
@return input string without simple quotes. | [
"Removes",
"simple",
"quotes",
"if",
"any",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/vars/VarUtils.java#L37-L43 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/util/HttpRequestHelper.java | HttpRequestHelper.getHost | public static HttpHost getHost(HttpRequest request) {
HttpHost httpHost = UriUtils.extractHost(request.getRequestLine().getUri());
String scheme = httpHost.getSchemeName();
String host = httpHost.getHostName();
int port = httpHost.getPort();
Header[] headers = request.getHeaders(... | java | public static HttpHost getHost(HttpRequest request) {
HttpHost httpHost = UriUtils.extractHost(request.getRequestLine().getUri());
String scheme = httpHost.getSchemeName();
String host = httpHost.getHostName();
int port = httpHost.getPort();
Header[] headers = request.getHeaders(... | [
"public",
"static",
"HttpHost",
"getHost",
"(",
"HttpRequest",
"request",
")",
"{",
"HttpHost",
"httpHost",
"=",
"UriUtils",
".",
"extractHost",
"(",
"request",
".",
"getRequestLine",
"(",
")",
".",
"getUri",
"(",
")",
")",
";",
"String",
"scheme",
"=",
"h... | Returns the target host as defined in the Host header or extracted from the request URI.
Usefull to generate Host header in a HttpRequest
@param request
@return the host formatted as host:port | [
"Returns",
"the",
"target",
"host",
"as",
"defined",
"in",
"the",
"Host",
"header",
"or",
"extracted",
"from",
"the",
"request",
"URI",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/util/HttpRequestHelper.java#L64-L81 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/http/ProxyingHttpClientBuilder.java | ProxyingHttpClientBuilder.addFetchEvent | private ClientExecChain addFetchEvent(final ClientExecChain wrapped) {
return new ClientExecChain() {
@Override
public CloseableHttpResponse execute(HttpRoute route, HttpRequestWrapper request,
HttpClientContext httpClientContext, HttpExecutionAware execAware) throws... | java | private ClientExecChain addFetchEvent(final ClientExecChain wrapped) {
return new ClientExecChain() {
@Override
public CloseableHttpResponse execute(HttpRoute route, HttpRequestWrapper request,
HttpClientContext httpClientContext, HttpExecutionAware execAware) throws... | [
"private",
"ClientExecChain",
"addFetchEvent",
"(",
"final",
"ClientExecChain",
"wrapped",
")",
"{",
"return",
"new",
"ClientExecChain",
"(",
")",
"{",
"@",
"Override",
"public",
"CloseableHttpResponse",
"execute",
"(",
"HttpRoute",
"route",
",",
"HttpRequestWrapper",... | Decorate with fetch event managements
@param wrapped
@return the decorated ClientExecChain | [
"Decorate",
"with",
"fetch",
"event",
"managements"
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/http/ProxyingHttpClientBuilder.java#L84-L122 | train |
esigate/esigate | esigate-servlet/src/main/java/org/esigate/servlet/user/FilteredRequest.java | FilteredRequest.getRemoteUser | @Override
public String getRemoteUser() {
String user = getHeader("X_REMOTE_USER");
if (user != null) {
return user;
} else {
return super.getRemoteUser();
}
} | java | @Override
public String getRemoteUser() {
String user = getHeader("X_REMOTE_USER");
if (user != null) {
return user;
} else {
return super.getRemoteUser();
}
} | [
"@",
"Override",
"public",
"String",
"getRemoteUser",
"(",
")",
"{",
"String",
"user",
"=",
"getHeader",
"(",
"\"X_REMOTE_USER\"",
")",
";",
"if",
"(",
"user",
"!=",
"null",
")",
"{",
"return",
"user",
";",
"}",
"else",
"{",
"return",
"super",
".",
"ge... | Returns the user defined as parameter "user" if present. | [
"Returns",
"the",
"user",
"defined",
"as",
"parameter",
"user",
"if",
"present",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-servlet/src/main/java/org/esigate/servlet/user/FilteredRequest.java#L36-L44 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/extension/surrogate/Surrogate.java | Surrogate.fixSurrogateMap | private void fixSurrogateMap(LinkedHashMap<String, List<String>> targetCapabilities, String currentSurrogate) {
boolean esiEnabledInEsigate = false;
// Check if Esigate will perform ESI.
for (String c : Esi.CAPABILITIES) {
if (targetCapabilities.get(currentSurrogate).contains(c)) {
... | java | private void fixSurrogateMap(LinkedHashMap<String, List<String>> targetCapabilities, String currentSurrogate) {
boolean esiEnabledInEsigate = false;
// Check if Esigate will perform ESI.
for (String c : Esi.CAPABILITIES) {
if (targetCapabilities.get(currentSurrogate).contains(c)) {
... | [
"private",
"void",
"fixSurrogateMap",
"(",
"LinkedHashMap",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"targetCapabilities",
",",
"String",
"currentSurrogate",
")",
"{",
"boolean",
"esiEnabledInEsigate",
"=",
"false",
";",
"// Check if Esigate will perform E... | The current implementation of ESI cannot execute rules partially. For instance if ESI-Inline is requested, ESI,
ESI-Inline, X-ESI-Fragment are executed.
<p>
This method handles this specific case : if one requested capability enables the Esi extension in this instance,
all other capabilities are moved to this instance... | [
"The",
"current",
"implementation",
"of",
"ESI",
"cannot",
"execute",
"rules",
"partially",
".",
"For",
"instance",
"if",
"ESI",
"-",
"Inline",
"is",
"requested",
"ESI",
"ESI",
"-",
"Inline",
"X",
"-",
"ESI",
"-",
"Fragment",
"are",
"executed",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/extension/surrogate/Surrogate.java#L438-L466 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/extension/surrogate/Surrogate.java | Surrogate.initSurrogateMap | private void initSurrogateMap(Map<String, List<String>> targetCapabilities,
SurrogateCapabilitiesHeader surrogateCapabilitiesHeader) {
for (SurrogateCapabilities sc : surrogateCapabilitiesHeader.getSurrogates()) {
targetCapabilities.put(sc.getDeviceToken(), new ArrayList<String>());
... | java | private void initSurrogateMap(Map<String, List<String>> targetCapabilities,
SurrogateCapabilitiesHeader surrogateCapabilitiesHeader) {
for (SurrogateCapabilities sc : surrogateCapabilitiesHeader.getSurrogates()) {
targetCapabilities.put(sc.getDeviceToken(), new ArrayList<String>());
... | [
"private",
"void",
"initSurrogateMap",
"(",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"targetCapabilities",
",",
"SurrogateCapabilitiesHeader",
"surrogateCapabilitiesHeader",
")",
"{",
"for",
"(",
"SurrogateCapabilities",
"sc",
":",
"surrogateCapabil... | Populate the Map with all current devices, with empty capabilities.
@param targetCapabilities
@param surrogateCapabilitiesHeader | [
"Populate",
"the",
"Map",
"with",
"all",
"current",
"devices",
"with",
"empty",
"capabilities",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/extension/surrogate/Surrogate.java#L474-L480 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/extension/surrogate/Surrogate.java | Surrogate.getFirstSurrogateFor | private String getFirstSurrogateFor(SurrogateCapabilitiesHeader surrogateCapabilitiesHeader, String capability) {
for (SurrogateCapabilities surrogate : surrogateCapabilitiesHeader.getSurrogates()) {
for (Capability sc : surrogate.getCapabilities()) {
if (capability.equals(sc.toStri... | java | private String getFirstSurrogateFor(SurrogateCapabilitiesHeader surrogateCapabilitiesHeader, String capability) {
for (SurrogateCapabilities surrogate : surrogateCapabilitiesHeader.getSurrogates()) {
for (Capability sc : surrogate.getCapabilities()) {
if (capability.equals(sc.toStri... | [
"private",
"String",
"getFirstSurrogateFor",
"(",
"SurrogateCapabilitiesHeader",
"surrogateCapabilitiesHeader",
",",
"String",
"capability",
")",
"{",
"for",
"(",
"SurrogateCapabilities",
"surrogate",
":",
"surrogateCapabilitiesHeader",
".",
"getSurrogates",
"(",
")",
")",
... | Returns the first surrogate which supports the requested capability.
@param surrogateCapabilitiesHeader
@param capability
@return a Surrogate or null if the capability is not found. | [
"Returns",
"the",
"first",
"surrogate",
"which",
"supports",
"the",
"requested",
"capability",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/extension/surrogate/Surrogate.java#L489-L499 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/extension/surrogate/Surrogate.java | Surrogate.processSurrogateControlContent | private static void processSurrogateControlContent(HttpResponse response, boolean keepHeader) {
if (!response.containsHeader(H_SURROGATE_CONTROL)) {
return;
}
if (!keepHeader) {
response.removeHeaders(H_SURROGATE_CONTROL);
return;
}
MoveRespo... | java | private static void processSurrogateControlContent(HttpResponse response, boolean keepHeader) {
if (!response.containsHeader(H_SURROGATE_CONTROL)) {
return;
}
if (!keepHeader) {
response.removeHeaders(H_SURROGATE_CONTROL);
return;
}
MoveRespo... | [
"private",
"static",
"void",
"processSurrogateControlContent",
"(",
"HttpResponse",
"response",
",",
"boolean",
"keepHeader",
")",
"{",
"if",
"(",
"!",
"response",
".",
"containsHeader",
"(",
"H_SURROGATE_CONTROL",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
... | Remove Surrogate-Control header or replace by its new value.
@param response
backend HTTP response.
@param keepHeader
should the Surrogate-Control header be forwarded to the client. | [
"Remove",
"Surrogate",
"-",
"Control",
"header",
"or",
"replace",
"by",
"its",
"new",
"value",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/extension/surrogate/Surrogate.java#L509-L520 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/vars/Operations.java | Operations.getOperandAsNumeric | private static Double getOperandAsNumeric(String op) {
Double d = null;
try {
d = Double.valueOf(op);
} catch (Exception e) {
// Null is returned if not numeric.
}
return d;
} | java | private static Double getOperandAsNumeric(String op) {
Double d = null;
try {
d = Double.valueOf(op);
} catch (Exception e) {
// Null is returned if not numeric.
}
return d;
} | [
"private",
"static",
"Double",
"getOperandAsNumeric",
"(",
"String",
"op",
")",
"{",
"Double",
"d",
"=",
"null",
";",
"try",
"{",
"d",
"=",
"Double",
".",
"valueOf",
"(",
"op",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// Null is return... | Get an operand as a numeric type.
@param op
operand as String
@return Double value or null if op is not numeric | [
"Get",
"an",
"operand",
"as",
"a",
"numeric",
"type",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/vars/Operations.java#L173-L181 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/util/PropertiesUtil.java | PropertiesUtil.getPropertyValue | public static Collection<String> getPropertyValue(Properties properties, String propertyName,
Collection<String> defaultValue) {
Collection<String> result = defaultValue;
String propertyValue = properties.getProperty(propertyName);
if (propertyValue != null) {
result = to... | java | public static Collection<String> getPropertyValue(Properties properties, String propertyName,
Collection<String> defaultValue) {
Collection<String> result = defaultValue;
String propertyValue = properties.getProperty(propertyName);
if (propertyValue != null) {
result = to... | [
"public",
"static",
"Collection",
"<",
"String",
">",
"getPropertyValue",
"(",
"Properties",
"properties",
",",
"String",
"propertyName",
",",
"Collection",
"<",
"String",
">",
"defaultValue",
")",
"{",
"Collection",
"<",
"String",
">",
"result",
"=",
"defaultVa... | Retrieves a property containing a comma separated list of values, trim them and return them as a Collection of
String.
@param properties
@param propertyName
@param defaultValue
@return the values | [
"Retrieves",
"a",
"property",
"containing",
"a",
"comma",
"separated",
"list",
"of",
"values",
"trim",
"them",
"and",
"return",
"them",
"as",
"a",
"Collection",
"of",
"String",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/util/PropertiesUtil.java#L45-L56 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/util/PropertiesUtil.java | PropertiesUtil.toCollection | static Collection<String> toCollection(String list) {
Collection<String> result = new ArrayList<>();
if (list != null) {
String[] values = list.split(",");
for (String value : values) {
String trimmed = value.trim();
if (!trimmed.isEmpty()) {
... | java | static Collection<String> toCollection(String list) {
Collection<String> result = new ArrayList<>();
if (list != null) {
String[] values = list.split(",");
for (String value : values) {
String trimmed = value.trim();
if (!trimmed.isEmpty()) {
... | [
"static",
"Collection",
"<",
"String",
">",
"toCollection",
"(",
"String",
"list",
")",
"{",
"Collection",
"<",
"String",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"list",
"!=",
"null",
")",
"{",
"String",
"[",
"]",
"val... | Return the provided comma-separated String as a collection. Order is maintained.
@param list
@return Ordered collection | [
"Return",
"the",
"provided",
"comma",
"-",
"separated",
"String",
"as",
"a",
"collection",
".",
"Order",
"is",
"maintained",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/util/PropertiesUtil.java#L64-L76 | train |
esigate/esigate | esigate-server/src/main/java/org/esigate/server/ControlHandler.java | ControlHandler.cleanupStatusKey | private static String cleanupStatusKey(String s) {
String result = s;
if (s.startsWith(PREFIX_CONTEXT)) {
result = s.substring(PREFIX_CONTEXT.length());
}
if (s.startsWith(PREFIX_THREAD_POOL)) {
result = s.substring(PREFIX_THREAD_POOL.length());
}
... | java | private static String cleanupStatusKey(String s) {
String result = s;
if (s.startsWith(PREFIX_CONTEXT)) {
result = s.substring(PREFIX_CONTEXT.length());
}
if (s.startsWith(PREFIX_THREAD_POOL)) {
result = s.substring(PREFIX_THREAD_POOL.length());
}
... | [
"private",
"static",
"String",
"cleanupStatusKey",
"(",
"String",
"s",
")",
"{",
"String",
"result",
"=",
"s",
";",
"if",
"(",
"s",
".",
"startsWith",
"(",
"PREFIX_CONTEXT",
")",
")",
"{",
"result",
"=",
"s",
".",
"substring",
"(",
"PREFIX_CONTEXT",
".",... | Remove unnecessary prefix from Metrics meters id.
@param s
@return | [
"Remove",
"unnecessary",
"prefix",
"from",
"Metrics",
"meters",
"id",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-server/src/main/java/org/esigate/server/ControlHandler.java#L225-L237 | train |
esigate/esigate | esigate-server/src/main/java/org/esigate/server/ControlHandler.java | ControlHandler.stopServer | private void stopServer() {
// Get current server
final Server targetServer = this.getServer();
// Start a new thread in order to escape the destruction of this Handler
// during the stop process.
new Thread() {
@Override
public void run() {
... | java | private void stopServer() {
// Get current server
final Server targetServer = this.getServer();
// Start a new thread in order to escape the destruction of this Handler
// during the stop process.
new Thread() {
@Override
public void run() {
... | [
"private",
"void",
"stopServer",
"(",
")",
"{",
"// Get current server",
"final",
"Server",
"targetServer",
"=",
"this",
".",
"getServer",
"(",
")",
";",
"// Start a new thread in order to escape the destruction of this Handler",
"// during the stop process.",
"new",
"Thread"... | Start a new thread to shutdown the server | [
"Start",
"a",
"new",
"thread",
"to",
"shutdown",
"the",
"server"
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-server/src/main/java/org/esigate/server/ControlHandler.java#L242-L259 | train |
esigate/esigate | esigate-server/src/main/java/org/esigate/server/metrics/InstrumentedServerConnector.java | InstrumentedServerConnector.instrument | private void instrument(String id, int port, MetricRegistry registry) {
this.setPort(port);
this.accepts = registry.meter(id + "-accepts");
this.connects = registry.meter(id + "-connects");
this.disconnects = registry.meter(id + "-disconnects");
this.connections = registry.counte... | java | private void instrument(String id, int port, MetricRegistry registry) {
this.setPort(port);
this.accepts = registry.meter(id + "-accepts");
this.connects = registry.meter(id + "-connects");
this.disconnects = registry.meter(id + "-disconnects");
this.connections = registry.counte... | [
"private",
"void",
"instrument",
"(",
"String",
"id",
",",
"int",
"port",
",",
"MetricRegistry",
"registry",
")",
"{",
"this",
".",
"setPort",
"(",
"port",
")",
";",
"this",
".",
"accepts",
"=",
"registry",
".",
"meter",
"(",
"id",
"+",
"\"-accepts\"",
... | Create metrics.
@param id
@param port
@param registry | [
"Create",
"metrics",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-server/src/main/java/org/esigate/server/metrics/InstrumentedServerConnector.java#L81-L88 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/http/HttpClientRequestExecutor.java | HttpClientRequestExecutor.execute | @Override
public CloseableHttpResponse execute(OutgoingRequest httpRequest) throws HttpErrorPage {
OutgoingRequestContext context = httpRequest.getContext();
IncomingRequest originalRequest = httpRequest.getOriginalRequest().getOriginalRequest();
if (cookieManager != null) {
Coo... | java | @Override
public CloseableHttpResponse execute(OutgoingRequest httpRequest) throws HttpErrorPage {
OutgoingRequestContext context = httpRequest.getContext();
IncomingRequest originalRequest = httpRequest.getOriginalRequest().getOriginalRequest();
if (cookieManager != null) {
Coo... | [
"@",
"Override",
"public",
"CloseableHttpResponse",
"execute",
"(",
"OutgoingRequest",
"httpRequest",
")",
"throws",
"HttpErrorPage",
"{",
"OutgoingRequestContext",
"context",
"=",
"httpRequest",
".",
"getContext",
"(",
")",
";",
"IncomingRequest",
"originalRequest",
"=... | Execute a HTTP request.
@param httpRequest
HTTP request to execute.
@return HTTP response.
@throws HttpErrorPage
if server returned no response or if the response as an error status code. | [
"Execute",
"a",
"HTTP",
"request",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/http/HttpClientRequestExecutor.java#L285-L329 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/cache/CacheAdapter.java | CacheAdapter.init | public void init(Properties properties) {
staleIfError = Parameters.STALE_IF_ERROR.getValue(properties);
staleWhileRevalidate = Parameters.STALE_WHILE_REVALIDATE.getValue(properties);
int maxAsynchronousWorkers = Parameters.MAX_ASYNCHRONOUS_WORKERS.getValue(properties);
if (staleWhileRev... | java | public void init(Properties properties) {
staleIfError = Parameters.STALE_IF_ERROR.getValue(properties);
staleWhileRevalidate = Parameters.STALE_WHILE_REVALIDATE.getValue(properties);
int maxAsynchronousWorkers = Parameters.MAX_ASYNCHRONOUS_WORKERS.getValue(properties);
if (staleWhileRev... | [
"public",
"void",
"init",
"(",
"Properties",
"properties",
")",
"{",
"staleIfError",
"=",
"Parameters",
".",
"STALE_IF_ERROR",
".",
"getValue",
"(",
"properties",
")",
";",
"staleWhileRevalidate",
"=",
"Parameters",
".",
"STALE_WHILE_REVALIDATE",
".",
"getValue",
... | Inititalize the instance.
@param properties
properties | [
"Inititalize",
"the",
"instance",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/cache/CacheAdapter.java#L59-L73 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/DriverConfiguration.java | DriverConfiguration.parseMappings | private static List<UriMapping> parseMappings(Properties props) {
List<UriMapping> mappings = new ArrayList<>();
Collection<String> mappingsParam = Parameters.MAPPINGS.getValue(props);
for (String mappingParam : mappingsParam) {
mappings.add(UriMapping.create(mappingParam));
... | java | private static List<UriMapping> parseMappings(Properties props) {
List<UriMapping> mappings = new ArrayList<>();
Collection<String> mappingsParam = Parameters.MAPPINGS.getValue(props);
for (String mappingParam : mappingsParam) {
mappings.add(UriMapping.create(mappingParam));
... | [
"private",
"static",
"List",
"<",
"UriMapping",
">",
"parseMappings",
"(",
"Properties",
"props",
")",
"{",
"List",
"<",
"UriMapping",
">",
"mappings",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"Collection",
"<",
"String",
">",
"mappingsParam",
"=",
"P... | Read the "Mappings" parameter and create the corresponding UriMapping rules.
@param props
@return The mapping rules for this driver instance. | [
"Read",
"the",
"Mappings",
"parameter",
"and",
"create",
"the",
"corresponding",
"UriMapping",
"rules",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/DriverConfiguration.java#L64-L73 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/http/cookie/CookieUtil.java | CookieUtil.encodeCookie | public static String encodeCookie(Cookie cookie) {
int maxAge = -1;
if (cookie.getExpiryDate() != null) {
maxAge = (int) ((cookie.getExpiryDate().getTime() - System.currentTimeMillis()) / ONE_SECOND);
// According to Cookie class specification, a negative value
// wou... | java | public static String encodeCookie(Cookie cookie) {
int maxAge = -1;
if (cookie.getExpiryDate() != null) {
maxAge = (int) ((cookie.getExpiryDate().getTime() - System.currentTimeMillis()) / ONE_SECOND);
// According to Cookie class specification, a negative value
// wou... | [
"public",
"static",
"String",
"encodeCookie",
"(",
"Cookie",
"cookie",
")",
"{",
"int",
"maxAge",
"=",
"-",
"1",
";",
"if",
"(",
"cookie",
".",
"getExpiryDate",
"(",
")",
"!=",
"null",
")",
"{",
"maxAge",
"=",
"(",
"int",
")",
"(",
"(",
"cookie",
"... | Utility method to transform a Cookie into a Set-Cookie Header.
@param cookie
the {@link Cookie} to format
@return the value of the Set-Cookie header | [
"Utility",
"method",
"to",
"transform",
"a",
"Cookie",
"into",
"a",
"Set",
"-",
"Cookie",
"Header",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/http/cookie/CookieUtil.java#L49-L92 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/extension/ExtensionFactory.java | ExtensionFactory.getExtension | public static <T extends Extension> T getExtension(Properties properties, Parameter<String> parameter, Driver d) {
T result;
String className = parameter.getValue(properties);
if (className == null) {
return null;
}
try {
if (LOG.isDebugEnabled()) {
... | java | public static <T extends Extension> T getExtension(Properties properties, Parameter<String> parameter, Driver d) {
T result;
String className = parameter.getValue(properties);
if (className == null) {
return null;
}
try {
if (LOG.isDebugEnabled()) {
... | [
"public",
"static",
"<",
"T",
"extends",
"Extension",
">",
"T",
"getExtension",
"(",
"Properties",
"properties",
",",
"Parameter",
"<",
"String",
">",
"parameter",
",",
"Driver",
"d",
")",
"{",
"T",
"result",
";",
"String",
"className",
"=",
"parameter",
"... | Get an extension as configured in properties.
@param properties
properties
@param parameter
the class name parameter
@param d
driver
@param <T>
class which extends Extension class which extends Extension
@return instance of {@link Extension} or null. | [
"Get",
"an",
"extension",
"as",
"configured",
"in",
"properties",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/extension/ExtensionFactory.java#L57-L73 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/parser/ParserContextImpl.java | ParserContextImpl.characters | void characters(CharSequence csq, int start, int end) throws IOException {
getCurrent().characters(csq, start, end);
} | java | void characters(CharSequence csq, int start, int end) throws IOException {
getCurrent().characters(csq, start, end);
} | [
"void",
"characters",
"(",
"CharSequence",
"csq",
",",
"int",
"start",
",",
"int",
"end",
")",
"throws",
"IOException",
"{",
"getCurrent",
"(",
")",
".",
"characters",
"(",
"csq",
",",
"start",
",",
"end",
")",
";",
"}"
] | Writes characters into current writer. | [
"Writes",
"characters",
"into",
"current",
"writer",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/parser/ParserContextImpl.java#L107-L109 | train |
esigate/esigate | esigate-server/src/main/java/org/esigate/server/EsigateServer.java | EsigateServer.getProperty | private static int getProperty(String prefix, String name, int defaultValue) {
int result = defaultValue;
try {
result = Integer.parseInt(System.getProperty(prefix + name));
} catch (NumberFormatException e) {
LOG.warn("Value for " + prefix + name + " must be an integer.... | java | private static int getProperty(String prefix, String name, int defaultValue) {
int result = defaultValue;
try {
result = Integer.parseInt(System.getProperty(prefix + name));
} catch (NumberFormatException e) {
LOG.warn("Value for " + prefix + name + " must be an integer.... | [
"private",
"static",
"int",
"getProperty",
"(",
"String",
"prefix",
",",
"String",
"name",
",",
"int",
"defaultValue",
")",
"{",
"int",
"result",
"=",
"defaultValue",
";",
"try",
"{",
"result",
"=",
"Integer",
".",
"parseInt",
"(",
"System",
".",
"getPrope... | Get an integer from System properties
@param prefix
@param name
@param defaultValue
@return | [
"Get",
"an",
"integer",
"from",
"System",
"properties"
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-server/src/main/java/org/esigate/server/EsigateServer.java#L87-L96 | train |
esigate/esigate | esigate-server/src/main/java/org/esigate/server/EsigateServer.java | EsigateServer.getProperty | private static String getProperty(String prefix, String name, String defaultValue) {
return System.getProperty(prefix + name, defaultValue);
} | java | private static String getProperty(String prefix, String name, String defaultValue) {
return System.getProperty(prefix + name, defaultValue);
} | [
"private",
"static",
"String",
"getProperty",
"(",
"String",
"prefix",
",",
"String",
"name",
",",
"String",
"defaultValue",
")",
"{",
"return",
"System",
".",
"getProperty",
"(",
"prefix",
"+",
"name",
",",
"defaultValue",
")",
";",
"}"
] | Get String from System properties
@param prefix
@param name
@param defaultValue
@return | [
"Get",
"String",
"from",
"System",
"properties"
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-server/src/main/java/org/esigate/server/EsigateServer.java#L106-L108 | train |
esigate/esigate | esigate-server/src/main/java/org/esigate/server/EsigateServer.java | EsigateServer.init | public static void init() {
// Get configuration
// Read from "server.properties" or custom file.
String configFile = null;
Properties serverProperties = new Properties();
try {
configFile = System.getProperty(PROPERTY_PREFIX + "config", "server.properties");
... | java | public static void init() {
// Get configuration
// Read from "server.properties" or custom file.
String configFile = null;
Properties serverProperties = new Properties();
try {
configFile = System.getProperty(PROPERTY_PREFIX + "config", "server.properties");
... | [
"public",
"static",
"void",
"init",
"(",
")",
"{",
"// Get configuration",
"// Read from \"server.properties\" or custom file.",
"String",
"configFile",
"=",
"null",
";",
"Properties",
"serverProperties",
"=",
"new",
"Properties",
"(",
")",
";",
"try",
"{",
"configFil... | Read server configuration from System properties and from server.properties. | [
"Read",
"server",
"configuration",
"from",
"System",
"properties",
"and",
"from",
"server",
".",
"properties",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-server/src/main/java/org/esigate/server/EsigateServer.java#L113-L135 | train |
esigate/esigate | esigate-server/src/main/java/org/esigate/server/EsigateServer.java | EsigateServer.init | public static void init(Properties configuration) {
for (Object prop : configuration.keySet()) {
String serverPropertyName = (String) prop;
System.setProperty(PROPERTY_PREFIX + serverPropertyName, configuration.getProperty(serverPropertyName));
}
// Read system properti... | java | public static void init(Properties configuration) {
for (Object prop : configuration.keySet()) {
String serverPropertyName = (String) prop;
System.setProperty(PROPERTY_PREFIX + serverPropertyName, configuration.getProperty(serverPropertyName));
}
// Read system properti... | [
"public",
"static",
"void",
"init",
"(",
"Properties",
"configuration",
")",
"{",
"for",
"(",
"Object",
"prop",
":",
"configuration",
".",
"keySet",
"(",
")",
")",
"{",
"String",
"serverPropertyName",
"=",
"(",
"String",
")",
"prop",
";",
"System",
".",
... | Set the provided server configuration then read configuration from System properties or load defaults.
@param configuration
configuration to use. | [
"Set",
"the",
"provided",
"server",
"configuration",
"then",
"read",
"configuration",
"from",
"System",
"properties",
"or",
"load",
"defaults",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-server/src/main/java/org/esigate/server/EsigateServer.java#L143-L161 | train |
esigate/esigate | esigate-server/src/main/java/org/esigate/server/EsigateServer.java | EsigateServer.main | public static void main(String[] args) throws Exception {
if (args.length < 1) {
EsigateServer.usage();
return;
}
switch (args[0]) {
case "start":
EsigateServer.init();
EsigateServer.start();
break;
case "stop":
... | java | public static void main(String[] args) throws Exception {
if (args.length < 1) {
EsigateServer.usage();
return;
}
switch (args[0]) {
case "start":
EsigateServer.init();
EsigateServer.start();
break;
case "stop":
... | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"if",
"(",
"args",
".",
"length",
"<",
"1",
")",
"{",
"EsigateServer",
".",
"usage",
"(",
")",
";",
"return",
";",
"}",
"switch",
"(",
"args",
"["... | Esigate Server entry point.
@param args
command line arguments.
@throws Exception
when server cannot be started. | [
"Esigate",
"Server",
"entry",
"point",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-server/src/main/java/org/esigate/server/EsigateServer.java#L180-L201 | train |
esigate/esigate | esigate-server/src/main/java/org/esigate/server/EsigateServer.java | EsigateServer.start | public static void start() throws Exception {
MetricRegistry registry = new MetricRegistry();
QueuedThreadPool threadPool = new InstrumentedQueuedThreadPool(registry);
threadPool.setName("esigate");
threadPool.setMaxThreads(maxThreads);
threadPool.setMinThreads(minThreads);
... | java | public static void start() throws Exception {
MetricRegistry registry = new MetricRegistry();
QueuedThreadPool threadPool = new InstrumentedQueuedThreadPool(registry);
threadPool.setName("esigate");
threadPool.setMaxThreads(maxThreads);
threadPool.setMinThreads(minThreads);
... | [
"public",
"static",
"void",
"start",
"(",
")",
"throws",
"Exception",
"{",
"MetricRegistry",
"registry",
"=",
"new",
"MetricRegistry",
"(",
")",
";",
"QueuedThreadPool",
"threadPool",
"=",
"new",
"InstrumentedQueuedThreadPool",
"(",
"registry",
")",
";",
"threadPo... | Create and start server.
@throws Exception
when server cannot be started. | [
"Create",
"and",
"start",
"server",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-server/src/main/java/org/esigate/server/EsigateServer.java#L232-L301 | train |
esigate/esigate | esigate-server/src/main/java/org/esigate/server/EsigateServer.java | EsigateServer.usage | private static void usage() {
StringBuilder usageText = new StringBuilder();
usageText.append("Usage: java -D").append(PROPERTY_PREFIX)
.append("config=esigate.properties -jar esigate-server.jar [start|stop]\n\t");
usageText.append("start Start the server (default)\n\t");
... | java | private static void usage() {
StringBuilder usageText = new StringBuilder();
usageText.append("Usage: java -D").append(PROPERTY_PREFIX)
.append("config=esigate.properties -jar esigate-server.jar [start|stop]\n\t");
usageText.append("start Start the server (default)\n\t");
... | [
"private",
"static",
"void",
"usage",
"(",
")",
"{",
"StringBuilder",
"usageText",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"usageText",
".",
"append",
"(",
"\"Usage: java -D\"",
")",
".",
"append",
"(",
"PROPERTY_PREFIX",
")",
".",
"append",
"(",
"\"conf... | Display usage information. | [
"Display",
"usage",
"information",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-server/src/main/java/org/esigate/server/EsigateServer.java#L322-L331 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/util/UriUtils.java | UriUtils.encodeIllegalCharacters | public static String encodeIllegalCharacters(String uri) {
StringBuilder result = new StringBuilder();
int length = uri.length();
for (int i = 0; i < length; i++) {
char character = uri.charAt(i);
if (character == '%') {
// Encode invalid escape sequences
... | java | public static String encodeIllegalCharacters(String uri) {
StringBuilder result = new StringBuilder();
int length = uri.length();
for (int i = 0; i < length; i++) {
char character = uri.charAt(i);
if (character == '%') {
// Encode invalid escape sequences
... | [
"public",
"static",
"String",
"encodeIllegalCharacters",
"(",
"String",
"uri",
")",
"{",
"StringBuilder",
"result",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"int",
"length",
"=",
"uri",
".",
"length",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
... | Fixes common mistakes in URI by replacing all illegal characters by their encoded value.
@param uri
the URI to fix
@return the fixed URI | [
"Fixes",
"common",
"mistakes",
"in",
"URI",
"by",
"replacing",
"all",
"illegal",
"characters",
"by",
"their",
"encoded",
"value",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/util/UriUtils.java#L76-L98 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/util/UriUtils.java | UriUtils.createURI | public static String createURI(final String scheme, final String host, int port, final String path,
final String query, final String fragment) {
StringBuilder buffer = new StringBuilder(Parameters.SMALL_BUFFER_SIZE);
if (host != null) {
if (scheme != null) {
buffe... | java | public static String createURI(final String scheme, final String host, int port, final String path,
final String query, final String fragment) {
StringBuilder buffer = new StringBuilder(Parameters.SMALL_BUFFER_SIZE);
if (host != null) {
if (scheme != null) {
buffe... | [
"public",
"static",
"String",
"createURI",
"(",
"final",
"String",
"scheme",
",",
"final",
"String",
"host",
",",
"int",
"port",
",",
"final",
"String",
"path",
",",
"final",
"String",
"query",
",",
"final",
"String",
"fragment",
")",
"{",
"StringBuilder",
... | Creates an URI as a String.
@param scheme
the scheme
@param host
the host
@param port
the port
@param path
the path
@param query
the query
@param fragment
the fragment
@return the uri | [
"Creates",
"an",
"URI",
"as",
"a",
"String",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/util/UriUtils.java#L134-L163 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/util/UriUtils.java | UriUtils.rewriteURI | public static String rewriteURI(String uri, HttpHost targetHost) {
try {
return URIUtils.rewriteURI(createURI(uri), targetHost).toString();
} catch (URISyntaxException e) {
throw new InvalidUriException(e);
}
} | java | public static String rewriteURI(String uri, HttpHost targetHost) {
try {
return URIUtils.rewriteURI(createURI(uri), targetHost).toString();
} catch (URISyntaxException e) {
throw new InvalidUriException(e);
}
} | [
"public",
"static",
"String",
"rewriteURI",
"(",
"String",
"uri",
",",
"HttpHost",
"targetHost",
")",
"{",
"try",
"{",
"return",
"URIUtils",
".",
"rewriteURI",
"(",
"createURI",
"(",
"uri",
")",
",",
"targetHost",
")",
".",
"toString",
"(",
")",
";",
"}"... | Replaces the scheme, host and port in a URI.
@param uri
the URI
@param targetHost
the target host
@return the rewritten URI | [
"Replaces",
"the",
"scheme",
"host",
"and",
"port",
"in",
"a",
"URI",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/util/UriUtils.java#L226-L232 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/util/UriUtils.java | UriUtils.removeSessionId | public static String removeSessionId(String sessionId, String page) {
String regexp = ";?jsessionid=" + Pattern.quote(sessionId);
return page.replaceAll(regexp, "");
} | java | public static String removeSessionId(String sessionId, String page) {
String regexp = ";?jsessionid=" + Pattern.quote(sessionId);
return page.replaceAll(regexp, "");
} | [
"public",
"static",
"String",
"removeSessionId",
"(",
"String",
"sessionId",
",",
"String",
"page",
")",
"{",
"String",
"regexp",
"=",
"\";?jsessionid=\"",
"+",
"Pattern",
".",
"quote",
"(",
"sessionId",
")",
";",
"return",
"page",
".",
"replaceAll",
"(",
"r... | Removes the jsessionid that may have been added to a URI on a java application server.
@param sessionId
the value of the sessionId that can also be found in a JSESSIONID cookie
@param page
the html code of the page
@return the fixed html | [
"Removes",
"the",
"jsessionid",
"that",
"may",
"have",
"been",
"added",
"to",
"a",
"URI",
"on",
"a",
"java",
"application",
"server",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/util/UriUtils.java#L243-L246 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/util/UriUtils.java | UriUtils.removeQuerystring | public static String removeQuerystring(String uriString) {
URI uri = createURI(uriString);
try {
return new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), uri.getPath(), null, null)
.toASCIIString();
} catch (URISyntaxException e) {
... | java | public static String removeQuerystring(String uriString) {
URI uri = createURI(uriString);
try {
return new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), uri.getPath(), null, null)
.toASCIIString();
} catch (URISyntaxException e) {
... | [
"public",
"static",
"String",
"removeQuerystring",
"(",
"String",
"uriString",
")",
"{",
"URI",
"uri",
"=",
"createURI",
"(",
"uriString",
")",
";",
"try",
"{",
"return",
"new",
"URI",
"(",
"uri",
".",
"getScheme",
"(",
")",
",",
"uri",
".",
"getUserInfo... | Removes the query and fragment at the end of a URI.
@param uriString
the original URI as a String
@return the URI without querystring nor fragment | [
"Removes",
"the",
"query",
"and",
"fragment",
"at",
"the",
"end",
"of",
"a",
"URI",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/util/UriUtils.java#L384-L392 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/http/DateUtils.java | DateUtils.formatDate | public static String formatDate(Date date) {
return org.apache.http.client.utils.DateUtils.formatDate(date);
} | java | public static String formatDate(Date date) {
return org.apache.http.client.utils.DateUtils.formatDate(date);
} | [
"public",
"static",
"String",
"formatDate",
"(",
"Date",
"date",
")",
"{",
"return",
"org",
".",
"apache",
".",
"http",
".",
"client",
".",
"utils",
".",
"DateUtils",
".",
"formatDate",
"(",
"date",
")",
";",
"}"
] | Formats the given date according to the RFC 1123 pattern.
@param date
The date to format.
@return An RFC 1123 formatted date string. | [
"Formats",
"the",
"given",
"date",
"according",
"to",
"the",
"RFC",
"1123",
"pattern",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/http/DateUtils.java#L18-L20 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/aggregator/ElementAttributesFactory.java | ElementAttributesFactory.createElementAttributes | static ElementAttributes createElementAttributes(String tag) {
// Parsing strings
// <!--$includetemplate$aggregated2$templatewithparams.jsp$-->
// or
// <!--$includeblock$aggregated2$$(block)$myblock$-->
// in order to retrieve driver, page and name attributes
Pattern pa... | java | static ElementAttributes createElementAttributes(String tag) {
// Parsing strings
// <!--$includetemplate$aggregated2$templatewithparams.jsp$-->
// or
// <!--$includeblock$aggregated2$$(block)$myblock$-->
// in order to retrieve driver, page and name attributes
Pattern pa... | [
"static",
"ElementAttributes",
"createElementAttributes",
"(",
"String",
"tag",
")",
"{",
"// Parsing strings",
"// <!--$includetemplate$aggregated2$templatewithparams.jsp$-->",
"// or",
"// <!--$includeblock$aggregated2$$(block)$myblock$-->",
"// in order to retrieve driver, page and name a... | Parse the tag and return the ElementAttributes
@param tag
the tag to parse
@return ElementAttributes | [
"Parse",
"the",
"tag",
"and",
"return",
"the",
"ElementAttributes"
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/aggregator/ElementAttributesFactory.java#L28-L62 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/http/ContentTypeHelper.java | ContentTypeHelper.isTextContentType | public boolean isTextContentType(HttpResponse httpResponse) {
String contentType = HttpResponseUtils.getFirstHeader(HttpHeaders.CONTENT_TYPE, httpResponse);
return isTextContentType(contentType);
} | java | public boolean isTextContentType(HttpResponse httpResponse) {
String contentType = HttpResponseUtils.getFirstHeader(HttpHeaders.CONTENT_TYPE, httpResponse);
return isTextContentType(contentType);
} | [
"public",
"boolean",
"isTextContentType",
"(",
"HttpResponse",
"httpResponse",
")",
"{",
"String",
"contentType",
"=",
"HttpResponseUtils",
".",
"getFirstHeader",
"(",
"HttpHeaders",
".",
"CONTENT_TYPE",
",",
"httpResponse",
")",
";",
"return",
"isTextContentType",
"(... | Check whether the given request's content-type corresponds to "parseable" text.
@param httpResponse
the response to analyze depending on its content-type
@return true if this represents text or false if not | [
"Check",
"whether",
"the",
"given",
"request",
"s",
"content",
"-",
"type",
"corresponds",
"to",
"parseable",
"text",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/http/ContentTypeHelper.java#L39-L42 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/http/ContentTypeHelper.java | ContentTypeHelper.isTextContentType | public boolean isTextContentType(String contentType) {
if (contentType != null) {
String lowerContentType = contentType.toLowerCase();
for (String textContentType : this.parsableContentTypes) {
if (lowerContentType.startsWith(textContentType)) {
return... | java | public boolean isTextContentType(String contentType) {
if (contentType != null) {
String lowerContentType = contentType.toLowerCase();
for (String textContentType : this.parsableContentTypes) {
if (lowerContentType.startsWith(textContentType)) {
return... | [
"public",
"boolean",
"isTextContentType",
"(",
"String",
"contentType",
")",
"{",
"if",
"(",
"contentType",
"!=",
"null",
")",
"{",
"String",
"lowerContentType",
"=",
"contentType",
".",
"toLowerCase",
"(",
")",
";",
"for",
"(",
"String",
"textContentType",
":... | Check whether the given content-type corresponds to "parseable" text.
@param contentType
the input content-type
@return true if this represents text or false if not | [
"Check",
"whether",
"the",
"given",
"content",
"-",
"type",
"corresponds",
"to",
"parseable",
"text",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/http/ContentTypeHelper.java#L51-L61 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/DriverFactory.java | DriverFactory.configure | public static void configure() {
InputStream inputStream = null;
try {
URL configUrl = getConfigUrl();
if (configUrl == null) {
throw new ConfigurationException("esigate.properties configuration file "
+ "was not found in the classpath");... | java | public static void configure() {
InputStream inputStream = null;
try {
URL configUrl = getConfigUrl();
if (configUrl == null) {
throw new ConfigurationException("esigate.properties configuration file "
+ "was not found in the classpath");... | [
"public",
"static",
"void",
"configure",
"(",
")",
"{",
"InputStream",
"inputStream",
"=",
"null",
";",
"try",
"{",
"URL",
"configUrl",
"=",
"getConfigUrl",
"(",
")",
";",
"if",
"(",
"configUrl",
"==",
"null",
")",
"{",
"throw",
"new",
"ConfigurationExcept... | Loads all instances according to default configuration file. | [
"Loads",
"all",
"instances",
"according",
"to",
"default",
"configuration",
"file",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/DriverFactory.java#L111-L144 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/DriverFactory.java | DriverFactory.configure | public static void configure(Properties props) {
Properties defaultProperties = new Properties();
HashMap<String, Properties> driversProps = new HashMap<>();
for (Enumeration<?> enumeration = props.propertyNames(); enumeration.hasMoreElements();) {
String propertyName = (String) enu... | java | public static void configure(Properties props) {
Properties defaultProperties = new Properties();
HashMap<String, Properties> driversProps = new HashMap<>();
for (Enumeration<?> enumeration = props.propertyNames(); enumeration.hasMoreElements();) {
String propertyName = (String) enu... | [
"public",
"static",
"void",
"configure",
"(",
"Properties",
"props",
")",
"{",
"Properties",
"defaultProperties",
"=",
"new",
"Properties",
"(",
")",
";",
"HashMap",
"<",
"String",
",",
"Properties",
">",
"driversProps",
"=",
"new",
"HashMap",
"<>",
"(",
")"... | Loads all instances according to the properties parameter.
@param props
properties to use for configuration | [
"Loads",
"all",
"instances",
"according",
"to",
"the",
"properties",
"parameter",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/DriverFactory.java#L152-L190 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/DriverFactory.java | DriverFactory.selectProvider | static MatchedRequest selectProvider(IncomingRequest request) throws HttpErrorPage {
URI requestURI = UriUtils.createURI(request.getRequestLine().getUri());
String host = UriUtils.extractHost(requestURI).toHostString();
Header hostHeader = request.getFirstHeader(HttpHeaders.HOST);
if (ho... | java | static MatchedRequest selectProvider(IncomingRequest request) throws HttpErrorPage {
URI requestURI = UriUtils.createURI(request.getRequestLine().getUri());
String host = UriUtils.extractHost(requestURI).toHostString();
Header hostHeader = request.getFirstHeader(HttpHeaders.HOST);
if (ho... | [
"static",
"MatchedRequest",
"selectProvider",
"(",
"IncomingRequest",
"request",
")",
"throws",
"HttpErrorPage",
"{",
"URI",
"requestURI",
"=",
"UriUtils",
".",
"createURI",
"(",
"request",
".",
"getRequestLine",
"(",
")",
".",
"getUri",
"(",
")",
")",
";",
"S... | Selects the Driver instance for this request based on the mappings declared in the configuration.
@param request
the incoming request
@return a {@link MatchedRequest} containing the {@link Driver} instance and the relative URI
@throws HttpErrorPage
if no instance was found for this request | [
"Selects",
"the",
"Driver",
"instance",
"for",
"this",
"request",
"based",
"on",
"the",
"mappings",
"declared",
"in",
"the",
"configuration",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/DriverFactory.java#L243-L277 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/vars/VariablesResolver.java | VariablesResolver.replaceAllVariables | public static String replaceAllVariables(String strVars, DriverRequest request) {
String result = strVars;
if (VariablesResolver.containsVariable(strVars)) {
Matcher matcher = VAR_PATTERN.matcher(strVars);
while (matcher.find()) {
String group = matcher.group();
... | java | public static String replaceAllVariables(String strVars, DriverRequest request) {
String result = strVars;
if (VariablesResolver.containsVariable(strVars)) {
Matcher matcher = VAR_PATTERN.matcher(strVars);
while (matcher.find()) {
String group = matcher.group();
... | [
"public",
"static",
"String",
"replaceAllVariables",
"(",
"String",
"strVars",
",",
"DriverRequest",
"request",
")",
"{",
"String",
"result",
"=",
"strVars",
";",
"if",
"(",
"VariablesResolver",
".",
"containsVariable",
"(",
"strVars",
")",
")",
"{",
"Matcher",
... | Replace all ESI variables found in strVars by their matching value in vars.properties.
@param strVars
a String containing variables.
@param request
@return The resulting String | [
"Replace",
"all",
"ESI",
"variables",
"found",
"in",
"strVars",
"by",
"their",
"matching",
"value",
"in",
"vars",
".",
"properties",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/vars/VariablesResolver.java#L143-L183 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/events/EventManager.java | EventManager.register | public void register(EventDefinition eventDefinition, IEventListener listener) {
if (eventDefinition.getType() == EventDefinition.TYPE_POST) {
register(listenersPost, eventDefinition, listener, true);
} else {
register(listeners, eventDefinition, listener, false);
}
} | java | public void register(EventDefinition eventDefinition, IEventListener listener) {
if (eventDefinition.getType() == EventDefinition.TYPE_POST) {
register(listenersPost, eventDefinition, listener, true);
} else {
register(listeners, eventDefinition, listener, false);
}
} | [
"public",
"void",
"register",
"(",
"EventDefinition",
"eventDefinition",
",",
"IEventListener",
"listener",
")",
"{",
"if",
"(",
"eventDefinition",
".",
"getType",
"(",
")",
"==",
"EventDefinition",
".",
"TYPE_POST",
")",
"{",
"register",
"(",
"listenersPost",
"... | Start listening to an event.
@param eventDefinition
@param listener | [
"Start",
"listening",
"to",
"an",
"event",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/events/EventManager.java#L127-L133 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/events/EventManager.java | EventManager.fire | public void fire(EventDefinition eventDefinition, Event eventDetails) {
if (eventDefinition.getType() == EventDefinition.TYPE_POST) {
fire(listenersPost, eventDefinition, eventDetails);
} else {
fire(listeners, eventDefinition, eventDetails);
}
} | java | public void fire(EventDefinition eventDefinition, Event eventDetails) {
if (eventDefinition.getType() == EventDefinition.TYPE_POST) {
fire(listenersPost, eventDefinition, eventDetails);
} else {
fire(listeners, eventDefinition, eventDetails);
}
} | [
"public",
"void",
"fire",
"(",
"EventDefinition",
"eventDefinition",
",",
"Event",
"eventDetails",
")",
"{",
"if",
"(",
"eventDefinition",
".",
"getType",
"(",
")",
"==",
"EventDefinition",
".",
"TYPE_POST",
")",
"{",
"fire",
"(",
"listenersPost",
",",
"eventD... | Fire a new event and run all the listeners.
@param eventDefinition
@param eventDetails | [
"Fire",
"a",
"new",
"event",
"and",
"run",
"all",
"the",
"listeners",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/events/EventManager.java#L141-L147 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/events/EventManager.java | EventManager.unregister | public void unregister(EventDefinition eventDefinition, IEventListener eventListener) {
if (eventDefinition.getType() == EventDefinition.TYPE_POST) {
unregister(listenersPost, eventDefinition, eventListener);
} else {
unregister(listeners, eventDefinition, eventListener);
... | java | public void unregister(EventDefinition eventDefinition, IEventListener eventListener) {
if (eventDefinition.getType() == EventDefinition.TYPE_POST) {
unregister(listenersPost, eventDefinition, eventListener);
} else {
unregister(listeners, eventDefinition, eventListener);
... | [
"public",
"void",
"unregister",
"(",
"EventDefinition",
"eventDefinition",
",",
"IEventListener",
"eventListener",
")",
"{",
"if",
"(",
"eventDefinition",
".",
"getType",
"(",
")",
"==",
"EventDefinition",
".",
"TYPE_POST",
")",
"{",
"unregister",
"(",
"listenersP... | Stop listening to an event.
@param eventDefinition
@param eventListener | [
"Stop",
"listening",
"to",
"an",
"event",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/events/EventManager.java#L177-L183 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/http/MoveResponseHeader.java | MoveResponseHeader.moveHeader | public static void moveHeader(HttpResponse response, String srcName, String targetName) {
if (response.containsHeader(srcName)) {
LOG.info("Moving header {} to {}", srcName, targetName);
Header[] headers = response.getHeaders(srcName);
response.removeHeaders(targetName);
... | java | public static void moveHeader(HttpResponse response, String srcName, String targetName) {
if (response.containsHeader(srcName)) {
LOG.info("Moving header {} to {}", srcName, targetName);
Header[] headers = response.getHeaders(srcName);
response.removeHeaders(targetName);
... | [
"public",
"static",
"void",
"moveHeader",
"(",
"HttpResponse",
"response",
",",
"String",
"srcName",
",",
"String",
"targetName",
")",
"{",
"if",
"(",
"response",
".",
"containsHeader",
"(",
"srcName",
")",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Moving header... | This method can be used directly to move an header.
@param response
HTTP response
@param srcName
source header name
@param targetName
target header name | [
"This",
"method",
"can",
"be",
"used",
"directly",
"to",
"move",
"an",
"header",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/http/MoveResponseHeader.java#L73-L84 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/Driver.java | Driver.render | public CloseableHttpResponse render(String pageUrl, IncomingRequest incomingRequest, Renderer... renderers)
throws IOException, HttpErrorPage {
DriverRequest driverRequest = new DriverRequest(incomingRequest, this, pageUrl);
// Replace ESI variables in URL
// TODO: should be perform... | java | public CloseableHttpResponse render(String pageUrl, IncomingRequest incomingRequest, Renderer... renderers)
throws IOException, HttpErrorPage {
DriverRequest driverRequest = new DriverRequest(incomingRequest, this, pageUrl);
// Replace ESI variables in URL
// TODO: should be perform... | [
"public",
"CloseableHttpResponse",
"render",
"(",
"String",
"pageUrl",
",",
"IncomingRequest",
"incomingRequest",
",",
"Renderer",
"...",
"renderers",
")",
"throws",
"IOException",
",",
"HttpErrorPage",
"{",
"DriverRequest",
"driverRequest",
"=",
"new",
"DriverRequest",... | Perform rendering on a single url content, and append result to "writer". Automatically follows redirects
@param pageUrl
Address of the page containing the template
@param incomingRequest
originating request object
@param renderers
the renderers to use in order to transform the output
@return The resulting response
@t... | [
"Perform",
"rendering",
"on",
"a",
"single",
"url",
"content",
"and",
"append",
"result",
"to",
"writer",
".",
"Automatically",
"follows",
"redirects"
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/Driver.java#L156-L220 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/Driver.java | Driver.proxy | public CloseableHttpResponse proxy(String relUrl, IncomingRequest incomingRequest, Renderer... renderers)
throws IOException, HttpErrorPage {
DriverRequest driverRequest = new DriverRequest(incomingRequest, this, relUrl);
driverRequest.setCharacterEncoding(this.config.getUriEncoding());
... | java | public CloseableHttpResponse proxy(String relUrl, IncomingRequest incomingRequest, Renderer... renderers)
throws IOException, HttpErrorPage {
DriverRequest driverRequest = new DriverRequest(incomingRequest, this, relUrl);
driverRequest.setCharacterEncoding(this.config.getUriEncoding());
... | [
"public",
"CloseableHttpResponse",
"proxy",
"(",
"String",
"relUrl",
",",
"IncomingRequest",
"incomingRequest",
",",
"Renderer",
"...",
"renderers",
")",
"throws",
"IOException",
",",
"HttpErrorPage",
"{",
"DriverRequest",
"driverRequest",
"=",
"new",
"DriverRequest",
... | Retrieves a resource from the provider application and transforms it using the Renderer passed as a parameter.
@param relUrl
the relative URL to the resource
@param incomingRequest
the request
@param renderers
the renderers to use to transform the output
@return The resulting response.
@throws IOException
If an IOExce... | [
"Retrieves",
"a",
"resource",
"from",
"the",
"provider",
"application",
"and",
"transforms",
"it",
"using",
"the",
"Renderer",
"passed",
"as",
"a",
"parameter",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/Driver.java#L269-L337 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/http/HttpResponseUtils.java | HttpResponseUtils.getFirstHeader | public static String getFirstHeader(String headerName, HttpResponse httpResponse) {
Header header = httpResponse.getFirstHeader(headerName);
if (header != null) {
return header.getValue();
}
return null;
} | java | public static String getFirstHeader(String headerName, HttpResponse httpResponse) {
Header header = httpResponse.getFirstHeader(headerName);
if (header != null) {
return header.getValue();
}
return null;
} | [
"public",
"static",
"String",
"getFirstHeader",
"(",
"String",
"headerName",
",",
"HttpResponse",
"httpResponse",
")",
"{",
"Header",
"header",
"=",
"httpResponse",
".",
"getFirstHeader",
"(",
"headerName",
")",
";",
"if",
"(",
"header",
"!=",
"null",
")",
"{"... | Get the value of the first header matching "headerName".
@param headerName
@param httpResponse
@return value of the first header or null if it doesn't exist. | [
"Get",
"the",
"value",
"of",
"the",
"first",
"header",
"matching",
"headerName",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/http/HttpResponseUtils.java#L82-L88 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/http/HeaderManager.java | HeaderManager.copyHeaders | public CloseableHttpResponse copyHeaders(OutgoingRequest outgoingRequest,
HttpEntityEnclosingRequest incomingRequest, HttpResponse httpClientResponse) {
HttpResponse result = new BasicHttpResponse(httpClientResponse.getStatusLine());
result.setEntity(httpClientResponse.getEntity());
... | java | public CloseableHttpResponse copyHeaders(OutgoingRequest outgoingRequest,
HttpEntityEnclosingRequest incomingRequest, HttpResponse httpClientResponse) {
HttpResponse result = new BasicHttpResponse(httpClientResponse.getStatusLine());
result.setEntity(httpClientResponse.getEntity());
... | [
"public",
"CloseableHttpResponse",
"copyHeaders",
"(",
"OutgoingRequest",
"outgoingRequest",
",",
"HttpEntityEnclosingRequest",
"incomingRequest",
",",
"HttpResponse",
"httpClientResponse",
")",
"{",
"HttpResponse",
"result",
"=",
"new",
"BasicHttpResponse",
"(",
"httpClientR... | Copies end-to-end headers from a response received from the server to the response to be sent to the client.
@param outgoingRequest
the request sent
@param incomingRequest
the original request received from the client
@param httpClientResponse
the response received from the provider application
@return the response to... | [
"Copies",
"end",
"-",
"to",
"-",
"end",
"headers",
"from",
"a",
"response",
"received",
"from",
"the",
"server",
"to",
"the",
"response",
"to",
"be",
"sent",
"to",
"the",
"client",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/http/HeaderManager.java#L159-L225 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/util/FilterList.java | FilterList.add | public void add(String toAdd) {
if (toAdd.contains("*")) {
set.clear();
defaultContains = true;
} else {
if (!defaultContains) {
set.add(toAdd);
} else {
set.remove(toAdd);
}
}
} | java | public void add(String toAdd) {
if (toAdd.contains("*")) {
set.clear();
defaultContains = true;
} else {
if (!defaultContains) {
set.add(toAdd);
} else {
set.remove(toAdd);
}
}
} | [
"public",
"void",
"add",
"(",
"String",
"toAdd",
")",
"{",
"if",
"(",
"toAdd",
".",
"contains",
"(",
"\"*\"",
")",
")",
"{",
"set",
".",
"clear",
"(",
")",
";",
"defaultContains",
"=",
"true",
";",
"}",
"else",
"{",
"if",
"(",
"!",
"defaultContains... | Add some tokens to the list. By default the list is empty. If the list already contains the added tokens or
everything, this method will have no effect.
@param toAdd
String token to add to the list. This argument can be:
<ul>
<li>A single String token</li>
<li>* (in this case the list will then act as if it contained ... | [
"Add",
"some",
"tokens",
"to",
"the",
"list",
".",
"By",
"default",
"the",
"list",
"is",
"empty",
".",
"If",
"the",
"list",
"already",
"contains",
"the",
"added",
"tokens",
"or",
"everything",
"this",
"method",
"will",
"have",
"no",
"effect",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/util/FilterList.java#L30-L41 | train |
esigate/esigate | esigate-core/src/main/java/org/esigate/util/FilterList.java | FilterList.remove | public void remove(String toRemove) {
if (toRemove.contains("*")) {
set.clear();
defaultContains = false;
} else {
if (defaultContains) {
set.add(toRemove);
} else {
set.remove(toRemove);
}
}
} | java | public void remove(String toRemove) {
if (toRemove.contains("*")) {
set.clear();
defaultContains = false;
} else {
if (defaultContains) {
set.add(toRemove);
} else {
set.remove(toRemove);
}
}
} | [
"public",
"void",
"remove",
"(",
"String",
"toRemove",
")",
"{",
"if",
"(",
"toRemove",
".",
"contains",
"(",
"\"*\"",
")",
")",
"{",
"set",
".",
"clear",
"(",
")",
";",
"defaultContains",
"=",
"false",
";",
"}",
"else",
"{",
"if",
"(",
"defaultConta... | Remove some tokens from the list. If the list is already empty or does not contains the tokens, this method will
have no effect.
@param toRemove
String tokens to add to the list. This argument can be:
<ul>
<li>A single String token</li>
<li>* (in this case the list will then be empty again)</li>
</ul> | [
"Remove",
"some",
"tokens",
"from",
"the",
"list",
".",
"If",
"the",
"list",
"is",
"already",
"empty",
"or",
"does",
"not",
"contains",
"the",
"tokens",
"this",
"method",
"will",
"have",
"no",
"effect",
"."
] | 50421fb224f16e1ec42715425109a72b3b55527b | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/util/FilterList.java#L54-L65 | train |
Shusshu/Android-RecurrencePicker | library/src/main/java/be/billington/calendar/recurrencepicker/RecurrencePickerDialog.java | RecurrencePickerDialog.updateEndCountText | private void updateEndCountText() {
final String END_COUNT_MARKER = "%d";
String endString = mResources.getQuantityString(R.plurals.recurrence_end_count,
mModel.endCount);
int markerStart = endString.indexOf(END_COUNT_MARKER);
if (markerStart != -1) {
if (mar... | java | private void updateEndCountText() {
final String END_COUNT_MARKER = "%d";
String endString = mResources.getQuantityString(R.plurals.recurrence_end_count,
mModel.endCount);
int markerStart = endString.indexOf(END_COUNT_MARKER);
if (markerStart != -1) {
if (mar... | [
"private",
"void",
"updateEndCountText",
"(",
")",
"{",
"final",
"String",
"END_COUNT_MARKER",
"=",
"\"%d\"",
";",
"String",
"endString",
"=",
"mResources",
".",
"getQuantityString",
"(",
"R",
".",
"plurals",
".",
"recurrence_end_count",
",",
"mModel",
".",
"end... | Update the "Repeat for N events" end option with the proper string values
based on the value that has been entered for N. | [
"Update",
"the",
"Repeat",
"for",
"N",
"events",
"end",
"option",
"with",
"the",
"proper",
"string",
"values",
"based",
"on",
"the",
"value",
"that",
"has",
"been",
"entered",
"for",
"N",
"."
] | 4f0ae74482e4d46d57a8fb13b4b7980a8613f4af | https://github.com/Shusshu/Android-RecurrencePicker/blob/4f0ae74482e4d46d57a8fb13b4b7980a8613f4af/library/src/main/java/be/billington/calendar/recurrencepicker/RecurrencePickerDialog.java#L1047-L1062 | train |
Shusshu/Android-RecurrencePicker | library/src/main/java/be/billington/calendar/recurrencepicker/RecurrencePickerDialog.java | RecurrencePickerDialog.onCheckedChanged | @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
int itemIdx = -1;
for (int i = 0; i < 7; i++) {
if (itemIdx == -1 && buttonView == mWeekByDayButtons[i]) {
itemIdx = i;
mModel.weeklyByDayOfWeek[i] = isChecked;
... | java | @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
int itemIdx = -1;
for (int i = 0; i < 7; i++) {
if (itemIdx == -1 && buttonView == mWeekByDayButtons[i]) {
itemIdx = i;
mModel.weeklyByDayOfWeek[i] = isChecked;
... | [
"@",
"Override",
"public",
"void",
"onCheckedChanged",
"(",
"CompoundButton",
"buttonView",
",",
"boolean",
"isChecked",
")",
"{",
"int",
"itemIdx",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"7",
";",
"i",
"++",
")",
"{",
... | Week repeat by day of week | [
"Week",
"repeat",
"by",
"day",
"of",
"week"
] | 4f0ae74482e4d46d57a8fb13b4b7980a8613f4af | https://github.com/Shusshu/Android-RecurrencePicker/blob/4f0ae74482e4d46d57a8fb13b4b7980a8613f4af/library/src/main/java/be/billington/calendar/recurrencepicker/RecurrencePickerDialog.java#L1122-L1132 | train |
Shusshu/Android-RecurrencePicker | library/src/main/java/be/billington/calendar/recurrencepicker/RecurrencePickerDialog.java | RecurrencePickerDialog.onCheckedChanged | @Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
if (checkedId == R.id.repeatMonthlyByNthDayOfMonth) {
mModel.monthlyRepeat = RecurrenceModel.MONTHLY_BY_DATE;
} else if (checkedId == R.id.repeatMonthlyByNthDayOfTheWeek) {
mModel.monthlyRepeat = Recurr... | java | @Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
if (checkedId == R.id.repeatMonthlyByNthDayOfMonth) {
mModel.monthlyRepeat = RecurrenceModel.MONTHLY_BY_DATE;
} else if (checkedId == R.id.repeatMonthlyByNthDayOfTheWeek) {
mModel.monthlyRepeat = Recurr... | [
"@",
"Override",
"public",
"void",
"onCheckedChanged",
"(",
"RadioGroup",
"group",
",",
"int",
"checkedId",
")",
"{",
"if",
"(",
"checkedId",
"==",
"R",
".",
"id",
".",
"repeatMonthlyByNthDayOfMonth",
")",
"{",
"mModel",
".",
"monthlyRepeat",
"=",
"RecurrenceM... | Month repeat by radio buttons | [
"Month",
"repeat",
"by",
"radio",
"buttons"
] | 4f0ae74482e4d46d57a8fb13b4b7980a8613f4af | https://github.com/Shusshu/Android-RecurrencePicker/blob/4f0ae74482e4d46d57a8fb13b4b7980a8613f4af/library/src/main/java/be/billington/calendar/recurrencepicker/RecurrencePickerDialog.java#L1136-L1144 | train |
Shusshu/Android-RecurrencePicker | library/src/main/java/be/billington/calendar/recurrencepicker/EventRecurrence.java | EventRecurrence.calendarDay2Day | public static int calendarDay2Day(int day) {
switch (day) {
case Calendar.SUNDAY:
return SU;
case Calendar.MONDAY:
return MO;
case Calendar.TUESDAY:
return TU;
case Calendar.WEDNESDAY:
return WE;
... | java | public static int calendarDay2Day(int day) {
switch (day) {
case Calendar.SUNDAY:
return SU;
case Calendar.MONDAY:
return MO;
case Calendar.TUESDAY:
return TU;
case Calendar.WEDNESDAY:
return WE;
... | [
"public",
"static",
"int",
"calendarDay2Day",
"(",
"int",
"day",
")",
"{",
"switch",
"(",
"day",
")",
"{",
"case",
"Calendar",
".",
"SUNDAY",
":",
"return",
"SU",
";",
"case",
"Calendar",
".",
"MONDAY",
":",
"return",
"MO",
";",
"case",
"Calendar",
"."... | Converts one of the Calendar.SUNDAY constants to the SU, MO, etc.
constants. btw, I think we should switch to those here too, to
get rid of this function, if possible. | [
"Converts",
"one",
"of",
"the",
"Calendar",
".",
"SUNDAY",
"constants",
"to",
"the",
"SU",
"MO",
"etc",
".",
"constants",
".",
"btw",
"I",
"think",
"we",
"should",
"switch",
"to",
"those",
"here",
"too",
"to",
"get",
"rid",
"of",
"this",
"function",
"i... | 4f0ae74482e4d46d57a8fb13b4b7980a8613f4af | https://github.com/Shusshu/Android-RecurrencePicker/blob/4f0ae74482e4d46d57a8fb13b4b7980a8613f4af/library/src/main/java/be/billington/calendar/recurrencepicker/EventRecurrence.java#L183-L202 | train |
Shusshu/Android-RecurrencePicker | library/src/main/java/be/billington/calendar/recurrencepicker/EventRecurrence.java | EventRecurrence.parse | public void parse(String recur) {
/*
* From RFC 2445 section 4.3.10:
*
* recur = "FREQ"=freq *(
* ; either UNTIL or COUNT may appear in a 'recur',
* ; but UNTIL and COUNT MUST NOT occur in the same 'recur'
*
* ( ";" "UNTIL" "=" end... | java | public void parse(String recur) {
/*
* From RFC 2445 section 4.3.10:
*
* recur = "FREQ"=freq *(
* ; either UNTIL or COUNT may appear in a 'recur',
* ; but UNTIL and COUNT MUST NOT occur in the same 'recur'
*
* ( ";" "UNTIL" "=" end... | [
"public",
"void",
"parse",
"(",
"String",
"recur",
")",
"{",
"/*\n * From RFC 2445 section 4.3.10:\n *\n * recur = \"FREQ\"=freq *(\n * ; either UNTIL or COUNT may appear in a 'recur',\n * ; but UNTIL and COUNT MUST NOT occur in the same 'recur'\n ... | Parses an rfc2445 recurrence rule string into its component pieces. Attempting to parse
malformed input will result in an EventRecurrence.InvalidFormatException.
@param recur The recurrence rule to parse (in un-folded form). | [
"Parses",
"an",
"rfc2445",
"recurrence",
"rule",
"string",
"into",
"its",
"component",
"pieces",
".",
"Attempting",
"to",
"parse",
"malformed",
"input",
"will",
"result",
"in",
"an",
"EventRecurrence",
".",
"InvalidFormatException",
"."
] | 4f0ae74482e4d46d57a8fb13b4b7980a8613f4af | https://github.com/Shusshu/Android-RecurrencePicker/blob/4f0ae74482e4d46d57a8fb13b4b7980a8613f4af/library/src/main/java/be/billington/calendar/recurrencepicker/EventRecurrence.java#L530-L659 | train |
Shusshu/Android-RecurrencePicker | library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java | Utils.compareCursors | public static boolean compareCursors(Cursor c1, Cursor c2) {
if (c1 == null || c2 == null) {
return false;
}
int numColumns = c1.getColumnCount();
if (numColumns != c2.getColumnCount()) {
return false;
}
if (c1.getCount() != c2.getCount()) {
... | java | public static boolean compareCursors(Cursor c1, Cursor c2) {
if (c1 == null || c2 == null) {
return false;
}
int numColumns = c1.getColumnCount();
if (numColumns != c2.getColumnCount()) {
return false;
}
if (c1.getCount() != c2.getCount()) {
... | [
"public",
"static",
"boolean",
"compareCursors",
"(",
"Cursor",
"c1",
",",
"Cursor",
"c2",
")",
"{",
"if",
"(",
"c1",
"==",
"null",
"||",
"c2",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"int",
"numColumns",
"=",
"c1",
".",
"getColumnCount",
... | Compares two cursors to see if they contain the same data.
@return Returns true of the cursors contain the same data and are not
null, false otherwise | [
"Compares",
"two",
"cursors",
"to",
"see",
"if",
"they",
"contain",
"the",
"same",
"data",
"."
] | 4f0ae74482e4d46d57a8fb13b4b7980a8613f4af | https://github.com/Shusshu/Android-RecurrencePicker/blob/4f0ae74482e4d46d57a8fb13b4b7980a8613f4af/library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java#L262-L287 | train |
Shusshu/Android-RecurrencePicker | library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java | Utils.getFirstDayOfWeek | public static int getFirstDayOfWeek(Context context) {
int startDay = Calendar.getInstance().getFirstDayOfWeek();
if (startDay == Calendar.SATURDAY) {
return Time.SATURDAY;
} else if (startDay == Calendar.MONDAY) {
return Time.MONDAY;
} else {
return ... | java | public static int getFirstDayOfWeek(Context context) {
int startDay = Calendar.getInstance().getFirstDayOfWeek();
if (startDay == Calendar.SATURDAY) {
return Time.SATURDAY;
} else if (startDay == Calendar.MONDAY) {
return Time.MONDAY;
} else {
return ... | [
"public",
"static",
"int",
"getFirstDayOfWeek",
"(",
"Context",
"context",
")",
"{",
"int",
"startDay",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
".",
"getFirstDayOfWeek",
"(",
")",
";",
"if",
"(",
"startDay",
"==",
"Calendar",
".",
"SATURDAY",
")",
"... | Get first day of week as android.text.format.Time constant.
@return the first day of week in android.text.format.Time | [
"Get",
"first",
"day",
"of",
"week",
"as",
"android",
".",
"text",
".",
"format",
".",
"Time",
"constant",
"."
] | 4f0ae74482e4d46d57a8fb13b4b7980a8613f4af | https://github.com/Shusshu/Android-RecurrencePicker/blob/4f0ae74482e4d46d57a8fb13b4b7980a8613f4af/library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java#L380-L390 | train |
Shusshu/Android-RecurrencePicker | library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java | Utils.convertDayOfWeekFromTimeToCalendar | public static int convertDayOfWeekFromTimeToCalendar(int timeDayOfWeek) {
switch (timeDayOfWeek) {
case Time.MONDAY:
return Calendar.MONDAY;
case Time.TUESDAY:
return Calendar.TUESDAY;
case Time.WEDNESDAY:
return Calendar.WEDNES... | java | public static int convertDayOfWeekFromTimeToCalendar(int timeDayOfWeek) {
switch (timeDayOfWeek) {
case Time.MONDAY:
return Calendar.MONDAY;
case Time.TUESDAY:
return Calendar.TUESDAY;
case Time.WEDNESDAY:
return Calendar.WEDNES... | [
"public",
"static",
"int",
"convertDayOfWeekFromTimeToCalendar",
"(",
"int",
"timeDayOfWeek",
")",
"{",
"switch",
"(",
"timeDayOfWeek",
")",
"{",
"case",
"Time",
".",
"MONDAY",
":",
"return",
"Calendar",
".",
"MONDAY",
";",
"case",
"Time",
".",
"TUESDAY",
":",... | Converts the day of the week from android.text.format.Time to java.util.Calendar | [
"Converts",
"the",
"day",
"of",
"the",
"week",
"from",
"android",
".",
"text",
".",
"format",
".",
"Time",
"to",
"java",
".",
"util",
".",
"Calendar"
] | 4f0ae74482e4d46d57a8fb13b4b7980a8613f4af | https://github.com/Shusshu/Android-RecurrencePicker/blob/4f0ae74482e4d46d57a8fb13b4b7980a8613f4af/library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java#L404-L424 | train |
Shusshu/Android-RecurrencePicker | library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java | Utils.isSaturday | public static boolean isSaturday(int column, int firstDayOfWeek) {
return (firstDayOfWeek == Time.SUNDAY && column == 6)
|| (firstDayOfWeek == Time.MONDAY && column == 5)
|| (firstDayOfWeek == Time.SATURDAY && column == 0);
} | java | public static boolean isSaturday(int column, int firstDayOfWeek) {
return (firstDayOfWeek == Time.SUNDAY && column == 6)
|| (firstDayOfWeek == Time.MONDAY && column == 5)
|| (firstDayOfWeek == Time.SATURDAY && column == 0);
} | [
"public",
"static",
"boolean",
"isSaturday",
"(",
"int",
"column",
",",
"int",
"firstDayOfWeek",
")",
"{",
"return",
"(",
"firstDayOfWeek",
"==",
"Time",
".",
"SUNDAY",
"&&",
"column",
"==",
"6",
")",
"||",
"(",
"firstDayOfWeek",
"==",
"Time",
".",
"MONDAY... | Determine whether the column position is Saturday or not.
@param column the column position
@param firstDayOfWeek the first day of week in android.text.format.Time
@return true if the column is Saturday position | [
"Determine",
"whether",
"the",
"column",
"position",
"is",
"Saturday",
"or",
"not",
"."
] | 4f0ae74482e4d46d57a8fb13b4b7980a8613f4af | https://github.com/Shusshu/Android-RecurrencePicker/blob/4f0ae74482e4d46d57a8fb13b4b7980a8613f4af/library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java#L434-L438 | train |
Shusshu/Android-RecurrencePicker | library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java | Utils.isSunday | public static boolean isSunday(int column, int firstDayOfWeek) {
return (firstDayOfWeek == Time.SUNDAY && column == 0)
|| (firstDayOfWeek == Time.MONDAY && column == 6)
|| (firstDayOfWeek == Time.SATURDAY && column == 1);
} | java | public static boolean isSunday(int column, int firstDayOfWeek) {
return (firstDayOfWeek == Time.SUNDAY && column == 0)
|| (firstDayOfWeek == Time.MONDAY && column == 6)
|| (firstDayOfWeek == Time.SATURDAY && column == 1);
} | [
"public",
"static",
"boolean",
"isSunday",
"(",
"int",
"column",
",",
"int",
"firstDayOfWeek",
")",
"{",
"return",
"(",
"firstDayOfWeek",
"==",
"Time",
".",
"SUNDAY",
"&&",
"column",
"==",
"0",
")",
"||",
"(",
"firstDayOfWeek",
"==",
"Time",
".",
"MONDAY",... | Determine whether the column position is Sunday or not.
@param column the column position
@param firstDayOfWeek the first day of week in android.text.format.Time
@return true if the column is Sunday position | [
"Determine",
"whether",
"the",
"column",
"position",
"is",
"Sunday",
"or",
"not",
"."
] | 4f0ae74482e4d46d57a8fb13b4b7980a8613f4af | https://github.com/Shusshu/Android-RecurrencePicker/blob/4f0ae74482e4d46d57a8fb13b4b7980a8613f4af/library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java#L447-L451 | train |
Shusshu/Android-RecurrencePicker | library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java | Utils.convertAlldayUtcToLocal | public static long convertAlldayUtcToLocal(Time recycle, long utcTime, String tz) {
if (recycle == null) {
recycle = new Time();
}
recycle.timezone = Time.TIMEZONE_UTC;
recycle.set(utcTime);
recycle.timezone = tz;
return recycle.normalize(true);
} | java | public static long convertAlldayUtcToLocal(Time recycle, long utcTime, String tz) {
if (recycle == null) {
recycle = new Time();
}
recycle.timezone = Time.TIMEZONE_UTC;
recycle.set(utcTime);
recycle.timezone = tz;
return recycle.normalize(true);
} | [
"public",
"static",
"long",
"convertAlldayUtcToLocal",
"(",
"Time",
"recycle",
",",
"long",
"utcTime",
",",
"String",
"tz",
")",
"{",
"if",
"(",
"recycle",
"==",
"null",
")",
"{",
"recycle",
"=",
"new",
"Time",
"(",
")",
";",
"}",
"recycle",
".",
"time... | Convert given UTC time into current local time. This assumes it is for an
allday event and will adjust the time to be on a midnight boundary.
@param recycle Time object to recycle, otherwise null.
@param utcTime Time to convert, in UTC.
@param tz The time zone to convert this time to. | [
"Convert",
"given",
"UTC",
"time",
"into",
"current",
"local",
"time",
".",
"This",
"assumes",
"it",
"is",
"for",
"an",
"allday",
"event",
"and",
"will",
"adjust",
"the",
"time",
"to",
"be",
"on",
"a",
"midnight",
"boundary",
"."
] | 4f0ae74482e4d46d57a8fb13b4b7980a8613f4af | https://github.com/Shusshu/Android-RecurrencePicker/blob/4f0ae74482e4d46d57a8fb13b4b7980a8613f4af/library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java#L461-L469 | train |
Shusshu/Android-RecurrencePicker | library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java | Utils.getNextMidnight | public static long getNextMidnight(Time recycle, long theTime, String tz) {
if (recycle == null) {
recycle = new Time();
}
recycle.timezone = tz;
recycle.set(theTime);
recycle.monthDay++;
recycle.hour = 0;
recycle.minute = 0;
recycle.second = 0... | java | public static long getNextMidnight(Time recycle, long theTime, String tz) {
if (recycle == null) {
recycle = new Time();
}
recycle.timezone = tz;
recycle.set(theTime);
recycle.monthDay++;
recycle.hour = 0;
recycle.minute = 0;
recycle.second = 0... | [
"public",
"static",
"long",
"getNextMidnight",
"(",
"Time",
"recycle",
",",
"long",
"theTime",
",",
"String",
"tz",
")",
"{",
"if",
"(",
"recycle",
"==",
"null",
")",
"{",
"recycle",
"=",
"new",
"Time",
"(",
")",
";",
"}",
"recycle",
".",
"timezone",
... | Finds and returns the next midnight after "theTime" in milliseconds UTC
@param recycle - Time object to recycle, otherwise null.
@param theTime - Time used for calculations (in UTC)
@param tz The time zone to convert this time to. | [
"Finds",
"and",
"returns",
"the",
"next",
"midnight",
"after",
"theTime",
"in",
"milliseconds",
"UTC"
] | 4f0ae74482e4d46d57a8fb13b4b7980a8613f4af | https://github.com/Shusshu/Android-RecurrencePicker/blob/4f0ae74482e4d46d57a8fb13b4b7980a8613f4af/library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java#L488-L499 | train |
Shusshu/Android-RecurrencePicker | library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java | Utils.checkForDuplicateNames | public static void checkForDuplicateNames(
Map<String, Boolean> isDuplicateName, Cursor cursor, int nameIndex) {
isDuplicateName.clear();
cursor.moveToPosition(-1);
while (cursor.moveToNext()) {
String displayName = cursor.getString(nameIndex);
// Set it to tr... | java | public static void checkForDuplicateNames(
Map<String, Boolean> isDuplicateName, Cursor cursor, int nameIndex) {
isDuplicateName.clear();
cursor.moveToPosition(-1);
while (cursor.moveToNext()) {
String displayName = cursor.getString(nameIndex);
// Set it to tr... | [
"public",
"static",
"void",
"checkForDuplicateNames",
"(",
"Map",
"<",
"String",
",",
"Boolean",
">",
"isDuplicateName",
",",
"Cursor",
"cursor",
",",
"int",
"nameIndex",
")",
"{",
"isDuplicateName",
".",
"clear",
"(",
")",
";",
"cursor",
".",
"moveToPosition"... | Scan through a cursor of calendars and check if names are duplicated.
This travels a cursor containing calendar display names and fills in the
provided map with whether or not each name is repeated.
@param isDuplicateName The map to put the duplicate check results in.
@param cursor The query of calendars to c... | [
"Scan",
"through",
"a",
"cursor",
"of",
"calendars",
"and",
"check",
"if",
"names",
"are",
"duplicated",
".",
"This",
"travels",
"a",
"cursor",
"containing",
"calendar",
"display",
"names",
"and",
"fills",
"in",
"the",
"provided",
"map",
"with",
"whether",
"... | 4f0ae74482e4d46d57a8fb13b4b7980a8613f4af | https://github.com/Shusshu/Android-RecurrencePicker/blob/4f0ae74482e4d46d57a8fb13b4b7980a8613f4af/library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java#L510-L521 | train |
Shusshu/Android-RecurrencePicker | library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java | Utils.getDisplayColorFromColor | public static int getDisplayColorFromColor(int color) {
if (!isJellybeanOrLater()) {
return color;
}
float[] hsv = new float[3];
Color.colorToHSV(color, hsv);
hsv[1] = Math.min(hsv[1] * SATURATION_ADJUST, 1.0f);
hsv[2] = hsv[2] * INTENSITY_ADJUST;
ret... | java | public static int getDisplayColorFromColor(int color) {
if (!isJellybeanOrLater()) {
return color;
}
float[] hsv = new float[3];
Color.colorToHSV(color, hsv);
hsv[1] = Math.min(hsv[1] * SATURATION_ADJUST, 1.0f);
hsv[2] = hsv[2] * INTENSITY_ADJUST;
ret... | [
"public",
"static",
"int",
"getDisplayColorFromColor",
"(",
"int",
"color",
")",
"{",
"if",
"(",
"!",
"isJellybeanOrLater",
"(",
")",
")",
"{",
"return",
"color",
";",
"}",
"float",
"[",
"]",
"hsv",
"=",
"new",
"float",
"[",
"3",
"]",
";",
"Color",
"... | For devices with Jellybean or later, darkens the given color to ensure that white text is
clearly visible on top of it. For devices prior to Jellybean, does nothing, as the
sync adapter handles the color change.
@param color | [
"For",
"devices",
"with",
"Jellybean",
"or",
"later",
"darkens",
"the",
"given",
"color",
"to",
"ensure",
"that",
"white",
"text",
"is",
"clearly",
"visible",
"on",
"top",
"of",
"it",
".",
"For",
"devices",
"prior",
"to",
"Jellybean",
"does",
"nothing",
"a... | 4f0ae74482e4d46d57a8fb13b4b7980a8613f4af | https://github.com/Shusshu/Android-RecurrencePicker/blob/4f0ae74482e4d46d57a8fb13b4b7980a8613f4af/library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java#L553-L563 | train |
Shusshu/Android-RecurrencePicker | library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java | Utils.getDeclinedColorFromColor | public static int getDeclinedColorFromColor(int color) {
int bg = 0xffffffff;
int a = DECLINED_EVENT_ALPHA;
int r = (((color & 0x00ff0000) * a) + ((bg & 0x00ff0000) * (0xff - a))) & 0xff000000;
int g = (((color & 0x0000ff00) * a) + ((bg & 0x0000ff00) * (0xff - a))) & 0x00ff0000;
... | java | public static int getDeclinedColorFromColor(int color) {
int bg = 0xffffffff;
int a = DECLINED_EVENT_ALPHA;
int r = (((color & 0x00ff0000) * a) + ((bg & 0x00ff0000) * (0xff - a))) & 0xff000000;
int g = (((color & 0x0000ff00) * a) + ((bg & 0x0000ff00) * (0xff - a))) & 0x00ff0000;
... | [
"public",
"static",
"int",
"getDeclinedColorFromColor",
"(",
"int",
"color",
")",
"{",
"int",
"bg",
"=",
"0xffffffff",
";",
"int",
"a",
"=",
"DECLINED_EVENT_ALPHA",
";",
"int",
"r",
"=",
"(",
"(",
"(",
"color",
"&",
"0x00ff0000",
")",
"*",
"a",
")",
"+... | white. The result is the color that should be used for declined events. | [
"white",
".",
"The",
"result",
"is",
"the",
"color",
"that",
"should",
"be",
"used",
"for",
"declined",
"events",
"."
] | 4f0ae74482e4d46d57a8fb13b4b7980a8613f4af | https://github.com/Shusshu/Android-RecurrencePicker/blob/4f0ae74482e4d46d57a8fb13b4b7980a8613f4af/library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java#L567-L574 | train |
Shusshu/Android-RecurrencePicker | library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java | Utils.weaveDNAStrands | private static void weaveDNAStrands(LinkedList<DNASegment> segments, int firstJulianDay,
HashMap<Integer, DNAStrand> strands, int top, int bottom, int[] dayXs) {
// First, get rid of any colors that ended up with no segments
Iterator<DNAStrand> strandIterator = st... | java | private static void weaveDNAStrands(LinkedList<DNASegment> segments, int firstJulianDay,
HashMap<Integer, DNAStrand> strands, int top, int bottom, int[] dayXs) {
// First, get rid of any colors that ended up with no segments
Iterator<DNAStrand> strandIterator = st... | [
"private",
"static",
"void",
"weaveDNAStrands",
"(",
"LinkedList",
"<",
"DNASegment",
">",
"segments",
",",
"int",
"firstJulianDay",
",",
"HashMap",
"<",
"Integer",
",",
"DNAStrand",
">",
"strands",
",",
"int",
"top",
",",
"int",
"bottom",
",",
"int",
"[",
... | list of points to draw | [
"list",
"of",
"points",
"to",
"draw"
] | 4f0ae74482e4d46d57a8fb13b4b7980a8613f4af | https://github.com/Shusshu/Android-RecurrencePicker/blob/4f0ae74482e4d46d57a8fb13b4b7980a8613f4af/library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java#L600-L639 | train |
Shusshu/Android-RecurrencePicker | library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java | Utils.getPixelOffsetFromMinutes | private static int getPixelOffsetFromMinutes(int minute, int workDayHeight,
int remainderHeight) {
int y;
if (minute < WORK_DAY_START_MINUTES) {
y = minute * remainderHeight / WORK_DAY_START_MINUTES;
} else if (minute < WORK_DAY_END_MI... | java | private static int getPixelOffsetFromMinutes(int minute, int workDayHeight,
int remainderHeight) {
int y;
if (minute < WORK_DAY_START_MINUTES) {
y = minute * remainderHeight / WORK_DAY_START_MINUTES;
} else if (minute < WORK_DAY_END_MI... | [
"private",
"static",
"int",
"getPixelOffsetFromMinutes",
"(",
"int",
"minute",
",",
"int",
"workDayHeight",
",",
"int",
"remainderHeight",
")",
"{",
"int",
"y",
";",
"if",
"(",
"minute",
"<",
"WORK_DAY_START_MINUTES",
")",
"{",
"y",
"=",
"minute",
"*",
"rema... | Compute a pixel offset from the top for a given minute from the work day
height and the height of the top area. | [
"Compute",
"a",
"pixel",
"offset",
"from",
"the",
"top",
"for",
"a",
"given",
"minute",
"from",
"the",
"work",
"day",
"height",
"and",
"the",
"height",
"of",
"the",
"top",
"area",
"."
] | 4f0ae74482e4d46d57a8fb13b4b7980a8613f4af | https://github.com/Shusshu/Android-RecurrencePicker/blob/4f0ae74482e4d46d57a8fb13b4b7980a8613f4af/library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java#L645-L658 | train |
Shusshu/Android-RecurrencePicker | library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java | Utils.getOrCreateStrand | private static DNAStrand getOrCreateStrand(HashMap<Integer, DNAStrand> strands, int color) {
DNAStrand strand = strands.get(color);
if (strand == null) {
strand = new DNAStrand();
strand.color = color;
strand.count = 0;
strands.put(strand.color, strand);
... | java | private static DNAStrand getOrCreateStrand(HashMap<Integer, DNAStrand> strands, int color) {
DNAStrand strand = strands.get(color);
if (strand == null) {
strand = new DNAStrand();
strand.color = color;
strand.count = 0;
strands.put(strand.color, strand);
... | [
"private",
"static",
"DNAStrand",
"getOrCreateStrand",
"(",
"HashMap",
"<",
"Integer",
",",
"DNAStrand",
">",
"strands",
",",
"int",
"color",
")",
"{",
"DNAStrand",
"strand",
"=",
"strands",
".",
"get",
"(",
"color",
")",
";",
"if",
"(",
"strand",
"==",
... | Try to get a strand of the given color. Create it if it doesn't exist. | [
"Try",
"to",
"get",
"a",
"strand",
"of",
"the",
"given",
"color",
".",
"Create",
"it",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | 4f0ae74482e4d46d57a8fb13b4b7980a8613f4af | https://github.com/Shusshu/Android-RecurrencePicker/blob/4f0ae74482e4d46d57a8fb13b4b7980a8613f4af/library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java#L663-L672 | train |
Shusshu/Android-RecurrencePicker | library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java | Utils.setUpSearchView | public static void setUpSearchView(SearchView view, Activity act) {
SearchManager searchManager = (SearchManager) act.getSystemService(Context.SEARCH_SERVICE);
view.setSearchableInfo(searchManager.getSearchableInfo(act.getComponentName()));
view.setQueryRefinementEnabled(true);
} | java | public static void setUpSearchView(SearchView view, Activity act) {
SearchManager searchManager = (SearchManager) act.getSystemService(Context.SEARCH_SERVICE);
view.setSearchableInfo(searchManager.getSearchableInfo(act.getComponentName()));
view.setQueryRefinementEnabled(true);
} | [
"public",
"static",
"void",
"setUpSearchView",
"(",
"SearchView",
"view",
",",
"Activity",
"act",
")",
"{",
"SearchManager",
"searchManager",
"=",
"(",
"SearchManager",
")",
"act",
".",
"getSystemService",
"(",
"Context",
".",
"SEARCH_SERVICE",
")",
";",
"view",... | This sets up a search view to use Calendar's search suggestions provider
and to allow refining the search.
@param view The {@link android.widget.SearchView} to set up
@param act The activity using the view | [
"This",
"sets",
"up",
"a",
"search",
"view",
"to",
"use",
"Calendar",
"s",
"search",
"suggestions",
"provider",
"and",
"to",
"allow",
"refining",
"the",
"search",
"."
] | 4f0ae74482e4d46d57a8fb13b4b7980a8613f4af | https://github.com/Shusshu/Android-RecurrencePicker/blob/4f0ae74482e4d46d57a8fb13b4b7980a8613f4af/library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java#L682-L686 | train |
Shusshu/Android-RecurrencePicker | library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java | Utils.setMidnightUpdater | public static void setMidnightUpdater(Handler h, Runnable r, String timezone) {
if (h == null || r == null || timezone == null) {
return;
}
long now = System.currentTimeMillis();
Time time = new Time(timezone);
time.set(now);
long runInMillis = (24 * 3600 - ti... | java | public static void setMidnightUpdater(Handler h, Runnable r, String timezone) {
if (h == null || r == null || timezone == null) {
return;
}
long now = System.currentTimeMillis();
Time time = new Time(timezone);
time.set(now);
long runInMillis = (24 * 3600 - ti... | [
"public",
"static",
"void",
"setMidnightUpdater",
"(",
"Handler",
"h",
",",
"Runnable",
"r",
",",
"String",
"timezone",
")",
"{",
"if",
"(",
"h",
"==",
"null",
"||",
"r",
"==",
"null",
"||",
"timezone",
"==",
"null",
")",
"{",
"return",
";",
"}",
"lo... | do run the runnable | [
"do",
"run",
"the",
"runnable"
] | 4f0ae74482e4d46d57a8fb13b4b7980a8613f4af | https://github.com/Shusshu/Android-RecurrencePicker/blob/4f0ae74482e4d46d57a8fb13b4b7980a8613f4af/library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java#L690-L701 | train |
Shusshu/Android-RecurrencePicker | library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java | Utils.resetMidnightUpdater | public static void resetMidnightUpdater(Handler h, Runnable r) {
if (h == null || r == null) {
return;
}
h.removeCallbacks(r);
} | java | public static void resetMidnightUpdater(Handler h, Runnable r) {
if (h == null || r == null) {
return;
}
h.removeCallbacks(r);
} | [
"public",
"static",
"void",
"resetMidnightUpdater",
"(",
"Handler",
"h",
",",
"Runnable",
"r",
")",
"{",
"if",
"(",
"h",
"==",
"null",
"||",
"r",
"==",
"null",
")",
"{",
"return",
";",
"}",
"h",
".",
"removeCallbacks",
"(",
"r",
")",
";",
"}"
] | Stop the midnight update thread | [
"Stop",
"the",
"midnight",
"update",
"thread"
] | 4f0ae74482e4d46d57a8fb13b4b7980a8613f4af | https://github.com/Shusshu/Android-RecurrencePicker/blob/4f0ae74482e4d46d57a8fb13b4b7980a8613f4af/library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java#L704-L709 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.