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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
datacleaner/AnalyzerBeans | cli/src/main/java/org/eobjects/analyzer/cli/CliArguments.java | CliArguments.printUsage | public static void printUsage(PrintWriter out) {
CliArguments arguments = new CliArguments();
CmdLineParser parser = new CmdLineParser(arguments);
parser.setUsageWidth(120);
parser.printUsage(out, null);
} | java | public static void printUsage(PrintWriter out) {
CliArguments arguments = new CliArguments();
CmdLineParser parser = new CmdLineParser(arguments);
parser.setUsageWidth(120);
parser.printUsage(out, null);
} | [
"public",
"static",
"void",
"printUsage",
"(",
"PrintWriter",
"out",
")",
"{",
"CliArguments",
"arguments",
"=",
"new",
"CliArguments",
"(",
")",
";",
"CmdLineParser",
"parser",
"=",
"new",
"CmdLineParser",
"(",
"arguments",
")",
";",
"parser",
".",
"setUsageW... | Prints the usage information for the CLI
@param out | [
"Prints",
"the",
"usage",
"information",
"for",
"the",
"CLI"
] | f82dae080d80d2a647b706a5fb22b3ea250613b3 | https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/cli/src/main/java/org/eobjects/analyzer/cli/CliArguments.java#L73-L78 | train |
datacleaner/AnalyzerBeans | cli/src/main/java/org/eobjects/analyzer/cli/CliArguments.java | CliArguments.isSet | public boolean isSet() {
if (isUsageMode()) {
return true;
}
if (getJobFile() != null) {
return true;
}
if (getListType() != null) {
return true;
}
return false;
} | java | public boolean isSet() {
if (isUsageMode()) {
return true;
}
if (getJobFile() != null) {
return true;
}
if (getListType() != null) {
return true;
}
return false;
} | [
"public",
"boolean",
"isSet",
"(",
")",
"{",
"if",
"(",
"isUsageMode",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"getJobFile",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"getListType",
"(",
")",
"!="... | Gets whether the arguments have been sufficiently set to execute a CLI
task.
@return true if the CLI arguments have been sufficiently set. | [
"Gets",
"whether",
"the",
"arguments",
"have",
"been",
"sufficiently",
"set",
"to",
"execute",
"a",
"CLI",
"task",
"."
] | f82dae080d80d2a647b706a5fb22b3ea250613b3 | https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/cli/src/main/java/org/eobjects/analyzer/cli/CliArguments.java#L162-L173 | train |
datacleaner/AnalyzerBeans | core/src/main/java/org/eobjects/analyzer/result/AnalyzerResultFuture.java | AnalyzerResultFuture.writeObject | private void writeObject(ObjectOutputStream out) throws IOException {
logger.info("Serialization requested, awaiting reference to load.");
get();
out.defaultWriteObject();
logger.info("Serialization finished!");
} | java | private void writeObject(ObjectOutputStream out) throws IOException {
logger.info("Serialization requested, awaiting reference to load.");
get();
out.defaultWriteObject();
logger.info("Serialization finished!");
} | [
"private",
"void",
"writeObject",
"(",
"ObjectOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"logger",
".",
"info",
"(",
"\"Serialization requested, awaiting reference to load.\"",
")",
";",
"get",
"(",
")",
";",
"out",
".",
"defaultWriteObject",
"(",
")",... | Method invoked when serialization takes place. Makes sure that we await
the loading of the result reference before writing any data.
@param out
@throws IOException | [
"Method",
"invoked",
"when",
"serialization",
"takes",
"place",
".",
"Makes",
"sure",
"that",
"we",
"await",
"the",
"loading",
"of",
"the",
"result",
"reference",
"before",
"writing",
"any",
"data",
"."
] | f82dae080d80d2a647b706a5fb22b3ea250613b3 | https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/core/src/main/java/org/eobjects/analyzer/result/AnalyzerResultFuture.java#L227-L232 | train |
fuinorg/event-store-commons | spi/src/main/java/org/fuin/esc/spi/EscEvents.java | EscEvents.create | public static EscEvents create(final JsonArray jsonArray) {
final List<EscEvent> events = new ArrayList<>();
for (final JsonValue jsonValue : jsonArray) {
if (jsonValue.getValueType() != JsonValue.ValueType.OBJECT) {
throw new IllegalArgumentException(
... | java | public static EscEvents create(final JsonArray jsonArray) {
final List<EscEvent> events = new ArrayList<>();
for (final JsonValue jsonValue : jsonArray) {
if (jsonValue.getValueType() != JsonValue.ValueType.OBJECT) {
throw new IllegalArgumentException(
... | [
"public",
"static",
"EscEvents",
"create",
"(",
"final",
"JsonArray",
"jsonArray",
")",
"{",
"final",
"List",
"<",
"EscEvent",
">",
"events",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"final",
"JsonValue",
"jsonValue",
":",
"jsonArray",
")"... | Creates in instance from the given JSON array.
@param jsonArray
Array to read values from.
@return New instance. | [
"Creates",
"in",
"instance",
"from",
"the",
"given",
"JSON",
"array",
"."
] | ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c | https://github.com/fuinorg/event-store-commons/blob/ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c/spi/src/main/java/org/fuin/esc/spi/EscEvents.java#L120-L130 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/ReadWriteManager.java | ReadWriteManager.load | static KAFDocument load(File file) throws IOException, JDOMException, KAFNotValidException {
SAXBuilder builder = new SAXBuilder();
Document document = (Document) builder.build(file);
Element rootElem = document.getRootElement();
return DOMToKAF(document);
} | java | static KAFDocument load(File file) throws IOException, JDOMException, KAFNotValidException {
SAXBuilder builder = new SAXBuilder();
Document document = (Document) builder.build(file);
Element rootElem = document.getRootElement();
return DOMToKAF(document);
} | [
"static",
"KAFDocument",
"load",
"(",
"File",
"file",
")",
"throws",
"IOException",
",",
"JDOMException",
",",
"KAFNotValidException",
"{",
"SAXBuilder",
"builder",
"=",
"new",
"SAXBuilder",
"(",
")",
";",
"Document",
"document",
"=",
"(",
"Document",
")",
"bu... | Loads the content of a KAF file into the given KAFDocument object | [
"Loads",
"the",
"content",
"of",
"a",
"KAF",
"file",
"into",
"the",
"given",
"KAFDocument",
"object"
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/ReadWriteManager.java#L45-L50 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/ReadWriteManager.java | ReadWriteManager.load | static KAFDocument load(Reader stream) throws IOException, JDOMException, KAFNotValidException {
SAXBuilder builder = new SAXBuilder();
Document document = (Document) builder.build(stream);
Element rootElem = document.getRootElement();
return DOMToKAF(document);
} | java | static KAFDocument load(Reader stream) throws IOException, JDOMException, KAFNotValidException {
SAXBuilder builder = new SAXBuilder();
Document document = (Document) builder.build(stream);
Element rootElem = document.getRootElement();
return DOMToKAF(document);
} | [
"static",
"KAFDocument",
"load",
"(",
"Reader",
"stream",
")",
"throws",
"IOException",
",",
"JDOMException",
",",
"KAFNotValidException",
"{",
"SAXBuilder",
"builder",
"=",
"new",
"SAXBuilder",
"(",
")",
";",
"Document",
"document",
"=",
"(",
"Document",
")",
... | Loads the content of a String in KAF format into the given KAFDocument object | [
"Loads",
"the",
"content",
"of",
"a",
"String",
"in",
"KAF",
"format",
"into",
"the",
"given",
"KAFDocument",
"object"
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/ReadWriteManager.java#L53-L58 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/ReadWriteManager.java | ReadWriteManager.save | static void save(KAFDocument kaf, String filename) {
try {
File file = new File(filename);
Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF8"));
out.write(kafToStr(kaf));
out.flush();
} catch (Exception e) {
System.out.println("Error writing to file");
... | java | static void save(KAFDocument kaf, String filename) {
try {
File file = new File(filename);
Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF8"));
out.write(kafToStr(kaf));
out.flush();
} catch (Exception e) {
System.out.println("Error writing to file");
... | [
"static",
"void",
"save",
"(",
"KAFDocument",
"kaf",
",",
"String",
"filename",
")",
"{",
"try",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"filename",
")",
";",
"Writer",
"out",
"=",
"new",
"BufferedWriter",
"(",
"new",
"OutputStreamWriter",
"(",
"ne... | Writes the content of a given KAFDocument to a file. | [
"Writes",
"the",
"content",
"of",
"a",
"given",
"KAFDocument",
"to",
"a",
"file",
"."
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/ReadWriteManager.java#L61-L70 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/ReadWriteManager.java | ReadWriteManager.print | static void print(KAFDocument kaf) {
try {
Writer out = new BufferedWriter(new OutputStreamWriter(System.out, "UTF8"));
out.write(kafToStr(kaf));
out.flush();
} catch (Exception e) {
System.out.println(e);
}
} | java | static void print(KAFDocument kaf) {
try {
Writer out = new BufferedWriter(new OutputStreamWriter(System.out, "UTF8"));
out.write(kafToStr(kaf));
out.flush();
} catch (Exception e) {
System.out.println(e);
}
} | [
"static",
"void",
"print",
"(",
"KAFDocument",
"kaf",
")",
"{",
"try",
"{",
"Writer",
"out",
"=",
"new",
"BufferedWriter",
"(",
"new",
"OutputStreamWriter",
"(",
"System",
".",
"out",
",",
"\"UTF8\"",
")",
")",
";",
"out",
".",
"write",
"(",
"kafToStr",
... | Writes the content of a KAFDocument object to standard output. | [
"Writes",
"the",
"content",
"of",
"a",
"KAFDocument",
"object",
"to",
"standard",
"output",
"."
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/ReadWriteManager.java#L73-L81 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/ReadWriteManager.java | ReadWriteManager.kafToStr | static String kafToStr(KAFDocument kaf) {
XMLOutputter out = new XMLOutputter(Format.getPrettyFormat().setLineSeparator(LineSeparator.UNIX).setTextMode(Format.TextMode.TRIM_FULL_WHITE));
Document jdom = KAFToDOM(kaf);
return out.outputString(jdom);
} | java | static String kafToStr(KAFDocument kaf) {
XMLOutputter out = new XMLOutputter(Format.getPrettyFormat().setLineSeparator(LineSeparator.UNIX).setTextMode(Format.TextMode.TRIM_FULL_WHITE));
Document jdom = KAFToDOM(kaf);
return out.outputString(jdom);
} | [
"static",
"String",
"kafToStr",
"(",
"KAFDocument",
"kaf",
")",
"{",
"XMLOutputter",
"out",
"=",
"new",
"XMLOutputter",
"(",
"Format",
".",
"getPrettyFormat",
"(",
")",
".",
"setLineSeparator",
"(",
"LineSeparator",
".",
"UNIX",
")",
".",
"setTextMode",
"(",
... | Returns a string containing the XML content of a KAFDocument object. | [
"Returns",
"a",
"string",
"containing",
"the",
"XML",
"content",
"of",
"a",
"KAFDocument",
"object",
"."
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/ReadWriteManager.java#L84-L88 | train |
datacleaner/AnalyzerBeans | core/src/main/java/org/eobjects/analyzer/job/runner/RowProcessingQueryOptimizer.java | RowProcessingQueryOptimizer.getOptimizedQuery | public Query getOptimizedQuery() {
// if (isOptimizable()) {
// return _baseQuery;
// }
// create a copy/clone of the original query
Query q = _baseQuery.clone();
Set<Entry<FilterConsumer, FilterOutcome>> entries = _optimizedFilters.entrySet();
for (Entry<Filter... | java | public Query getOptimizedQuery() {
// if (isOptimizable()) {
// return _baseQuery;
// }
// create a copy/clone of the original query
Query q = _baseQuery.clone();
Set<Entry<FilterConsumer, FilterOutcome>> entries = _optimizedFilters.entrySet();
for (Entry<Filter... | [
"public",
"Query",
"getOptimizedQuery",
"(",
")",
"{",
"// if (isOptimizable()) {",
"// return _baseQuery;",
"// }",
"// create a copy/clone of the original query",
"Query",
"q",
"=",
"_baseQuery",
".",
"clone",
"(",
")",
";",
"Set",
"<",
"Entry",
"<",
"FilterConsumer",... | Gets the optimized query.
@return | [
"Gets",
"the",
"optimized",
"query",
"."
] | f82dae080d80d2a647b706a5fb22b3ea250613b3 | https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/core/src/main/java/org/eobjects/analyzer/job/runner/RowProcessingQueryOptimizer.java#L226-L249 | train |
datacleaner/AnalyzerBeans | components/pattern-finder/src/main/java/org/eobjects/analyzer/beans/stringpattern/PredefinedTokenTokenizer.java | PredefinedTokenTokenizer.tokenize | @Override
public List<Token> tokenize(String s) {
List<Token> result = new ArrayList<Token>();
result.add(new UndefinedToken(s));
for (PredefinedTokenDefinition predefinedTokenDefinition : _predefinedTokenDefitions) {
Set<Pattern> patterns = predefinedTokenDefinition.getTokenRegexPatterns();
for (Pattern ... | java | @Override
public List<Token> tokenize(String s) {
List<Token> result = new ArrayList<Token>();
result.add(new UndefinedToken(s));
for (PredefinedTokenDefinition predefinedTokenDefinition : _predefinedTokenDefitions) {
Set<Pattern> patterns = predefinedTokenDefinition.getTokenRegexPatterns();
for (Pattern ... | [
"@",
"Override",
"public",
"List",
"<",
"Token",
">",
"tokenize",
"(",
"String",
"s",
")",
"{",
"List",
"<",
"Token",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"Token",
">",
"(",
")",
";",
"result",
".",
"add",
"(",
"new",
"UndefinedToken",
"(",
... | Will only return either tokens with type PREDEFINED or UNDEFINED | [
"Will",
"only",
"return",
"either",
"tokens",
"with",
"type",
"PREDEFINED",
"or",
"UNDEFINED"
] | f82dae080d80d2a647b706a5fb22b3ea250613b3 | https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/components/pattern-finder/src/main/java/org/eobjects/analyzer/beans/stringpattern/PredefinedTokenTokenizer.java#L48-L73 | train |
lisicnu/Log4Android | src/main/java/com/github/lisicnu/log4android/appender/SyslogAppender.java | SyslogAppender.doLog | public void doLog(String clientID, String name, long time, Level level,
Object message, Throwable t) {
if (logOpen && formatter != null) {
sendMessage(syslogMessage.createMessageData(formatter.format(clientID, name, time, level, message, t)));
}
} | java | public void doLog(String clientID, String name, long time, Level level,
Object message, Throwable t) {
if (logOpen && formatter != null) {
sendMessage(syslogMessage.createMessageData(formatter.format(clientID, name, time, level, message, t)));
}
} | [
"public",
"void",
"doLog",
"(",
"String",
"clientID",
",",
"String",
"name",
",",
"long",
"time",
",",
"Level",
"level",
",",
"Object",
"message",
",",
"Throwable",
"t",
")",
"{",
"if",
"(",
"logOpen",
"&&",
"formatter",
"!=",
"null",
")",
"{",
"sendMe... | Do the logging.
@param level
the level to use for the logging.
@param message
the message to log.
@param t
the exception to log. | [
"Do",
"the",
"logging",
"."
] | 229632528e63a424460a219decdaffcf75a9f4a4 | https://github.com/lisicnu/Log4Android/blob/229632528e63a424460a219decdaffcf75a9f4a4/src/main/java/com/github/lisicnu/log4android/appender/SyslogAppender.java#L35-L40 | train |
lisicnu/Log4Android | src/main/java/com/github/lisicnu/log4android/format/PatternFormatter.java | PatternFormatter.format | public String format(String clientID, String name, long time, Level level, Object message,
Throwable t){
if (!patternParsed && pattern != null) {
parsePattern(pattern);
}
StringBuffer formattedStringBuffer = new StringBuffer(64);
if (commandArray != null) {
int length = commandArray.length;
... | java | public String format(String clientID, String name, long time, Level level, Object message,
Throwable t){
if (!patternParsed && pattern != null) {
parsePattern(pattern);
}
StringBuffer formattedStringBuffer = new StringBuffer(64);
if (commandArray != null) {
int length = commandArray.length;
... | [
"public",
"String",
"format",
"(",
"String",
"clientID",
",",
"String",
"name",
",",
"long",
"time",
",",
"Level",
"level",
",",
"Object",
"message",
",",
"Throwable",
"t",
")",
"{",
"if",
"(",
"!",
"patternParsed",
"&&",
"pattern",
"!=",
"null",
")",
... | Format the input parameters.
@see com.github.lisicnu.log4android.format.Formatter#format(String, String, long,
com.github.lisicnu.log4android.Level, Object, Throwable) | [
"Format",
"the",
"input",
"parameters",
"."
] | 229632528e63a424460a219decdaffcf75a9f4a4 | https://github.com/lisicnu/Log4Android/blob/229632528e63a424460a219decdaffcf75a9f4a4/src/main/java/com/github/lisicnu/log4android/format/PatternFormatter.java#L109-L130 | train |
lisicnu/Log4Android | src/main/java/com/github/lisicnu/log4android/format/PatternFormatter.java | PatternFormatter.setPattern | public void setPattern(String pattern) throws IllegalArgumentException{
if (pattern == null) {
throw new IllegalArgumentException("The pattern must not be null.");
}
this.pattern = pattern;
parsePattern(this.pattern);
} | java | public void setPattern(String pattern) throws IllegalArgumentException{
if (pattern == null) {
throw new IllegalArgumentException("The pattern must not be null.");
}
this.pattern = pattern;
parsePattern(this.pattern);
} | [
"public",
"void",
"setPattern",
"(",
"String",
"pattern",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"pattern",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The pattern must not be null.\"",
")",
";",
"}",
"this",
"."... | Set the pattern that is when formatting.
@param pattern
the pattern to set
@throws IllegalArgumentException
if the pattern is null. | [
"Set",
"the",
"pattern",
"that",
"is",
"when",
"formatting",
"."
] | 229632528e63a424460a219decdaffcf75a9f4a4 | https://github.com/lisicnu/Log4Android/blob/229632528e63a424460a219decdaffcf75a9f4a4/src/main/java/com/github/lisicnu/log4android/format/PatternFormatter.java#L149-L156 | train |
lisicnu/Log4Android | src/main/java/com/github/lisicnu/log4android/format/PatternFormatter.java | PatternFormatter.parsePattern | private void parsePattern(String pattern){
int currentIndex = 0;
int patternLength = pattern.length();
Vector<FormatCommandInterface> converterVector = new Vector<FormatCommandInterface>(20);
while (currentIndex < patternLength) {
char currentChar = pattern.charAt(currentIndex);
if (currentChar == '%')... | java | private void parsePattern(String pattern){
int currentIndex = 0;
int patternLength = pattern.length();
Vector<FormatCommandInterface> converterVector = new Vector<FormatCommandInterface>(20);
while (currentIndex < patternLength) {
char currentChar = pattern.charAt(currentIndex);
if (currentChar == '%')... | [
"private",
"void",
"parsePattern",
"(",
"String",
"pattern",
")",
"{",
"int",
"currentIndex",
"=",
"0",
";",
"int",
"patternLength",
"=",
"pattern",
".",
"length",
"(",
")",
";",
"Vector",
"<",
"FormatCommandInterface",
">",
"converterVector",
"=",
"new",
"V... | Parse the pattern.
This creates a command array that is executed when formatting the log
message. | [
"Parse",
"the",
"pattern",
"."
] | 229632528e63a424460a219decdaffcf75a9f4a4 | https://github.com/lisicnu/Log4Android/blob/229632528e63a424460a219decdaffcf75a9f4a4/src/main/java/com/github/lisicnu/log4android/format/PatternFormatter.java#L164-L258 | train |
pawelprazak/java-extended | guava/src/main/java/com/bluecatcode/common/collections/Collections3.java | Collections3.zip | @Beta
public static <K, V> Map<K, V> zip(List<K> keys, List<V> values) {
checkArgument(keys != null, "Expected non-null keys");
checkArgument(values != null, "Expected non-null values");
checkArgument(keys.size() == values.size(), "Expected equal size of lists, got %s and %s", keys.size(), v... | java | @Beta
public static <K, V> Map<K, V> zip(List<K> keys, List<V> values) {
checkArgument(keys != null, "Expected non-null keys");
checkArgument(values != null, "Expected non-null values");
checkArgument(keys.size() == values.size(), "Expected equal size of lists, got %s and %s", keys.size(), v... | [
"@",
"Beta",
"public",
"static",
"<",
"K",
",",
"V",
">",
"Map",
"<",
"K",
",",
"V",
">",
"zip",
"(",
"List",
"<",
"K",
">",
"keys",
",",
"List",
"<",
"V",
">",
"values",
")",
"{",
"checkArgument",
"(",
"keys",
"!=",
"null",
",",
"\"Expected no... | Combine two lists into a map. Lists must have the same size.
@param keys the key list
@param values the value list
@param <K> the key type
@param <V> the value type
@return the resulting map
@throws IllegalArgumentException if lists size differ
@throws NullPointerException if any of the lists is null | [
"Combine",
"two",
"lists",
"into",
"a",
"map",
".",
"Lists",
"must",
"have",
"the",
"same",
"size",
"."
] | ce1a556a95cbbf7c950a03662938bc02622de69b | https://github.com/pawelprazak/java-extended/blob/ce1a556a95cbbf7c950a03662938bc02622de69b/guava/src/main/java/com/bluecatcode/common/collections/Collections3.java#L28-L41 | train |
pawelprazak/java-extended | guava/src/main/java/com/bluecatcode/common/collections/Collections3.java | Collections3.getOnlyEntry | @Beta
public static <K, V> Map.Entry<K, V> getOnlyEntry(Map<K, V> map) {
checkArgument(map != null, "Expected non-null map");
return getOnlyElement(map.entrySet());
} | java | @Beta
public static <K, V> Map.Entry<K, V> getOnlyEntry(Map<K, V> map) {
checkArgument(map != null, "Expected non-null map");
return getOnlyElement(map.entrySet());
} | [
"@",
"Beta",
"public",
"static",
"<",
"K",
",",
"V",
">",
"Map",
".",
"Entry",
"<",
"K",
",",
"V",
">",
"getOnlyEntry",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
")",
"{",
"checkArgument",
"(",
"map",
"!=",
"null",
",",
"\"Expected non-null map\"... | Gets the only element from a given map or throws an exception
@param map the map to get only entry from
@param <K> the key type
@param <V> the value type
@return the single entry contained in the map
@throws NoSuchElementException if the map is empty
@throws IllegalArgumentException if the map contains multiple entr... | [
"Gets",
"the",
"only",
"element",
"from",
"a",
"given",
"map",
"or",
"throws",
"an",
"exception"
] | ce1a556a95cbbf7c950a03662938bc02622de69b | https://github.com/pawelprazak/java-extended/blob/ce1a556a95cbbf7c950a03662938bc02622de69b/guava/src/main/java/com/bluecatcode/common/collections/Collections3.java#L104-L108 | train |
pawelprazak/java-extended | guava/src/main/java/com/bluecatcode/common/collections/Collections3.java | Collections3.mergeMaps | @Beta
public static <K, V> Map<K, V> mergeMaps(Map<K, V> first, Map<K, V> second, V defaultValue) {
checkArgument(first != null, "Expected non-null first map");
checkArgument(second != null, "Expected non-null second map");
checkArgument(defaultValue != null, "Expected non-null default value... | java | @Beta
public static <K, V> Map<K, V> mergeMaps(Map<K, V> first, Map<K, V> second, V defaultValue) {
checkArgument(first != null, "Expected non-null first map");
checkArgument(second != null, "Expected non-null second map");
checkArgument(defaultValue != null, "Expected non-null default value... | [
"@",
"Beta",
"public",
"static",
"<",
"K",
",",
"V",
">",
"Map",
"<",
"K",
",",
"V",
">",
"mergeMaps",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"first",
",",
"Map",
"<",
"K",
",",
"V",
">",
"second",
",",
"V",
"defaultValue",
")",
"{",
"checkArgu... | Mergers two maps handling null keys, null values and duplicates
@param first the first map to merge
@param second the second map to merge
@param defaultValue the value to be used in case of null value
@param <K> the key type
@param <V> the value type
@return a single map containing entries from the given ... | [
"Mergers",
"two",
"maps",
"handling",
"null",
"keys",
"null",
"values",
"and",
"duplicates"
] | ce1a556a95cbbf7c950a03662938bc02622de69b | https://github.com/pawelprazak/java-extended/blob/ce1a556a95cbbf7c950a03662938bc02622de69b/guava/src/main/java/com/bluecatcode/common/collections/Collections3.java#L121-L143 | train |
morimekta/providence | providence-storage/src/main/java/net/morimekta/providence/storage/MessageStoreUtils.java | MessageStoreUtils.buildAll | public static <M extends PMessage<M,F>, F extends PField, B extends PMessageBuilder<M,F>>
List<M> buildAll(Collection<B> builders) {
if (builders == null) {
return null;
}
return builders.stream()
.map(PMessageBuilder::build)
.collect... | java | public static <M extends PMessage<M,F>, F extends PField, B extends PMessageBuilder<M,F>>
List<M> buildAll(Collection<B> builders) {
if (builders == null) {
return null;
}
return builders.stream()
.map(PMessageBuilder::build)
.collect... | [
"public",
"static",
"<",
"M",
"extends",
"PMessage",
"<",
"M",
",",
"F",
">",
",",
"F",
"extends",
"PField",
",",
"B",
"extends",
"PMessageBuilder",
"<",
"M",
",",
"F",
">",
">",
"List",
"<",
"M",
">",
"buildAll",
"(",
"Collection",
"<",
"B",
">",
... | Build all items of the collection containing builders. The list must not
contain any null items.
@param builders List of builders.
@param <M> The message type.
@param <F> The field type.
@param <B> The builder type.
@return List of messages or null if null input. | [
"Build",
"all",
"items",
"of",
"the",
"collection",
"containing",
"builders",
".",
"The",
"list",
"must",
"not",
"contain",
"any",
"null",
"items",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-storage/src/main/java/net/morimekta/providence/storage/MessageStoreUtils.java#L25-L33 | train |
morimekta/providence | providence-storage/src/main/java/net/morimekta/providence/storage/MessageStoreUtils.java | MessageStoreUtils.mutateAll | @SuppressWarnings("unchecked")
public static <M extends PMessage<M,F>, F extends PField, B extends PMessageBuilder<M,F>>
List<B> mutateAll(Collection<M> messages) {
if (messages == null) {
return null;
}
return (List<B>) messages.stream()
.map... | java | @SuppressWarnings("unchecked")
public static <M extends PMessage<M,F>, F extends PField, B extends PMessageBuilder<M,F>>
List<B> mutateAll(Collection<M> messages) {
if (messages == null) {
return null;
}
return (List<B>) messages.stream()
.map... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"M",
"extends",
"PMessage",
"<",
"M",
",",
"F",
">",
",",
"F",
"extends",
"PField",
",",
"B",
"extends",
"PMessageBuilder",
"<",
"M",
",",
"F",
">",
">",
"List",
"<",
"B",
"... | Mutate all items of the collection containing messages. The list must not
contain any null items.
@param messages List of messages
@param <M> The message type.
@param <F> The field type.
@param <B> The builder type.
@return List of builders or null if null input. | [
"Mutate",
"all",
"items",
"of",
"the",
"collection",
"containing",
"messages",
".",
"The",
"list",
"must",
"not",
"contain",
"any",
"null",
"items",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-storage/src/main/java/net/morimekta/providence/storage/MessageStoreUtils.java#L45-L54 | train |
morimekta/providence | providence-storage/src/main/java/net/morimekta/providence/storage/MessageStoreUtils.java | MessageStoreUtils.buildIfNotNull | public static <M extends PMessage<M,F>, F extends PField, B extends PMessageBuilder<M,F>>
M buildIfNotNull(B builder) {
if (builder == null) {
return null;
}
return builder.build();
} | java | public static <M extends PMessage<M,F>, F extends PField, B extends PMessageBuilder<M,F>>
M buildIfNotNull(B builder) {
if (builder == null) {
return null;
}
return builder.build();
} | [
"public",
"static",
"<",
"M",
"extends",
"PMessage",
"<",
"M",
",",
"F",
">",
",",
"F",
"extends",
"PField",
",",
"B",
"extends",
"PMessageBuilder",
"<",
"M",
",",
"F",
">",
">",
"M",
"buildIfNotNull",
"(",
"B",
"builder",
")",
"{",
"if",
"(",
"bui... | Build the message from builder if it is not null.
@param builder The builder to build.
@param <M> The message type.
@param <F> The field type.
@param <B> The builder type.
@return The message or null if null input. | [
"Build",
"the",
"message",
"from",
"builder",
"if",
"it",
"is",
"not",
"null",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-storage/src/main/java/net/morimekta/providence/storage/MessageStoreUtils.java#L65-L71 | train |
morimekta/providence | providence-storage/src/main/java/net/morimekta/providence/storage/MessageStoreUtils.java | MessageStoreUtils.mutateIfNotNull | @SuppressWarnings("unchecked")
public static <M extends PMessage<M,F>, F extends PField, B extends PMessageBuilder<M,F>>
B mutateIfNotNull(M message) {
if (message == null) {
return null;
}
return (B) message.mutate();
} | java | @SuppressWarnings("unchecked")
public static <M extends PMessage<M,F>, F extends PField, B extends PMessageBuilder<M,F>>
B mutateIfNotNull(M message) {
if (message == null) {
return null;
}
return (B) message.mutate();
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"M",
"extends",
"PMessage",
"<",
"M",
",",
"F",
">",
",",
"F",
"extends",
"PField",
",",
"B",
"extends",
"PMessageBuilder",
"<",
"M",
",",
"F",
">",
">",
"B",
"mutateIfNotNull",... | Mutate the message if it is not null.
@param message Message to mutate.
@param <M> The message type.
@param <F> The field type.
@param <B> The builder type.
@return The builder or null if null input. | [
"Mutate",
"the",
"message",
"if",
"it",
"is",
"not",
"null",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-storage/src/main/java/net/morimekta/providence/storage/MessageStoreUtils.java#L82-L89 | train |
jetty-project/jetty-npn | npn-boot/src/main/java/sun/security/ssl/HelloExtensions.java | SupportedEllipticCurvesExtension.isSupported | static boolean isSupported(int index) {
if ((index <= 0) || (index >= NAMED_CURVE_OID_TABLE.length)) {
return false;
}
if (fips == false) {
// in non-FIPS mode, we support all valid indices
return true;
}
return DEFAULT.contains(index);
} | java | static boolean isSupported(int index) {
if ((index <= 0) || (index >= NAMED_CURVE_OID_TABLE.length)) {
return false;
}
if (fips == false) {
// in non-FIPS mode, we support all valid indices
return true;
}
return DEFAULT.contains(index);
} | [
"static",
"boolean",
"isSupported",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"(",
"index",
"<=",
"0",
")",
"||",
"(",
"index",
">=",
"NAMED_CURVE_OID_TABLE",
".",
"length",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"fips",
"==",
"false"... | Test whether we support the curve with the given index. | [
"Test",
"whether",
"we",
"support",
"the",
"curve",
"with",
"the",
"given",
"index",
"."
] | a26a7a5eabeeb57a63c6ee08fcf9b8cec1fa6c0d | https://github.com/jetty-project/jetty-npn/blob/a26a7a5eabeeb57a63c6ee08fcf9b8cec1fa6c0d/npn-boot/src/main/java/sun/security/ssl/HelloExtensions.java#L553-L562 | train |
morimekta/providence | providence-jdbi-v2/src/main/java/net/morimekta/providence/jdbi/v2/ProvidenceJdbi.java | ProvidenceJdbi.toField | public static <M extends PMessage<M,F>, F extends PField>
MessageFieldArgument<M,F> toField(M message, F field) {
return new MessageFieldArgument<>(message, field);
} | java | public static <M extends PMessage<M,F>, F extends PField>
MessageFieldArgument<M,F> toField(M message, F field) {
return new MessageFieldArgument<>(message, field);
} | [
"public",
"static",
"<",
"M",
"extends",
"PMessage",
"<",
"M",
",",
"F",
">",
",",
"F",
"extends",
"PField",
">",
"MessageFieldArgument",
"<",
"M",
",",
"F",
">",
"toField",
"(",
"M",
"message",
",",
"F",
"field",
")",
"{",
"return",
"new",
"MessageF... | Bind to the given field for the message.
@param message The message tp bind value from.
@param field The field to bind to.
@param <M> The message type.
@param <F> The message field type.
@return The message field argument. | [
"Bind",
"to",
"the",
"given",
"field",
"for",
"the",
"message",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-jdbi-v2/src/main/java/net/morimekta/providence/jdbi/v2/ProvidenceJdbi.java#L30-L33 | train |
morimekta/providence | providence-jdbi-v2/src/main/java/net/morimekta/providence/jdbi/v2/ProvidenceJdbi.java | ProvidenceJdbi.withColumn | public static <F extends PField> MappedField<F> withColumn(F field) {
return new MappedField<>(field.getName(), field);
} | java | public static <F extends PField> MappedField<F> withColumn(F field) {
return new MappedField<>(field.getName(), field);
} | [
"public",
"static",
"<",
"F",
"extends",
"PField",
">",
"MappedField",
"<",
"F",
">",
"withColumn",
"(",
"F",
"field",
")",
"{",
"return",
"new",
"MappedField",
"<>",
"(",
"field",
".",
"getName",
"(",
")",
",",
"field",
")",
";",
"}"
] | With column mapped to field using the field name.
@param field Field it is mapped to.
@param <F> The message field type.
@return The mapped field. | [
"With",
"column",
"mapped",
"to",
"field",
"using",
"the",
"field",
"name",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-jdbi-v2/src/main/java/net/morimekta/providence/jdbi/v2/ProvidenceJdbi.java#L67-L69 | train |
morimekta/providence | providence-jdbi-v2/src/main/java/net/morimekta/providence/jdbi/v2/ProvidenceJdbi.java | ProvidenceJdbi.withColumn | public static <F extends PField> MappedField<F> withColumn(String name, F field) {
return new MappedField<>(name, field);
} | java | public static <F extends PField> MappedField<F> withColumn(String name, F field) {
return new MappedField<>(name, field);
} | [
"public",
"static",
"<",
"F",
"extends",
"PField",
">",
"MappedField",
"<",
"F",
">",
"withColumn",
"(",
"String",
"name",
",",
"F",
"field",
")",
"{",
"return",
"new",
"MappedField",
"<>",
"(",
"name",
",",
"field",
")",
";",
"}"
] | With column mapped to field.
@param name Name of column.
@param field Field it is mapped to.
@param <F> The message field type.
@return The mapped field. | [
"With",
"column",
"mapped",
"to",
"field",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-jdbi-v2/src/main/java/net/morimekta/providence/jdbi/v2/ProvidenceJdbi.java#L79-L81 | train |
isisaddons-legacy/isis-module-security | dom/src/main/java/org/isisaddons/module/security/shiro/AuthenticationStrategyForIsisModuleSecurityRealm.java | AuthenticationStrategyForIsisModuleSecurityRealm.beforeAllAttempts | @Override
public AuthenticationInfo beforeAllAttempts(Collection<? extends Realm> realms, AuthenticationToken token) throws AuthenticationException {
final SimpleAuthenticationInfo authenticationInfo = (SimpleAuthenticationInfo) super.beforeAllAttempts(realms, token);
authenticationInfo.setPrincipa... | java | @Override
public AuthenticationInfo beforeAllAttempts(Collection<? extends Realm> realms, AuthenticationToken token) throws AuthenticationException {
final SimpleAuthenticationInfo authenticationInfo = (SimpleAuthenticationInfo) super.beforeAllAttempts(realms, token);
authenticationInfo.setPrincipa... | [
"@",
"Override",
"public",
"AuthenticationInfo",
"beforeAllAttempts",
"(",
"Collection",
"<",
"?",
"extends",
"Realm",
">",
"realms",
",",
"AuthenticationToken",
"token",
")",
"throws",
"AuthenticationException",
"{",
"final",
"SimpleAuthenticationInfo",
"authenticationIn... | Reconfigures the SimpleAuthenticationInfo to use a implementation for storing its PrincipalCollections.
<p>
The default implementation uses a {@link org.apache.shiro.subject.SimplePrincipalCollection}, however this
doesn't play well with the Isis Addons' security module which ends up chaining together multiple instanc... | [
"Reconfigures",
"the",
"SimpleAuthenticationInfo",
"to",
"use",
"a",
"implementation",
"for",
"storing",
"its",
"PrincipalCollections",
"."
] | a9deb1b003ba01e44c859085bd078be8df0c1863 | https://github.com/isisaddons-legacy/isis-module-security/blob/a9deb1b003ba01e44c859085bd078be8df0c1863/dom/src/main/java/org/isisaddons/module/security/shiro/AuthenticationStrategyForIsisModuleSecurityRealm.java#L26-L32 | train |
morimekta/providence | providence-config/src/main/java/net/morimekta/providence/config/impl/UpdatingConfigSupplier.java | UpdatingConfigSupplier.set | protected final void set(M config) {
ArrayList<WeakReference<ConfigListener<M,F>>> iterateOver;
synchronized (this) {
M old = instance.get();
if (old == config || (old != null && old.equals(config))) {
return;
}
instance.set(config);
... | java | protected final void set(M config) {
ArrayList<WeakReference<ConfigListener<M,F>>> iterateOver;
synchronized (this) {
M old = instance.get();
if (old == config || (old != null && old.equals(config))) {
return;
}
instance.set(config);
... | [
"protected",
"final",
"void",
"set",
"(",
"M",
"config",
")",
"{",
"ArrayList",
"<",
"WeakReference",
"<",
"ConfigListener",
"<",
"M",
",",
"F",
">",
">",
">",
"iterateOver",
";",
"synchronized",
"(",
"this",
")",
"{",
"M",
"old",
"=",
"instance",
".",... | Set a new config value to the supplier. This is protected as it is
usually up to the supplier implementation to enable updating the
config at later stages.
@param config The new config instance. | [
"Set",
"a",
"new",
"config",
"value",
"to",
"the",
"supplier",
".",
"This",
"is",
"protected",
"as",
"it",
"is",
"usually",
"up",
"to",
"the",
"supplier",
"implementation",
"to",
"enable",
"updating",
"the",
"config",
"at",
"later",
"stages",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-config/src/main/java/net/morimekta/providence/config/impl/UpdatingConfigSupplier.java#L97-L120 | train |
mgormley/agiga | src/main/java/edu/jhu/agiga/AgigaSentenceReader.java | AgigaSentenceReader.parseDependencies | private List<AgigaTypedDependency> parseDependencies(VTDNav vn, DependencyForm form) throws NavException,
PilotException {
require (vn.matchElement(AgigaConstants.SENTENCE));
// Move to the <basic-deps> tag
require (vn.toElement(VTDNav.FC, form.getXmlTag()));
List<AgigaType... | java | private List<AgigaTypedDependency> parseDependencies(VTDNav vn, DependencyForm form) throws NavException,
PilotException {
require (vn.matchElement(AgigaConstants.SENTENCE));
// Move to the <basic-deps> tag
require (vn.toElement(VTDNav.FC, form.getXmlTag()));
List<AgigaType... | [
"private",
"List",
"<",
"AgigaTypedDependency",
">",
"parseDependencies",
"(",
"VTDNav",
"vn",
",",
"DependencyForm",
"form",
")",
"throws",
"NavException",
",",
"PilotException",
"{",
"require",
"(",
"vn",
".",
"matchElement",
"(",
"AgigaConstants",
".",
"SENTENC... | Assumes the position of vn is at a "sent" tag
@return | [
"Assumes",
"the",
"position",
"of",
"vn",
"is",
"at",
"a",
"sent",
"tag"
] | d61db78e3fa9d2470122d869a9ab798cb07eea3b | https://github.com/mgormley/agiga/blob/d61db78e3fa9d2470122d869a9ab798cb07eea3b/src/main/java/edu/jhu/agiga/AgigaSentenceReader.java#L314-L342 | train |
lisicnu/Log4Android | src/main/java/com/github/lisicnu/log4android/config/Configurator.java | Configurator.configure | public void configure(String filename, boolean isExternalFile) {
try {
Properties properties;
InputStream inputStream;
if (!isExternalFile) {
Resources resources = context.getResources();
AssetManager assetManager = resources.getAssets();
... | java | public void configure(String filename, boolean isExternalFile) {
try {
Properties properties;
InputStream inputStream;
if (!isExternalFile) {
Resources resources = context.getResources();
AssetManager assetManager = resources.getAssets();
... | [
"public",
"void",
"configure",
"(",
"String",
"filename",
",",
"boolean",
"isExternalFile",
")",
"{",
"try",
"{",
"Properties",
"properties",
";",
"InputStream",
"inputStream",
";",
"if",
"(",
"!",
"isExternalFile",
")",
"{",
"Resources",
"resources",
"=",
"co... | Configure using the specified filename.
@param filename the filename of the properties file used for configuration.
@param isExternalFile the filename is from assets or external storage. | [
"Configure",
"using",
"the",
"specified",
"filename",
"."
] | 229632528e63a424460a219decdaffcf75a9f4a4 | https://github.com/lisicnu/Log4Android/blob/229632528e63a424460a219decdaffcf75a9f4a4/src/main/java/com/github/lisicnu/log4android/config/Configurator.java#L146-L167 | train |
lisicnu/Log4Android | src/main/java/com/github/lisicnu/log4android/config/Configurator.java | Configurator.configure | public void configure(int resId) {
Resources resources = context.getResources();
try {
InputStream rawResource = resources.openRawResource(resId);
Properties properties = loadProperties(rawResource);
startConfiguration(properties);
} catch (NotFoundException ... | java | public void configure(int resId) {
Resources resources = context.getResources();
try {
InputStream rawResource = resources.openRawResource(resId);
Properties properties = loadProperties(rawResource);
startConfiguration(properties);
} catch (NotFoundException ... | [
"public",
"void",
"configure",
"(",
"int",
"resId",
")",
"{",
"Resources",
"resources",
"=",
"context",
".",
"getResources",
"(",
")",
";",
"try",
"{",
"InputStream",
"rawResource",
"=",
"resources",
".",
"openRawResource",
"(",
"resId",
")",
";",
"Propertie... | Configure using the specified resource Id.
@param resId the resource Id where to load the properties from. | [
"Configure",
"using",
"the",
"specified",
"resource",
"Id",
"."
] | 229632528e63a424460a219decdaffcf75a9f4a4 | https://github.com/lisicnu/Log4Android/blob/229632528e63a424460a219decdaffcf75a9f4a4/src/main/java/com/github/lisicnu/log4android/config/Configurator.java#L174-L186 | train |
lisicnu/Log4Android | src/main/java/com/github/lisicnu/log4android/config/Configurator.java | Configurator.startConfiguration | private void startConfiguration(Properties properties) {
if (properties.containsKey(Configurator.ROOT_LOGGER_KEY)) {
Log.i(TAG, "Modern configuration not yet supported");
} else {
Log.i(TAG, "Configure using the simple style (aka classic style)");
configureSimpleStyl... | java | private void startConfiguration(Properties properties) {
if (properties.containsKey(Configurator.ROOT_LOGGER_KEY)) {
Log.i(TAG, "Modern configuration not yet supported");
} else {
Log.i(TAG, "Configure using the simple style (aka classic style)");
configureSimpleStyl... | [
"private",
"void",
"startConfiguration",
"(",
"Properties",
"properties",
")",
"{",
"if",
"(",
"properties",
".",
"containsKey",
"(",
"Configurator",
".",
"ROOT_LOGGER_KEY",
")",
")",
"{",
"Log",
".",
"i",
"(",
"TAG",
",",
"\"Modern configuration not yet supported... | Start the configuration
@param properties | [
"Start",
"the",
"configuration"
] | 229632528e63a424460a219decdaffcf75a9f4a4 | https://github.com/lisicnu/Log4Android/blob/229632528e63a424460a219decdaffcf75a9f4a4/src/main/java/com/github/lisicnu/log4android/config/Configurator.java#L207-L215 | train |
jetty-project/jetty-npn | npn-boot/src/main/java/sun/security/ssl/Handshaker.java | Handshaker.setVersion | void setVersion(ProtocolVersion protocolVersion) {
this.protocolVersion = protocolVersion;
setVersionSE(protocolVersion);
output.r.setVersion(protocolVersion);
} | java | void setVersion(ProtocolVersion protocolVersion) {
this.protocolVersion = protocolVersion;
setVersionSE(protocolVersion);
output.r.setVersion(protocolVersion);
} | [
"void",
"setVersion",
"(",
"ProtocolVersion",
"protocolVersion",
")",
"{",
"this",
".",
"protocolVersion",
"=",
"protocolVersion",
";",
"setVersionSE",
"(",
"protocolVersion",
")",
";",
"output",
".",
"r",
".",
"setVersion",
"(",
"protocolVersion",
")",
";",
"}"... | Set the active protocol version and propagate it to the SSLSocket
and our handshake streams. Called from ClientHandshaker
and ServerHandshaker with the negotiated protocol version. | [
"Set",
"the",
"active",
"protocol",
"version",
"and",
"propagate",
"it",
"to",
"the",
"SSLSocket",
"and",
"our",
"handshake",
"streams",
".",
"Called",
"from",
"ClientHandshaker",
"and",
"ServerHandshaker",
"with",
"the",
"negotiated",
"protocol",
"version",
"."
] | a26a7a5eabeeb57a63c6ee08fcf9b8cec1fa6c0d | https://github.com/jetty-project/jetty-npn/blob/a26a7a5eabeeb57a63c6ee08fcf9b8cec1fa6c0d/npn-boot/src/main/java/sun/security/ssl/Handshaker.java#L389-L394 | train |
jetty-project/jetty-npn | npn-boot/src/main/java/sun/security/ssl/Handshaker.java | Handshaker.activate | void activate(ProtocolVersion helloVersion) throws IOException {
if (activeProtocols == null) {
activeProtocols = getActiveProtocols();
}
if (activeProtocols.collection().isEmpty() ||
activeProtocols.max.v == ProtocolVersion.NONE.v) {
throw new SSLHandsha... | java | void activate(ProtocolVersion helloVersion) throws IOException {
if (activeProtocols == null) {
activeProtocols = getActiveProtocols();
}
if (activeProtocols.collection().isEmpty() ||
activeProtocols.max.v == ProtocolVersion.NONE.v) {
throw new SSLHandsha... | [
"void",
"activate",
"(",
"ProtocolVersion",
"helloVersion",
")",
"throws",
"IOException",
"{",
"if",
"(",
"activeProtocols",
"==",
"null",
")",
"{",
"activeProtocols",
"=",
"getActiveProtocols",
"(",
")",
";",
"}",
"if",
"(",
"activeProtocols",
".",
"collection"... | Prior to handshaking, activate the handshake and initialize the version,
input stream and output stream. | [
"Prior",
"to",
"handshaking",
"activate",
"the",
"handshake",
"and",
"initialize",
"the",
"version",
"input",
"stream",
"and",
"output",
"stream",
"."
] | a26a7a5eabeeb57a63c6ee08fcf9b8cec1fa6c0d | https://github.com/jetty-project/jetty-npn/blob/a26a7a5eabeeb57a63c6ee08fcf9b8cec1fa6c0d/npn-boot/src/main/java/sun/security/ssl/Handshaker.java#L467-L527 | train |
jetty-project/jetty-npn | npn-boot/src/main/java/sun/security/ssl/Handshaker.java | Handshaker.isNegotiable | boolean isNegotiable(CipherSuite s) {
if (activeCipherSuites == null) {
activeCipherSuites = getActiveCipherSuites();
}
return activeCipherSuites.contains(s) && s.isNegotiable();
} | java | boolean isNegotiable(CipherSuite s) {
if (activeCipherSuites == null) {
activeCipherSuites = getActiveCipherSuites();
}
return activeCipherSuites.contains(s) && s.isNegotiable();
} | [
"boolean",
"isNegotiable",
"(",
"CipherSuite",
"s",
")",
"{",
"if",
"(",
"activeCipherSuites",
"==",
"null",
")",
"{",
"activeCipherSuites",
"=",
"getActiveCipherSuites",
"(",
")",
";",
"}",
"return",
"activeCipherSuites",
".",
"contains",
"(",
"s",
")",
"&&",... | Check if the given ciphersuite is enabled and available.
Does not check if the required server certificates are available. | [
"Check",
"if",
"the",
"given",
"ciphersuite",
"is",
"enabled",
"and",
"available",
".",
"Does",
"not",
"check",
"if",
"the",
"required",
"server",
"certificates",
"are",
"available",
"."
] | a26a7a5eabeeb57a63c6ee08fcf9b8cec1fa6c0d | https://github.com/jetty-project/jetty-npn/blob/a26a7a5eabeeb57a63c6ee08fcf9b8cec1fa6c0d/npn-boot/src/main/java/sun/security/ssl/Handshaker.java#L543-L549 | train |
jetty-project/jetty-npn | npn-boot/src/main/java/sun/security/ssl/Handshaker.java | Handshaker.isNegotiable | boolean isNegotiable(ProtocolVersion protocolVersion) {
if (activeProtocols == null) {
activeProtocols = getActiveProtocols();
}
return activeProtocols.contains(protocolVersion);
} | java | boolean isNegotiable(ProtocolVersion protocolVersion) {
if (activeProtocols == null) {
activeProtocols = getActiveProtocols();
}
return activeProtocols.contains(protocolVersion);
} | [
"boolean",
"isNegotiable",
"(",
"ProtocolVersion",
"protocolVersion",
")",
"{",
"if",
"(",
"activeProtocols",
"==",
"null",
")",
"{",
"activeProtocols",
"=",
"getActiveProtocols",
"(",
")",
";",
"}",
"return",
"activeProtocols",
".",
"contains",
"(",
"protocolVers... | Check if the given protocol version is enabled and available. | [
"Check",
"if",
"the",
"given",
"protocol",
"version",
"is",
"enabled",
"and",
"available",
"."
] | a26a7a5eabeeb57a63c6ee08fcf9b8cec1fa6c0d | https://github.com/jetty-project/jetty-npn/blob/a26a7a5eabeeb57a63c6ee08fcf9b8cec1fa6c0d/npn-boot/src/main/java/sun/security/ssl/Handshaker.java#L554-L560 | train |
jetty-project/jetty-npn | npn-boot/src/main/java/sun/security/ssl/Handshaker.java | Handshaker.selectProtocolVersion | ProtocolVersion selectProtocolVersion(ProtocolVersion protocolVersion) {
if (activeProtocols == null) {
activeProtocols = getActiveProtocols();
}
return activeProtocols.selectProtocolVersion(protocolVersion);
} | java | ProtocolVersion selectProtocolVersion(ProtocolVersion protocolVersion) {
if (activeProtocols == null) {
activeProtocols = getActiveProtocols();
}
return activeProtocols.selectProtocolVersion(protocolVersion);
} | [
"ProtocolVersion",
"selectProtocolVersion",
"(",
"ProtocolVersion",
"protocolVersion",
")",
"{",
"if",
"(",
"activeProtocols",
"==",
"null",
")",
"{",
"activeProtocols",
"=",
"getActiveProtocols",
"(",
")",
";",
"}",
"return",
"activeProtocols",
".",
"selectProtocolVe... | Select a protocol version from the list. Called from
ServerHandshaker to negotiate protocol version.
Return the lower of the protocol version suggested in the
clien hello and the highest supported by the server. | [
"Select",
"a",
"protocol",
"version",
"from",
"the",
"list",
".",
"Called",
"from",
"ServerHandshaker",
"to",
"negotiate",
"protocol",
"version",
"."
] | a26a7a5eabeeb57a63c6ee08fcf9b8cec1fa6c0d | https://github.com/jetty-project/jetty-npn/blob/a26a7a5eabeeb57a63c6ee08fcf9b8cec1fa6c0d/npn-boot/src/main/java/sun/security/ssl/Handshaker.java#L569-L575 | train |
jetty-project/jetty-npn | npn-boot/src/main/java/sun/security/ssl/Handshaker.java | Handshaker.getActiveCipherSuites | CipherSuiteList getActiveCipherSuites() {
if (activeCipherSuites == null) {
if (activeProtocols == null) {
activeProtocols = getActiveProtocols();
}
ArrayList<CipherSuite> suites = new ArrayList<>();
if (!(activeProtocols.collection().isEmpty()) &... | java | CipherSuiteList getActiveCipherSuites() {
if (activeCipherSuites == null) {
if (activeProtocols == null) {
activeProtocols = getActiveProtocols();
}
ArrayList<CipherSuite> suites = new ArrayList<>();
if (!(activeProtocols.collection().isEmpty()) &... | [
"CipherSuiteList",
"getActiveCipherSuites",
"(",
")",
"{",
"if",
"(",
"activeCipherSuites",
"==",
"null",
")",
"{",
"if",
"(",
"activeProtocols",
"==",
"null",
")",
"{",
"activeProtocols",
"=",
"getActiveProtocols",
"(",
")",
";",
"}",
"ArrayList",
"<",
"Ciphe... | Get the active cipher suites.
In TLS 1.1, many weak or vulnerable cipher suites were obsoleted,
such as TLS_RSA_EXPORT_WITH_RC4_40_MD5. The implementation MUST NOT
negotiate these cipher suites in TLS 1.1 or later mode.
Therefore, when the active protocols only include TLS 1.1 or later,
the client cannot request to n... | [
"Get",
"the",
"active",
"cipher",
"suites",
"."
] | a26a7a5eabeeb57a63c6ee08fcf9b8cec1fa6c0d | https://github.com/jetty-project/jetty-npn/blob/a26a7a5eabeeb57a63c6ee08fcf9b8cec1fa6c0d/npn-boot/src/main/java/sun/security/ssl/Handshaker.java#L593-L625 | train |
jetty-project/jetty-npn | npn-boot/src/main/java/sun/security/ssl/Handshaker.java | Handshaker.newReadCipher | CipherBox newReadCipher() throws NoSuchAlgorithmException {
BulkCipher cipher = cipherSuite.cipher;
CipherBox box;
if (isClient) {
box = cipher.newCipher(protocolVersion, svrWriteKey, svrWriteIV,
sslContext.getSecureRandom(), false);
svr... | java | CipherBox newReadCipher() throws NoSuchAlgorithmException {
BulkCipher cipher = cipherSuite.cipher;
CipherBox box;
if (isClient) {
box = cipher.newCipher(protocolVersion, svrWriteKey, svrWriteIV,
sslContext.getSecureRandom(), false);
svr... | [
"CipherBox",
"newReadCipher",
"(",
")",
"throws",
"NoSuchAlgorithmException",
"{",
"BulkCipher",
"cipher",
"=",
"cipherSuite",
".",
"cipher",
";",
"CipherBox",
"box",
";",
"if",
"(",
"isClient",
")",
"{",
"box",
"=",
"cipher",
".",
"newCipher",
"(",
"protocolV... | Create a new read cipher and return it to caller. | [
"Create",
"a",
"new",
"read",
"cipher",
"and",
"return",
"it",
"to",
"caller",
"."
] | a26a7a5eabeeb57a63c6ee08fcf9b8cec1fa6c0d | https://github.com/jetty-project/jetty-npn/blob/a26a7a5eabeeb57a63c6ee08fcf9b8cec1fa6c0d/npn-boot/src/main/java/sun/security/ssl/Handshaker.java#L714-L729 | train |
jetty-project/jetty-npn | npn-boot/src/main/java/sun/security/ssl/Handshaker.java | Handshaker.newReadMAC | MAC newReadMAC() throws NoSuchAlgorithmException, InvalidKeyException {
MacAlg macAlg = cipherSuite.macAlg;
MAC mac;
if (isClient) {
mac = macAlg.newMac(protocolVersion, svrMacSecret);
svrMacSecret = null;
} else {
mac = macAlg.newMac(protocolVersion, ... | java | MAC newReadMAC() throws NoSuchAlgorithmException, InvalidKeyException {
MacAlg macAlg = cipherSuite.macAlg;
MAC mac;
if (isClient) {
mac = macAlg.newMac(protocolVersion, svrMacSecret);
svrMacSecret = null;
} else {
mac = macAlg.newMac(protocolVersion, ... | [
"MAC",
"newReadMAC",
"(",
")",
"throws",
"NoSuchAlgorithmException",
",",
"InvalidKeyException",
"{",
"MacAlg",
"macAlg",
"=",
"cipherSuite",
".",
"macAlg",
";",
"MAC",
"mac",
";",
"if",
"(",
"isClient",
")",
"{",
"mac",
"=",
"macAlg",
".",
"newMac",
"(",
... | Create a new read MAC and return it to caller. | [
"Create",
"a",
"new",
"read",
"MAC",
"and",
"return",
"it",
"to",
"caller",
"."
] | a26a7a5eabeeb57a63c6ee08fcf9b8cec1fa6c0d | https://github.com/jetty-project/jetty-npn/blob/a26a7a5eabeeb57a63c6ee08fcf9b8cec1fa6c0d/npn-boot/src/main/java/sun/security/ssl/Handshaker.java#L754-L765 | train |
jetty-project/jetty-npn | npn-boot/src/main/java/sun/security/ssl/Handshaker.java | Handshaker.throwSSLException | static void throwSSLException(String msg, Throwable cause)
throws SSLException {
SSLException e = new SSLException(msg);
e.initCause(cause);
throw e;
} | java | static void throwSSLException(String msg, Throwable cause)
throws SSLException {
SSLException e = new SSLException(msg);
e.initCause(cause);
throw e;
} | [
"static",
"void",
"throwSSLException",
"(",
"String",
"msg",
",",
"Throwable",
"cause",
")",
"throws",
"SSLException",
"{",
"SSLException",
"e",
"=",
"new",
"SSLException",
"(",
"msg",
")",
";",
"e",
".",
"initCause",
"(",
"cause",
")",
";",
"throw",
"e",
... | Throw an SSLException with the specified message and cause.
Shorthand until a new SSLException constructor is added.
This method never returns. | [
"Throw",
"an",
"SSLException",
"with",
"the",
"specified",
"message",
"and",
"cause",
".",
"Shorthand",
"until",
"a",
"new",
"SSLException",
"constructor",
"is",
"added",
".",
"This",
"method",
"never",
"returns",
"."
] | a26a7a5eabeeb57a63c6ee08fcf9b8cec1fa6c0d | https://github.com/jetty-project/jetty-npn/blob/a26a7a5eabeeb57a63c6ee08fcf9b8cec1fa6c0d/npn-boot/src/main/java/sun/security/ssl/Handshaker.java#L1270-L1275 | train |
morimekta/providence | providence-config/src/main/java/net/morimekta/providence/config/impl/ProvidenceConfigUtil.java | ProvidenceConfigUtil.getInMessage | static Object getInMessage(PMessage message, String key) throws ProvidenceConfigException {
return getInMessage(message, key, null);
} | java | static Object getInMessage(PMessage message, String key) throws ProvidenceConfigException {
return getInMessage(message, key, null);
} | [
"static",
"Object",
"getInMessage",
"(",
"PMessage",
"message",
",",
"String",
"key",
")",
"throws",
"ProvidenceConfigException",
"{",
"return",
"getInMessage",
"(",
"message",
",",
"key",
",",
"null",
")",
";",
"}"
] | Look up a key in the message structure. If the key is not found, return null.
@param message The message to look up into.
@param key The key to look up.
@return The value found or null.
@throws ProvidenceConfigException When unable to get value from message. | [
"Look",
"up",
"a",
"key",
"in",
"the",
"message",
"structure",
".",
"If",
"the",
"key",
"is",
"not",
"found",
"return",
"null",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-config/src/main/java/net/morimekta/providence/config/impl/ProvidenceConfigUtil.java#L103-L105 | train |
morimekta/providence | providence-config/src/main/java/net/morimekta/providence/config/impl/ProvidenceConfigUtil.java | ProvidenceConfigUtil.getInMessage | static Object getInMessage(PMessage message, final String key, Object defValue)
throws ProvidenceConfigException {
String sub = key;
String name;
PMessageDescriptor descriptor = message.descriptor();
while (sub.contains(".")) {
int idx = sub.indexOf(".");
... | java | static Object getInMessage(PMessage message, final String key, Object defValue)
throws ProvidenceConfigException {
String sub = key;
String name;
PMessageDescriptor descriptor = message.descriptor();
while (sub.contains(".")) {
int idx = sub.indexOf(".");
... | [
"static",
"Object",
"getInMessage",
"(",
"PMessage",
"message",
",",
"final",
"String",
"key",
",",
"Object",
"defValue",
")",
"throws",
"ProvidenceConfigException",
"{",
"String",
"sub",
"=",
"key",
";",
"String",
"name",
";",
"PMessageDescriptor",
"descriptor",
... | Look up a key in the message structure. If the key is not found, return
the default value. Note that the default value will be converted to the
type of the declared field, not returned verbatim.
@param message The message to look up into.
@param key The key to look up.
@param defValue The default value.
@return The va... | [
"Look",
"up",
"a",
"key",
"in",
"the",
"message",
"structure",
".",
"If",
"the",
"key",
"is",
"not",
"found",
"return",
"the",
"default",
"value",
".",
"Note",
"that",
"the",
"default",
"value",
"will",
"be",
"converted",
"to",
"the",
"type",
"of",
"th... | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-config/src/main/java/net/morimekta/providence/config/impl/ProvidenceConfigUtil.java#L118-L156 | train |
morimekta/providence | providence-config/src/main/java/net/morimekta/providence/config/impl/ProvidenceConfigUtil.java | ProvidenceConfigUtil.asDouble | static double asDouble(Object value) throws ProvidenceConfigException {
if (value instanceof Number) {
return ((Number) value).doubleValue();
} else if (value instanceof Numeric) {
return ((Numeric) value).asInteger();
}
throw new ProvidenceConfigException(
... | java | static double asDouble(Object value) throws ProvidenceConfigException {
if (value instanceof Number) {
return ((Number) value).doubleValue();
} else if (value instanceof Numeric) {
return ((Numeric) value).asInteger();
}
throw new ProvidenceConfigException(
... | [
"static",
"double",
"asDouble",
"(",
"Object",
"value",
")",
"throws",
"ProvidenceConfigException",
"{",
"if",
"(",
"value",
"instanceof",
"Number",
")",
"{",
"return",
"(",
"(",
"Number",
")",
"value",
")",
".",
"doubleValue",
"(",
")",
";",
"}",
"else",
... | Convert the value to a double.
@param value The value instance.
@return The double value.
@throws ProvidenceConfigException When unable to convert value. | [
"Convert",
"the",
"value",
"to",
"a",
"double",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-config/src/main/java/net/morimekta/providence/config/impl/ProvidenceConfigUtil.java#L323-L331 | train |
morimekta/providence | providence-config/src/main/java/net/morimekta/providence/config/impl/ProvidenceConfigUtil.java | ProvidenceConfigUtil.asString | static String asString(Object value) throws ProvidenceConfigException {
if (value instanceof Collection || value instanceof Map) {
throw new ProvidenceConfigException(
"Unable to convert " + value.getClass().getSimpleName() + " to a string");
} else if (value instanceof S... | java | static String asString(Object value) throws ProvidenceConfigException {
if (value instanceof Collection || value instanceof Map) {
throw new ProvidenceConfigException(
"Unable to convert " + value.getClass().getSimpleName() + " to a string");
} else if (value instanceof S... | [
"static",
"String",
"asString",
"(",
"Object",
"value",
")",
"throws",
"ProvidenceConfigException",
"{",
"if",
"(",
"value",
"instanceof",
"Collection",
"||",
"value",
"instanceof",
"Map",
")",
"{",
"throw",
"new",
"ProvidenceConfigException",
"(",
"\"Unable to conv... | Convert the value to a string.
@param value The value instance.
@return The string value.
@throws ProvidenceConfigException When unable to convert value. | [
"Convert",
"the",
"value",
"to",
"a",
"string",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-config/src/main/java/net/morimekta/providence/config/impl/ProvidenceConfigUtil.java#L340-L351 | train |
morimekta/providence | providence-config/src/main/java/net/morimekta/providence/config/impl/ProvidenceConfigUtil.java | ProvidenceConfigUtil.resolveFile | static Path resolveFile(Path reference, String path) throws IOException {
if (reference == null) {
Path file = canonicalFileLocation(Paths.get(path));
if (Files.exists(file)) {
if (Files.isRegularFile(file)) {
return file;
}
... | java | static Path resolveFile(Path reference, String path) throws IOException {
if (reference == null) {
Path file = canonicalFileLocation(Paths.get(path));
if (Files.exists(file)) {
if (Files.isRegularFile(file)) {
return file;
}
... | [
"static",
"Path",
"resolveFile",
"(",
"Path",
"reference",
",",
"String",
"path",
")",
"throws",
"IOException",
"{",
"if",
"(",
"reference",
"==",
"null",
")",
"{",
"Path",
"file",
"=",
"canonicalFileLocation",
"(",
"Paths",
".",
"get",
"(",
"path",
")",
... | Resolve a file path within the source roots.
@param reference A file or directory reference
@param path The file reference to resolve.
@return The resolved file.
@throws FileNotFoundException When the file is not found.
@throws IOException When unable to make canonical path. | [
"Resolve",
"a",
"file",
"path",
"within",
"the",
"source",
"roots",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-config/src/main/java/net/morimekta/providence/config/impl/ProvidenceConfigUtil.java#L525-L556 | train |
pawelprazak/java-extended | guava/src/main/java/com/bluecatcode/common/base/Environment.java | Environment.getNextAvailablePort | public static int getNextAvailablePort(int fromPort, int toPort) {
if (fromPort < MIN_PORT_NUMBER || toPort > MAX_PORT_NUMBER || fromPort > toPort) {
throw new IllegalArgumentException(format("Invalid port range: %d ~ %d", fromPort, toPort));
}
int nextPort = fromPort;
//noi... | java | public static int getNextAvailablePort(int fromPort, int toPort) {
if (fromPort < MIN_PORT_NUMBER || toPort > MAX_PORT_NUMBER || fromPort > toPort) {
throw new IllegalArgumentException(format("Invalid port range: %d ~ %d", fromPort, toPort));
}
int nextPort = fromPort;
//noi... | [
"public",
"static",
"int",
"getNextAvailablePort",
"(",
"int",
"fromPort",
",",
"int",
"toPort",
")",
"{",
"if",
"(",
"fromPort",
"<",
"MIN_PORT_NUMBER",
"||",
"toPort",
">",
"MAX_PORT_NUMBER",
"||",
"fromPort",
">",
"toPort",
")",
"{",
"throw",
"new",
"Ille... | Returns a currently available port number in the specified range.
@param fromPort the lower port limit
@param toPort the upper port limit
@throws IllegalArgumentException if port range is not between {@link #MIN_PORT_NUMBER}
and {@link #MAX_PORT_NUMBER} or <code>fromPort</code> if greater than <code>toPort</code>.
@ret... | [
"Returns",
"a",
"currently",
"available",
"port",
"number",
"in",
"the",
"specified",
"range",
"."
] | ce1a556a95cbbf7c950a03662938bc02622de69b | https://github.com/pawelprazak/java-extended/blob/ce1a556a95cbbf7c950a03662938bc02622de69b/guava/src/main/java/com/bluecatcode/common/base/Environment.java#L116-L125 | train |
pawelprazak/java-extended | guava/src/main/java/com/bluecatcode/common/base/Environment.java | Environment.isPortAvailable | public static boolean isPortAvailable(int port) {
StringBuilder builder = new StringBuilder();
builder.append("Testing port ").append(port).append("\n");
try (Socket s = new Socket("localhost", port)) {
// If the code makes it this far without an exception it means
// som... | java | public static boolean isPortAvailable(int port) {
StringBuilder builder = new StringBuilder();
builder.append("Testing port ").append(port).append("\n");
try (Socket s = new Socket("localhost", port)) {
// If the code makes it this far without an exception it means
// som... | [
"public",
"static",
"boolean",
"isPortAvailable",
"(",
"int",
"port",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"builder",
".",
"append",
"(",
"\"Testing port \"",
")",
".",
"append",
"(",
"port",
")",
".",
"append",
... | Checks if a port is available by opening a socket on it
@param port the port to test
@return true if the port is available | [
"Checks",
"if",
"a",
"port",
"is",
"available",
"by",
"opening",
"a",
"socket",
"on",
"it"
] | ce1a556a95cbbf7c950a03662938bc02622de69b | https://github.com/pawelprazak/java-extended/blob/ce1a556a95cbbf7c950a03662938bc02622de69b/guava/src/main/java/com/bluecatcode/common/base/Environment.java#L141-L155 | train |
morimekta/providence | providence-core/src/main/java/net/morimekta/providence/PMessageBuilder.java | PMessageBuilder.presentFields | @Nonnull
public Collection<F> presentFields() {
return Arrays.stream(descriptor().getFields())
.filter(this::isSet)
.collect(Collectors.toList());
} | java | @Nonnull
public Collection<F> presentFields() {
return Arrays.stream(descriptor().getFields())
.filter(this::isSet)
.collect(Collectors.toList());
} | [
"@",
"Nonnull",
"public",
"Collection",
"<",
"F",
">",
"presentFields",
"(",
")",
"{",
"return",
"Arrays",
".",
"stream",
"(",
"descriptor",
"(",
")",
".",
"getFields",
"(",
")",
")",
".",
"filter",
"(",
"this",
"::",
"isSet",
")",
".",
"collect",
"(... | Get a Collection of F with fields set on the builder. A.k.a is
present.
Unusual naming because it avoids conflict with generated methods.
@return Collection of F | [
"Get",
"a",
"Collection",
"of",
"F",
"with",
"fields",
"set",
"on",
"the",
"builder",
".",
"A",
".",
"k",
".",
"a",
"is",
"present",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-core/src/main/java/net/morimekta/providence/PMessageBuilder.java#L104-L109 | train |
morimekta/providence | providence-core/src/main/java/net/morimekta/providence/PMessageBuilder.java | PMessageBuilder.modifiedFields | @Nonnull
public Collection<F> modifiedFields() {
return Arrays.stream(descriptor().getFields())
.filter(this::isModified)
.collect(Collectors.toList());
} | java | @Nonnull
public Collection<F> modifiedFields() {
return Arrays.stream(descriptor().getFields())
.filter(this::isModified)
.collect(Collectors.toList());
} | [
"@",
"Nonnull",
"public",
"Collection",
"<",
"F",
">",
"modifiedFields",
"(",
")",
"{",
"return",
"Arrays",
".",
"stream",
"(",
"descriptor",
"(",
")",
".",
"getFields",
"(",
")",
")",
".",
"filter",
"(",
"this",
"::",
"isModified",
")",
".",
"collect"... | Get a Collection of F with fields Modified since creation of the builder.
@return Collection of F | [
"Get",
"a",
"Collection",
"of",
"F",
"with",
"fields",
"Modified",
"since",
"creation",
"of",
"the",
"builder",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-core/src/main/java/net/morimekta/providence/PMessageBuilder.java#L134-L139 | train |
pawelprazak/java-extended | guava/src/main/java/com/bluecatcode/common/base/RichEnumConstants.java | RichEnumConstants.richConstants | public static <T extends Enum<T> & RichEnum<T>> RichEnumConstants<T> richConstants(Class<T> theClass) {
return new RichEnumConstants<>(theClass);
} | java | public static <T extends Enum<T> & RichEnum<T>> RichEnumConstants<T> richConstants(Class<T> theClass) {
return new RichEnumConstants<>(theClass);
} | [
"public",
"static",
"<",
"T",
"extends",
"Enum",
"<",
"T",
">",
"&",
"RichEnum",
"<",
"T",
">",
">",
"RichEnumConstants",
"<",
"T",
">",
"richConstants",
"(",
"Class",
"<",
"T",
">",
"theClass",
")",
"{",
"return",
"new",
"RichEnumConstants",
"<>",
"("... | The factory method
@param theClass the enum class
@param <T> the enum type
@return the rich enum companion class instance | [
"The",
"factory",
"method"
] | ce1a556a95cbbf7c950a03662938bc02622de69b | https://github.com/pawelprazak/java-extended/blob/ce1a556a95cbbf7c950a03662938bc02622de69b/guava/src/main/java/com/bluecatcode/common/base/RichEnumConstants.java#L39-L41 | train |
seedstack/w20-bridge-addon | specs/src/main/java/org/seedstack/w20/ConfiguredModule.java | ConfiguredModule.putConfigurationValue | @JsonAnySetter
public void putConfigurationValue(String key, Object value) {
this.configuration.put(key, value);
} | java | @JsonAnySetter
public void putConfigurationValue(String key, Object value) {
this.configuration.put(key, value);
} | [
"@",
"JsonAnySetter",
"public",
"void",
"putConfigurationValue",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"this",
".",
"configuration",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}"
] | Put a value in the module configuration map.
@param key the key.
@param value the value. | [
"Put",
"a",
"value",
"in",
"the",
"module",
"configuration",
"map",
"."
] | 94c997a9392f10a1bf1655e7f25bf2f6f328ce20 | https://github.com/seedstack/w20-bridge-addon/blob/94c997a9392f10a1bf1655e7f25bf2f6f328ce20/specs/src/main/java/org/seedstack/w20/ConfiguredModule.java#L89-L92 | train |
morimekta/providence | providence-reflect/src/main/java-gen/net/morimekta/providence/model/ProgramMeta.java | ProgramMeta.optionalFilePath | @javax.annotation.Nonnull
public java.util.Optional<String> optionalFilePath() {
return java.util.Optional.ofNullable(mFilePath);
} | java | @javax.annotation.Nonnull
public java.util.Optional<String> optionalFilePath() {
return java.util.Optional.ofNullable(mFilePath);
} | [
"@",
"javax",
".",
"annotation",
".",
"Nonnull",
"public",
"java",
".",
"util",
".",
"Optional",
"<",
"String",
">",
"optionalFilePath",
"(",
")",
"{",
"return",
"java",
".",
"util",
".",
"Optional",
".",
"ofNullable",
"(",
"mFilePath",
")",
";",
"}"
] | Full absolute path to the file.
@return Optional of the <code>file_path</code> field value. | [
"Full",
"absolute",
"path",
"to",
"the",
"file",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-reflect/src/main/java-gen/net/morimekta/providence/model/ProgramMeta.java#L61-L64 | train |
morimekta/providence | providence-reflect/src/main/java-gen/net/morimekta/providence/model/ProgramMeta.java | ProgramMeta.optionalFileLines | @javax.annotation.Nonnull
public java.util.Optional<java.util.List<String>> optionalFileLines() {
return java.util.Optional.ofNullable(mFileLines);
} | java | @javax.annotation.Nonnull
public java.util.Optional<java.util.List<String>> optionalFileLines() {
return java.util.Optional.ofNullable(mFileLines);
} | [
"@",
"javax",
".",
"annotation",
".",
"Nonnull",
"public",
"java",
".",
"util",
".",
"Optional",
"<",
"java",
".",
"util",
".",
"List",
"<",
"String",
">",
">",
"optionalFileLines",
"(",
")",
"{",
"return",
"java",
".",
"util",
".",
"Optional",
".",
... | The lines of the program file
@return Optional of the <code>file_lines</code> field value. | [
"The",
"lines",
"of",
"the",
"program",
"file"
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-reflect/src/main/java-gen/net/morimekta/providence/model/ProgramMeta.java#L88-L91 | train |
morimekta/providence | providence-reflect/src/main/java-gen/net/morimekta/providence/model/ProgramMeta.java | ProgramMeta.optionalProgram | @javax.annotation.Nonnull
public java.util.Optional<net.morimekta.providence.model.ProgramType> optionalProgram() {
return java.util.Optional.ofNullable(mProgram);
} | java | @javax.annotation.Nonnull
public java.util.Optional<net.morimekta.providence.model.ProgramType> optionalProgram() {
return java.util.Optional.ofNullable(mProgram);
} | [
"@",
"javax",
".",
"annotation",
".",
"Nonnull",
"public",
"java",
".",
"util",
".",
"Optional",
"<",
"net",
".",
"morimekta",
".",
"providence",
".",
"model",
".",
"ProgramType",
">",
"optionalProgram",
"(",
")",
"{",
"return",
"java",
".",
"util",
".",... | The program type definition
@return Optional of the <code>program</code> field value. | [
"The",
"program",
"type",
"definition"
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-reflect/src/main/java-gen/net/morimekta/providence/model/ProgramMeta.java#L111-L114 | train |
morimekta/providence | providence-reflect/src/main/java/net/morimekta/providence/reflect/util/ProgramRegistry.java | ProgramRegistry.registryForPath | @Nonnull
public ProgramTypeRegistry registryForPath(String path) {
return registryMap.computeIfAbsent(path, p -> new ProgramTypeRegistry(programNameFromPath(path)));
} | java | @Nonnull
public ProgramTypeRegistry registryForPath(String path) {
return registryMap.computeIfAbsent(path, p -> new ProgramTypeRegistry(programNameFromPath(path)));
} | [
"@",
"Nonnull",
"public",
"ProgramTypeRegistry",
"registryForPath",
"(",
"String",
"path",
")",
"{",
"return",
"registryMap",
".",
"computeIfAbsent",
"(",
"path",
",",
"p",
"->",
"new",
"ProgramTypeRegistry",
"(",
"programNameFromPath",
"(",
"path",
")",
")",
")... | Get a program type registry for the file at given path. If the
registry is not created yet, it will be created.
@param path The thrift file path.
@return The associated program type registry. | [
"Get",
"a",
"program",
"type",
"registry",
"for",
"the",
"file",
"at",
"given",
"path",
".",
"If",
"the",
"registry",
"is",
"not",
"created",
"yet",
"it",
"will",
"be",
"created",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-reflect/src/main/java/net/morimekta/providence/reflect/util/ProgramRegistry.java#L65-L68 | train |
morimekta/providence | providence-reflect/src/main/java/net/morimekta/providence/reflect/util/ProgramRegistry.java | ProgramRegistry.containsProgramPath | public boolean containsProgramPath(String path) {
return registryMap.containsKey(path) && registryMap.get(path).getProgram() != null;
} | java | public boolean containsProgramPath(String path) {
return registryMap.containsKey(path) && registryMap.get(path).getProgram() != null;
} | [
"public",
"boolean",
"containsProgramPath",
"(",
"String",
"path",
")",
"{",
"return",
"registryMap",
".",
"containsKey",
"(",
"path",
")",
"&&",
"registryMap",
".",
"get",
"(",
"path",
")",
".",
"getProgram",
"(",
")",
"!=",
"null",
";",
"}"
] | Gets the document for a given file path.
@param path The file path.
@return The contained document, or null if not found. | [
"Gets",
"the",
"document",
"for",
"a",
"given",
"file",
"path",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-reflect/src/main/java/net/morimekta/providence/reflect/util/ProgramRegistry.java#L85-L87 | train |
morimekta/providence | providence-thrift-compat/src/main/java/net/morimekta/providence/thrift/io/FramedBufferOutputStream.java | FramedBufferOutputStream.completeFrame | public void completeFrame() throws IOException {
int frameSize = buffer.position();
if (frameSize > 0) {
frameSizeBuffer.rewind();
try (ByteBufferOutputStream bos = new ByteBufferOutputStream(frameSizeBuffer);
BinaryWriter writer = new BigEndianBinaryWriter(bos))... | java | public void completeFrame() throws IOException {
int frameSize = buffer.position();
if (frameSize > 0) {
frameSizeBuffer.rewind();
try (ByteBufferOutputStream bos = new ByteBufferOutputStream(frameSizeBuffer);
BinaryWriter writer = new BigEndianBinaryWriter(bos))... | [
"public",
"void",
"completeFrame",
"(",
")",
"throws",
"IOException",
"{",
"int",
"frameSize",
"=",
"buffer",
".",
"position",
"(",
")",
";",
"if",
"(",
"frameSize",
">",
"0",
")",
"{",
"frameSizeBuffer",
".",
"rewind",
"(",
")",
";",
"try",
"(",
"Byte... | Write the frame at the current state, and reset the buffer to be able to
generate a new frame.
@throws IOException On failed write. | [
"Write",
"the",
"frame",
"at",
"the",
"current",
"state",
"and",
"reset",
"the",
"buffer",
"to",
"be",
"able",
"to",
"generate",
"a",
"new",
"frame",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-thrift-compat/src/main/java/net/morimekta/providence/thrift/io/FramedBufferOutputStream.java#L90-L112 | train |
ZsoltSafrany/java-apns-gae | src/main/java/apns/ApnsConnectionPool.java | ApnsConnectionPool.put | public synchronized void put(ApnsConnection connection) {
if (connection == null) {
throw new IllegalArgumentException("connection must not be null");
}
if (mPool.size() < mCapacity) {
mPool.add(connection);
}
} | java | public synchronized void put(ApnsConnection connection) {
if (connection == null) {
throw new IllegalArgumentException("connection must not be null");
}
if (mPool.size() < mCapacity) {
mPool.add(connection);
}
} | [
"public",
"synchronized",
"void",
"put",
"(",
"ApnsConnection",
"connection",
")",
"{",
"if",
"(",
"connection",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"connection must not be null\"",
")",
";",
"}",
"if",
"(",
"mPool",
".",
... | If and only if size of the pool is less than its capacity then
connection is put into the pool and size of the pool incremented by one;
otherwise method argument is ignored and pool is not changed.
@param connection that you want to put into the pool | [
"If",
"and",
"only",
"if",
"size",
"of",
"the",
"pool",
"is",
"less",
"than",
"its",
"capacity",
"then",
"connection",
"is",
"put",
"into",
"the",
"pool",
"and",
"size",
"of",
"the",
"pool",
"incremented",
"by",
"one",
";",
"otherwise",
"method",
"argume... | 9302bfe78b8e5a2819d21bcf5c39c67214883186 | https://github.com/ZsoltSafrany/java-apns-gae/blob/9302bfe78b8e5a2819d21bcf5c39c67214883186/src/main/java/apns/ApnsConnectionPool.java#L44-L51 | train |
pawelprazak/java-extended | guava/src/main/java/com/bluecatcode/common/hash/Hash.java | Hash.newHash | public static HashCode newHash(String input, HashFunction function) {
return function.hashString(input, Charsets.UTF_8);
} | java | public static HashCode newHash(String input, HashFunction function) {
return function.hashString(input, Charsets.UTF_8);
} | [
"public",
"static",
"HashCode",
"newHash",
"(",
"String",
"input",
",",
"HashFunction",
"function",
")",
"{",
"return",
"function",
".",
"hashString",
"(",
"input",
",",
"Charsets",
".",
"UTF_8",
")",
";",
"}"
] | Creates a UTF-8 encoded hash using the hash function
@param input string to encode
@param function hash function to use
@return the hash code | [
"Creates",
"a",
"UTF",
"-",
"8",
"encoded",
"hash",
"using",
"the",
"hash",
"function"
] | ce1a556a95cbbf7c950a03662938bc02622de69b | https://github.com/pawelprazak/java-extended/blob/ce1a556a95cbbf7c950a03662938bc02622de69b/guava/src/main/java/com/bluecatcode/common/hash/Hash.java#L28-L30 | train |
morimekta/providence | providence-reflect/src/main/java/net/morimekta/providence/reflect/contained/CField.java | CField.equalsQualifiedName | private static boolean equalsQualifiedName(PDescriptor a, PDescriptor b) {
return (a != null) && (b != null) && (a.getQualifiedName()
.equals(b.getQualifiedName()));
} | java | private static boolean equalsQualifiedName(PDescriptor a, PDescriptor b) {
return (a != null) && (b != null) && (a.getQualifiedName()
.equals(b.getQualifiedName()));
} | [
"private",
"static",
"boolean",
"equalsQualifiedName",
"(",
"PDescriptor",
"a",
",",
"PDescriptor",
"b",
")",
"{",
"return",
"(",
"a",
"!=",
"null",
")",
"&&",
"(",
"b",
"!=",
"null",
")",
"&&",
"(",
"a",
".",
"getQualifiedName",
"(",
")",
".",
"equals... | Check if the two descriptors has the same qualified name, i..e
symbolically represent the same type.
@param a The first type.
@param b The second type.
@return If the two types are the same. | [
"Check",
"if",
"the",
"two",
"descriptors",
"has",
"the",
"same",
"qualified",
"name",
"i",
"..",
"e",
"symbolically",
"represent",
"the",
"same",
"type",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-reflect/src/main/java/net/morimekta/providence/reflect/contained/CField.java#L190-L193 | train |
jetty-project/jetty-npn | npn-boot/src/main/java/sun/security/ssl/ServerHandshaker.java | ServerHandshaker.setupPrivateKeyAndChain | private boolean setupPrivateKeyAndChain(String algorithm) {
X509ExtendedKeyManager km = sslContext.getX509KeyManager();
String alias;
if (conn != null) {
alias = km.chooseServerAlias(algorithm, null, conn);
} else {
alias = km.chooseEngineServerAlias(algorithm, nu... | java | private boolean setupPrivateKeyAndChain(String algorithm) {
X509ExtendedKeyManager km = sslContext.getX509KeyManager();
String alias;
if (conn != null) {
alias = km.chooseServerAlias(algorithm, null, conn);
} else {
alias = km.chooseEngineServerAlias(algorithm, nu... | [
"private",
"boolean",
"setupPrivateKeyAndChain",
"(",
"String",
"algorithm",
")",
"{",
"X509ExtendedKeyManager",
"km",
"=",
"sslContext",
".",
"getX509KeyManager",
"(",
")",
";",
"String",
"alias",
";",
"if",
"(",
"conn",
"!=",
"null",
")",
"{",
"alias",
"=",
... | Retrieve the server key and certificate for the specified algorithm
from the KeyManager and set the instance variables.
@return true if successful, false if not available or invalid | [
"Retrieve",
"the",
"server",
"key",
"and",
"certificate",
"for",
"the",
"specified",
"algorithm",
"from",
"the",
"KeyManager",
"and",
"set",
"the",
"instance",
"variables",
"."
] | a26a7a5eabeeb57a63c6ee08fcf9b8cec1fa6c0d | https://github.com/jetty-project/jetty-npn/blob/a26a7a5eabeeb57a63c6ee08fcf9b8cec1fa6c0d/npn-boot/src/main/java/sun/security/ssl/ServerHandshaker.java#L1285-L1329 | train |
jetty-project/jetty-npn | npn-boot/src/main/java/sun/security/ssl/ServerHandshaker.java | ServerHandshaker.setupKerberosKeys | private boolean setupKerberosKeys() {
if (kerberosKeys != null) {
return true;
}
try {
final AccessControlContext acc = getAccSE();
kerberosKeys = AccessController.doPrivileged(
// Eliminate dependency on KerberosKey
new Privile... | java | private boolean setupKerberosKeys() {
if (kerberosKeys != null) {
return true;
}
try {
final AccessControlContext acc = getAccSE();
kerberosKeys = AccessController.doPrivileged(
// Eliminate dependency on KerberosKey
new Privile... | [
"private",
"boolean",
"setupKerberosKeys",
"(",
")",
"{",
"if",
"(",
"kerberosKeys",
"!=",
"null",
")",
"{",
"return",
"true",
";",
"}",
"try",
"{",
"final",
"AccessControlContext",
"acc",
"=",
"getAccSE",
"(",
")",
";",
"kerberosKeys",
"=",
"AccessControlle... | Retrieve the Kerberos key for the specified server principal
from the JAAS configuration file.
@return true if successful, false if not available or invalid | [
"Retrieve",
"the",
"Kerberos",
"key",
"for",
"the",
"specified",
"server",
"principal",
"from",
"the",
"JAAS",
"configuration",
"file",
"."
] | a26a7a5eabeeb57a63c6ee08fcf9b8cec1fa6c0d | https://github.com/jetty-project/jetty-npn/blob/a26a7a5eabeeb57a63c6ee08fcf9b8cec1fa6c0d/npn-boot/src/main/java/sun/security/ssl/ServerHandshaker.java#L1337-L1388 | train |
isisaddons-legacy/isis-module-security | dom/src/main/java/org/isisaddons/module/security/dom/permission/ApplicationPermissionValue.java | ApplicationPermissionValue.implies | @Programmatic
public boolean implies(final ApplicationFeatureId featureId, final ApplicationPermissionMode mode) {
if(getRule() != ApplicationPermissionRule.ALLOW) {
// only allow rules can imply
return false;
}
if(getMode() == ApplicationPermissionMode.VIEWING && mod... | java | @Programmatic
public boolean implies(final ApplicationFeatureId featureId, final ApplicationPermissionMode mode) {
if(getRule() != ApplicationPermissionRule.ALLOW) {
// only allow rules can imply
return false;
}
if(getMode() == ApplicationPermissionMode.VIEWING && mod... | [
"@",
"Programmatic",
"public",
"boolean",
"implies",
"(",
"final",
"ApplicationFeatureId",
"featureId",
",",
"final",
"ApplicationPermissionMode",
"mode",
")",
"{",
"if",
"(",
"getRule",
"(",
")",
"!=",
"ApplicationPermissionRule",
".",
"ALLOW",
")",
"{",
"// only... | region > implies, refutes | [
"region",
">",
"implies",
"refutes"
] | a9deb1b003ba01e44c859085bd078be8df0c1863 | https://github.com/isisaddons-legacy/isis-module-security/blob/a9deb1b003ba01e44c859085bd078be8df0c1863/dom/src/main/java/org/isisaddons/module/security/dom/permission/ApplicationPermissionValue.java#L74-L87 | train |
morimekta/providence | providence-core/src/main/java/net/morimekta/providence/descriptor/PPrimitive.java | PPrimitive.findByName | public static PPrimitive findByName(String name) {
switch (name) {
case "void":
return VOID;
case "bool":
return BOOL;
case "byte":
case "i8":
return BYTE;
case "i16":
return I16;
... | java | public static PPrimitive findByName(String name) {
switch (name) {
case "void":
return VOID;
case "bool":
return BOOL;
case "byte":
case "i8":
return BYTE;
case "i16":
return I16;
... | [
"public",
"static",
"PPrimitive",
"findByName",
"(",
"String",
"name",
")",
"{",
"switch",
"(",
"name",
")",
"{",
"case",
"\"void\"",
":",
"return",
"VOID",
";",
"case",
"\"bool\"",
":",
"return",
"BOOL",
";",
"case",
"\"byte\"",
":",
"case",
"\"i8\"",
"... | Find primitive by name.
@param name The name of the primitive.
@return The primitive descriptor. | [
"Find",
"primitive",
"by",
"name",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-core/src/main/java/net/morimekta/providence/descriptor/PPrimitive.java#L125-L148 | train |
lisicnu/Log4Android | src/main/java/com/github/lisicnu/log4android/format/command/ThrowableFormatCommand.java | ThrowableFormatCommand.execute | public String execute(String clientID, String name, long time, Level level,
Object message, Throwable throwable){
StringBuilder sb = new StringBuilder();
if (throwable != null) {
sb.append(throwable.toString());
String newline = System.getProperty("line.separator");
StackTraceElement[] stackTrace... | java | public String execute(String clientID, String name, long time, Level level,
Object message, Throwable throwable){
StringBuilder sb = new StringBuilder();
if (throwable != null) {
sb.append(throwable.toString());
String newline = System.getProperty("line.separator");
StackTraceElement[] stackTrace... | [
"public",
"String",
"execute",
"(",
"String",
"clientID",
",",
"String",
"name",
",",
"long",
"time",
",",
"Level",
"level",
",",
"Object",
"message",
",",
"Throwable",
"throwable",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";... | Set the log data.
@see FormatCommandInterface#execute(String, String, long, Level, Object,
Throwable) | [
"Set",
"the",
"log",
"data",
"."
] | 229632528e63a424460a219decdaffcf75a9f4a4 | https://github.com/lisicnu/Log4Android/blob/229632528e63a424460a219decdaffcf75a9f4a4/src/main/java/com/github/lisicnu/log4android/format/command/ThrowableFormatCommand.java#L40-L57 | train |
lisicnu/Log4Android | src/main/java/com/github/lisicnu/log4android/appender/SyslogMessage.java | SyslogMessage.createMessageData | public String createMessageData(String message) {
messageStringBuffer.delete(0, messageStringBuffer.length());
// Create the PRI part
messageStringBuffer.append('<');
int priority = facility * 8 + severity;
messageStringBuffer.append(priority);
messageStringBuffer.append('>');
// Create the HEADER part... | java | public String createMessageData(String message) {
messageStringBuffer.delete(0, messageStringBuffer.length());
// Create the PRI part
messageStringBuffer.append('<');
int priority = facility * 8 + severity;
messageStringBuffer.append(priority);
messageStringBuffer.append('>');
// Create the HEADER part... | [
"public",
"String",
"createMessageData",
"(",
"String",
"message",
")",
"{",
"messageStringBuffer",
".",
"delete",
"(",
"0",
",",
"messageStringBuffer",
".",
"length",
"(",
")",
")",
";",
"// Create the PRI part",
"messageStringBuffer",
".",
"append",
"(",
"'",
... | Create the syslog message data, that is consequently wrapped in a
datagram.
@param message
the message to include.
@return a <code>String</code> object representing the syslog message
data. | [
"Create",
"the",
"syslog",
"message",
"data",
"that",
"is",
"consequently",
"wrapped",
"in",
"a",
"datagram",
"."
] | 229632528e63a424460a219decdaffcf75a9f4a4 | https://github.com/lisicnu/Log4Android/blob/229632528e63a424460a219decdaffcf75a9f4a4/src/main/java/com/github/lisicnu/log4android/appender/SyslogMessage.java#L117-L177 | train |
lisicnu/Log4Android | src/main/java/com/github/lisicnu/log4android/appender/SyslogMessage.java | SyslogMessage.setFacility | public void setFacility(byte facility) {
if (facility < SyslogMessage.FACILITY_KERNAL_MESSAGE
|| facility > SyslogMessage.FACILITY_LOCAL_USE_7) {
throw new IllegalArgumentException("Not a valid facility.");
}
this.facility = facility;
} | java | public void setFacility(byte facility) {
if (facility < SyslogMessage.FACILITY_KERNAL_MESSAGE
|| facility > SyslogMessage.FACILITY_LOCAL_USE_7) {
throw new IllegalArgumentException("Not a valid facility.");
}
this.facility = facility;
} | [
"public",
"void",
"setFacility",
"(",
"byte",
"facility",
")",
"{",
"if",
"(",
"facility",
"<",
"SyslogMessage",
".",
"FACILITY_KERNAL_MESSAGE",
"||",
"facility",
">",
"SyslogMessage",
".",
"FACILITY_LOCAL_USE_7",
")",
"{",
"throw",
"new",
"IllegalArgumentException"... | Set the facility that is used when sending message.
@param facility
the facility to set
@throws IllegalArgumentException
if the facility is not a valid one. | [
"Set",
"the",
"facility",
"that",
"is",
"used",
"when",
"sending",
"message",
"."
] | 229632528e63a424460a219decdaffcf75a9f4a4 | https://github.com/lisicnu/Log4Android/blob/229632528e63a424460a219decdaffcf75a9f4a4/src/main/java/com/github/lisicnu/log4android/appender/SyslogMessage.java#L187-L194 | train |
lisicnu/Log4Android | src/main/java/com/github/lisicnu/log4android/appender/SyslogMessage.java | SyslogMessage.setSeverity | public void setSeverity(byte severity) throws IllegalArgumentException {
if (severity < SyslogMessage.SEVERITY_EMERGENCY
|| severity > SyslogMessage.SEVERITY_DEBUG) {
throw new IllegalArgumentException("Not a valid severity.");
}
this.severity = severity;
} | java | public void setSeverity(byte severity) throws IllegalArgumentException {
if (severity < SyslogMessage.SEVERITY_EMERGENCY
|| severity > SyslogMessage.SEVERITY_DEBUG) {
throw new IllegalArgumentException("Not a valid severity.");
}
this.severity = severity;
} | [
"public",
"void",
"setSeverity",
"(",
"byte",
"severity",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"severity",
"<",
"SyslogMessage",
".",
"SEVERITY_EMERGENCY",
"||",
"severity",
">",
"SyslogMessage",
".",
"SEVERITY_DEBUG",
")",
"{",
"throw",
"new... | Get the severity at which the message shall be sent.
@param severity
the severity to set
@throws IllegalArgumentException
if the severity is not a valid severity. | [
"Get",
"the",
"severity",
"at",
"which",
"the",
"message",
"shall",
"be",
"sent",
"."
] | 229632528e63a424460a219decdaffcf75a9f4a4 | https://github.com/lisicnu/Log4Android/blob/229632528e63a424460a219decdaffcf75a9f4a4/src/main/java/com/github/lisicnu/log4android/appender/SyslogMessage.java#L210-L217 | train |
lisicnu/Log4Android | src/main/java/com/github/lisicnu/log4android/appender/SyslogMessage.java | SyslogMessage.setTag | public void setTag(String tag) throws IllegalArgumentException {
if (tag == null
|| (tag != null && (tag.length() < 1 || tag.length() > 32))) {
throw new IllegalArgumentException(
"The tag must not be null, the length between 1..32");
}
this.tag = tag;
} | java | public void setTag(String tag) throws IllegalArgumentException {
if (tag == null
|| (tag != null && (tag.length() < 1 || tag.length() > 32))) {
throw new IllegalArgumentException(
"The tag must not be null, the length between 1..32");
}
this.tag = tag;
} | [
"public",
"void",
"setTag",
"(",
"String",
"tag",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"tag",
"==",
"null",
"||",
"(",
"tag",
"!=",
"null",
"&&",
"(",
"tag",
".",
"length",
"(",
")",
"<",
"1",
"||",
"tag",
".",
"length",
"(",
... | Set the tag that is used for the TAG field in the MSG part of the
message. The TAG length must not exceed 32 chars.
@param tag
the tag to set
@throws IllegalArgumentException
if the tag is null or the length is incorrect. | [
"Set",
"the",
"tag",
"that",
"is",
"used",
"for",
"the",
"TAG",
"field",
"in",
"the",
"MSG",
"part",
"of",
"the",
"message",
".",
"The",
"TAG",
"length",
"must",
"not",
"exceed",
"32",
"chars",
"."
] | 229632528e63a424460a219decdaffcf75a9f4a4 | https://github.com/lisicnu/Log4Android/blob/229632528e63a424460a219decdaffcf75a9f4a4/src/main/java/com/github/lisicnu/log4android/appender/SyslogMessage.java#L261-L269 | train |
pawelprazak/java-extended | guava/src/main/java/com/bluecatcode/common/io/Files.java | Files.getFileAsProperties | public static Properties getFileAsProperties(String path) {
File file = new File(nullToEmpty(path));
return getFileAsProperties(file);
} | java | public static Properties getFileAsProperties(String path) {
File file = new File(nullToEmpty(path));
return getFileAsProperties(file);
} | [
"public",
"static",
"Properties",
"getFileAsProperties",
"(",
"String",
"path",
")",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"nullToEmpty",
"(",
"path",
")",
")",
";",
"return",
"getFileAsProperties",
"(",
"file",
")",
";",
"}"
] | Loads properties from file path
@param path the path to properties file
@return the loaded properties | [
"Loads",
"properties",
"from",
"file",
"path"
] | ce1a556a95cbbf7c950a03662938bc02622de69b | https://github.com/pawelprazak/java-extended/blob/ce1a556a95cbbf7c950a03662938bc02622de69b/guava/src/main/java/com/bluecatcode/common/io/Files.java#L36-L39 | train |
morimekta/providence | providence-core/src/main/java-gen/net/morimekta/providence/util/Any.java | Any.optionalData | @javax.annotation.Nonnull
public java.util.Optional<net.morimekta.util.Binary> optionalData() {
return java.util.Optional.ofNullable(mData);
} | java | @javax.annotation.Nonnull
public java.util.Optional<net.morimekta.util.Binary> optionalData() {
return java.util.Optional.ofNullable(mData);
} | [
"@",
"javax",
".",
"annotation",
".",
"Nonnull",
"public",
"java",
".",
"util",
".",
"Optional",
"<",
"net",
".",
"morimekta",
".",
"util",
".",
"Binary",
">",
"optionalData",
"(",
")",
"{",
"return",
"java",
".",
"util",
".",
"Optional",
".",
"ofNulla... | The actual content binary data.
@return Optional of the <code>data</code> field value. | [
"The",
"actual",
"content",
"binary",
"data",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-core/src/main/java-gen/net/morimekta/providence/util/Any.java#L100-L103 | train |
morimekta/providence | providence-config/src/main/java/net/morimekta/providence/config/impl/ProvidenceConfigSupplier.java | ProvidenceConfigSupplier.reload | private void reload() {
try {
if (!configFile.exists()) {
LOGGER.warn("Config file deleted " + configFile + ", keeping old config.");
return;
}
LOGGER.trace("Config reload triggered for " + configFile);
if (parentSupplier != null) {... | java | private void reload() {
try {
if (!configFile.exists()) {
LOGGER.warn("Config file deleted " + configFile + ", keeping old config.");
return;
}
LOGGER.trace("Config reload triggered for " + configFile);
if (parentSupplier != null) {... | [
"private",
"void",
"reload",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"configFile",
".",
"exists",
"(",
")",
")",
"{",
"LOGGER",
".",
"warn",
"(",
"\"Config file deleted \"",
"+",
"configFile",
"+",
"\", keeping old config.\"",
")",
";",
"return",
";",
... | Trigger reloading of the config file. | [
"Trigger",
"reloading",
"of",
"the",
"config",
"file",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-config/src/main/java/net/morimekta/providence/config/impl/ProvidenceConfigSupplier.java#L119-L134 | train |
morimekta/providence | providence-core/src/main/java/net/morimekta/providence/serializer/binary/BinaryFormatUtils.java | BinaryFormatUtils.readMessage | public static <Message extends PMessage<Message, Field>, Field extends PField>
Message readMessage(BigEndianBinaryReader input,
PMessageDescriptor<Message, Field> descriptor,
boolean strict) throws IOException {
PMessageBuilder<Message, Field> builder = descri... | java | public static <Message extends PMessage<Message, Field>, Field extends PField>
Message readMessage(BigEndianBinaryReader input,
PMessageDescriptor<Message, Field> descriptor,
boolean strict) throws IOException {
PMessageBuilder<Message, Field> builder = descri... | [
"public",
"static",
"<",
"Message",
"extends",
"PMessage",
"<",
"Message",
",",
"Field",
">",
",",
"Field",
"extends",
"PField",
">",
"Message",
"readMessage",
"(",
"BigEndianBinaryReader",
"input",
",",
"PMessageDescriptor",
"<",
"Message",
",",
"Field",
">",
... | Read message from reader.
@param input The input reader.
@param descriptor The message descriptor.
@param strict If the message should be read in strict mode.
@param <Message> The message type.
@param <Field> The field type.
@return The read and parsed message.
@throws IOException If read failed. | [
"Read",
"message",
"from",
"reader",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-core/src/main/java/net/morimekta/providence/serializer/binary/BinaryFormatUtils.java#L111-L142 | train |
morimekta/providence | providence-core/src/main/java/net/morimekta/providence/serializer/binary/BinaryFormatUtils.java | BinaryFormatUtils.consumeMessage | public static void consumeMessage(BigEndianBinaryReader in) throws IOException {
FieldInfo fieldInfo;
while ((fieldInfo = readFieldInfo(in)) != null) {
readFieldValue(in, fieldInfo, null, false);
}
} | java | public static void consumeMessage(BigEndianBinaryReader in) throws IOException {
FieldInfo fieldInfo;
while ((fieldInfo = readFieldInfo(in)) != null) {
readFieldValue(in, fieldInfo, null, false);
}
} | [
"public",
"static",
"void",
"consumeMessage",
"(",
"BigEndianBinaryReader",
"in",
")",
"throws",
"IOException",
"{",
"FieldInfo",
"fieldInfo",
";",
"while",
"(",
"(",
"fieldInfo",
"=",
"readFieldInfo",
"(",
"in",
")",
")",
"!=",
"null",
")",
"{",
"readFieldVal... | Consume a message from the stream without parsing the content into a message.
@param in Stream to read message from.
@throws IOException On read failures. | [
"Consume",
"a",
"message",
"from",
"the",
"stream",
"without",
"parsing",
"the",
"content",
"into",
"a",
"message",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-core/src/main/java/net/morimekta/providence/serializer/binary/BinaryFormatUtils.java#L150-L155 | train |
morimekta/providence | providence-core/src/main/java/net/morimekta/providence/serializer/binary/BinaryFormatUtils.java | BinaryFormatUtils.writeMessage | public static <Message extends PMessage<Message, Field>, Field extends PField>
int writeMessage(BigEndianBinaryWriter writer, Message message)
throws IOException {
if (message instanceof BinaryWriter) {
return ((BinaryWriter) message).writeBinary(writer);
}
int len =... | java | public static <Message extends PMessage<Message, Field>, Field extends PField>
int writeMessage(BigEndianBinaryWriter writer, Message message)
throws IOException {
if (message instanceof BinaryWriter) {
return ((BinaryWriter) message).writeBinary(writer);
}
int len =... | [
"public",
"static",
"<",
"Message",
"extends",
"PMessage",
"<",
"Message",
",",
"Field",
">",
",",
"Field",
"extends",
"PField",
">",
"int",
"writeMessage",
"(",
"BigEndianBinaryWriter",
"writer",
",",
"Message",
"message",
")",
"throws",
"IOException",
"{",
"... | Write message to writer.
@param writer The binary writer.
@param message The message to write.
@param <Message> The message type.
@param <Field> The field type.
@return The number of bytes written.
@throws IOException If write failed. | [
"Write",
"message",
"to",
"writer",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-core/src/main/java/net/morimekta/providence/serializer/binary/BinaryFormatUtils.java#L340-L368 | train |
morimekta/providence | providence-core/src/main/java/net/morimekta/providence/serializer/BaseSerializerProvider.java | BaseSerializerProvider.register | protected void register(Serializer serializer, String... mediaTypes) {
for (String mediaType : mediaTypes) {
this.serializerMap.put(mediaType, serializer);
}
} | java | protected void register(Serializer serializer, String... mediaTypes) {
for (String mediaType : mediaTypes) {
this.serializerMap.put(mediaType, serializer);
}
} | [
"protected",
"void",
"register",
"(",
"Serializer",
"serializer",
",",
"String",
"...",
"mediaTypes",
")",
"{",
"for",
"(",
"String",
"mediaType",
":",
"mediaTypes",
")",
"{",
"this",
".",
"serializerMap",
".",
"put",
"(",
"mediaType",
",",
"serializer",
")"... | Register the serializer with a given set of media types.
@param serializer The serializer to register.
@param mediaTypes The media types to register it for. | [
"Register",
"the",
"serializer",
"with",
"a",
"given",
"set",
"of",
"media",
"types",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-core/src/main/java/net/morimekta/providence/serializer/BaseSerializerProvider.java#L80-L84 | train |
jboss/jboss-saaj-api_spec | src/main/java/javax/xml/soap/SOAPPart.java | SOAPPart.getContentLocation | public String getContentLocation() {
String[] values = getMimeHeader("Content-Location");
if (values != null && values.length > 0)
return values[0];
return null;
} | java | public String getContentLocation() {
String[] values = getMimeHeader("Content-Location");
if (values != null && values.length > 0)
return values[0];
return null;
} | [
"public",
"String",
"getContentLocation",
"(",
")",
"{",
"String",
"[",
"]",
"values",
"=",
"getMimeHeader",
"(",
"\"Content-Location\"",
")",
";",
"if",
"(",
"values",
"!=",
"null",
"&&",
"values",
".",
"length",
">",
"0",
")",
"return",
"values",
"[",
... | Retrieves the value of the MIME header whose name is "Content-Location".
@return a <code>String</code> giving the value of the MIME header whose
name is "Content-Location"
@see #setContentLocation | [
"Retrieves",
"the",
"value",
"of",
"the",
"MIME",
"header",
"whose",
"name",
"is",
"Content",
"-",
"Location",
"."
] | 2dda4e662e4f99b289f3a8d944a68cf537c78dd4 | https://github.com/jboss/jboss-saaj-api_spec/blob/2dda4e662e4f99b289f3a8d944a68cf537c78dd4/src/main/java/javax/xml/soap/SOAPPart.java#L104-L109 | train |
morimekta/providence | providence-core/src/main/java/net/morimekta/providence/serializer/pretty/Tokenizer.java | Tokenizer.readBinary | public String readBinary(char end) throws IOException {
int startOffset = bufferOffset;
int startLinePos = linePos;
CharArrayWriter baos = new CharArrayWriter();
while (readNextChar()) {
if (lastChar == end) {
lastChar = 0;
return baos.toString... | java | public String readBinary(char end) throws IOException {
int startOffset = bufferOffset;
int startLinePos = linePos;
CharArrayWriter baos = new CharArrayWriter();
while (readNextChar()) {
if (lastChar == end) {
lastChar = 0;
return baos.toString... | [
"public",
"String",
"readBinary",
"(",
"char",
"end",
")",
"throws",
"IOException",
"{",
"int",
"startOffset",
"=",
"bufferOffset",
";",
"int",
"startLinePos",
"=",
"linePos",
";",
"CharArrayWriter",
"baos",
"=",
"new",
"CharArrayWriter",
"(",
")",
";",
"while... | Read the 'content' of encoded binary. This does not parse the
binary, just read out from the buffer the string representing the
binary data, as delimited by the requested 'end' char.
@param end The char that ends the binary content.
@return The string encoded string representation.
@throws TokenizerException On illega... | [
"Read",
"the",
"content",
"of",
"encoded",
"binary",
".",
"This",
"does",
"not",
"parse",
"the",
"binary",
"just",
"read",
"out",
"from",
"the",
"buffer",
"the",
"string",
"representing",
"the",
"binary",
"data",
"as",
"delimited",
"by",
"the",
"requested",
... | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-core/src/main/java/net/morimekta/providence/serializer/pretty/Tokenizer.java#L217-L231 | train |
isisaddons-legacy/isis-module-security | dom/src/main/java/org/isisaddons/module/security/app/feature/ApplicationFeatureViewModel.java | ApplicationFeatureViewModel.newViewModel | public static ApplicationFeatureViewModel newViewModel(
final ApplicationFeatureId featureId,
final ApplicationFeatureRepositoryDefault applicationFeatureRepository,
final DomainObjectContainer container) {
final Class<? extends ApplicationFeatureViewModel> cls = viewModelCla... | java | public static ApplicationFeatureViewModel newViewModel(
final ApplicationFeatureId featureId,
final ApplicationFeatureRepositoryDefault applicationFeatureRepository,
final DomainObjectContainer container) {
final Class<? extends ApplicationFeatureViewModel> cls = viewModelCla... | [
"public",
"static",
"ApplicationFeatureViewModel",
"newViewModel",
"(",
"final",
"ApplicationFeatureId",
"featureId",
",",
"final",
"ApplicationFeatureRepositoryDefault",
"applicationFeatureRepository",
",",
"final",
"DomainObjectContainer",
"container",
")",
"{",
"final",
"Cla... | region > constructors | [
"region",
">",
"constructors"
] | a9deb1b003ba01e44c859085bd078be8df0c1863 | https://github.com/isisaddons-legacy/isis-module-security/blob/a9deb1b003ba01e44c859085bd078be8df0c1863/dom/src/main/java/org/isisaddons/module/security/app/feature/ApplicationFeatureViewModel.java#L66-L76 | train |
isisaddons-legacy/isis-module-security | dom/src/main/java/org/isisaddons/module/security/app/feature/ApplicationFeatureViewModel.java | ApplicationFeatureViewModel.getMemberName | @Property(
domainEvent = MemberNameDomainEvent.class
)
@PropertyLayout(typicalLength=ApplicationFeature.TYPICAL_LENGTH_MEMBER_NAME)
@MemberOrder(name="Id", sequence = "2.4")
public String getMemberName() {
return getFeatureId().getMemberName();
} | java | @Property(
domainEvent = MemberNameDomainEvent.class
)
@PropertyLayout(typicalLength=ApplicationFeature.TYPICAL_LENGTH_MEMBER_NAME)
@MemberOrder(name="Id", sequence = "2.4")
public String getMemberName() {
return getFeatureId().getMemberName();
} | [
"@",
"Property",
"(",
"domainEvent",
"=",
"MemberNameDomainEvent",
".",
"class",
")",
"@",
"PropertyLayout",
"(",
"typicalLength",
"=",
"ApplicationFeature",
".",
"TYPICAL_LENGTH_MEMBER_NAME",
")",
"@",
"MemberOrder",
"(",
"name",
"=",
"\"Id\"",
",",
"sequence",
"... | For packages and class names, will be null. | [
"For",
"packages",
"and",
"class",
"names",
"will",
"be",
"null",
"."
] | a9deb1b003ba01e44c859085bd078be8df0c1863 | https://github.com/isisaddons-legacy/isis-module-security/blob/a9deb1b003ba01e44c859085bd078be8df0c1863/dom/src/main/java/org/isisaddons/module/security/app/feature/ApplicationFeatureViewModel.java#L228-L235 | train |
isisaddons-legacy/isis-module-security | dom/src/main/java/org/isisaddons/module/security/app/feature/ApplicationFeatureViewModel.java | ApplicationFeatureViewModel.getParentPackage | @Programmatic
public ApplicationFeatureViewModel getParentPackage() {
return Functions.asViewModelForId(applicationFeatureRepository, container).apply(getFeatureId().getParentPackageId());
} | java | @Programmatic
public ApplicationFeatureViewModel getParentPackage() {
return Functions.asViewModelForId(applicationFeatureRepository, container).apply(getFeatureId().getParentPackageId());
} | [
"@",
"Programmatic",
"public",
"ApplicationFeatureViewModel",
"getParentPackage",
"(",
")",
"{",
"return",
"Functions",
".",
"asViewModelForId",
"(",
"applicationFeatureRepository",
",",
"container",
")",
".",
"apply",
"(",
"getFeatureId",
"(",
")",
".",
"getParentPac... | The parent package feature of this class or package. | [
"The",
"parent",
"package",
"feature",
"of",
"this",
"class",
"or",
"package",
"."
] | a9deb1b003ba01e44c859085bd078be8df0c1863 | https://github.com/isisaddons-legacy/isis-module-security/blob/a9deb1b003ba01e44c859085bd078be8df0c1863/dom/src/main/java/org/isisaddons/module/security/app/feature/ApplicationFeatureViewModel.java#L319-L322 | train |
isisaddons-legacy/isis-module-security | dom/src/main/java/org/isisaddons/module/security/dom/user/ApplicationUserRepository.java | ApplicationUserRepository.findByUsernameCached | @Programmatic
public ApplicationUser findByUsernameCached(final String username) {
return queryResultsCache.execute(new Callable<ApplicationUser>() {
@Override public ApplicationUser call() throws Exception {
return findByUsername(username);
}
}, ApplicationUs... | java | @Programmatic
public ApplicationUser findByUsernameCached(final String username) {
return queryResultsCache.execute(new Callable<ApplicationUser>() {
@Override public ApplicationUser call() throws Exception {
return findByUsername(username);
}
}, ApplicationUs... | [
"@",
"Programmatic",
"public",
"ApplicationUser",
"findByUsernameCached",
"(",
"final",
"String",
"username",
")",
"{",
"return",
"queryResultsCache",
".",
"execute",
"(",
"new",
"Callable",
"<",
"ApplicationUser",
">",
"(",
")",
"{",
"@",
"Override",
"public",
... | region > findByUsername | [
"region",
">",
"findByUsername"
] | a9deb1b003ba01e44c859085bd078be8df0c1863 | https://github.com/isisaddons-legacy/isis-module-security/blob/a9deb1b003ba01e44c859085bd078be8df0c1863/dom/src/main/java/org/isisaddons/module/security/dom/user/ApplicationUserRepository.java#L77-L84 | train |
isisaddons-legacy/isis-module-security | dom/src/main/java/org/isisaddons/module/security/dom/user/ApplicationUserRepository.java | ApplicationUserRepository.findByAtPath | @Programmatic
public List<ApplicationUser> findByAtPath(final String atPath) {
return container.allMatches(new QueryDefault<>(
ApplicationUser.class,
"findByAtPath", "atPath", atPath));
} | java | @Programmatic
public List<ApplicationUser> findByAtPath(final String atPath) {
return container.allMatches(new QueryDefault<>(
ApplicationUser.class,
"findByAtPath", "atPath", atPath));
} | [
"@",
"Programmatic",
"public",
"List",
"<",
"ApplicationUser",
">",
"findByAtPath",
"(",
"final",
"String",
"atPath",
")",
"{",
"return",
"container",
".",
"allMatches",
"(",
"new",
"QueryDefault",
"<>",
"(",
"ApplicationUser",
".",
"class",
",",
"\"findByAtPath... | region > allUsers | [
"region",
">",
"allUsers"
] | a9deb1b003ba01e44c859085bd078be8df0c1863 | https://github.com/isisaddons-legacy/isis-module-security/blob/a9deb1b003ba01e44c859085bd078be8df0c1863/dom/src/main/java/org/isisaddons/module/security/dom/user/ApplicationUserRepository.java#L208-L213 | train |
morimekta/providence | providence-config/src/main/java/net/morimekta/providence/config/impl/ProvidenceConfigParser.java | ProvidenceConfigParser.resolve | @SuppressWarnings("unchecked")
private static <V> V resolve(ProvidenceConfigContext context,
Token token,
Tokenizer tokenizer,
PDescriptor descriptor) throws TokenizerException {
Object value = resolveAny(cont... | java | @SuppressWarnings("unchecked")
private static <V> V resolve(ProvidenceConfigContext context,
Token token,
Tokenizer tokenizer,
PDescriptor descriptor) throws TokenizerException {
Object value = resolveAny(cont... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"static",
"<",
"V",
">",
"V",
"resolve",
"(",
"ProvidenceConfigContext",
"context",
",",
"Token",
"token",
",",
"Tokenizer",
"tokenizer",
",",
"PDescriptor",
"descriptor",
")",
"throws",
"TokenizerExce... | Resolve a value reference.
@param context The parsing context.
@param token The ID token to look for.
@param tokenizer The tokenizer.
@param descriptor The item descriptor.
@return The value at the given key, or exception if not found. | [
"Resolve",
"a",
"value",
"reference",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-config/src/main/java/net/morimekta/providence/config/impl/ProvidenceConfigParser.java#L866-L876 | train |
pawelprazak/java-extended | guava/src/main/java/com/bluecatcode/common/io/Resources.java | Resources.getContextClassLoader | public static ClassLoader getContextClassLoader(Class<?> contextClass) {
return Objects.firstNonNull(
Thread.currentThread().getContextClassLoader(),
contextClass.getClassLoader()
);
} | java | public static ClassLoader getContextClassLoader(Class<?> contextClass) {
return Objects.firstNonNull(
Thread.currentThread().getContextClassLoader(),
contextClass.getClassLoader()
);
} | [
"public",
"static",
"ClassLoader",
"getContextClassLoader",
"(",
"Class",
"<",
"?",
">",
"contextClass",
")",
"{",
"return",
"Objects",
".",
"firstNonNull",
"(",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getContextClassLoader",
"(",
")",
",",
"contextClass... | Returns current thread context class loader or context class's class loader
@param contextClass context class to use
@return the context class loader | [
"Returns",
"current",
"thread",
"context",
"class",
"loader",
"or",
"context",
"class",
"s",
"class",
"loader"
] | ce1a556a95cbbf7c950a03662938bc02622de69b | https://github.com/pawelprazak/java-extended/blob/ce1a556a95cbbf7c950a03662938bc02622de69b/guava/src/main/java/com/bluecatcode/common/io/Resources.java#L203-L208 | train |
seedstack/w20-bridge-addon | rest/src/main/java/org/seedstack/w20/internal/PathUtils.java | PathUtils.buildPath | public static String buildPath(String first, String... parts) {
StringBuilder result = new StringBuilder(first);
for (String part : parts) {
if (result.length() == 0) {
if (part.startsWith("/")) {
result.append(part.substring(1));
} else {... | java | public static String buildPath(String first, String... parts) {
StringBuilder result = new StringBuilder(first);
for (String part : parts) {
if (result.length() == 0) {
if (part.startsWith("/")) {
result.append(part.substring(1));
} else {... | [
"public",
"static",
"String",
"buildPath",
"(",
"String",
"first",
",",
"String",
"...",
"parts",
")",
"{",
"StringBuilder",
"result",
"=",
"new",
"StringBuilder",
"(",
"first",
")",
";",
"for",
"(",
"String",
"part",
":",
"parts",
")",
"{",
"if",
"(",
... | Concatenate path parts into a full path, taking care of extra or missing slashes.
@param first the first part.
@param parts the additional parts.
@return the concatenated path. | [
"Concatenate",
"path",
"parts",
"into",
"a",
"full",
"path",
"taking",
"care",
"of",
"extra",
"or",
"missing",
"slashes",
"."
] | 94c997a9392f10a1bf1655e7f25bf2f6f328ce20 | https://github.com/seedstack/w20-bridge-addon/blob/94c997a9392f10a1bf1655e7f25bf2f6f328ce20/rest/src/main/java/org/seedstack/w20/internal/PathUtils.java#L71-L93 | train |
peter-lawrey/SAXophone | saxophone/src/main/java/net/openhft/saxophone/json/Lexer.java | Lexer.lexUtf8Char | private TokenType lexUtf8Char(Bytes jsonText, int curChar) {
if (curChar <= 0x7f) {
/* single byte */
return STRING;
} else if ((curChar >> 5) == 0x6) {
/* two byte */
if (jsonText.readRemaining() == 0) return EOF;
curChar = readChar(jsonText)... | java | private TokenType lexUtf8Char(Bytes jsonText, int curChar) {
if (curChar <= 0x7f) {
/* single byte */
return STRING;
} else if ((curChar >> 5) == 0x6) {
/* two byte */
if (jsonText.readRemaining() == 0) return EOF;
curChar = readChar(jsonText)... | [
"private",
"TokenType",
"lexUtf8Char",
"(",
"Bytes",
"jsonText",
",",
"int",
"curChar",
")",
"{",
"if",
"(",
"curChar",
"<=",
"0x7f",
")",
"{",
"/* single byte */",
"return",
"STRING",
";",
"}",
"else",
"if",
"(",
"(",
"curChar",
">>",
"5",
")",
"==",
... | process a variable length utf8 encoded codepoint.
@return
STRING - if valid utf8 char was parsed and offset was advanced
EOF - if end of input was hit before validation could complete
ERROR - if invalid utf8 was encountered
NOTE: on error the offset will point to the first char of the
invalid utf8 | [
"process",
"a",
"variable",
"length",
"utf8",
"encoded",
"codepoint",
"."
] | b122a09daece921fda811acabd18fcd9c84afe14 | https://github.com/peter-lawrey/SAXophone/blob/b122a09daece921fda811acabd18fcd9c84afe14/saxophone/src/main/java/net/openhft/saxophone/json/Lexer.java#L163-L198 | train |
peter-lawrey/SAXophone | saxophone/src/main/java/net/openhft/saxophone/json/Lexer.java | Lexer.lexString | private TokenType lexString(Bytes jsonText) {
TokenType tok = ERROR;
boolean hasEscapes = false;
finish_string_lex:
for (;;) {
int curChar;
/* now jump into a faster scanning routine to skip as much
* of the buffers as possible */
{
... | java | private TokenType lexString(Bytes jsonText) {
TokenType tok = ERROR;
boolean hasEscapes = false;
finish_string_lex:
for (;;) {
int curChar;
/* now jump into a faster scanning routine to skip as much
* of the buffers as possible */
{
... | [
"private",
"TokenType",
"lexString",
"(",
"Bytes",
"jsonText",
")",
"{",
"TokenType",
"tok",
"=",
"ERROR",
";",
"boolean",
"hasEscapes",
"=",
"false",
";",
"finish_string_lex",
":",
"for",
"(",
";",
";",
")",
"{",
"int",
"curChar",
";",
"/* now jump into a f... | Lex a string.
@return
STRING - lex of string was successful. offset points to terminating '"'.
EOF - end of text was encountered before we could complete the lex.
ERROR - embedded in the string were unallowable chars. offset
points to the offending char | [
"Lex",
"a",
"string",
"."
] | b122a09daece921fda811acabd18fcd9c84afe14 | https://github.com/peter-lawrey/SAXophone/blob/b122a09daece921fda811acabd18fcd9c84afe14/saxophone/src/main/java/net/openhft/saxophone/json/Lexer.java#L225-L316 | train |
pawelprazak/java-extended | guava/src/main/java/com/bluecatcode/common/predicates/Predicates.java | Predicates.nor | @Beta
public static <T> Predicate<T> nor(Predicate<? super T> first, Predicate<? super T> second) {
return com.google.common.base.Predicates.not(com.google.common.base.Predicates.or(first, second));
} | java | @Beta
public static <T> Predicate<T> nor(Predicate<? super T> first, Predicate<? super T> second) {
return com.google.common.base.Predicates.not(com.google.common.base.Predicates.or(first, second));
} | [
"@",
"Beta",
"public",
"static",
"<",
"T",
">",
"Predicate",
"<",
"T",
">",
"nor",
"(",
"Predicate",
"<",
"?",
"super",
"T",
">",
"first",
",",
"Predicate",
"<",
"?",
"super",
"T",
">",
"second",
")",
"{",
"return",
"com",
".",
"google",
".",
"co... | NOT OR Predicate
Truth table:
<pre>
B A Q
-------
0 0 1
0 1 0
1 0 0
1 1 0
</pre>
@param first the first argument
@param second the second argument
@return the predicate | [
"NOT",
"OR",
"Predicate"
] | ce1a556a95cbbf7c950a03662938bc02622de69b | https://github.com/pawelprazak/java-extended/blob/ce1a556a95cbbf7c950a03662938bc02622de69b/guava/src/main/java/com/bluecatcode/common/predicates/Predicates.java#L178-L181 | train |
peter-lawrey/SAXophone | saxophone/src/main/java/net/openhft/saxophone/json/JsonParserBuilder.java | JsonParserBuilder.options | public JsonParserBuilder options(JsonParserOption first, JsonParserOption... rest) {
this.options = EnumSet.of(first, rest);
return this;
} | java | public JsonParserBuilder options(JsonParserOption first, JsonParserOption... rest) {
this.options = EnumSet.of(first, rest);
return this;
} | [
"public",
"JsonParserBuilder",
"options",
"(",
"JsonParserOption",
"first",
",",
"JsonParserOption",
"...",
"rest",
")",
"{",
"this",
".",
"options",
"=",
"EnumSet",
".",
"of",
"(",
"first",
",",
"rest",
")",
";",
"return",
"this",
";",
"}"
] | Sets the parser options. The previous options, if any, are discarded.
@param first parser option
@param rest the rest parser options
@return a reference to this builder | [
"Sets",
"the",
"parser",
"options",
".",
"The",
"previous",
"options",
"if",
"any",
"are",
"discarded",
"."
] | b122a09daece921fda811acabd18fcd9c84afe14 | https://github.com/peter-lawrey/SAXophone/blob/b122a09daece921fda811acabd18fcd9c84afe14/saxophone/src/main/java/net/openhft/saxophone/json/JsonParserBuilder.java#L267-L270 | train |
peter-lawrey/SAXophone | saxophone/src/main/java/net/openhft/saxophone/json/JsonParserBuilder.java | JsonParserBuilder.applyAdapter | public JsonParserBuilder applyAdapter(JsonHandlerBase a) {
boolean applied = false;
if (a instanceof ObjectStartHandler) {
objectStartHandler((ObjectStartHandler) a);
applied = true;
}
if (a instanceof ObjectEndHandler) {
objectEndHandler((ObjectEndHan... | java | public JsonParserBuilder applyAdapter(JsonHandlerBase a) {
boolean applied = false;
if (a instanceof ObjectStartHandler) {
objectStartHandler((ObjectStartHandler) a);
applied = true;
}
if (a instanceof ObjectEndHandler) {
objectEndHandler((ObjectEndHan... | [
"public",
"JsonParserBuilder",
"applyAdapter",
"(",
"JsonHandlerBase",
"a",
")",
"{",
"boolean",
"applied",
"=",
"false",
";",
"if",
"(",
"a",
"instanceof",
"ObjectStartHandler",
")",
"{",
"objectStartHandler",
"(",
"(",
"ObjectStartHandler",
")",
"a",
")",
";",... | Convenient method to apply the adapter which implements several handler interfaces in one call.
<p>Is equivalent to <pre>{@code
if (a instanceof ObjectStartHandler)
objectStartHandler((ObjectStartHandler) a);
if (a instanceof ObjectEndHandler)
objectEndHandler((ObjectEndHandler) a);
// ... the same job for the rest ha... | [
"Convenient",
"method",
"to",
"apply",
"the",
"adapter",
"which",
"implements",
"several",
"handler",
"interfaces",
"in",
"one",
"call",
"."
] | b122a09daece921fda811acabd18fcd9c84afe14 | https://github.com/peter-lawrey/SAXophone/blob/b122a09daece921fda811acabd18fcd9c84afe14/saxophone/src/main/java/net/openhft/saxophone/json/JsonParserBuilder.java#L343-L396 | train |
morimekta/providence | providence-generator-java/src/main/java/net/morimekta/providence/generator/format/java/utils/JUtils.java | JUtils.camelCase | public static String camelCase(String prefix, String name) {
return Strings.camelCase(prefix, name);
} | java | public static String camelCase(String prefix, String name) {
return Strings.camelCase(prefix, name);
} | [
"public",
"static",
"String",
"camelCase",
"(",
"String",
"prefix",
",",
"String",
"name",
")",
"{",
"return",
"Strings",
".",
"camelCase",
"(",
"prefix",
",",
"name",
")",
";",
"}"
] | Format a prefixed name as camelCase. The prefix is kept verbatim, while
tha name is split on '_' chars, and joined with each part capitalized.
@param prefix Name prefix, not modified.
@param name The name to camel-case.
@return theCamelCasedName | [
"Format",
"a",
"prefixed",
"name",
"as",
"camelCase",
".",
"The",
"prefix",
"is",
"kept",
"verbatim",
"while",
"tha",
"name",
"is",
"split",
"on",
"_",
"chars",
"and",
"joined",
"with",
"each",
"part",
"capitalized",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-generator-java/src/main/java/net/morimekta/providence/generator/format/java/utils/JUtils.java#L128-L130 | train |
morimekta/providence | providence-generator-java/src/main/java/net/morimekta/providence/generator/format/java/utils/JUtils.java | JUtils.macroCase | public static String macroCase(String name) {
return Strings.c_case(name).toUpperCase(Locale.US);
} | java | public static String macroCase(String name) {
return Strings.c_case(name).toUpperCase(Locale.US);
} | [
"public",
"static",
"String",
"macroCase",
"(",
"String",
"name",
")",
"{",
"return",
"Strings",
".",
"c_case",
"(",
"name",
")",
".",
"toUpperCase",
"(",
"Locale",
".",
"US",
")",
";",
"}"
] | Format a prefixed name as MACRO_CASE.
@param name The name to macro-case.
@return THE_MACRO_CASED_NAME | [
"Format",
"a",
"prefixed",
"name",
"as",
"MACRO_CASE",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-generator-java/src/main/java/net/morimekta/providence/generator/format/java/utils/JUtils.java#L138-L140 | train |
pawelprazak/java-extended | guava/src/main/java/com/bluecatcode/common/contract/Postconditions.java | Postconditions.ensure | public static void ensure(boolean condition, String message, Object... args) {
if (!condition) {
throw new EnsureViolation(format(message, args));
}
} | java | public static void ensure(boolean condition, String message, Object... args) {
if (!condition) {
throw new EnsureViolation(format(message, args));
}
} | [
"public",
"static",
"void",
"ensure",
"(",
"boolean",
"condition",
",",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"!",
"condition",
")",
"{",
"throw",
"new",
"EnsureViolation",
"(",
"format",
"(",
"message",
",",
"args",
")"... | Postcondition that supplier are supposed to ensure.
Violations are considered to be a programming error, on the suppliers part.
@param condition the assertion condition
@param message the fail message template
@param args the message template arguments
@throws EnsureViolation if the <tt>condition</tt> is <b>fal... | [
"Postcondition",
"that",
"supplier",
"are",
"supposed",
"to",
"ensure",
".",
"Violations",
"are",
"considered",
"to",
"be",
"a",
"programming",
"error",
"on",
"the",
"suppliers",
"part",
"."
] | ce1a556a95cbbf7c950a03662938bc02622de69b | https://github.com/pawelprazak/java-extended/blob/ce1a556a95cbbf7c950a03662938bc02622de69b/guava/src/main/java/com/bluecatcode/common/contract/Postconditions.java#L61-L65 | train |
peter-lawrey/SAXophone | saxophone/src/main/java/net/openhft/saxophone/json/JsonParser.java | JsonParser.reset | public void reset() {
lexer.reset();
stateStack.clear();
stateStack.push(START);
parseError = null;
if (resetHook != null)
resetHook.onReset();
} | java | public void reset() {
lexer.reset();
stateStack.clear();
stateStack.push(START);
parseError = null;
if (resetHook != null)
resetHook.onReset();
} | [
"public",
"void",
"reset",
"(",
")",
"{",
"lexer",
".",
"reset",
"(",
")",
";",
"stateStack",
".",
"clear",
"(",
")",
";",
"stateStack",
".",
"push",
"(",
"START",
")",
";",
"parseError",
"=",
"null",
";",
"if",
"(",
"resetHook",
"!=",
"null",
")",... | Resets the parser to clear "just like after construction" state.
<p>At the end {@link net.openhft.saxophone.json.handler.ResetHook}, if provided,
is notified.
<p>Reusing parsers is encouraged because parser allocation / garbage collection
is pretty costly. | [
"Resets",
"the",
"parser",
"to",
"clear",
"just",
"like",
"after",
"construction",
"state",
"."
] | b122a09daece921fda811acabd18fcd9c84afe14 | https://github.com/peter-lawrey/SAXophone/blob/b122a09daece921fda811acabd18fcd9c84afe14/saxophone/src/main/java/net/openhft/saxophone/json/JsonParser.java#L199-L206 | train |
peter-lawrey/SAXophone | saxophone/src/main/java/net/openhft/saxophone/json/JsonParser.java | JsonParser.finish | public boolean finish() {
if (!parse(finishSpace())) return false;
switch(stateStack.current()) {
case PARSE_ERROR:
case LEXICAL_ERROR:
case HANDLER_CANCEL:
case HANDLER_EXCEPTION:
throw new AssertionError("exception should be thrown direc... | java | public boolean finish() {
if (!parse(finishSpace())) return false;
switch(stateStack.current()) {
case PARSE_ERROR:
case LEXICAL_ERROR:
case HANDLER_CANCEL:
case HANDLER_EXCEPTION:
throw new AssertionError("exception should be thrown direc... | [
"public",
"boolean",
"finish",
"(",
")",
"{",
"if",
"(",
"!",
"parse",
"(",
"finishSpace",
"(",
")",
")",
")",
"return",
"false",
";",
"switch",
"(",
"stateStack",
".",
"current",
"(",
")",
")",
"{",
"case",
"PARSE_ERROR",
":",
"case",
"LEXICAL_ERROR",... | Processes the last token.
<p>If the JSON data portions given to {@link #parse(Bytes)} method
by now since the previous {@link #reset()} call, or call of this method,
or parser construction don't comprise one or several complete JSON entities, and
{@link net.openhft.saxophone.json.JsonParserOption#ALLOW_PARTIAL_VALUES}... | [
"Processes",
"the",
"last",
"token",
"."
] | b122a09daece921fda811acabd18fcd9c84afe14 | https://github.com/peter-lawrey/SAXophone/blob/b122a09daece921fda811acabd18fcd9c84afe14/saxophone/src/main/java/net/openhft/saxophone/json/JsonParser.java#L264-L279 | train |
morimekta/providence | providence-core/src/main/java/net/morimekta/providence/serializer/binary/BinaryType.java | BinaryType.asString | public static String asString(byte id) {
switch (id) {
case STOP:
return "stop(0)";
case VOID:
return "void(1)";
case BOOL:
return "bool(2)";
case BYTE:
return "byte(3)";
case DOUBLE:
... | java | public static String asString(byte id) {
switch (id) {
case STOP:
return "stop(0)";
case VOID:
return "void(1)";
case BOOL:
return "bool(2)";
case BYTE:
return "byte(3)";
case DOUBLE:
... | [
"public",
"static",
"String",
"asString",
"(",
"byte",
"id",
")",
"{",
"switch",
"(",
"id",
")",
"{",
"case",
"STOP",
":",
"return",
"\"stop(0)\"",
";",
"case",
"VOID",
":",
"return",
"\"void(1)\"",
";",
"case",
"BOOL",
":",
"return",
"\"bool(2)\"",
";",... | Readable string value for a type ID.
@param id The type ID.
@return The type string. | [
"Readable",
"string",
"value",
"for",
"a",
"type",
"ID",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-core/src/main/java/net/morimekta/providence/serializer/binary/BinaryType.java#L81-L117 | train |
socialsensor/socialmedia-abstractions | src/main/java/eu/socialsensor/framework/retrievers/socialmedia/DailyMotionRetriever.java | DailyMotionRetriever.getMediaItem | public MediaItem getMediaItem(String id) {
DailyMotionUrl url = new DailyMotionUrl(requestPrefix + id);
HttpRequest request;
try {
request = requestFactory.buildGetRequest(url);
DailyMotionVideo video = request.execute().parseAs(DailyMotionVideo.class);
if(video != null) {
MediaItem mediaIt... | java | public MediaItem getMediaItem(String id) {
DailyMotionUrl url = new DailyMotionUrl(requestPrefix + id);
HttpRequest request;
try {
request = requestFactory.buildGetRequest(url);
DailyMotionVideo video = request.execute().parseAs(DailyMotionVideo.class);
if(video != null) {
MediaItem mediaIt... | [
"public",
"MediaItem",
"getMediaItem",
"(",
"String",
"id",
")",
"{",
"DailyMotionUrl",
"url",
"=",
"new",
"DailyMotionUrl",
"(",
"requestPrefix",
"+",
"id",
")",
";",
"HttpRequest",
"request",
";",
"try",
"{",
"request",
"=",
"requestFactory",
".",
"buildGetR... | Returns the retrieved media item | [
"Returns",
"the",
"retrieved",
"media",
"item"
] | 01e7f4927cc43ec3415f3f31713eb811e011c364 | https://github.com/socialsensor/socialmedia-abstractions/blob/01e7f4927cc43ec3415f3f31713eb811e011c364/src/main/java/eu/socialsensor/framework/retrievers/socialmedia/DailyMotionRetriever.java#L69-L88 | train |
lisicnu/Log4Android | src/main/java/com/github/lisicnu/log4android/format/command/DateFormatCommand.java | DateFormatCommand.toAbsoluteFormat | String toAbsoluteFormat(long time){
calendar.setTime(new Date(time));
long hours = calendar.get(Calendar.HOUR_OF_DAY);
StringBuffer buffer = new StringBuffer();
if (hours < 10) {
buffer.append('0');
}
buffer.append(hours);
buffer.append(':');
long minutes = calendar.get(Calendar.MINUTE);
if (mi... | java | String toAbsoluteFormat(long time){
calendar.setTime(new Date(time));
long hours = calendar.get(Calendar.HOUR_OF_DAY);
StringBuffer buffer = new StringBuffer();
if (hours < 10) {
buffer.append('0');
}
buffer.append(hours);
buffer.append(':');
long minutes = calendar.get(Calendar.MINUTE);
if (mi... | [
"String",
"toAbsoluteFormat",
"(",
"long",
"time",
")",
"{",
"calendar",
".",
"setTime",
"(",
"new",
"Date",
"(",
"time",
")",
")",
";",
"long",
"hours",
"=",
"calendar",
".",
"get",
"(",
"Calendar",
".",
"HOUR_OF_DAY",
")",
";",
"StringBuffer",
"buffer"... | Format as an absolute date time format, that is
@param time
the time to format.
@return the formatted <code>String</code>. | [
"Format",
"as",
"an",
"absolute",
"date",
"time",
"format",
"that",
"is"
] | 229632528e63a424460a219decdaffcf75a9f4a4 | https://github.com/lisicnu/Log4Android/blob/229632528e63a424460a219decdaffcf75a9f4a4/src/main/java/com/github/lisicnu/log4android/format/command/DateFormatCommand.java#L109-L146 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.