repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
datasalt/pangool | core/src/main/java/com/datasalt/pangool/tuplemr/mapred/GroupComparator.java | GroupComparator.compare | @SuppressWarnings("rawtypes")
@Override
public int compare(ITuple w1, ITuple w2) {
int schemaId1 = tupleMRConf.getSchemaIdByName(w1.getSchema().getName());
int schemaId2 = tupleMRConf.getSchemaIdByName(w2.getSchema().getName());
int[] indexes1 = serInfo.getGroupSchemaIndexTranslation(schemaId1);
int[] indexe... | java | @SuppressWarnings("rawtypes")
@Override
public int compare(ITuple w1, ITuple w2) {
int schemaId1 = tupleMRConf.getSchemaIdByName(w1.getSchema().getName());
int schemaId2 = tupleMRConf.getSchemaIdByName(w2.getSchema().getName());
int[] indexes1 = serInfo.getGroupSchemaIndexTranslation(schemaId1);
int[] indexe... | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"@",
"Override",
"public",
"int",
"compare",
"(",
"ITuple",
"w1",
",",
"ITuple",
"w2",
")",
"{",
"int",
"schemaId1",
"=",
"tupleMRConf",
".",
"getSchemaIdByName",
"(",
"w1",
".",
"getSchema",
"(",
")",
"."... | Never called in MapRed jobs. Just for completion and test purposes | [
"Never",
"called",
"in",
"MapRed",
"jobs",
".",
"Just",
"for",
"completion",
"and",
"test",
"purposes"
] | bfd312dd78cba03febaf7988ae96a3d4bc585408 | https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/tuplemr/mapred/GroupComparator.java#L45-L54 | train |
EXIficient/exificient-core | src/main/java/com/siemens/ct/exi/core/io/channel/BitEncoderChannel.java | BitEncoderChannel.encodeNBitUnsignedInteger | public void encodeNBitUnsignedInteger(int b, int n) throws IOException {
if (b < 0 || n < 0) {
throw new IllegalArgumentException(
"Encode negative value as unsigned integer is invalid!");
}
assert (b >= 0);
assert (n >= 0);
ostream.writeBits(b, n);
} | java | public void encodeNBitUnsignedInteger(int b, int n) throws IOException {
if (b < 0 || n < 0) {
throw new IllegalArgumentException(
"Encode negative value as unsigned integer is invalid!");
}
assert (b >= 0);
assert (n >= 0);
ostream.writeBits(b, n);
} | [
"public",
"void",
"encodeNBitUnsignedInteger",
"(",
"int",
"b",
",",
"int",
"n",
")",
"throws",
"IOException",
"{",
"if",
"(",
"b",
"<",
"0",
"||",
"n",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Encode negative value as unsigned i... | Encode n-bit unsigned integer. The n least significant bits of parameter
b starting with the most significant, i.e. from left to right. | [
"Encode",
"n",
"-",
"bit",
"unsigned",
"integer",
".",
"The",
"n",
"least",
"significant",
"bits",
"of",
"parameter",
"b",
"starting",
"with",
"the",
"most",
"significant",
"i",
".",
"e",
".",
"from",
"left",
"to",
"right",
"."
] | b6026c5fd39e9cc3d7874caa20f084e264e0ddc7 | https://github.com/EXIficient/exificient-core/blob/b6026c5fd39e9cc3d7874caa20f084e264e0ddc7/src/main/java/com/siemens/ct/exi/core/io/channel/BitEncoderChannel.java#L90-L99 | train |
datasalt/pangool | core/src/main/java/com/datasalt/pangool/io/Mutator.java | Mutator.subSetOf | public static Schema subSetOf(Schema schema, String... subSetFields) {
return subSetOf("subSetSchema" + (COUNTER++), schema, subSetFields);
} | java | public static Schema subSetOf(Schema schema, String... subSetFields) {
return subSetOf("subSetSchema" + (COUNTER++), schema, subSetFields);
} | [
"public",
"static",
"Schema",
"subSetOf",
"(",
"Schema",
"schema",
",",
"String",
"...",
"subSetFields",
")",
"{",
"return",
"subSetOf",
"(",
"\"subSetSchema\"",
"+",
"(",
"COUNTER",
"++",
")",
",",
"schema",
",",
"subSetFields",
")",
";",
"}"
] | Creates a subset of the input Schema exactly with the fields whose names are specified.
The name of the schema is auto-generated with a static counter. | [
"Creates",
"a",
"subset",
"of",
"the",
"input",
"Schema",
"exactly",
"with",
"the",
"fields",
"whose",
"names",
"are",
"specified",
".",
"The",
"name",
"of",
"the",
"schema",
"is",
"auto",
"-",
"generated",
"with",
"a",
"static",
"counter",
"."
] | bfd312dd78cba03febaf7988ae96a3d4bc585408 | https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/io/Mutator.java#L52-L54 | train |
datasalt/pangool | core/src/main/java/com/datasalt/pangool/io/Mutator.java | Mutator.subSetOf | public static Schema subSetOf(String newName, Schema schema, String... subSetFields) {
List<Field> newSchema = new ArrayList<Field>();
for(String subSetField: subSetFields) {
newSchema.add(schema.getField(subSetField));
}
return new Schema(newName, newSchema);
} | java | public static Schema subSetOf(String newName, Schema schema, String... subSetFields) {
List<Field> newSchema = new ArrayList<Field>();
for(String subSetField: subSetFields) {
newSchema.add(schema.getField(subSetField));
}
return new Schema(newName, newSchema);
} | [
"public",
"static",
"Schema",
"subSetOf",
"(",
"String",
"newName",
",",
"Schema",
"schema",
",",
"String",
"...",
"subSetFields",
")",
"{",
"List",
"<",
"Field",
">",
"newSchema",
"=",
"new",
"ArrayList",
"<",
"Field",
">",
"(",
")",
";",
"for",
"(",
... | Creates a subset of the input Schema exactly with the fields whose names are specified.
The name of the schema is also specified as a parameter. | [
"Creates",
"a",
"subset",
"of",
"the",
"input",
"Schema",
"exactly",
"with",
"the",
"fields",
"whose",
"names",
"are",
"specified",
".",
"The",
"name",
"of",
"the",
"schema",
"is",
"also",
"specified",
"as",
"a",
"parameter",
"."
] | bfd312dd78cba03febaf7988ae96a3d4bc585408 | https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/io/Mutator.java#L60-L66 | train |
datasalt/pangool | core/src/main/java/com/datasalt/pangool/io/Mutator.java | Mutator.superSetOf | public static Schema superSetOf(Schema schema, Field... newFields) {
return superSetOf("superSetSchema" + (COUNTER++), schema, newFields);
} | java | public static Schema superSetOf(Schema schema, Field... newFields) {
return superSetOf("superSetSchema" + (COUNTER++), schema, newFields);
} | [
"public",
"static",
"Schema",
"superSetOf",
"(",
"Schema",
"schema",
",",
"Field",
"...",
"newFields",
")",
"{",
"return",
"superSetOf",
"(",
"\"superSetSchema\"",
"+",
"(",
"COUNTER",
"++",
")",
",",
"schema",
",",
"newFields",
")",
";",
"}"
] | Creates a superset of the input Schema, taking all the Fields in the input schema
and adding some new ones. The new fields are fully specified in a Field class.
The name of the schema is auto-generated with a static counter. | [
"Creates",
"a",
"superset",
"of",
"the",
"input",
"Schema",
"taking",
"all",
"the",
"Fields",
"in",
"the",
"input",
"schema",
"and",
"adding",
"some",
"new",
"ones",
".",
"The",
"new",
"fields",
"are",
"fully",
"specified",
"in",
"a",
"Field",
"class",
"... | bfd312dd78cba03febaf7988ae96a3d4bc585408 | https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/io/Mutator.java#L73-L75 | train |
datasalt/pangool | core/src/main/java/com/datasalt/pangool/io/Mutator.java | Mutator.superSetOf | public static Schema superSetOf(String newName, Schema schema, Field... newFields) {
List<Field> newSchema = new ArrayList<Field>();
newSchema.addAll(schema.getFields());
for(Field newField: newFields) {
newSchema.add(newField);
}
return new Schema(newName, newSchema);
} | java | public static Schema superSetOf(String newName, Schema schema, Field... newFields) {
List<Field> newSchema = new ArrayList<Field>();
newSchema.addAll(schema.getFields());
for(Field newField: newFields) {
newSchema.add(newField);
}
return new Schema(newName, newSchema);
} | [
"public",
"static",
"Schema",
"superSetOf",
"(",
"String",
"newName",
",",
"Schema",
"schema",
",",
"Field",
"...",
"newFields",
")",
"{",
"List",
"<",
"Field",
">",
"newSchema",
"=",
"new",
"ArrayList",
"<",
"Field",
">",
"(",
")",
";",
"newSchema",
"."... | Creates a superset of the input Schema, taking all the Fields in the input schema
and adding some new ones. The new fields are fully specified in a Field class.
The name of the schema is also specified as a parameter. | [
"Creates",
"a",
"superset",
"of",
"the",
"input",
"Schema",
"taking",
"all",
"the",
"Fields",
"in",
"the",
"input",
"schema",
"and",
"adding",
"some",
"new",
"ones",
".",
"The",
"new",
"fields",
"are",
"fully",
"specified",
"in",
"a",
"Field",
"class",
"... | bfd312dd78cba03febaf7988ae96a3d4bc585408 | https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/io/Mutator.java#L82-L89 | train |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/scheduler/SchedulerService.java | SchedulerService.setupScheduler | @PostConstruct
public void setupScheduler() {
for(SchedulerTask task : tasks) {
if(task.getDelay() > 0 && task.getInterval() > 0) {
executor.scheduleWithFixedDelay(task.getTask(), task.getDelay(), task.getInterval(), task.getTimeUnit());
} else if(task.isImmediate() && task.getInterval() > 0) ... | java | @PostConstruct
public void setupScheduler() {
for(SchedulerTask task : tasks) {
if(task.getDelay() > 0 && task.getInterval() > 0) {
executor.scheduleWithFixedDelay(task.getTask(), task.getDelay(), task.getInterval(), task.getTimeUnit());
} else if(task.isImmediate() && task.getInterval() > 0) ... | [
"@",
"PostConstruct",
"public",
"void",
"setupScheduler",
"(",
")",
"{",
"for",
"(",
"SchedulerTask",
"task",
":",
"tasks",
")",
"{",
"if",
"(",
"task",
".",
"getDelay",
"(",
")",
">",
"0",
"&&",
"task",
".",
"getInterval",
"(",
")",
">",
"0",
")",
... | Schedules all tasks injected in by guice. | [
"Schedules",
"all",
"tasks",
"injected",
"in",
"by",
"guice",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/scheduler/SchedulerService.java#L57-L70 | train |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/meta/AlternateContentConfigProcessor.java | AlternateContentConfigProcessor.getAlternateContentDirectory | public File getAlternateContentDirectory(String userAgent) {
Configuration config = liveConfig;
for(AlternateContent configuration: config.configs) {
try {
if(configuration.compiledPattern.matcher(userAgent).matches()) {
return new File(config.metaDir, configuration.getContentDirectory()... | java | public File getAlternateContentDirectory(String userAgent) {
Configuration config = liveConfig;
for(AlternateContent configuration: config.configs) {
try {
if(configuration.compiledPattern.matcher(userAgent).matches()) {
return new File(config.metaDir, configuration.getContentDirectory()... | [
"public",
"File",
"getAlternateContentDirectory",
"(",
"String",
"userAgent",
")",
"{",
"Configuration",
"config",
"=",
"liveConfig",
";",
"for",
"(",
"AlternateContent",
"configuration",
":",
"config",
".",
"configs",
")",
"{",
"try",
"{",
"if",
"(",
"configura... | Iterates through AlternateContent objects trying to match against their pre compiled pattern.
@param userAgent The userAgent request header.
@return the ContentDirectory of the matched AlternateContent instance or null if none are found. | [
"Iterates",
"through",
"AlternateContent",
"objects",
"trying",
"to",
"match",
"against",
"their",
"pre",
"compiled",
"pattern",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/meta/AlternateContentConfigProcessor.java#L75-L87 | train |
datasalt/pangool | core/src/main/java/com/datasalt/pangool/tuplemr/TupleMRConfigBuilder.java | TupleMRConfigBuilder.addIntermediateSchema | public void addIntermediateSchema(Schema schema) throws TupleMRException {
if (schemaAlreadyExists(schema.getName())) {
throw new TupleMRException("There's a schema with that name '" + schema.getName()
+ "'");
}
schemas.add(schema);
} | java | public void addIntermediateSchema(Schema schema) throws TupleMRException {
if (schemaAlreadyExists(schema.getName())) {
throw new TupleMRException("There's a schema with that name '" + schema.getName()
+ "'");
}
schemas.add(schema);
} | [
"public",
"void",
"addIntermediateSchema",
"(",
"Schema",
"schema",
")",
"throws",
"TupleMRException",
"{",
"if",
"(",
"schemaAlreadyExists",
"(",
"schema",
".",
"getName",
"(",
")",
")",
")",
"{",
"throw",
"new",
"TupleMRException",
"(",
"\"There's a schema with ... | Adds a Map-output schema. Tuples emitted by TupleMapper will use one of the
schemas added by this method. Schemas added in consecutive calls to this
method must be named differently. | [
"Adds",
"a",
"Map",
"-",
"output",
"schema",
".",
"Tuples",
"emitted",
"by",
"TupleMapper",
"will",
"use",
"one",
"of",
"the",
"schemas",
"added",
"by",
"this",
"method",
".",
"Schemas",
"added",
"in",
"consecutive",
"calls",
"to",
"this",
"method",
"must"... | bfd312dd78cba03febaf7988ae96a3d4bc585408 | https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/tuplemr/TupleMRConfigBuilder.java#L73-L79 | train |
datasalt/pangool | core/src/main/java/com/datasalt/pangool/tuplemr/TupleMRConfigBuilder.java | TupleMRConfigBuilder.setOrderBy | public void setOrderBy(OrderBy ordering) throws TupleMRException {
failIfNull(ordering, "OrderBy can't be null");
failIfEmpty(ordering.getElements(), "OrderBy can't be empty");
failIfEmpty(schemas, "Need to specify source schemas");
failIfEmpty(groupByFields, "Need to specify group by fields");
if (... | java | public void setOrderBy(OrderBy ordering) throws TupleMRException {
failIfNull(ordering, "OrderBy can't be null");
failIfEmpty(ordering.getElements(), "OrderBy can't be empty");
failIfEmpty(schemas, "Need to specify source schemas");
failIfEmpty(groupByFields, "Need to specify group by fields");
if (... | [
"public",
"void",
"setOrderBy",
"(",
"OrderBy",
"ordering",
")",
"throws",
"TupleMRException",
"{",
"failIfNull",
"(",
"ordering",
",",
"\"OrderBy can't be null\"",
")",
";",
"failIfEmpty",
"(",
"ordering",
".",
"getElements",
"(",
")",
",",
"\"OrderBy can't be empt... | Sets the criteria to sort the tuples by. In a multi-schema scenario all the
fields defined in the specified ordering must be present in every
intermediate schema defined.
@see OrderBy | [
"Sets",
"the",
"criteria",
"to",
"sort",
"the",
"tuples",
"by",
".",
"In",
"a",
"multi",
"-",
"schema",
"scenario",
"all",
"the",
"fields",
"defined",
"in",
"the",
"specified",
"ordering",
"must",
"be",
"present",
"in",
"every",
"intermediate",
"schema",
"... | bfd312dd78cba03febaf7988ae96a3d4bc585408 | https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/tuplemr/TupleMRConfigBuilder.java#L252-L291 | train |
datasalt/pangool | core/src/main/java/com/datasalt/pangool/tuplemr/TupleMRConfigBuilder.java | TupleMRConfigBuilder.setSpecificOrderBy | public void setSpecificOrderBy(String schemaName, OrderBy ordering)
throws TupleMRException {
// TODO
failIfNull(schemaName, "Not able to set specific orderBy for null source");
if (!schemaAlreadyExists(schemaName)) {
throw new TupleMRException("Unknown source '" + schemaName
+ "' in s... | java | public void setSpecificOrderBy(String schemaName, OrderBy ordering)
throws TupleMRException {
// TODO
failIfNull(schemaName, "Not able to set specific orderBy for null source");
if (!schemaAlreadyExists(schemaName)) {
throw new TupleMRException("Unknown source '" + schemaName
+ "' in s... | [
"public",
"void",
"setSpecificOrderBy",
"(",
"String",
"schemaName",
",",
"OrderBy",
"ordering",
")",
"throws",
"TupleMRException",
"{",
"// TODO",
"failIfNull",
"(",
"schemaName",
",",
"\"Not able to set specific orderBy for null source\"",
")",
";",
"if",
"(",
"!",
... | Sets how tuples from the specific schemaName will be sorted after being
sorted by commonOrderBy and schemaOrder | [
"Sets",
"how",
"tuples",
"from",
"the",
"specific",
"schemaName",
"will",
"be",
"sorted",
"after",
"being",
"sorted",
"by",
"commonOrderBy",
"and",
"schemaOrder"
] | bfd312dd78cba03febaf7988ae96a3d4bc585408 | https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/tuplemr/TupleMRConfigBuilder.java#L299-L343 | train |
datasalt/pangool | core/src/main/java/com/datasalt/pangool/tuplemr/mapred/RollupReducer.java | RollupReducer.initComparators | private void initComparators() {
TupleMRConfigBuilder.initializeComparators(context.getHadoopContext()
.getConfiguration(), tupleMRConfig);
customComparators = new RawComparator<?>[maxDepth + 1];
for(int i = minDepth; i <= maxDepth; i++) {
SortElement element = tupleMRConfig.getCommonCriteria().getElemen... | java | private void initComparators() {
TupleMRConfigBuilder.initializeComparators(context.getHadoopContext()
.getConfiguration(), tupleMRConfig);
customComparators = new RawComparator<?>[maxDepth + 1];
for(int i = minDepth; i <= maxDepth; i++) {
SortElement element = tupleMRConfig.getCommonCriteria().getElemen... | [
"private",
"void",
"initComparators",
"(",
")",
"{",
"TupleMRConfigBuilder",
".",
"initializeComparators",
"(",
"context",
".",
"getHadoopContext",
"(",
")",
".",
"getConfiguration",
"(",
")",
",",
"tupleMRConfig",
")",
";",
"customComparators",
"=",
"new",
"RawCo... | Initialize the custom comparators. Creates a quick access array for the
custom comparators. | [
"Initialize",
"the",
"custom",
"comparators",
".",
"Creates",
"a",
"quick",
"access",
"array",
"for",
"the",
"custom",
"comparators",
"."
] | bfd312dd78cba03febaf7988ae96a3d4bc585408 | https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/tuplemr/mapred/RollupReducer.java#L92-L102 | train |
datasalt/pangool | core/src/main/java/com/datasalt/pangool/utils/TupleToAvroRecordConverter.java | TupleToAvroRecordConverter.toRecord | @SuppressWarnings({ "unchecked", "rawtypes" })
public Record toRecord(ITuple tuple, Record reuse) throws IOException {
Record record = reuse;
if (record == null){
record = new Record(avroSchema);
}
if (schemaValidation && !tuple.getSchema().equals(pangoolSchema)){
throw new IOException("Tuple '"+tuple +... | java | @SuppressWarnings({ "unchecked", "rawtypes" })
public Record toRecord(ITuple tuple, Record reuse) throws IOException {
Record record = reuse;
if (record == null){
record = new Record(avroSchema);
}
if (schemaValidation && !tuple.getSchema().equals(pangoolSchema)){
throw new IOException("Tuple '"+tuple +... | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"public",
"Record",
"toRecord",
"(",
"ITuple",
"tuple",
",",
"Record",
"reuse",
")",
"throws",
"IOException",
"{",
"Record",
"record",
"=",
"reuse",
";",
"if",
"(",
"record",
... | Moves data between a Tuple and an Avro Record | [
"Moves",
"data",
"between",
"a",
"Tuple",
"and",
"an",
"Avro",
"Record"
] | bfd312dd78cba03febaf7988ae96a3d4bc585408 | https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/utils/TupleToAvroRecordConverter.java#L75-L130 | train |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/config/ConfigManager.java | ConfigManager.appendToDefaultProperties | public Properties appendToDefaultProperties(File configFile) {
if(defaultProperties != null && configFile.canRead()) {
defaultProperties = appendProperties(defaultProperties, configFile);
}
return defaultProperties;
} | java | public Properties appendToDefaultProperties(File configFile) {
if(defaultProperties != null && configFile.canRead()) {
defaultProperties = appendProperties(defaultProperties, configFile);
}
return defaultProperties;
} | [
"public",
"Properties",
"appendToDefaultProperties",
"(",
"File",
"configFile",
")",
"{",
"if",
"(",
"defaultProperties",
"!=",
"null",
"&&",
"configFile",
".",
"canRead",
"(",
")",
")",
"{",
"defaultProperties",
"=",
"appendProperties",
"(",
"defaultProperties",
... | Adds properties from file to the default properties if the file exists.
@param configFile
@return default properties instance | [
"Adds",
"properties",
"from",
"file",
"to",
"the",
"default",
"properties",
"if",
"the",
"file",
"exists",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/config/ConfigManager.java#L95-L103 | train |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/config/ConfigManager.java | ConfigManager.appendProperties | public Properties appendProperties(Properties properties, File configFile) {
if(!configFile.exists()) {
return properties;
}
return reader.appendProperties(properties, configFile, log);
} | java | public Properties appendProperties(Properties properties, File configFile) {
if(!configFile.exists()) {
return properties;
}
return reader.appendProperties(properties, configFile, log);
} | [
"public",
"Properties",
"appendProperties",
"(",
"Properties",
"properties",
",",
"File",
"configFile",
")",
"{",
"if",
"(",
"!",
"configFile",
".",
"exists",
"(",
")",
")",
"{",
"return",
"properties",
";",
"}",
"return",
"reader",
".",
"appendProperties",
... | Add new properties to an existing Properties object | [
"Add",
"new",
"properties",
"to",
"an",
"existing",
"Properties",
"object"
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/config/ConfigManager.java#L109-L117 | train |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/config/ConfigManager.java | ConfigManager.getSystemProperties | public Properties getSystemProperties() {
Properties properties = new Properties();
properties.putAll(System.getenv());
properties.putAll(System.getProperties());
return properties;
} | java | public Properties getSystemProperties() {
Properties properties = new Properties();
properties.putAll(System.getenv());
properties.putAll(System.getProperties());
return properties;
} | [
"public",
"Properties",
"getSystemProperties",
"(",
")",
"{",
"Properties",
"properties",
"=",
"new",
"Properties",
"(",
")",
";",
"properties",
".",
"putAll",
"(",
"System",
".",
"getenv",
"(",
")",
")",
";",
"properties",
".",
"putAll",
"(",
"System",
".... | Read in The system properties | [
"Read",
"in",
"The",
"system",
"properties"
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/config/ConfigManager.java#L123-L130 | train |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/config/ConfigManager.java | ConfigManager.getPropertiesByContext | public Properties getPropertiesByContext(ServletContext context, String path) {
return reader.getProperties(context, path, log);
} | java | public Properties getPropertiesByContext(ServletContext context, String path) {
return reader.getProperties(context, path, log);
} | [
"public",
"Properties",
"getPropertiesByContext",
"(",
"ServletContext",
"context",
",",
"String",
"path",
")",
"{",
"return",
"reader",
".",
"getProperties",
"(",
"context",
",",
"path",
",",
"log",
")",
";",
"}"
] | Read in properties based on a ServletContext and a path to a config file | [
"Read",
"in",
"properties",
"based",
"on",
"a",
"ServletContext",
"and",
"a",
"path",
"to",
"a",
"config",
"file"
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/config/ConfigManager.java#L136-L139 | train |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/config/ConfigManager.java | ConfigManager.persistProperties | public synchronized void persistProperties(Properties properties, File propsFile, String message) {
Properties toWrite = new Properties();
for(String key : properties.stringPropertyNames()) {
if(System.getProperties().containsKey(key) && !properties.getProperty(key).equals(System.getProperty(key))) {
... | java | public synchronized void persistProperties(Properties properties, File propsFile, String message) {
Properties toWrite = new Properties();
for(String key : properties.stringPropertyNames()) {
if(System.getProperties().containsKey(key) && !properties.getProperty(key).equals(System.getProperty(key))) {
... | [
"public",
"synchronized",
"void",
"persistProperties",
"(",
"Properties",
"properties",
",",
"File",
"propsFile",
",",
"String",
"message",
")",
"{",
"Properties",
"toWrite",
"=",
"new",
"Properties",
"(",
")",
";",
"for",
"(",
"String",
"key",
":",
"propertie... | Persist properties that are not system env or other system properties, in a thread synchronized manner | [
"Persist",
"properties",
"that",
"are",
"not",
"system",
"env",
"or",
"other",
"system",
"properties",
"in",
"a",
"thread",
"synchronized",
"manner"
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/config/ConfigManager.java#L164-L182 | train |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/config/ConfigManager.java | ConfigManager.makeConfigParserLive | public void makeConfigParserLive() {
if(stagedConfigParser != null) {
notifyListeners(listeners, stagedConfigParser, log);
liveConfigParser = stagedConfigParser;
latch.countDown();
}
} | java | public void makeConfigParserLive() {
if(stagedConfigParser != null) {
notifyListeners(listeners, stagedConfigParser, log);
liveConfigParser = stagedConfigParser;
latch.countDown();
}
} | [
"public",
"void",
"makeConfigParserLive",
"(",
")",
"{",
"if",
"(",
"stagedConfigParser",
"!=",
"null",
")",
"{",
"notifyListeners",
"(",
"listeners",
",",
"stagedConfigParser",
",",
"log",
")",
";",
"liveConfigParser",
"=",
"stagedConfigParser",
";",
"latch",
"... | This notifies all registered listeners then make a staged configuration live. | [
"This",
"notifies",
"all",
"registered",
"listeners",
"then",
"make",
"a",
"staged",
"configuration",
"live",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/config/ConfigManager.java#L214-L222 | train |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/config/ConfigManager.java | ConfigManager.getListenerGenericTypes | private static Class<?>[] getListenerGenericTypes(Class<?> listenerClass, Logger log) {
List<Class<?>> configClasses = new ArrayList<Class<?>>();
Type[] typeVars = listenerClass.getGenericInterfaces();
if(typeVars != null) {
for(Type interfaceClass : typeVars) {
if(interfaceClass instanceof Pa... | java | private static Class<?>[] getListenerGenericTypes(Class<?> listenerClass, Logger log) {
List<Class<?>> configClasses = new ArrayList<Class<?>>();
Type[] typeVars = listenerClass.getGenericInterfaces();
if(typeVars != null) {
for(Type interfaceClass : typeVars) {
if(interfaceClass instanceof Pa... | [
"private",
"static",
"Class",
"<",
"?",
">",
"[",
"]",
"getListenerGenericTypes",
"(",
"Class",
"<",
"?",
">",
"listenerClass",
",",
"Logger",
"log",
")",
"{",
"List",
"<",
"Class",
"<",
"?",
">",
">",
"configClasses",
"=",
"new",
"ArrayList",
"<",
"Cl... | Gets a list of classes that the listenerClass is interesting in listening to.
@param listenerClass
@param log
@return | [
"Gets",
"a",
"list",
"of",
"classes",
"that",
"the",
"listenerClass",
"is",
"interesting",
"in",
"listening",
"to",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/config/ConfigManager.java#L271-L294 | train |
EXIficient/exificient-core | src/main/java/com/siemens/ct/exi/core/helpers/DefaultEXIFactory.java | DefaultEXIFactory.doSanityCheck | protected void doSanityCheck() throws EXIException {
// Self-contained elements do not work with re-ordered
if (fidelityOptions.isFidelityEnabled(FidelityOptions.FEATURE_SC)
&& (codingMode == CodingMode.COMPRESSION || codingMode == CodingMode.PRE_COMPRESSION)) {
throw new EXIException(
"(Pre-)Com... | java | protected void doSanityCheck() throws EXIException {
// Self-contained elements do not work with re-ordered
if (fidelityOptions.isFidelityEnabled(FidelityOptions.FEATURE_SC)
&& (codingMode == CodingMode.COMPRESSION || codingMode == CodingMode.PRE_COMPRESSION)) {
throw new EXIException(
"(Pre-)Com... | [
"protected",
"void",
"doSanityCheck",
"(",
")",
"throws",
"EXIException",
"{",
"// Self-contained elements do not work with re-ordered\r",
"if",
"(",
"fidelityOptions",
".",
"isFidelityEnabled",
"(",
"FidelityOptions",
".",
"FEATURE_SC",
")",
"&&",
"(",
"codingMode",
"=="... | some consistency and sanity checks | [
"some",
"consistency",
"and",
"sanity",
"checks"
] | b6026c5fd39e9cc3d7874caa20f084e264e0ddc7 | https://github.com/EXIficient/exificient-core/blob/b6026c5fd39e9cc3d7874caa20f084e264e0ddc7/src/main/java/com/siemens/ct/exi/core/helpers/DefaultEXIFactory.java#L399-L422 | train |
datasalt/pangool | core/src/main/java/com/datasalt/pangool/solr/SolrRecordWriter.java | SolrRecordWriter.zipDirectory | static public int zipDirectory(final Configuration conf, final ZipOutputStream zos, final String baseName,
final String root, final Path itemToZip) throws IOException {
LOG.info(String.format("zipDirectory: %s %s %s", baseName, root, itemToZip));
LocalFileSystem localFs = FileSystem.getLocal(conf);
int count... | java | static public int zipDirectory(final Configuration conf, final ZipOutputStream zos, final String baseName,
final String root, final Path itemToZip) throws IOException {
LOG.info(String.format("zipDirectory: %s %s %s", baseName, root, itemToZip));
LocalFileSystem localFs = FileSystem.getLocal(conf);
int count... | [
"static",
"public",
"int",
"zipDirectory",
"(",
"final",
"Configuration",
"conf",
",",
"final",
"ZipOutputStream",
"zos",
",",
"final",
"String",
"baseName",
",",
"final",
"String",
"root",
",",
"final",
"Path",
"itemToZip",
")",
"throws",
"IOException",
"{",
... | Write a file to a zip output stream, removing leading path name components from the actual file name when creating
the zip file entry.
The entry placed in the zip file is <code>baseName</code>/ <code>relativePath</code>, where
<code>relativePath</code> is constructed by removing a leading <code>root</code> from the pa... | [
"Write",
"a",
"file",
"to",
"a",
"zip",
"output",
"stream",
"removing",
"leading",
"path",
"name",
"components",
"from",
"the",
"actual",
"file",
"name",
"when",
"creating",
"the",
"zip",
"file",
"entry",
"."
] | bfd312dd78cba03febaf7988ae96a3d4bc585408 | https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/solr/SolrRecordWriter.java#L432-L486 | train |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java | WarUtils.addListener | public static void addListener(Document doc, Element root) {
Element listener = doc.createElement("listener");
Element listenerClass = doc.createElement("listener-class");
listener.appendChild(listenerClass);
listenerClass.appendChild(doc
.createTextNode("org.apache.shiro.web.env.EnvironmentLoad... | java | public static void addListener(Document doc, Element root) {
Element listener = doc.createElement("listener");
Element listenerClass = doc.createElement("listener-class");
listener.appendChild(listenerClass);
listenerClass.appendChild(doc
.createTextNode("org.apache.shiro.web.env.EnvironmentLoad... | [
"public",
"static",
"void",
"addListener",
"(",
"Document",
"doc",
",",
"Element",
"root",
")",
"{",
"Element",
"listener",
"=",
"doc",
".",
"createElement",
"(",
"\"listener\"",
")",
";",
"Element",
"listenerClass",
"=",
"doc",
".",
"createElement",
"(",
"\... | Adds a shiro environment listener to load the shiro config file.
@param doc The xml DOM document to create the new xml elements with.
@param root The xml Element node to add the listener to. | [
"Adds",
"a",
"shiro",
"environment",
"listener",
"to",
"load",
"the",
"shiro",
"config",
"file",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java#L261-L269 | train |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java | WarUtils.addContextParam | public static void addContextParam(Document doc, Element root) {
Element ctxParam = doc.createElement("context-param");
Element paramName = doc.createElement("param-name");
paramName.appendChild(doc.createTextNode("shiroConfigLocations"));
ctxParam.appendChild(paramName);
Element paramValue = doc.cr... | java | public static void addContextParam(Document doc, Element root) {
Element ctxParam = doc.createElement("context-param");
Element paramName = doc.createElement("param-name");
paramName.appendChild(doc.createTextNode("shiroConfigLocations"));
ctxParam.appendChild(paramName);
Element paramValue = doc.cr... | [
"public",
"static",
"void",
"addContextParam",
"(",
"Document",
"doc",
",",
"Element",
"root",
")",
"{",
"Element",
"ctxParam",
"=",
"doc",
".",
"createElement",
"(",
"\"context-param\"",
")",
";",
"Element",
"paramName",
"=",
"doc",
".",
"createElement",
"(",... | Adds a context parameter to a web.xml file to override where the shiro config location is to be loaded from.
The location loaded from will be represented by the "com.meltmedia.cadmium.contentRoot" system property.
@param doc The xml DOM document to create the new xml elements with.
@param root The xml Element node to a... | [
"Adds",
"a",
"context",
"parameter",
"to",
"a",
"web",
".",
"xml",
"file",
"to",
"override",
"where",
"the",
"shiro",
"config",
"location",
"is",
"to",
"be",
"loaded",
"from",
".",
"The",
"location",
"loaded",
"from",
"will",
"be",
"represented",
"by",
"... | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java#L277-L289 | train |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java | WarUtils.addEnvContextParam | public static void addEnvContextParam(Document doc, Element root) {
Element ctxParam = doc.createElement("context-param");
Element paramName = doc.createElement("param-name");
paramName.appendChild(doc.createTextNode("shiroEnvironmentClass"));
ctxParam.appendChild(paramName);
Element paramValue = do... | java | public static void addEnvContextParam(Document doc, Element root) {
Element ctxParam = doc.createElement("context-param");
Element paramName = doc.createElement("param-name");
paramName.appendChild(doc.createTextNode("shiroEnvironmentClass"));
ctxParam.appendChild(paramName);
Element paramValue = do... | [
"public",
"static",
"void",
"addEnvContextParam",
"(",
"Document",
"doc",
",",
"Element",
"root",
")",
"{",
"Element",
"ctxParam",
"=",
"doc",
".",
"createElement",
"(",
"\"context-param\"",
")",
";",
"Element",
"paramName",
"=",
"doc",
".",
"createElement",
"... | Adds a context parameter to a web.xml file to override where the shiro environment class.
@param doc The xml DOM document to create the new xml elements with.
@param root The xml Element node to add the context param to. | [
"Adds",
"a",
"context",
"parameter",
"to",
"a",
"web",
".",
"xml",
"file",
"to",
"override",
"where",
"the",
"shiro",
"environment",
"class",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java#L296-L306 | train |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java | WarUtils.addFilter | public static void addFilter(Document doc, Element root) {
Element filter = doc.createElement("filter");
Element filterName = doc.createElement("filter-name");
filterName.appendChild(doc.createTextNode("ShiroFilter"));
filter.appendChild(filterName);
Element filterClass = doc.createElement("filter-c... | java | public static void addFilter(Document doc, Element root) {
Element filter = doc.createElement("filter");
Element filterName = doc.createElement("filter-name");
filterName.appendChild(doc.createTextNode("ShiroFilter"));
filter.appendChild(filterName);
Element filterClass = doc.createElement("filter-c... | [
"public",
"static",
"void",
"addFilter",
"(",
"Document",
"doc",
",",
"Element",
"root",
")",
"{",
"Element",
"filter",
"=",
"doc",
".",
"createElement",
"(",
"\"filter\"",
")",
";",
"Element",
"filterName",
"=",
"doc",
".",
"createElement",
"(",
"\"filter-n... | Adds the shiro filter to a web.xml file.
@param doc The xml DOM document to create the new xml elements with.
@param root The xml Element node to add the filter to. | [
"Adds",
"the",
"shiro",
"filter",
"to",
"a",
"web",
".",
"xml",
"file",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java#L313-L324 | train |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java | WarUtils.addFilterMapping | public static void addFilterMapping(Document doc, Element root) {
Element filterMapping = doc.createElement("filter-mapping");
Element filterName = doc.createElement("filter-name");
filterName.appendChild(doc.createTextNode("ShiroFilter"));
filterMapping.appendChild(filterName);
Element urlPattern =... | java | public static void addFilterMapping(Document doc, Element root) {
Element filterMapping = doc.createElement("filter-mapping");
Element filterName = doc.createElement("filter-name");
filterName.appendChild(doc.createTextNode("ShiroFilter"));
filterMapping.appendChild(filterName);
Element urlPattern =... | [
"public",
"static",
"void",
"addFilterMapping",
"(",
"Document",
"doc",
",",
"Element",
"root",
")",
"{",
"Element",
"filterMapping",
"=",
"doc",
".",
"createElement",
"(",
"\"filter-mapping\"",
")",
";",
"Element",
"filterName",
"=",
"doc",
".",
"createElement"... | Adds the filter mapping for the shiro filter to a web.xml file.
@param doc The xml DOM document to create the new xml elements with.
@param root The xml Element node to add the filter mapping to. | [
"Adds",
"the",
"filter",
"mapping",
"for",
"the",
"shiro",
"filter",
"to",
"a",
"web",
".",
"xml",
"file",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java#L331-L343 | train |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java | WarUtils.addDispatchers | public static void addDispatchers(Document doc, Element filterMapping,
String... names) {
if (names != null) {
for (String name : names) {
Element dispatcher = doc.createElement("dispatcher");
dispatcher.appendChild(doc.createTextNode(name));
filterMapping.appendChild(dispatcher)... | java | public static void addDispatchers(Document doc, Element filterMapping,
String... names) {
if (names != null) {
for (String name : names) {
Element dispatcher = doc.createElement("dispatcher");
dispatcher.appendChild(doc.createTextNode(name));
filterMapping.appendChild(dispatcher)... | [
"public",
"static",
"void",
"addDispatchers",
"(",
"Document",
"doc",
",",
"Element",
"filterMapping",
",",
"String",
"...",
"names",
")",
"{",
"if",
"(",
"names",
"!=",
"null",
")",
"{",
"for",
"(",
"String",
"name",
":",
"names",
")",
"{",
"Element",
... | Adds dispatchers for each item in the vargs parameter names to a
filter mapping element of a web.xml file.
@param doc The xml DOM document to create the new xml elements with.
@param filterMapping The filter mapping element to append to from a web.xml document.
@param names The names of the dispatchers to add. | [
"Adds",
"dispatchers",
"for",
"each",
"item",
"in",
"the",
"vargs",
"parameter",
"names",
"to",
"a",
"filter",
"mapping",
"element",
"of",
"a",
"web",
".",
"xml",
"file",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java#L352-L361 | train |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java | WarUtils.storeXmlDocument | public static void storeXmlDocument(ZipOutputStream outZip,
ZipEntry jbossWeb, Document doc) throws IOException,
TransformerFactoryConfigurationError, TransformerConfigurationException,
TransformerException {
jbossWeb = new ZipEntry(jbossWeb.getName());
outZip.putNextEntry(jbossWeb);
Tran... | java | public static void storeXmlDocument(ZipOutputStream outZip,
ZipEntry jbossWeb, Document doc) throws IOException,
TransformerFactoryConfigurationError, TransformerConfigurationException,
TransformerException {
jbossWeb = new ZipEntry(jbossWeb.getName());
outZip.putNextEntry(jbossWeb);
Tran... | [
"public",
"static",
"void",
"storeXmlDocument",
"(",
"ZipOutputStream",
"outZip",
",",
"ZipEntry",
"jbossWeb",
",",
"Document",
"doc",
")",
"throws",
"IOException",
",",
"TransformerFactoryConfigurationError",
",",
"TransformerConfigurationException",
",",
"TransformerExcep... | Writes a xml document to a zip file with an entry specified by the jbossWeb parameter.
@param outZip The zip output stream to write to.
@param jbossWeb The zip entry to add to the zip file.
@param doc The xml DOM document to write to the zip file.
@throws IOException
@throws TransformerFactoryConfigurationError
@throws... | [
"Writes",
"a",
"xml",
"document",
"to",
"a",
"zip",
"file",
"with",
"an",
"entry",
"specified",
"by",
"the",
"jbossWeb",
"parameter",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java#L411-L429 | train |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java | WarUtils.removeNodesByTagName | public static void removeNodesByTagName(Element doc, String tagname) {
NodeList nodes = doc.getElementsByTagName(tagname);
for (int i = 0; i < nodes.getLength(); i++) {
Node n = nodes.item(i);
doc.removeChild(n);
}
} | java | public static void removeNodesByTagName(Element doc, String tagname) {
NodeList nodes = doc.getElementsByTagName(tagname);
for (int i = 0; i < nodes.getLength(); i++) {
Node n = nodes.item(i);
doc.removeChild(n);
}
} | [
"public",
"static",
"void",
"removeNodesByTagName",
"(",
"Element",
"doc",
",",
"String",
"tagname",
")",
"{",
"NodeList",
"nodes",
"=",
"doc",
".",
"getElementsByTagName",
"(",
"tagname",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nodes... | Removes elements by a specified tag name from the xml Element passed in.
@param doc The xml Element to remove from.
@param tagname The tag name to remove. | [
"Removes",
"elements",
"by",
"a",
"specified",
"tag",
"name",
"from",
"the",
"xml",
"Element",
"passed",
"in",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java#L436-L442 | train |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java | WarUtils.storeProperties | public static void storeProperties(ZipOutputStream outZip,
ZipEntry cadmiumPropertiesEntry, Properties cadmiumProps,
List<String> newWarNames) throws IOException {
ZipEntry newCadmiumEntry = new ZipEntry(cadmiumPropertiesEntry.getName());
outZip.putNextEntry(newCadmiumEntry);
cadmiumProps.store(... | java | public static void storeProperties(ZipOutputStream outZip,
ZipEntry cadmiumPropertiesEntry, Properties cadmiumProps,
List<String> newWarNames) throws IOException {
ZipEntry newCadmiumEntry = new ZipEntry(cadmiumPropertiesEntry.getName());
outZip.putNextEntry(newCadmiumEntry);
cadmiumProps.store(... | [
"public",
"static",
"void",
"storeProperties",
"(",
"ZipOutputStream",
"outZip",
",",
"ZipEntry",
"cadmiumPropertiesEntry",
",",
"Properties",
"cadmiumProps",
",",
"List",
"<",
"String",
">",
"newWarNames",
")",
"throws",
"IOException",
"{",
"ZipEntry",
"newCadmiumEnt... | Adds a properties file to a war.
@param outZip The zip output stream to add to.
@param cadmiumPropertiesEntry The entry to add.
@param cadmiumProps The properties to store in the zip file.
@param newWarNames The first element of this list is used in a comment of the properties file.
@throws IOException | [
"Adds",
"a",
"properties",
"file",
"to",
"a",
"war",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java#L452-L460 | train |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java | WarUtils.getWarName | public static String getWarName( ServletContext context ) {
String[] pathSegments = context.getRealPath("/WEB-INF/web.xml").split("/");
String warName = pathSegments[pathSegments.length - 3];
if(!warName.endsWith(".war")) {
URL webXml = WarUtils.class.getClassLoader().getResource("/cadmium-version.pro... | java | public static String getWarName( ServletContext context ) {
String[] pathSegments = context.getRealPath("/WEB-INF/web.xml").split("/");
String warName = pathSegments[pathSegments.length - 3];
if(!warName.endsWith(".war")) {
URL webXml = WarUtils.class.getClassLoader().getResource("/cadmium-version.pro... | [
"public",
"static",
"String",
"getWarName",
"(",
"ServletContext",
"context",
")",
"{",
"String",
"[",
"]",
"pathSegments",
"=",
"context",
".",
"getRealPath",
"(",
"\"/WEB-INF/web.xml\"",
")",
".",
"split",
"(",
"\"/\"",
")",
";",
"String",
"warName",
"=",
... | Gets the currently deployed war file name from the ServletContext.
@param context
@return | [
"Gets",
"the",
"currently",
"deployed",
"war",
"file",
"name",
"from",
"the",
"ServletContext",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java#L779-L805 | train |
EXIficient/exificient-core | src/main/java/com/siemens/ct/exi/core/io/channel/AbstractDecoderChannel.java | AbstractDecoderChannel.decodeUnsignedInteger | public final int decodeUnsignedInteger() throws IOException {
// 0XXXXXXX ... 1XXXXXXX 1XXXXXXX
int result = decode();
// < 128: just one byte, optimal case
// ELSE: multiple bytes...
if (result >= 128) {
result = (result & 127);
int mShift = 7;
int b;
do {
// 1. Read the next octet
b =... | java | public final int decodeUnsignedInteger() throws IOException {
// 0XXXXXXX ... 1XXXXXXX 1XXXXXXX
int result = decode();
// < 128: just one byte, optimal case
// ELSE: multiple bytes...
if (result >= 128) {
result = (result & 127);
int mShift = 7;
int b;
do {
// 1. Read the next octet
b =... | [
"public",
"final",
"int",
"decodeUnsignedInteger",
"(",
")",
"throws",
"IOException",
"{",
"// 0XXXXXXX ... 1XXXXXXX 1XXXXXXX",
"int",
"result",
"=",
"decode",
"(",
")",
";",
"// < 128: just one byte, optimal case",
"// ELSE: multiple bytes...",
"if",
"(",
"result",
">=",... | Decode an arbitrary precision non negative integer using a sequence of
octets. The most significant bit of the last octet is set to zero to
indicate sequence termination. Only seven bits per octet are used to
store the integer's value. | [
"Decode",
"an",
"arbitrary",
"precision",
"non",
"negative",
"integer",
"using",
"a",
"sequence",
"of",
"octets",
".",
"The",
"most",
"significant",
"bit",
"of",
"the",
"last",
"octet",
"is",
"set",
"to",
"zero",
"to",
"indicate",
"sequence",
"termination",
... | b6026c5fd39e9cc3d7874caa20f084e264e0ddc7 | https://github.com/EXIficient/exificient-core/blob/b6026c5fd39e9cc3d7874caa20f084e264e0ddc7/src/main/java/com/siemens/ct/exi/core/io/channel/AbstractDecoderChannel.java#L129-L157 | train |
EXIficient/exificient-core | src/main/java/com/siemens/ct/exi/core/io/channel/AbstractDecoderChannel.java | AbstractDecoderChannel.decodeDateTimeValue | public DateTimeValue decodeDateTimeValue(DateTimeType type)
throws IOException {
int year = 0, monthDay = 0, time = 0, fractionalSecs = 0;
switch (type) {
case gYear: // Year, [Time-Zone]
year = decodeInteger() + DateTimeValue.YEAR_OFFSET;
break;
case gYearMonth: // Year, MonthDay, [TimeZone]
case d... | java | public DateTimeValue decodeDateTimeValue(DateTimeType type)
throws IOException {
int year = 0, monthDay = 0, time = 0, fractionalSecs = 0;
switch (type) {
case gYear: // Year, [Time-Zone]
year = decodeInteger() + DateTimeValue.YEAR_OFFSET;
break;
case gYearMonth: // Year, MonthDay, [TimeZone]
case d... | [
"public",
"DateTimeValue",
"decodeDateTimeValue",
"(",
"DateTimeType",
"type",
")",
"throws",
"IOException",
"{",
"int",
"year",
"=",
"0",
",",
"monthDay",
"=",
"0",
",",
"time",
"=",
"0",
",",
"fractionalSecs",
"=",
"0",
";",
"switch",
"(",
"type",
")",
... | Decode Date-Time as sequence of values representing the individual
components of the Date-Time. | [
"Decode",
"Date",
"-",
"Time",
"as",
"sequence",
"of",
"values",
"representing",
"the",
"individual",
"components",
"of",
"the",
"Date",
"-",
"Time",
"."
] | b6026c5fd39e9cc3d7874caa20f084e264e0ddc7 | https://github.com/EXIficient/exificient-core/blob/b6026c5fd39e9cc3d7874caa20f084e264e0ddc7/src/main/java/com/siemens/ct/exi/core/io/channel/AbstractDecoderChannel.java#L329-L373 | train |
datasalt/pangool | core/src/main/java/com/datasalt/pangool/tuplemr/MultipleInputsInterface.java | MultipleInputsInterface.configureJob | public Set<String> configureJob(Job job) throws FileNotFoundException, IOException {
Set<String> instanceFiles = new HashSet<String>();
for (Map.Entry<Path, List<Input>> entry : multiInputs.entrySet()) {
for (int inputId = 0; inputId < entry.getValue().size(); inputId++) {
Input input = entry.getV... | java | public Set<String> configureJob(Job job) throws FileNotFoundException, IOException {
Set<String> instanceFiles = new HashSet<String>();
for (Map.Entry<Path, List<Input>> entry : multiInputs.entrySet()) {
for (int inputId = 0; inputId < entry.getValue().size(); inputId++) {
Input input = entry.getV... | [
"public",
"Set",
"<",
"String",
">",
"configureJob",
"(",
"Job",
"job",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
"{",
"Set",
"<",
"String",
">",
"instanceFiles",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"Ma... | Use this method for configuring a Job instance according to the multiple
input specs that has been specified. Returns the instance files created. | [
"Use",
"this",
"method",
"for",
"configuring",
"a",
"Job",
"instance",
"according",
"to",
"the",
"multiple",
"input",
"specs",
"that",
"has",
"been",
"specified",
".",
"Returns",
"the",
"instance",
"files",
"created",
"."
] | bfd312dd78cba03febaf7988ae96a3d4bc585408 | https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/tuplemr/MultipleInputsInterface.java#L56-L66 | train |
meltmedia/cadmium | cli/src/main/java/com/meltmedia/cadmium/cli/HistoryCommand.java | HistoryCommand.waitForToken | public static void waitForToken(String siteUri, String token, Long since, Long timeout) throws Exception {
if(!siteUri.endsWith("/system/history")) {
siteUri += "/system/history";
}
siteUri += "/" + token;
if(since != null) {
siteUri += "/" + since;
}
HttpClient httpClient = ht... | java | public static void waitForToken(String siteUri, String token, Long since, Long timeout) throws Exception {
if(!siteUri.endsWith("/system/history")) {
siteUri += "/system/history";
}
siteUri += "/" + token;
if(since != null) {
siteUri += "/" + since;
}
HttpClient httpClient = ht... | [
"public",
"static",
"void",
"waitForToken",
"(",
"String",
"siteUri",
",",
"String",
"token",
",",
"Long",
"since",
",",
"Long",
"timeout",
")",
"throws",
"Exception",
"{",
"if",
"(",
"!",
"siteUri",
".",
"endsWith",
"(",
"\"/system/history\"",
")",
")",
"... | Waits until a timeout is reached or a token shows up in the history of a site as finished or failed.
@param siteUri The uri to a cadmium site.
@param token The token that represents a history event to wait for.
@param since A timestamp to pass on the the cadmium site to set a limit on how far back to check the history... | [
"Waits",
"until",
"a",
"timeout",
"is",
"reached",
"or",
"a",
"token",
"shows",
"up",
"in",
"the",
"history",
"of",
"a",
"site",
"as",
"finished",
"or",
"failed",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/cli/src/main/java/com/meltmedia/cadmium/cli/HistoryCommand.java#L135-L172 | train |
meltmedia/cadmium | cli/src/main/java/com/meltmedia/cadmium/cli/HistoryCommand.java | HistoryCommand.getHistory | public static List<HistoryEntry> getHistory(String siteUri, int limit, boolean filter, String token)
throws URISyntaxException, IOException, ClientProtocolException, Exception {
if(!siteUri.endsWith("/system/history")) {
siteUri += "/system/history";
}
List<HistoryEntry> history = null;
... | java | public static List<HistoryEntry> getHistory(String siteUri, int limit, boolean filter, String token)
throws URISyntaxException, IOException, ClientProtocolException, Exception {
if(!siteUri.endsWith("/system/history")) {
siteUri += "/system/history";
}
List<HistoryEntry> history = null;
... | [
"public",
"static",
"List",
"<",
"HistoryEntry",
">",
"getHistory",
"(",
"String",
"siteUri",
",",
"int",
"limit",
",",
"boolean",
"filter",
",",
"String",
"token",
")",
"throws",
"URISyntaxException",
",",
"IOException",
",",
"ClientProtocolException",
",",
"Ex... | Retrieves the history of a Cadmium site.
@param siteUri The uri of a cadmium site.
@param limit The maximum number of history entries to retrieve or if set to -1 tells the site to retrieve all history.
@param filter If true filters out the non revertable history entries.
@param token The Github API token to pass to th... | [
"Retrieves",
"the",
"history",
"of",
"a",
"Cadmium",
"site",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/cli/src/main/java/com/meltmedia/cadmium/cli/HistoryCommand.java#L189-L241 | train |
meltmedia/cadmium | cli/src/main/java/com/meltmedia/cadmium/cli/HistoryCommand.java | HistoryCommand.printComments | private static void printComments(String comment) {
int index = 0;
int nextIndex = 154;
while(index < comment.length()) {
nextIndex = nextIndex <= comment.length() ? nextIndex : comment.length();
String commentSegment = comment.substring(index, nextIndex);
int lastSpace = commentSegment.la... | java | private static void printComments(String comment) {
int index = 0;
int nextIndex = 154;
while(index < comment.length()) {
nextIndex = nextIndex <= comment.length() ? nextIndex : comment.length();
String commentSegment = comment.substring(index, nextIndex);
int lastSpace = commentSegment.la... | [
"private",
"static",
"void",
"printComments",
"(",
"String",
"comment",
")",
"{",
"int",
"index",
"=",
"0",
";",
"int",
"nextIndex",
"=",
"154",
";",
"while",
"(",
"index",
"<",
"comment",
".",
"length",
"(",
")",
")",
"{",
"nextIndex",
"=",
"nextIndex... | Helper method to format comments to standard out.
@param comment | [
"Helper",
"method",
"to",
"format",
"comments",
"to",
"standard",
"out",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/cli/src/main/java/com/meltmedia/cadmium/cli/HistoryCommand.java#L248-L278 | train |
meltmedia/cadmium | cli/src/main/java/com/meltmedia/cadmium/cli/HistoryCommand.java | HistoryCommand.formatTimeLive | private static String formatTimeLive(long timeLive) {
String timeString = "ms";
timeString = (timeLive % 1000) + timeString;
timeLive = timeLive / 1000;
if(timeLive > 0) {
timeString = (timeLive % 60) + "s" + timeString;
timeLive = timeLive / 60;
if(timeLive > 0) {
timeString =... | java | private static String formatTimeLive(long timeLive) {
String timeString = "ms";
timeString = (timeLive % 1000) + timeString;
timeLive = timeLive / 1000;
if(timeLive > 0) {
timeString = (timeLive % 60) + "s" + timeString;
timeLive = timeLive / 60;
if(timeLive > 0) {
timeString =... | [
"private",
"static",
"String",
"formatTimeLive",
"(",
"long",
"timeLive",
")",
"{",
"String",
"timeString",
"=",
"\"ms\"",
";",
"timeString",
"=",
"(",
"timeLive",
"%",
"1000",
")",
"+",
"timeString",
";",
"timeLive",
"=",
"timeLive",
"/",
"1000",
";",
"if... | Helper method to format a timestamp.
@param timeLive
@return | [
"Helper",
"method",
"to",
"format",
"a",
"timestamp",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/cli/src/main/java/com/meltmedia/cadmium/cli/HistoryCommand.java#L286-L306 | train |
meltmedia/cadmium | servlets/src/main/java/com/meltmedia/cadmium/servlets/XForwardedSecureRedirectStrategy.java | XForwardedSecureRedirectStrategy.isSecure | @Override
public boolean isSecure(HttpServletRequest request) {
String proto = request.getHeader(X_FORWARED_PROTO);
if( proto != null ) return proto.equalsIgnoreCase(HTTPS_PROTOCOL);
return super.isSecure(request);
} | java | @Override
public boolean isSecure(HttpServletRequest request) {
String proto = request.getHeader(X_FORWARED_PROTO);
if( proto != null ) return proto.equalsIgnoreCase(HTTPS_PROTOCOL);
return super.isSecure(request);
} | [
"@",
"Override",
"public",
"boolean",
"isSecure",
"(",
"HttpServletRequest",
"request",
")",
"{",
"String",
"proto",
"=",
"request",
".",
"getHeader",
"(",
"X_FORWARED_PROTO",
")",
";",
"if",
"(",
"proto",
"!=",
"null",
")",
"return",
"proto",
".",
"equalsIg... | When the X-Forwarded-Proto header is present, this method returns true if the header equals "https", false otherwise. When
the header is not present, it delegates this call to the super class. | [
"When",
"the",
"X",
"-",
"Forwarded",
"-",
"Proto",
"header",
"is",
"present",
"this",
"method",
"returns",
"true",
"if",
"the",
"header",
"equals",
"https",
"false",
"otherwise",
".",
"When",
"the",
"header",
"is",
"not",
"present",
"it",
"delegates",
"th... | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/servlets/src/main/java/com/meltmedia/cadmium/servlets/XForwardedSecureRedirectStrategy.java#L38-L43 | train |
meltmedia/cadmium | servlets/src/main/java/com/meltmedia/cadmium/servlets/XForwardedSecureRedirectStrategy.java | XForwardedSecureRedirectStrategy.getProtocol | @Override
public String getProtocol(HttpServletRequest request) {
String proto = request.getHeader(X_FORWARED_PROTO);
if( proto != null ) return proto;
return super.getProtocol(request);
} | java | @Override
public String getProtocol(HttpServletRequest request) {
String proto = request.getHeader(X_FORWARED_PROTO);
if( proto != null ) return proto;
return super.getProtocol(request);
} | [
"@",
"Override",
"public",
"String",
"getProtocol",
"(",
"HttpServletRequest",
"request",
")",
"{",
"String",
"proto",
"=",
"request",
".",
"getHeader",
"(",
"X_FORWARED_PROTO",
")",
";",
"if",
"(",
"proto",
"!=",
"null",
")",
"return",
"proto",
";",
"return... | When the X-Forwarded-Proto header is present, this method returns the value of that header. When
the header is not present, it delegates this call to the super class. | [
"When",
"the",
"X",
"-",
"Forwarded",
"-",
"Proto",
"header",
"is",
"present",
"this",
"method",
"returns",
"the",
"value",
"of",
"that",
"header",
".",
"When",
"the",
"header",
"is",
"not",
"present",
"it",
"delegates",
"this",
"call",
"to",
"the",
"sup... | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/servlets/src/main/java/com/meltmedia/cadmium/servlets/XForwardedSecureRedirectStrategy.java#L49-L54 | train |
meltmedia/cadmium | servlets/src/main/java/com/meltmedia/cadmium/servlets/XForwardedSecureRedirectStrategy.java | XForwardedSecureRedirectStrategy.getPort | @Override
public int getPort(HttpServletRequest request) {
String portValue = request.getHeader(X_FORWARED_PORT);
if( portValue != null ) return Integer.parseInt(portValue);
return super.getPort(request);
} | java | @Override
public int getPort(HttpServletRequest request) {
String portValue = request.getHeader(X_FORWARED_PORT);
if( portValue != null ) return Integer.parseInt(portValue);
return super.getPort(request);
} | [
"@",
"Override",
"public",
"int",
"getPort",
"(",
"HttpServletRequest",
"request",
")",
"{",
"String",
"portValue",
"=",
"request",
".",
"getHeader",
"(",
"X_FORWARED_PORT",
")",
";",
"if",
"(",
"portValue",
"!=",
"null",
")",
"return",
"Integer",
".",
"pars... | When the X-Forwarded-Port header is present, this method returns the value of that header. When
the header is not present, it delegates this call to the super class. | [
"When",
"the",
"X",
"-",
"Forwarded",
"-",
"Port",
"header",
"is",
"present",
"this",
"method",
"returns",
"the",
"value",
"of",
"that",
"header",
".",
"When",
"the",
"header",
"is",
"not",
"present",
"it",
"delegates",
"this",
"call",
"to",
"the",
"supe... | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/servlets/src/main/java/com/meltmedia/cadmium/servlets/XForwardedSecureRedirectStrategy.java#L60-L65 | train |
meltmedia/cadmium | servlets/src/main/java/com/meltmedia/cadmium/servlets/FileServlet.java | FileServlet.contentTypeOf | public String contentTypeOf( String path ) throws IOException {
File file = findFile(path);
return lookupMimeType(file.getName());
} | java | public String contentTypeOf( String path ) throws IOException {
File file = findFile(path);
return lookupMimeType(file.getName());
} | [
"public",
"String",
"contentTypeOf",
"(",
"String",
"path",
")",
"throws",
"IOException",
"{",
"File",
"file",
"=",
"findFile",
"(",
"path",
")",
";",
"return",
"lookupMimeType",
"(",
"file",
".",
"getName",
"(",
")",
")",
";",
"}"
] | Returns the content type for the specified path.
@param path the path to look up.
@return the content type for the path.
@throws FileNotFoundException if a file (or welcome file) does not exist at path.
@throws IOException if any other problem prevents the lookup of the content type. | [
"Returns",
"the",
"content",
"type",
"for",
"the",
"specified",
"path",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/servlets/src/main/java/com/meltmedia/cadmium/servlets/FileServlet.java#L92-L95 | train |
meltmedia/cadmium | servlets/src/main/java/com/meltmedia/cadmium/servlets/FileServlet.java | FileServlet.findFile | public File findFile( String path ) throws IOException {
File base = new File(getBasePath());
File pathFile = new File(base, "."+path);
if( !pathFile.exists()) throw new FileNotFoundException("No file or directory at "+pathFile.getCanonicalPath());
if( pathFile.isFile()) return pathFile;
pathFile = new F... | java | public File findFile( String path ) throws IOException {
File base = new File(getBasePath());
File pathFile = new File(base, "."+path);
if( !pathFile.exists()) throw new FileNotFoundException("No file or directory at "+pathFile.getCanonicalPath());
if( pathFile.isFile()) return pathFile;
pathFile = new F... | [
"public",
"File",
"findFile",
"(",
"String",
"path",
")",
"throws",
"IOException",
"{",
"File",
"base",
"=",
"new",
"File",
"(",
"getBasePath",
"(",
")",
")",
";",
"File",
"pathFile",
"=",
"new",
"File",
"(",
"base",
",",
"\".\"",
"+",
"path",
")",
"... | Returns the file object for the given path, including welcome file lookup. If the file cannot be found, a
FileNotFoundException is returned.
@param path the path to look up.
@return the file object for that path.
@throws FileNotFoundException if the file could not be found.
@throws IOException if any other problem pr... | [
"Returns",
"the",
"file",
"object",
"for",
"the",
"given",
"path",
"including",
"welcome",
"file",
"lookup",
".",
"If",
"the",
"file",
"cannot",
"be",
"found",
"a",
"FileNotFoundException",
"is",
"returned",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/servlets/src/main/java/com/meltmedia/cadmium/servlets/FileServlet.java#L106-L114 | train |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/git/DelayedGitServiceInitializer.java | DelayedGitServiceInitializer.setGitService | public void setGitService(GitService git) {
if(git != null) {
logger.debug("Setting git service");
this.git = git;
latch.countDown();
}
} | java | public void setGitService(GitService git) {
if(git != null) {
logger.debug("Setting git service");
this.git = git;
latch.countDown();
}
} | [
"public",
"void",
"setGitService",
"(",
"GitService",
"git",
")",
"{",
"if",
"(",
"git",
"!=",
"null",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Setting git service\"",
")",
";",
"this",
".",
"git",
"=",
"git",
";",
"latch",
".",
"countDown",
"(",
")",... | Sets the common reference an releases any threads waiting for the reference to be set.
@param git | [
"Sets",
"the",
"common",
"reference",
"an",
"releases",
"any",
"threads",
"waiting",
"for",
"the",
"reference",
"to",
"be",
"set",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/git/DelayedGitServiceInitializer.java#L150-L156 | train |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/git/DelayedGitServiceInitializer.java | DelayedGitServiceInitializer.close | @Override
public void close() throws IOException {
if(git != null) {
IOUtils.closeQuietly(git);
git = null;
}
latch.countDown();
try {
latch.notifyAll();
} catch(Exception e) {
logger.trace("Failed to notifyAll");
}
try {
locker.notifyAll();
} catch(Except... | java | @Override
public void close() throws IOException {
if(git != null) {
IOUtils.closeQuietly(git);
git = null;
}
latch.countDown();
try {
latch.notifyAll();
} catch(Exception e) {
logger.trace("Failed to notifyAll");
}
try {
locker.notifyAll();
} catch(Except... | [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"git",
"!=",
"null",
")",
"{",
"IOUtils",
".",
"closeQuietly",
"(",
"git",
")",
";",
"git",
"=",
"null",
";",
"}",
"latch",
".",
"countDown",
"(",
")",
"... | Releases any used resources and waiting threads.
@throws IOException | [
"Releases",
"any",
"used",
"resources",
"and",
"waiting",
"threads",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/git/DelayedGitServiceInitializer.java#L163-L180 | train |
EXIficient/exificient-core | src/main/java/com/siemens/ct/exi/core/io/compression/EXIInflaterInputStream.java | EXIInflaterInputStream.read | public int read(byte[] b, int off, int len) throws IOException {
ensureOpen();
if ((off | len | (off + len) | (b.length - (off + len))) < 0) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
return 0;
}
try {
int n;
while ((n = inf.inflate(b, off, len)) == 0) {
if (inf.finished()... | java | public int read(byte[] b, int off, int len) throws IOException {
ensureOpen();
if ((off | len | (off + len) | (b.length - (off + len))) < 0) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
return 0;
}
try {
int n;
while ((n = inf.inflate(b, off, len)) == 0) {
if (inf.finished()... | [
"public",
"int",
"read",
"(",
"byte",
"[",
"]",
"b",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"ensureOpen",
"(",
")",
";",
"if",
"(",
"(",
"off",
"|",
"len",
"|",
"(",
"off",
"+",
"len",
")",
"|",
"(",
"b",
"."... | Reads uncompressed data into an array of bytes. This method will block
until some input can be decompressed.
@param b
the buffer into which the data is read
@param off
the start offset of the data
@param len
the maximum number of bytes read
@return the actual number of bytes read, or -1 if the end of the
compressed in... | [
"Reads",
"uncompressed",
"data",
"into",
"an",
"array",
"of",
"bytes",
".",
"This",
"method",
"will",
"block",
"until",
"some",
"input",
"can",
"be",
"decompressed",
"."
] | b6026c5fd39e9cc3d7874caa20f084e264e0ddc7 | https://github.com/EXIficient/exificient-core/blob/b6026c5fd39e9cc3d7874caa20f084e264e0ddc7/src/main/java/com/siemens/ct/exi/core/io/compression/EXIInflaterInputStream.java#L180-L203 | train |
datasalt/pangool | core/src/main/java/com/datasalt/pangool/utils/CommonUtils.java | CommonUtils.writeTXT | public static void writeTXT(String string, File file) throws IOException {
BufferedWriter out = new BufferedWriter(new FileWriter(file));
out.write(string);
out.close();
} | java | public static void writeTXT(String string, File file) throws IOException {
BufferedWriter out = new BufferedWriter(new FileWriter(file));
out.write(string);
out.close();
} | [
"public",
"static",
"void",
"writeTXT",
"(",
"String",
"string",
",",
"File",
"file",
")",
"throws",
"IOException",
"{",
"BufferedWriter",
"out",
"=",
"new",
"BufferedWriter",
"(",
"new",
"FileWriter",
"(",
"file",
")",
")",
";",
"out",
".",
"write",
"(",
... | Writes the string into the file. | [
"Writes",
"the",
"string",
"into",
"the",
"file",
"."
] | bfd312dd78cba03febaf7988ae96a3d4bc585408 | https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/utils/CommonUtils.java#L39-L43 | train |
EXIficient/exificient-core | src/main/java/com/siemens/ct/exi/core/DecodingOptions.java | DecodingOptions.setOption | public void setOption(String key) throws UnsupportedOption {
if (key.equals(IGNORE_SCHEMA_ID)) {
options.add(key);
} else {
throw new UnsupportedOption("DecodingOption '" + key
+ "' is unknown!");
}
} | java | public void setOption(String key) throws UnsupportedOption {
if (key.equals(IGNORE_SCHEMA_ID)) {
options.add(key);
} else {
throw new UnsupportedOption("DecodingOption '" + key
+ "' is unknown!");
}
} | [
"public",
"void",
"setOption",
"(",
"String",
"key",
")",
"throws",
"UnsupportedOption",
"{",
"if",
"(",
"key",
".",
"equals",
"(",
"IGNORE_SCHEMA_ID",
")",
")",
"{",
"options",
".",
"add",
"(",
"key",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"Unsup... | Enables given option.
<p>
Note: Some options (e.g. INCLUDE_SCHEMA_ID) will only take effect if the
EXI options document is set to encode options in general (see
INCLUDE_OPTIONS).
</p>
@param key
referring to a specific option
@throws UnsupportedOption
if option is not supported | [
"Enables",
"given",
"option",
"."
] | b6026c5fd39e9cc3d7874caa20f084e264e0ddc7 | https://github.com/EXIficient/exificient-core/blob/b6026c5fd39e9cc3d7874caa20f084e264e0ddc7/src/main/java/com/siemens/ct/exi/core/DecodingOptions.java#L79-L86 | train |
EXIficient/exificient-core | src/main/java/com/siemens/ct/exi/core/io/channel/ByteEncoderChannel.java | ByteEncoderChannel.encodeNBitUnsignedInteger | public void encodeNBitUnsignedInteger(int b, int n) throws IOException {
if (b < 0 || n < 0) {
throw new IllegalArgumentException(
"Negative value as unsigned integer!");
}
assert (b >= 0);
assert (n >= 0);
if (n == 0) {
// 0 bytes
} else if (n < 9) {
// 1 byte
encode(b & 0xff);
} else i... | java | public void encodeNBitUnsignedInteger(int b, int n) throws IOException {
if (b < 0 || n < 0) {
throw new IllegalArgumentException(
"Negative value as unsigned integer!");
}
assert (b >= 0);
assert (n >= 0);
if (n == 0) {
// 0 bytes
} else if (n < 9) {
// 1 byte
encode(b & 0xff);
} else i... | [
"public",
"void",
"encodeNBitUnsignedInteger",
"(",
"int",
"b",
",",
"int",
"n",
")",
"throws",
"IOException",
"{",
"if",
"(",
"b",
"<",
"0",
"||",
"n",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Negative value as unsigned integer!... | Encode n-bit unsigned integer using the minimum number of bytes required
to store n bits. The n least significant bits of parameter b starting
with the most significant, i.e. from left to right. | [
"Encode",
"n",
"-",
"bit",
"unsigned",
"integer",
"using",
"the",
"minimum",
"number",
"of",
"bytes",
"required",
"to",
"store",
"n",
"bits",
".",
"The",
"n",
"least",
"significant",
"bits",
"of",
"parameter",
"b",
"starting",
"with",
"the",
"most",
"signi... | b6026c5fd39e9cc3d7874caa20f084e264e0ddc7 | https://github.com/EXIficient/exificient-core/blob/b6026c5fd39e9cc3d7874caa20f084e264e0ddc7/src/main/java/com/siemens/ct/exi/core/io/channel/ByteEncoderChannel.java#L93-L125 | train |
datasalt/pangool | core/src/main/java/com/datasalt/pangool/PangoolDriver.java | PangoolDriver.addClass | @SuppressWarnings("rawtypes")
public void addClass(String name, Class mainClass, String description) throws Throwable {
programs.put(name, new ProgramDescription(mainClass, description));
} | java | @SuppressWarnings("rawtypes")
public void addClass(String name, Class mainClass, String description) throws Throwable {
programs.put(name, new ProgramDescription(mainClass, description));
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"void",
"addClass",
"(",
"String",
"name",
",",
"Class",
"mainClass",
",",
"String",
"description",
")",
"throws",
"Throwable",
"{",
"programs",
".",
"put",
"(",
"name",
",",
"new",
"ProgramDescripti... | This is the method that adds the classed to the repository
@param name
The name of the string you want the class instance to be called with
@param mainClass
The class that you want to add to the repository
@param description
The description of the class
@throws NoSuchMethodException
@throws SecurityException | [
"This",
"is",
"the",
"method",
"that",
"adds",
"the",
"classed",
"to",
"the",
"repository"
] | bfd312dd78cba03febaf7988ae96a3d4bc585408 | https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/PangoolDriver.java#L88-L91 | train |
datasalt/pangool | core/src/main/java/com/datasalt/pangool/PangoolDriver.java | PangoolDriver.driver | public void driver(String[] args) throws Throwable {
// Make sure they gave us a program name.
if(args.length == 0) {
System.out.println("An example program must be given as the" + " first argument.");
printUsage(programs);
throw new IllegalArgumentException("An example program must be given " + "as the fi... | java | public void driver(String[] args) throws Throwable {
// Make sure they gave us a program name.
if(args.length == 0) {
System.out.println("An example program must be given as the" + " first argument.");
printUsage(programs);
throw new IllegalArgumentException("An example program must be given " + "as the fi... | [
"public",
"void",
"driver",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Throwable",
"{",
"// Make sure they gave us a program name.",
"if",
"(",
"args",
".",
"length",
"==",
"0",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"An example program m... | This is a driver for the example programs. It looks at the first command line argument and tries to find an example
program with that name. If it is found, it calls the main method in that class with the rest of the command line
arguments.
@param args
The argument from the user. args[0] is the command to run.
@throws ... | [
"This",
"is",
"a",
"driver",
"for",
"the",
"example",
"programs",
".",
"It",
"looks",
"at",
"the",
"first",
"command",
"line",
"argument",
"and",
"tries",
"to",
"find",
"an",
"example",
"program",
"with",
"that",
"name",
".",
"If",
"it",
"is",
"found",
... | bfd312dd78cba03febaf7988ae96a3d4bc585408 | https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/PangoolDriver.java#L107-L129 | train |
datasalt/pangool | core/src/main/java/com/datasalt/pangool/serialization/HadoopSerialization.java | HadoopSerialization.ser | public void ser(Object datum, OutputStream output) throws IOException {
Map<Class, Serializer> serializers = cachedSerializers.get();
Serializer ser = serializers.get(datum.getClass());
if(ser == null) {
ser = serialization.getSerializer(datum.getClass());
if(ser == null) {
throw new IOException("Serial... | java | public void ser(Object datum, OutputStream output) throws IOException {
Map<Class, Serializer> serializers = cachedSerializers.get();
Serializer ser = serializers.get(datum.getClass());
if(ser == null) {
ser = serialization.getSerializer(datum.getClass());
if(ser == null) {
throw new IOException("Serial... | [
"public",
"void",
"ser",
"(",
"Object",
"datum",
",",
"OutputStream",
"output",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"Class",
",",
"Serializer",
">",
"serializers",
"=",
"cachedSerializers",
".",
"get",
"(",
")",
";",
"Serializer",
"ser",
"=",
"s... | Serializes the given object using the Hadoop serialization system. | [
"Serializes",
"the",
"given",
"object",
"using",
"the",
"Hadoop",
"serialization",
"system",
"."
] | bfd312dd78cba03febaf7988ae96a3d4bc585408 | https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/serialization/HadoopSerialization.java#L72-L85 | train |
datasalt/pangool | core/src/main/java/com/datasalt/pangool/serialization/HadoopSerialization.java | HadoopSerialization.deser | public <T> T deser(Object obj, InputStream in) throws IOException {
Map<Class, Deserializer> deserializers = cachedDeserializers.get();
Deserializer deSer = deserializers.get(obj.getClass());
if(deSer == null) {
deSer = serialization.getDeserializer(obj.getClass());
deserializers.put(obj.getClass(), deSer);... | java | public <T> T deser(Object obj, InputStream in) throws IOException {
Map<Class, Deserializer> deserializers = cachedDeserializers.get();
Deserializer deSer = deserializers.get(obj.getClass());
if(deSer == null) {
deSer = serialization.getDeserializer(obj.getClass());
deserializers.put(obj.getClass(), deSer);... | [
"public",
"<",
"T",
">",
"T",
"deser",
"(",
"Object",
"obj",
",",
"InputStream",
"in",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"Class",
",",
"Deserializer",
">",
"deserializers",
"=",
"cachedDeserializers",
".",
"get",
"(",
")",
";",
"Deserializer",... | Deseerializes into the given object using the Hadoop serialization system.
Object cannot be null. | [
"Deseerializes",
"into",
"the",
"given",
"object",
"using",
"the",
"Hadoop",
"serialization",
"system",
".",
"Object",
"cannot",
"be",
"null",
"."
] | bfd312dd78cba03febaf7988ae96a3d4bc585408 | https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/serialization/HadoopSerialization.java#L91-L102 | train |
datasalt/pangool | core/src/main/java/com/datasalt/pangool/serialization/HadoopSerialization.java | HadoopSerialization.deser | public <T> T deser(Object obj, byte[] array, int offset, int length) throws IOException {
Map<Class, Deserializer> deserializers = cachedDeserializers.get();
Deserializer deSer = deserializers.get(obj.getClass());
if(deSer == null) {
deSer = serialization.getDeserializer(obj.getClass());
deserializers.put(o... | java | public <T> T deser(Object obj, byte[] array, int offset, int length) throws IOException {
Map<Class, Deserializer> deserializers = cachedDeserializers.get();
Deserializer deSer = deserializers.get(obj.getClass());
if(deSer == null) {
deSer = serialization.getDeserializer(obj.getClass());
deserializers.put(o... | [
"public",
"<",
"T",
">",
"T",
"deser",
"(",
"Object",
"obj",
",",
"byte",
"[",
"]",
"array",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"Class",
",",
"Deserializer",
">",
"deserializers",
"=",
"cachedDese... | Deserialize an object using Hadoop serialization from a byte array. The
object cannot be null. | [
"Deserialize",
"an",
"object",
"using",
"Hadoop",
"serialization",
"from",
"a",
"byte",
"array",
".",
"The",
"object",
"cannot",
"be",
"null",
"."
] | bfd312dd78cba03febaf7988ae96a3d4bc585408 | https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/serialization/HadoopSerialization.java#L126-L140 | train |
meltmedia/cadmium | servlets/src/main/java/com/meltmedia/cadmium/servlets/BasicFileServlet.java | BasicFileServlet.copyPartialContent | public static void copyPartialContent(InputStream in, OutputStream out, Range r) throws IOException {
IOUtils.copyLarge(in, out, r.start, r.length);
} | java | public static void copyPartialContent(InputStream in, OutputStream out, Range r) throws IOException {
IOUtils.copyLarge(in, out, r.start, r.length);
} | [
"public",
"static",
"void",
"copyPartialContent",
"(",
"InputStream",
"in",
",",
"OutputStream",
"out",
",",
"Range",
"r",
")",
"throws",
"IOException",
"{",
"IOUtils",
".",
"copyLarge",
"(",
"in",
",",
"out",
",",
"r",
".",
"start",
",",
"r",
".",
"leng... | Copies the given range of bytes from the input stream to the output stream.
@param in
@param out
@param r
@throws IOException | [
"Copies",
"the",
"given",
"range",
"of",
"bytes",
"from",
"the",
"input",
"stream",
"to",
"the",
"output",
"stream",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/servlets/src/main/java/com/meltmedia/cadmium/servlets/BasicFileServlet.java#L225-L227 | train |
meltmedia/cadmium | servlets/src/main/java/com/meltmedia/cadmium/servlets/BasicFileServlet.java | BasicFileServlet.calculateRangeLength | public static Long calculateRangeLength(FileRequestContext context, Range range) {
if(range.start == -1) range.start = 0;
if(range.end == -1) range.end = context.file.length() - 1;
range.length = range.end - range.start + 1;
return range.length;
} | java | public static Long calculateRangeLength(FileRequestContext context, Range range) {
if(range.start == -1) range.start = 0;
if(range.end == -1) range.end = context.file.length() - 1;
range.length = range.end - range.start + 1;
return range.length;
} | [
"public",
"static",
"Long",
"calculateRangeLength",
"(",
"FileRequestContext",
"context",
",",
"Range",
"range",
")",
"{",
"if",
"(",
"range",
".",
"start",
"==",
"-",
"1",
")",
"range",
".",
"start",
"=",
"0",
";",
"if",
"(",
"range",
".",
"end",
"=="... | Calculates the length of a given range.
@param context
@param range
@return | [
"Calculates",
"the",
"length",
"of",
"a",
"given",
"range",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/servlets/src/main/java/com/meltmedia/cadmium/servlets/BasicFileServlet.java#L236-L241 | train |
meltmedia/cadmium | servlets/src/main/java/com/meltmedia/cadmium/servlets/BasicFileServlet.java | BasicFileServlet.checkAccepts | protected boolean checkAccepts(FileRequestContext context) throws IOException {
if (!canAccept(context.request.getHeader(ACCEPT_HEADER), false, context.contentType)) {
notAcceptable(context);
return true;
}
if (!(canAccept(context.request.getHeader(ACCEPT_ENCODING_HEADER), false, "identity"... | java | protected boolean checkAccepts(FileRequestContext context) throws IOException {
if (!canAccept(context.request.getHeader(ACCEPT_HEADER), false, context.contentType)) {
notAcceptable(context);
return true;
}
if (!(canAccept(context.request.getHeader(ACCEPT_ENCODING_HEADER), false, "identity"... | [
"protected",
"boolean",
"checkAccepts",
"(",
"FileRequestContext",
"context",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"canAccept",
"(",
"context",
".",
"request",
".",
"getHeader",
"(",
"ACCEPT_HEADER",
")",
",",
"false",
",",
"context",
".",
"conte... | Checks the accepts headers and makes sure that we can fulfill the request.
@param context
@return
@throws IOException | [
"Checks",
"the",
"accepts",
"headers",
"and",
"makes",
"sure",
"that",
"we",
"can",
"fulfill",
"the",
"request",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/servlets/src/main/java/com/meltmedia/cadmium/servlets/BasicFileServlet.java#L249-L264 | train |
meltmedia/cadmium | servlets/src/main/java/com/meltmedia/cadmium/servlets/BasicFileServlet.java | BasicFileServlet.locateFileToServe | public boolean locateFileToServe( FileRequestContext context ) throws IOException {
context.file = new File( contentDir, context.path);
// if the path is not on the file system, send a 404.
if( !context.file.exists() ) {
context.response.sendError(HttpServletResponse.SC_NOT_FOUND);
return t... | java | public boolean locateFileToServe( FileRequestContext context ) throws IOException {
context.file = new File( contentDir, context.path);
// if the path is not on the file system, send a 404.
if( !context.file.exists() ) {
context.response.sendError(HttpServletResponse.SC_NOT_FOUND);
return t... | [
"public",
"boolean",
"locateFileToServe",
"(",
"FileRequestContext",
"context",
")",
"throws",
"IOException",
"{",
"context",
".",
"file",
"=",
"new",
"File",
"(",
"contentDir",
",",
"context",
".",
"path",
")",
";",
"// if the path is not on the file system, send a 4... | Locates the file to serve. Returns true if locating the file caused the request to be handled.
@param context
@return
@throws IOException | [
"Locates",
"the",
"file",
"to",
"serve",
".",
"Returns",
"true",
"if",
"locating",
"the",
"file",
"caused",
"the",
"request",
"to",
"be",
"handled",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/servlets/src/main/java/com/meltmedia/cadmium/servlets/BasicFileServlet.java#L287-L311 | train |
meltmedia/cadmium | servlets/src/main/java/com/meltmedia/cadmium/servlets/BasicFileServlet.java | BasicFileServlet.invalidRanges | public static void invalidRanges(FileRequestContext context) throws IOException {
context.response.setHeader(CONTENT_RANGE_HEADER, "*/" + context.file.length());
context.response.sendError(HttpServletResponse.SC_REQUESTED_RANGE_NOT_SATISFIABLE);
} | java | public static void invalidRanges(FileRequestContext context) throws IOException {
context.response.setHeader(CONTENT_RANGE_HEADER, "*/" + context.file.length());
context.response.sendError(HttpServletResponse.SC_REQUESTED_RANGE_NOT_SATISFIABLE);
} | [
"public",
"static",
"void",
"invalidRanges",
"(",
"FileRequestContext",
"context",
")",
"throws",
"IOException",
"{",
"context",
".",
"response",
".",
"setHeader",
"(",
"CONTENT_RANGE_HEADER",
",",
"\"*/\"",
"+",
"context",
".",
"file",
".",
"length",
"(",
")",
... | Sets the appropriate response headers and error status for bad ranges
@param context
@throws IOException | [
"Sets",
"the",
"appropriate",
"response",
"headers",
"and",
"error",
"status",
"for",
"bad",
"ranges"
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/servlets/src/main/java/com/meltmedia/cadmium/servlets/BasicFileServlet.java#L392-L395 | train |
meltmedia/cadmium | servlets/src/main/java/com/meltmedia/cadmium/servlets/BasicFileServlet.java | BasicFileServlet.canAccept | public static boolean canAccept(String headerValue, boolean strict, String type) {
if(headerValue != null && type != null) {
String availableTypes[] = headerValue.split(",");
for(String availableType : availableTypes) {
String typeParams[] = availableType.split(";");
double qValue = 1.0... | java | public static boolean canAccept(String headerValue, boolean strict, String type) {
if(headerValue != null && type != null) {
String availableTypes[] = headerValue.split(",");
for(String availableType : availableTypes) {
String typeParams[] = availableType.split(";");
double qValue = 1.0... | [
"public",
"static",
"boolean",
"canAccept",
"(",
"String",
"headerValue",
",",
"boolean",
"strict",
",",
"String",
"type",
")",
"{",
"if",
"(",
"headerValue",
"!=",
"null",
"&&",
"type",
"!=",
"null",
")",
"{",
"String",
"availableTypes",
"[",
"]",
"=",
... | Parses an Accept header value and checks to see if the type is acceptable.
@param headerValue The value of the header.
@param strict Forces the type to be in the header.
@param type The token that we need in order to be acceptable.
@return | [
"Parses",
"an",
"Accept",
"header",
"value",
"and",
"checks",
"to",
"see",
"if",
"the",
"type",
"is",
"acceptable",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/servlets/src/main/java/com/meltmedia/cadmium/servlets/BasicFileServlet.java#L451-L482 | train |
meltmedia/cadmium | servlets/src/main/java/com/meltmedia/cadmium/servlets/BasicFileServlet.java | BasicFileServlet.hasMatch | private static boolean hasMatch(String[] typeParams, String... type) {
boolean matches = false;
for(String t : type) {
for(String typeParam : typeParams) {
if(typeParam.contains("/")) {
String typePart = typeParam.replace("*", "");
if(t.startsWith(typePart) || t.endsWith(typePa... | java | private static boolean hasMatch(String[] typeParams, String... type) {
boolean matches = false;
for(String t : type) {
for(String typeParam : typeParams) {
if(typeParam.contains("/")) {
String typePart = typeParam.replace("*", "");
if(t.startsWith(typePart) || t.endsWith(typePa... | [
"private",
"static",
"boolean",
"hasMatch",
"(",
"String",
"[",
"]",
"typeParams",
",",
"String",
"...",
"type",
")",
"{",
"boolean",
"matches",
"=",
"false",
";",
"for",
"(",
"String",
"t",
":",
"type",
")",
"{",
"for",
"(",
"String",
"typeParam",
":"... | Check to see if a Accept header accept part matches any of the given types.
@param typeParams
@param type
@return | [
"Check",
"to",
"see",
"if",
"a",
"Accept",
"header",
"accept",
"part",
"matches",
"any",
"of",
"the",
"given",
"types",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/servlets/src/main/java/com/meltmedia/cadmium/servlets/BasicFileServlet.java#L490-L510 | train |
meltmedia/cadmium | servlets/src/main/java/com/meltmedia/cadmium/servlets/BasicFileServlet.java | BasicFileServlet.handleWelcomeRedirect | public boolean handleWelcomeRedirect( FileRequestContext context ) throws IOException {
if( context.file.isFile() && context.file.getName().equals("index.html")) {
resolveContentType(context);
String location = context.path.replaceFirst("/index.html\\Z", "");
if( location.isEmpty() ) location = "/... | java | public boolean handleWelcomeRedirect( FileRequestContext context ) throws IOException {
if( context.file.isFile() && context.file.getName().equals("index.html")) {
resolveContentType(context);
String location = context.path.replaceFirst("/index.html\\Z", "");
if( location.isEmpty() ) location = "/... | [
"public",
"boolean",
"handleWelcomeRedirect",
"(",
"FileRequestContext",
"context",
")",
"throws",
"IOException",
"{",
"if",
"(",
"context",
".",
"file",
".",
"isFile",
"(",
")",
"&&",
"context",
".",
"file",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"... | Forces requests for index files to not use the file name.
@param context
@return true if the request was handled, false otherwise.
@throws IOException | [
"Forces",
"requests",
"for",
"index",
"files",
"to",
"not",
"use",
"the",
"file",
"name",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/servlets/src/main/java/com/meltmedia/cadmium/servlets/BasicFileServlet.java#L553-L563 | train |
meltmedia/cadmium | servlets/src/main/java/com/meltmedia/cadmium/servlets/BasicFileServlet.java | BasicFileServlet.resolveContentType | public void resolveContentType(FileRequestContext context) {
String contentType = lookupMimeType(context.file.getName());
if(contentType != null) {
context.contentType = contentType;
if(contentType.equals("text/html")) {
context.contentType += ";charset=UTF-8";
}
}
} | java | public void resolveContentType(FileRequestContext context) {
String contentType = lookupMimeType(context.file.getName());
if(contentType != null) {
context.contentType = contentType;
if(contentType.equals("text/html")) {
context.contentType += ";charset=UTF-8";
}
}
} | [
"public",
"void",
"resolveContentType",
"(",
"FileRequestContext",
"context",
")",
"{",
"String",
"contentType",
"=",
"lookupMimeType",
"(",
"context",
".",
"file",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"contentType",
"!=",
"null",
")",
"{",
"contex... | Looks up the mime type based on file extension and if found sets it on the FileRequestContext.
@param context | [
"Looks",
"up",
"the",
"mime",
"type",
"based",
"on",
"file",
"extension",
"and",
"if",
"found",
"sets",
"it",
"on",
"the",
"FileRequestContext",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/servlets/src/main/java/com/meltmedia/cadmium/servlets/BasicFileServlet.java#L570-L578 | train |
EXIficient/exificient-core | src/main/java/com/siemens/ct/exi/core/io/BitOutputStream.java | BitOutputStream.flushBuffer | protected void flushBuffer() throws IOException {
if (capacity == 0) {
ostream.write(buffer);
capacity = BITS_IN_BYTE;
buffer = 0;
len++;
}
} | java | protected void flushBuffer() throws IOException {
if (capacity == 0) {
ostream.write(buffer);
capacity = BITS_IN_BYTE;
buffer = 0;
len++;
}
} | [
"protected",
"void",
"flushBuffer",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"capacity",
"==",
"0",
")",
"{",
"ostream",
".",
"write",
"(",
"buffer",
")",
";",
"capacity",
"=",
"BITS_IN_BYTE",
";",
"buffer",
"=",
"0",
";",
"len",
"++",
";",
... | If buffer is full, write it out and reset internal state.
@throws IOException
IO exception | [
"If",
"buffer",
"is",
"full",
"write",
"it",
"out",
"and",
"reset",
"internal",
"state",
"."
] | b6026c5fd39e9cc3d7874caa20f084e264e0ddc7 | https://github.com/EXIficient/exificient-core/blob/b6026c5fd39e9cc3d7874caa20f084e264e0ddc7/src/main/java/com/siemens/ct/exi/core/io/BitOutputStream.java#L97-L104 | train |
EXIficient/exificient-core | src/main/java/com/siemens/ct/exi/core/io/BitOutputStream.java | BitOutputStream.align | public void align() throws IOException {
if (capacity < BITS_IN_BYTE) {
ostream.write(buffer << capacity);
capacity = BITS_IN_BYTE;
buffer = 0;
len++;
}
} | java | public void align() throws IOException {
if (capacity < BITS_IN_BYTE) {
ostream.write(buffer << capacity);
capacity = BITS_IN_BYTE;
buffer = 0;
len++;
}
} | [
"public",
"void",
"align",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"capacity",
"<",
"BITS_IN_BYTE",
")",
"{",
"ostream",
".",
"write",
"(",
"buffer",
"<<",
"capacity",
")",
";",
"capacity",
"=",
"BITS_IN_BYTE",
";",
"buffer",
"=",
"0",
";",
... | If there are some unwritten bits, pad them if necessary and write them
out.
@throws IOException
IO exception | [
"If",
"there",
"are",
"some",
"unwritten",
"bits",
"pad",
"them",
"if",
"necessary",
"and",
"write",
"them",
"out",
"."
] | b6026c5fd39e9cc3d7874caa20f084e264e0ddc7 | https://github.com/EXIficient/exificient-core/blob/b6026c5fd39e9cc3d7874caa20f084e264e0ddc7/src/main/java/com/siemens/ct/exi/core/io/BitOutputStream.java#L143-L150 | train |
EXIficient/exificient-core | src/main/java/com/siemens/ct/exi/core/io/BitOutputStream.java | BitOutputStream.writeBits | public void writeBits(int b, int n) throws IOException {
if (n <= capacity) {
// all bits fit into the current buffer
buffer = (buffer << n) | (b & (0xff >> (BITS_IN_BYTE - n)));
capacity -= n;
if (capacity == 0) {
ostream.write(buffer);
capacity = BITS_IN_BYTE;
len++;
}
} else {
// fi... | java | public void writeBits(int b, int n) throws IOException {
if (n <= capacity) {
// all bits fit into the current buffer
buffer = (buffer << n) | (b & (0xff >> (BITS_IN_BYTE - n)));
capacity -= n;
if (capacity == 0) {
ostream.write(buffer);
capacity = BITS_IN_BYTE;
len++;
}
} else {
// fi... | [
"public",
"void",
"writeBits",
"(",
"int",
"b",
",",
"int",
"n",
")",
"throws",
"IOException",
"{",
"if",
"(",
"n",
"<=",
"capacity",
")",
"{",
"// all bits fit into the current buffer",
"buffer",
"=",
"(",
"buffer",
"<<",
"n",
")",
"|",
"(",
"b",
"&",
... | Write the n least significant bits of parameter b starting with the most
significant, i.e. from left to right.
@param b
bits
@param n
number of bits
@throws IOException
IO exception | [
"Write",
"the",
"n",
"least",
"significant",
"bits",
"of",
"parameter",
"b",
"starting",
"with",
"the",
"most",
"significant",
"i",
".",
"e",
".",
"from",
"left",
"to",
"right",
"."
] | b6026c5fd39e9cc3d7874caa20f084e264e0ddc7 | https://github.com/EXIficient/exificient-core/blob/b6026c5fd39e9cc3d7874caa20f084e264e0ddc7/src/main/java/com/siemens/ct/exi/core/io/BitOutputStream.java#L202-L232 | train |
EXIficient/exificient-core | src/main/java/com/siemens/ct/exi/core/io/BitOutputStream.java | BitOutputStream.writeDirectBytes | protected void writeDirectBytes(byte[] b, int off, int len)
throws IOException {
ostream.write(b, off, len);
len += len;
} | java | protected void writeDirectBytes(byte[] b, int off, int len)
throws IOException {
ostream.write(b, off, len);
len += len;
} | [
"protected",
"void",
"writeDirectBytes",
"(",
"byte",
"[",
"]",
"b",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"ostream",
".",
"write",
"(",
"b",
",",
"off",
",",
"len",
")",
";",
"len",
"+=",
"len",
";",
"}"
] | Ignore current buffer, and write a sequence of bytes directly to the
underlying stream.
@param b
byte array
@param off
byte array offset
@param len
byte array length
@throws IOException
IO exception | [
"Ignore",
"current",
"buffer",
"and",
"write",
"a",
"sequence",
"of",
"bytes",
"directly",
"to",
"the",
"underlying",
"stream",
"."
] | b6026c5fd39e9cc3d7874caa20f084e264e0ddc7 | https://github.com/EXIficient/exificient-core/blob/b6026c5fd39e9cc3d7874caa20f084e264e0ddc7/src/main/java/com/siemens/ct/exi/core/io/BitOutputStream.java#L261-L265 | train |
datasalt/pangool | core/src/main/java/com/datasalt/pangool/tuplemr/mapred/lib/input/TupleTextInputFormat.java | TupleTextInputFormat.adaptNumber | private static String adaptNumber(String number) {
String n = number.trim();
if(n.startsWith("+")) {
return n.substring(1);
} else {
return n;
}
} | java | private static String adaptNumber(String number) {
String n = number.trim();
if(n.startsWith("+")) {
return n.substring(1);
} else {
return n;
}
} | [
"private",
"static",
"String",
"adaptNumber",
"(",
"String",
"number",
")",
"{",
"String",
"n",
"=",
"number",
".",
"trim",
"(",
")",
";",
"if",
"(",
"n",
".",
"startsWith",
"(",
"\"+\"",
")",
")",
"{",
"return",
"n",
".",
"substring",
"(",
"1",
")... | Adapt a number for being able to be parsed by Integer and Long | [
"Adapt",
"a",
"number",
"for",
"being",
"able",
"to",
"be",
"parsed",
"by",
"Integer",
"and",
"Long"
] | bfd312dd78cba03febaf7988ae96a3d4bc585408 | https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/tuplemr/mapred/lib/input/TupleTextInputFormat.java#L439-L446 | train |
meltmedia/cadmium | servlets/src/main/java/com/meltmedia/cadmium/servlets/shiro/AuthenticationManagerCommandAction.java | AuthenticationManagerCommandAction.persistRealmChanges | private void persistRealmChanges() {
configManager.persistProperties(realm.getProperties(), new File(applicationContentDir, PersistablePropertiesRealm.REALM_FILE_NAME), null);
} | java | private void persistRealmChanges() {
configManager.persistProperties(realm.getProperties(), new File(applicationContentDir, PersistablePropertiesRealm.REALM_FILE_NAME), null);
} | [
"private",
"void",
"persistRealmChanges",
"(",
")",
"{",
"configManager",
".",
"persistProperties",
"(",
"realm",
".",
"getProperties",
"(",
")",
",",
"new",
"File",
"(",
"applicationContentDir",
",",
"PersistablePropertiesRealm",
".",
"REALM_FILE_NAME",
")",
",",
... | Persists the user accounts to a properties file that is only available to this site only. | [
"Persists",
"the",
"user",
"accounts",
"to",
"a",
"properties",
"file",
"that",
"is",
"only",
"available",
"to",
"this",
"site",
"only",
"."
] | bca585030e141803a73b58abb128d130157b6ddf | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/servlets/src/main/java/com/meltmedia/cadmium/servlets/shiro/AuthenticationManagerCommandAction.java#L80-L82 | train |
datasalt/pangool | core/src/main/java/com/datasalt/pangool/utils/HadoopUtils.java | HadoopUtils.stringToFile | public static void stringToFile(FileSystem fs, Path path, String string)
throws IOException {
OutputStream os = fs.create(path, true);
PrintWriter pw = new PrintWriter(os);
pw.append(string);
pw.close();
} | java | public static void stringToFile(FileSystem fs, Path path, String string)
throws IOException {
OutputStream os = fs.create(path, true);
PrintWriter pw = new PrintWriter(os);
pw.append(string);
pw.close();
} | [
"public",
"static",
"void",
"stringToFile",
"(",
"FileSystem",
"fs",
",",
"Path",
"path",
",",
"String",
"string",
")",
"throws",
"IOException",
"{",
"OutputStream",
"os",
"=",
"fs",
".",
"create",
"(",
"path",
",",
"true",
")",
";",
"PrintWriter",
"pw",
... | Creates a file with the given string, overwritting if needed. | [
"Creates",
"a",
"file",
"with",
"the",
"given",
"string",
"overwritting",
"if",
"needed",
"."
] | bfd312dd78cba03febaf7988ae96a3d4bc585408 | https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/utils/HadoopUtils.java#L59-L65 | train |
datasalt/pangool | core/src/main/java/com/datasalt/pangool/utils/HadoopUtils.java | HadoopUtils.fileToString | public static String fileToString(FileSystem fs, Path path) throws IOException {
if(!fs.exists(path)) {
return null;
}
InputStream is = fs.open(path);
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
char[] buff = new char[256];
StringBuilder sb = new Str... | java | public static String fileToString(FileSystem fs, Path path) throws IOException {
if(!fs.exists(path)) {
return null;
}
InputStream is = fs.open(path);
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
char[] buff = new char[256];
StringBuilder sb = new Str... | [
"public",
"static",
"String",
"fileToString",
"(",
"FileSystem",
"fs",
",",
"Path",
"path",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"fs",
".",
"exists",
"(",
"path",
")",
")",
"{",
"return",
"null",
";",
"}",
"InputStream",
"is",
"=",
"fs",
... | Reads the content of a file into a String. Return null if the file does not
exist. | [
"Reads",
"the",
"content",
"of",
"a",
"file",
"into",
"a",
"String",
".",
"Return",
"null",
"if",
"the",
"file",
"does",
"not",
"exist",
"."
] | bfd312dd78cba03febaf7988ae96a3d4bc585408 | https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/utils/HadoopUtils.java#L71-L87 | train |
datasalt/pangool | core/src/main/java/com/datasalt/pangool/utils/HadoopUtils.java | HadoopUtils.readIntIntMap | public static HashMap<Integer, Integer> readIntIntMap(Path path, FileSystem fs)
throws IOException {
SequenceFile.Reader reader = new SequenceFile.Reader(fs, path, fs.getConf());
IntWritable topic = new IntWritable();
IntWritable value = new IntWritable();
HashMap<Integer, Integer> ret = new HashMap<Inte... | java | public static HashMap<Integer, Integer> readIntIntMap(Path path, FileSystem fs)
throws IOException {
SequenceFile.Reader reader = new SequenceFile.Reader(fs, path, fs.getConf());
IntWritable topic = new IntWritable();
IntWritable value = new IntWritable();
HashMap<Integer, Integer> ret = new HashMap<Inte... | [
"public",
"static",
"HashMap",
"<",
"Integer",
",",
"Integer",
">",
"readIntIntMap",
"(",
"Path",
"path",
",",
"FileSystem",
"fs",
")",
"throws",
"IOException",
"{",
"SequenceFile",
".",
"Reader",
"reader",
"=",
"new",
"SequenceFile",
".",
"Reader",
"(",
"fs... | Reads maps of integer -> integer | [
"Reads",
"maps",
"of",
"integer",
"-",
">",
"integer"
] | bfd312dd78cba03febaf7988ae96a3d4bc585408 | https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/utils/HadoopUtils.java#L127-L144 | train |
ignaciotcrespo/frutilla | java/src/main/java/org/frutilla/FrutillaParser.java | FrutillaParser.scenario | static Scenario scenario(String text) {
reset();
final Scenario scenario = new Scenario(text);
sRoot = scenario;
return scenario;
} | java | static Scenario scenario(String text) {
reset();
final Scenario scenario = new Scenario(text);
sRoot = scenario;
return scenario;
} | [
"static",
"Scenario",
"scenario",
"(",
"String",
"text",
")",
"{",
"reset",
"(",
")",
";",
"final",
"Scenario",
"scenario",
"=",
"new",
"Scenario",
"(",
"text",
")",
";",
"sRoot",
"=",
"scenario",
";",
"return",
"scenario",
";",
"}"
] | Describes the scenario of the use case.
@param text the sentence describing the scenario
@return a Scenario object to conitnue adding sentences | [
"Describes",
"the",
"scenario",
"of",
"the",
"use",
"case",
"."
] | 4b225f8be47b0b12df1b82157f92fa6d0075e9ff | https://github.com/ignaciotcrespo/frutilla/blob/4b225f8be47b0b12df1b82157f92fa6d0075e9ff/java/src/main/java/org/frutilla/FrutillaParser.java#L24-L29 | train |
ignaciotcrespo/frutilla | java/src/main/java/org/frutilla/FrutillaParser.java | FrutillaParser.given | static Given given(String text) {
reset();
final Given given = new Given(text);
sRoot = given;
return given;
} | java | static Given given(String text) {
reset();
final Given given = new Given(text);
sRoot = given;
return given;
} | [
"static",
"Given",
"given",
"(",
"String",
"text",
")",
"{",
"reset",
"(",
")",
";",
"final",
"Given",
"given",
"=",
"new",
"Given",
"(",
"text",
")",
";",
"sRoot",
"=",
"given",
";",
"return",
"given",
";",
"}"
] | Describes the entry point of the use case.
@param text the sentence describing the entry point
@return a Given object to continue adding sentences | [
"Describes",
"the",
"entry",
"point",
"of",
"the",
"use",
"case",
"."
] | 4b225f8be47b0b12df1b82157f92fa6d0075e9ff | https://github.com/ignaciotcrespo/frutilla/blob/4b225f8be47b0b12df1b82157f92fa6d0075e9ff/java/src/main/java/org/frutilla/FrutillaParser.java#L37-L42 | train |
ignaciotcrespo/frutilla | java/src/main/java/org/frutilla/ExceptionUtils.java | ExceptionUtils.insertMessage | public static void insertMessage(Throwable onObject, String msg) {
try {
Field field = Throwable.class.getDeclaredField("detailMessage"); //Method("initCause", new Class[]{Throwable.class});
field.setAccessible(true);
if (onObject.getMessage() != null) {
field... | java | public static void insertMessage(Throwable onObject, String msg) {
try {
Field field = Throwable.class.getDeclaredField("detailMessage"); //Method("initCause", new Class[]{Throwable.class});
field.setAccessible(true);
if (onObject.getMessage() != null) {
field... | [
"public",
"static",
"void",
"insertMessage",
"(",
"Throwable",
"onObject",
",",
"String",
"msg",
")",
"{",
"try",
"{",
"Field",
"field",
"=",
"Throwable",
".",
"class",
".",
"getDeclaredField",
"(",
"\"detailMessage\"",
")",
";",
"//Method(\"initCause\", new Class... | Addes a message at the beginning of the stacktrace. | [
"Addes",
"a",
"message",
"at",
"the",
"beginning",
"of",
"the",
"stacktrace",
"."
] | 4b225f8be47b0b12df1b82157f92fa6d0075e9ff | https://github.com/ignaciotcrespo/frutilla/blob/4b225f8be47b0b12df1b82157f92fa6d0075e9ff/java/src/main/java/org/frutilla/ExceptionUtils.java#L13-L26 | train |
scireum/server-sass | src/main/java/org/serversass/Parser.java | Parser.parse | public Stylesheet parse() throws ParseException {
while (tokenizer.more()) {
if (tokenizer.current().isKeyword(KEYWORD_IMPORT)) {
// Handle @import
parseImport();
} else if (tokenizer.current().isKeyword(KEYWORD_MIXIN)) {
// Handle @mixin
... | java | public Stylesheet parse() throws ParseException {
while (tokenizer.more()) {
if (tokenizer.current().isKeyword(KEYWORD_IMPORT)) {
// Handle @import
parseImport();
} else if (tokenizer.current().isKeyword(KEYWORD_MIXIN)) {
// Handle @mixin
... | [
"public",
"Stylesheet",
"parse",
"(",
")",
"throws",
"ParseException",
"{",
"while",
"(",
"tokenizer",
".",
"more",
"(",
")",
")",
"{",
"if",
"(",
"tokenizer",
".",
"current",
"(",
")",
".",
"isKeyword",
"(",
"KEYWORD_IMPORT",
")",
")",
"{",
"// Handle @... | Parses the given input returning the parsed stylesheet.
@return the AST representation of the parsed input
@throws ParseException if one or more problems occurred while parsing | [
"Parses",
"the",
"given",
"input",
"returning",
"the",
"parsed",
"stylesheet",
"."
] | e74af983567f10c43420d70cd31165dd080ba8fc | https://github.com/scireum/server-sass/blob/e74af983567f10c43420d70cd31165dd080ba8fc/src/main/java/org/serversass/Parser.java#L155-L184 | train |
scireum/server-sass | src/main/java/org/serversass/Parser.java | Parser.parseSection | private Section parseSection(boolean mediaQuery) {
Section section = new Section();
parseSectionSelector(mediaQuery, section);
tokenizer.consumeExpectedSymbol("{");
while (tokenizer.more()) {
if (tokenizer.current().isSymbol("}")) {
tokenizer.consumeExpectedSy... | java | private Section parseSection(boolean mediaQuery) {
Section section = new Section();
parseSectionSelector(mediaQuery, section);
tokenizer.consumeExpectedSymbol("{");
while (tokenizer.more()) {
if (tokenizer.current().isSymbol("}")) {
tokenizer.consumeExpectedSy... | [
"private",
"Section",
"parseSection",
"(",
"boolean",
"mediaQuery",
")",
"{",
"Section",
"section",
"=",
"new",
"Section",
"(",
")",
";",
"parseSectionSelector",
"(",
"mediaQuery",
",",
"section",
")",
";",
"tokenizer",
".",
"consumeExpectedSymbol",
"(",
"\"{\""... | Parses a "section" which is either a media query or a css selector along with a set of attributes.
@param mediaQuery determines if we're about to parse a media query or a "normal" section
@return the parsed section | [
"Parses",
"a",
"section",
"which",
"is",
"either",
"a",
"media",
"query",
"or",
"a",
"css",
"selector",
"along",
"with",
"a",
"set",
"of",
"attributes",
"."
] | e74af983567f10c43420d70cd31165dd080ba8fc | https://github.com/scireum/server-sass/blob/e74af983567f10c43420d70cd31165dd080ba8fc/src/main/java/org/serversass/Parser.java#L192-L219 | train |
duracloud/management-console | account-management-util/src/main/java/org/duracloud/account/db/util/security/impl/AnnotationParserImpl.java | AnnotationParserImpl.getValues | private Object[] getValues(Map<String, Object> annotationAtts) {
if (null == annotationAtts) {
throw new DuraCloudRuntimeException("Arg annotationAtts is null.");
}
List<Object> values = new ArrayList<Object>();
for (String key : annotationAtts.keySet()) {
Objec... | java | private Object[] getValues(Map<String, Object> annotationAtts) {
if (null == annotationAtts) {
throw new DuraCloudRuntimeException("Arg annotationAtts is null.");
}
List<Object> values = new ArrayList<Object>();
for (String key : annotationAtts.keySet()) {
Objec... | [
"private",
"Object",
"[",
"]",
"getValues",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"annotationAtts",
")",
"{",
"if",
"(",
"null",
"==",
"annotationAtts",
")",
"{",
"throw",
"new",
"DuraCloudRuntimeException",
"(",
"\"Arg annotationAtts is null.\"",
")",
... | This method extracts the annotation argument info from the annotation
metadata.
Since the implementation of access for annotation arguments varies, this
method may need to be overwritten by additional AnnotationParsers.
@param annotationAtts mapping of annotation-implementation-dependent
access keys and the annotation... | [
"This",
"method",
"extracts",
"the",
"annotation",
"argument",
"info",
"from",
"the",
"annotation",
"metadata",
".",
"Since",
"the",
"implementation",
"of",
"access",
"for",
"annotation",
"arguments",
"varies",
"this",
"method",
"may",
"need",
"to",
"be",
"overw... | 7331015c01f9ac5cc5c0aa8ae9a2a1a77e9f4ac6 | https://github.com/duracloud/management-console/blob/7331015c01f9ac5cc5c0aa8ae9a2a1a77e9f4ac6/account-management-util/src/main/java/org/duracloud/account/db/util/security/impl/AnnotationParserImpl.java#L148-L163 | train |
duracloud/management-console | account-management-security/src/main/java/org/duracloud/account/security/vote/UserAccessDecisionVoter.java | UserAccessDecisionVoter.getOtherRolesArg | private Set<Role> getOtherRolesArg(Object[] arguments) {
if (arguments.length <= NEW_ROLES_INDEX) {
log.error("Illegal number of args: " + arguments.length);
}
Set<Role> roles = new HashSet<Role>();
Object[] rolesArray = (Object[]) arguments[NEW_ROLES_INDEX];
if (nul... | java | private Set<Role> getOtherRolesArg(Object[] arguments) {
if (arguments.length <= NEW_ROLES_INDEX) {
log.error("Illegal number of args: " + arguments.length);
}
Set<Role> roles = new HashSet<Role>();
Object[] rolesArray = (Object[]) arguments[NEW_ROLES_INDEX];
if (nul... | [
"private",
"Set",
"<",
"Role",
">",
"getOtherRolesArg",
"(",
"Object",
"[",
"]",
"arguments",
")",
"{",
"if",
"(",
"arguments",
".",
"length",
"<=",
"NEW_ROLES_INDEX",
")",
"{",
"log",
".",
"error",
"(",
"\"Illegal number of args: \"",
"+",
"arguments",
".",... | This method returns roles argument of in the target method invocation. | [
"This",
"method",
"returns",
"roles",
"argument",
"of",
"in",
"the",
"target",
"method",
"invocation",
"."
] | 7331015c01f9ac5cc5c0aa8ae9a2a1a77e9f4ac6 | https://github.com/duracloud/management-console/blob/7331015c01f9ac5cc5c0aa8ae9a2a1a77e9f4ac6/account-management-security/src/main/java/org/duracloud/account/security/vote/UserAccessDecisionVoter.java#L170-L184 | train |
duracloud/management-console | account-management-security/src/main/java/org/duracloud/account/security/vote/UserAccessDecisionVoter.java | UserAccessDecisionVoter.getOtherUserIdArg | private Long getOtherUserIdArg(Object[] arguments) {
if (arguments.length <= OTHER_USER_ID_INDEX) {
log.error("Illegal number of args: " + arguments.length);
}
return (Long) arguments[OTHER_USER_ID_INDEX];
} | java | private Long getOtherUserIdArg(Object[] arguments) {
if (arguments.length <= OTHER_USER_ID_INDEX) {
log.error("Illegal number of args: " + arguments.length);
}
return (Long) arguments[OTHER_USER_ID_INDEX];
} | [
"private",
"Long",
"getOtherUserIdArg",
"(",
"Object",
"[",
"]",
"arguments",
")",
"{",
"if",
"(",
"arguments",
".",
"length",
"<=",
"OTHER_USER_ID_INDEX",
")",
"{",
"log",
".",
"error",
"(",
"\"Illegal number of args: \"",
"+",
"arguments",
".",
"length",
")"... | This method returns peer userId argument of the target method invocation. | [
"This",
"method",
"returns",
"peer",
"userId",
"argument",
"of",
"the",
"target",
"method",
"invocation",
"."
] | 7331015c01f9ac5cc5c0aa8ae9a2a1a77e9f4ac6 | https://github.com/duracloud/management-console/blob/7331015c01f9ac5cc5c0aa8ae9a2a1a77e9f4ac6/account-management-security/src/main/java/org/duracloud/account/security/vote/UserAccessDecisionVoter.java#L189-L194 | train |
duracloud/management-console | account-management-security/src/main/java/org/duracloud/account/security/vote/UserAccessDecisionVoter.java | UserAccessDecisionVoter.getUserIdArg | private Long getUserIdArg(Object[] arguments) {
if (arguments.length <= USER_ID_INDEX) {
log.error("Illegal number of args: " + arguments.length);
}
return (Long) arguments[USER_ID_INDEX];
} | java | private Long getUserIdArg(Object[] arguments) {
if (arguments.length <= USER_ID_INDEX) {
log.error("Illegal number of args: " + arguments.length);
}
return (Long) arguments[USER_ID_INDEX];
} | [
"private",
"Long",
"getUserIdArg",
"(",
"Object",
"[",
"]",
"arguments",
")",
"{",
"if",
"(",
"arguments",
".",
"length",
"<=",
"USER_ID_INDEX",
")",
"{",
"log",
".",
"error",
"(",
"\"Illegal number of args: \"",
"+",
"arguments",
".",
"length",
")",
";",
... | This method returns userId argument of the target method invocation. | [
"This",
"method",
"returns",
"userId",
"argument",
"of",
"the",
"target",
"method",
"invocation",
"."
] | 7331015c01f9ac5cc5c0aa8ae9a2a1a77e9f4ac6 | https://github.com/duracloud/management-console/blob/7331015c01f9ac5cc5c0aa8ae9a2a1a77e9f4ac6/account-management-security/src/main/java/org/duracloud/account/security/vote/UserAccessDecisionVoter.java#L199-L204 | train |
duracloud/management-console | account-management-security/src/main/java/org/duracloud/account/security/vote/UserAccessDecisionVoter.java | UserAccessDecisionVoter.getAccountIdArg | private Long getAccountIdArg(Object[] arguments) {
if (arguments.length <= ACCT_ID_INDEX) {
log.error("Illegal number of args: " + arguments.length);
}
return (Long) arguments[ACCT_ID_INDEX];
} | java | private Long getAccountIdArg(Object[] arguments) {
if (arguments.length <= ACCT_ID_INDEX) {
log.error("Illegal number of args: " + arguments.length);
}
return (Long) arguments[ACCT_ID_INDEX];
} | [
"private",
"Long",
"getAccountIdArg",
"(",
"Object",
"[",
"]",
"arguments",
")",
"{",
"if",
"(",
"arguments",
".",
"length",
"<=",
"ACCT_ID_INDEX",
")",
"{",
"log",
".",
"error",
"(",
"\"Illegal number of args: \"",
"+",
"arguments",
".",
"length",
")",
";",... | This method returns acctId argument of the target method invocation. | [
"This",
"method",
"returns",
"acctId",
"argument",
"of",
"the",
"target",
"method",
"invocation",
"."
] | 7331015c01f9ac5cc5c0aa8ae9a2a1a77e9f4ac6 | https://github.com/duracloud/management-console/blob/7331015c01f9ac5cc5c0aa8ae9a2a1a77e9f4ac6/account-management-security/src/main/java/org/duracloud/account/security/vote/UserAccessDecisionVoter.java#L216-L221 | train |
scireum/server-sass | src/main/java/org/serversass/Functions.java | Functions.rgb | public static Expression rgb(Generator generator, FunctionCall input) {
return new Color(input.getExpectedIntParam(0), input.getExpectedIntParam(1), input.getExpectedIntParam(2));
} | java | public static Expression rgb(Generator generator, FunctionCall input) {
return new Color(input.getExpectedIntParam(0), input.getExpectedIntParam(1), input.getExpectedIntParam(2));
} | [
"public",
"static",
"Expression",
"rgb",
"(",
"Generator",
"generator",
",",
"FunctionCall",
"input",
")",
"{",
"return",
"new",
"Color",
"(",
"input",
".",
"getExpectedIntParam",
"(",
"0",
")",
",",
"input",
".",
"getExpectedIntParam",
"(",
"1",
")",
",",
... | Creates a color from given RGB values.
@param generator the surrounding generator
@param input the function call to evaluate
@return the result of the evaluation | [
"Creates",
"a",
"color",
"from",
"given",
"RGB",
"values",
"."
] | e74af983567f10c43420d70cd31165dd080ba8fc | https://github.com/scireum/server-sass/blob/e74af983567f10c43420d70cd31165dd080ba8fc/src/main/java/org/serversass/Functions.java#L44-L46 | train |
scireum/server-sass | src/main/java/org/serversass/Functions.java | Functions.rgba | public static Expression rgba(Generator generator, FunctionCall input) {
if (input.getParameters().size() == 4) {
return new Color(input.getExpectedIntParam(0),
input.getExpectedIntParam(1),
input.getExpectedIntParam(2),
... | java | public static Expression rgba(Generator generator, FunctionCall input) {
if (input.getParameters().size() == 4) {
return new Color(input.getExpectedIntParam(0),
input.getExpectedIntParam(1),
input.getExpectedIntParam(2),
... | [
"public",
"static",
"Expression",
"rgba",
"(",
"Generator",
"generator",
",",
"FunctionCall",
"input",
")",
"{",
"if",
"(",
"input",
".",
"getParameters",
"(",
")",
".",
"size",
"(",
")",
"==",
"4",
")",
"{",
"return",
"new",
"Color",
"(",
"input",
"."... | Creates a color from given RGB and alpha values.
@param generator the surrounding generator
@param input the function call to evaluate
@return the result of the evaluation | [
"Creates",
"a",
"color",
"from",
"given",
"RGB",
"and",
"alpha",
"values",
"."
] | e74af983567f10c43420d70cd31165dd080ba8fc | https://github.com/scireum/server-sass/blob/e74af983567f10c43420d70cd31165dd080ba8fc/src/main/java/org/serversass/Functions.java#L55-L69 | train |
scireum/server-sass | src/main/java/org/serversass/Functions.java | Functions.adjusthue | public static Expression adjusthue(Generator generator, FunctionCall input) {
Color color = input.getExpectedColorParam(0);
int changeInDegrees = input.getExpectedIntParam(1);
Color.HSL hsl = color.getHSL();
hsl.setH(hsl.getH() + changeInDegrees);
return hsl.getColor();
} | java | public static Expression adjusthue(Generator generator, FunctionCall input) {
Color color = input.getExpectedColorParam(0);
int changeInDegrees = input.getExpectedIntParam(1);
Color.HSL hsl = color.getHSL();
hsl.setH(hsl.getH() + changeInDegrees);
return hsl.getColor();
} | [
"public",
"static",
"Expression",
"adjusthue",
"(",
"Generator",
"generator",
",",
"FunctionCall",
"input",
")",
"{",
"Color",
"color",
"=",
"input",
".",
"getExpectedColorParam",
"(",
"0",
")",
";",
"int",
"changeInDegrees",
"=",
"input",
".",
"getExpectedIntPa... | Adjusts the hue of the given color by the given number of degrees.
@param generator the surrounding generator
@param input the function call to evaluate
@return the result of the evaluation | [
"Adjusts",
"the",
"hue",
"of",
"the",
"given",
"color",
"by",
"the",
"given",
"number",
"of",
"degrees",
"."
] | e74af983567f10c43420d70cd31165dd080ba8fc | https://github.com/scireum/server-sass/blob/e74af983567f10c43420d70cd31165dd080ba8fc/src/main/java/org/serversass/Functions.java#L78-L84 | train |
scireum/server-sass | src/main/java/org/serversass/Functions.java | Functions.lighten | public static Expression lighten(Generator generator, FunctionCall input) {
Color color = input.getExpectedColorParam(0);
int increase = input.getExpectedIntParam(1);
return changeLighteness(color, increase);
} | java | public static Expression lighten(Generator generator, FunctionCall input) {
Color color = input.getExpectedColorParam(0);
int increase = input.getExpectedIntParam(1);
return changeLighteness(color, increase);
} | [
"public",
"static",
"Expression",
"lighten",
"(",
"Generator",
"generator",
",",
"FunctionCall",
"input",
")",
"{",
"Color",
"color",
"=",
"input",
".",
"getExpectedColorParam",
"(",
"0",
")",
";",
"int",
"increase",
"=",
"input",
".",
"getExpectedIntParam",
"... | Increases the lightness of the given color by N percent.
@param generator the surrounding generator
@param input the function call to evaluate
@return the result of the evaluation | [
"Increases",
"the",
"lightness",
"of",
"the",
"given",
"color",
"by",
"N",
"percent",
"."
] | e74af983567f10c43420d70cd31165dd080ba8fc | https://github.com/scireum/server-sass/blob/e74af983567f10c43420d70cd31165dd080ba8fc/src/main/java/org/serversass/Functions.java#L93-L97 | train |
scireum/server-sass | src/main/java/org/serversass/Functions.java | Functions.alpha | public static Expression alpha(Generator generator, FunctionCall input) {
Color color = input.getExpectedColorParam(0);
return new Number(color.getA(), String.valueOf(color.getA()), "");
} | java | public static Expression alpha(Generator generator, FunctionCall input) {
Color color = input.getExpectedColorParam(0);
return new Number(color.getA(), String.valueOf(color.getA()), "");
} | [
"public",
"static",
"Expression",
"alpha",
"(",
"Generator",
"generator",
",",
"FunctionCall",
"input",
")",
"{",
"Color",
"color",
"=",
"input",
".",
"getExpectedColorParam",
"(",
"0",
")",
";",
"return",
"new",
"Number",
"(",
"color",
".",
"getA",
"(",
"... | Returns the alpha value of the given color
@param generator the surrounding generator
@param input the function call to evaluate
@return the result of the evaluation | [
"Returns",
"the",
"alpha",
"value",
"of",
"the",
"given",
"color"
] | e74af983567f10c43420d70cd31165dd080ba8fc | https://github.com/scireum/server-sass/blob/e74af983567f10c43420d70cd31165dd080ba8fc/src/main/java/org/serversass/Functions.java#L106-L109 | train |
scireum/server-sass | src/main/java/org/serversass/Functions.java | Functions.darken | public static Expression darken(Generator generator, FunctionCall input) {
Color color = input.getExpectedColorParam(0);
int decrease = input.getExpectedIntParam(1);
return changeLighteness(color, -decrease);
} | java | public static Expression darken(Generator generator, FunctionCall input) {
Color color = input.getExpectedColorParam(0);
int decrease = input.getExpectedIntParam(1);
return changeLighteness(color, -decrease);
} | [
"public",
"static",
"Expression",
"darken",
"(",
"Generator",
"generator",
",",
"FunctionCall",
"input",
")",
"{",
"Color",
"color",
"=",
"input",
".",
"getExpectedColorParam",
"(",
"0",
")",
";",
"int",
"decrease",
"=",
"input",
".",
"getExpectedIntParam",
"(... | Decreases the lightness of the given color by N percent.
@param generator the surrounding generator
@param input the function call to evaluate
@return the result of the evaluation | [
"Decreases",
"the",
"lightness",
"of",
"the",
"given",
"color",
"by",
"N",
"percent",
"."
] | e74af983567f10c43420d70cd31165dd080ba8fc | https://github.com/scireum/server-sass/blob/e74af983567f10c43420d70cd31165dd080ba8fc/src/main/java/org/serversass/Functions.java#L130-L134 | train |
scireum/server-sass | src/main/java/org/serversass/Functions.java | Functions.saturate | public static Expression saturate(Generator generator, FunctionCall input) {
Color color = input.getExpectedColorParam(0);
int increase = input.getExpectedIntParam(1);
return changeSaturation(color, increase);
} | java | public static Expression saturate(Generator generator, FunctionCall input) {
Color color = input.getExpectedColorParam(0);
int increase = input.getExpectedIntParam(1);
return changeSaturation(color, increase);
} | [
"public",
"static",
"Expression",
"saturate",
"(",
"Generator",
"generator",
",",
"FunctionCall",
"input",
")",
"{",
"Color",
"color",
"=",
"input",
".",
"getExpectedColorParam",
"(",
"0",
")",
";",
"int",
"increase",
"=",
"input",
".",
"getExpectedIntParam",
... | Increases the saturation of the given color by N percent.
@param generator the surrounding generator
@param input the function call to evaluate
@return the result of the evaluation | [
"Increases",
"the",
"saturation",
"of",
"the",
"given",
"color",
"by",
"N",
"percent",
"."
] | e74af983567f10c43420d70cd31165dd080ba8fc | https://github.com/scireum/server-sass/blob/e74af983567f10c43420d70cd31165dd080ba8fc/src/main/java/org/serversass/Functions.java#L143-L147 | train |
scireum/server-sass | src/main/java/org/serversass/Functions.java | Functions.desaturate | public static Expression desaturate(Generator generator, FunctionCall input) {
Color color = input.getExpectedColorParam(0);
int decrease = input.getExpectedIntParam(1);
return changeSaturation(color, -decrease);
} | java | public static Expression desaturate(Generator generator, FunctionCall input) {
Color color = input.getExpectedColorParam(0);
int decrease = input.getExpectedIntParam(1);
return changeSaturation(color, -decrease);
} | [
"public",
"static",
"Expression",
"desaturate",
"(",
"Generator",
"generator",
",",
"FunctionCall",
"input",
")",
"{",
"Color",
"color",
"=",
"input",
".",
"getExpectedColorParam",
"(",
"0",
")",
";",
"int",
"decrease",
"=",
"input",
".",
"getExpectedIntParam",
... | Decreases the saturation of the given color by N percent.
@param generator the surrounding generator
@param input the function call to evaluate
@return the result of the evaluation | [
"Decreases",
"the",
"saturation",
"of",
"the",
"given",
"color",
"by",
"N",
"percent",
"."
] | e74af983567f10c43420d70cd31165dd080ba8fc | https://github.com/scireum/server-sass/blob/e74af983567f10c43420d70cd31165dd080ba8fc/src/main/java/org/serversass/Functions.java#L156-L160 | train |
scireum/server-sass | src/main/java/org/serversass/Functions.java | Functions.fade_out | @SuppressWarnings("squid:S00100")
public static Expression fade_out(Generator generator, FunctionCall input) {
return opacify(generator, input);
} | java | @SuppressWarnings("squid:S00100")
public static Expression fade_out(Generator generator, FunctionCall input) {
return opacify(generator, input);
} | [
"@",
"SuppressWarnings",
"(",
"\"squid:S00100\"",
")",
"public",
"static",
"Expression",
"fade_out",
"(",
"Generator",
"generator",
",",
"FunctionCall",
"input",
")",
"{",
"return",
"opacify",
"(",
"generator",
",",
"input",
")",
";",
"}"
] | Decreases the opacity of the given color by the given amount.
@param generator the surrounding generator
@param input the function call to evaluate
@return the result of the evaluation | [
"Decreases",
"the",
"opacity",
"of",
"the",
"given",
"color",
"by",
"the",
"given",
"amount",
"."
] | e74af983567f10c43420d70cd31165dd080ba8fc | https://github.com/scireum/server-sass/blob/e74af983567f10c43420d70cd31165dd080ba8fc/src/main/java/org/serversass/Functions.java#L207-L210 | train |
scireum/server-sass | src/main/java/org/serversass/Functions.java | Functions.mix | public static Expression mix(Generator generator, FunctionCall input) {
Color color1 = input.getExpectedColorParam(0);
Color color2 = input.getExpectedColorParam(1);
float weight = input.getParameters().size() > 2 ? input.getExpectedFloatParam(2) : 0.5f;
return new Color((int) Math.round... | java | public static Expression mix(Generator generator, FunctionCall input) {
Color color1 = input.getExpectedColorParam(0);
Color color2 = input.getExpectedColorParam(1);
float weight = input.getParameters().size() > 2 ? input.getExpectedFloatParam(2) : 0.5f;
return new Color((int) Math.round... | [
"public",
"static",
"Expression",
"mix",
"(",
"Generator",
"generator",
",",
"FunctionCall",
"input",
")",
"{",
"Color",
"color1",
"=",
"input",
".",
"getExpectedColorParam",
"(",
"0",
")",
";",
"Color",
"color2",
"=",
"input",
".",
"getExpectedColorParam",
"(... | Calculates the weighted arithmetic mean of two colors.
@param generator the surrounding generator
@param input the function call to evaluate
@return the result of the evaluation | [
"Calculates",
"the",
"weighted",
"arithmetic",
"mean",
"of",
"two",
"colors",
"."
] | e74af983567f10c43420d70cd31165dd080ba8fc | https://github.com/scireum/server-sass/blob/e74af983567f10c43420d70cd31165dd080ba8fc/src/main/java/org/serversass/Functions.java#L219-L227 | train |
scireum/server-sass | src/main/java/org/serversass/Output.java | Output.lineBreak | public Output lineBreak() throws IOException {
writer.write("\n");
if (!skipOptionalOutput) {
for (int i = 0; i < indentLevel; i++) {
writer.write(indentDepth);
}
}
return this;
} | java | public Output lineBreak() throws IOException {
writer.write("\n");
if (!skipOptionalOutput) {
for (int i = 0; i < indentLevel; i++) {
writer.write(indentDepth);
}
}
return this;
} | [
"public",
"Output",
"lineBreak",
"(",
")",
"throws",
"IOException",
"{",
"writer",
".",
"write",
"(",
"\"\\n\"",
")",
";",
"if",
"(",
"!",
"skipOptionalOutput",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"indentLevel",
";",
"i",
"++",... | Outputs an indented line break in any case.
@return the instance itself for fluent method calls
@throws IOException in case of an io error in the underlying writer | [
"Outputs",
"an",
"indented",
"line",
"break",
"in",
"any",
"case",
"."
] | e74af983567f10c43420d70cd31165dd080ba8fc | https://github.com/scireum/server-sass/blob/e74af983567f10c43420d70cd31165dd080ba8fc/src/main/java/org/serversass/Output.java#L78-L86 | train |
scireum/server-sass | src/main/java/org/serversass/ast/Color.java | Color.getHSL | @SuppressWarnings("squid:S1244")
public HSL getHSL() {
// Convert the RGB values to the range 0-1
double red = r / 255.0;
double green = g / 255.0;
double blue = b / 255.0;
// Find the minimum and maximum values of R, G and B.
double min = Math.min(red, Math.min(gree... | java | @SuppressWarnings("squid:S1244")
public HSL getHSL() {
// Convert the RGB values to the range 0-1
double red = r / 255.0;
double green = g / 255.0;
double blue = b / 255.0;
// Find the minimum and maximum values of R, G and B.
double min = Math.min(red, Math.min(gree... | [
"@",
"SuppressWarnings",
"(",
"\"squid:S1244\"",
")",
"public",
"HSL",
"getHSL",
"(",
")",
"{",
"// Convert the RGB values to the range 0-1",
"double",
"red",
"=",
"r",
"/",
"255.0",
";",
"double",
"green",
"=",
"g",
"/",
"255.0",
";",
"double",
"blue",
"=",
... | Computes the HSL value form the stored RGB values.
@return a triple containing the hue, saturation and lightness | [
"Computes",
"the",
"HSL",
"value",
"form",
"the",
"stored",
"RGB",
"values",
"."
] | e74af983567f10c43420d70cd31165dd080ba8fc | https://github.com/scireum/server-sass/blob/e74af983567f10c43420d70cd31165dd080ba8fc/src/main/java/org/serversass/ast/Color.java#L238-L285 | train |
scireum/server-sass | src/main/java/org/serversass/ast/Section.java | Section.getMediaQuery | public String getMediaQuery(Scope scope, Generator gen) {
StringBuilder sb = new StringBuilder();
for (Expression expr : mediaQueries) {
if (sb.length() > 0) {
sb.append(" and ");
}
sb.append(expr.eval(scope, gen));
}
return sb.toString... | java | public String getMediaQuery(Scope scope, Generator gen) {
StringBuilder sb = new StringBuilder();
for (Expression expr : mediaQueries) {
if (sb.length() > 0) {
sb.append(" and ");
}
sb.append(expr.eval(scope, gen));
}
return sb.toString... | [
"public",
"String",
"getMediaQuery",
"(",
"Scope",
"scope",
",",
"Generator",
"gen",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"Expression",
"expr",
":",
"mediaQueries",
")",
"{",
"if",
"(",
"sb",
".",
"leng... | Compiles the effective media query of this section into a string
@param scope the scope used to resolve variables
@param gen the generator used to evaluate functions
@return the effective media query as string or "" if there is no media query | [
"Compiles",
"the",
"effective",
"media",
"query",
"of",
"this",
"section",
"into",
"a",
"string"
] | e74af983567f10c43420d70cd31165dd080ba8fc | https://github.com/scireum/server-sass/blob/e74af983567f10c43420d70cd31165dd080ba8fc/src/main/java/org/serversass/ast/Section.java#L128-L137 | train |
scireum/server-sass | src/main/java/org/serversass/ast/Section.java | Section.getSelectorString | public String getSelectorString() {
StringBuilder sb = new StringBuilder();
for (List<String> selector : selectors) {
if (sb.length() > 0) {
sb.append(",");
}
for (String s : selector) {
if (sb.length() > 0) {
sb.app... | java | public String getSelectorString() {
StringBuilder sb = new StringBuilder();
for (List<String> selector : selectors) {
if (sb.length() > 0) {
sb.append(",");
}
for (String s : selector) {
if (sb.length() > 0) {
sb.app... | [
"public",
"String",
"getSelectorString",
"(",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"List",
"<",
"String",
">",
"selector",
":",
"selectors",
")",
"{",
"if",
"(",
"sb",
".",
"length",
"(",
")",
">",
... | Compiles the effective selector string.
@return a string containing all selector chains for this section | [
"Compiles",
"the",
"effective",
"selector",
"string",
"."
] | e74af983567f10c43420d70cd31165dd080ba8fc | https://github.com/scireum/server-sass/blob/e74af983567f10c43420d70cd31165dd080ba8fc/src/main/java/org/serversass/ast/Section.java#L144-L158 | train |
scireum/server-sass | src/main/java/org/serversass/Generator.java | Generator.importStylesheet | public void importStylesheet(Stylesheet sheet) {
if (sheet == null) {
return;
}
if (importedSheets.contains(sheet.getName())) {
return;
}
importedSheets.add(sheet.getName());
for (String imp : sheet.getImports()) {
importStylesheet(imp)... | java | public void importStylesheet(Stylesheet sheet) {
if (sheet == null) {
return;
}
if (importedSheets.contains(sheet.getName())) {
return;
}
importedSheets.add(sheet.getName());
for (String imp : sheet.getImports()) {
importStylesheet(imp)... | [
"public",
"void",
"importStylesheet",
"(",
"Stylesheet",
"sheet",
")",
"{",
"if",
"(",
"sheet",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"importedSheets",
".",
"contains",
"(",
"sheet",
".",
"getName",
"(",
")",
")",
")",
"{",
"return",
... | Imports an already parsed stylesheet.
@param sheet the stylesheet to import | [
"Imports",
"an",
"already",
"parsed",
"stylesheet",
"."
] | e74af983567f10c43420d70cd31165dd080ba8fc | https://github.com/scireum/server-sass/blob/e74af983567f10c43420d70cd31165dd080ba8fc/src/main/java/org/serversass/Generator.java#L197-L222 | train |
duracloud/management-console | account-management-util/src/main/java/org/duracloud/account/db/util/impl/DuracloudGroupServiceImpl.java | DuracloudGroupServiceImpl.isGroupNameValid | protected final boolean isGroupNameValid(String name) {
if (name == null) {
return false;
}
if (!name.startsWith(DuracloudGroup.PREFIX)) {
return false;
}
if (DuracloudGroup.PUBLIC_GROUP_NAME.equalsIgnoreCase(name)) {
return false;
}
... | java | protected final boolean isGroupNameValid(String name) {
if (name == null) {
return false;
}
if (!name.startsWith(DuracloudGroup.PREFIX)) {
return false;
}
if (DuracloudGroup.PUBLIC_GROUP_NAME.equalsIgnoreCase(name)) {
return false;
}
... | [
"protected",
"final",
"boolean",
"isGroupNameValid",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"name",
".",
"startsWith",
"(",
"DuracloudGroup",
".",
"PREFIX",
")",
")",
"{"... | This method is 'protected' for testing purposes only. | [
"This",
"method",
"is",
"protected",
"for",
"testing",
"purposes",
"only",
"."
] | 7331015c01f9ac5cc5c0aa8ae9a2a1a77e9f4ac6 | https://github.com/duracloud/management-console/blob/7331015c01f9ac5cc5c0aa8ae9a2a1a77e9f4ac6/account-management-util/src/main/java/org/duracloud/account/db/util/impl/DuracloudGroupServiceImpl.java#L85-L100 | train |
duracloud/management-console | account-management-monitor/src/main/java/org/duracloud/account/monitor/duplication/domain/DuplicationReport.java | DuplicationReport.getDupIssues | public List<DuplicationInfo> getDupIssues() {
List<DuplicationInfo> dupIssues = new LinkedList<>();
for (DuplicationInfo dupInfo : dupInfos.values()) {
if (dupInfo.hasIssues()) {
dupIssues.add(dupInfo);
}
}
return dupIssues;
} | java | public List<DuplicationInfo> getDupIssues() {
List<DuplicationInfo> dupIssues = new LinkedList<>();
for (DuplicationInfo dupInfo : dupInfos.values()) {
if (dupInfo.hasIssues()) {
dupIssues.add(dupInfo);
}
}
return dupIssues;
} | [
"public",
"List",
"<",
"DuplicationInfo",
">",
"getDupIssues",
"(",
")",
"{",
"List",
"<",
"DuplicationInfo",
">",
"dupIssues",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"for",
"(",
"DuplicationInfo",
"dupInfo",
":",
"dupInfos",
".",
"values",
"(",
")... | This method gets all issues discovered for all checked accounts
@return list of duplication infos with issues | [
"This",
"method",
"gets",
"all",
"issues",
"discovered",
"for",
"all",
"checked",
"accounts"
] | 7331015c01f9ac5cc5c0aa8ae9a2a1a77e9f4ac6 | https://github.com/duracloud/management-console/blob/7331015c01f9ac5cc5c0aa8ae9a2a1a77e9f4ac6/account-management-monitor/src/main/java/org/duracloud/account/monitor/duplication/domain/DuplicationReport.java#L54-L62 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.