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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
wuman/JReadability | src/main/java/com/wuman/jreadability/Readability.java | Readability.cleanHeaders | private static void cleanHeaders(Element e) {
for (int headerIndex = 1; headerIndex < 7; headerIndex++) {
Elements headers = getElementsByTag(e, "h" + headerIndex);
for (Element header : headers) {
if (getClassWeight(header) < 0
|| getLinkDensity(h... | java | private static void cleanHeaders(Element e) {
for (int headerIndex = 1; headerIndex < 7; headerIndex++) {
Elements headers = getElementsByTag(e, "h" + headerIndex);
for (Element header : headers) {
if (getClassWeight(header) < 0
|| getLinkDensity(h... | [
"private",
"static",
"void",
"cleanHeaders",
"(",
"Element",
"e",
")",
"{",
"for",
"(",
"int",
"headerIndex",
"=",
"1",
";",
"headerIndex",
"<",
"7",
";",
"headerIndex",
"++",
")",
"{",
"Elements",
"headers",
"=",
"getElementsByTag",
"(",
"e",
",",
"\"h\... | Clean out spurious headers from an Element. Checks things like classnames
and link density.
@param e | [
"Clean",
"out",
"spurious",
"headers",
"from",
"an",
"Element",
".",
"Checks",
"things",
"like",
"classnames",
"and",
"link",
"density",
"."
] | 16c18c42402bd13c6e024c2fd3a86dd28ba53e74 | https://github.com/wuman/JReadability/blob/16c18c42402bd13c6e024c2fd3a86dd28ba53e74/src/main/java/com/wuman/jreadability/Readability.java#L720-L730 | train |
wuman/JReadability | src/main/java/com/wuman/jreadability/Readability.java | Readability.dbg | protected void dbg(String msg, Throwable t) {
System.out.println(msg + (t != null ? ("\n" + t.getMessage()) : "")
+ (t != null ? ("\n" + t.getStackTrace()) : ""));
} | java | protected void dbg(String msg, Throwable t) {
System.out.println(msg + (t != null ? ("\n" + t.getMessage()) : "")
+ (t != null ? ("\n" + t.getStackTrace()) : ""));
} | [
"protected",
"void",
"dbg",
"(",
"String",
"msg",
",",
"Throwable",
"t",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"msg",
"+",
"(",
"t",
"!=",
"null",
"?",
"(",
"\"\\n\"",
"+",
"t",
".",
"getMessage",
"(",
")",
")",
":",
"\"\"",
")",
... | Print debug logs with stack trace
@param msg
@param t | [
"Print",
"debug",
"logs",
"with",
"stack",
"trace"
] | 16c18c42402bd13c6e024c2fd3a86dd28ba53e74 | https://github.com/wuman/JReadability/blob/16c18c42402bd13c6e024c2fd3a86dd28ba53e74/src/main/java/com/wuman/jreadability/Readability.java#L747-L750 | train |
wuman/JReadability | src/main/java/com/wuman/jreadability/Readability.java | Readability.getContentScore | private static int getContentScore(Element node) {
try {
return Integer.parseInt(node.attr(CONTENT_SCORE));
} catch (NumberFormatException e) {
return 0;
}
} | java | private static int getContentScore(Element node) {
try {
return Integer.parseInt(node.attr(CONTENT_SCORE));
} catch (NumberFormatException e) {
return 0;
}
} | [
"private",
"static",
"int",
"getContentScore",
"(",
"Element",
"node",
")",
"{",
"try",
"{",
"return",
"Integer",
".",
"parseInt",
"(",
"node",
".",
"attr",
"(",
"CONTENT_SCORE",
")",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"... | Reads the content score.
@param node
@return | [
"Reads",
"the",
"content",
"score",
"."
] | 16c18c42402bd13c6e024c2fd3a86dd28ba53e74 | https://github.com/wuman/JReadability/blob/16c18c42402bd13c6e024c2fd3a86dd28ba53e74/src/main/java/com/wuman/jreadability/Readability.java#L834-L840 | train |
wuman/JReadability | src/main/java/com/wuman/jreadability/Readability.java | Readability.scaleContentScore | private static Element scaleContentScore(Element node, float scale) {
int contentScore = getContentScore(node);
contentScore *= scale;
node.attr(CONTENT_SCORE, Integer.toString(contentScore));
return node;
} | java | private static Element scaleContentScore(Element node, float scale) {
int contentScore = getContentScore(node);
contentScore *= scale;
node.attr(CONTENT_SCORE, Integer.toString(contentScore));
return node;
} | [
"private",
"static",
"Element",
"scaleContentScore",
"(",
"Element",
"node",
",",
"float",
"scale",
")",
"{",
"int",
"contentScore",
"=",
"getContentScore",
"(",
"node",
")",
";",
"contentScore",
"*=",
"scale",
";",
"node",
".",
"attr",
"(",
"CONTENT_SCORE",
... | Scales the content score for an Element with a factor of scale.
@param node
@param scale
@return | [
"Scales",
"the",
"content",
"score",
"for",
"an",
"Element",
"with",
"a",
"factor",
"of",
"scale",
"."
] | 16c18c42402bd13c6e024c2fd3a86dd28ba53e74 | https://github.com/wuman/JReadability/blob/16c18c42402bd13c6e024c2fd3a86dd28ba53e74/src/main/java/com/wuman/jreadability/Readability.java#L864-L869 | train |
srikalyc/Sql4D | Sql4DClient/src/main/java/com/yahoo/sql4dclient/Main.java | Main.stty | private static String stty(final String args) throws IOException, InterruptedException {
return runCommand(new String[]{
"sh", "-c", String.format("stty %s < /dev/tty", args)
});
} | java | private static String stty(final String args) throws IOException, InterruptedException {
return runCommand(new String[]{
"sh", "-c", String.format("stty %s < /dev/tty", args)
});
} | [
"private",
"static",
"String",
"stty",
"(",
"final",
"String",
"args",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"return",
"runCommand",
"(",
"new",
"String",
"[",
"]",
"{",
"\"sh\"",
",",
"\"-c\"",
",",
"String",
".",
"format",
"(",
... | Run the stty command with arguments in the active terminal. | [
"Run",
"the",
"stty",
"command",
"with",
"arguments",
"in",
"the",
"active",
"terminal",
"."
] | 2c052fe60ead5a16277c798a3440de7d4f6f24f6 | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4DClient/src/main/java/com/yahoo/sql4dclient/Main.java#L373-L377 | train |
srikalyc/Sql4D | Sql4DClient/src/main/java/com/yahoo/sql4dclient/Main.java | Main.runCommand | private static String runCommand(final String[] cmd)
throws IOException, InterruptedException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Process process = Runtime.getRuntime().exec(cmd);
int c;
InputStream in = process.getInputStream();
while ((c = in... | java | private static String runCommand(final String[] cmd)
throws IOException, InterruptedException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Process process = Runtime.getRuntime().exec(cmd);
int c;
InputStream in = process.getInputStream();
while ((c = in... | [
"private",
"static",
"String",
"runCommand",
"(",
"final",
"String",
"[",
"]",
"cmd",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"Process",
"process",
"=",
... | Run the command synchronously and return clubbed standard error and
output stream's data. | [
"Run",
"the",
"command",
"synchronously",
"and",
"return",
"clubbed",
"standard",
"error",
"and",
"output",
"stream",
"s",
"data",
"."
] | 2c052fe60ead5a16277c798a3440de7d4f6f24f6 | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4DClient/src/main/java/com/yahoo/sql4dclient/Main.java#L383-L398 | train |
srikalyc/Sql4D | IndexerAgent/src/main/java/com/yahoo/sql4d/indexeragent/sql/SqlFileSniffer.java | SqlFileSniffer.processSql | private DataSource processSql(String insertStmntStr) {
Program pgm = DCompiler.compileSql(insertStmntStr);
if (!(pgm instanceof InsertProgram)) {
log.error("Ignoring program {} . Only inserts are supported", insertStmntStr);
return null;
}
InsertProgram insertPgm ... | java | private DataSource processSql(String insertStmntStr) {
Program pgm = DCompiler.compileSql(insertStmntStr);
if (!(pgm instanceof InsertProgram)) {
log.error("Ignoring program {} . Only inserts are supported", insertStmntStr);
return null;
}
InsertProgram insertPgm ... | [
"private",
"DataSource",
"processSql",
"(",
"String",
"insertStmntStr",
")",
"{",
"Program",
"pgm",
"=",
"DCompiler",
".",
"compileSql",
"(",
"insertStmntStr",
")",
";",
"if",
"(",
"!",
"(",
"pgm",
"instanceof",
"InsertProgram",
")",
")",
"{",
"log",
".",
... | Creates DataSource for the given Sql insert statement.
@param insertStmntStr
@return | [
"Creates",
"DataSource",
"for",
"the",
"given",
"Sql",
"insert",
"statement",
"."
] | 2c052fe60ead5a16277c798a3440de7d4f6f24f6 | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/IndexerAgent/src/main/java/com/yahoo/sql4d/indexeragent/sql/SqlFileSniffer.java#L95-L141 | train |
srikalyc/Sql4D | Sql4DClient/src/main/java/com/yahoo/sql4dclient/CircularBuffer.java | CircularBuffer.get | public T get(int index) {
if (index < 0 || index >= size) {
return null;
}
if (!wasFullAtleastOnce && index >= emptyItemIndex) {
return null;
}
return (T)(items[index]);
} | java | public T get(int index) {
if (index < 0 || index >= size) {
return null;
}
if (!wasFullAtleastOnce && index >= emptyItemIndex) {
return null;
}
return (T)(items[index]);
} | [
"public",
"T",
"get",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"index",
"<",
"0",
"||",
"index",
">=",
"size",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"!",
"wasFullAtleastOnce",
"&&",
"index",
">=",
"emptyItemIndex",
")",
"{",
"return",
"... | To exactly get item at index.
@param index
@return | [
"To",
"exactly",
"get",
"item",
"at",
"index",
"."
] | 2c052fe60ead5a16277c798a3440de7d4f6f24f6 | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4DClient/src/main/java/com/yahoo/sql4dclient/CircularBuffer.java#L46-L54 | train |
srikalyc/Sql4D | Sql4DClient/src/main/java/com/yahoo/sql4dclient/CircularBuffer.java | CircularBuffer.getDown | public T getDown() {
if (navigator < 0) {// This is true when there are no elements.
return null;
}
if ((wasFullAtleastOnce && navigator == size - 1) ||
(!wasFullAtleastOnce && navigator == emptyItemIndex - 1)) {
try {
return (T)(items[nav... | java | public T getDown() {
if (navigator < 0) {// This is true when there are no elements.
return null;
}
if ((wasFullAtleastOnce && navigator == size - 1) ||
(!wasFullAtleastOnce && navigator == emptyItemIndex - 1)) {
try {
return (T)(items[nav... | [
"public",
"T",
"getDown",
"(",
")",
"{",
"if",
"(",
"navigator",
"<",
"0",
")",
"{",
"// This is true when there are no elements.",
"return",
"null",
";",
"}",
"if",
"(",
"(",
"wasFullAtleastOnce",
"&&",
"navigator",
"==",
"size",
"-",
"1",
")",
"||",
"(",... | Think of this method conceptually as navigating using down arrow in history
list of commands.
@return | [
"Think",
"of",
"this",
"method",
"conceptually",
"as",
"navigating",
"using",
"down",
"arrow",
"in",
"history",
"list",
"of",
"commands",
"."
] | 2c052fe60ead5a16277c798a3440de7d4f6f24f6 | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4DClient/src/main/java/com/yahoo/sql4dclient/CircularBuffer.java#L61-L74 | train |
srikalyc/Sql4D | Sql4DClient/src/main/java/com/yahoo/sql4dclient/CircularBuffer.java | CircularBuffer.getUp | public T getUp() {
if (navigator < 0) {
return null;
}
if (navigator == 0) {
try {
return (T)(items[navigator]);
} finally {
if (wasFullAtleastOnce) {
navigator = size - 1;
} else {
... | java | public T getUp() {
if (navigator < 0) {
return null;
}
if (navigator == 0) {
try {
return (T)(items[navigator]);
} finally {
if (wasFullAtleastOnce) {
navigator = size - 1;
} else {
... | [
"public",
"T",
"getUp",
"(",
")",
"{",
"if",
"(",
"navigator",
"<",
"0",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"navigator",
"==",
"0",
")",
"{",
"try",
"{",
"return",
"(",
"T",
")",
"(",
"items",
"[",
"navigator",
"]",
")",
";",
"}... | Think of this method conceptually as navigating using down up in history
list of commands.
@return | [
"Think",
"of",
"this",
"method",
"conceptually",
"as",
"navigating",
"using",
"down",
"up",
"in",
"history",
"list",
"of",
"commands",
"."
] | 2c052fe60ead5a16277c798a3440de7d4f6f24f6 | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4DClient/src/main/java/com/yahoo/sql4dclient/CircularBuffer.java#L81-L97 | train |
srikalyc/Sql4D | Sql4DClient/src/main/java/com/yahoo/sql4dclient/CircularBuffer.java | CircularBuffer.add | public void add(T item) {
hasElements = true;
navigator = emptyItemIndex;
items[emptyItemIndex] = item;
if (emptyItemIndex == size - 1) {
wasFullAtleastOnce = true;
}
emptyItemIndex = (emptyItemIndex + 1) % size;
} | java | public void add(T item) {
hasElements = true;
navigator = emptyItemIndex;
items[emptyItemIndex] = item;
if (emptyItemIndex == size - 1) {
wasFullAtleastOnce = true;
}
emptyItemIndex = (emptyItemIndex + 1) % size;
} | [
"public",
"void",
"add",
"(",
"T",
"item",
")",
"{",
"hasElements",
"=",
"true",
";",
"navigator",
"=",
"emptyItemIndex",
";",
"items",
"[",
"emptyItemIndex",
"]",
"=",
"item",
";",
"if",
"(",
"emptyItemIndex",
"==",
"size",
"-",
"1",
")",
"{",
"wasFul... | Navigator should point to most recent added element.
@param item | [
"Navigator",
"should",
"point",
"to",
"most",
"recent",
"added",
"element",
"."
] | 2c052fe60ead5a16277c798a3440de7d4f6f24f6 | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4DClient/src/main/java/com/yahoo/sql4dclient/CircularBuffer.java#L103-L111 | train |
srikalyc/Sql4D | Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/OverlordAccessor.java | OverlordAccessor.pollTaskStatus | public TaskStatus pollTaskStatus(String taskId, Map<String, String> reqHeaders) {
CloseableHttpResponse resp = null;
String url = format("%s/%s/status", format(overlordUrl, overlordHost, overlordPort), taskId);
try {
resp = get(url, reqHeaders);
//TODO: Check for nulls in... | java | public TaskStatus pollTaskStatus(String taskId, Map<String, String> reqHeaders) {
CloseableHttpResponse resp = null;
String url = format("%s/%s/status", format(overlordUrl, overlordHost, overlordPort), taskId);
try {
resp = get(url, reqHeaders);
//TODO: Check for nulls in... | [
"public",
"TaskStatus",
"pollTaskStatus",
"(",
"String",
"taskId",
",",
"Map",
"<",
"String",
",",
"String",
">",
"reqHeaders",
")",
"{",
"CloseableHttpResponse",
"resp",
"=",
"null",
";",
"String",
"url",
"=",
"format",
"(",
"\"%s/%s/status\"",
",",
"format",... | Poll for task's status for tasks fired with 0 wait time.
@param taskId
@param reqHeaders
@return | [
"Poll",
"for",
"task",
"s",
"status",
"for",
"tasks",
"fired",
"with",
"0",
"wait",
"time",
"."
] | 2c052fe60ead5a16277c798a3440de7d4f6f24f6 | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/OverlordAccessor.java#L133-L157 | train |
srikalyc/Sql4D | IndexerAgent/src/main/java/com/yahoo/sql4d/indexeragent/actors/MainActor.java | MainActor.scheduleCron | private Cancellable scheduleCron(int initialDelay, int interval, MessageTypes message) {
return scheduler.schedule(secs(initialDelay), secs(interval),
getSelf(), message, getContext().dispatcher(), null);
} | java | private Cancellable scheduleCron(int initialDelay, int interval, MessageTypes message) {
return scheduler.schedule(secs(initialDelay), secs(interval),
getSelf(), message, getContext().dispatcher(), null);
} | [
"private",
"Cancellable",
"scheduleCron",
"(",
"int",
"initialDelay",
",",
"int",
"interval",
",",
"MessageTypes",
"message",
")",
"{",
"return",
"scheduler",
".",
"schedule",
"(",
"secs",
"(",
"initialDelay",
")",
",",
"secs",
"(",
"interval",
")",
",",
"ge... | Schedules messages ever interval seconds.
@param initialDelay
@param interval
@param message
@return | [
"Schedules",
"messages",
"ever",
"interval",
"seconds",
"."
] | 2c052fe60ead5a16277c798a3440de7d4f6f24f6 | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/IndexerAgent/src/main/java/com/yahoo/sql4d/indexeragent/actors/MainActor.java#L120-L123 | train |
srikalyc/Sql4D | IndexerAgent/src/main/java/com/yahoo/sql4d/indexeragent/actors/MainActor.java | MainActor.bootFromDsqls | private void bootFromDsqls(String path) {
File[] files = new File(path).listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.endsWith(".sql");
}
});
for (File file:files) {//In this cont... | java | private void bootFromDsqls(String path) {
File[] files = new File(path).listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.endsWith(".sql");
}
});
for (File file:files) {//In this cont... | [
"private",
"void",
"bootFromDsqls",
"(",
"String",
"path",
")",
"{",
"File",
"[",
"]",
"files",
"=",
"new",
"File",
"(",
"path",
")",
".",
"listFiles",
"(",
"new",
"FilenameFilter",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"accept",
"(",
"F... | Read off a bunch of sql files expecting insert statements within them. | [
"Read",
"off",
"a",
"bunch",
"of",
"sql",
"files",
"expecting",
"insert",
"statements",
"within",
"them",
"."
] | 2c052fe60ead5a16277c798a3440de7d4f6f24f6 | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/IndexerAgent/src/main/java/com/yahoo/sql4d/indexeragent/actors/MainActor.java#L142-L153 | train |
srikalyc/Sql4D | Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/DruidNodeAccessor.java | DruidNodeAccessor.proxyInit | private static synchronized void proxyInit() {
if (PROXY_HOST != null && customRouterPlanner == null) {
HttpHost proxy = new HttpHost(PROXY_HOST, PROXY_PORT);
customRouterPlanner = new DefaultProxyRoutePlanner(proxy);
}
} | java | private static synchronized void proxyInit() {
if (PROXY_HOST != null && customRouterPlanner == null) {
HttpHost proxy = new HttpHost(PROXY_HOST, PROXY_PORT);
customRouterPlanner = new DefaultProxyRoutePlanner(proxy);
}
} | [
"private",
"static",
"synchronized",
"void",
"proxyInit",
"(",
")",
"{",
"if",
"(",
"PROXY_HOST",
"!=",
"null",
"&&",
"customRouterPlanner",
"==",
"null",
")",
"{",
"HttpHost",
"proxy",
"=",
"new",
"HttpHost",
"(",
"PROXY_HOST",
",",
"PROXY_PORT",
")",
";",
... | To ensure customRouterPlanner is initialized only once. | [
"To",
"ensure",
"customRouterPlanner",
"is",
"initialized",
"only",
"once",
"."
] | 2c052fe60ead5a16277c798a3440de7d4f6f24f6 | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/DruidNodeAccessor.java#L89-L94 | train |
srikalyc/Sql4D | Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/DruidNodeAccessor.java | DruidNodeAccessor.returnClient | public void returnClient(CloseableHttpResponse resp) {
try {
if (resp != null) {
EntityUtils.consume(resp.getEntity());
}
} catch (IOException ex) {
//TODO: Could not consume response completely. This is serious because the client will not be returned... | java | public void returnClient(CloseableHttpResponse resp) {
try {
if (resp != null) {
EntityUtils.consume(resp.getEntity());
}
} catch (IOException ex) {
//TODO: Could not consume response completely. This is serious because the client will not be returned... | [
"public",
"void",
"returnClient",
"(",
"CloseableHttpResponse",
"resp",
")",
"{",
"try",
"{",
"if",
"(",
"resp",
"!=",
"null",
")",
"{",
"EntityUtils",
".",
"consume",
"(",
"resp",
".",
"getEntity",
"(",
")",
")",
";",
"}",
"}",
"catch",
"(",
"IOExcept... | This ensures the response body is completely consumed and hence the HttpClient
object will be return back to the pool successfully.
@param resp | [
"This",
"ensures",
"the",
"response",
"body",
"is",
"completely",
"consumed",
"and",
"hence",
"the",
"HttpClient",
"object",
"will",
"be",
"return",
"back",
"to",
"the",
"pool",
"successfully",
"."
] | 2c052fe60ead5a16277c798a3440de7d4f6f24f6 | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/DruidNodeAccessor.java#L106-L115 | train |
srikalyc/Sql4D | Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/sql/MysqlAccessor.java | MysqlAccessor.execute | public boolean execute(Map<String, String> params, String query) {
final AtomicBoolean result = new AtomicBoolean(false);
Tuple2<DataSource, Connection> conn = null;
try {
conn = getConnection();
NamedParameterJdbcTemplate jdbcTemplate = new NamedParameterJdbcTemplate(con... | java | public boolean execute(Map<String, String> params, String query) {
final AtomicBoolean result = new AtomicBoolean(false);
Tuple2<DataSource, Connection> conn = null;
try {
conn = getConnection();
NamedParameterJdbcTemplate jdbcTemplate = new NamedParameterJdbcTemplate(con... | [
"public",
"boolean",
"execute",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"params",
",",
"String",
"query",
")",
"{",
"final",
"AtomicBoolean",
"result",
"=",
"new",
"AtomicBoolean",
"(",
"false",
")",
";",
"Tuple2",
"<",
"DataSource",
",",
"Connectio... | Suitable for CRUD operations where no result set is expected.
@param params
@param query
@return | [
"Suitable",
"for",
"CRUD",
"operations",
"where",
"no",
"result",
"set",
"is",
"expected",
"."
] | 2c052fe60ead5a16277c798a3440de7d4f6f24f6 | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/sql/MysqlAccessor.java#L164-L188 | train |
srikalyc/Sql4D | Sql4DCompiler/src/main/java/com/yahoo/sql4d/query/QueryUtils.java | QueryUtils.checkAndPromoteToTimeSeries | public static QueryMeta checkAndPromoteToTimeSeries(QueryMeta qMeta) {
if (qMeta instanceof GroupByQueryMeta) {
if (((GroupByQueryMeta)qMeta).fetchDimensions == null) {
return TimeSeriesQueryMeta.promote(qMeta);
}
}
return qMeta;
} | java | public static QueryMeta checkAndPromoteToTimeSeries(QueryMeta qMeta) {
if (qMeta instanceof GroupByQueryMeta) {
if (((GroupByQueryMeta)qMeta).fetchDimensions == null) {
return TimeSeriesQueryMeta.promote(qMeta);
}
}
return qMeta;
} | [
"public",
"static",
"QueryMeta",
"checkAndPromoteToTimeSeries",
"(",
"QueryMeta",
"qMeta",
")",
"{",
"if",
"(",
"qMeta",
"instanceof",
"GroupByQueryMeta",
")",
"{",
"if",
"(",
"(",
"(",
"GroupByQueryMeta",
")",
"qMeta",
")",
".",
"fetchDimensions",
"==",
"null",... | Every query starts with GroupBy. Call this method after GROUP BY clause.
@param qMeta
@return | [
"Every",
"query",
"starts",
"with",
"GroupBy",
".",
"Call",
"this",
"method",
"after",
"GROUP",
"BY",
"clause",
"."
] | 2c052fe60ead5a16277c798a3440de7d4f6f24f6 | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4DCompiler/src/main/java/com/yahoo/sql4d/query/QueryUtils.java#L33-L40 | train |
srikalyc/Sql4D | Sql4DCompiler/src/main/java/com/yahoo/sql4d/delete/DeleteMeta.java | DeleteMeta.filterSegments | public void filterSegments(List<Interval> allSegments) {
segmentsToDelete = Lists.newArrayList(Iterables.filter(allSegments, new Predicate<Interval>() {
@Override
public boolean apply(Interval i) {
return i.fallsIn(interval);
}
}));
} | java | public void filterSegments(List<Interval> allSegments) {
segmentsToDelete = Lists.newArrayList(Iterables.filter(allSegments, new Predicate<Interval>() {
@Override
public boolean apply(Interval i) {
return i.fallsIn(interval);
}
}));
} | [
"public",
"void",
"filterSegments",
"(",
"List",
"<",
"Interval",
">",
"allSegments",
")",
"{",
"segmentsToDelete",
"=",
"Lists",
".",
"newArrayList",
"(",
"Iterables",
".",
"filter",
"(",
"allSegments",
",",
"new",
"Predicate",
"<",
"Interval",
">",
"(",
")... | Retain segments only overlapping with the range.
@param allSegments | [
"Retain",
"segments",
"only",
"overlapping",
"with",
"the",
"range",
"."
] | 2c052fe60ead5a16277c798a3440de7d4f6f24f6 | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4DCompiler/src/main/java/com/yahoo/sql4d/delete/DeleteMeta.java#L59-L66 | train |
srikalyc/Sql4D | Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/BrokerAccessor.java | BrokerAccessor.getTimeBoundary | public Interval getTimeBoundary(String dataSource, Map<String, String> reqHeaders) throws IllegalAccessException {
Program<BaseStatementMeta> pgm = DCompiler.compileSql(format("SELECT FROM %s", dataSource));
Either<String,Either<Mapper4All,JSONArray>> res = fireQuery(pgm.nthStmnt(0).toString(), reqHeade... | java | public Interval getTimeBoundary(String dataSource, Map<String, String> reqHeaders) throws IllegalAccessException {
Program<BaseStatementMeta> pgm = DCompiler.compileSql(format("SELECT FROM %s", dataSource));
Either<String,Either<Mapper4All,JSONArray>> res = fireQuery(pgm.nthStmnt(0).toString(), reqHeade... | [
"public",
"Interval",
"getTimeBoundary",
"(",
"String",
"dataSource",
",",
"Map",
"<",
"String",
",",
"String",
">",
"reqHeaders",
")",
"throws",
"IllegalAccessException",
"{",
"Program",
"<",
"BaseStatementMeta",
">",
"pgm",
"=",
"DCompiler",
".",
"compileSql",
... | Get timeboundary.
@param dataSource
@param reqHeaders
@return
@throws java.lang.IllegalAccessException | [
"Get",
"timeboundary",
"."
] | 2c052fe60ead5a16277c798a3440de7d4f6f24f6 | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/BrokerAccessor.java#L84-L98 | train |
srikalyc/Sql4D | Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/DDataSource.java | DDataSource.getCompiledAST | public Program<BaseStatementMeta> getCompiledAST(String sqlQuery, NamedParameters namedParams, Map<String, String> reqHeaders) throws Exception {
Program<BaseStatementMeta> pgm = DCompiler.compileSql(preprocessSqlQuery(sqlQuery, namedParams));
for (BaseStatementMeta stmnt : pgm.getAllStmnts()) {
... | java | public Program<BaseStatementMeta> getCompiledAST(String sqlQuery, NamedParameters namedParams, Map<String, String> reqHeaders) throws Exception {
Program<BaseStatementMeta> pgm = DCompiler.compileSql(preprocessSqlQuery(sqlQuery, namedParams));
for (BaseStatementMeta stmnt : pgm.getAllStmnts()) {
... | [
"public",
"Program",
"<",
"BaseStatementMeta",
">",
"getCompiledAST",
"(",
"String",
"sqlQuery",
",",
"NamedParameters",
"namedParams",
",",
"Map",
"<",
"String",
",",
"String",
">",
"reqHeaders",
")",
"throws",
"Exception",
"{",
"Program",
"<",
"BaseStatementMeta... | Get an in memory representation of broken SQL query. This may require
contacting druid for resolving dimensions Vs metrics for SELECT queries
hence it also optionally accepts HTTP request headers to be sent out.
@param sqlQuery
@param namedParams
@param reqHeaders
@return
@throws java.lang.Exception | [
"Get",
"an",
"in",
"memory",
"representation",
"of",
"broken",
"SQL",
"query",
".",
"This",
"may",
"require",
"contacting",
"druid",
"for",
"resolving",
"dimensions",
"Vs",
"metrics",
"for",
"SELECT",
"queries",
"hence",
"it",
"also",
"optionally",
"accepts",
... | 2c052fe60ead5a16277c798a3440de7d4f6f24f6 | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/DDataSource.java#L144-L168 | train |
srikalyc/Sql4D | Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/DDataSource.java | DDataSource.query | public Either<String, Either<Joiner4All, Mapper4All>> query(String sqlQuery, Map<String, String> reqHeaders) {
return query(sqlQuery, null, reqHeaders, false, "sql");
} | java | public Either<String, Either<Joiner4All, Mapper4All>> query(String sqlQuery, Map<String, String> reqHeaders) {
return query(sqlQuery, null, reqHeaders, false, "sql");
} | [
"public",
"Either",
"<",
"String",
",",
"Either",
"<",
"Joiner4All",
",",
"Mapper4All",
">",
">",
"query",
"(",
"String",
"sqlQuery",
",",
"Map",
"<",
"String",
",",
"String",
">",
"reqHeaders",
")",
"{",
"return",
"query",
"(",
"sqlQuery",
",",
"null",
... | Query and return the Json response.
@param sqlQuery
@param reqHeaders
@return | [
"Query",
"and",
"return",
"the",
"Json",
"response",
"."
] | 2c052fe60ead5a16277c798a3440de7d4f6f24f6 | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/DDataSource.java#L234-L236 | train |
srikalyc/Sql4D | Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/Mapper4Bean.java | Mapper4Bean.extractKeyAndRow | private T extractKeyAndRow(String timestamp, JSONObject jsonRow) {
T rowValues = null;
try {
rowValues = rowMapper.newInstance();
rowValues.getClass().getMethod("setTimestamp", String.class).invoke(rowValues, timestamp);
for (Object key : jsonRow.keySet()) {
... | java | private T extractKeyAndRow(String timestamp, JSONObject jsonRow) {
T rowValues = null;
try {
rowValues = rowMapper.newInstance();
rowValues.getClass().getMethod("setTimestamp", String.class).invoke(rowValues, timestamp);
for (Object key : jsonRow.keySet()) {
... | [
"private",
"T",
"extractKeyAndRow",
"(",
"String",
"timestamp",
",",
"JSONObject",
"jsonRow",
")",
"{",
"T",
"rowValues",
"=",
"null",
";",
"try",
"{",
"rowValues",
"=",
"rowMapper",
".",
"newInstance",
"(",
")",
";",
"rowValues",
".",
"getClass",
"(",
")"... | Extract v = all fields from json. The first field is always timestamp and
is not extracted here.
@param timestamp
@param jsonRow
@return | [
"Extract",
"v",
"=",
"all",
"fields",
"from",
"json",
".",
"The",
"first",
"field",
"is",
"always",
"timestamp",
"and",
"is",
"not",
"extracted",
"here",
"."
] | 2c052fe60ead5a16277c798a3440de7d4f6f24f6 | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/Mapper4Bean.java#L80-L93 | train |
srikalyc/Sql4D | Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/Mapper4All.java | Mapper4All.extractKeyAndRow | private List<Object> extractKeyAndRow(String timestamp, JSONObject jsonRow) {
List<Object> rowValues = new ArrayList<>();
rowValues.add(timestamp);
for (Object key : jsonRow.keySet()) {
rowValues.add(jsonRow.get(key.toString()));
}
return rowValues;
} | java | private List<Object> extractKeyAndRow(String timestamp, JSONObject jsonRow) {
List<Object> rowValues = new ArrayList<>();
rowValues.add(timestamp);
for (Object key : jsonRow.keySet()) {
rowValues.add(jsonRow.get(key.toString()));
}
return rowValues;
} | [
"private",
"List",
"<",
"Object",
">",
"extractKeyAndRow",
"(",
"String",
"timestamp",
",",
"JSONObject",
"jsonRow",
")",
"{",
"List",
"<",
"Object",
">",
"rowValues",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"rowValues",
".",
"add",
"(",
"timestamp",... | Extract v = all fields from json. The first field is always timestamp and
is passed to the method not extracted.
@param timestamp
@param jsonRow
@return | [
"Extract",
"v",
"=",
"all",
"fields",
"from",
"json",
".",
"The",
"first",
"field",
"is",
"always",
"timestamp",
"and",
"is",
"passed",
"to",
"the",
"method",
"not",
"extracted",
"."
] | 2c052fe60ead5a16277c798a3440de7d4f6f24f6 | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/Mapper4All.java#L71-L78 | train |
srikalyc/Sql4D | Sql4DCompiler/src/main/java/com/yahoo/sql4d/utils/DruidUtils.java | DruidUtils.getDimensions | public static List<String> getDimensions(Map<String, String> fetchDimensions) {
return new ArrayList<>(fetchDimensions.keySet());
} | java | public static List<String> getDimensions(Map<String, String> fetchDimensions) {
return new ArrayList<>(fetchDimensions.keySet());
} | [
"public",
"static",
"List",
"<",
"String",
">",
"getDimensions",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"fetchDimensions",
")",
"{",
"return",
"new",
"ArrayList",
"<>",
"(",
"fetchDimensions",
".",
"keySet",
"(",
")",
")",
";",
"}"
] | This method actually returns everything(including timestamp which is first field. | [
"This",
"method",
"actually",
"returns",
"everything",
"(",
"including",
"timestamp",
"which",
"is",
"first",
"field",
"."
] | 2c052fe60ead5a16277c798a3440de7d4f6f24f6 | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4DCompiler/src/main/java/com/yahoo/sql4d/utils/DruidUtils.java#L27-L29 | train |
srikalyc/Sql4D | IndexerAgent/src/main/java/com/yahoo/sql4d/indexeragent/meta/DBHandler.java | DBHandler.markTask | public void markTask(StatusTrail st, boolean success) {
st.setStatus(success ? JobStatus.done : JobStatus.not_done);
st.setAttemptsDone(st.getAttemptsDone() + 1);
st.setGivenUp(st.getAttemptsDone() >= getMaxTaskAttempts() ? 1 : 0);
updateStatusTrail(st);
} | java | public void markTask(StatusTrail st, boolean success) {
st.setStatus(success ? JobStatus.done : JobStatus.not_done);
st.setAttemptsDone(st.getAttemptsDone() + 1);
st.setGivenUp(st.getAttemptsDone() >= getMaxTaskAttempts() ? 1 : 0);
updateStatusTrail(st);
} | [
"public",
"void",
"markTask",
"(",
"StatusTrail",
"st",
",",
"boolean",
"success",
")",
"{",
"st",
".",
"setStatus",
"(",
"success",
"?",
"JobStatus",
".",
"done",
":",
"JobStatus",
".",
"not_done",
")",
";",
"st",
".",
"setAttemptsDone",
"(",
"st",
".",... | Change the status of a task.
@param st
@param success | [
"Change",
"the",
"status",
"of",
"a",
"task",
"."
] | 2c052fe60ead5a16277c798a3440de7d4f6f24f6 | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/IndexerAgent/src/main/java/com/yahoo/sql4d/indexeragent/meta/DBHandler.java#L218-L223 | train |
srikalyc/Sql4D | Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/CoordinatorAccessor.java | CoordinatorAccessor.fireCommand | private Either<String, Either<JSONArray, JSONObject>> fireCommand(String endPoint, String optData, Map<String, String> reqHeaders) {
CloseableHttpResponse resp = null;
String respStr;
String url = format(coordinatorUrl + endPoint, coordinatorHost, coordinatorPort);
try {
if (... | java | private Either<String, Either<JSONArray, JSONObject>> fireCommand(String endPoint, String optData, Map<String, String> reqHeaders) {
CloseableHttpResponse resp = null;
String respStr;
String url = format(coordinatorUrl + endPoint, coordinatorHost, coordinatorPort);
try {
if (... | [
"private",
"Either",
"<",
"String",
",",
"Either",
"<",
"JSONArray",
",",
"JSONObject",
">",
">",
"fireCommand",
"(",
"String",
"endPoint",
",",
"String",
"optData",
",",
"Map",
"<",
"String",
",",
"String",
">",
"reqHeaders",
")",
"{",
"CloseableHttpRespons... | All commands. If data is null then GET else POST.
@return | [
"All",
"commands",
".",
"If",
"data",
"is",
"null",
"then",
"GET",
"else",
"POST",
"."
] | 2c052fe60ead5a16277c798a3440de7d4f6f24f6 | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/CoordinatorAccessor.java#L54-L75 | train |
srikalyc/Sql4D | Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/CoordinatorAccessor.java | CoordinatorAccessor.dataSources | public Either<String, List<String>> dataSources(Map<String, String> reqHeaders) {
Either<String, Either<JSONArray, JSONObject>> resp = fireCommand("druid/coordinator/v1/metadata/datasources", null, reqHeaders);
if (resp.isLeft()) {
return new Left<>(resp.left().get());
}
Eith... | java | public Either<String, List<String>> dataSources(Map<String, String> reqHeaders) {
Either<String, Either<JSONArray, JSONObject>> resp = fireCommand("druid/coordinator/v1/metadata/datasources", null, reqHeaders);
if (resp.isLeft()) {
return new Left<>(resp.left().get());
}
Eith... | [
"public",
"Either",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"dataSources",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"reqHeaders",
")",
"{",
"Either",
"<",
"String",
",",
"Either",
"<",
"JSONArray",
",",
"JSONObject",
">",
">",
"resp"... | Retrieve all the datasources provisioned in Druid.
@param reqHeaders
@return | [
"Retrieve",
"all",
"the",
"datasources",
"provisioned",
"in",
"Druid",
"."
] | 2c052fe60ead5a16277c798a3440de7d4f6f24f6 | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/CoordinatorAccessor.java#L82-L97 | train |
srikalyc/Sql4D | IndexerAgent/src/main/java/com/yahoo/sql4d/indexeragent/util/UniqueOnlyQueue.java | UniqueOnlyQueue.removeFirst | public T removeFirst() {
try {
modifyLock.lock();
Iterator<T> it = iterator();
if (it.hasNext()) {
T item = it.next();
it.remove();
return item;
}
} finally {
modifyLock.unlock();
}
... | java | public T removeFirst() {
try {
modifyLock.lock();
Iterator<T> it = iterator();
if (it.hasNext()) {
T item = it.next();
it.remove();
return item;
}
} finally {
modifyLock.unlock();
}
... | [
"public",
"T",
"removeFirst",
"(",
")",
"{",
"try",
"{",
"modifyLock",
".",
"lock",
"(",
")",
";",
"Iterator",
"<",
"T",
">",
"it",
"=",
"iterator",
"(",
")",
";",
"if",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"T",
"item",
"=",
"it",
"... | Special method that removes head element.
@return | [
"Special",
"method",
"that",
"removes",
"head",
"element",
"."
] | 2c052fe60ead5a16277c798a3440de7d4f6f24f6 | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/IndexerAgent/src/main/java/com/yahoo/sql4d/indexeragent/util/UniqueOnlyQueue.java#L76-L89 | train |
srikalyc/Sql4D | Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/BaseJoiner.java | BaseJoiner.join | public void join(JSONArray jsonAllRows, List<String> joinFields, ActionType action) {
if (jsonAllRows.length() == 0) {
return;
}
JSONObject sample = jsonAllRows.getJSONObject(0);
if (sample.has("event")) {// GroupBy
extractAndTakeAction(null, jsonAllRows, joinFiel... | java | public void join(JSONArray jsonAllRows, List<String> joinFields, ActionType action) {
if (jsonAllRows.length() == 0) {
return;
}
JSONObject sample = jsonAllRows.getJSONObject(0);
if (sample.has("event")) {// GroupBy
extractAndTakeAction(null, jsonAllRows, joinFiel... | [
"public",
"void",
"join",
"(",
"JSONArray",
"jsonAllRows",
",",
"List",
"<",
"String",
">",
"joinFields",
",",
"ActionType",
"action",
")",
"{",
"if",
"(",
"jsonAllRows",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
";",
"}",
"JSONObject",
"... | If action if FIRST_CUT then the values are added directly to the result else
rows will be filtered on key.
@param jsonAllRows
@param joinFields
@param action | [
"If",
"action",
"if",
"FIRST_CUT",
"then",
"the",
"values",
"are",
"added",
"directly",
"to",
"the",
"result",
"else",
"rows",
"will",
"be",
"filtered",
"on",
"key",
"."
] | 2c052fe60ead5a16277c798a3440de7d4f6f24f6 | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/BaseJoiner.java#L40-L57 | train |
srikalyc/Sql4D | Sql4DCompiler/src/main/java/com/yahoo/sql4d/DCompiler.java | DCompiler.compileSql | public static Program compileSql(String query) {
try {
ANTLRStringStream in = new ANTLRStringStream(query);
druidGLexer lexer = new druidGLexer(in);
CommonTokenStream tokens = new CommonTokenStream(lexer);
druidGParser parser = new druidGParser(tokens);
... | java | public static Program compileSql(String query) {
try {
ANTLRStringStream in = new ANTLRStringStream(query);
druidGLexer lexer = new druidGLexer(in);
CommonTokenStream tokens = new CommonTokenStream(lexer);
druidGParser parser = new druidGParser(tokens);
... | [
"public",
"static",
"Program",
"compileSql",
"(",
"String",
"query",
")",
"{",
"try",
"{",
"ANTLRStringStream",
"in",
"=",
"new",
"ANTLRStringStream",
"(",
"query",
")",
";",
"druidGLexer",
"lexer",
"=",
"new",
"druidGLexer",
"(",
"in",
")",
";",
"CommonToke... | Sql->Json.
@param query
@return | [
"Sql",
"-",
">",
"Json",
"."
] | 2c052fe60ead5a16277c798a3440de7d4f6f24f6 | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4DCompiler/src/main/java/com/yahoo/sql4d/DCompiler.java#L36-L49 | train |
srikalyc/Sql4D | Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/BaseMapper.java | BaseMapper.tryRefillHeaders | protected void tryRefillHeaders(JSONObject eachRow) {
if (eachRow == null) {
return;
}
if (eachRow.keySet().size() > baseFieldNames.size() - 1) {//i.e excluding timestamp, if the sizes are not same then we have not covered all field names
baseFieldNames.clear();
... | java | protected void tryRefillHeaders(JSONObject eachRow) {
if (eachRow == null) {
return;
}
if (eachRow.keySet().size() > baseFieldNames.size() - 1) {//i.e excluding timestamp, if the sizes are not same then we have not covered all field names
baseFieldNames.clear();
... | [
"protected",
"void",
"tryRefillHeaders",
"(",
"JSONObject",
"eachRow",
")",
"{",
"if",
"(",
"eachRow",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"eachRow",
".",
"keySet",
"(",
")",
".",
"size",
"(",
")",
">",
"baseFieldNames",
".",
"size",... | Will attempt to refill headers if we see more fields.
@param eachRow | [
"Will",
"attempt",
"to",
"refill",
"headers",
"if",
"we",
"see",
"more",
"fields",
"."
] | 2c052fe60ead5a16277c798a3440de7d4f6f24f6 | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/BaseMapper.java#L71-L80 | train |
srikalyc/Sql4D | Sql4DCompiler/src/main/java/com/yahoo/sql4d/query/nodes/Granularity.java | Granularity.getJsonMap | public Map<String, Object> getJsonMap() {
Map<String, Object> map = new LinkedHashMap<>();
map.put("type", gComplex!=null && gComplex.isLeft()? "duration":"period");
if (gComplex != null) {
if (gComplex.isLeft()) {
map.put("duration", gComplex.left().get());
... | java | public Map<String, Object> getJsonMap() {
Map<String, Object> map = new LinkedHashMap<>();
map.put("type", gComplex!=null && gComplex.isLeft()? "duration":"period");
if (gComplex != null) {
if (gComplex.isLeft()) {
map.put("duration", gComplex.left().get());
... | [
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"getJsonMap",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
"=",
"new",
"LinkedHashMap",
"<>",
"(",
")",
";",
"map",
".",
"put",
"(",
"\"type\"",
",",
"gComplex",
"!=",
"null",
"... | Basic type when granularity is just string is taken care in QueryMeta class.
For duration and period types we get Json from here.
@return | [
"Basic",
"type",
"when",
"granularity",
"is",
"just",
"string",
"is",
"taken",
"care",
"in",
"QueryMeta",
"class",
".",
"For",
"duration",
"and",
"period",
"types",
"we",
"get",
"Json",
"from",
"here",
"."
] | 2c052fe60ead5a16277c798a3440de7d4f6f24f6 | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4DCompiler/src/main/java/com/yahoo/sql4d/query/nodes/Granularity.java#L90-L108 | train |
srikalyc/Sql4D | Sql4DCompiler/src/main/java/com/yahoo/sql4d/insert/InsertMeta.java | InsertMeta.getSpec | public Map<String, Object> getSpec() {
return ImmutableMap.<String, Object>of(
"ioConfig", getIoConfig(),
"dataSchema", getDataSchema(),
"tuningConfig", getTuningConfig());
} | java | public Map<String, Object> getSpec() {
return ImmutableMap.<String, Object>of(
"ioConfig", getIoConfig(),
"dataSchema", getDataSchema(),
"tuningConfig", getTuningConfig());
} | [
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"getSpec",
"(",
")",
"{",
"return",
"ImmutableMap",
".",
"<",
"String",
",",
"Object",
">",
"of",
"(",
"\"ioConfig\"",
",",
"getIoConfig",
"(",
")",
",",
"\"dataSchema\"",
",",
"getDataSchema",
"(",
")"... | be removed in future. | [
"be",
"removed",
"in",
"future",
"."
] | 2c052fe60ead5a16277c798a3440de7d4f6f24f6 | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4DCompiler/src/main/java/com/yahoo/sql4d/insert/InsertMeta.java#L76-L81 | train |
axibase/atsd-api-java | src/main/java/com/axibase/tsd/client/DefaultStreamingManager.java | DefaultStreamingManager.removeSavedPlainCommands | @Override
public List<String> removeSavedPlainCommands() {
if (saved.isEmpty()) {
return Collections.emptyList();
}
List<String> result = new ArrayList<>(saved);
saved.clear();
if (!result.isEmpty()) {
log.info("{} commands are removed from saved list"... | java | @Override
public List<String> removeSavedPlainCommands() {
if (saved.isEmpty()) {
return Collections.emptyList();
}
List<String> result = new ArrayList<>(saved);
saved.clear();
if (!result.isEmpty()) {
log.info("{} commands are removed from saved list"... | [
"@",
"Override",
"public",
"List",
"<",
"String",
">",
"removeSavedPlainCommands",
"(",
")",
"{",
"if",
"(",
"saved",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"}",
"List",
"<",
"String",
">",
"result... | Stable work is not guaranteed | [
"Stable",
"work",
"is",
"not",
"guaranteed"
] | 63a0767d08b202dad2ebef4372ff947d6fba0246 | https://github.com/axibase/atsd-api-java/blob/63a0767d08b202dad2ebef4372ff947d6fba0246/src/main/java/com/axibase/tsd/client/DefaultStreamingManager.java#L294-L305 | train |
axibase/atsd-api-java | src/main/java/com/axibase/tsd/client/AtsdPropertyExtractor.java | AtsdPropertyExtractor.getAsLong | public long getAsLong(final String name, final long defaultValue) {
return AtsdUtil.getPropertyLongValue(fullName(name), clientProperties, defaultValue);
} | java | public long getAsLong(final String name, final long defaultValue) {
return AtsdUtil.getPropertyLongValue(fullName(name), clientProperties, defaultValue);
} | [
"public",
"long",
"getAsLong",
"(",
"final",
"String",
"name",
",",
"final",
"long",
"defaultValue",
")",
"{",
"return",
"AtsdUtil",
".",
"getPropertyLongValue",
"(",
"fullName",
"(",
"name",
")",
",",
"clientProperties",
",",
"defaultValue",
")",
";",
"}"
] | Get property by name as long value
@param name name of property without the prefix.
@param defaultValue default value for case when the property is not set.
@return property's value. | [
"Get",
"property",
"by",
"name",
"as",
"long",
"value"
] | 63a0767d08b202dad2ebef4372ff947d6fba0246 | https://github.com/axibase/atsd-api-java/blob/63a0767d08b202dad2ebef4372ff947d6fba0246/src/main/java/com/axibase/tsd/client/AtsdPropertyExtractor.java#L23-L25 | train |
axibase/atsd-api-java | src/main/java/com/axibase/tsd/client/AtsdPropertyExtractor.java | AtsdPropertyExtractor.getAsInt | public int getAsInt(final String name, final int defaultValue) {
return AtsdUtil.getPropertyIntValue(fullName(name), clientProperties, defaultValue);
} | java | public int getAsInt(final String name, final int defaultValue) {
return AtsdUtil.getPropertyIntValue(fullName(name), clientProperties, defaultValue);
} | [
"public",
"int",
"getAsInt",
"(",
"final",
"String",
"name",
",",
"final",
"int",
"defaultValue",
")",
"{",
"return",
"AtsdUtil",
".",
"getPropertyIntValue",
"(",
"fullName",
"(",
"name",
")",
",",
"clientProperties",
",",
"defaultValue",
")",
";",
"}"
] | Get property by name as int value
@param name name of property without the prefix.
@param defaultValue default value for case when the property is not set.
@return property's value. | [
"Get",
"property",
"by",
"name",
"as",
"int",
"value"
] | 63a0767d08b202dad2ebef4372ff947d6fba0246 | https://github.com/axibase/atsd-api-java/blob/63a0767d08b202dad2ebef4372ff947d6fba0246/src/main/java/com/axibase/tsd/client/AtsdPropertyExtractor.java#L34-L36 | train |
axibase/atsd-api-java | src/main/java/com/axibase/tsd/client/AtsdPropertyExtractor.java | AtsdPropertyExtractor.getAsBoolean | public boolean getAsBoolean(final String name, final boolean defaultValue) {
return AtsdUtil.getPropertyBoolValue(fullName(name), clientProperties, defaultValue);
} | java | public boolean getAsBoolean(final String name, final boolean defaultValue) {
return AtsdUtil.getPropertyBoolValue(fullName(name), clientProperties, defaultValue);
} | [
"public",
"boolean",
"getAsBoolean",
"(",
"final",
"String",
"name",
",",
"final",
"boolean",
"defaultValue",
")",
"{",
"return",
"AtsdUtil",
".",
"getPropertyBoolValue",
"(",
"fullName",
"(",
"name",
")",
",",
"clientProperties",
",",
"defaultValue",
")",
";",
... | Get property by name as boolean value
@param name name of property without the prefix.
@param defaultValue default value for case when the property is not set.
@return property's value. | [
"Get",
"property",
"by",
"name",
"as",
"boolean",
"value"
] | 63a0767d08b202dad2ebef4372ff947d6fba0246 | https://github.com/axibase/atsd-api-java/blob/63a0767d08b202dad2ebef4372ff947d6fba0246/src/main/java/com/axibase/tsd/client/AtsdPropertyExtractor.java#L45-L47 | train |
axibase/atsd-api-java | src/main/java/com/axibase/tsd/model/system/ClientConfiguration.java | ClientConfiguration.builder | public static ClientConfigurationBuilder builder(final String url, final String username, final String password) {
return new ClientConfigurationBuilder(url, username, password);
} | java | public static ClientConfigurationBuilder builder(final String url, final String username, final String password) {
return new ClientConfigurationBuilder(url, username, password);
} | [
"public",
"static",
"ClientConfigurationBuilder",
"builder",
"(",
"final",
"String",
"url",
",",
"final",
"String",
"username",
",",
"final",
"String",
"password",
")",
"{",
"return",
"new",
"ClientConfigurationBuilder",
"(",
"url",
",",
"username",
",",
"password... | Create builder with unnecessary args.
@param url full URL to both Metadata and Data ATSD API
@param username user name to login
@param password password to login
@return ClientConfigurationBuilder | [
"Create",
"builder",
"with",
"unnecessary",
"args",
"."
] | 63a0767d08b202dad2ebef4372ff947d6fba0246 | https://github.com/axibase/atsd-api-java/blob/63a0767d08b202dad2ebef4372ff947d6fba0246/src/main/java/com/axibase/tsd/model/system/ClientConfiguration.java#L65-L67 | train |
axibase/atsd-api-java | src/main/java/com/axibase/tsd/client/MetaDataService.java | MetaDataService.createOrReplaceMetric | public boolean createOrReplaceMetric(Metric metric) {
String metricName = metric.getName();
checkMetricIsEmpty(metricName);
QueryPart<Metric> queryPart = new Query<Metric>("metrics")
.path(metricName, true);
return httpClientManager.updateMetaData(queryPart, put(metric));... | java | public boolean createOrReplaceMetric(Metric metric) {
String metricName = metric.getName();
checkMetricIsEmpty(metricName);
QueryPart<Metric> queryPart = new Query<Metric>("metrics")
.path(metricName, true);
return httpClientManager.updateMetaData(queryPart, put(metric));... | [
"public",
"boolean",
"createOrReplaceMetric",
"(",
"Metric",
"metric",
")",
"{",
"String",
"metricName",
"=",
"metric",
".",
"getName",
"(",
")",
";",
"checkMetricIsEmpty",
"(",
"metricName",
")",
";",
"QueryPart",
"<",
"Metric",
">",
"queryPart",
"=",
"new",
... | create or replace metric
@param metric metric
@return is success | [
"create",
"or",
"replace",
"metric"
] | 63a0767d08b202dad2ebef4372ff947d6fba0246 | https://github.com/axibase/atsd-api-java/blob/63a0767d08b202dad2ebef4372ff947d6fba0246/src/main/java/com/axibase/tsd/client/MetaDataService.java#L185-L191 | train |
axibase/atsd-api-java | src/main/java/com/axibase/tsd/client/MetaDataService.java | MetaDataService.createOrReplaceEntity | public boolean createOrReplaceEntity(Entity entity) {
String entityName = entity.getName();
checkEntityIsEmpty(entityName);
QueryPart<Entity> queryPart = new Query<Entity>("entities")
.path(entityName, true);
return httpClientManager.updateMetaData(queryPart, put(entity))... | java | public boolean createOrReplaceEntity(Entity entity) {
String entityName = entity.getName();
checkEntityIsEmpty(entityName);
QueryPart<Entity> queryPart = new Query<Entity>("entities")
.path(entityName, true);
return httpClientManager.updateMetaData(queryPart, put(entity))... | [
"public",
"boolean",
"createOrReplaceEntity",
"(",
"Entity",
"entity",
")",
"{",
"String",
"entityName",
"=",
"entity",
".",
"getName",
"(",
")",
";",
"checkEntityIsEmpty",
"(",
"entityName",
")",
";",
"QueryPart",
"<",
"Entity",
">",
"queryPart",
"=",
"new",
... | Create or replace
@param entity entity
@return is success | [
"Create",
"or",
"replace"
] | 63a0767d08b202dad2ebef4372ff947d6fba0246 | https://github.com/axibase/atsd-api-java/blob/63a0767d08b202dad2ebef4372ff947d6fba0246/src/main/java/com/axibase/tsd/client/MetaDataService.java#L304-L310 | train |
axibase/atsd-api-java | src/main/java/com/axibase/tsd/client/MetaDataService.java | MetaDataService.deleteEntityGroup | public boolean deleteEntityGroup(EntityGroup entityGroup) {
String entityGroupName = entityGroup.getName();
checkEntityGroupIsEmpty(entityGroupName);
QueryPart<EntityGroup> query = new Query<EntityGroup>("entity-groups")
.path(entityGroupName, true);
return httpClientMana... | java | public boolean deleteEntityGroup(EntityGroup entityGroup) {
String entityGroupName = entityGroup.getName();
checkEntityGroupIsEmpty(entityGroupName);
QueryPart<EntityGroup> query = new Query<EntityGroup>("entity-groups")
.path(entityGroupName, true);
return httpClientMana... | [
"public",
"boolean",
"deleteEntityGroup",
"(",
"EntityGroup",
"entityGroup",
")",
"{",
"String",
"entityGroupName",
"=",
"entityGroup",
".",
"getName",
"(",
")",
";",
"checkEntityGroupIsEmpty",
"(",
"entityGroupName",
")",
";",
"QueryPart",
"<",
"EntityGroup",
">",
... | Delete entity group
@param entityGroup entity group
@return is success | [
"Delete",
"entity",
"group"
] | 63a0767d08b202dad2ebef4372ff947d6fba0246 | https://github.com/axibase/atsd-api-java/blob/63a0767d08b202dad2ebef4372ff947d6fba0246/src/main/java/com/axibase/tsd/client/MetaDataService.java#L415-L421 | train |
axibase/atsd-api-java | src/main/java/com/axibase/tsd/client/MetaDataService.java | MetaDataService.addGroupEntities | public boolean addGroupEntities(String entityGroupName, Boolean createEntities, Entity... entities) {
checkEntityGroupIsEmpty(entityGroupName);
List<String> entitiesNames = new ArrayList<>();
for (Entity entity : entities) {
entitiesNames.add(entity.getName());
}
Quer... | java | public boolean addGroupEntities(String entityGroupName, Boolean createEntities, Entity... entities) {
checkEntityGroupIsEmpty(entityGroupName);
List<String> entitiesNames = new ArrayList<>();
for (Entity entity : entities) {
entitiesNames.add(entity.getName());
}
Quer... | [
"public",
"boolean",
"addGroupEntities",
"(",
"String",
"entityGroupName",
",",
"Boolean",
"createEntities",
",",
"Entity",
"...",
"entities",
")",
"{",
"checkEntityGroupIsEmpty",
"(",
"entityGroupName",
")",
";",
"List",
"<",
"String",
">",
"entitiesNames",
"=",
... | Add specified entities to entity group.
@param entityGroupName Entity group name.
@param createEntities Automatically create new entities from the submitted list if such entities don't already exist.
@param entities Entities to create.
@return {@code true} if entities added.
@throws AtsdClientException raised ... | [
"Add",
"specified",
"entities",
"to",
"entity",
"group",
"."
] | 63a0767d08b202dad2ebef4372ff947d6fba0246 | https://github.com/axibase/atsd-api-java/blob/63a0767d08b202dad2ebef4372ff947d6fba0246/src/main/java/com/axibase/tsd/client/MetaDataService.java#L508-L519 | train |
axibase/atsd-api-java | src/main/java/com/axibase/tsd/client/MetaDataService.java | MetaDataService.deleteGroupEntities | public boolean deleteGroupEntities(String entityGroupName, Entity... entities) {
checkEntityGroupIsEmpty(entityGroupName);
List<String> entitiesNames = new ArrayList<>();
for (Entity entity : entities) {
entitiesNames.add(entity.getName());
}
QueryPart<Entity> query =... | java | public boolean deleteGroupEntities(String entityGroupName, Entity... entities) {
checkEntityGroupIsEmpty(entityGroupName);
List<String> entitiesNames = new ArrayList<>();
for (Entity entity : entities) {
entitiesNames.add(entity.getName());
}
QueryPart<Entity> query =... | [
"public",
"boolean",
"deleteGroupEntities",
"(",
"String",
"entityGroupName",
",",
"Entity",
"...",
"entities",
")",
"{",
"checkEntityGroupIsEmpty",
"(",
"entityGroupName",
")",
";",
"List",
"<",
"String",
">",
"entitiesNames",
"=",
"new",
"ArrayList",
"<>",
"(",
... | Delete entities from entity group.
@param entityGroupName Entity group name.
@param entities Entities to replace. @return {@code true} if entities added.
@return is success
@throws AtsdClientException raised if there is any client problem
@throws AtsdServerException raised if there is any server problem | [
"Delete",
"entities",
"from",
"entity",
"group",
"."
] | 63a0767d08b202dad2ebef4372ff947d6fba0246 | https://github.com/axibase/atsd-api-java/blob/63a0767d08b202dad2ebef4372ff947d6fba0246/src/main/java/com/axibase/tsd/client/MetaDataService.java#L555-L565 | train |
axibase/atsd-api-java | src/main/java/com/axibase/tsd/client/ClientConfigurationFactory.java | ClientConfigurationFactory.createClientConfiguration | public ClientConfiguration createClientConfiguration() {
return ClientConfiguration.builder(buildTimeSeriesUrl(), username, password)
.connectTimeoutMillis(connectTimeoutMillis)
.readTimeoutMillis(readTimeoutMillis)
.pingTimeoutMillis(pingTimeoutMillis)
... | java | public ClientConfiguration createClientConfiguration() {
return ClientConfiguration.builder(buildTimeSeriesUrl(), username, password)
.connectTimeoutMillis(connectTimeoutMillis)
.readTimeoutMillis(readTimeoutMillis)
.pingTimeoutMillis(pingTimeoutMillis)
... | [
"public",
"ClientConfiguration",
"createClientConfiguration",
"(",
")",
"{",
"return",
"ClientConfiguration",
".",
"builder",
"(",
"buildTimeSeriesUrl",
"(",
")",
",",
"username",
",",
"password",
")",
".",
"connectTimeoutMillis",
"(",
"connectTimeoutMillis",
")",
"."... | Build client configuration from set properties.
@return ClientConfiguration instance. | [
"Build",
"client",
"configuration",
"from",
"set",
"properties",
"."
] | 63a0767d08b202dad2ebef4372ff947d6fba0246 | https://github.com/axibase/atsd-api-java/blob/63a0767d08b202dad2ebef4372ff947d6fba0246/src/main/java/com/axibase/tsd/client/ClientConfigurationFactory.java#L126-L136 | train |
FasterXML/jackson-jr | jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/JSONComposer.java | JSONComposer.finish | @SuppressWarnings("unchecked")
public T finish() throws IOException
{
if (_open) {
_closeChild();
_open = false;
if (_closeGenerator) {
_generator.close();
} else if (Feature.FLUSH_AFTER_WRITE_VALUE.isEnabled(_features)) {
_... | java | @SuppressWarnings("unchecked")
public T finish() throws IOException
{
if (_open) {
_closeChild();
_open = false;
if (_closeGenerator) {
_generator.close();
} else if (Feature.FLUSH_AFTER_WRITE_VALUE.isEnabled(_features)) {
_... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"T",
"finish",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"_open",
")",
"{",
"_closeChild",
"(",
")",
";",
"_open",
"=",
"false",
";",
"if",
"(",
"_closeGenerator",
")",
"{",
"_generat... | Method to call to complete composition, flush any pending content,
and return instance of specified result type. | [
"Method",
"to",
"call",
"to",
"complete",
"composition",
"flush",
"any",
"pending",
"content",
"and",
"return",
"instance",
"of",
"specified",
"result",
"type",
"."
] | 62ca7a82bd90a9be77028e0b62364307d7532837 | https://github.com/FasterXML/jackson-jr/blob/62ca7a82bd90a9be77028e0b62364307d7532837/jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/JSONComposer.java#L114-L140 | train |
FasterXML/jackson-jr | jr-objects/src/main/java/com/fasterxml/jackson/jr/type/TypeBindings.java | TypeBindings.withUnboundVariable | public TypeBindings withUnboundVariable(String name)
{
int len = (_unboundVariables == null) ? 0 : _unboundVariables.length;
String[] names = (len == 0)
? new String[1] : Arrays.copyOf(_unboundVariables, len+1);
names[len] = name;
return new TypeBindings(_names, _typ... | java | public TypeBindings withUnboundVariable(String name)
{
int len = (_unboundVariables == null) ? 0 : _unboundVariables.length;
String[] names = (len == 0)
? new String[1] : Arrays.copyOf(_unboundVariables, len+1);
names[len] = name;
return new TypeBindings(_names, _typ... | [
"public",
"TypeBindings",
"withUnboundVariable",
"(",
"String",
"name",
")",
"{",
"int",
"len",
"=",
"(",
"_unboundVariables",
"==",
"null",
")",
"?",
"0",
":",
"_unboundVariables",
".",
"length",
";",
"String",
"[",
"]",
"names",
"=",
"(",
"len",
"==",
... | Method for creating an instance that has same bindings as this object,
plus an indicator for additional type variable that may be unbound within
this context; this is needed to resolve recursive self-references. | [
"Method",
"for",
"creating",
"an",
"instance",
"that",
"has",
"same",
"bindings",
"as",
"this",
"object",
"plus",
"an",
"indicator",
"for",
"additional",
"type",
"variable",
"that",
"may",
"be",
"unbound",
"within",
"this",
"context",
";",
"this",
"is",
"nee... | 62ca7a82bd90a9be77028e0b62364307d7532837 | https://github.com/FasterXML/jackson-jr/blob/62ca7a82bd90a9be77028e0b62364307d7532837/jr-objects/src/main/java/com/fasterxml/jackson/jr/type/TypeBindings.java#L78-L85 | train |
FasterXML/jackson-jr | jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/impl/ValueReaderLocator.java | ValueReaderLocator.findReader | public ValueReader findReader(Class<?> raw)
{
ClassKey k = (_key == null) ? new ClassKey(raw, _features) : _key.with(raw, _features);
ValueReader vr = _knownReaders.get(k);
if (vr != null) {
return vr;
}
vr = createReader(null, raw, raw);
// 15-Jun-2016, t... | java | public ValueReader findReader(Class<?> raw)
{
ClassKey k = (_key == null) ? new ClassKey(raw, _features) : _key.with(raw, _features);
ValueReader vr = _knownReaders.get(k);
if (vr != null) {
return vr;
}
vr = createReader(null, raw, raw);
// 15-Jun-2016, t... | [
"public",
"ValueReader",
"findReader",
"(",
"Class",
"<",
"?",
">",
"raw",
")",
"{",
"ClassKey",
"k",
"=",
"(",
"_key",
"==",
"null",
")",
"?",
"new",
"ClassKey",
"(",
"raw",
",",
"_features",
")",
":",
"_key",
".",
"with",
"(",
"raw",
",",
"_featu... | Method used during deserialization to find handler for given
non-generic type. | [
"Method",
"used",
"during",
"deserialization",
"to",
"find",
"handler",
"for",
"given",
"non",
"-",
"generic",
"type",
"."
] | 62ca7a82bd90a9be77028e0b62364307d7532837 | https://github.com/FasterXML/jackson-jr/blob/62ca7a82bd90a9be77028e0b62364307d7532837/jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/impl/ValueReaderLocator.java#L136-L151 | train |
FasterXML/jackson-jr | jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/JSON.java | JSON.with | public JSON with(Feature ... features)
{
int flags = _features;
for (Feature feature : features) {
flags |= feature.mask();
}
return _with(flags);
} | java | public JSON with(Feature ... features)
{
int flags = _features;
for (Feature feature : features) {
flags |= feature.mask();
}
return _with(flags);
} | [
"public",
"JSON",
"with",
"(",
"Feature",
"...",
"features",
")",
"{",
"int",
"flags",
"=",
"_features",
";",
"for",
"(",
"Feature",
"feature",
":",
"features",
")",
"{",
"flags",
"|=",
"feature",
".",
"mask",
"(",
")",
";",
"}",
"return",
"_with",
"... | Mutant factory for constructing an instance with specified features
enabled. | [
"Mutant",
"factory",
"for",
"constructing",
"an",
"instance",
"with",
"specified",
"features",
"enabled",
"."
] | 62ca7a82bd90a9be77028e0b62364307d7532837 | https://github.com/FasterXML/jackson-jr/blob/62ca7a82bd90a9be77028e0b62364307d7532837/jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/JSON.java#L582-L589 | train |
FasterXML/jackson-jr | jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/JSON.java | JSON._with | protected final JSON _with(int features)
{
if (_features == features) {
return this;
}
return _with(features, _streamFactory, _treeCodec,
_reader, _writer, _prettyPrinter);
} | java | protected final JSON _with(int features)
{
if (_features == features) {
return this;
}
return _with(features, _streamFactory, _treeCodec,
_reader, _writer, _prettyPrinter);
} | [
"protected",
"final",
"JSON",
"_with",
"(",
"int",
"features",
")",
"{",
"if",
"(",
"_features",
"==",
"features",
")",
"{",
"return",
"this",
";",
"}",
"return",
"_with",
"(",
"features",
",",
"_streamFactory",
",",
"_treeCodec",
",",
"_reader",
",",
"_... | Internal mutant factory method used for constructing | [
"Internal",
"mutant",
"factory",
"method",
"used",
"for",
"constructing"
] | 62ca7a82bd90a9be77028e0b62364307d7532837 | https://github.com/FasterXML/jackson-jr/blob/62ca7a82bd90a9be77028e0b62364307d7532837/jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/JSON.java#L607-L614 | train |
FasterXML/jackson-jr | jr-objects/src/main/java/com/fasterxml/jackson/jr/type/ResolvedType.java | ResolvedType.typeParametersFor | public List<ResolvedType> typeParametersFor(Class<?> erasedSupertype) {
ResolvedType type = findSupertype(erasedSupertype);
if (type != null) {
return type.typeParams();
}
return null;
} | java | public List<ResolvedType> typeParametersFor(Class<?> erasedSupertype) {
ResolvedType type = findSupertype(erasedSupertype);
if (type != null) {
return type.typeParams();
}
return null;
} | [
"public",
"List",
"<",
"ResolvedType",
">",
"typeParametersFor",
"(",
"Class",
"<",
"?",
">",
"erasedSupertype",
")",
"{",
"ResolvedType",
"type",
"=",
"findSupertype",
"(",
"erasedSupertype",
")",
";",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"return",
... | Method that will try to find type parameterization this type
has for specified super type
@return List of type parameters for specified supertype (which may
be empty, if supertype is not a parametric type); null if specified
type is not a super type of this type | [
"Method",
"that",
"will",
"try",
"to",
"find",
"type",
"parameterization",
"this",
"type",
"has",
"for",
"specified",
"super",
"type"
] | 62ca7a82bd90a9be77028e0b62364307d7532837 | https://github.com/FasterXML/jackson-jr/blob/62ca7a82bd90a9be77028e0b62364307d7532837/jr-objects/src/main/java/com/fasterxml/jackson/jr/type/ResolvedType.java#L94-L100 | train |
FasterXML/jackson-jr | jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/JSONObjectException.java | JSONObjectException.getPath | public List<Reference> getPath()
{
if (_path == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(_path);
} | java | public List<Reference> getPath()
{
if (_path == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(_path);
} | [
"public",
"List",
"<",
"Reference",
">",
"getPath",
"(",
")",
"{",
"if",
"(",
"_path",
"==",
"null",
")",
"{",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"}",
"return",
"Collections",
".",
"unmodifiableList",
"(",
"_path",
")",
";",
"}"
... | Method for accessing full structural path within type hierarchy
down to problematic property. | [
"Method",
"for",
"accessing",
"full",
"structural",
"path",
"within",
"type",
"hierarchy",
"down",
"to",
"problematic",
"property",
"."
] | 62ca7a82bd90a9be77028e0b62364307d7532837 | https://github.com/FasterXML/jackson-jr/blob/62ca7a82bd90a9be77028e0b62364307d7532837/jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/JSONObjectException.java#L252-L258 | train |
FasterXML/jackson-jr | jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/impl/BeanReader.java | BeanReader.read | @Override
public Object read(JSONReader r, JsonParser p) throws IOException
{
if (p.isExpectedStartObjectToken()) {
final Object bean;
try {
bean = create();
} catch (Exception e) {
return _reportFailureToCreate(p, e);
}
... | java | @Override
public Object read(JSONReader r, JsonParser p) throws IOException
{
if (p.isExpectedStartObjectToken()) {
final Object bean;
try {
bean = create();
} catch (Exception e) {
return _reportFailureToCreate(p, e);
}
... | [
"@",
"Override",
"public",
"Object",
"read",
"(",
"JSONReader",
"r",
",",
"JsonParser",
"p",
")",
"throws",
"IOException",
"{",
"if",
"(",
"p",
".",
"isExpectedStartObjectToken",
"(",
")",
")",
"{",
"final",
"Object",
"bean",
";",
"try",
"{",
"bean",
"="... | Method used for deserialization; will read an instance of the bean
type using given parser. | [
"Method",
"used",
"for",
"deserialization",
";",
"will",
"read",
"an",
"instance",
"of",
"the",
"bean",
"type",
"using",
"given",
"parser",
"."
] | 62ca7a82bd90a9be77028e0b62364307d7532837 | https://github.com/FasterXML/jackson-jr/blob/62ca7a82bd90a9be77028e0b62364307d7532837/jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/impl/BeanReader.java#L101-L129 | train |
FasterXML/jackson-jr | jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/impl/JSONReader.java | JSONReader.readBean | @SuppressWarnings("unchecked")
public <T> T readBean(Class<T> type) throws IOException {
ValueReader vr = _readerLocator.findReader(type);
return (T) vr.read(this, _parser);
} | java | @SuppressWarnings("unchecked")
public <T> T readBean(Class<T> type) throws IOException {
ValueReader vr = _readerLocator.findReader(type);
return (T) vr.read(this, _parser);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"readBean",
"(",
"Class",
"<",
"T",
">",
"type",
")",
"throws",
"IOException",
"{",
"ValueReader",
"vr",
"=",
"_readerLocator",
".",
"findReader",
"(",
"type",
")",
";",
"r... | Method for reading a JSON Object from input and building a Bean of
specified type out of it; Bean has to conform to standard Java Bean
specification by having setters for passing JSON Object properties. | [
"Method",
"for",
"reading",
"a",
"JSON",
"Object",
"from",
"input",
"and",
"building",
"a",
"Bean",
"of",
"specified",
"type",
"out",
"of",
"it",
";",
"Bean",
"has",
"to",
"conform",
"to",
"standard",
"Java",
"Bean",
"specification",
"by",
"having",
"sette... | 62ca7a82bd90a9be77028e0b62364307d7532837 | https://github.com/FasterXML/jackson-jr/blob/62ca7a82bd90a9be77028e0b62364307d7532837/jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/impl/JSONReader.java#L231-L235 | train |
neuland/jade4j | src/main/java/org/apache/commons/jexl2/JadeJexlInterpreter.java | JadeJexlInterpreter.unknownVariable | protected Object unknownVariable(JexlException xjexl) {
// don't throw the exception
if (!silent) {
logger.trace(xjexl.getMessage());
}
return null;
} | java | protected Object unknownVariable(JexlException xjexl) {
// don't throw the exception
if (!silent) {
logger.trace(xjexl.getMessage());
}
return null;
} | [
"protected",
"Object",
"unknownVariable",
"(",
"JexlException",
"xjexl",
")",
"{",
"// don't throw the exception",
"if",
"(",
"!",
"silent",
")",
"{",
"logger",
".",
"trace",
"(",
"xjexl",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"return",
"null",
";",
... | Triggered when variable can not be resolved.
@param xjexl
the JexlException ("undefined variable " + variable)
@return throws JexlException if strict, null otherwise | [
"Triggered",
"when",
"variable",
"can",
"not",
"be",
"resolved",
"."
] | 621907732fb88c1b0145733624751f0fcaca2ff7 | https://github.com/neuland/jade4j/blob/621907732fb88c1b0145733624751f0fcaca2ff7/src/main/java/org/apache/commons/jexl2/JadeJexlInterpreter.java#L20-L26 | train |
neuland/jade4j | src/main/java/org/apache/commons/jexl2/JadeJexlArithmetic.java | JadeJexlArithmetic.toBoolean | @Override
public boolean toBoolean(Object val) {
if (val == null) {
controlNullOperand();
return false;
} else if (val instanceof Boolean) {
return (Boolean) val;
} else if (val instanceof Number) {
double number = toDouble(val);
re... | java | @Override
public boolean toBoolean(Object val) {
if (val == null) {
controlNullOperand();
return false;
} else if (val instanceof Boolean) {
return (Boolean) val;
} else if (val instanceof Number) {
double number = toDouble(val);
re... | [
"@",
"Override",
"public",
"boolean",
"toBoolean",
"(",
"Object",
"val",
")",
"{",
"if",
"(",
"val",
"==",
"null",
")",
"{",
"controlNullOperand",
"(",
")",
";",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"val",
"instanceof",
"Boolean",
")",
"{",
... | using the original implementation
added check for empty lists
defaulting to "true" | [
"using",
"the",
"original",
"implementation",
"added",
"check",
"for",
"empty",
"lists",
"defaulting",
"to",
"true"
] | 621907732fb88c1b0145733624751f0fcaca2ff7 | https://github.com/neuland/jade4j/blob/621907732fb88c1b0145733624751f0fcaca2ff7/src/main/java/org/apache/commons/jexl2/JadeJexlArithmetic.java#L76-L94 | train |
neuland/jade4j | src/main/java/org/apache/commons/jexl2/JadeIntrospect.java | JadeIntrospect.getPropertyGet | @SuppressWarnings("deprecation")
@Override
public JexlPropertyGet getPropertyGet(Object obj, Object identifier, JexlInfo info) {
JexlPropertyGet get = getJadeGetExecutor(obj, identifier);
if (get == null && obj != null && identifier != null) {
get = getIndexedGet(obj, identifier.toString());
if (get == null... | java | @SuppressWarnings("deprecation")
@Override
public JexlPropertyGet getPropertyGet(Object obj, Object identifier, JexlInfo info) {
JexlPropertyGet get = getJadeGetExecutor(obj, identifier);
if (get == null && obj != null && identifier != null) {
get = getIndexedGet(obj, identifier.toString());
if (get == null... | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"@",
"Override",
"public",
"JexlPropertyGet",
"getPropertyGet",
"(",
"Object",
"obj",
",",
"Object",
"identifier",
",",
"JexlInfo",
"info",
")",
"{",
"JexlPropertyGet",
"get",
"=",
"getJadeGetExecutor",
"(",
"o... | Overwriting method to replace "getGetExecutor" call with "getJadeGetExecutor" | [
"Overwriting",
"method",
"to",
"replace",
"getGetExecutor",
"call",
"with",
"getJadeGetExecutor"
] | 621907732fb88c1b0145733624751f0fcaca2ff7 | https://github.com/neuland/jade4j/blob/621907732fb88c1b0145733624751f0fcaca2ff7/src/main/java/org/apache/commons/jexl2/JadeIntrospect.java#L25-L39 | train |
neuland/jade4j | src/main/java/org/apache/commons/jexl2/JadeIntrospect.java | JadeIntrospect.getJadeGetExecutor | public final AbstractExecutor.Get getJadeGetExecutor(Object obj, Object identifier) {
final Class<?> claz = obj.getClass();
final String property = toString(identifier);
AbstractExecutor.Get executor;
// let's see if we are a map...
executor = new MapGetExecutor(this, claz, identifier);
if (executor.isAlive... | java | public final AbstractExecutor.Get getJadeGetExecutor(Object obj, Object identifier) {
final Class<?> claz = obj.getClass();
final String property = toString(identifier);
AbstractExecutor.Get executor;
// let's see if we are a map...
executor = new MapGetExecutor(this, claz, identifier);
if (executor.isAlive... | [
"public",
"final",
"AbstractExecutor",
".",
"Get",
"getJadeGetExecutor",
"(",
"Object",
"obj",
",",
"Object",
"identifier",
")",
"{",
"final",
"Class",
"<",
"?",
">",
"claz",
"=",
"obj",
".",
"getClass",
"(",
")",
";",
"final",
"String",
"property",
"=",
... | Identical to getGetExecutor, but does check for map first. Mainly to avoid problems with 'class' properties. | [
"Identical",
"to",
"getGetExecutor",
"but",
"does",
"check",
"for",
"map",
"first",
".",
"Mainly",
"to",
"avoid",
"problems",
"with",
"class",
"properties",
"."
] | 621907732fb88c1b0145733624751f0fcaca2ff7 | https://github.com/neuland/jade4j/blob/621907732fb88c1b0145733624751f0fcaca2ff7/src/main/java/org/apache/commons/jexl2/JadeIntrospect.java#L44-L87 | train |
olavloite/spanner-jdbc | src/main/java/nl/topicus/jdbc/CloudSpannerPooledConnection.java | CloudSpannerPooledConnection.getConnection | @Override
public ICloudSpannerConnection getConnection() throws SQLException {
if (con == null) {
// Before throwing the exception, let's notify the registered
// listeners about the error
SQLException sqlException = new CloudSpannerSQLException(
"This PooledConnection has alread... | java | @Override
public ICloudSpannerConnection getConnection() throws SQLException {
if (con == null) {
// Before throwing the exception, let's notify the registered
// listeners about the error
SQLException sqlException = new CloudSpannerSQLException(
"This PooledConnection has alread... | [
"@",
"Override",
"public",
"ICloudSpannerConnection",
"getConnection",
"(",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"con",
"==",
"null",
")",
"{",
"// Before throwing the exception, let's notify the registered\r",
"// listeners about the error\r",
"SQLException",
"sqlE... | Gets a handle for a client to use. This is a wrapper around the physical connection, so the
client can call close and it will just return the connection to the pool without really closing
the physical connection.
<p>
According to the JDBC 2.0 Optional Package spec (6.2.3), only one client may have an active
handle to ... | [
"Gets",
"a",
"handle",
"for",
"a",
"client",
"to",
"use",
".",
"This",
"is",
"a",
"wrapper",
"around",
"the",
"physical",
"connection",
"so",
"the",
"client",
"can",
"call",
"close",
"and",
"it",
"will",
"just",
"return",
"the",
"connection",
"to",
"the"... | b65a5185300580b143866e57501a1ea606b59aa5 | https://github.com/olavloite/spanner-jdbc/blob/b65a5185300580b143866e57501a1ea606b59aa5/src/main/java/nl/topicus/jdbc/CloudSpannerPooledConnection.java#L123-L166 | train |
olavloite/spanner-jdbc | src/main/java/nl/topicus/jdbc/CloudSpannerPooledConnection.java | CloudSpannerPooledConnection.fireConnectionFatalError | void fireConnectionFatalError(SQLException e) {
ConnectionEvent evt = null;
// Copy the listener list so the listener can remove itself during this
// method call
ConnectionEventListener[] local =
listeners.toArray(new ConnectionEventListener[listeners.size()]);
for (ConnectionEventLis... | java | void fireConnectionFatalError(SQLException e) {
ConnectionEvent evt = null;
// Copy the listener list so the listener can remove itself during this
// method call
ConnectionEventListener[] local =
listeners.toArray(new ConnectionEventListener[listeners.size()]);
for (ConnectionEventLis... | [
"void",
"fireConnectionFatalError",
"(",
"SQLException",
"e",
")",
"{",
"ConnectionEvent",
"evt",
"=",
"null",
";",
"// Copy the listener list so the listener can remove itself during this\r",
"// method call\r",
"ConnectionEventListener",
"[",
"]",
"local",
"=",
"listeners",
... | Used to fire a connection error event to all listeners. | [
"Used",
"to",
"fire",
"a",
"connection",
"error",
"event",
"to",
"all",
"listeners",
"."
] | b65a5185300580b143866e57501a1ea606b59aa5 | https://github.com/olavloite/spanner-jdbc/blob/b65a5185300580b143866e57501a1ea606b59aa5/src/main/java/nl/topicus/jdbc/CloudSpannerPooledConnection.java#L196-L208 | train |
olavloite/spanner-jdbc | src/main/java/nl/topicus/jdbc/CloudSpannerPooledConnection.java | CloudSpannerPooledConnection.fireConnectionError | private void fireConnectionError(SQLException e) {
Code code = Code.UNKNOWN;
if (e instanceof CloudSpannerSQLException) {
code = ((CloudSpannerSQLException) e).getCode();
}
if (!isFatalState(code)) {
return;
}
fireConnectionFatalError(e);
} | java | private void fireConnectionError(SQLException e) {
Code code = Code.UNKNOWN;
if (e instanceof CloudSpannerSQLException) {
code = ((CloudSpannerSQLException) e).getCode();
}
if (!isFatalState(code)) {
return;
}
fireConnectionFatalError(e);
} | [
"private",
"void",
"fireConnectionError",
"(",
"SQLException",
"e",
")",
"{",
"Code",
"code",
"=",
"Code",
".",
"UNKNOWN",
";",
"if",
"(",
"e",
"instanceof",
"CloudSpannerSQLException",
")",
"{",
"code",
"=",
"(",
"(",
"CloudSpannerSQLException",
")",
"e",
"... | Fires a connection error event, but only if we think the exception is fatal.
@param e the SQLException to consider | [
"Fires",
"a",
"connection",
"error",
"event",
"but",
"only",
"if",
"we",
"think",
"the",
"exception",
"is",
"fatal",
"."
] | b65a5185300580b143866e57501a1ea606b59aa5 | https://github.com/olavloite/spanner-jdbc/blob/b65a5185300580b143866e57501a1ea606b59aa5/src/main/java/nl/topicus/jdbc/CloudSpannerPooledConnection.java#L234-L243 | train |
olavloite/spanner-jdbc | src/main/java/nl/topicus/jdbc/statement/AbstractSpannerExpressionVisitorAdapter.java | AbstractSpannerExpressionVisitorAdapter.visit | @Override
public void visit(Column column) {
String stringValue = column.getColumnName();
if (stringValue.equalsIgnoreCase("true") || stringValue.equalsIgnoreCase("false")) {
setValue(Boolean.valueOf(stringValue), Types.BOOLEAN);
}
} | java | @Override
public void visit(Column column) {
String stringValue = column.getColumnName();
if (stringValue.equalsIgnoreCase("true") || stringValue.equalsIgnoreCase("false")) {
setValue(Boolean.valueOf(stringValue), Types.BOOLEAN);
}
} | [
"@",
"Override",
"public",
"void",
"visit",
"(",
"Column",
"column",
")",
"{",
"String",
"stringValue",
"=",
"column",
".",
"getColumnName",
"(",
")",
";",
"if",
"(",
"stringValue",
".",
"equalsIgnoreCase",
"(",
"\"true\"",
")",
"||",
"stringValue",
".",
"... | Booleans are not recognized by the parser, but are seen as column names.
@param column | [
"Booleans",
"are",
"not",
"recognized",
"by",
"the",
"parser",
"but",
"are",
"seen",
"as",
"column",
"names",
"."
] | b65a5185300580b143866e57501a1ea606b59aa5 | https://github.com/olavloite/spanner-jdbc/blob/b65a5185300580b143866e57501a1ea606b59aa5/src/main/java/nl/topicus/jdbc/statement/AbstractSpannerExpressionVisitorAdapter.java#L109-L115 | train |
olavloite/spanner-jdbc | src/main/java/nl/topicus/jdbc/statement/CloudSpannerStatement.java | CloudSpannerStatement.formatDDLStatement | protected String formatDDLStatement(String sql) {
String result = removeComments(sql);
String[] parts = getTokens(sql, 0);
if (parts.length > 2 && parts[0].equalsIgnoreCase("create")
&& parts[1].equalsIgnoreCase("table")) {
String sqlWithSingleSpaces = String.join(" ", parts);
int ... | java | protected String formatDDLStatement(String sql) {
String result = removeComments(sql);
String[] parts = getTokens(sql, 0);
if (parts.length > 2 && parts[0].equalsIgnoreCase("create")
&& parts[1].equalsIgnoreCase("table")) {
String sqlWithSingleSpaces = String.join(" ", parts);
int ... | [
"protected",
"String",
"formatDDLStatement",
"(",
"String",
"sql",
")",
"{",
"String",
"result",
"=",
"removeComments",
"(",
"sql",
")",
";",
"String",
"[",
"]",
"parts",
"=",
"getTokens",
"(",
"sql",
",",
"0",
")",
";",
"if",
"(",
"parts",
".",
"lengt... | Does some formatting to DDL statements that might have been generated by standard SQL
generators to make it compatible with Google Cloud Spanner. We also need to get rid of any
comments, as Google Cloud Spanner does not accept comments in DDL-statements.
@param sql The sql to format
@return The formatted DDL statement... | [
"Does",
"some",
"formatting",
"to",
"DDL",
"statements",
"that",
"might",
"have",
"been",
"generated",
"by",
"standard",
"SQL",
"generators",
"to",
"make",
"it",
"compatible",
"with",
"Google",
"Cloud",
"Spanner",
".",
"We",
"also",
"need",
"to",
"get",
"rid... | b65a5185300580b143866e57501a1ea606b59aa5 | https://github.com/olavloite/spanner-jdbc/blob/b65a5185300580b143866e57501a1ea606b59aa5/src/main/java/nl/topicus/jdbc/statement/CloudSpannerStatement.java#L63-L81 | train |
olavloite/spanner-jdbc | src/main/java/nl/topicus/jdbc/statement/CloudSpannerStatement.java | CloudSpannerStatement.isDDLStatement | protected boolean isDDLStatement(String[] sqlTokens) {
if (sqlTokens.length > 0) {
for (String statement : DDL_STATEMENTS) {
if (sqlTokens[0].equalsIgnoreCase(statement))
return true;
}
}
return false;
} | java | protected boolean isDDLStatement(String[] sqlTokens) {
if (sqlTokens.length > 0) {
for (String statement : DDL_STATEMENTS) {
if (sqlTokens[0].equalsIgnoreCase(statement))
return true;
}
}
return false;
} | [
"protected",
"boolean",
"isDDLStatement",
"(",
"String",
"[",
"]",
"sqlTokens",
")",
"{",
"if",
"(",
"sqlTokens",
".",
"length",
">",
"0",
")",
"{",
"for",
"(",
"String",
"statement",
":",
"DDL_STATEMENTS",
")",
"{",
"if",
"(",
"sqlTokens",
"[",
"0",
"... | Do a quick check if this SQL statement is a DDL statement
@param sqlTokens The statement to check
@return true if the SQL statement is a DDL statement | [
"Do",
"a",
"quick",
"check",
"if",
"this",
"SQL",
"statement",
"is",
"a",
"DDL",
"statement"
] | b65a5185300580b143866e57501a1ea606b59aa5 | https://github.com/olavloite/spanner-jdbc/blob/b65a5185300580b143866e57501a1ea606b59aa5/src/main/java/nl/topicus/jdbc/statement/CloudSpannerStatement.java#L250-L259 | train |
olavloite/spanner-jdbc | src/main/java/nl/topicus/jdbc/statement/CloudSpannerStatement.java | CloudSpannerStatement.getTokens | protected String[] getTokens(String sql, int limit) {
String result = removeComments(sql);
String generated = result.replaceFirst("=", " = ");
return generated.split("\\s+", limit);
} | java | protected String[] getTokens(String sql, int limit) {
String result = removeComments(sql);
String generated = result.replaceFirst("=", " = ");
return generated.split("\\s+", limit);
} | [
"protected",
"String",
"[",
"]",
"getTokens",
"(",
"String",
"sql",
",",
"int",
"limit",
")",
"{",
"String",
"result",
"=",
"removeComments",
"(",
"sql",
")",
";",
"String",
"generated",
"=",
"result",
".",
"replaceFirst",
"(",
"\"=\"",
",",
"\" = \"",
"... | Remove comments from the given sql string and split it into parts based on all space characters
@param sql The sql statement to break into parts
@param limit The maximum number of times the pattern should be applied
@return String array with all the parts of the sql statement | [
"Remove",
"comments",
"from",
"the",
"given",
"sql",
"string",
"and",
"split",
"it",
"into",
"parts",
"based",
"on",
"all",
"space",
"characters"
] | b65a5185300580b143866e57501a1ea606b59aa5 | https://github.com/olavloite/spanner-jdbc/blob/b65a5185300580b143866e57501a1ea606b59aa5/src/main/java/nl/topicus/jdbc/statement/CloudSpannerStatement.java#L278-L282 | train |
olavloite/spanner-jdbc | src/main/java/nl/topicus/jdbc/statement/CloudSpannerStatement.java | CloudSpannerStatement.getCustomDriverStatement | protected CustomDriverStatement getCustomDriverStatement(String[] sqlTokens) {
if (sqlTokens.length > 0) {
for (CustomDriverStatement statement : customDriverStatements) {
if (sqlTokens[0].equalsIgnoreCase(statement.statement)) {
return statement;
}
}
}
return n... | java | protected CustomDriverStatement getCustomDriverStatement(String[] sqlTokens) {
if (sqlTokens.length > 0) {
for (CustomDriverStatement statement : customDriverStatements) {
if (sqlTokens[0].equalsIgnoreCase(statement.statement)) {
return statement;
}
}
}
return n... | [
"protected",
"CustomDriverStatement",
"getCustomDriverStatement",
"(",
"String",
"[",
"]",
"sqlTokens",
")",
"{",
"if",
"(",
"sqlTokens",
".",
"length",
">",
"0",
")",
"{",
"for",
"(",
"CustomDriverStatement",
"statement",
":",
"customDriverStatements",
")",
"{",
... | Checks if a sql statement is a custom statement only recognized by this driver
@param sqlTokens The statement to check
@return The custom driver statement if the given statement is a custom statement only
recognized by the Cloud Spanner JDBC driver, such as show_ddl_operations | [
"Checks",
"if",
"a",
"sql",
"statement",
"is",
"a",
"custom",
"statement",
"only",
"recognized",
"by",
"this",
"driver"
] | b65a5185300580b143866e57501a1ea606b59aa5 | https://github.com/olavloite/spanner-jdbc/blob/b65a5185300580b143866e57501a1ea606b59aa5/src/main/java/nl/topicus/jdbc/statement/CloudSpannerStatement.java#L473-L482 | train |
olavloite/spanner-jdbc | src/main/java/nl/topicus/jdbc/CloudSpannerConnection.java | CloudSpannerConnection.setDynamicConnectionProperty | public int setDynamicConnectionProperty(String propertyName, String propertyValue)
throws SQLException {
return getPropertySetter(propertyName).apply(Boolean.valueOf(propertyValue));
} | java | public int setDynamicConnectionProperty(String propertyName, String propertyValue)
throws SQLException {
return getPropertySetter(propertyName).apply(Boolean.valueOf(propertyValue));
} | [
"public",
"int",
"setDynamicConnectionProperty",
"(",
"String",
"propertyName",
",",
"String",
"propertyValue",
")",
"throws",
"SQLException",
"{",
"return",
"getPropertySetter",
"(",
"propertyName",
")",
".",
"apply",
"(",
"Boolean",
".",
"valueOf",
"(",
"propertyV... | Set a dynamic connection property, such as AsyncDdlOperations
@param propertyName The name of the dynamic connection property
@param propertyValue The value to set
@return 1 if the property was set, 0 if not (this complies with the normal behaviour of
executeUpdate(...) methods)
@throws SQLException Throws {@link SQLE... | [
"Set",
"a",
"dynamic",
"connection",
"property",
"such",
"as",
"AsyncDdlOperations"
] | b65a5185300580b143866e57501a1ea606b59aa5 | https://github.com/olavloite/spanner-jdbc/blob/b65a5185300580b143866e57501a1ea606b59aa5/src/main/java/nl/topicus/jdbc/CloudSpannerConnection.java#L746-L749 | train |
olavloite/spanner-jdbc | src/main/java/nl/topicus/jdbc/CloudSpannerConnection.java | CloudSpannerConnection.resetDynamicConnectionProperty | public int resetDynamicConnectionProperty(String propertyName) throws SQLException {
return getPropertySetter(propertyName).apply(getOriginalValueGetter(propertyName).get());
} | java | public int resetDynamicConnectionProperty(String propertyName) throws SQLException {
return getPropertySetter(propertyName).apply(getOriginalValueGetter(propertyName).get());
} | [
"public",
"int",
"resetDynamicConnectionProperty",
"(",
"String",
"propertyName",
")",
"throws",
"SQLException",
"{",
"return",
"getPropertySetter",
"(",
"propertyName",
")",
".",
"apply",
"(",
"getOriginalValueGetter",
"(",
"propertyName",
")",
".",
"get",
"(",
")"... | Reset a dynamic connection property to its original value, such as AsyncDdlOperations
@param propertyName The name of the dynamic connection property
@return 1 if the property was reset, 0 if not (this complies with the normal behaviour of
executeUpdate(...) methods)
@throws SQLException Throws {@link SQLException} if... | [
"Reset",
"a",
"dynamic",
"connection",
"property",
"to",
"its",
"original",
"value",
"such",
"as",
"AsyncDdlOperations"
] | b65a5185300580b143866e57501a1ea606b59aa5 | https://github.com/olavloite/spanner-jdbc/blob/b65a5185300580b143866e57501a1ea606b59aa5/src/main/java/nl/topicus/jdbc/CloudSpannerConnection.java#L759-L761 | train |
olavloite/spanner-jdbc | src/main/java/nl/topicus/jdbc/CloudSpannerDatabaseMetaData.java | CloudSpannerDatabaseMetaData.getVersionColumnsOrBestRowIdentifier | private ResultSet getVersionColumnsOrBestRowIdentifier() throws SQLException {
String sql = VERSION_AND_IDENTIFIER_COLUMNS_SELECT_STATEMENT + FROM_STATEMENT_WITHOUT_RESULTS;
CloudSpannerPreparedStatement statement = prepareStatement(sql);
return statement.executeQuery();
} | java | private ResultSet getVersionColumnsOrBestRowIdentifier() throws SQLException {
String sql = VERSION_AND_IDENTIFIER_COLUMNS_SELECT_STATEMENT + FROM_STATEMENT_WITHOUT_RESULTS;
CloudSpannerPreparedStatement statement = prepareStatement(sql);
return statement.executeQuery();
} | [
"private",
"ResultSet",
"getVersionColumnsOrBestRowIdentifier",
"(",
")",
"throws",
"SQLException",
"{",
"String",
"sql",
"=",
"VERSION_AND_IDENTIFIER_COLUMNS_SELECT_STATEMENT",
"+",
"FROM_STATEMENT_WITHOUT_RESULTS",
";",
"CloudSpannerPreparedStatement",
"statement",
"=",
"prepar... | A simple private method that combines the result of two methods that return exactly the same
result
@return An empty {@link ResultSet} containing the columns for the methods
{@link DatabaseMetaData#getBestRowIdentifier(String, String, String, int, boolean)} and
{@link DatabaseMetaData#getVersionColumns(String, String,... | [
"A",
"simple",
"private",
"method",
"that",
"combines",
"the",
"result",
"of",
"two",
"methods",
"that",
"return",
"exactly",
"the",
"same",
"result"
] | b65a5185300580b143866e57501a1ea606b59aa5 | https://github.com/olavloite/spanner-jdbc/blob/b65a5185300580b143866e57501a1ea606b59aa5/src/main/java/nl/topicus/jdbc/CloudSpannerDatabaseMetaData.java#L767-L772 | train |
olavloite/spanner-jdbc | src/main/java/nl/topicus/jdbc/CloudSpannerDriver.java | CloudSpannerDriver.connect | @Override
public CloudSpannerConnection connect(String url, Properties info) throws SQLException {
if (!acceptsURL(url))
return null;
// Parse URL
ConnectionProperties properties = ConnectionProperties.parse(url);
// Get connection properties from properties
properties.setAdditionalCo... | java | @Override
public CloudSpannerConnection connect(String url, Properties info) throws SQLException {
if (!acceptsURL(url))
return null;
// Parse URL
ConnectionProperties properties = ConnectionProperties.parse(url);
// Get connection properties from properties
properties.setAdditionalCo... | [
"@",
"Override",
"public",
"CloudSpannerConnection",
"connect",
"(",
"String",
"url",
",",
"Properties",
"info",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"!",
"acceptsURL",
"(",
"url",
")",
")",
"return",
"null",
";",
"// Parse URL\r",
"ConnectionPropertie... | Connects to a Google Cloud Spanner database.
@param url Connection URL in the form jdbc:cloudspanner://localhost;Project
=projectId;Instance=instanceId ;Database=databaseName;PvtKeyPath
=path_to_key_file;SimulateProductName=product_name
@param info Additional connection properties that will be set on the new connectio... | [
"Connects",
"to",
"a",
"Google",
"Cloud",
"Spanner",
"database",
"."
] | b65a5185300580b143866e57501a1ea606b59aa5 | https://github.com/olavloite/spanner-jdbc/blob/b65a5185300580b143866e57501a1ea606b59aa5/src/main/java/nl/topicus/jdbc/CloudSpannerDriver.java#L130-L160 | train |
olavloite/spanner-jdbc | src/main/java/nl/topicus/jdbc/CloudSpannerDriver.java | CloudSpannerDriver.closeSpanner | public synchronized void closeSpanner() {
try {
for (Entry<Spanner, List<CloudSpannerConnection>> entry : connections.entrySet()) {
List<CloudSpannerConnection> list = entry.getValue();
for (CloudSpannerConnection con : list) {
if (!con.isClosed()) {
con.rollback();... | java | public synchronized void closeSpanner() {
try {
for (Entry<Spanner, List<CloudSpannerConnection>> entry : connections.entrySet()) {
List<CloudSpannerConnection> list = entry.getValue();
for (CloudSpannerConnection con : list) {
if (!con.isClosed()) {
con.rollback();... | [
"public",
"synchronized",
"void",
"closeSpanner",
"(",
")",
"{",
"try",
"{",
"for",
"(",
"Entry",
"<",
"Spanner",
",",
"List",
"<",
"CloudSpannerConnection",
">",
">",
"entry",
":",
"connections",
".",
"entrySet",
"(",
")",
")",
"{",
"List",
"<",
"CloudS... | Closes all connections to Google Cloud Spanner that have been opened by this driver during the
lifetime of this application. You should call this method when you want to shutdown your
application, as this frees up all connections and sessions to Google Cloud Spanner. Failure to
do so, will keep sessions open server sid... | [
"Closes",
"all",
"connections",
"to",
"Google",
"Cloud",
"Spanner",
"that",
"have",
"been",
"opened",
"by",
"this",
"driver",
"during",
"the",
"lifetime",
"of",
"this",
"application",
".",
"You",
"should",
"call",
"this",
"method",
"when",
"you",
"want",
"to... | b65a5185300580b143866e57501a1ea606b59aa5 | https://github.com/olavloite/spanner-jdbc/blob/b65a5185300580b143866e57501a1ea606b59aa5/src/main/java/nl/topicus/jdbc/CloudSpannerDriver.java#L170-L187 | train |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/decorator/HeaderDialogDecorator.java | HeaderDialogDecorator.inflateHeader | private View inflateHeader() {
if (getRootView() != null) {
if (header == null) {
LayoutInflater layoutInflater = LayoutInflater.from(getContext());
header = (ViewGroup) layoutInflater
.inflate(R.layout.material_dialog_header, getRootView(), fa... | java | private View inflateHeader() {
if (getRootView() != null) {
if (header == null) {
LayoutInflater layoutInflater = LayoutInflater.from(getContext());
header = (ViewGroup) layoutInflater
.inflate(R.layout.material_dialog_header, getRootView(), fa... | [
"private",
"View",
"inflateHeader",
"(",
")",
"{",
"if",
"(",
"getRootView",
"(",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"header",
"==",
"null",
")",
"{",
"LayoutInflater",
"layoutInflater",
"=",
"LayoutInflater",
".",
"from",
"(",
"getContext",
"(",
")... | Inflates the dialog's header.
@return The view, which has been inflated, as an instance of the class {@link View} or null,
if no view has been inflated | [
"Inflates",
"the",
"dialog",
"s",
"header",
"."
] | 8990eed72ee5f5a9720836ee708f71ac0d43053b | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/decorator/HeaderDialogDecorator.java#L250-L283 | train |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/decorator/HeaderDialogDecorator.java | HeaderDialogDecorator.adaptHeaderVisibility | private void adaptHeaderVisibility() {
if (header != null) {
if (showHeader) {
header.setVisibility(View.VISIBLE);
notifyOnAreaShown(Area.HEADER);
} else {
header.setVisibility(View.GONE);
notifyOnAreaHidden(Area.HEADER);
... | java | private void adaptHeaderVisibility() {
if (header != null) {
if (showHeader) {
header.setVisibility(View.VISIBLE);
notifyOnAreaShown(Area.HEADER);
} else {
header.setVisibility(View.GONE);
notifyOnAreaHidden(Area.HEADER);
... | [
"private",
"void",
"adaptHeaderVisibility",
"(",
")",
"{",
"if",
"(",
"header",
"!=",
"null",
")",
"{",
"if",
"(",
"showHeader",
")",
"{",
"header",
".",
"setVisibility",
"(",
"View",
".",
"VISIBLE",
")",
";",
"notifyOnAreaShown",
"(",
"Area",
".",
"HEAD... | Adapts the visibility of the dialog's header. | [
"Adapts",
"the",
"visibility",
"of",
"the",
"dialog",
"s",
"header",
"."
] | 8990eed72ee5f5a9720836ee708f71ac0d43053b | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/decorator/HeaderDialogDecorator.java#L298-L308 | train |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/decorator/HeaderDialogDecorator.java | HeaderDialogDecorator.adaptHeaderHeight | private void adaptHeaderHeight() {
if (header != null) {
ViewGroup.LayoutParams layoutParams = header.getLayoutParams();
layoutParams.height = headerHeight;
}
} | java | private void adaptHeaderHeight() {
if (header != null) {
ViewGroup.LayoutParams layoutParams = header.getLayoutParams();
layoutParams.height = headerHeight;
}
} | [
"private",
"void",
"adaptHeaderHeight",
"(",
")",
"{",
"if",
"(",
"header",
"!=",
"null",
")",
"{",
"ViewGroup",
".",
"LayoutParams",
"layoutParams",
"=",
"header",
".",
"getLayoutParams",
"(",
")",
";",
"layoutParams",
".",
"height",
"=",
"headerHeight",
";... | Adapts the height of the dialog's header. | [
"Adapts",
"the",
"height",
"of",
"the",
"dialog",
"s",
"header",
"."
] | 8990eed72ee5f5a9720836ee708f71ac0d43053b | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/decorator/HeaderDialogDecorator.java#L313-L318 | train |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/decorator/HeaderDialogDecorator.java | HeaderDialogDecorator.adaptHeaderBackground | private void adaptHeaderBackground(@Nullable final BackgroundAnimation animation) {
if (headerBackgroundImageView != null) {
Drawable newBackground = headerBackground;
if (animation != null && newBackground != null) {
Drawable previousBackground = headerBackgroundImageVi... | java | private void adaptHeaderBackground(@Nullable final BackgroundAnimation animation) {
if (headerBackgroundImageView != null) {
Drawable newBackground = headerBackground;
if (animation != null && newBackground != null) {
Drawable previousBackground = headerBackgroundImageVi... | [
"private",
"void",
"adaptHeaderBackground",
"(",
"@",
"Nullable",
"final",
"BackgroundAnimation",
"animation",
")",
"{",
"if",
"(",
"headerBackgroundImageView",
"!=",
"null",
")",
"{",
"Drawable",
"newBackground",
"=",
"headerBackground",
";",
"if",
"(",
"animation"... | Adapts the background of the dialog's header.
@param animation
The animation, which should be used to change the background, as an instance of the
class {@link BackgroundAnimation} or null, if no animation should be used | [
"Adapts",
"the",
"background",
"of",
"the",
"dialog",
"s",
"header",
"."
] | 8990eed72ee5f5a9720836ee708f71ac0d43053b | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/decorator/HeaderDialogDecorator.java#L327-L373 | train |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/decorator/HeaderDialogDecorator.java | HeaderDialogDecorator.adaptHeaderIcon | private void adaptHeaderIcon(@Nullable final DrawableAnimation animation) {
if (headerIconImageView != null) {
ImageViewCompat.setImageTintList(headerIconImageView, headerIconTintList);
ImageViewCompat.setImageTintMode(headerIconImageView, headerIconTintMode);
Drawable newIco... | java | private void adaptHeaderIcon(@Nullable final DrawableAnimation animation) {
if (headerIconImageView != null) {
ImageViewCompat.setImageTintList(headerIconImageView, headerIconTintList);
ImageViewCompat.setImageTintMode(headerIconImageView, headerIconTintMode);
Drawable newIco... | [
"private",
"void",
"adaptHeaderIcon",
"(",
"@",
"Nullable",
"final",
"DrawableAnimation",
"animation",
")",
"{",
"if",
"(",
"headerIconImageView",
"!=",
"null",
")",
"{",
"ImageViewCompat",
".",
"setImageTintList",
"(",
"headerIconImageView",
",",
"headerIconTintList"... | Adapt's the icon of the dialog's header.
@param animation
The animation, which should be used to change the icon, as an instance of the class
{@link DrawableAnimation} or null, if no animation should be used | [
"Adapt",
"s",
"the",
"icon",
"of",
"the",
"dialog",
"s",
"header",
"."
] | 8990eed72ee5f5a9720836ee708f71ac0d43053b | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/decorator/HeaderDialogDecorator.java#L382-L436 | train |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/decorator/HeaderDialogDecorator.java | HeaderDialogDecorator.adaptHeaderDividerVisibility | private void adaptHeaderDividerVisibility() {
if (headerDivider != null) {
headerDivider.setVisibility(showHeaderDivider ? View.VISIBLE : View.GONE);
}
} | java | private void adaptHeaderDividerVisibility() {
if (headerDivider != null) {
headerDivider.setVisibility(showHeaderDivider ? View.VISIBLE : View.GONE);
}
} | [
"private",
"void",
"adaptHeaderDividerVisibility",
"(",
")",
"{",
"if",
"(",
"headerDivider",
"!=",
"null",
")",
"{",
"headerDivider",
".",
"setVisibility",
"(",
"showHeaderDivider",
"?",
"View",
".",
"VISIBLE",
":",
"View",
".",
"GONE",
")",
";",
"}",
"}"
] | Adapts the visibility of the divider of the dialog's header. | [
"Adapts",
"the",
"visibility",
"of",
"the",
"divider",
"of",
"the",
"dialog",
"s",
"header",
"."
] | 8990eed72ee5f5a9720836ee708f71ac0d43053b | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/decorator/HeaderDialogDecorator.java#L450-L454 | train |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/decorator/AbstractDecorator.java | AbstractDecorator.attach | @NonNull
public final Map<ViewType, View> attach(@NonNull final Window window, @NonNull final View view,
@NonNull final Map<ViewType, View> areas,
final ParamType param) {
Condition.INSTANCE.ensureNotNull(window, "The wi... | java | @NonNull
public final Map<ViewType, View> attach(@NonNull final Window window, @NonNull final View view,
@NonNull final Map<ViewType, View> areas,
final ParamType param) {
Condition.INSTANCE.ensureNotNull(window, "The wi... | [
"@",
"NonNull",
"public",
"final",
"Map",
"<",
"ViewType",
",",
"View",
">",
"attach",
"(",
"@",
"NonNull",
"final",
"Window",
"window",
",",
"@",
"NonNull",
"final",
"View",
"view",
",",
"@",
"NonNull",
"final",
"Map",
"<",
"ViewType",
",",
"View",
">... | Attaches the decorator to the view hierarchy. This enables the decorator to modify the view
hierarchy until it is detached.
@param window
The window of the dialog, whose view hierarchy should be modified by the decorator,
as an instance of the class {@link Window}. The window may not be null
@param view
The root view ... | [
"Attaches",
"the",
"decorator",
"to",
"the",
"view",
"hierarchy",
".",
"This",
"enables",
"the",
"decorator",
"to",
"modify",
"the",
"view",
"hierarchy",
"until",
"it",
"is",
"detached",
"."
] | 8990eed72ee5f5a9720836ee708f71ac0d43053b | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/decorator/AbstractDecorator.java#L136-L146 | train |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/decorator/AbstractDecorator.java | AbstractDecorator.addAreaListener | public final void addAreaListener(@NonNull final AreaListener listener) {
Condition.INSTANCE.ensureNotNull(listener, "The listener may not be null");
this.areaListeners.add(listener);
} | java | public final void addAreaListener(@NonNull final AreaListener listener) {
Condition.INSTANCE.ensureNotNull(listener, "The listener may not be null");
this.areaListeners.add(listener);
} | [
"public",
"final",
"void",
"addAreaListener",
"(",
"@",
"NonNull",
"final",
"AreaListener",
"listener",
")",
"{",
"Condition",
".",
"INSTANCE",
".",
"ensureNotNull",
"(",
"listener",
",",
"\"The listener may not be null\"",
")",
";",
"this",
".",
"areaListeners",
... | Adds a new listener, which should be notified, when an area is modified by the dialog.
@param listener
The listener, which should be added, as an instance of the type {@link AreaListener}.
The listener may not be null | [
"Adds",
"a",
"new",
"listener",
"which",
"should",
"be",
"notified",
"when",
"an",
"area",
"is",
"modified",
"by",
"the",
"dialog",
"."
] | 8990eed72ee5f5a9720836ee708f71ac0d43053b | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/decorator/AbstractDecorator.java#L166-L169 | train |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/decorator/AbstractDecorator.java | AbstractDecorator.removeAreaListener | public final void removeAreaListener(@NonNull final AreaListener listener) {
Condition.INSTANCE.ensureNotNull(listener, "The listener may not be null");
this.areaListeners.remove(listener);
} | java | public final void removeAreaListener(@NonNull final AreaListener listener) {
Condition.INSTANCE.ensureNotNull(listener, "The listener may not be null");
this.areaListeners.remove(listener);
} | [
"public",
"final",
"void",
"removeAreaListener",
"(",
"@",
"NonNull",
"final",
"AreaListener",
"listener",
")",
"{",
"Condition",
".",
"INSTANCE",
".",
"ensureNotNull",
"(",
"listener",
",",
"\"The listener may not be null\"",
")",
";",
"this",
".",
"areaListeners",... | Removes a specific listener, which should not be notified, when an area is modified by the
decorator, anymore.
@param listener
The listener, which should be added, as an instance of the type {@link AreaListener}.
The listener may not be null | [
"Removes",
"a",
"specific",
"listener",
"which",
"should",
"not",
"be",
"notified",
"when",
"an",
"area",
"is",
"modified",
"by",
"the",
"decorator",
"anymore",
"."
] | 8990eed72ee5f5a9720836ee708f71ac0d43053b | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/decorator/AbstractDecorator.java#L179-L182 | train |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/decorator/AbstractDecorator.java | AbstractDecorator.notifyOnAreaShown | protected final void notifyOnAreaShown(@NonNull final Area area) {
for (AreaListener listener : areaListeners) {
listener.onAreaShown(area);
}
} | java | protected final void notifyOnAreaShown(@NonNull final Area area) {
for (AreaListener listener : areaListeners) {
listener.onAreaShown(area);
}
} | [
"protected",
"final",
"void",
"notifyOnAreaShown",
"(",
"@",
"NonNull",
"final",
"Area",
"area",
")",
"{",
"for",
"(",
"AreaListener",
"listener",
":",
"areaListeners",
")",
"{",
"listener",
".",
"onAreaShown",
"(",
"area",
")",
";",
"}",
"}"
] | Notifies the listeners, which have been registered to be notified, when the visibility of the
dialog's areas has been changed, about an area being shown.
@param area
The area, which has been shown, as a value of the enum {@link Area}. The area may not
be null | [
"Notifies",
"the",
"listeners",
"which",
"have",
"been",
"registered",
"to",
"be",
"notified",
"when",
"the",
"visibility",
"of",
"the",
"dialog",
"s",
"areas",
"has",
"been",
"changed",
"about",
"an",
"area",
"being",
"shown",
"."
] | 8990eed72ee5f5a9720836ee708f71ac0d43053b | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/decorator/AbstractDecorator.java#L192-L196 | train |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/decorator/AbstractDecorator.java | AbstractDecorator.notifyOnAreaHidden | protected final void notifyOnAreaHidden(@NonNull final Area area) {
for (AreaListener listener : areaListeners) {
listener.onAreaHidden(area);
}
} | java | protected final void notifyOnAreaHidden(@NonNull final Area area) {
for (AreaListener listener : areaListeners) {
listener.onAreaHidden(area);
}
} | [
"protected",
"final",
"void",
"notifyOnAreaHidden",
"(",
"@",
"NonNull",
"final",
"Area",
"area",
")",
"{",
"for",
"(",
"AreaListener",
"listener",
":",
"areaListeners",
")",
"{",
"listener",
".",
"onAreaHidden",
"(",
"area",
")",
";",
"}",
"}"
] | Notifies the listeners, which have been registered to be notified, when the visibility of the
dialog's areas has been changed, about an area being hidden.
@param area
The area, which has been hidden, as a value of the enum {@link Area}. The area may
not be null | [
"Notifies",
"the",
"listeners",
"which",
"have",
"been",
"registered",
"to",
"be",
"notified",
"when",
"the",
"visibility",
"of",
"the",
"dialog",
"s",
"areas",
"has",
"been",
"changed",
"about",
"an",
"area",
"being",
"hidden",
"."
] | 8990eed72ee5f5a9720836ee708f71ac0d43053b | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/decorator/AbstractDecorator.java#L206-L210 | train |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java | MaterialDialogDecorator.createWindowInsetsListener | private OnApplyWindowInsetsListener createWindowInsetsListener() {
return new OnApplyWindowInsetsListener() {
@Override
public WindowInsetsCompat onApplyWindowInsets(final View v,
final WindowInsetsCompat insets) {
... | java | private OnApplyWindowInsetsListener createWindowInsetsListener() {
return new OnApplyWindowInsetsListener() {
@Override
public WindowInsetsCompat onApplyWindowInsets(final View v,
final WindowInsetsCompat insets) {
... | [
"private",
"OnApplyWindowInsetsListener",
"createWindowInsetsListener",
"(",
")",
"{",
"return",
"new",
"OnApplyWindowInsetsListener",
"(",
")",
"{",
"@",
"Override",
"public",
"WindowInsetsCompat",
"onApplyWindowInsets",
"(",
"final",
"View",
"v",
",",
"final",
"Window... | Creates and returns a listener, which allows to observe when window insets are applied to the
root view of the view hierarchy, which is modified by the decorator.
@return The listener, which has been created, as an instance of the type {@link
OnApplyWindowInsetsListener} | [
"Creates",
"and",
"returns",
"a",
"listener",
"which",
"allows",
"to",
"observe",
"when",
"window",
"insets",
"are",
"applied",
"to",
"the",
"root",
"view",
"of",
"the",
"view",
"hierarchy",
"which",
"is",
"modified",
"by",
"the",
"decorator",
"."
] | 8990eed72ee5f5a9720836ee708f71ac0d43053b | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java#L560-L576 | train |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java | MaterialDialogDecorator.createLayoutParams | private RelativeLayout.LayoutParams createLayoutParams() {
Rect windowDimensions = new Rect();
Window window = getWindow();
assert window != null;
window.getDecorView().getWindowVisibleDisplayFrame(windowDimensions);
int leftInset = isFitsSystemWindowsLeft() && isFullscreen() && ... | java | private RelativeLayout.LayoutParams createLayoutParams() {
Rect windowDimensions = new Rect();
Window window = getWindow();
assert window != null;
window.getDecorView().getWindowVisibleDisplayFrame(windowDimensions);
int leftInset = isFitsSystemWindowsLeft() && isFullscreen() && ... | [
"private",
"RelativeLayout",
".",
"LayoutParams",
"createLayoutParams",
"(",
")",
"{",
"Rect",
"windowDimensions",
"=",
"new",
"Rect",
"(",
")",
";",
"Window",
"window",
"=",
"getWindow",
"(",
")",
";",
"assert",
"window",
"!=",
"null",
";",
"window",
".",
... | Creates and returns the layout params, which should be used by the dialog's root view.
@return The layout params, which have been created, as an instance of the class {@link
RelativeLayout.LayoutParams} | [
"Creates",
"and",
"returns",
"the",
"layout",
"params",
"which",
"should",
"be",
"used",
"by",
"the",
"dialog",
"s",
"root",
"view",
"."
] | 8990eed72ee5f5a9720836ee708f71ac0d43053b | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java#L584-L638 | train |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java | MaterialDialogDecorator.inflateTitleView | private View inflateTitleView() {
if (getRootView() != null) {
inflateTitleContainer();
if (customTitleView != null) {
titleContainer.addView(customTitleView);
} else if (customTitleViewId != -1) {
LayoutInflater layoutInflater = LayoutInflate... | java | private View inflateTitleView() {
if (getRootView() != null) {
inflateTitleContainer();
if (customTitleView != null) {
titleContainer.addView(customTitleView);
} else if (customTitleViewId != -1) {
LayoutInflater layoutInflater = LayoutInflate... | [
"private",
"View",
"inflateTitleView",
"(",
")",
"{",
"if",
"(",
"getRootView",
"(",
")",
"!=",
"null",
")",
"{",
"inflateTitleContainer",
"(",
")",
";",
"if",
"(",
"customTitleView",
"!=",
"null",
")",
"{",
"titleContainer",
".",
"addView",
"(",
"customTi... | Inflates the view, which is used to show the dialog's title. The view may either be the
default one or a custom view, if one has been set before.
@return The view, which has been inflated, as an instance of the class {@link View} or null,
if no view has been inflated | [
"Inflates",
"the",
"view",
"which",
"is",
"used",
"to",
"show",
"the",
"dialog",
"s",
"title",
".",
"The",
"view",
"may",
"either",
"be",
"the",
"default",
"one",
"or",
"a",
"custom",
"view",
"if",
"one",
"has",
"been",
"set",
"before",
"."
] | 8990eed72ee5f5a9720836ee708f71ac0d43053b | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java#L670-L695 | train |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java | MaterialDialogDecorator.inflateTitleContainer | private void inflateTitleContainer() {
if (titleContainer == null) {
titleContainer = new RelativeLayout(getContext());
titleContainer.setId(R.id.title_container);
titleContainer.setLayoutParams(
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARE... | java | private void inflateTitleContainer() {
if (titleContainer == null) {
titleContainer = new RelativeLayout(getContext());
titleContainer.setId(R.id.title_container);
titleContainer.setLayoutParams(
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARE... | [
"private",
"void",
"inflateTitleContainer",
"(",
")",
"{",
"if",
"(",
"titleContainer",
"==",
"null",
")",
"{",
"titleContainer",
"=",
"new",
"RelativeLayout",
"(",
"getContext",
"(",
")",
")",
";",
"titleContainer",
".",
"setId",
"(",
"R",
".",
"id",
".",... | Inflates the container, which contains the dialog's title, if it is not yet inflated. | [
"Inflates",
"the",
"container",
"which",
"contains",
"the",
"dialog",
"s",
"title",
"if",
"it",
"is",
"not",
"yet",
"inflated",
"."
] | 8990eed72ee5f5a9720836ee708f71ac0d43053b | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java#L700-L710 | train |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java | MaterialDialogDecorator.inflateMessageView | private View inflateMessageView() {
if (getRootView() != null) {
inflateMessageContainer();
if (customMessageView != null) {
messageContainer.addView(customMessageView);
} else if (customMessageViewId != -1) {
LayoutInflater layoutInflater = L... | java | private View inflateMessageView() {
if (getRootView() != null) {
inflateMessageContainer();
if (customMessageView != null) {
messageContainer.addView(customMessageView);
} else if (customMessageViewId != -1) {
LayoutInflater layoutInflater = L... | [
"private",
"View",
"inflateMessageView",
"(",
")",
"{",
"if",
"(",
"getRootView",
"(",
")",
"!=",
"null",
")",
"{",
"inflateMessageContainer",
"(",
")",
";",
"if",
"(",
"customMessageView",
"!=",
"null",
")",
"{",
"messageContainer",
".",
"addView",
"(",
"... | Inflates the view, which is used to show the dialog's message. The view may either be the
default one or a custom view, if one has been set before.
@return The view, which has been inflated, as an instance of the class {@link View} or null,
if no view has been inflated | [
"Inflates",
"the",
"view",
"which",
"is",
"used",
"to",
"show",
"the",
"dialog",
"s",
"message",
".",
"The",
"view",
"may",
"either",
"be",
"the",
"default",
"one",
"or",
"a",
"custom",
"view",
"if",
"one",
"has",
"been",
"set",
"before",
"."
] | 8990eed72ee5f5a9720836ee708f71ac0d43053b | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java#L719-L742 | train |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java | MaterialDialogDecorator.inflateMessageContainer | private void inflateMessageContainer() {
if (messageContainer == null) {
messageContainer = new RelativeLayout(getContext());
messageContainer.setId(R.id.message_container);
messageContainer.setLayoutParams(
new ViewGroup.LayoutParams(ViewGroup.LayoutParam... | java | private void inflateMessageContainer() {
if (messageContainer == null) {
messageContainer = new RelativeLayout(getContext());
messageContainer.setId(R.id.message_container);
messageContainer.setLayoutParams(
new ViewGroup.LayoutParams(ViewGroup.LayoutParam... | [
"private",
"void",
"inflateMessageContainer",
"(",
")",
"{",
"if",
"(",
"messageContainer",
"==",
"null",
")",
"{",
"messageContainer",
"=",
"new",
"RelativeLayout",
"(",
"getContext",
"(",
")",
")",
";",
"messageContainer",
".",
"setId",
"(",
"R",
".",
"id"... | Inflates the container, which contains the dialog's message, if it is not yet inflated. | [
"Inflates",
"the",
"container",
"which",
"contains",
"the",
"dialog",
"s",
"message",
"if",
"it",
"is",
"not",
"yet",
"inflated",
"."
] | 8990eed72ee5f5a9720836ee708f71ac0d43053b | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java#L747-L757 | train |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java | MaterialDialogDecorator.inflateContentView | private View inflateContentView() {
if (getRootView() != null) {
inflateContentContainer();
if (customView != null) {
contentContainer.addView(customView);
} else if (customViewId != -1) {
LayoutInflater layoutInflater = LayoutInflater.from(ge... | java | private View inflateContentView() {
if (getRootView() != null) {
inflateContentContainer();
if (customView != null) {
contentContainer.addView(customView);
} else if (customViewId != -1) {
LayoutInflater layoutInflater = LayoutInflater.from(ge... | [
"private",
"View",
"inflateContentView",
"(",
")",
"{",
"if",
"(",
"getRootView",
"(",
")",
"!=",
"null",
")",
"{",
"inflateContentContainer",
"(",
")",
";",
"if",
"(",
"customView",
"!=",
"null",
")",
"{",
"contentContainer",
".",
"addView",
"(",
"customV... | Inflates the view, which is used to show the dialog's content. The view may either be the
default one or a custom view, if one has been set before.
@return The view, which has been inflated, as an instance of the class {@link View} or null,
if no view has been inflated | [
"Inflates",
"the",
"view",
"which",
"is",
"used",
"to",
"show",
"the",
"dialog",
"s",
"content",
".",
"The",
"view",
"may",
"either",
"be",
"the",
"default",
"one",
"or",
"a",
"custom",
"view",
"if",
"one",
"has",
"been",
"set",
"before",
"."
] | 8990eed72ee5f5a9720836ee708f71ac0d43053b | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java#L766-L783 | train |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java | MaterialDialogDecorator.inflateContentContainer | private void inflateContentContainer() {
if (contentContainer == null) {
contentContainer = new RelativeLayout(getContext());
contentContainer.setId(R.id.content_container);
LinearLayout.LayoutParams layoutParams =
new LinearLayout.LayoutParams(LinearLayou... | java | private void inflateContentContainer() {
if (contentContainer == null) {
contentContainer = new RelativeLayout(getContext());
contentContainer.setId(R.id.content_container);
LinearLayout.LayoutParams layoutParams =
new LinearLayout.LayoutParams(LinearLayou... | [
"private",
"void",
"inflateContentContainer",
"(",
")",
"{",
"if",
"(",
"contentContainer",
"==",
"null",
")",
"{",
"contentContainer",
"=",
"new",
"RelativeLayout",
"(",
"getContext",
"(",
")",
")",
";",
"contentContainer",
".",
"setId",
"(",
"R",
".",
"id"... | Inflates the container, which contains the dialog's content, if it is not yet inflated. | [
"Inflates",
"the",
"container",
"which",
"contains",
"the",
"dialog",
"s",
"content",
"if",
"it",
"is",
"not",
"yet",
"inflated",
"."
] | 8990eed72ee5f5a9720836ee708f71ac0d43053b | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java#L788-L799 | train |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java | MaterialDialogDecorator.adaptWindowBackgroundAndInset | private void adaptWindowBackgroundAndInset() {
DialogRootView rootView = getRootView();
if (rootView != null) {
rootView.setWindowBackgroundAndInset(windowBackground, windowInsets);
}
} | java | private void adaptWindowBackgroundAndInset() {
DialogRootView rootView = getRootView();
if (rootView != null) {
rootView.setWindowBackgroundAndInset(windowBackground, windowInsets);
}
} | [
"private",
"void",
"adaptWindowBackgroundAndInset",
"(",
")",
"{",
"DialogRootView",
"rootView",
"=",
"getRootView",
"(",
")",
";",
"if",
"(",
"rootView",
"!=",
"null",
")",
"{",
"rootView",
".",
"setWindowBackgroundAndInset",
"(",
"windowBackground",
",",
"window... | Adapts the background and inset of the dialog's window. | [
"Adapts",
"the",
"background",
"and",
"inset",
"of",
"the",
"dialog",
"s",
"window",
"."
] | 8990eed72ee5f5a9720836ee708f71ac0d43053b | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java#L804-L810 | train |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java | MaterialDialogDecorator.adaptLayoutParams | private void adaptLayoutParams() {
DialogRootView rootView = getRootView();
if (getWindow() != null && rootView != null) {
rootView.setLayoutParams(createLayoutParams());
rootView.setFullscreen(isFullscreen());
rootView.setMaxWidth(getMaxWidth());
rootVie... | java | private void adaptLayoutParams() {
DialogRootView rootView = getRootView();
if (getWindow() != null && rootView != null) {
rootView.setLayoutParams(createLayoutParams());
rootView.setFullscreen(isFullscreen());
rootView.setMaxWidth(getMaxWidth());
rootVie... | [
"private",
"void",
"adaptLayoutParams",
"(",
")",
"{",
"DialogRootView",
"rootView",
"=",
"getRootView",
"(",
")",
";",
"if",
"(",
"getWindow",
"(",
")",
"!=",
"null",
"&&",
"rootView",
"!=",
"null",
")",
"{",
"rootView",
".",
"setLayoutParams",
"(",
"crea... | Adapts the layout params of the dialog. | [
"Adapts",
"the",
"layout",
"params",
"of",
"the",
"dialog",
"."
] | 8990eed72ee5f5a9720836ee708f71ac0d43053b | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java#L815-L824 | train |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java | MaterialDialogDecorator.adaptPadding | private void adaptPadding() {
ViewGroup dialogRootView = getRootView();
if (dialogRootView != null) {
dialogRootView.setPadding(getPaddingLeft(), getPaddingTop(), getPaddingRight(),
getPaddingBottom());
}
} | java | private void adaptPadding() {
ViewGroup dialogRootView = getRootView();
if (dialogRootView != null) {
dialogRootView.setPadding(getPaddingLeft(), getPaddingTop(), getPaddingRight(),
getPaddingBottom());
}
} | [
"private",
"void",
"adaptPadding",
"(",
")",
"{",
"ViewGroup",
"dialogRootView",
"=",
"getRootView",
"(",
")",
";",
"if",
"(",
"dialogRootView",
"!=",
"null",
")",
"{",
"dialogRootView",
".",
"setPadding",
"(",
"getPaddingLeft",
"(",
")",
",",
"getPaddingTop",... | Adapts the padding of the dialog. | [
"Adapts",
"the",
"padding",
"of",
"the",
"dialog",
"."
] | 8990eed72ee5f5a9720836ee708f71ac0d43053b | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java#L829-L836 | train |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java | MaterialDialogDecorator.adaptIcon | private void adaptIcon() {
if (iconImageView != null) {
ImageViewCompat.setImageTintList(iconImageView, iconTintList);
ImageViewCompat.setImageTintMode(iconImageView, iconTintMode);
iconImageView.setImageDrawable(icon);
iconImageView.setVisibility(icon != null ? V... | java | private void adaptIcon() {
if (iconImageView != null) {
ImageViewCompat.setImageTintList(iconImageView, iconTintList);
ImageViewCompat.setImageTintMode(iconImageView, iconTintMode);
iconImageView.setImageDrawable(icon);
iconImageView.setVisibility(icon != null ? V... | [
"private",
"void",
"adaptIcon",
"(",
")",
"{",
"if",
"(",
"iconImageView",
"!=",
"null",
")",
"{",
"ImageViewCompat",
".",
"setImageTintList",
"(",
"iconImageView",
",",
"iconTintList",
")",
";",
"ImageViewCompat",
".",
"setImageTintMode",
"(",
"iconImageView",
... | Adapts the dialog's icon. | [
"Adapts",
"the",
"dialog",
"s",
"icon",
"."
] | 8990eed72ee5f5a9720836ee708f71ac0d43053b | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java#L948-L957 | train |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java | MaterialDialogDecorator.adaptTitleContainerVisibility | private void adaptTitleContainerVisibility() {
if (titleContainer != null) {
boolean visible = isCustomTitleUsed() || !TextUtils.isEmpty(title) || icon != null;
if (visible) {
titleContainer.setVisibility(View.VISIBLE);
notifyOnAreaShown(Area.TITLE);
... | java | private void adaptTitleContainerVisibility() {
if (titleContainer != null) {
boolean visible = isCustomTitleUsed() || !TextUtils.isEmpty(title) || icon != null;
if (visible) {
titleContainer.setVisibility(View.VISIBLE);
notifyOnAreaShown(Area.TITLE);
... | [
"private",
"void",
"adaptTitleContainerVisibility",
"(",
")",
"{",
"if",
"(",
"titleContainer",
"!=",
"null",
")",
"{",
"boolean",
"visible",
"=",
"isCustomTitleUsed",
"(",
")",
"||",
"!",
"TextUtils",
".",
"isEmpty",
"(",
"title",
")",
"||",
"icon",
"!=",
... | Adapts the visibility of the parent view of the text view, which is used to show the title of
the dialog. | [
"Adapts",
"the",
"visibility",
"of",
"the",
"parent",
"view",
"of",
"the",
"text",
"view",
"which",
"is",
"used",
"to",
"show",
"the",
"title",
"of",
"the",
"dialog",
"."
] | 8990eed72ee5f5a9720836ee708f71ac0d43053b | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java#L963-L975 | train |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java | MaterialDialogDecorator.adaptMessage | private void adaptMessage() {
if (messageTextView != null) {
messageTextView.setText(message);
messageTextView.setVisibility(!TextUtils.isEmpty(message) ? View.VISIBLE : View.GONE);
}
adaptMessageContainerVisibility();
} | java | private void adaptMessage() {
if (messageTextView != null) {
messageTextView.setText(message);
messageTextView.setVisibility(!TextUtils.isEmpty(message) ? View.VISIBLE : View.GONE);
}
adaptMessageContainerVisibility();
} | [
"private",
"void",
"adaptMessage",
"(",
")",
"{",
"if",
"(",
"messageTextView",
"!=",
"null",
")",
"{",
"messageTextView",
".",
"setText",
"(",
"message",
")",
";",
"messageTextView",
".",
"setVisibility",
"(",
"!",
"TextUtils",
".",
"isEmpty",
"(",
"message... | Adapts the dialog's message. | [
"Adapts",
"the",
"dialog",
"s",
"message",
"."
] | 8990eed72ee5f5a9720836ee708f71ac0d43053b | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java#L981-L988 | train |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java | MaterialDialogDecorator.adaptMessageContainerVisibility | private void adaptMessageContainerVisibility() {
if (titleContainer != null) {
boolean visible = isCustomMessageUsed() || !TextUtils.isEmpty(message);
if (visible) {
messageContainer.setVisibility(View.VISIBLE);
notifyOnAreaShown(Area.MESSAGE);
... | java | private void adaptMessageContainerVisibility() {
if (titleContainer != null) {
boolean visible = isCustomMessageUsed() || !TextUtils.isEmpty(message);
if (visible) {
messageContainer.setVisibility(View.VISIBLE);
notifyOnAreaShown(Area.MESSAGE);
... | [
"private",
"void",
"adaptMessageContainerVisibility",
"(",
")",
"{",
"if",
"(",
"titleContainer",
"!=",
"null",
")",
"{",
"boolean",
"visible",
"=",
"isCustomMessageUsed",
"(",
")",
"||",
"!",
"TextUtils",
".",
"isEmpty",
"(",
"message",
")",
";",
"if",
"(",... | Adapts the visibility of the parent view of the text view, which is used to show the message
of the dialog. | [
"Adapts",
"the",
"visibility",
"of",
"the",
"parent",
"view",
"of",
"the",
"text",
"view",
"which",
"is",
"used",
"to",
"show",
"the",
"message",
"of",
"the",
"dialog",
"."
] | 8990eed72ee5f5a9720836ee708f71ac0d43053b | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java#L1012-L1024 | train |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java | MaterialDialogDecorator.adaptBackground | private void adaptBackground(@Nullable final BackgroundAnimation animation) {
if (getRootView() != null && getWindow() != null) {
Drawable newBackground = background;
if (animation != null && newBackground != null) {
View animatedView = isFullscreen() ? getWindow().getDe... | java | private void adaptBackground(@Nullable final BackgroundAnimation animation) {
if (getRootView() != null && getWindow() != null) {
Drawable newBackground = background;
if (animation != null && newBackground != null) {
View animatedView = isFullscreen() ? getWindow().getDe... | [
"private",
"void",
"adaptBackground",
"(",
"@",
"Nullable",
"final",
"BackgroundAnimation",
"animation",
")",
"{",
"if",
"(",
"getRootView",
"(",
")",
"!=",
"null",
"&&",
"getWindow",
"(",
")",
"!=",
"null",
")",
"{",
"Drawable",
"newBackground",
"=",
"backg... | Adapts the dialog's background.
@param animation
The animation, which should be used to change the background, as an instance of the
class {@link BackgroundAnimation} or null, if no animation should be used | [
"Adapts",
"the",
"dialog",
"s",
"background",
"."
] | 8990eed72ee5f5a9720836ee708f71ac0d43053b | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java#L1033-L1083 | train |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java | MaterialDialogDecorator.adaptContentContainerVisibility | private void adaptContentContainerVisibility() {
if (contentContainer != null) {
if (isCustomViewUsed()) {
contentContainer.setVisibility(View.VISIBLE);
notifyOnAreaShown(Area.CONTENT);
} else {
contentContainer.setVisibility(View.GONE);
... | java | private void adaptContentContainerVisibility() {
if (contentContainer != null) {
if (isCustomViewUsed()) {
contentContainer.setVisibility(View.VISIBLE);
notifyOnAreaShown(Area.CONTENT);
} else {
contentContainer.setVisibility(View.GONE);
... | [
"private",
"void",
"adaptContentContainerVisibility",
"(",
")",
"{",
"if",
"(",
"contentContainer",
"!=",
"null",
")",
"{",
"if",
"(",
"isCustomViewUsed",
"(",
")",
")",
"{",
"contentContainer",
".",
"setVisibility",
"(",
"View",
".",
"VISIBLE",
")",
";",
"n... | Adapts the visibility of the parent view of the view, which is used to show the dialog's
content. | [
"Adapts",
"the",
"visibility",
"of",
"the",
"parent",
"view",
"of",
"the",
"view",
"which",
"is",
"used",
"to",
"show",
"the",
"dialog",
"s",
"content",
"."
] | 8990eed72ee5f5a9720836ee708f71ac0d43053b | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/decorator/MaterialDialogDecorator.java#L1089-L1099 | train |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/builder/AbstractListDialogBuilder.java | AbstractListDialogBuilder.obtainItemColor | private void obtainItemColor(@StyleRes final int themeResourceId) {
TypedArray typedArray = getContext().getTheme()
.obtainStyledAttributes(themeResourceId, new int[]{R.attr.materialDialogItemColor});
int defaultColor = ThemeUtil
.getColor(getContext(), themeResourceId, a... | java | private void obtainItemColor(@StyleRes final int themeResourceId) {
TypedArray typedArray = getContext().getTheme()
.obtainStyledAttributes(themeResourceId, new int[]{R.attr.materialDialogItemColor});
int defaultColor = ThemeUtil
.getColor(getContext(), themeResourceId, a... | [
"private",
"void",
"obtainItemColor",
"(",
"@",
"StyleRes",
"final",
"int",
"themeResourceId",
")",
"{",
"TypedArray",
"typedArray",
"=",
"getContext",
"(",
")",
".",
"getTheme",
"(",
")",
".",
"obtainStyledAttributes",
"(",
"themeResourceId",
",",
"new",
"int",... | Obtains the item color from a specific theme.
@param themeResourceId
The resource id of the theme, the item color should be obtained from, as an {@link
Integer} value | [
"Obtains",
"the",
"item",
"color",
"from",
"a",
"specific",
"theme",
"."
] | 8990eed72ee5f5a9720836ee708f71ac0d43053b | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/builder/AbstractListDialogBuilder.java#L55-L61 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.