id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
103,000 | matomo-org/piwik-java-tracker | src/main/java/org/piwik/java/tracking/PiwikRequest.java | PiwikRequest.setParameter | private void setParameter(String key, Object value){
if (value == null){
parameters.remove(key);
}
else{
parameters.put(key, value);
}
} | java | private void setParameter(String key, Object value){
if (value == null){
parameters.remove(key);
}
else{
parameters.put(key, value);
}
} | [
"private",
"void",
"setParameter",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"parameters",
".",
"remove",
"(",
"key",
")",
";",
"}",
"else",
"{",
"parameters",
".",
"put",
"(",
"key",
",",
"... | Set a stored parameter.
@param key the parameter's key
@param value the parameter's value. Removes the parameter if null | [
"Set",
"a",
"stored",
"parameter",
"."
] | 23df71d27a89e89dc7a539b2eda88c90a206458b | https://github.com/matomo-org/piwik-java-tracker/blob/23df71d27a89e89dc7a539b2eda88c90a206458b/src/main/java/org/piwik/java/tracking/PiwikRequest.java#L1757-L1764 |
103,001 | matomo-org/piwik-java-tracker | src/main/java/org/piwik/java/tracking/PiwikRequest.java | PiwikRequest.setNonEmptyStringParameter | private void setNonEmptyStringParameter(String key, String value){
if (value == null){
parameters.remove(key);
}
else if (value.length() == 0){
throw new IllegalArgumentException("Value cannot be empty.");
}
else{
parameters.put(key, value);
... | java | private void setNonEmptyStringParameter(String key, String value){
if (value == null){
parameters.remove(key);
}
else if (value.length() == 0){
throw new IllegalArgumentException("Value cannot be empty.");
}
else{
parameters.put(key, value);
... | [
"private",
"void",
"setNonEmptyStringParameter",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"parameters",
".",
"remove",
"(",
"key",
")",
";",
"}",
"else",
"if",
"(",
"value",
".",
"length",
"(",... | Set a stored parameter and verify it is a non-empty string.
@param key the parameter's key
@param value the parameter's value. Cannot be the empty. Removes the parameter if null
string | [
"Set",
"a",
"stored",
"parameter",
"and",
"verify",
"it",
"is",
"a",
"non",
"-",
"empty",
"string",
"."
] | 23df71d27a89e89dc7a539b2eda88c90a206458b | https://github.com/matomo-org/piwik-java-tracker/blob/23df71d27a89e89dc7a539b2eda88c90a206458b/src/main/java/org/piwik/java/tracking/PiwikRequest.java#L1781-L1791 |
103,002 | matomo-org/piwik-java-tracker | src/main/java/org/piwik/java/tracking/PiwikRequest.java | PiwikRequest.getBooleanParameter | private Boolean getBooleanParameter(String key){
Integer i = (Integer)parameters.get(key);
if (i == null){
return null;
}
return i.equals(1);
} | java | private Boolean getBooleanParameter(String key){
Integer i = (Integer)parameters.get(key);
if (i == null){
return null;
}
return i.equals(1);
} | [
"private",
"Boolean",
"getBooleanParameter",
"(",
"String",
"key",
")",
"{",
"Integer",
"i",
"=",
"(",
"Integer",
")",
"parameters",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"i",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"i",
... | Get a stored parameter that is a boolean.
@param key the parameter's key
@return the stored parameter's value | [
"Get",
"a",
"stored",
"parameter",
"that",
"is",
"a",
"boolean",
"."
] | 23df71d27a89e89dc7a539b2eda88c90a206458b | https://github.com/matomo-org/piwik-java-tracker/blob/23df71d27a89e89dc7a539b2eda88c90a206458b/src/main/java/org/piwik/java/tracking/PiwikRequest.java#L1798-L1804 |
103,003 | matomo-org/piwik-java-tracker | src/main/java/org/piwik/java/tracking/PiwikRequest.java | PiwikRequest.setBooleanParameter | private void setBooleanParameter(String key, Boolean value){
if (value == null){
parameters.remove(key);
}
else if (value){
parameters.put(key, 1);
}
else{
parameters.put(key, 0);
}
} | java | private void setBooleanParameter(String key, Boolean value){
if (value == null){
parameters.remove(key);
}
else if (value){
parameters.put(key, 1);
}
else{
parameters.put(key, 0);
}
} | [
"private",
"void",
"setBooleanParameter",
"(",
"String",
"key",
",",
"Boolean",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"parameters",
".",
"remove",
"(",
"key",
")",
";",
"}",
"else",
"if",
"(",
"value",
")",
"{",
"parameters",
... | Set a stored parameter that is a boolean. This value will be stored as "1"
for true and "0" for false.
@param key the parameter's key
@param value the parameter's value. Removes the parameter if null | [
"Set",
"a",
"stored",
"parameter",
"that",
"is",
"a",
"boolean",
".",
"This",
"value",
"will",
"be",
"stored",
"as",
"1",
"for",
"true",
"and",
"0",
"for",
"false",
"."
] | 23df71d27a89e89dc7a539b2eda88c90a206458b | https://github.com/matomo-org/piwik-java-tracker/blob/23df71d27a89e89dc7a539b2eda88c90a206458b/src/main/java/org/piwik/java/tracking/PiwikRequest.java#L1812-L1822 |
103,004 | matomo-org/piwik-java-tracker | src/main/java/org/piwik/java/tracking/PiwikRequest.java | PiwikRequest.getCustomVariable | private CustomVariable getCustomVariable(String parameter, int index){
CustomVariableList cvl = (CustomVariableList)parameters.get(parameter);
if (cvl == null){
return null;
}
return cvl.get(index);
} | java | private CustomVariable getCustomVariable(String parameter, int index){
CustomVariableList cvl = (CustomVariableList)parameters.get(parameter);
if (cvl == null){
return null;
}
return cvl.get(index);
} | [
"private",
"CustomVariable",
"getCustomVariable",
"(",
"String",
"parameter",
",",
"int",
"index",
")",
"{",
"CustomVariableList",
"cvl",
"=",
"(",
"CustomVariableList",
")",
"parameters",
".",
"get",
"(",
"parameter",
")",
";",
"if",
"(",
"cvl",
"==",
"null",... | Get a value that is stored in a json object at the specified parameter.
@param parameter the parameter to retrieve the json object from
@param key the key of the value. Cannot be null
@return the value | [
"Get",
"a",
"value",
"that",
"is",
"stored",
"in",
"a",
"json",
"object",
"at",
"the",
"specified",
"parameter",
"."
] | 23df71d27a89e89dc7a539b2eda88c90a206458b | https://github.com/matomo-org/piwik-java-tracker/blob/23df71d27a89e89dc7a539b2eda88c90a206458b/src/main/java/org/piwik/java/tracking/PiwikRequest.java#L1830-L1837 |
103,005 | matomo-org/piwik-java-tracker | src/main/java/org/piwik/java/tracking/PiwikRequest.java | PiwikRequest.setCustomVariable | private void setCustomVariable(String parameter, CustomVariable customVariable, Integer index){
CustomVariableList cvl = (CustomVariableList)parameters.get(parameter);
if (cvl == null){
cvl = new CustomVariableList();
parameters.put(parameter, cvl);
}
if ... | java | private void setCustomVariable(String parameter, CustomVariable customVariable, Integer index){
CustomVariableList cvl = (CustomVariableList)parameters.get(parameter);
if (cvl == null){
cvl = new CustomVariableList();
parameters.put(parameter, cvl);
}
if ... | [
"private",
"void",
"setCustomVariable",
"(",
"String",
"parameter",
",",
"CustomVariable",
"customVariable",
",",
"Integer",
"index",
")",
"{",
"CustomVariableList",
"cvl",
"=",
"(",
"CustomVariableList",
")",
"parameters",
".",
"get",
"(",
"parameter",
")",
";",
... | Store a value in a json object at the specified parameter.
@param parameter the parameter to store the json object at
@param key the key of the value. Cannot be null
@param value the value. Removes the parameter if null | [
"Store",
"a",
"value",
"in",
"a",
"json",
"object",
"at",
"the",
"specified",
"parameter",
"."
] | 23df71d27a89e89dc7a539b2eda88c90a206458b | https://github.com/matomo-org/piwik-java-tracker/blob/23df71d27a89e89dc7a539b2eda88c90a206458b/src/main/java/org/piwik/java/tracking/PiwikRequest.java#L1858-L1877 |
103,006 | matomo-org/piwik-java-tracker | src/main/java/org/piwik/java/tracking/PiwikRequest.java | PiwikRequest.getFromJsonArray | private JsonValue getFromJsonArray(String key, int index){
PiwikJsonArray a = (PiwikJsonArray)parameters.get(key);
if (a == null){
return null;
}
return a.get(index);
} | java | private JsonValue getFromJsonArray(String key, int index){
PiwikJsonArray a = (PiwikJsonArray)parameters.get(key);
if (a == null){
return null;
}
return a.get(index);
} | [
"private",
"JsonValue",
"getFromJsonArray",
"(",
"String",
"key",
",",
"int",
"index",
")",
"{",
"PiwikJsonArray",
"a",
"=",
"(",
"PiwikJsonArray",
")",
"parameters",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"a",
"==",
"null",
")",
"{",
"return",
"... | Get the value at the specified index from the json array at the specified
parameter.
@param key the key of the json array to access
@param index the index of the value in the json array
@return the value at the index in the json array | [
"Get",
"the",
"value",
"at",
"the",
"specified",
"index",
"from",
"the",
"json",
"array",
"at",
"the",
"specified",
"parameter",
"."
] | 23df71d27a89e89dc7a539b2eda88c90a206458b | https://github.com/matomo-org/piwik-java-tracker/blob/23df71d27a89e89dc7a539b2eda88c90a206458b/src/main/java/org/piwik/java/tracking/PiwikRequest.java#L1899-L1906 |
103,007 | matomo-org/piwik-java-tracker | src/main/java/org/piwik/java/tracking/PiwikRequest.java | PiwikRequest.addToJsonArray | private void addToJsonArray(String key, JsonValue value){
if (value == null){
throw new NullPointerException("Value cannot be null.");
}
PiwikJsonArray a = (PiwikJsonArray)parameters.get(key);
if (a == null){
a = new PiwikJsonArray();
paramete... | java | private void addToJsonArray(String key, JsonValue value){
if (value == null){
throw new NullPointerException("Value cannot be null.");
}
PiwikJsonArray a = (PiwikJsonArray)parameters.get(key);
if (a == null){
a = new PiwikJsonArray();
paramete... | [
"private",
"void",
"addToJsonArray",
"(",
"String",
"key",
",",
"JsonValue",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Value cannot be null.\"",
")",
";",
"}",
"PiwikJsonArray",
"a",
"=",
"... | Add a value to the json array at the specified parameter
@param key the key of the json array to add to
@param value the value to add. Cannot be null | [
"Add",
"a",
"value",
"to",
"the",
"json",
"array",
"at",
"the",
"specified",
"parameter"
] | 23df71d27a89e89dc7a539b2eda88c90a206458b | https://github.com/matomo-org/piwik-java-tracker/blob/23df71d27a89e89dc7a539b2eda88c90a206458b/src/main/java/org/piwik/java/tracking/PiwikRequest.java#L1912-L1923 |
103,008 | fullcontact/hadoop-sstable | sstable-core/src/main/java/com/fullcontact/cassandra/io/compress/CompressionMetadata.java | CompressionMetadata.readChunkOffsets | private Memory readChunkOffsets(DataInput input) {
try {
int chunkCount = input.readInt();
Memory offsets = Memory.allocate(chunkCount * 8);
for (int i = 0; i < chunkCount; i++) {
try {
offsets.setLong(i * 8, input.readLong());
... | java | private Memory readChunkOffsets(DataInput input) {
try {
int chunkCount = input.readInt();
Memory offsets = Memory.allocate(chunkCount * 8);
for (int i = 0; i < chunkCount; i++) {
try {
offsets.setLong(i * 8, input.readLong());
... | [
"private",
"Memory",
"readChunkOffsets",
"(",
"DataInput",
"input",
")",
"{",
"try",
"{",
"int",
"chunkCount",
"=",
"input",
".",
"readInt",
"(",
")",
";",
"Memory",
"offsets",
"=",
"Memory",
".",
"allocate",
"(",
"chunkCount",
"*",
"8",
")",
";",
"for",... | Read offsets of the individual chunks from the given input.
@param input Source of the data.
@return collection of the chunk offsets. | [
"Read",
"offsets",
"of",
"the",
"individual",
"chunks",
"from",
"the",
"given",
"input",
"."
] | 1189c2cb3a2cbbe03b75fda1cf02698e6283dfb2 | https://github.com/fullcontact/hadoop-sstable/blob/1189c2cb3a2cbbe03b75fda1cf02698e6283dfb2/sstable-core/src/main/java/com/fullcontact/cassandra/io/compress/CompressionMetadata.java#L136-L155 |
103,009 | fullcontact/hadoop-sstable | sstable-core/src/main/java/com/fullcontact/sstable/index/SSTableIndexIndex.java | SSTableIndexIndex.readIndex | public static SSTableIndexIndex readIndex(final FileSystem fileSystem, final Path sstablePath) throws IOException {
final Closer closer = Closer.create();
final Path indexPath = sstablePath.suffix(SSTABLE_INDEX_SUFFIX);
// Detonate if we don't have an index.
final FSDataInputStream inpu... | java | public static SSTableIndexIndex readIndex(final FileSystem fileSystem, final Path sstablePath) throws IOException {
final Closer closer = Closer.create();
final Path indexPath = sstablePath.suffix(SSTABLE_INDEX_SUFFIX);
// Detonate if we don't have an index.
final FSDataInputStream inpu... | [
"public",
"static",
"SSTableIndexIndex",
"readIndex",
"(",
"final",
"FileSystem",
"fileSystem",
",",
"final",
"Path",
"sstablePath",
")",
"throws",
"IOException",
"{",
"final",
"Closer",
"closer",
"=",
"Closer",
".",
"create",
"(",
")",
";",
"final",
"Path",
"... | Read an existing index. Reads and returns the index index, which is a list of chunks defined by the Cassandra
Index.db file along with the configured split size.
@param fileSystem Hadoop file system.
@param sstablePath SSTable Index.db.
@return Index of chunks.
@throws IOException | [
"Read",
"an",
"existing",
"index",
".",
"Reads",
"and",
"returns",
"the",
"index",
"index",
"which",
"is",
"a",
"list",
"of",
"chunks",
"defined",
"by",
"the",
"Cassandra",
"Index",
".",
"db",
"file",
"along",
"with",
"the",
"configured",
"split",
"size",
... | 1189c2cb3a2cbbe03b75fda1cf02698e6283dfb2 | https://github.com/fullcontact/hadoop-sstable/blob/1189c2cb3a2cbbe03b75fda1cf02698e6283dfb2/sstable-core/src/main/java/com/fullcontact/sstable/index/SSTableIndexIndex.java#L52-L69 |
103,010 | fullcontact/hadoop-sstable | sstable-core/src/main/java/com/fullcontact/sstable/index/SSTableIndexOutputFormat.java | SSTableIndexOutputFormat.getOutputCommitter | @Override
public OutputCommitter getOutputCommitter(TaskAttemptContext taskAttemptContext)
throws IOException, InterruptedException {
return new OutputCommitter() {
@Override
public void setupJob(JobContext jobContext) throws IOException {
}
@Over... | java | @Override
public OutputCommitter getOutputCommitter(TaskAttemptContext taskAttemptContext)
throws IOException, InterruptedException {
return new OutputCommitter() {
@Override
public void setupJob(JobContext jobContext) throws IOException {
}
@Over... | [
"@",
"Override",
"public",
"OutputCommitter",
"getOutputCommitter",
"(",
"TaskAttemptContext",
"taskAttemptContext",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"return",
"new",
"OutputCommitter",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"... | and writes to that instead. | [
"and",
"writes",
"to",
"that",
"instead",
"."
] | 1189c2cb3a2cbbe03b75fda1cf02698e6283dfb2 | https://github.com/fullcontact/hadoop-sstable/blob/1189c2cb3a2cbbe03b75fda1cf02698e6283dfb2/sstable-core/src/main/java/com/fullcontact/sstable/index/SSTableIndexOutputFormat.java#L26-L55 |
103,011 | fullcontact/hadoop-sstable | sstable-core/src/main/java/com/fullcontact/sstable/util/CQLUtil.java | CQLUtil.parseCreateStatement | public static CFMetaData parseCreateStatement(String cql) throws RequestValidationException {
final CreateColumnFamilyStatement statement =
(CreateColumnFamilyStatement) QueryProcessor.parseStatement(cql).prepare().statement;
final CFMetaData cfm =
new CFMetaData("assess... | java | public static CFMetaData parseCreateStatement(String cql) throws RequestValidationException {
final CreateColumnFamilyStatement statement =
(CreateColumnFamilyStatement) QueryProcessor.parseStatement(cql).prepare().statement;
final CFMetaData cfm =
new CFMetaData("assess... | [
"public",
"static",
"CFMetaData",
"parseCreateStatement",
"(",
"String",
"cql",
")",
"throws",
"RequestValidationException",
"{",
"final",
"CreateColumnFamilyStatement",
"statement",
"=",
"(",
"CreateColumnFamilyStatement",
")",
"QueryProcessor",
".",
"parseStatement",
"(",... | Parses a CQL CREATE statement into its CFMetaData object
@param cql
@return CFMetaData
@throws RequestValidationException if CQL is invalid | [
"Parses",
"a",
"CQL",
"CREATE",
"statement",
"into",
"its",
"CFMetaData",
"object"
] | 1189c2cb3a2cbbe03b75fda1cf02698e6283dfb2 | https://github.com/fullcontact/hadoop-sstable/blob/1189c2cb3a2cbbe03b75fda1cf02698e6283dfb2/sstable-core/src/main/java/com/fullcontact/sstable/util/CQLUtil.java#L22-L31 |
103,012 | fullcontact/hadoop-sstable | sstable-core/src/main/java/com/fullcontact/sstable/hadoop/IndexOffsetScanner.java | IndexOffsetScanner.next | public long next() {
try {
ByteBufferUtil.readWithShortLength(input);
final long offset = input.readLong();
// TODO: Because this is version ic > ia promotedIndex is true and we need to handle it. See C* Descriptor
skipPromotedIndex(input);
return o... | java | public long next() {
try {
ByteBufferUtil.readWithShortLength(input);
final long offset = input.readLong();
// TODO: Because this is version ic > ia promotedIndex is true and we need to handle it. See C* Descriptor
skipPromotedIndex(input);
return o... | [
"public",
"long",
"next",
"(",
")",
"{",
"try",
"{",
"ByteBufferUtil",
".",
"readWithShortLength",
"(",
"input",
")",
";",
"final",
"long",
"offset",
"=",
"input",
".",
"readLong",
"(",
")",
";",
"// TODO: Because this is version ic > ia promotedIndex is true and we... | Get the next offset from the SSTable index.
@return SSTable offset. | [
"Get",
"the",
"next",
"offset",
"from",
"the",
"SSTable",
"index",
"."
] | 1189c2cb3a2cbbe03b75fda1cf02698e6283dfb2 | https://github.com/fullcontact/hadoop-sstable/blob/1189c2cb3a2cbbe03b75fda1cf02698e6283dfb2/sstable-core/src/main/java/com/fullcontact/sstable/hadoop/IndexOffsetScanner.java#L115-L128 |
103,013 | fullcontact/hadoop-sstable | sstable-core/src/main/java/com/fullcontact/sstable/hadoop/IndexOffsetScanner.java | IndexOffsetScanner.skipPromotedIndex | private void skipPromotedIndex(final DataInput in) throws IOException {
final int size = in.readInt();
if (size <= 0) {
return;
}
FileUtils.skipBytesFully(in, size);
} | java | private void skipPromotedIndex(final DataInput in) throws IOException {
final int size = in.readInt();
if (size <= 0) {
return;
}
FileUtils.skipBytesFully(in, size);
} | [
"private",
"void",
"skipPromotedIndex",
"(",
"final",
"DataInput",
"in",
")",
"throws",
"IOException",
"{",
"final",
"int",
"size",
"=",
"in",
".",
"readInt",
"(",
")",
";",
"if",
"(",
"size",
"<=",
"0",
")",
"{",
"return",
";",
"}",
"FileUtils",
".",
... | Convenience method for skipping promoted index from SSTable index file.
@param in DataInput.
@throws IOException | [
"Convenience",
"method",
"for",
"skipping",
"promoted",
"index",
"from",
"SSTable",
"index",
"file",
"."
] | 1189c2cb3a2cbbe03b75fda1cf02698e6283dfb2 | https://github.com/fullcontact/hadoop-sstable/blob/1189c2cb3a2cbbe03b75fda1cf02698e6283dfb2/sstable-core/src/main/java/com/fullcontact/sstable/hadoop/IndexOffsetScanner.java#L135-L142 |
103,014 | fullcontact/hadoop-sstable | sstable-core/src/main/java/com/fullcontact/sstable/hadoop/mapreduce/SSTableInputFormat.java | SSTableInputFormat.handleFile | private Collection<FileStatus> handleFile(final FileStatus file, final JobContext job) throws IOException {
final List<FileStatus> results = Lists.newArrayList();
if(file.isDir()) {
final Path p = file.getPath();
LOG.debug("Expanding {}", p);
final FileSystem fs = p.... | java | private Collection<FileStatus> handleFile(final FileStatus file, final JobContext job) throws IOException {
final List<FileStatus> results = Lists.newArrayList();
if(file.isDir()) {
final Path p = file.getPath();
LOG.debug("Expanding {}", p);
final FileSystem fs = p.... | [
"private",
"Collection",
"<",
"FileStatus",
">",
"handleFile",
"(",
"final",
"FileStatus",
"file",
",",
"final",
"JobContext",
"job",
")",
"throws",
"IOException",
"{",
"final",
"List",
"<",
"FileStatus",
">",
"results",
"=",
"Lists",
".",
"newArrayList",
"(",... | If we have a directory recursively gather the files we care about for this job.
@param file Root file/directory.
@param job Job context.
@return All files we care about.
@throws IOException | [
"If",
"we",
"have",
"a",
"directory",
"recursively",
"gather",
"the",
"files",
"we",
"care",
"about",
"for",
"this",
"job",
"."
] | 1189c2cb3a2cbbe03b75fda1cf02698e6283dfb2 | https://github.com/fullcontact/hadoop-sstable/blob/1189c2cb3a2cbbe03b75fda1cf02698e6283dfb2/sstable-core/src/main/java/com/fullcontact/sstable/hadoop/mapreduce/SSTableInputFormat.java#L103-L119 |
103,015 | whitfin/siphash-java | src/main/java/io/whitfin/siphash/SipHasherContainer.java | SipHasherContainer.hash | public final long hash(byte[] data, int c, int d) {
return SipHasher.hash(
c, d,
this.v0,
this.v1,
this.v2,
this.v3,
data
);
} | java | public final long hash(byte[] data, int c, int d) {
return SipHasher.hash(
c, d,
this.v0,
this.v1,
this.v2,
this.v3,
data
);
} | [
"public",
"final",
"long",
"hash",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"c",
",",
"int",
"d",
")",
"{",
"return",
"SipHasher",
".",
"hash",
"(",
"c",
",",
"d",
",",
"this",
".",
"v0",
",",
"this",
".",
"v1",
",",
"this",
".",
"v2",
",",... | Hashes input data using the preconfigured state.
@param data
the data to hash and digest.
@param c
the desired rounds of C compression.
@param d
the desired rounds of D compression.
@return
a long value as the output of the hash. | [
"Hashes",
"input",
"data",
"using",
"the",
"preconfigured",
"state",
"."
] | 0744d68238bf6d0258154a8152bf2f4537b3cbb8 | https://github.com/whitfin/siphash-java/blob/0744d68238bf6d0258154a8152bf2f4537b3cbb8/src/main/java/io/whitfin/siphash/SipHasherContainer.java#L78-L87 |
103,016 | whitfin/siphash-java | src/main/java/io/whitfin/siphash/SipHasherStream.java | SipHasherStream.update | public final SipHasherStream update(byte b) {
this.len++;
this.m |= (((long) b & 0xff) << (this.m_idx++ * 8));
if (this.m_idx < 8) {
return this;
}
this.v3 ^= this.m;
for (int i = 0; i < this.c; i++) {
round();
}
this.v0 ^= this.m;
... | java | public final SipHasherStream update(byte b) {
this.len++;
this.m |= (((long) b & 0xff) << (this.m_idx++ * 8));
if (this.m_idx < 8) {
return this;
}
this.v3 ^= this.m;
for (int i = 0; i < this.c; i++) {
round();
}
this.v0 ^= this.m;
... | [
"public",
"final",
"SipHasherStream",
"update",
"(",
"byte",
"b",
")",
"{",
"this",
".",
"len",
"++",
";",
"this",
".",
"m",
"|=",
"(",
"(",
"(",
"long",
")",
"b",
"&",
"0xff",
")",
"<<",
"(",
"this",
".",
"m_idx",
"++",
"*",
"8",
")",
")",
"... | Updates the hash with a single byte.
This will only modify the internal `m` value, nothing will be modified
in the actual `v*` states until an 8-byte block has been provided.
@param b
the byte being added to the digest.
@return
the same {@link SipHasherStream} for chaining. | [
"Updates",
"the",
"hash",
"with",
"a",
"single",
"byte",
"."
] | 0744d68238bf6d0258154a8152bf2f4537b3cbb8 | https://github.com/whitfin/siphash-java/blob/0744d68238bf6d0258154a8152bf2f4537b3cbb8/src/main/java/io/whitfin/siphash/SipHasherStream.java#L106-L120 |
103,017 | whitfin/siphash-java | src/main/java/io/whitfin/siphash/SipHasherStream.java | SipHasherStream.digest | public final long digest() {
byte msgLenMod256 = this.len;
while (this.m_idx < 7) {
update((byte) 0);
}
update(msgLenMod256);
this.v2 ^= 0xff;
for (int i = 0; i < this.d; i++) {
round();
}
return this.v0 ^ this.v1 ^ this.v2 ^ thi... | java | public final long digest() {
byte msgLenMod256 = this.len;
while (this.m_idx < 7) {
update((byte) 0);
}
update(msgLenMod256);
this.v2 ^= 0xff;
for (int i = 0; i < this.d; i++) {
round();
}
return this.v0 ^ this.v1 ^ this.v2 ^ thi... | [
"public",
"final",
"long",
"digest",
"(",
")",
"{",
"byte",
"msgLenMod256",
"=",
"this",
".",
"len",
";",
"while",
"(",
"this",
".",
"m_idx",
"<",
"7",
")",
"{",
"update",
"(",
"(",
"byte",
")",
"0",
")",
";",
"}",
"update",
"(",
"msgLenMod256",
... | Finalizes the digest and returns the hash.
This works by padding to the next 8-byte block, before applying
the compression rounds once more - but this time using D rounds
of compression rather than C.
@return
the final result of the hash as a long. | [
"Finalizes",
"the",
"digest",
"and",
"returns",
"the",
"hash",
"."
] | 0744d68238bf6d0258154a8152bf2f4537b3cbb8 | https://github.com/whitfin/siphash-java/blob/0744d68238bf6d0258154a8152bf2f4537b3cbb8/src/main/java/io/whitfin/siphash/SipHasherStream.java#L147-L161 |
103,018 | whitfin/siphash-java | src/main/java/io/whitfin/siphash/SipHasherStream.java | SipHasherStream.round | private void round() {
this.v0 += this.v1;
this.v2 += this.v3;
this.v1 = rotateLeft(this.v1, 13);
this.v3 = rotateLeft(this.v3, 16);
this.v1 ^= this.v0;
this.v3 ^= this.v2;
this.v0 = rotateLeft(this.v0, 32);
this.v2 += this.v1;
this.v0 += this.v3... | java | private void round() {
this.v0 += this.v1;
this.v2 += this.v3;
this.v1 = rotateLeft(this.v1, 13);
this.v3 = rotateLeft(this.v3, 16);
this.v1 ^= this.v0;
this.v3 ^= this.v2;
this.v0 = rotateLeft(this.v0, 32);
this.v2 += this.v1;
this.v0 += this.v3... | [
"private",
"void",
"round",
"(",
")",
"{",
"this",
".",
"v0",
"+=",
"this",
".",
"v1",
";",
"this",
".",
"v2",
"+=",
"this",
".",
"v3",
";",
"this",
".",
"v1",
"=",
"rotateLeft",
"(",
"this",
".",
"v1",
",",
"13",
")",
";",
"this",
".",
"v3",... | SipRound implementation for internal use. | [
"SipRound",
"implementation",
"for",
"internal",
"use",
"."
] | 0744d68238bf6d0258154a8152bf2f4537b3cbb8 | https://github.com/whitfin/siphash-java/blob/0744d68238bf6d0258154a8152bf2f4537b3cbb8/src/main/java/io/whitfin/siphash/SipHasherStream.java#L166-L184 |
103,019 | whitfin/siphash-java | src/main/java/io/whitfin/siphash/SipHasher.java | SipHasher.hash | public static long hash(byte[] key, byte[] data, int c, int d) {
if (key.length != 16) {
throw new IllegalArgumentException("Key must be exactly 16 bytes!");
}
long k0 = bytesToLong(key, 0);
long k1 = bytesToLong(key, 8);
return hash(
c, d,
I... | java | public static long hash(byte[] key, byte[] data, int c, int d) {
if (key.length != 16) {
throw new IllegalArgumentException("Key must be exactly 16 bytes!");
}
long k0 = bytesToLong(key, 0);
long k1 = bytesToLong(key, 8);
return hash(
c, d,
I... | [
"public",
"static",
"long",
"hash",
"(",
"byte",
"[",
"]",
"key",
",",
"byte",
"[",
"]",
"data",
",",
"int",
"c",
",",
"int",
"d",
")",
"{",
"if",
"(",
"key",
".",
"length",
"!=",
"16",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"... | Hashes a data input for a given key, using the provided rounds
of compression.
@param key
the key to seed the hash with.
@param data
the input data to hash.
@param c
the number of C rounds of compression
@param d
the number of D rounds of compression.
@return
a long value as the output of the hash. | [
"Hashes",
"a",
"data",
"input",
"for",
"a",
"given",
"key",
"using",
"the",
"provided",
"rounds",
"of",
"compression",
"."
] | 0744d68238bf6d0258154a8152bf2f4537b3cbb8 | https://github.com/whitfin/siphash-java/blob/0744d68238bf6d0258154a8152bf2f4537b3cbb8/src/main/java/io/whitfin/siphash/SipHasher.java#L103-L119 |
103,020 | whitfin/siphash-java | src/main/java/io/whitfin/siphash/SipHasher.java | SipHasher.toHexString | public static String toHexString(long hash) {
String hex = Long.toHexString(hash);
if (hex.length() == 16) {
return hex;
}
StringBuilder sb = new StringBuilder();
for (int i = 0, j = 16 - hex.length(); i < j; i++) {
sb.append('0');
}
ret... | java | public static String toHexString(long hash) {
String hex = Long.toHexString(hash);
if (hex.length() == 16) {
return hex;
}
StringBuilder sb = new StringBuilder();
for (int i = 0, j = 16 - hex.length(); i < j; i++) {
sb.append('0');
}
ret... | [
"public",
"static",
"String",
"toHexString",
"(",
"long",
"hash",
")",
"{",
"String",
"hex",
"=",
"Long",
".",
"toHexString",
"(",
"hash",
")",
";",
"if",
"(",
"hex",
".",
"length",
"(",
")",
"==",
"16",
")",
"{",
"return",
"hex",
";",
"}",
"String... | Converts a hash to a hexidecimal representation.
@param hash
the finalized hash value to convert to hex.
@return
a {@link String} representation of the hash. | [
"Converts",
"a",
"hash",
"to",
"a",
"hexidecimal",
"representation",
"."
] | 0744d68238bf6d0258154a8152bf2f4537b3cbb8 | https://github.com/whitfin/siphash-java/blob/0744d68238bf6d0258154a8152bf2f4537b3cbb8/src/main/java/io/whitfin/siphash/SipHasher.java#L162-L175 |
103,021 | whitfin/siphash-java | src/main/java/io/whitfin/siphash/SipHasher.java | SipHasher.bytesToLong | static long bytesToLong(byte[] bytes, int offset) {
long m = 0;
for (int i = 0; i < 8; i++) {
m |= ((((long) bytes[i + offset]) & 0xff) << (8 * i));
}
return m;
} | java | static long bytesToLong(byte[] bytes, int offset) {
long m = 0;
for (int i = 0; i < 8; i++) {
m |= ((((long) bytes[i + offset]) & 0xff) << (8 * i));
}
return m;
} | [
"static",
"long",
"bytesToLong",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
")",
"{",
"long",
"m",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"8",
";",
"i",
"++",
")",
"{",
"m",
"|=",
"(",
"(",
"(",
"(",
"l... | Converts a chunk of 8 bytes to a number in little endian.
Accepts an offset to determine where the chunk begins.
@param bytes
the byte array containing our bytes to convert.
@param offset
the index to start at when chunking bytes.
@return
a long representation, in little endian. | [
"Converts",
"a",
"chunk",
"of",
"8",
"bytes",
"to",
"a",
"number",
"in",
"little",
"endian",
"."
] | 0744d68238bf6d0258154a8152bf2f4537b3cbb8 | https://github.com/whitfin/siphash-java/blob/0744d68238bf6d0258154a8152bf2f4537b3cbb8/src/main/java/io/whitfin/siphash/SipHasher.java#L189-L195 |
103,022 | whitfin/siphash-java | src/main/java/io/whitfin/siphash/SipHasher.java | SipHasher.hash | static long hash(int c, int d, long v0, long v1, long v2, long v3, byte[] data) {
long m;
int last = data.length / 8 * 8;
int i = 0;
int r;
while (i < last) {
m = data[i++] & 0xffL;
for (r = 1; r < 8; r++) {
m |= (data[i++] & 0xffL) << (r ... | java | static long hash(int c, int d, long v0, long v1, long v2, long v3, byte[] data) {
long m;
int last = data.length / 8 * 8;
int i = 0;
int r;
while (i < last) {
m = data[i++] & 0xffL;
for (r = 1; r < 8; r++) {
m |= (data[i++] & 0xffL) << (r ... | [
"static",
"long",
"hash",
"(",
"int",
"c",
",",
"int",
"d",
",",
"long",
"v0",
",",
"long",
"v1",
",",
"long",
"v2",
",",
"long",
"v3",
",",
"byte",
"[",
"]",
"data",
")",
"{",
"long",
"m",
";",
"int",
"last",
"=",
"data",
".",
"length",
"/",... | Internal 0A hashing implementation.
Requires initial state being manually provided (to avoid allocation). The
compression rounds must also be provided, as nothing will be validated in
this layer (such as defaults).
@param c
the rounds of C compression to apply.
@param d
the rounds of D compression to apply.
@param v0... | [
"Internal",
"0A",
"hashing",
"implementation",
"."
] | 0744d68238bf6d0258154a8152bf2f4537b3cbb8 | https://github.com/whitfin/siphash-java/blob/0744d68238bf6d0258154a8152bf2f4537b3cbb8/src/main/java/io/whitfin/siphash/SipHasher.java#L221-L307 |
103,023 | nathanmarz/dfs-datastores | dfs-datastores/src/main/java/com/backtype/support/SubsetSum.java | SubsetSum.split | public static <T extends Value> List<List<T>> split(List<T> input, long targetSize) {
Collections.sort(input, new Comparator<Value>() {
public int compare(Value o1, Value o2) {
return new Long(o1.getValue()).compareTo(new Long(o2.getValue()));
}
});
List<T... | java | public static <T extends Value> List<List<T>> split(List<T> input, long targetSize) {
Collections.sort(input, new Comparator<Value>() {
public int compare(Value o1, Value o2) {
return new Long(o1.getValue()).compareTo(new Long(o2.getValue()));
}
});
List<T... | [
"public",
"static",
"<",
"T",
"extends",
"Value",
">",
"List",
"<",
"List",
"<",
"T",
">",
">",
"split",
"(",
"List",
"<",
"T",
">",
"input",
",",
"long",
"targetSize",
")",
"{",
"Collections",
".",
"sort",
"(",
"input",
",",
"new",
"Comparator",
"... | things that are too big get their own set | [
"things",
"that",
"are",
"too",
"big",
"get",
"their",
"own",
"set"
] | ad2ce6d1ef748bab8444e81fa1617ab5e8b1a43e | https://github.com/nathanmarz/dfs-datastores/blob/ad2ce6d1ef748bab8444e81fa1617ab5e8b1a43e/dfs-datastores/src/main/java/com/backtype/support/SubsetSum.java#L54-L80 |
103,024 | nathanmarz/dfs-datastores | dfs-datastores/src/main/java/com/backtype/hadoop/pail/Pail.java | Pail.checkCombineValidity | private boolean checkCombineValidity(Pail p, CopyArgs args) throws IOException {
if(args.force) return true;
PailSpec mine = getSpec();
PailSpec other = p.getSpec();
PailStructure structure = mine.getStructure();
boolean typesSame = structure.getType().equals(other.getStructure(... | java | private boolean checkCombineValidity(Pail p, CopyArgs args) throws IOException {
if(args.force) return true;
PailSpec mine = getSpec();
PailSpec other = p.getSpec();
PailStructure structure = mine.getStructure();
boolean typesSame = structure.getType().equals(other.getStructure(... | [
"private",
"boolean",
"checkCombineValidity",
"(",
"Pail",
"p",
",",
"CopyArgs",
"args",
")",
"throws",
"IOException",
"{",
"if",
"(",
"args",
".",
"force",
")",
"return",
"true",
";",
"PailSpec",
"mine",
"=",
"getSpec",
"(",
")",
";",
"PailSpec",
"other",... | returns if formats are same | [
"returns",
"if",
"formats",
"are",
"same"
] | ad2ce6d1ef748bab8444e81fa1617ab5e8b1a43e | https://github.com/nathanmarz/dfs-datastores/blob/ad2ce6d1ef748bab8444e81fa1617ab5e8b1a43e/dfs-datastores/src/main/java/com/backtype/hadoop/pail/Pail.java#L312-L330 |
103,025 | nathanmarz/dfs-datastores | dfs-datastores/src/main/java/com/backtype/hadoop/pail/Pail.java | Pail.copyAppend | public void copyAppend(Pail p, CopyArgs args) throws IOException {
args = new CopyArgs(args);
if(args.renameMode==null) args.renameMode = RenameMode.ALWAYS_RENAME;
boolean formatsSame = checkCombineValidity(p, args);
String sourceQual = getQualifiedRoot(p);
String destQual = get... | java | public void copyAppend(Pail p, CopyArgs args) throws IOException {
args = new CopyArgs(args);
if(args.renameMode==null) args.renameMode = RenameMode.ALWAYS_RENAME;
boolean formatsSame = checkCombineValidity(p, args);
String sourceQual = getQualifiedRoot(p);
String destQual = get... | [
"public",
"void",
"copyAppend",
"(",
"Pail",
"p",
",",
"CopyArgs",
"args",
")",
"throws",
"IOException",
"{",
"args",
"=",
"new",
"CopyArgs",
"(",
"args",
")",
";",
"if",
"(",
"args",
".",
"renameMode",
"==",
"null",
")",
"args",
".",
"renameMode",
"="... | Copy append will copy all the files from p into this pail. Appending maintains the
structure that was present in p. | [
"Copy",
"append",
"will",
"copy",
"all",
"the",
"files",
"from",
"p",
"into",
"this",
"pail",
".",
"Appending",
"maintains",
"the",
"structure",
"that",
"was",
"present",
"in",
"p",
"."
] | ad2ce6d1ef748bab8444e81fa1617ab5e8b1a43e | https://github.com/nathanmarz/dfs-datastores/blob/ad2ce6d1ef748bab8444e81fa1617ab5e8b1a43e/dfs-datastores/src/main/java/com/backtype/hadoop/pail/Pail.java#L411-L423 |
103,026 | nathanmarz/dfs-datastores | dfs-datastores/src/main/java/com/backtype/support/Utils.java | Utils.isLong | public static boolean isLong(String input) {
try {
Long.parseLong(input);
return true;
} catch (Exception e) {
return false;
}
} | java | public static boolean isLong(String input) {
try {
Long.parseLong(input);
return true;
} catch (Exception e) {
return false;
}
} | [
"public",
"static",
"boolean",
"isLong",
"(",
"String",
"input",
")",
"{",
"try",
"{",
"Long",
".",
"parseLong",
"(",
"input",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"return",
"false",
";",
"}",
"}"
] | Return true or false if the input is a long
@param input
@return boolean | [
"Return",
"true",
"or",
"false",
"if",
"the",
"input",
"is",
"a",
"long"
] | ad2ce6d1ef748bab8444e81fa1617ab5e8b1a43e | https://github.com/nathanmarz/dfs-datastores/blob/ad2ce6d1ef748bab8444e81fa1617ab5e8b1a43e/dfs-datastores/src/main/java/com/backtype/support/Utils.java#L42-L49 |
103,027 | dhanji/sitebricks | sitebricks/src/main/java/com/google/sitebricks/compiler/HtmlParser.java | HtmlParser.parseAnnotatableText | private void parseAnnotatableText(String text, Element parent) {
AnnotationNode annotation = null;
Matcher matcher = AnnotationParser.WIDGET_ANNOTATION_REGEX.matcher(text);
int previousEnd = 0;
while (matcher.find()){
int start = matcher.start();
// build a new text node for what is between last i... | java | private void parseAnnotatableText(String text, Element parent) {
AnnotationNode annotation = null;
Matcher matcher = AnnotationParser.WIDGET_ANNOTATION_REGEX.matcher(text);
int previousEnd = 0;
while (matcher.find()){
int start = matcher.start();
// build a new text node for what is between last i... | [
"private",
"void",
"parseAnnotatableText",
"(",
"String",
"text",
",",
"Element",
"parent",
")",
"{",
"AnnotationNode",
"annotation",
"=",
"null",
";",
"Matcher",
"matcher",
"=",
"AnnotationParser",
".",
"WIDGET_ANNOTATION_REGEX",
".",
"matcher",
"(",
"text",
")",... | Pulls a text segment apart by annotations within it and creates multiple Text Nodes
applying the annotation to each text segment as approriate.
@param text the text to be processed for annotations
@param parent | [
"Pulls",
"a",
"text",
"segment",
"apart",
"by",
"annotations",
"within",
"it",
"and",
"creates",
"multiple",
"Text",
"Nodes",
"applying",
"the",
"annotation",
"to",
"each",
"text",
"segment",
"as",
"approriate",
"."
] | 8682029a78bd48fb8566173d970800499e9e5d97 | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks/src/main/java/com/google/sitebricks/compiler/HtmlParser.java#L265-L320 |
103,028 | dhanji/sitebricks | sitebricks/src/main/java/com/google/sitebricks/compiler/HtmlParser.java | HtmlParser.addTextNodeToParent | private void addTextNodeToParent (String text, Element parent, AnnotationNode annotation) {
String [] lines = new String[] {text};
if (annotation != null)
lines = splitInTwo(text);
for (int i = 0; i < lines.length; i++){
TextNode textNode = TextNode.createFromEncoded(lines[i], baseUri);
lin... | java | private void addTextNodeToParent (String text, Element parent, AnnotationNode annotation) {
String [] lines = new String[] {text};
if (annotation != null)
lines = splitInTwo(text);
for (int i = 0; i < lines.length; i++){
TextNode textNode = TextNode.createFromEncoded(lines[i], baseUri);
lin... | [
"private",
"void",
"addTextNodeToParent",
"(",
"String",
"text",
",",
"Element",
"parent",
",",
"AnnotationNode",
"annotation",
")",
"{",
"String",
"[",
"]",
"lines",
"=",
"new",
"String",
"[",
"]",
"{",
"text",
"}",
";",
"if",
"(",
"annotation",
"!=",
"... | Break the text up by the first line delimiter. We only want annotations applied to the first line of a block of text
and not to a whole segment.
@param text the text to turn into nodes
@param parent the parent node
@param annotation the current annotation to be applied to the first line of text | [
"Break",
"the",
"text",
"up",
"by",
"the",
"first",
"line",
"delimiter",
".",
"We",
"only",
"want",
"annotations",
"applied",
"to",
"the",
"first",
"line",
"of",
"a",
"block",
"of",
"text",
"and",
"not",
"to",
"a",
"whole",
"segment",
"."
] | 8682029a78bd48fb8566173d970800499e9e5d97 | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks/src/main/java/com/google/sitebricks/compiler/HtmlParser.java#L330-L347 |
103,029 | dhanji/sitebricks | sitebricks/src/main/java/com/google/sitebricks/compiler/HtmlParser.java | HtmlParser.splitInTwo | private String[] splitInTwo(String text) {
Matcher matcher = LINE_SEPARATOR.matcher(text);
while (matcher.find()){
int start = matcher.start();
if (start > 0 && start < text.length()) {
String segment = text.substring(0, start);
if (segment.trim().length() > 0)
return new String[] {text.su... | java | private String[] splitInTwo(String text) {
Matcher matcher = LINE_SEPARATOR.matcher(text);
while (matcher.find()){
int start = matcher.start();
if (start > 0 && start < text.length()) {
String segment = text.substring(0, start);
if (segment.trim().length() > 0)
return new String[] {text.su... | [
"private",
"String",
"[",
"]",
"splitInTwo",
"(",
"String",
"text",
")",
"{",
"Matcher",
"matcher",
"=",
"LINE_SEPARATOR",
".",
"matcher",
"(",
"text",
")",
";",
"while",
"(",
"matcher",
".",
"find",
"(",
")",
")",
"{",
"int",
"start",
"=",
"matcher",
... | Break a text segment apart into two at the first line delimiter which has non-whitespace characters before it.
@param text text to split in two
@return | [
"Break",
"a",
"text",
"segment",
"apart",
"into",
"two",
"at",
"the",
"first",
"line",
"delimiter",
"which",
"has",
"non",
"-",
"whitespace",
"characters",
"before",
"it",
"."
] | 8682029a78bd48fb8566173d970800499e9e5d97 | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks/src/main/java/com/google/sitebricks/compiler/HtmlParser.java#L355-L366 |
103,030 | dhanji/sitebricks | sitebricks/src/main/java/com/google/sitebricks/compiler/HtmlParser.java | HtmlParser.canContain | boolean canContain(Tag parent, Tag child) {
Validate.notNull(child);
if (child.isBlock() && !parent.canContainBlock())
return false;
if (!child.isBlock() && parent.isData())
return false;
if (closingOptional.contains(parent.getName()) && parent.getName().equals(child.getName()))
ret... | java | boolean canContain(Tag parent, Tag child) {
Validate.notNull(child);
if (child.isBlock() && !parent.canContainBlock())
return false;
if (!child.isBlock() && parent.isData())
return false;
if (closingOptional.contains(parent.getName()) && parent.getName().equals(child.getName()))
ret... | [
"boolean",
"canContain",
"(",
"Tag",
"parent",
",",
"Tag",
"child",
")",
"{",
"Validate",
".",
"notNull",
"(",
"child",
")",
";",
"if",
"(",
"child",
".",
"isBlock",
"(",
")",
"&&",
"!",
"parent",
".",
"canContainBlock",
"(",
")",
")",
"return",
"fal... | Test if this tag, the prospective parent, can accept the proposed child.
@param child potential child tag.
@return true if this can contain child. | [
"Test",
"if",
"this",
"tag",
"the",
"prospective",
"parent",
"can",
"accept",
"the",
"proposed",
"child",
"."
] | 8682029a78bd48fb8566173d970800499e9e5d97 | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks/src/main/java/com/google/sitebricks/compiler/HtmlParser.java#L530-L561 |
103,031 | dhanji/sitebricks | sitebricks/src/main/java/com/google/sitebricks/routing/DefaultPageBook.java | DefaultPageBook.readAnnotationValue | static String readAnnotationValue(Annotation annotation) {
try {
Method m = annotation.getClass().getMethod("value");
return (String) m.invoke(annotation);
} catch (NoSuchMethodException e) {
throw new IllegalStateException("Encountered a configured annotation that " +
... | java | static String readAnnotationValue(Annotation annotation) {
try {
Method m = annotation.getClass().getMethod("value");
return (String) m.invoke(annotation);
} catch (NoSuchMethodException e) {
throw new IllegalStateException("Encountered a configured annotation that " +
... | [
"static",
"String",
"readAnnotationValue",
"(",
"Annotation",
"annotation",
")",
"{",
"try",
"{",
"Method",
"m",
"=",
"annotation",
".",
"getClass",
"(",
")",
".",
"getMethod",
"(",
"\"value\"",
")",
";",
"return",
"(",
"String",
")",
"m",
".",
"invoke",
... | A simple utility method that reads the String value attribute of any annotation
instance. | [
"A",
"simple",
"utility",
"method",
"that",
"reads",
"the",
"String",
"value",
"attribute",
"of",
"any",
"annotation",
"instance",
"."
] | 8682029a78bd48fb8566173d970800499e9e5d97 | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks/src/main/java/com/google/sitebricks/routing/DefaultPageBook.java#L913-L929 |
103,032 | dhanji/sitebricks | sitebricks/src/main/java/com/google/sitebricks/compiler/MvelEvaluatorCompiler.java | MvelEvaluatorCompiler.singleBackingTypeParserContext | private ParserContext singleBackingTypeParserContext() throws ExpressionCompileException {
ParserContext context = new ParserContext();
context.setStrongTyping(true);
context.addInput("this", backingType);
PropertyDescriptor[] propertyDescriptors;
try {
propertyDescriptors = Introspector.getB... | java | private ParserContext singleBackingTypeParserContext() throws ExpressionCompileException {
ParserContext context = new ParserContext();
context.setStrongTyping(true);
context.addInput("this", backingType);
PropertyDescriptor[] propertyDescriptors;
try {
propertyDescriptors = Introspector.getB... | [
"private",
"ParserContext",
"singleBackingTypeParserContext",
"(",
")",
"throws",
"ExpressionCompileException",
"{",
"ParserContext",
"context",
"=",
"new",
"ParserContext",
"(",
")",
";",
"context",
".",
"setStrongTyping",
"(",
"true",
")",
";",
"context",
".",
"ad... | generates a parsing context with type information from the backing type's javabean properties | [
"generates",
"a",
"parsing",
"context",
"with",
"type",
"information",
"from",
"the",
"backing",
"type",
"s",
"javabean",
"properties"
] | 8682029a78bd48fb8566173d970800499e9e5d97 | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks/src/main/java/com/google/sitebricks/compiler/MvelEvaluatorCompiler.java#L162-L220 |
103,033 | dhanji/sitebricks | sitebricks/src/main/java/com/google/sitebricks/routing/PathMatcherChain.java | PathMatcherChain.toMatchChain | private static List<PathMatcher> toMatchChain(String path) {
String[] pieces = path.split(PATH_SEPARATOR);
List<PathMatcher> matchers = new ArrayList<PathMatcher>();
for (String piece : pieces) {
matchers.add((piece.startsWith(":")) ? new GreedyPathMatcher(piece) : new SimplePathMat... | java | private static List<PathMatcher> toMatchChain(String path) {
String[] pieces = path.split(PATH_SEPARATOR);
List<PathMatcher> matchers = new ArrayList<PathMatcher>();
for (String piece : pieces) {
matchers.add((piece.startsWith(":")) ? new GreedyPathMatcher(piece) : new SimplePathMat... | [
"private",
"static",
"List",
"<",
"PathMatcher",
">",
"toMatchChain",
"(",
"String",
"path",
")",
"{",
"String",
"[",
"]",
"pieces",
"=",
"path",
".",
"split",
"(",
"PATH_SEPARATOR",
")",
";",
"List",
"<",
"PathMatcher",
">",
"matchers",
"=",
"new",
"Arr... | converts a string path to a tree of heterogenous matchers | [
"converts",
"a",
"string",
"path",
"to",
"a",
"tree",
"of",
"heterogenous",
"matchers"
] | 8682029a78bd48fb8566173d970800499e9e5d97 | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks/src/main/java/com/google/sitebricks/routing/PathMatcherChain.java#L21-L30 |
103,034 | dhanji/sitebricks | sitebricks-mail/src/main/java/com/google/sitebricks/mail/NettyImapClient.java | NettyImapClient.connect | @Override
public synchronized boolean connect(final DisconnectListener listener) {
reset();
ChannelFuture future = bootstrap.connect(new InetSocketAddress(config.getHost(),
config.getPort()));
Channel channel = future.awaitUninterruptibly().getChannel();
if (!future.isSuccess()) {
thro... | java | @Override
public synchronized boolean connect(final DisconnectListener listener) {
reset();
ChannelFuture future = bootstrap.connect(new InetSocketAddress(config.getHost(),
config.getPort()));
Channel channel = future.awaitUninterruptibly().getChannel();
if (!future.isSuccess()) {
thro... | [
"@",
"Override",
"public",
"synchronized",
"boolean",
"connect",
"(",
"final",
"DisconnectListener",
"listener",
")",
"{",
"reset",
"(",
")",
";",
"ChannelFuture",
"future",
"=",
"bootstrap",
".",
"connect",
"(",
"new",
"InetSocketAddress",
"(",
"config",
".",
... | Connects to the IMAP server logs in with the given credentials. | [
"Connects",
"to",
"the",
"IMAP",
"server",
"logs",
"in",
"with",
"the",
"given",
"credentials",
"."
] | 8682029a78bd48fb8566173d970800499e9e5d97 | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks-mail/src/main/java/com/google/sitebricks/mail/NettyImapClient.java#L118-L144 |
103,035 | dhanji/sitebricks | sitebricks-mail/src/main/java/com/google/sitebricks/mail/NettyImapClient.java | NettyImapClient.disconnect | @Override
public synchronized void disconnect() {
try {
// If there is an error with the handler, dont bother logging out.
if (!mailClientHandler.isHalted()) {
if (mailClientHandler.idleRequested.get()) {
log.warn("Disconnect called while IDLE, leaving idle and logging out.");
... | java | @Override
public synchronized void disconnect() {
try {
// If there is an error with the handler, dont bother logging out.
if (!mailClientHandler.isHalted()) {
if (mailClientHandler.idleRequested.get()) {
log.warn("Disconnect called while IDLE, leaving idle and logging out.");
... | [
"@",
"Override",
"public",
"synchronized",
"void",
"disconnect",
"(",
")",
"{",
"try",
"{",
"// If there is an error with the handler, dont bother logging out.",
"if",
"(",
"!",
"mailClientHandler",
".",
"isHalted",
"(",
")",
")",
"{",
"if",
"(",
"mailClientHandler",
... | Logs out of the current IMAP session and releases all resources, including
executor services. | [
"Logs",
"out",
"of",
"the",
"current",
"IMAP",
"session",
"and",
"releases",
"all",
"resources",
"including",
"executor",
"services",
"."
] | 8682029a78bd48fb8566173d970800499e9e5d97 | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks-mail/src/main/java/com/google/sitebricks/mail/NettyImapClient.java#L221-L253 |
103,036 | dhanji/sitebricks | sitebricks/src/main/java/com/google/sitebricks/compiler/Parsing.java | Parsing.tokenize | public static List<Token> tokenize(String warpRawText, EvaluatorCompiler compiler) throws ExpressionCompileException {
ArrayList<Token> tokens = new ArrayList<Token>();
//simple state machine to iterate the text and break it up into chunks
char[] characters = warpRawText.toCharArray();
StringBui... | java | public static List<Token> tokenize(String warpRawText, EvaluatorCompiler compiler) throws ExpressionCompileException {
ArrayList<Token> tokens = new ArrayList<Token>();
//simple state machine to iterate the text and break it up into chunks
char[] characters = warpRawText.toCharArray();
StringBui... | [
"public",
"static",
"List",
"<",
"Token",
">",
"tokenize",
"(",
"String",
"warpRawText",
",",
"EvaluatorCompiler",
"compiler",
")",
"throws",
"ExpressionCompileException",
"{",
"ArrayList",
"<",
"Token",
">",
"tokens",
"=",
"new",
"ArrayList",
"<",
"Token",
">",... | tokenizes text into raw text chunks interspersed with expression chunks | [
"tokenizes",
"text",
"into",
"raw",
"text",
"chunks",
"interspersed",
"with",
"expression",
"chunks"
] | 8682029a78bd48fb8566173d970800499e9e5d97 | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks/src/main/java/com/google/sitebricks/compiler/Parsing.java#L97-L152 |
103,037 | dhanji/sitebricks | sitebricks/src/main/java/com/google/sitebricks/ScanAndCompileBootstrapper.java | ScanAndCompileBootstrapper.collectBindings | private void collectBindings(List<SitebricksModule.LinkingBinder> bindings,
Set<PageBook.Page> pagesToCompile) {
// Reverse the method map for easy lookup of HTTP method annotations.
Map<Class<? extends Annotation>, String> methodSet = null;
//go thru bindings and obtain pag... | java | private void collectBindings(List<SitebricksModule.LinkingBinder> bindings,
Set<PageBook.Page> pagesToCompile) {
// Reverse the method map for easy lookup of HTTP method annotations.
Map<Class<? extends Annotation>, String> methodSet = null;
//go thru bindings and obtain pag... | [
"private",
"void",
"collectBindings",
"(",
"List",
"<",
"SitebricksModule",
".",
"LinkingBinder",
">",
"bindings",
",",
"Set",
"<",
"PageBook",
".",
"Page",
">",
"pagesToCompile",
")",
"{",
"// Reverse the method map for easy lookup of HTTP method annotations.",
"Map",
... | processes all explicit bindings, including static resources. | [
"processes",
"all",
"explicit",
"bindings",
"including",
"static",
"resources",
"."
] | 8682029a78bd48fb8566173d970800499e9e5d97 | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks/src/main/java/com/google/sitebricks/ScanAndCompileBootstrapper.java#L129-L162 |
103,038 | dhanji/sitebricks | sitebricks/src/main/java/com/google/sitebricks/ScanAndCompileBootstrapper.java | ScanAndCompileBootstrapper.scanPagesToCompile | private Set<PageBook.Page> scanPagesToCompile(Set<Class<?>> set) {
Set<Templates.Descriptor> templates = Sets.newHashSet();
Set<PageBook.Page> pagesToCompile = Sets.newHashSet();
for (Class<?> pageClass : set) {
EmbedAs embedAs = pageClass.getAnnotation(EmbedAs.class);
if (null != embedAs) {
... | java | private Set<PageBook.Page> scanPagesToCompile(Set<Class<?>> set) {
Set<Templates.Descriptor> templates = Sets.newHashSet();
Set<PageBook.Page> pagesToCompile = Sets.newHashSet();
for (Class<?> pageClass : set) {
EmbedAs embedAs = pageClass.getAnnotation(EmbedAs.class);
if (null != embedAs) {
... | [
"private",
"Set",
"<",
"PageBook",
".",
"Page",
">",
"scanPagesToCompile",
"(",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"set",
")",
"{",
"Set",
"<",
"Templates",
".",
"Descriptor",
">",
"templates",
"=",
"Sets",
".",
"newHashSet",
"(",
")",
";",
"Se... | goes through the set of scanned classes and builds pages out of them. | [
"goes",
"through",
"the",
"set",
"of",
"scanned",
"classes",
"and",
"builds",
"pages",
"out",
"of",
"them",
"."
] | 8682029a78bd48fb8566173d970800499e9e5d97 | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks/src/main/java/com/google/sitebricks/ScanAndCompileBootstrapper.java#L165-L209 |
103,039 | dhanji/sitebricks | sitebricks/src/main/java/com/google/sitebricks/rendering/control/DecorateWidget.java | DecorateWidget.nextDecoratedClassInHierarchy | private Class<?> nextDecoratedClassInHierarchy(Class<?> previousTemplateClass,
Class<?> candidate) {
if (candidate == previousTemplateClass) {
// terminate the recursion
return null;
} else if (candidate == Object.class) {
// this should n... | java | private Class<?> nextDecoratedClassInHierarchy(Class<?> previousTemplateClass,
Class<?> candidate) {
if (candidate == previousTemplateClass) {
// terminate the recursion
return null;
} else if (candidate == Object.class) {
// this should n... | [
"private",
"Class",
"<",
"?",
">",
"nextDecoratedClassInHierarchy",
"(",
"Class",
"<",
"?",
">",
"previousTemplateClass",
",",
"Class",
"<",
"?",
">",
"candidate",
")",
"{",
"if",
"(",
"candidate",
"==",
"previousTemplateClass",
")",
"{",
"// terminate the recur... | recursively find the next superclass with an @Decorated annotation | [
"recursively",
"find",
"the",
"next",
"superclass",
"with",
"an"
] | 8682029a78bd48fb8566173d970800499e9e5d97 | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks/src/main/java/com/google/sitebricks/rendering/control/DecorateWidget.java#L74-L90 |
103,040 | dhanji/sitebricks | sitebricks-mail/src/main/java/com/google/sitebricks/mail/imap/Message.java | Message.setBody | @Override public void setBody(String body) {
assert bodyParts.isEmpty() : "Unexpected set body call to a multipart email";
bodyParts.add(new BodyPart(body));
} | java | @Override public void setBody(String body) {
assert bodyParts.isEmpty() : "Unexpected set body call to a multipart email";
bodyParts.add(new BodyPart(body));
} | [
"@",
"Override",
"public",
"void",
"setBody",
"(",
"String",
"body",
")",
"{",
"assert",
"bodyParts",
".",
"isEmpty",
"(",
")",
":",
"\"Unexpected set body call to a multipart email\"",
";",
"bodyParts",
".",
"add",
"(",
"new",
"BodyPart",
"(",
"body",
")",
")... | Short hand. | [
"Short",
"hand",
"."
] | 8682029a78bd48fb8566173d970800499e9e5d97 | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks-mail/src/main/java/com/google/sitebricks/mail/imap/Message.java#L58-L61 |
103,041 | dhanji/sitebricks | sitebricks-mail/src/main/java/com/google/sitebricks/mail/imap/StoreLabelsResponseExtractor.java | StoreLabelsResponseExtractor.extract | @Override
public Set<String> extract(List<String> messages) throws ExtractionException {
boolean gotFetch = false;
Set<String> result = null;
// Find FETCH, throw error if none or more than one, or if we receive an error response.
String fetchStr = null;
for (int i = 0, messagesSize = messages.si... | java | @Override
public Set<String> extract(List<String> messages) throws ExtractionException {
boolean gotFetch = false;
Set<String> result = null;
// Find FETCH, throw error if none or more than one, or if we receive an error response.
String fetchStr = null;
for (int i = 0, messagesSize = messages.si... | [
"@",
"Override",
"public",
"Set",
"<",
"String",
">",
"extract",
"(",
"List",
"<",
"String",
">",
"messages",
")",
"throws",
"ExtractionException",
"{",
"boolean",
"gotFetch",
"=",
"false",
";",
"Set",
"<",
"String",
">",
"result",
"=",
"null",
";",
"// ... | Parse the response, which includes label settings and command status.
We expect only one FETCH response as we only set labels on one msg.
http://code.google.com/apis/gmail/imap/#x-gm-labels
C: a011 STORE_FLAGS 1 +X-GM-LABELS (foo)
S: * 1 FETCH (X-GM-LABELS (\Inbox \Sent Important "Muy Importante" foo))
S: a011 OK STOR... | [
"Parse",
"the",
"response",
"which",
"includes",
"label",
"settings",
"and",
"command",
"status",
".",
"We",
"expect",
"only",
"one",
"FETCH",
"response",
"as",
"we",
"only",
"set",
"labels",
"on",
"one",
"msg",
"."
] | 8682029a78bd48fb8566173d970800499e9e5d97 | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks-mail/src/main/java/com/google/sitebricks/mail/imap/StoreLabelsResponseExtractor.java#L33-L70 |
103,042 | dhanji/sitebricks | sitebricks-mail/src/main/java/com/google/sitebricks/mail/MailClientHandler.java | MailClientHandler.enqueue | public void enqueue(CommandCompletion completion) {
completions.add(completion);
commandTrace.add(new Date().toString() + " " + completion.toString());
} | java | public void enqueue(CommandCompletion completion) {
completions.add(completion);
commandTrace.add(new Date().toString() + " " + completion.toString());
} | [
"public",
"void",
"enqueue",
"(",
"CommandCompletion",
"completion",
")",
"{",
"completions",
".",
"add",
"(",
"completion",
")",
";",
"commandTrace",
".",
"add",
"(",
"new",
"Date",
"(",
")",
".",
"toString",
"(",
")",
"+",
"\" \"",
"+",
"completion",
"... | DO NOT synchronize! | [
"DO",
"NOT",
"synchronize!"
] | 8682029a78bd48fb8566173d970800499e9e5d97 | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks-mail/src/main/java/com/google/sitebricks/mail/MailClientHandler.java#L121-L124 |
103,043 | dhanji/sitebricks | sitebricks-mail/src/main/java/com/google/sitebricks/mail/MailClientHandler.java | MailClientHandler.complete | private synchronized void complete(String message) {
// This is a weird problem with writing stuff while idling. Need to investigate it more, but
// for now just ignore it.
if (MESSAGE_COULDNT_BE_FETCHED_REGEX.matcher(message).matches()) {
log.warn("Some messages in the batch could not be fetched... | java | private synchronized void complete(String message) {
// This is a weird problem with writing stuff while idling. Need to investigate it more, but
// for now just ignore it.
if (MESSAGE_COULDNT_BE_FETCHED_REGEX.matcher(message).matches()) {
log.warn("Some messages in the batch could not be fetched... | [
"private",
"synchronized",
"void",
"complete",
"(",
"String",
"message",
")",
"{",
"// This is a weird problem with writing stuff while idling. Need to investigate it more, but",
"// for now just ignore it.",
"if",
"(",
"MESSAGE_COULDNT_BE_FETCHED_REGEX",
".",
"matcher",
"(",
"mess... | This is synchronized to ensure that we process the queue serially. | [
"This",
"is",
"synchronized",
"to",
"ensure",
"that",
"we",
"process",
"the",
"queue",
"serially",
"."
] | 8682029a78bd48fb8566173d970800499e9e5d97 | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks-mail/src/main/java/com/google/sitebricks/mail/MailClientHandler.java#L263-L304 |
103,044 | dhanji/sitebricks | sitebricks-mail/src/main/java/com/google/sitebricks/mail/MailClientHandler.java | MailClientHandler.observe | void observe(FolderObserver observer) {
synchronized (idleMutex) {
this.observer = observer;
pushedData = new PushedData();
idleAcknowledged.set(false);
}
} | java | void observe(FolderObserver observer) {
synchronized (idleMutex) {
this.observer = observer;
pushedData = new PushedData();
idleAcknowledged.set(false);
}
} | [
"void",
"observe",
"(",
"FolderObserver",
"observer",
")",
"{",
"synchronized",
"(",
"idleMutex",
")",
"{",
"this",
".",
"observer",
"=",
"observer",
";",
"pushedData",
"=",
"new",
"PushedData",
"(",
")",
";",
"idleAcknowledged",
".",
"set",
"(",
"false",
... | Registers a FolderObserver to receive events happening with a particular
folder. Typically an IMAP IDLE feature. If called multiple times, will
overwrite the currently set observer. | [
"Registers",
"a",
"FolderObserver",
"to",
"receive",
"events",
"happening",
"with",
"a",
"particular",
"folder",
".",
"Typically",
"an",
"IMAP",
"IDLE",
"feature",
".",
"If",
"called",
"multiple",
"times",
"will",
"overwrite",
"the",
"currently",
"set",
"observe... | 8682029a78bd48fb8566173d970800499e9e5d97 | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks-mail/src/main/java/com/google/sitebricks/mail/MailClientHandler.java#L343-L349 |
103,045 | dhanji/sitebricks | sitebricks/src/main/java/com/google/sitebricks/Localizer.java | Localizer.defaultLocalizationFor | public static Localization defaultLocalizationFor(Class<?> iface) {
Map<String, String> defaultMessages = Maps.newHashMap();
for (Method method : iface.getMethods()) {
Message msg = method.getAnnotation(Message.class);
if (null != msg) {
defaultMessages.put(method.getName(), msg.message());... | java | public static Localization defaultLocalizationFor(Class<?> iface) {
Map<String, String> defaultMessages = Maps.newHashMap();
for (Method method : iface.getMethods()) {
Message msg = method.getAnnotation(Message.class);
if (null != msg) {
defaultMessages.put(method.getName(), msg.message());... | [
"public",
"static",
"Localization",
"defaultLocalizationFor",
"(",
"Class",
"<",
"?",
">",
"iface",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"defaultMessages",
"=",
"Maps",
".",
"newHashMap",
"(",
")",
";",
"for",
"(",
"Method",
"method",
":",
... | Returns a localization value object describing the defaults specified in the @Message
annotations of the methods on the given i18n interface. The locale used is the system
default. | [
"Returns",
"a",
"localization",
"value",
"object",
"describing",
"the",
"defaults",
"specified",
"in",
"the"
] | 8682029a78bd48fb8566173d970800499e9e5d97 | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks/src/main/java/com/google/sitebricks/Localizer.java#L256-L267 |
103,046 | dhanji/sitebricks | sitebricks-mail/src/main/java/com/google/sitebricks/mail/oauth/XoauthSasl.java | XoauthSasl.build | public String build(Protocol protocol, String oauthToken, String oauthTokenSecret)
throws IOException, OAuthException, URISyntaxException {
OAuthAccessor accessor = new OAuthAccessor(consumer);
accessor.tokenSecret = oauthTokenSecret;
Map<String, String> parameters = new HashMap<String, String>();
... | java | public String build(Protocol protocol, String oauthToken, String oauthTokenSecret)
throws IOException, OAuthException, URISyntaxException {
OAuthAccessor accessor = new OAuthAccessor(consumer);
accessor.tokenSecret = oauthTokenSecret;
Map<String, String> parameters = new HashMap<String, String>();
... | [
"public",
"String",
"build",
"(",
"Protocol",
"protocol",
",",
"String",
"oauthToken",
",",
"String",
"oauthTokenSecret",
")",
"throws",
"IOException",
",",
"OAuthException",
",",
"URISyntaxException",
"{",
"OAuthAccessor",
"accessor",
"=",
"new",
"OAuthAccessor",
"... | Builds an XOAUTH SASL client response.
@return A base-64 encoded containing the auth string suitable for login via xoauth. | [
"Builds",
"an",
"XOAUTH",
"SASL",
"client",
"response",
"."
] | 8682029a78bd48fb8566173d970800499e9e5d97 | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks-mail/src/main/java/com/google/sitebricks/mail/oauth/XoauthSasl.java#L32-L66 |
103,047 | dhanji/sitebricks | sitebricks-converter/src/main/java/com/google/sitebricks/conversion/generics/Generics.java | Generics.erase | public static Class<?> erase(Type type)
{
if (type instanceof Class<?>)
{
return (Class<?>) type;
}
else if (type instanceof ParameterizedType)
{
return (Class<?>) ((ParameterizedType) type).getRawType();
}
else if (type instanceof TypeVariable<?>)
{
TypeVariable<?> tv = (TypeVaria... | java | public static Class<?> erase(Type type)
{
if (type instanceof Class<?>)
{
return (Class<?>) type;
}
else if (type instanceof ParameterizedType)
{
return (Class<?>) ((ParameterizedType) type).getRawType();
}
else if (type instanceof TypeVariable<?>)
{
TypeVariable<?> tv = (TypeVaria... | [
"public",
"static",
"Class",
"<",
"?",
">",
"erase",
"(",
"Type",
"type",
")",
"{",
"if",
"(",
"type",
"instanceof",
"Class",
"<",
"?",
">",
")",
"{",
"return",
"(",
"Class",
"<",
"?",
">",
")",
"type",
";",
"}",
"else",
"if",
"(",
"type",
"ins... | Returns the erasure of the given type. | [
"Returns",
"the",
"erasure",
"of",
"the",
"given",
"type",
"."
] | 8682029a78bd48fb8566173d970800499e9e5d97 | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks-converter/src/main/java/com/google/sitebricks/conversion/generics/Generics.java#L27-L55 |
103,048 | dhanji/sitebricks | sitebricks-converter/src/main/java/com/google/sitebricks/conversion/generics/Generics.java | Generics.mapTypeParameters | private static Type mapTypeParameters(Type toMapType, Type typeAndParams)
{
if (isMissingTypeParameters(typeAndParams))
{
return erase(toMapType);
}
else
{
VarMap varMap = new VarMap();
Type handlingTypeAndParams = typeAndParams;
while (handlingTypeAndParams instanceof ParameterizedType... | java | private static Type mapTypeParameters(Type toMapType, Type typeAndParams)
{
if (isMissingTypeParameters(typeAndParams))
{
return erase(toMapType);
}
else
{
VarMap varMap = new VarMap();
Type handlingTypeAndParams = typeAndParams;
while (handlingTypeAndParams instanceof ParameterizedType... | [
"private",
"static",
"Type",
"mapTypeParameters",
"(",
"Type",
"toMapType",
",",
"Type",
"typeAndParams",
")",
"{",
"if",
"(",
"isMissingTypeParameters",
"(",
"typeAndParams",
")",
")",
"{",
"return",
"erase",
"(",
"toMapType",
")",
";",
"}",
"else",
"{",
"V... | Maps type parameters in a type to their values.
@param toMapType
Type possibly containing type arguments
@param typeAndParams
must be either ParameterizedType, or (in case there are no
type arguments, or it's a raw type) Class
@return toMapType, but with type parameters from typeAndParams replaced. | [
"Maps",
"type",
"parameters",
"in",
"a",
"type",
"to",
"their",
"values",
"."
] | 8682029a78bd48fb8566173d970800499e9e5d97 | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks-converter/src/main/java/com/google/sitebricks/conversion/generics/Generics.java#L67-L88 |
103,049 | dhanji/sitebricks | sitebricks/src/main/java/com/google/sitebricks/compiler/HtmlTemplateCompiler.java | HtmlTemplateCompiler.walk | @NotNull
private <N extends Node> WidgetChain walk(PageCompilingContext pc, N node) {
WidgetChain widgetChain = Chains.proceeding();
for (Node n: node.childNodes()) {
if (n instanceof Element) {
final Element child = (Element) n;
//push form if this is a ... | java | @NotNull
private <N extends Node> WidgetChain walk(PageCompilingContext pc, N node) {
WidgetChain widgetChain = Chains.proceeding();
for (Node n: node.childNodes()) {
if (n instanceof Element) {
final Element child = (Element) n;
//push form if this is a ... | [
"@",
"NotNull",
"private",
"<",
"N",
"extends",
"Node",
">",
"WidgetChain",
"walk",
"(",
"PageCompilingContext",
"pc",
",",
"N",
"node",
")",
"{",
"WidgetChain",
"widgetChain",
"=",
"Chains",
".",
"proceeding",
"(",
")",
";",
"for",
"(",
"Node",
"n",
":"... | Walks the DOM recursively, and converts elements into corresponding sitebricks widgets. | [
"Walks",
"the",
"DOM",
"recursively",
"and",
"converts",
"elements",
"into",
"corresponding",
"sitebricks",
"widgets",
"."
] | 8682029a78bd48fb8566173d970800499e9e5d97 | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks/src/main/java/com/google/sitebricks/compiler/HtmlTemplateCompiler.java#L110-L201 |
103,050 | dhanji/sitebricks | sitebricks/src/main/java/com/google/sitebricks/compiler/HtmlTemplateCompiler.java | HtmlTemplateCompiler.lexicalClimb | private boolean lexicalClimb(PageCompilingContext pc, Node node) {
if (node.attr(ANNOTATION).length()>1) {
// Setup a new lexical scope (symbol table changes on each scope encountered).
if (REPEAT_WIDGET.equalsIgnoreCase(node.attr(ANNOTATION_KEY))
|| CHOOSE_WIDGET.equals... | java | private boolean lexicalClimb(PageCompilingContext pc, Node node) {
if (node.attr(ANNOTATION).length()>1) {
// Setup a new lexical scope (symbol table changes on each scope encountered).
if (REPEAT_WIDGET.equalsIgnoreCase(node.attr(ANNOTATION_KEY))
|| CHOOSE_WIDGET.equals... | [
"private",
"boolean",
"lexicalClimb",
"(",
"PageCompilingContext",
"pc",
",",
"Node",
"node",
")",
"{",
"if",
"(",
"node",
".",
"attr",
"(",
"ANNOTATION",
")",
".",
"length",
"(",
")",
">",
"1",
")",
"{",
"// Setup a new lexical scope (symbol table changes on ea... | Called to push a new lexical scope onto the stack. | [
"Called",
"to",
"push",
"a",
"new",
"lexical",
"scope",
"onto",
"the",
"stack",
"."
] | 8682029a78bd48fb8566173d970800499e9e5d97 | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks/src/main/java/com/google/sitebricks/compiler/HtmlTemplateCompiler.java#L225-L251 |
103,051 | dhanji/sitebricks | sitebricks/src/main/java/com/google/sitebricks/compiler/HtmlTemplateCompiler.java | HtmlTemplateCompiler.checkEmbedAgainst | private void checkEmbedAgainst(PageCompilingContext pc, EvaluatorCompiler compiler, Map<String, String> properties, Class<?> embedClass, Node node) {
// TODO also type check them against expressions
for (String property : properties.keySet()) {
try {
if (!compiler.isWritable(property)) {
... | java | private void checkEmbedAgainst(PageCompilingContext pc, EvaluatorCompiler compiler, Map<String, String> properties, Class<?> embedClass, Node node) {
// TODO also type check them against expressions
for (String property : properties.keySet()) {
try {
if (!compiler.isWritable(property)) {
... | [
"private",
"void",
"checkEmbedAgainst",
"(",
"PageCompilingContext",
"pc",
",",
"EvaluatorCompiler",
"compiler",
",",
"Map",
"<",
"String",
",",
"String",
">",
"properties",
",",
"Class",
"<",
"?",
">",
"embedClass",
",",
"Node",
"node",
")",
"{",
"// TODO als... | Ensures that embed bound properties are writable | [
"Ensures",
"that",
"embed",
"bound",
"properties",
"are",
"writable"
] | 8682029a78bd48fb8566173d970800499e9e5d97 | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks/src/main/java/com/google/sitebricks/compiler/HtmlTemplateCompiler.java#L520-L543 |
103,052 | dhanji/sitebricks | sitebricks/src/main/java/com/google/sitebricks/compiler/HtmlTemplateCompiler.java | HtmlTemplateCompiler.findSiblings | public List<Node> findSiblings(Node node) {
Preconditions.checkNotNull(node);
Node parent = node.parent();
if (null == parent) return null;
return parent.childNodes();
} | java | public List<Node> findSiblings(Node node) {
Preconditions.checkNotNull(node);
Node parent = node.parent();
if (null == parent) return null;
return parent.childNodes();
} | [
"public",
"List",
"<",
"Node",
">",
"findSiblings",
"(",
"Node",
"node",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"node",
")",
";",
"Node",
"parent",
"=",
"node",
".",
"parent",
"(",
")",
";",
"if",
"(",
"null",
"==",
"parent",
")",
"retu... | TESTING jsoup.nodes.Node | [
"TESTING",
"jsoup",
".",
"nodes",
".",
"Node"
] | 8682029a78bd48fb8566173d970800499e9e5d97 | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks/src/main/java/com/google/sitebricks/compiler/HtmlTemplateCompiler.java#L559-L566 |
103,053 | dhanji/sitebricks | sitebricks/src/main/java/com/google/sitebricks/compiler/HtmlTemplateCompiler.java | HtmlTemplateCompiler.cleanHtml | private static String cleanHtml(final Node node) {
if (node instanceof Element) {
Element element = ((Element) node);
StringBuilder accum = new StringBuilder();
accum.append("<").append(element.tagName());
for (Attribute attribute: element.attributes()) {
... | java | private static String cleanHtml(final Node node) {
if (node instanceof Element) {
Element element = ((Element) node);
StringBuilder accum = new StringBuilder();
accum.append("<").append(element.tagName());
for (Attribute attribute: element.attributes()) {
... | [
"private",
"static",
"String",
"cleanHtml",
"(",
"final",
"Node",
"node",
")",
"{",
"if",
"(",
"node",
"instanceof",
"Element",
")",
"{",
"Element",
"element",
"=",
"(",
"(",
"Element",
")",
"node",
")",
";",
"StringBuilder",
"accum",
"=",
"new",
"String... | outerHtml from jsoup.Node, Element with suppressed _attribs | [
"outerHtml",
"from",
"jsoup",
".",
"Node",
"Element",
"with",
"suppressed",
"_attribs"
] | 8682029a78bd48fb8566173d970800499e9e5d97 | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks/src/main/java/com/google/sitebricks/compiler/HtmlTemplateCompiler.java#L586-L636 |
103,054 | dhanji/sitebricks | sitebricks/src/main/java/com/google/sitebricks/binding/MvelRequestBinder.java | MvelRequestBinder.search | private Object search(Collection<?> collection, String hashKey) {
int hash = Integer.valueOf(hashKey);
for (Object o : collection) {
if (o.hashCode() == hash)
return o;
}
//nothing found
return null;
} | java | private Object search(Collection<?> collection, String hashKey) {
int hash = Integer.valueOf(hashKey);
for (Object o : collection) {
if (o.hashCode() == hash)
return o;
}
//nothing found
return null;
} | [
"private",
"Object",
"search",
"(",
"Collection",
"<",
"?",
">",
"collection",
",",
"String",
"hashKey",
")",
"{",
"int",
"hash",
"=",
"Integer",
".",
"valueOf",
"(",
"hashKey",
")",
";",
"for",
"(",
"Object",
"o",
":",
"collection",
")",
"{",
"if",
... | Linear collection search by hashcode | [
"Linear",
"collection",
"search",
"by",
"hashcode"
] | 8682029a78bd48fb8566173d970800499e9e5d97 | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks/src/main/java/com/google/sitebricks/binding/MvelRequestBinder.java#L104-L114 |
103,055 | dhanji/sitebricks | sitebricks/src/main/java/com/google/sitebricks/compiler/AnnotationNode.java | AnnotationNode.annotation | public AnnotationNode annotation(String annotation) {
this.attr(ANNOTATION, annotation);
String[] kc = AnnotationParser.extractKeyAndContent(annotation);
this.attr(ANNOTATION_KEY, kc[0]);
this.attr(ANNOTATION_CONTENT, kc[1]);
return this;
} | java | public AnnotationNode annotation(String annotation) {
this.attr(ANNOTATION, annotation);
String[] kc = AnnotationParser.extractKeyAndContent(annotation);
this.attr(ANNOTATION_KEY, kc[0]);
this.attr(ANNOTATION_CONTENT, kc[1]);
return this;
} | [
"public",
"AnnotationNode",
"annotation",
"(",
"String",
"annotation",
")",
"{",
"this",
".",
"attr",
"(",
"ANNOTATION",
",",
"annotation",
")",
";",
"String",
"[",
"]",
"kc",
"=",
"AnnotationParser",
".",
"extractKeyAndContent",
"(",
"annotation",
")",
";",
... | Set the annotation of this node.
@param annotation raw annotation
@return this, for chaining | [
"Set",
"the",
"annotation",
"of",
"this",
"node",
"."
] | 8682029a78bd48fb8566173d970800499e9e5d97 | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks/src/main/java/com/google/sitebricks/compiler/AnnotationNode.java#L42-L48 |
103,056 | dhanji/sitebricks | sitebricks-mail/src/main/java/com/google/sitebricks/mail/imap/StoreFlagsResponseExtractor.java | StoreFlagsResponseExtractor.extract | @Override
public Set<Flag> extract(List<String> messages) throws ExtractionException {
boolean gotFetch = false;
Set<Flag> result = null;
// Find FETCH, throw error if none or more than one, or if we receive an error response.
String fetchStr = null;
for (int i = 0, messagesSize = messages.size()... | java | @Override
public Set<Flag> extract(List<String> messages) throws ExtractionException {
boolean gotFetch = false;
Set<Flag> result = null;
// Find FETCH, throw error if none or more than one, or if we receive an error response.
String fetchStr = null;
for (int i = 0, messagesSize = messages.size()... | [
"@",
"Override",
"public",
"Set",
"<",
"Flag",
">",
"extract",
"(",
"List",
"<",
"String",
">",
"messages",
")",
"throws",
"ExtractionException",
"{",
"boolean",
"gotFetch",
"=",
"false",
";",
"Set",
"<",
"Flag",
">",
"result",
"=",
"null",
";",
"// Find... | Parse the response, which includes new flag settings and command status.
We expect only one FETCH response as we only set flags on one msg.
http://tools.ietf.org/html/rfc3501#section-6.4.6
C: A003 STORE_FLAGS 6 +FLAGS (\Deleted)
S: * 4 FETCH (FLAGS (\Deleted \Flagged \Seen) UID 6)
S: A003 OK STORE_FLAGS completed | [
"Parse",
"the",
"response",
"which",
"includes",
"new",
"flag",
"settings",
"and",
"command",
"status",
".",
"We",
"expect",
"only",
"one",
"FETCH",
"response",
"as",
"we",
"only",
"set",
"flags",
"on",
"one",
"msg",
"."
] | 8682029a78bd48fb8566173d970800499e9e5d97 | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks-mail/src/main/java/com/google/sitebricks/mail/imap/StoreFlagsResponseExtractor.java#L28-L61 |
103,057 | wuman/JReadability | src/main/java/com/wuman/jreadability/Readability.java | Readability.getArticleTitle | protected Element getArticleTitle() {
Element articleTitle = mDocument.createElement("h1");
articleTitle.html(mDocument.title());
return articleTitle;
} | java | protected Element getArticleTitle() {
Element articleTitle = mDocument.createElement("h1");
articleTitle.html(mDocument.title());
return articleTitle;
} | [
"protected",
"Element",
"getArticleTitle",
"(",
")",
"{",
"Element",
"articleTitle",
"=",
"mDocument",
".",
"createElement",
"(",
"\"h1\"",
")",
";",
"articleTitle",
".",
"html",
"(",
"mDocument",
".",
"title",
"(",
")",
")",
";",
"return",
"articleTitle",
"... | Get the article title as an H1. Currently just uses document.title, we
might want to be smarter in the future.
@return | [
"Get",
"the",
"article",
"title",
"as",
"an",
"H1",
".",
"Currently",
"just",
"uses",
"document",
".",
"title",
"we",
"might",
"want",
"to",
"be",
"smarter",
"in",
"the",
"future",
"."
] | 16c18c42402bd13c6e024c2fd3a86dd28ba53e74 | https://github.com/wuman/JReadability/blob/16c18c42402bd13c6e024c2fd3a86dd28ba53e74/src/main/java/com/wuman/jreadability/Readability.java#L134-L138 |
103,058 | wuman/JReadability | src/main/java/com/wuman/jreadability/Readability.java | Readability.prepDocument | protected void prepDocument() {
/**
* In some cases a body element can't be found (if the HTML is totally
* hosed for example) so we create a new body node and append it to the
* document.
*/
if (mDocument.body() == null) {
mDocument.appendElement("body");... | java | protected void prepDocument() {
/**
* In some cases a body element can't be found (if the HTML is totally
* hosed for example) so we create a new body node and append it to the
* document.
*/
if (mDocument.body() == null) {
mDocument.appendElement("body");... | [
"protected",
"void",
"prepDocument",
"(",
")",
"{",
"/**\n * In some cases a body element can't be found (if the HTML is totally\n * hosed for example) so we create a new body node and append it to the\n * document.\n */",
"if",
"(",
"mDocument",
".",
"body",
... | Prepare the HTML document for readability to scrape it. This includes
things like stripping javascript, CSS, and handling terrible markup. | [
"Prepare",
"the",
"HTML",
"document",
"for",
"readability",
"to",
"scrape",
"it",
".",
"This",
"includes",
"things",
"like",
"stripping",
"javascript",
"CSS",
"and",
"handling",
"terrible",
"markup",
"."
] | 16c18c42402bd13c6e024c2fd3a86dd28ba53e74 | https://github.com/wuman/JReadability/blob/16c18c42402bd13c6e024c2fd3a86dd28ba53e74/src/main/java/com/wuman/jreadability/Readability.java#L144-L183 |
103,059 | wuman/JReadability | src/main/java/com/wuman/jreadability/Readability.java | Readability.prepArticle | private void prepArticle(Element articleContent) {
cleanStyles(articleContent);
killBreaks(articleContent);
/* Clean out junk from the article content */
clean(articleContent, "form");
clean(articleContent, "object");
clean(articleContent, "h1");
/**
* I... | java | private void prepArticle(Element articleContent) {
cleanStyles(articleContent);
killBreaks(articleContent);
/* Clean out junk from the article content */
clean(articleContent, "form");
clean(articleContent, "object");
clean(articleContent, "h1");
/**
* I... | [
"private",
"void",
"prepArticle",
"(",
"Element",
"articleContent",
")",
"{",
"cleanStyles",
"(",
"articleContent",
")",
";",
"killBreaks",
"(",
"articleContent",
")",
";",
"/* Clean out junk from the article content */",
"clean",
"(",
"articleContent",
",",
"\"form\"",... | Prepare the article node for display. Clean out any inline styles,
iframes, forms, strip extraneous <p> tags, etc.
@param articleContent | [
"Prepare",
"the",
"article",
"node",
"for",
"display",
".",
"Clean",
"out",
"any",
"inline",
"styles",
"iframes",
"forms",
"strip",
"extraneous",
"<",
";",
"p>",
";",
"tags",
"etc",
"."
] | 16c18c42402bd13c6e024c2fd3a86dd28ba53e74 | https://github.com/wuman/JReadability/blob/16c18c42402bd13c6e024c2fd3a86dd28ba53e74/src/main/java/com/wuman/jreadability/Readability.java#L191-L239 |
103,060 | wuman/JReadability | src/main/java/com/wuman/jreadability/Readability.java | Readability.getInnerText | private static String getInnerText(Element e, boolean normalizeSpaces) {
String textContent = e.text().trim();
if (normalizeSpaces) {
textContent = textContent.replaceAll(Patterns.REGEX_NORMALIZE, "");
}
return textContent;
} | java | private static String getInnerText(Element e, boolean normalizeSpaces) {
String textContent = e.text().trim();
if (normalizeSpaces) {
textContent = textContent.replaceAll(Patterns.REGEX_NORMALIZE, "");
}
return textContent;
} | [
"private",
"static",
"String",
"getInnerText",
"(",
"Element",
"e",
",",
"boolean",
"normalizeSpaces",
")",
"{",
"String",
"textContent",
"=",
"e",
".",
"text",
"(",
")",
".",
"trim",
"(",
")",
";",
"if",
"(",
"normalizeSpaces",
")",
"{",
"textContent",
... | Get the inner text of a node - cross browser compatibly. This also strips
out any excess whitespace to be found.
@param e
@param normalizeSpaces
@return | [
"Get",
"the",
"inner",
"text",
"of",
"a",
"node",
"-",
"cross",
"browser",
"compatibly",
".",
"This",
"also",
"strips",
"out",
"any",
"excess",
"whitespace",
"to",
"be",
"found",
"."
] | 16c18c42402bd13c6e024c2fd3a86dd28ba53e74 | https://github.com/wuman/JReadability/blob/16c18c42402bd13c6e024c2fd3a86dd28ba53e74/src/main/java/com/wuman/jreadability/Readability.java#L494-L502 |
103,061 | wuman/JReadability | src/main/java/com/wuman/jreadability/Readability.java | Readability.getCharCount | private static int getCharCount(Element e, String s) {
if (s == null || s.length() == 0) {
s = ",";
}
return getInnerText(e, true).split(s).length;
} | java | private static int getCharCount(Element e, String s) {
if (s == null || s.length() == 0) {
s = ",";
}
return getInnerText(e, true).split(s).length;
} | [
"private",
"static",
"int",
"getCharCount",
"(",
"Element",
"e",
",",
"String",
"s",
")",
"{",
"if",
"(",
"s",
"==",
"null",
"||",
"s",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"s",
"=",
"\",\"",
";",
"}",
"return",
"getInnerText",
"(",
"e",... | Get the number of times a string s appears in the node e.
@param e
@param s
@return | [
"Get",
"the",
"number",
"of",
"times",
"a",
"string",
"s",
"appears",
"in",
"the",
"node",
"e",
"."
] | 16c18c42402bd13c6e024c2fd3a86dd28ba53e74 | https://github.com/wuman/JReadability/blob/16c18c42402bd13c6e024c2fd3a86dd28ba53e74/src/main/java/com/wuman/jreadability/Readability.java#L511-L516 |
103,062 | wuman/JReadability | src/main/java/com/wuman/jreadability/Readability.java | Readability.cleanStyles | private static void cleanStyles(Element e) {
if (e == null) {
return;
}
Element cur = e.children().first();
// Remove any root styles, if we're able.
if (!"readability-styled".equals(e.className())) {
e.removeAttr("style");
}
// Go until... | java | private static void cleanStyles(Element e) {
if (e == null) {
return;
}
Element cur = e.children().first();
// Remove any root styles, if we're able.
if (!"readability-styled".equals(e.className())) {
e.removeAttr("style");
}
// Go until... | [
"private",
"static",
"void",
"cleanStyles",
"(",
"Element",
"e",
")",
"{",
"if",
"(",
"e",
"==",
"null",
")",
"{",
"return",
";",
"}",
"Element",
"cur",
"=",
"e",
".",
"children",
"(",
")",
".",
"first",
"(",
")",
";",
"// Remove any root styles, if we... | Remove the style attribute on every e and under.
@param e | [
"Remove",
"the",
"style",
"attribute",
"on",
"every",
"e",
"and",
"under",
"."
] | 16c18c42402bd13c6e024c2fd3a86dd28ba53e74 | https://github.com/wuman/JReadability/blob/16c18c42402bd13c6e024c2fd3a86dd28ba53e74/src/main/java/com/wuman/jreadability/Readability.java#L523-L544 |
103,063 | wuman/JReadability | src/main/java/com/wuman/jreadability/Readability.java | Readability.getLinkDensity | private static float getLinkDensity(Element e) {
Elements links = getElementsByTag(e, "a");
int textLength = getInnerText(e, true).length();
float linkLength = 0.0F;
for (Element link : links) {
linkLength += getInnerText(link, true).length();
}
return linkLen... | java | private static float getLinkDensity(Element e) {
Elements links = getElementsByTag(e, "a");
int textLength = getInnerText(e, true).length();
float linkLength = 0.0F;
for (Element link : links) {
linkLength += getInnerText(link, true).length();
}
return linkLen... | [
"private",
"static",
"float",
"getLinkDensity",
"(",
"Element",
"e",
")",
"{",
"Elements",
"links",
"=",
"getElementsByTag",
"(",
"e",
",",
"\"a\"",
")",
";",
"int",
"textLength",
"=",
"getInnerText",
"(",
"e",
",",
"true",
")",
".",
"length",
"(",
")",
... | Get the density of links as a percentage of the content. This is the
amount of text that is inside a link divided by the total text in the
node.
@param e
@return | [
"Get",
"the",
"density",
"of",
"links",
"as",
"a",
"percentage",
"of",
"the",
"content",
".",
"This",
"is",
"the",
"amount",
"of",
"text",
"that",
"is",
"inside",
"a",
"link",
"divided",
"by",
"the",
"total",
"text",
"in",
"the",
"node",
"."
] | 16c18c42402bd13c6e024c2fd3a86dd28ba53e74 | https://github.com/wuman/JReadability/blob/16c18c42402bd13c6e024c2fd3a86dd28ba53e74/src/main/java/com/wuman/jreadability/Readability.java#L554-L562 |
103,064 | wuman/JReadability | src/main/java/com/wuman/jreadability/Readability.java | Readability.killBreaks | private static void killBreaks(Element e) {
e.html(e.html().replaceAll(Patterns.REGEX_KILL_BREAKS, "<br />"));
} | java | private static void killBreaks(Element e) {
e.html(e.html().replaceAll(Patterns.REGEX_KILL_BREAKS, "<br />"));
} | [
"private",
"static",
"void",
"killBreaks",
"(",
"Element",
"e",
")",
"{",
"e",
".",
"html",
"(",
"e",
".",
"html",
"(",
")",
".",
"replaceAll",
"(",
"Patterns",
".",
"REGEX_KILL_BREAKS",
",",
"\"<br />\"",
")",
")",
";",
"}"
] | Remove extraneous break tags from a node.
@param e | [
"Remove",
"extraneous",
"break",
"tags",
"from",
"a",
"node",
"."
] | 16c18c42402bd13c6e024c2fd3a86dd28ba53e74 | https://github.com/wuman/JReadability/blob/16c18c42402bd13c6e024c2fd3a86dd28ba53e74/src/main/java/com/wuman/jreadability/Readability.java#L612-L614 |
103,065 | wuman/JReadability | src/main/java/com/wuman/jreadability/Readability.java | Readability.cleanConditionally | private void cleanConditionally(Element e, String tag) {
Elements tagsList = getElementsByTag(e, tag);
/**
* Gather counts for other typical elements embedded within. Traverse
* backwards so we can remove nodes at the same time without effecting
* the traversal.
*
... | java | private void cleanConditionally(Element e, String tag) {
Elements tagsList = getElementsByTag(e, tag);
/**
* Gather counts for other typical elements embedded within. Traverse
* backwards so we can remove nodes at the same time without effecting
* the traversal.
*
... | [
"private",
"void",
"cleanConditionally",
"(",
"Element",
"e",
",",
"String",
"tag",
")",
"{",
"Elements",
"tagsList",
"=",
"getElementsByTag",
"(",
"e",
",",
"tag",
")",
";",
"/**\n * Gather counts for other typical elements embedded within. Traverse\n * bac... | Clean an element of all tags of type "tag" if they look fishy. "Fishy" is
an algorithm based on content length, classnames, link density, number of
images & embeds, etc.
@param e
@param tag | [
"Clean",
"an",
"element",
"of",
"all",
"tags",
"of",
"type",
"tag",
"if",
"they",
"look",
"fishy",
".",
"Fishy",
"is",
"an",
"algorithm",
"based",
"on",
"content",
"length",
"classnames",
"link",
"density",
"number",
"of",
"images",
"&",
"embeds",
"etc",
... | 16c18c42402bd13c6e024c2fd3a86dd28ba53e74 | https://github.com/wuman/JReadability/blob/16c18c42402bd13c6e024c2fd3a86dd28ba53e74/src/main/java/com/wuman/jreadability/Readability.java#L647-L712 |
103,066 | 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 |
103,067 | 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 |
103,068 | 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 |
103,069 | 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 |
103,070 | 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 |
103,071 | 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 |
103,072 | 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 |
103,073 | 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 |
103,074 | 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 |
103,075 | 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 |
103,076 | 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 |
103,077 | 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 |
103,078 | 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 |
103,079 | 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 |
103,080 | 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 |
103,081 | 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 |
103,082 | 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 |
103,083 | 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 |
103,084 | 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 |
103,085 | 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 |
103,086 | 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 |
103,087 | 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 |
103,088 | 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 |
103,089 | 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 |
103,090 | 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 |
103,091 | 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 |
103,092 | 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 |
103,093 | 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 |
103,094 | 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 |
103,095 | 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 |
103,096 | 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 |
103,097 | 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 |
103,098 | 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 |
103,099 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.