id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
109,200 | vvakame/JsonPullParser | jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/util/JsonParseUtil.java | JsonParseUtil.parserEnumList | public static <T extends Enum<T>>List<T> parserEnumList(JsonPullParser parser, Class<T> clazz)
throws IOException, JsonFormatException {
State eventType = parser.getEventType();
if (eventType == State.VALUE_NULL) {
return null;
}
if (eventType != State.START_ARRAY) {
throw new IllegalStateException("n... | java | public static <T extends Enum<T>>List<T> parserEnumList(JsonPullParser parser, Class<T> clazz)
throws IOException, JsonFormatException {
State eventType = parser.getEventType();
if (eventType == State.VALUE_NULL) {
return null;
}
if (eventType != State.START_ARRAY) {
throw new IllegalStateException("n... | [
"public",
"static",
"<",
"T",
"extends",
"Enum",
"<",
"T",
">",
">",
"List",
"<",
"T",
">",
"parserEnumList",
"(",
"JsonPullParser",
"parser",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"throws",
"IOException",
",",
"JsonFormatException",
"{",
"State",
"... | Parses the current token as a list of Enums.
@param <T>
@param parser
@param clazz
@return List of {@link Enum}s
@throws IOException
@throws JsonFormatException
@author vvakame | [
"Parses",
"the",
"current",
"token",
"as",
"a",
"list",
"of",
"Enums",
"."
] | fce183ca66354723323a77f2ae8cb5222b5836bc | https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/util/JsonParseUtil.java#L568-L593 |
109,201 | vvakame/JsonPullParser | jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/builder/JsonModelBuilder.java | JsonModelBuilder.rm | public JsonModelBuilder<T> rm(String... names) {
for (String name : names) {
rmSub(name);
}
return this;
} | java | public JsonModelBuilder<T> rm(String... names) {
for (String name : names) {
rmSub(name);
}
return this;
} | [
"public",
"JsonModelBuilder",
"<",
"T",
">",
"rm",
"(",
"String",
"...",
"names",
")",
"{",
"for",
"(",
"String",
"name",
":",
"names",
")",
"{",
"rmSub",
"(",
"name",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Detaches property builder for the given names.
@param names
@return this
@author vvakame | [
"Detaches",
"property",
"builder",
"for",
"the",
"given",
"names",
"."
] | fce183ca66354723323a77f2ae8cb5222b5836bc | https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/builder/JsonModelBuilder.java#L529-L534 |
109,202 | vvakame/JsonPullParser | jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/util/JsonArray.java | JsonArray.fromParser | public static JsonArray fromParser(JsonPullParser parser) throws IOException,
JsonFormatException {
State state = parser.getEventType();
if (state == State.VALUE_NULL) {
return null;
} else if (state != State.START_ARRAY) {
throw new JsonFormatException("unexpected token. token=" + state, parser);
}
... | java | public static JsonArray fromParser(JsonPullParser parser) throws IOException,
JsonFormatException {
State state = parser.getEventType();
if (state == State.VALUE_NULL) {
return null;
} else if (state != State.START_ARRAY) {
throw new JsonFormatException("unexpected token. token=" + state, parser);
}
... | [
"public",
"static",
"JsonArray",
"fromParser",
"(",
"JsonPullParser",
"parser",
")",
"throws",
"IOException",
",",
"JsonFormatException",
"{",
"State",
"state",
"=",
"parser",
".",
"getEventType",
"(",
")",
";",
"if",
"(",
"state",
"==",
"State",
".",
"VALUE_N... | Parses the given JSON data as an array.
@param parser {@link JsonPullParser} with some JSON-formatted data
@return {@link JsonArray}
@throws IOException
@throws JsonFormatException
@author vvakame | [
"Parses",
"the",
"given",
"JSON",
"data",
"as",
"an",
"array",
"."
] | fce183ca66354723323a77f2ae8cb5222b5836bc | https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/util/JsonArray.java#L63-L80 |
109,203 | vvakame/JsonPullParser | jsonpullparser-apt/src/main/java/net/vvakame/util/jsonpullparser/factory/Log.java | Log.e | public static void e(String msg, Element element) {
messager.printMessage(Diagnostic.Kind.ERROR, msg, element);
} | java | public static void e(String msg, Element element) {
messager.printMessage(Diagnostic.Kind.ERROR, msg, element);
} | [
"public",
"static",
"void",
"e",
"(",
"String",
"msg",
",",
"Element",
"element",
")",
"{",
"messager",
".",
"printMessage",
"(",
"Diagnostic",
".",
"Kind",
".",
"ERROR",
",",
"msg",
",",
"element",
")",
";",
"}"
] | Logs error message about the given element.
@param msg Message
@param element Offending element
@author vvakame | [
"Logs",
"error",
"message",
"about",
"the",
"given",
"element",
"."
] | fce183ca66354723323a77f2ae8cb5222b5836bc | https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-apt/src/main/java/net/vvakame/util/jsonpullparser/factory/Log.java#L114-L116 |
109,204 | vvakame/JsonPullParser | jsonpullparser-apt/src/main/java/net/vvakame/util/jsonpullparser/factory/Log.java | Log.e | public static void e(Throwable e) {
messager.printMessage(Diagnostic.Kind.ERROR, "exception thrown! " + e.getMessage());
} | java | public static void e(Throwable e) {
messager.printMessage(Diagnostic.Kind.ERROR, "exception thrown! " + e.getMessage());
} | [
"public",
"static",
"void",
"e",
"(",
"Throwable",
"e",
")",
"{",
"messager",
".",
"printMessage",
"(",
"Diagnostic",
".",
"Kind",
".",
"ERROR",
",",
"\"exception thrown! \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}"
] | Logs error message about the given exception.
@param e Offending throwable
@author vvakame | [
"Logs",
"error",
"message",
"about",
"the",
"given",
"exception",
"."
] | fce183ca66354723323a77f2ae8cb5222b5836bc | https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-apt/src/main/java/net/vvakame/util/jsonpullparser/factory/Log.java#L123-L125 |
109,205 | vvakame/JsonPullParser | jsonpullparser-apt/src/main/java/net/vvakame/apt/AptUtil.java | AptUtil.isPrimitiveWrapper | public static boolean isPrimitiveWrapper(Element element) {
if (element == null) {
return false;
} else if (element.toString().equals(Boolean.class.getCanonicalName())) {
return true;
} else if (element.toString().equals(Integer.class.getCanonicalName())) {
return true;
} else if (element.toString().eq... | java | public static boolean isPrimitiveWrapper(Element element) {
if (element == null) {
return false;
} else if (element.toString().equals(Boolean.class.getCanonicalName())) {
return true;
} else if (element.toString().equals(Integer.class.getCanonicalName())) {
return true;
} else if (element.toString().eq... | [
"public",
"static",
"boolean",
"isPrimitiveWrapper",
"(",
"Element",
"element",
")",
"{",
"if",
"(",
"element",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"element",
".",
"toString",
"(",
")",
".",
"equals",
"(",
"Boolean",
... | Tests if the given element is a primitive wrapper.
@param element
@return true if the element is a primitive wrapper, false otherwise.
@author vvakame | [
"Tests",
"if",
"the",
"given",
"element",
"is",
"a",
"primitive",
"wrapper",
"."
] | fce183ca66354723323a77f2ae8cb5222b5836bc | https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-apt/src/main/java/net/vvakame/apt/AptUtil.java#L94-L116 |
109,206 | vvakame/JsonPullParser | jsonpullparser-apt/src/main/java/net/vvakame/apt/AptUtil.java | AptUtil.isInternalType | public static boolean isInternalType(Types typeUtils, TypeMirror type) {
Element element = ((TypeElement) typeUtils.asElement(type)).getEnclosingElement();
return element.getKind() != ElementKind.PACKAGE;
} | java | public static boolean isInternalType(Types typeUtils, TypeMirror type) {
Element element = ((TypeElement) typeUtils.asElement(type)).getEnclosingElement();
return element.getKind() != ElementKind.PACKAGE;
} | [
"public",
"static",
"boolean",
"isInternalType",
"(",
"Types",
"typeUtils",
",",
"TypeMirror",
"type",
")",
"{",
"Element",
"element",
"=",
"(",
"(",
"TypeElement",
")",
"typeUtils",
".",
"asElement",
"(",
"type",
")",
")",
".",
"getEnclosingElement",
"(",
"... | Test if the given type is an internal type.
@param typeUtils
@param type
@return True if the type is an internal type, false otherwise.
@author vvakame | [
"Test",
"if",
"the",
"given",
"type",
"is",
"an",
"internal",
"type",
"."
] | fce183ca66354723323a77f2ae8cb5222b5836bc | https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-apt/src/main/java/net/vvakame/apt/AptUtil.java#L135-L138 |
109,207 | vvakame/JsonPullParser | jsonpullparser-apt/src/main/java/net/vvakame/apt/AptUtil.java | AptUtil.isPackagePrivate | public static boolean isPackagePrivate(Element element) {
if (isPublic(element)) {
return false;
} else if (isProtected(element)) {
return false;
} else if (isPrivate(element)) {
return false;
}
return true;
} | java | public static boolean isPackagePrivate(Element element) {
if (isPublic(element)) {
return false;
} else if (isProtected(element)) {
return false;
} else if (isPrivate(element)) {
return false;
}
return true;
} | [
"public",
"static",
"boolean",
"isPackagePrivate",
"(",
"Element",
"element",
")",
"{",
"if",
"(",
"isPublic",
"(",
"element",
")",
")",
"{",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"isProtected",
"(",
"element",
")",
")",
"{",
"return",
"false",... | Tests if the given element has the package-private visibility.
@param element
@return true if package-private, false otherwise
@author vvakame | [
"Tests",
"if",
"the",
"given",
"element",
"has",
"the",
"package",
"-",
"private",
"visibility",
"."
] | fce183ca66354723323a77f2ae8cb5222b5836bc | https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-apt/src/main/java/net/vvakame/apt/AptUtil.java#L360-L369 |
109,208 | vvakame/JsonPullParser | jsonpullparser-apt/src/main/java/net/vvakame/apt/AptUtil.java | AptUtil.getElementSetter | public static String getElementSetter(Element element) {
// 後続処理注意 hogeに対して sethoge が取得される. setHoge ではない.
String setterName = null;
if (isPrimitiveBoolean(element)) {
Pattern pattern = Pattern.compile("^is[^a-z].*$");
Matcher matcher = pattern.matcher(element.getSimpleName().toString());
if (matcher.matc... | java | public static String getElementSetter(Element element) {
// 後続処理注意 hogeに対して sethoge が取得される. setHoge ではない.
String setterName = null;
if (isPrimitiveBoolean(element)) {
Pattern pattern = Pattern.compile("^is[^a-z].*$");
Matcher matcher = pattern.matcher(element.getSimpleName().toString());
if (matcher.matc... | [
"public",
"static",
"String",
"getElementSetter",
"(",
"Element",
"element",
")",
"{",
"// 後続処理注意 hogeに対して sethoge が取得される. setHoge ではない.",
"String",
"setterName",
"=",
"null",
";",
"if",
"(",
"isPrimitiveBoolean",
"(",
"element",
")",
")",
"{",
"Pattern",
"pattern",
... | Returns the name of corresponding setter.
@param element the field
@return setter name
@author vvakame | [
"Returns",
"the",
"name",
"of",
"corresponding",
"setter",
"."
] | fce183ca66354723323a77f2ae8cb5222b5836bc | https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-apt/src/main/java/net/vvakame/apt/AptUtil.java#L425-L457 |
109,209 | vvakame/JsonPullParser | jsonpullparser-apt/src/main/java/net/vvakame/apt/AptUtil.java | AptUtil.getElementGetter | public static String getElementGetter(Element element) {
// TODO 型(boolean)による絞り込みをするべき
String getterName1 = "get" + element.getSimpleName().toString();
String getterName2 = "is" + element.getSimpleName().toString();
String getterName3 = element.getSimpleName().toString();
Element getter = null;
for (Eleme... | java | public static String getElementGetter(Element element) {
// TODO 型(boolean)による絞り込みをするべき
String getterName1 = "get" + element.getSimpleName().toString();
String getterName2 = "is" + element.getSimpleName().toString();
String getterName3 = element.getSimpleName().toString();
Element getter = null;
for (Eleme... | [
"public",
"static",
"String",
"getElementGetter",
"(",
"Element",
"element",
")",
"{",
"// TODO 型(boolean)による絞り込みをするべき",
"String",
"getterName1",
"=",
"\"get\"",
"+",
"element",
".",
"getSimpleName",
"(",
")",
".",
"toString",
"(",
")",
";",
"String",
"getterName2... | Returns the name of corresponding getter.
@param element the field
@return getter name
@author vvakame | [
"Returns",
"the",
"name",
"of",
"corresponding",
"getter",
"."
] | fce183ca66354723323a77f2ae8cb5222b5836bc | https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-apt/src/main/java/net/vvakame/apt/AptUtil.java#L465-L498 |
109,210 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/JTB.java | JTB.setInputFile | public void setInputFile (final File value)
{
if (value != null && !value.isAbsolute ())
{
throw new IllegalArgumentException ("path is not absolute: " + value);
}
this.inputFile = value;
} | java | public void setInputFile (final File value)
{
if (value != null && !value.isAbsolute ())
{
throw new IllegalArgumentException ("path is not absolute: " + value);
}
this.inputFile = value;
} | [
"public",
"void",
"setInputFile",
"(",
"final",
"File",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
"&&",
"!",
"value",
".",
"isAbsolute",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"path is not absolute: \"",
"+",
"value... | Sets the absolute path to the grammar file to pass into JTB for
preprocessing.
@param value
The absolute path to the grammar file to pass into JTB for
preprocessing. | [
"Sets",
"the",
"absolute",
"path",
"to",
"the",
"grammar",
"file",
"to",
"pass",
"into",
"JTB",
"for",
"preprocessing",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/JTB.java#L138-L145 |
109,211 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/JTB.java | JTB.setOutputDirectory | public void setOutputDirectory (final File value)
{
if (value != null && !value.isAbsolute ())
{
throw new IllegalArgumentException ("path is not absolute: " + value);
}
this.outputDirectory = value;
} | java | public void setOutputDirectory (final File value)
{
if (value != null && !value.isAbsolute ())
{
throw new IllegalArgumentException ("path is not absolute: " + value);
}
this.outputDirectory = value;
} | [
"public",
"void",
"setOutputDirectory",
"(",
"final",
"File",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
"&&",
"!",
"value",
".",
"isAbsolute",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"path is not absolute: \"",
"+",
... | Sets the absolute path to the output directory for the generated grammar
file.
@param value
The absolute path to the output directory for the generated grammar
file. If this directory does not exist yet, it is created. Note that
this path should already include the desired package hierarchy
because JTB will not append... | [
"Sets",
"the",
"absolute",
"path",
"to",
"the",
"output",
"directory",
"for",
"the",
"generated",
"grammar",
"file",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/JTB.java#L158-L165 |
109,212 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/JTB.java | JTB.getOutputFile | public File getOutputFile ()
{
File outputFile = null;
if (this.outputDirectory != null && this.inputFile != null)
{
final String fileName = FileUtils.removeExtension (this.inputFile.getName ()) + ".jj";
outputFile = new File (this.outputDirectory, fileName);
}
return outputFile;
} | java | public File getOutputFile ()
{
File outputFile = null;
if (this.outputDirectory != null && this.inputFile != null)
{
final String fileName = FileUtils.removeExtension (this.inputFile.getName ()) + ".jj";
outputFile = new File (this.outputDirectory, fileName);
}
return outputFile;
} | [
"public",
"File",
"getOutputFile",
"(",
")",
"{",
"File",
"outputFile",
"=",
"null",
";",
"if",
"(",
"this",
".",
"outputDirectory",
"!=",
"null",
"&&",
"this",
".",
"inputFile",
"!=",
"null",
")",
"{",
"final",
"String",
"fileName",
"=",
"FileUtils",
".... | Gets the absolute path to the enhanced grammar file generated by JTB.
@return The absolute path to the enhanced grammar file generated by JTB or
<code>null</code> if either the input file or the output directory
have not been set. | [
"Gets",
"the",
"absolute",
"path",
"to",
"the",
"enhanced",
"grammar",
"file",
"generated",
"by",
"JTB",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/JTB.java#L174-L183 |
109,213 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/JTB.java | JTB.setNodeDirectory | public void setNodeDirectory (final File value)
{
if (value != null && !value.isAbsolute ())
{
throw new IllegalArgumentException ("path is not absolute: " + value);
}
this.nodeDirectory = value;
} | java | public void setNodeDirectory (final File value)
{
if (value != null && !value.isAbsolute ())
{
throw new IllegalArgumentException ("path is not absolute: " + value);
}
this.nodeDirectory = value;
} | [
"public",
"void",
"setNodeDirectory",
"(",
"final",
"File",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
"&&",
"!",
"value",
".",
"isAbsolute",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"path is not absolute: \"",
"+",
"v... | Sets the absolute path to the output directory for the syntax tree files.
@param value
The absolute path to the output directory for the generated syntax
tree files, may be <code>null</code> to use a sub directory in the
output directory of the grammar file. If this directory does not
exist yet, it is created. Note th... | [
"Sets",
"the",
"absolute",
"path",
"to",
"the",
"output",
"directory",
"for",
"the",
"syntax",
"tree",
"files",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/JTB.java#L196-L203 |
109,214 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/JTB.java | JTB.getEffectiveNodeDirectory | private File getEffectiveNodeDirectory ()
{
if (this.nodeDirectory != null)
return this.nodeDirectory;
if (this.outputDirectory != null)
return new File (this.outputDirectory, getLastPackageName (getEffectiveNodePackageName ()));
return null;
} | java | private File getEffectiveNodeDirectory ()
{
if (this.nodeDirectory != null)
return this.nodeDirectory;
if (this.outputDirectory != null)
return new File (this.outputDirectory, getLastPackageName (getEffectiveNodePackageName ()));
return null;
} | [
"private",
"File",
"getEffectiveNodeDirectory",
"(",
")",
"{",
"if",
"(",
"this",
".",
"nodeDirectory",
"!=",
"null",
")",
"return",
"this",
".",
"nodeDirectory",
";",
"if",
"(",
"this",
".",
"outputDirectory",
"!=",
"null",
")",
"return",
"new",
"File",
"... | Gets the absolute path to the output directory for the syntax tree files.
@return The absolute path to the output directory for the syntax tree
files, only <code>null</code> if neither {@link #outputDirectory}
nor {@link #nodeDirectory} have been set. | [
"Gets",
"the",
"absolute",
"path",
"to",
"the",
"output",
"directory",
"for",
"the",
"syntax",
"tree",
"files",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/JTB.java#L212-L219 |
109,215 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/JTB.java | JTB.setVisitorDirectory | public void setVisitorDirectory (final File value)
{
if (value != null && !value.isAbsolute ())
{
throw new IllegalArgumentException ("path is not absolute: " + value);
}
this.visitorDirectory = value;
} | java | public void setVisitorDirectory (final File value)
{
if (value != null && !value.isAbsolute ())
{
throw new IllegalArgumentException ("path is not absolute: " + value);
}
this.visitorDirectory = value;
} | [
"public",
"void",
"setVisitorDirectory",
"(",
"final",
"File",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
"&&",
"!",
"value",
".",
"isAbsolute",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"path is not absolute: \"",
"+",
... | Sets the absolute path to the output directory for the visitor files.
@param value
The absolute path to the output directory for the generated visitor
files, may be <code>null</code> to use a sub directory in the output
directory of the grammar file. If this directory does not exist yet,
it is created. Note that this ... | [
"Sets",
"the",
"absolute",
"path",
"to",
"the",
"output",
"directory",
"for",
"the",
"visitor",
"files",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/JTB.java#L232-L239 |
109,216 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/JTB.java | JTB.getEffectiveVisitorDirectory | private File getEffectiveVisitorDirectory ()
{
if (this.visitorDirectory != null)
return this.visitorDirectory;
if (this.outputDirectory != null)
return new File (this.outputDirectory, getLastPackageName (getEffectiveVisitorPackageName ()));
return null;
} | java | private File getEffectiveVisitorDirectory ()
{
if (this.visitorDirectory != null)
return this.visitorDirectory;
if (this.outputDirectory != null)
return new File (this.outputDirectory, getLastPackageName (getEffectiveVisitorPackageName ()));
return null;
} | [
"private",
"File",
"getEffectiveVisitorDirectory",
"(",
")",
"{",
"if",
"(",
"this",
".",
"visitorDirectory",
"!=",
"null",
")",
"return",
"this",
".",
"visitorDirectory",
";",
"if",
"(",
"this",
".",
"outputDirectory",
"!=",
"null",
")",
"return",
"new",
"F... | Gets the absolute path to the output directory for the visitor files.
@return The absolute path to the output directory for the visitor, only
<code>null</code> if neither {@link #outputDirectory} nor
{@link #visitorDirectory} have been set. | [
"Gets",
"the",
"absolute",
"path",
"to",
"the",
"output",
"directory",
"for",
"the",
"visitor",
"files",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/JTB.java#L248-L255 |
109,217 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/JTB.java | JTB.getEffectiveNodePackageName | private String getEffectiveNodePackageName ()
{
if (this.packageName != null)
return this.packageName.length () <= 0 ? SYNTAX_TREE : this.packageName + '.' + SYNTAX_TREE;
if (this.nodePackageName != null)
return this.nodePackageName;
return SYNTAX_TREE;
} | java | private String getEffectiveNodePackageName ()
{
if (this.packageName != null)
return this.packageName.length () <= 0 ? SYNTAX_TREE : this.packageName + '.' + SYNTAX_TREE;
if (this.nodePackageName != null)
return this.nodePackageName;
return SYNTAX_TREE;
} | [
"private",
"String",
"getEffectiveNodePackageName",
"(",
")",
"{",
"if",
"(",
"this",
".",
"packageName",
"!=",
"null",
")",
"return",
"this",
".",
"packageName",
".",
"length",
"(",
")",
"<=",
"0",
"?",
"SYNTAX_TREE",
":",
"this",
".",
"packageName",
"+",... | Gets the effective package name for the syntax tree files.
@return The effective package name for the syntax tree files, never
<code>null</code>. | [
"Gets",
"the",
"effective",
"package",
"name",
"for",
"the",
"syntax",
"tree",
"files",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/JTB.java#L286-L294 |
109,218 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/JTB.java | JTB.getEffectiveVisitorPackageName | private String getEffectiveVisitorPackageName ()
{
if (this.packageName != null)
return this.packageName.length () <= 0 ? VISITOR : this.packageName + '.' + VISITOR;
if (this.visitorPackageName != null)
return this.visitorPackageName;
return VISITOR;
} | java | private String getEffectiveVisitorPackageName ()
{
if (this.packageName != null)
return this.packageName.length () <= 0 ? VISITOR : this.packageName + '.' + VISITOR;
if (this.visitorPackageName != null)
return this.visitorPackageName;
return VISITOR;
} | [
"private",
"String",
"getEffectiveVisitorPackageName",
"(",
")",
"{",
"if",
"(",
"this",
".",
"packageName",
"!=",
"null",
")",
"return",
"this",
".",
"packageName",
".",
"length",
"(",
")",
"<=",
"0",
"?",
"VISITOR",
":",
"this",
".",
"packageName",
"+",
... | Gets the effective package name for the visitor files.
@return The effective package name for the visitor files, never
<code>null</code>. | [
"Gets",
"the",
"effective",
"package",
"name",
"for",
"the",
"visitor",
"files",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/JTB.java#L313-L320 |
109,219 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/JTB.java | JTB.generateArguments | private String [] generateArguments ()
{
final List <String> argsList = new ArrayList <> ();
argsList.add ("-np");
argsList.add (getEffectiveNodePackageName ());
argsList.add ("-vp");
argsList.add (getEffectiveVisitorPackageName ());
if (this.supressErrorChecking != null && this.supressErro... | java | private String [] generateArguments ()
{
final List <String> argsList = new ArrayList <> ();
argsList.add ("-np");
argsList.add (getEffectiveNodePackageName ());
argsList.add ("-vp");
argsList.add (getEffectiveVisitorPackageName ());
if (this.supressErrorChecking != null && this.supressErro... | [
"private",
"String",
"[",
"]",
"generateArguments",
"(",
")",
"{",
"final",
"List",
"<",
"String",
">",
"argsList",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"argsList",
".",
"add",
"(",
"\"-np\"",
")",
";",
"argsList",
".",
"add",
"(",
"getEffecti... | Assembles the command line arguments for the invocation of JTB according to
the configuration.
@return A string array that represents the command line arguments to use
for JTB. | [
"Assembles",
"the",
"command",
"line",
"arguments",
"for",
"the",
"invocation",
"of",
"JTB",
"according",
"to",
"the",
"configuration",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/JTB.java#L455-L519 |
109,220 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/JTB.java | JTB.getLastPackageName | private String getLastPackageName (final String name)
{
if (name != null)
{
return name.substring (name.lastIndexOf ('.') + 1);
}
return null;
} | java | private String getLastPackageName (final String name)
{
if (name != null)
{
return name.substring (name.lastIndexOf ('.') + 1);
}
return null;
} | [
"private",
"String",
"getLastPackageName",
"(",
"final",
"String",
"name",
")",
"{",
"if",
"(",
"name",
"!=",
"null",
")",
"{",
"return",
"name",
".",
"substring",
"(",
"name",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
"+",
"1",
")",
";",
"}",
"return"... | Gets the last identifier from the specified package name. For example,
returns "apache" upon input of "org.apache". JTB uses this approach to
derive the output directories for the visitor and syntax tree files.
@param name
The package name from which to retrieve the last sub package, may be
<code>null</code>.
@return ... | [
"Gets",
"the",
"last",
"identifier",
"from",
"the",
"specified",
"package",
"name",
".",
"For",
"example",
"returns",
"apache",
"upon",
"input",
"of",
"org",
".",
"apache",
".",
"JTB",
"uses",
"this",
"approach",
"to",
"derive",
"the",
"output",
"directories... | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/JTB.java#L532-L539 |
109,221 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/JJTreeJavaCCMojo.java | JJTreeJavaCCMojo.newJJTree | protected JJTree newJJTree ()
{
final JJTree jjtree = new JJTree ();
jjtree.setLog (getLog ());
jjtree.setGrammarEncoding (getGrammarEncoding ());
jjtree.setOutputEncoding (getOutputEncoding ());
jjtree.setJdkVersion (getJdkVersion ());
jjtree.setBuildNodeFiles (this.buildNodeFiles);
jjtre... | java | protected JJTree newJJTree ()
{
final JJTree jjtree = new JJTree ();
jjtree.setLog (getLog ());
jjtree.setGrammarEncoding (getGrammarEncoding ());
jjtree.setOutputEncoding (getOutputEncoding ());
jjtree.setJdkVersion (getJdkVersion ());
jjtree.setBuildNodeFiles (this.buildNodeFiles);
jjtre... | [
"protected",
"JJTree",
"newJJTree",
"(",
")",
"{",
"final",
"JJTree",
"jjtree",
"=",
"new",
"JJTree",
"(",
")",
";",
"jjtree",
".",
"setLog",
"(",
"getLog",
"(",
")",
")",
";",
"jjtree",
".",
"setGrammarEncoding",
"(",
"getGrammarEncoding",
"(",
")",
")"... | Creates a new facade to invoke JJTree. Most options for the invocation are
derived from the current values of the corresponding mojo parameters. The
caller is responsible to set the input file, output directory and package
on the returned facade.
@return The facade for the tool invocation, never <code>null</code>. | [
"Creates",
"a",
"new",
"facade",
"to",
"invoke",
"JJTree",
".",
"Most",
"options",
"for",
"the",
"invocation",
"are",
"derived",
"from",
"the",
"current",
"values",
"of",
"the",
"corresponding",
"mojo",
"parameters",
".",
"The",
"caller",
"is",
"responsible",
... | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/JJTreeJavaCCMojo.java#L366-L388 |
109,222 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/ForkedJvm.java | ForkedJvm.addClassPathEntry | public final void addClassPathEntry (@Nullable final File path)
{
if (path != null)
m_aClassPathEntries.add (path.getAbsolutePath ());
} | java | public final void addClassPathEntry (@Nullable final File path)
{
if (path != null)
m_aClassPathEntries.add (path.getAbsolutePath ());
} | [
"public",
"final",
"void",
"addClassPathEntry",
"(",
"@",
"Nullable",
"final",
"File",
"path",
")",
"{",
"if",
"(",
"path",
"!=",
"null",
")",
"m_aClassPathEntries",
".",
"add",
"(",
"path",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"}"
] | Adds the specified path to the class path of the forked JVM.
@param path
The path to add, may be <code>null</code>. | [
"Adds",
"the",
"specified",
"path",
"to",
"the",
"class",
"path",
"of",
"the",
"forked",
"JVM",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/ForkedJvm.java#L168-L172 |
109,223 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/ForkedJvm.java | ForkedJvm._getResourceSource | @Nullable
private static File _getResourceSource (final String resource, final ClassLoader loader)
{
if (resource != null)
{
URL url;
if (loader != null)
{
url = loader.getResource (resource);
}
else
{
url = ClassLoader.getSystemResource (resource);
... | java | @Nullable
private static File _getResourceSource (final String resource, final ClassLoader loader)
{
if (resource != null)
{
URL url;
if (loader != null)
{
url = loader.getResource (resource);
}
else
{
url = ClassLoader.getSystemResource (resource);
... | [
"@",
"Nullable",
"private",
"static",
"File",
"_getResourceSource",
"(",
"final",
"String",
"resource",
",",
"final",
"ClassLoader",
"loader",
")",
"{",
"if",
"(",
"resource",
"!=",
"null",
")",
"{",
"URL",
"url",
";",
"if",
"(",
"loader",
"!=",
"null",
... | Gets the JAR file or directory that contains the specified resource.
@param resource
The absolute name of the resource to find, may be <code>null</code>.
@param loader
The class loader to use for searching the resource, may be
<code>null</code>.
@return The absolute path to the resource location or <code>null</code> i... | [
"Gets",
"the",
"JAR",
"file",
"or",
"directory",
"that",
"contains",
"the",
"specified",
"resource",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/ForkedJvm.java#L234-L251 |
109,224 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/ForkedJvm.java | ForkedJvm._createCommandLine | private Commandline _createCommandLine ()
{
/*
* NOTE: This method is designed to work with plexus-utils:1.1 which is used
* by all Maven versions before 2.0.6 regardless of our plugin dependency.
* Therefore, we use setWorkingDirectory(String) rather than
* setWorkingDirectory(File) and addAr... | java | private Commandline _createCommandLine ()
{
/*
* NOTE: This method is designed to work with plexus-utils:1.1 which is used
* by all Maven versions before 2.0.6 regardless of our plugin dependency.
* Therefore, we use setWorkingDirectory(String) rather than
* setWorkingDirectory(File) and addAr... | [
"private",
"Commandline",
"_createCommandLine",
"(",
")",
"{",
"/*\n * NOTE: This method is designed to work with plexus-utils:1.1 which is used\n * by all Maven versions before 2.0.6 regardless of our plugin dependency.\n * Therefore, we use setWorkingDirectory(String) rather than\n * s... | Creates the command line for the new JVM based on the current
configuration.
@return The command line used to fork the JVM, never <code>null</code>. | [
"Creates",
"the",
"command",
"line",
"for",
"the",
"new",
"JVM",
"based",
"on",
"the",
"current",
"configuration",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/ForkedJvm.java#L347-L379 |
109,225 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/JJDocMojo.java | JJDocMojo.getSourceDirectories | private File [] getSourceDirectories ()
{
final Set <File> directories = new LinkedHashSet <> ();
if (this.sourceDirectories != null && this.sourceDirectories.length > 0)
{
directories.addAll (Arrays.asList (this.sourceDirectories));
}
else
{
if (this.defaultGrammarDirectoryJavaCC ... | java | private File [] getSourceDirectories ()
{
final Set <File> directories = new LinkedHashSet <> ();
if (this.sourceDirectories != null && this.sourceDirectories.length > 0)
{
directories.addAll (Arrays.asList (this.sourceDirectories));
}
else
{
if (this.defaultGrammarDirectoryJavaCC ... | [
"private",
"File",
"[",
"]",
"getSourceDirectories",
"(",
")",
"{",
"final",
"Set",
"<",
"File",
">",
"directories",
"=",
"new",
"LinkedHashSet",
"<>",
"(",
")",
";",
"if",
"(",
"this",
".",
"sourceDirectories",
"!=",
"null",
"&&",
"this",
".",
"sourceDi... | Get the source directories that should be scanned for grammar files.
@return The source directories that should be scanned for grammar files,
never <code>null</code>. | [
"Get",
"the",
"source",
"directories",
"that",
"should",
"be",
"scanned",
"for",
"grammar",
"files",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/JJDocMojo.java#L249-L272 |
109,226 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/JJDocMojo.java | JJDocMojo.executeReport | @Override
public void executeReport (final Locale locale) throws MavenReportException
{
final Sink sink = getSink ();
createReportHeader (getBundle (locale), sink);
final File [] sourceDirs = getSourceDirectories ();
for (final File sourceDir : sourceDirs)
{
final GrammarInfo [] grammarI... | java | @Override
public void executeReport (final Locale locale) throws MavenReportException
{
final Sink sink = getSink ();
createReportHeader (getBundle (locale), sink);
final File [] sourceDirs = getSourceDirectories ();
for (final File sourceDir : sourceDirs)
{
final GrammarInfo [] grammarI... | [
"@",
"Override",
"public",
"void",
"executeReport",
"(",
"final",
"Locale",
"locale",
")",
"throws",
"MavenReportException",
"{",
"final",
"Sink",
"sink",
"=",
"getSink",
"(",
")",
";",
"createReportHeader",
"(",
"getBundle",
"(",
"locale",
")",
",",
"sink",
... | Run the actual report.
@param locale
The locale to use for this report.
@throws MavenReportException
If the report generation failed. | [
"Run",
"the",
"actual",
"report",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/JJDocMojo.java#L337-L386 |
109,227 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/JJDocMojo.java | JJDocMojo.createReportHeader | private void createReportHeader (final ResourceBundle bundle, final Sink sink)
{
sink.head ();
sink.title ();
sink.text (bundle.getString ("report.jjdoc.title"));
sink.title_ ();
sink.head_ ();
sink.body ();
sink.section1 ();
sink.sectionTitle1 ();
sink.text (bundle.getString ("r... | java | private void createReportHeader (final ResourceBundle bundle, final Sink sink)
{
sink.head ();
sink.title ();
sink.text (bundle.getString ("report.jjdoc.title"));
sink.title_ ();
sink.head_ ();
sink.body ();
sink.section1 ();
sink.sectionTitle1 ();
sink.text (bundle.getString ("r... | [
"private",
"void",
"createReportHeader",
"(",
"final",
"ResourceBundle",
"bundle",
",",
"final",
"Sink",
"sink",
")",
"{",
"sink",
".",
"head",
"(",
")",
";",
"sink",
".",
"title",
"(",
")",
";",
"sink",
".",
"text",
"(",
"bundle",
".",
"getString",
"(... | Create the header and title for the HTML report page.
@param bundle
The resource bundle with the text.
@param sink
The sink for writing to the main report file. | [
"Create",
"the",
"header",
"and",
"title",
"for",
"the",
"HTML",
"report",
"page",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/JJDocMojo.java#L416-L440 |
109,228 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/JJDocMojo.java | JJDocMojo.createReportLink | private void createReportLink (final Sink sink, final File sourceDirectory, final File grammarFile, String linkPath)
{
sink.tableRow ();
sink.tableCell ();
if (linkPath.startsWith ("/"))
{
linkPath = linkPath.substring (1);
}
sink.link (linkPath);
String grammarFileRelativePath = sou... | java | private void createReportLink (final Sink sink, final File sourceDirectory, final File grammarFile, String linkPath)
{
sink.tableRow ();
sink.tableCell ();
if (linkPath.startsWith ("/"))
{
linkPath = linkPath.substring (1);
}
sink.link (linkPath);
String grammarFileRelativePath = sou... | [
"private",
"void",
"createReportLink",
"(",
"final",
"Sink",
"sink",
",",
"final",
"File",
"sourceDirectory",
",",
"final",
"File",
"grammarFile",
",",
"String",
"linkPath",
")",
"{",
"sink",
".",
"tableRow",
"(",
")",
";",
"sink",
".",
"tableCell",
"(",
"... | Create a table row containing a link to the JJDoc report for a grammar
file.
@param sink
The sink to write the report
@param sourceDirectory
The source directory of the grammar file.
@param grammarFile
The JavaCC grammar file.
@param linkPath
The path to the JJDoc output. | [
"Create",
"a",
"table",
"row",
"containing",
"a",
"link",
"to",
"the",
"JJDoc",
"report",
"for",
"a",
"grammar",
"file",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/JJDocMojo.java#L455-L473 |
109,229 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/JJDocMojo.java | JJDocMojo.newJJDoc | private JJDoc newJJDoc ()
{
final JJDoc jjdoc = new JJDoc ();
jjdoc.setLog (getLog ());
jjdoc.setGrammarEncoding (this.grammarEncoding);
jjdoc.setOutputEncoding (this.outputEncoding);
jjdoc.setCssHref (this.cssHref);
jjdoc.setText (this.text);
jjdoc.setBnf (this.bnf);
jjdoc.setOneTable... | java | private JJDoc newJJDoc ()
{
final JJDoc jjdoc = new JJDoc ();
jjdoc.setLog (getLog ());
jjdoc.setGrammarEncoding (this.grammarEncoding);
jjdoc.setOutputEncoding (this.outputEncoding);
jjdoc.setCssHref (this.cssHref);
jjdoc.setText (this.text);
jjdoc.setBnf (this.bnf);
jjdoc.setOneTable... | [
"private",
"JJDoc",
"newJJDoc",
"(",
")",
"{",
"final",
"JJDoc",
"jjdoc",
"=",
"new",
"JJDoc",
"(",
")",
";",
"jjdoc",
".",
"setLog",
"(",
"getLog",
"(",
")",
")",
";",
"jjdoc",
".",
"setGrammarEncoding",
"(",
"this",
".",
"grammarEncoding",
")",
";",
... | Creates a new facade to invoke JJDoc. Most options for the invocation are
derived from the current values of the corresponding mojo parameters. The
caller is responsible to set the input file and output file on the returned
facade.
@return The facade for the tool invocation, never <code>null</code>. | [
"Creates",
"a",
"new",
"facade",
"to",
"invoke",
"JJDoc",
".",
"Most",
"options",
"for",
"the",
"invocation",
"are",
"derived",
"from",
"the",
"current",
"values",
"of",
"the",
"corresponding",
"mojo",
"parameters",
".",
"The",
"caller",
"is",
"responsible",
... | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/JJDocMojo.java#L495-L506 |
109,230 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/JJDocMojo.java | JJDocMojo.scanForGrammars | private GrammarInfo [] scanForGrammars (final File sourceDirectory) throws MavenReportException
{
if (!sourceDirectory.isDirectory ())
{
return null;
}
GrammarInfo [] grammarInfos;
getLog ().debug ("Scanning for grammars: " + sourceDirectory);
try
{
final String [] includes =... | java | private GrammarInfo [] scanForGrammars (final File sourceDirectory) throws MavenReportException
{
if (!sourceDirectory.isDirectory ())
{
return null;
}
GrammarInfo [] grammarInfos;
getLog ().debug ("Scanning for grammars: " + sourceDirectory);
try
{
final String [] includes =... | [
"private",
"GrammarInfo",
"[",
"]",
"scanForGrammars",
"(",
"final",
"File",
"sourceDirectory",
")",
"throws",
"MavenReportException",
"{",
"if",
"(",
"!",
"sourceDirectory",
".",
"isDirectory",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"GrammarInfo",
"[... | Searches the specified source directory to find grammar files that can be
documented.
@param sourceDirectory
The source directory to scan for grammar files.
@return An array of grammar infos describing the found grammar files or
<code>null</code> if the source directory does not exist.
@throws MavenReportException
If ... | [
"Searches",
"the",
"specified",
"source",
"directory",
"to",
"find",
"grammar",
"files",
"that",
"can",
"be",
"documented",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/JJDocMojo.java#L519-L545 |
109,231 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/AbstractJavaCCMojo.java | AbstractJavaCCMojo.execute | public void execute () throws MojoExecutionException, MojoFailureException
{
final GrammarInfo [] grammarInfos = scanForGrammars ();
if (grammarInfos == null)
{
getLog ().info ("Skipping non-existing source directory: " + getSourceDirectory ());
return;
}
else
if (grammarInfos.l... | java | public void execute () throws MojoExecutionException, MojoFailureException
{
final GrammarInfo [] grammarInfos = scanForGrammars ();
if (grammarInfos == null)
{
getLog ().info ("Skipping non-existing source directory: " + getSourceDirectory ());
return;
}
else
if (grammarInfos.l... | [
"public",
"void",
"execute",
"(",
")",
"throws",
"MojoExecutionException",
",",
"MojoFailureException",
"{",
"final",
"GrammarInfo",
"[",
"]",
"grammarInfos",
"=",
"scanForGrammars",
"(",
")",
";",
"if",
"(",
"grammarInfos",
"==",
"null",
")",
"{",
"getLog",
"... | Execute the tool.
@throws MojoExecutionException
If the invocation of the tool failed.
@throws MojoFailureException
If the tool reported a non-zero exit code. | [
"Execute",
"the",
"tool",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/AbstractJavaCCMojo.java#L433-L473 |
109,232 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/AbstractJavaCCMojo.java | AbstractJavaCCMojo.scanForGrammars | private GrammarInfo [] scanForGrammars () throws MojoExecutionException
{
if (!getSourceDirectory ().isDirectory ())
{
return null;
}
GrammarInfo [] grammarInfos;
getLog ().debug ("Scanning for grammars: " + getSourceDirectory ());
try
{
final GrammarDirectoryScanner scanner ... | java | private GrammarInfo [] scanForGrammars () throws MojoExecutionException
{
if (!getSourceDirectory ().isDirectory ())
{
return null;
}
GrammarInfo [] grammarInfos;
getLog ().debug ("Scanning for grammars: " + getSourceDirectory ());
try
{
final GrammarDirectoryScanner scanner ... | [
"private",
"GrammarInfo",
"[",
"]",
"scanForGrammars",
"(",
")",
"throws",
"MojoExecutionException",
"{",
"if",
"(",
"!",
"getSourceDirectory",
"(",
")",
".",
"isDirectory",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"GrammarInfo",
"[",
"]",
"grammarInf... | Scans the configured source directory for grammar files which need
processing.
@return An array of grammar infos describing the found grammar files or
<code>null</code> if the source directory does not exist.
@throws MojoExecutionException
If the source directory could not be scanned. | [
"Scans",
"the",
"configured",
"source",
"directory",
"for",
"grammar",
"files",
"which",
"need",
"processing",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/AbstractJavaCCMojo.java#L497-L526 |
109,233 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/AbstractJavaCCMojo.java | AbstractJavaCCMojo.deleteTempDirectory | protected void deleteTempDirectory (final File tempDirectory)
{
try
{
FileUtils.deleteDirectory (tempDirectory);
}
catch (final IOException e)
{
getLog ().warn ("Failed to delete temporary directory: " + tempDirectory, e);
}
} | java | protected void deleteTempDirectory (final File tempDirectory)
{
try
{
FileUtils.deleteDirectory (tempDirectory);
}
catch (final IOException e)
{
getLog ().warn ("Failed to delete temporary directory: " + tempDirectory, e);
}
} | [
"protected",
"void",
"deleteTempDirectory",
"(",
"final",
"File",
"tempDirectory",
")",
"{",
"try",
"{",
"FileUtils",
".",
"deleteDirectory",
"(",
"tempDirectory",
")",
";",
"}",
"catch",
"(",
"final",
"IOException",
"e",
")",
"{",
"getLog",
"(",
")",
".",
... | Deletes the specified temporary directory.
@param tempDirectory
The directory to delete, must not be <code>null</code>. | [
"Deletes",
"the",
"specified",
"temporary",
"directory",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/AbstractJavaCCMojo.java#L544-L554 |
109,234 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/AbstractJavaCCMojo.java | AbstractJavaCCMojo.findSourceFile | private File findSourceFile (final String filename)
{
final Collection <File> sourceRoots = this.nonGeneratedSourceRoots;
for (final File sourceRoot : sourceRoots)
{
final File sourceFile = new File (sourceRoot, filename);
if (sourceFile.exists ())
{
return sourceFile;
}
... | java | private File findSourceFile (final String filename)
{
final Collection <File> sourceRoots = this.nonGeneratedSourceRoots;
for (final File sourceRoot : sourceRoots)
{
final File sourceFile = new File (sourceRoot, filename);
if (sourceFile.exists ())
{
return sourceFile;
}
... | [
"private",
"File",
"findSourceFile",
"(",
"final",
"String",
"filename",
")",
"{",
"final",
"Collection",
"<",
"File",
">",
"sourceRoots",
"=",
"this",
".",
"nonGeneratedSourceRoots",
";",
"for",
"(",
"final",
"File",
"sourceRoot",
":",
"sourceRoots",
")",
"{"... | Determines whether the specified source file is already present in any of the
compile source roots registered with the current Maven project.
@param filename
The source filename to check, relative to a source root, must not be
<code>null</code>.
@return The (absolute) path to the existing source file if any,
<code>nul... | [
"Determines",
"whether",
"the",
"specified",
"source",
"file",
"is",
"already",
"present",
"in",
"any",
"of",
"the",
"compile",
"source",
"roots",
"registered",
"with",
"the",
"current",
"Maven",
"project",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/AbstractJavaCCMojo.java#L693-L705 |
109,235 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/AbstractJavaCCMojo.java | AbstractJavaCCMojo.addSourceRoot | private void addSourceRoot (final File directory)
{
if (this.project != null)
{
getLog ().debug ("Adding compile source root: " + directory);
this.project.addCompileSourceRoot (directory.getAbsolutePath ());
}
} | java | private void addSourceRoot (final File directory)
{
if (this.project != null)
{
getLog ().debug ("Adding compile source root: " + directory);
this.project.addCompileSourceRoot (directory.getAbsolutePath ());
}
} | [
"private",
"void",
"addSourceRoot",
"(",
"final",
"File",
"directory",
")",
"{",
"if",
"(",
"this",
".",
"project",
"!=",
"null",
")",
"{",
"getLog",
"(",
")",
".",
"debug",
"(",
"\"Adding compile source root: \"",
"+",
"directory",
")",
";",
"this",
".",
... | Registers the specified directory as a compile source root for the current
project.
@param directory
The absolute path to the source root, must not be <code>null</code>. | [
"Registers",
"the",
"specified",
"directory",
"as",
"a",
"compile",
"source",
"root",
"for",
"the",
"current",
"project",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/AbstractJavaCCMojo.java#L728-L735 |
109,236 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/AbstractJavaCCMojo.java | AbstractJavaCCMojo.newJavaCC | protected JavaCC newJavaCC ()
{
final JavaCC javacc = new JavaCC ();
javacc.setLog (getLog ());
javacc.setGrammarEncoding (this.grammarEncoding);
javacc.setOutputEncoding (this.outputEncoding);
javacc.setJdkVersion (this.jdkVersion);
javacc.setBuildParser (this.buildParser);
javacc.setBuil... | java | protected JavaCC newJavaCC ()
{
final JavaCC javacc = new JavaCC ();
javacc.setLog (getLog ());
javacc.setGrammarEncoding (this.grammarEncoding);
javacc.setOutputEncoding (this.outputEncoding);
javacc.setJdkVersion (this.jdkVersion);
javacc.setBuildParser (this.buildParser);
javacc.setBuil... | [
"protected",
"JavaCC",
"newJavaCC",
"(",
")",
"{",
"final",
"JavaCC",
"javacc",
"=",
"new",
"JavaCC",
"(",
")",
";",
"javacc",
".",
"setLog",
"(",
"getLog",
"(",
")",
")",
";",
"javacc",
".",
"setGrammarEncoding",
"(",
"this",
".",
"grammarEncoding",
")"... | Creates a new facade to invoke JavaCC. Most options for the invocation are
derived from the current values of the corresponding mojo parameters. The
caller is responsible to set the input file and output directory on the
returned facade.
@return The facade for the tool invocation, never <code>null</code>. | [
"Creates",
"a",
"new",
"facade",
"to",
"invoke",
"JavaCC",
".",
"Most",
"options",
"for",
"the",
"invocation",
"are",
"derived",
"from",
"the",
"current",
"values",
"of",
"the",
"corresponding",
"mojo",
"parameters",
".",
"The",
"caller",
"is",
"responsible",
... | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/AbstractJavaCCMojo.java#L745-L777 |
109,237 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/UrlUtils.java | UrlUtils.getResourceRoot | public static File getResourceRoot (final URL url, final String resource)
{
String path = null;
if (url != null)
{
final String spec = url.toExternalForm ();
if ((JAR_FILE).regionMatches (true, 0, spec, 0, JAR_FILE.length ()))
{
URL jar;
try
{
jar = new ... | java | public static File getResourceRoot (final URL url, final String resource)
{
String path = null;
if (url != null)
{
final String spec = url.toExternalForm ();
if ((JAR_FILE).regionMatches (true, 0, spec, 0, JAR_FILE.length ()))
{
URL jar;
try
{
jar = new ... | [
"public",
"static",
"File",
"getResourceRoot",
"(",
"final",
"URL",
"url",
",",
"final",
"String",
"resource",
")",
"{",
"String",
"path",
"=",
"null",
";",
"if",
"(",
"url",
"!=",
"null",
")",
"{",
"final",
"String",
"spec",
"=",
"url",
".",
"toExtern... | Gets the absolute filesystem path to the class path root for the specified
resource. The root is either a JAR file or a directory with loose class
files. If the URL does not use a supported protocol, an exception will be
thrown.
@param url
The URL to the resource, may be <code>null</code>.
@param resource
The name of ... | [
"Gets",
"the",
"absolute",
"filesystem",
"path",
"to",
"the",
"class",
"path",
"root",
"for",
"the",
"specified",
"resource",
".",
"The",
"root",
"is",
"either",
"a",
"JAR",
"file",
"or",
"a",
"directory",
"with",
"loose",
"class",
"files",
".",
"If",
"t... | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/UrlUtils.java#L70-L101 |
109,238 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/JTBJavaCCMojo.java | JTBJavaCCMojo.newJTB | private JTB newJTB ()
{
final JTB jtb = new JTB ();
jtb.setLog (getLog ());
jtb.setDescriptiveFieldNames (this.descriptiveFieldNames);
jtb.setJavadocFriendlyComments (this.javadocFriendlyComments);
jtb.setNodeParentClass (this.nodeParentClass);
jtb.setParentPointers (this.parentPointers);
... | java | private JTB newJTB ()
{
final JTB jtb = new JTB ();
jtb.setLog (getLog ());
jtb.setDescriptiveFieldNames (this.descriptiveFieldNames);
jtb.setJavadocFriendlyComments (this.javadocFriendlyComments);
jtb.setNodeParentClass (this.nodeParentClass);
jtb.setParentPointers (this.parentPointers);
... | [
"private",
"JTB",
"newJTB",
"(",
")",
"{",
"final",
"JTB",
"jtb",
"=",
"new",
"JTB",
"(",
")",
";",
"jtb",
".",
"setLog",
"(",
"getLog",
"(",
")",
")",
";",
"jtb",
".",
"setDescriptiveFieldNames",
"(",
"this",
".",
"descriptiveFieldNames",
")",
";",
... | Creates a new facade to invoke JTB. Most options for the invocation are
derived from the current values of the corresponding mojo parameters. The
caller is responsible to set the input file, output directories and
packages on the returned facade.
@return The facade for the tool invocation, never <code>null</code>. | [
"Creates",
"a",
"new",
"facade",
"to",
"invoke",
"JTB",
".",
"Most",
"options",
"for",
"the",
"invocation",
"are",
"derived",
"from",
"the",
"current",
"values",
"of",
"the",
"corresponding",
"mojo",
"parameters",
".",
"The",
"caller",
"is",
"responsible",
"... | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/JTBJavaCCMojo.java#L401-L414 |
109,239 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/GrammarDirectoryScanner.java | GrammarDirectoryScanner.setSourceDirectory | public void setSourceDirectory (final File directory)
{
if (!directory.isAbsolute ())
{
throw new IllegalArgumentException ("source directory is not absolute: " + directory);
}
this.scanner.setBasedir (directory);
} | java | public void setSourceDirectory (final File directory)
{
if (!directory.isAbsolute ())
{
throw new IllegalArgumentException ("source directory is not absolute: " + directory);
}
this.scanner.setBasedir (directory);
} | [
"public",
"void",
"setSourceDirectory",
"(",
"final",
"File",
"directory",
")",
"{",
"if",
"(",
"!",
"directory",
".",
"isAbsolute",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"source directory is not absolute: \"",
"+",
"directory",
")... | Sets the absolute path to the source directory to scan for grammar files.
This directory must exist or the scanner will report an error.
@param directory
The absolute path to the source directory to scan, must not be
<code>null</code>. | [
"Sets",
"the",
"absolute",
"path",
"to",
"the",
"source",
"directory",
"to",
"scan",
"for",
"grammar",
"files",
".",
"This",
"directory",
"must",
"exist",
"or",
"the",
"scanner",
"will",
"report",
"an",
"error",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/GrammarDirectoryScanner.java#L90-L97 |
109,240 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/GrammarDirectoryScanner.java | GrammarDirectoryScanner.setOutputDirectory | public void setOutputDirectory (final File directory)
{
if (directory != null && !directory.isAbsolute ())
{
throw new IllegalArgumentException ("output directory is not absolute: " + directory);
}
this.outputDirectory = directory;
} | java | public void setOutputDirectory (final File directory)
{
if (directory != null && !directory.isAbsolute ())
{
throw new IllegalArgumentException ("output directory is not absolute: " + directory);
}
this.outputDirectory = directory;
} | [
"public",
"void",
"setOutputDirectory",
"(",
"final",
"File",
"directory",
")",
"{",
"if",
"(",
"directory",
"!=",
"null",
"&&",
"!",
"directory",
".",
"isAbsolute",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"output directory is not ... | Sets the absolute path to the output directory used to detect stale target
files.
@param directory
The absolute path to the output directory used to detect stale target
files by timestamp checking, may be <code>null</code> if no stale
detection should be performed. | [
"Sets",
"the",
"absolute",
"path",
"to",
"the",
"output",
"directory",
"used",
"to",
"detect",
"stale",
"target",
"files",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/GrammarDirectoryScanner.java#L145-L152 |
109,241 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/GrammarDirectoryScanner.java | GrammarDirectoryScanner.scan | public void scan () throws IOException
{
this.includedGrammars.clear ();
this.scanner.scan ();
final String [] includedFiles = this.scanner.getIncludedFiles ();
for (final String includedFile : includedFiles)
{
final GrammarInfo grammarInfo = new GrammarInfo (this.scanner.getBasedir (), inc... | java | public void scan () throws IOException
{
this.includedGrammars.clear ();
this.scanner.scan ();
final String [] includedFiles = this.scanner.getIncludedFiles ();
for (final String includedFile : includedFiles)
{
final GrammarInfo grammarInfo = new GrammarInfo (this.scanner.getBasedir (), inc... | [
"public",
"void",
"scan",
"(",
")",
"throws",
"IOException",
"{",
"this",
".",
"includedGrammars",
".",
"clear",
"(",
")",
";",
"this",
".",
"scanner",
".",
"scan",
"(",
")",
";",
"final",
"String",
"[",
"]",
"includedFiles",
"=",
"this",
".",
"scanner... | Scans the source directory for grammar files that match at least one
inclusion pattern but no exclusion pattern, optionally performing timestamp
checking to exclude grammars whose corresponding parser files are up to date.
@throws IOException
If a grammar file could not be analyzed for metadata. | [
"Scans",
"the",
"source",
"directory",
"for",
"grammar",
"files",
"that",
"match",
"at",
"least",
"one",
"inclusion",
"pattern",
"but",
"no",
"exclusion",
"pattern",
"optionally",
"performing",
"timestamp",
"checking",
"to",
"exclude",
"grammars",
"whose",
"corres... | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/GrammarDirectoryScanner.java#L176-L204 |
109,242 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/GrammarDirectoryScanner.java | GrammarDirectoryScanner.getTargetFiles | protected File [] getTargetFiles (final File targetDirectory, final String grammarFile, final GrammarInfo grammarInfo)
{
final File parserFile = new File (targetDirectory, grammarInfo.getParserFile ());
return new File [] { parserFile };
} | java | protected File [] getTargetFiles (final File targetDirectory, final String grammarFile, final GrammarInfo grammarInfo)
{
final File parserFile = new File (targetDirectory, grammarInfo.getParserFile ());
return new File [] { parserFile };
} | [
"protected",
"File",
"[",
"]",
"getTargetFiles",
"(",
"final",
"File",
"targetDirectory",
",",
"final",
"String",
"grammarFile",
",",
"final",
"GrammarInfo",
"grammarInfo",
")",
"{",
"final",
"File",
"parserFile",
"=",
"new",
"File",
"(",
"targetDirectory",
",",... | Determines the output files corresponding to the specified grammar file.
@param targetDirectory
The absolute path to the output directory for the target files, must
not be <code>null</code>.
@param grammarFile
The path to the grammar file, relative to the scanned source
directory, must not be <code>null</code>.
@param... | [
"Determines",
"the",
"output",
"files",
"corresponding",
"to",
"the",
"specified",
"grammar",
"file",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/GrammarDirectoryScanner.java#L220-L224 |
109,243 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/GrammarInfo.java | GrammarInfo.findPackageName | private String findPackageName (final String grammar)
{
final String packageDeclaration = "package\\s+([^\\s.;]+(\\.[^\\s.;]+)*)\\s*;";
final Matcher matcher = Pattern.compile (packageDeclaration).matcher (grammar);
if (matcher.find ())
{
return matcher.group (1);
}
return "";
} | java | private String findPackageName (final String grammar)
{
final String packageDeclaration = "package\\s+([^\\s.;]+(\\.[^\\s.;]+)*)\\s*;";
final Matcher matcher = Pattern.compile (packageDeclaration).matcher (grammar);
if (matcher.find ())
{
return matcher.group (1);
}
return "";
} | [
"private",
"String",
"findPackageName",
"(",
"final",
"String",
"grammar",
")",
"{",
"final",
"String",
"packageDeclaration",
"=",
"\"package\\\\s+([^\\\\s.;]+(\\\\.[^\\\\s.;]+)*)\\\\s*;\"",
";",
"final",
"Matcher",
"matcher",
"=",
"Pattern",
".",
"compile",
"(",
"packa... | Extracts the declared package name from the specified grammar file.
@param grammar
The contents of the grammar file, must not be <code>null</code>.
@return The declared package name or an empty string if not found. | [
"Extracts",
"the",
"declared",
"package",
"name",
"from",
"the",
"specified",
"grammar",
"file",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/GrammarInfo.java#L171-L180 |
109,244 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/GrammarInfo.java | GrammarInfo.findParserName | private String findParserName (final String grammar)
{
final String parserBegin = "PARSER_BEGIN\\s*\\(\\s*([^\\s\\)]+)\\s*\\)";
final Matcher matcher = Pattern.compile (parserBegin).matcher (grammar);
if (matcher.find ())
{
return matcher.group (1);
}
return "";
} | java | private String findParserName (final String grammar)
{
final String parserBegin = "PARSER_BEGIN\\s*\\(\\s*([^\\s\\)]+)\\s*\\)";
final Matcher matcher = Pattern.compile (parserBegin).matcher (grammar);
if (matcher.find ())
{
return matcher.group (1);
}
return "";
} | [
"private",
"String",
"findParserName",
"(",
"final",
"String",
"grammar",
")",
"{",
"final",
"String",
"parserBegin",
"=",
"\"PARSER_BEGIN\\\\s*\\\\(\\\\s*([^\\\\s\\\\)]+)\\\\s*\\\\)\"",
";",
"final",
"Matcher",
"matcher",
"=",
"Pattern",
".",
"compile",
"(",
"parserBeg... | Extracts the simple parser name from the specified grammar file.
@param grammar
The contents of the grammar file, must not be <code>null</code>.
@return The parser name or an empty string if not found. | [
"Extracts",
"the",
"simple",
"parser",
"name",
"from",
"the",
"specified",
"grammar",
"file",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/GrammarInfo.java#L189-L198 |
109,245 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/AbstractToolFacade.java | AbstractToolFacade.getToolName | protected String getToolName ()
{
final String name = getClass ().getName ();
return name.substring (name.lastIndexOf ('.') + 1);
} | java | protected String getToolName ()
{
final String name = getClass ().getName ();
return name.substring (name.lastIndexOf ('.') + 1);
} | [
"protected",
"String",
"getToolName",
"(",
")",
"{",
"final",
"String",
"name",
"=",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
";",
"return",
"name",
".",
"substring",
"(",
"name",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
"+",
"1",
")",
";",
"... | Gets the name of the tool.
@return The name of the tool, never <code>null</code>. | [
"Gets",
"the",
"name",
"of",
"the",
"tool",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/AbstractToolFacade.java#L81-L85 |
109,246 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/AbstractToolFacade.java | AbstractToolFacade.run | public void run () throws MojoExecutionException, MojoFailureException
{
ESuccess exitCode;
try
{
if (getLog ().isDebugEnabled ())
{
getLog ().debug ("Running " + getToolName () + ": " + this);
}
exitCode = execute ();
}
catch (final Exception e)
{
throw n... | java | public void run () throws MojoExecutionException, MojoFailureException
{
ESuccess exitCode;
try
{
if (getLog ().isDebugEnabled ())
{
getLog ().debug ("Running " + getToolName () + ": " + this);
}
exitCode = execute ();
}
catch (final Exception e)
{
throw n... | [
"public",
"void",
"run",
"(",
")",
"throws",
"MojoExecutionException",
",",
"MojoFailureException",
"{",
"ESuccess",
"exitCode",
";",
"try",
"{",
"if",
"(",
"getLog",
"(",
")",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"getLog",
"(",
")",
".",
"debug",
... | Runs the tool using the previously set parameters.
@throws MojoExecutionException
If the tool could not be invoked.
@throws MojoFailureException
If the tool reported a non-zero exit code. | [
"Runs",
"the",
"tool",
"using",
"the",
"previously",
"set",
"parameters",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/AbstractToolFacade.java#L105-L124 |
109,247 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/JJDoc.java | JJDoc.setOutputFile | public void setOutputFile (final File value)
{
if (value != null && !value.isAbsolute ())
{
throw new IllegalArgumentException ("path is not absolute: " + value);
}
this.outputFile = value;
} | java | public void setOutputFile (final File value)
{
if (value != null && !value.isAbsolute ())
{
throw new IllegalArgumentException ("path is not absolute: " + value);
}
this.outputFile = value;
} | [
"public",
"void",
"setOutputFile",
"(",
"final",
"File",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
"&&",
"!",
"value",
".",
"isAbsolute",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"path is not absolute: \"",
"+",
"valu... | Sets the absolute path to the output file.
@param value
The absolute path to the HTML/text file to generate. | [
"Sets",
"the",
"absolute",
"path",
"to",
"the",
"output",
"file",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/JJDoc.java#L104-L111 |
109,248 | phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/JJDoc.java | JJDoc._generateArguments | private String [] _generateArguments ()
{
final List <String> argsList = new ArrayList <> ();
if (StringUtils.isNotEmpty (this.grammarEncoding))
{
argsList.add ("-GRAMMAR_ENCODING=" + this.grammarEncoding);
}
if (StringUtils.isNotEmpty (this.outputEncoding))
{
argsList.add ("-OUT... | java | private String [] _generateArguments ()
{
final List <String> argsList = new ArrayList <> ();
if (StringUtils.isNotEmpty (this.grammarEncoding))
{
argsList.add ("-GRAMMAR_ENCODING=" + this.grammarEncoding);
}
if (StringUtils.isNotEmpty (this.outputEncoding))
{
argsList.add ("-OUT... | [
"private",
"String",
"[",
"]",
"_generateArguments",
"(",
")",
"{",
"final",
"List",
"<",
"String",
">",
"argsList",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"StringUtils",
".",
"isNotEmpty",
"(",
"this",
".",
"grammarEncoding",
")",
")",... | Assembles the command line arguments for the invocation of JJDoc according
to the configuration.
@return A string array that represents the arguments to use for JJDoc. | [
"Assembles",
"the",
"command",
"line",
"arguments",
"for",
"the",
"invocation",
"of",
"JJDoc",
"according",
"to",
"the",
"configuration",
"."
] | 99497a971fe59ab2289258ca7ddcfa40e651f19f | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/JJDoc.java#L217-L262 |
109,249 | NextFaze/power-adapters | power-adapters/src/main/java/com/nextfaze/poweradapters/PowerAdapter.java | PowerAdapter.offset | @CheckResult
@NonNull
public final PowerAdapter offset(int offset) {
if (offset <= 0) {
return this;
}
if (offset == Integer.MAX_VALUE) {
return EMPTY;
}
return new OffsetAdapter(this, offset);
} | java | @CheckResult
@NonNull
public final PowerAdapter offset(int offset) {
if (offset <= 0) {
return this;
}
if (offset == Integer.MAX_VALUE) {
return EMPTY;
}
return new OffsetAdapter(this, offset);
} | [
"@",
"CheckResult",
"@",
"NonNull",
"public",
"final",
"PowerAdapter",
"offset",
"(",
"int",
"offset",
")",
"{",
"if",
"(",
"offset",
"<=",
"0",
")",
"{",
"return",
"this",
";",
"}",
"if",
"(",
"offset",
"==",
"Integer",
".",
"MAX_VALUE",
")",
"{",
"... | Returns a new adapter that presents all items of this adapter, starting at the specified offset.
@param offset The item offset.
@return A new adapter. | [
"Returns",
"a",
"new",
"adapter",
"that",
"presents",
"all",
"items",
"of",
"this",
"adapter",
"starting",
"at",
"the",
"specified",
"offset",
"."
] | cdf00b1b723ed9d6bcd549ae9741a19dd59651e1 | https://github.com/NextFaze/power-adapters/blob/cdf00b1b723ed9d6bcd549ae9741a19dd59651e1/power-adapters/src/main/java/com/nextfaze/poweradapters/PowerAdapter.java#L482-L492 |
109,250 | NextFaze/power-adapters | power-adapters/src/main/java/com/nextfaze/poweradapters/PowerAdapter.java | PowerAdapter.limit | @CheckResult
@NonNull
public final PowerAdapter limit(int limit) {
if (limit == Integer.MAX_VALUE) {
return this;
}
if (limit <= 0) {
return EMPTY;
}
return new LimitAdapter(this, limit);
} | java | @CheckResult
@NonNull
public final PowerAdapter limit(int limit) {
if (limit == Integer.MAX_VALUE) {
return this;
}
if (limit <= 0) {
return EMPTY;
}
return new LimitAdapter(this, limit);
} | [
"@",
"CheckResult",
"@",
"NonNull",
"public",
"final",
"PowerAdapter",
"limit",
"(",
"int",
"limit",
")",
"{",
"if",
"(",
"limit",
"==",
"Integer",
".",
"MAX_VALUE",
")",
"{",
"return",
"this",
";",
"}",
"if",
"(",
"limit",
"<=",
"0",
")",
"{",
"retu... | Returns a new adapter that presents all items of this adapter, up until the specified limit.
@param limit The item limit.
@return A new adapter. | [
"Returns",
"a",
"new",
"adapter",
"that",
"presents",
"all",
"items",
"of",
"this",
"adapter",
"up",
"until",
"the",
"specified",
"limit",
"."
] | cdf00b1b723ed9d6bcd549ae9741a19dd59651e1 | https://github.com/NextFaze/power-adapters/blob/cdf00b1b723ed9d6bcd549ae9741a19dd59651e1/power-adapters/src/main/java/com/nextfaze/poweradapters/PowerAdapter.java#L499-L509 |
109,251 | NextFaze/power-adapters | power-adapters-data/src/main/java/com/nextfaze/poweradapters/data/widget/DataLayout.java | DataLayout.shouldAnimate | private boolean shouldAnimate() {
if (!mAnimationEnabled) {
return false;
}
Display display = currentDisplay();
if (display == null) {
return false;
}
if (mVisibleStartTime <= 0) {
return false;
}
long threshold = (long)... | java | private boolean shouldAnimate() {
if (!mAnimationEnabled) {
return false;
}
Display display = currentDisplay();
if (display == null) {
return false;
}
if (mVisibleStartTime <= 0) {
return false;
}
long threshold = (long)... | [
"private",
"boolean",
"shouldAnimate",
"(",
")",
"{",
"if",
"(",
"!",
"mAnimationEnabled",
")",
"{",
"return",
"false",
";",
"}",
"Display",
"display",
"=",
"currentDisplay",
"(",
")",
";",
"if",
"(",
"display",
"==",
"null",
")",
"{",
"return",
"false",... | Returns whether now is an appropriate time to perform animations. | [
"Returns",
"whether",
"now",
"is",
"an",
"appropriate",
"time",
"to",
"perform",
"animations",
"."
] | cdf00b1b723ed9d6bcd549ae9741a19dd59651e1 | https://github.com/NextFaze/power-adapters/blob/cdf00b1b723ed9d6bcd549ae9741a19dd59651e1/power-adapters-data/src/main/java/com/nextfaze/poweradapters/data/widget/DataLayout.java#L733-L747 |
109,252 | NextFaze/power-adapters | power-adapters/src/main/java/com/nextfaze/poweradapters/Condition.java | Condition.notifyChanged | protected final void notifyChanged() {
for (int i = mObservers.size() - 1; i >= 0; i--) {
mObservers.get(i).onChanged();
}
} | java | protected final void notifyChanged() {
for (int i = mObservers.size() - 1; i >= 0; i--) {
mObservers.get(i).onChanged();
}
} | [
"protected",
"final",
"void",
"notifyChanged",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"mObservers",
".",
"size",
"(",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"mObservers",
".",
"get",
"(",
"i",
")",
".",
"onChanged",
... | Notify observers that the condition has changed. | [
"Notify",
"observers",
"that",
"the",
"condition",
"has",
"changed",
"."
] | cdf00b1b723ed9d6bcd549ae9741a19dd59651e1 | https://github.com/NextFaze/power-adapters/blob/cdf00b1b723ed9d6bcd549ae9741a19dd59651e1/power-adapters/src/main/java/com/nextfaze/poweradapters/Condition.java#L36-L40 |
109,253 | NextFaze/power-adapters | power-adapters-data/src/main/java/com/nextfaze/poweradapters/data/Data.java | Data.notifyError | protected final void notifyError(@NonNull final Throwable e) {
//noinspection ThrowableResultOfMethodCallIgnored
checkNotNull(e, "e");
runOnUiThread(new Runnable() {
@Override
public void run() {
mErrorObservable.notifyError(e);
}
});
... | java | protected final void notifyError(@NonNull final Throwable e) {
//noinspection ThrowableResultOfMethodCallIgnored
checkNotNull(e, "e");
runOnUiThread(new Runnable() {
@Override
public void run() {
mErrorObservable.notifyError(e);
}
});
... | [
"protected",
"final",
"void",
"notifyError",
"(",
"@",
"NonNull",
"final",
"Throwable",
"e",
")",
"{",
"//noinspection ThrowableResultOfMethodCallIgnored",
"checkNotNull",
"(",
"e",
",",
"\"e\"",
")",
";",
"runOnUiThread",
"(",
"new",
"Runnable",
"(",
")",
"{",
... | Dispatch an error notification on the UI thread. | [
"Dispatch",
"an",
"error",
"notification",
"on",
"the",
"UI",
"thread",
"."
] | cdf00b1b723ed9d6bcd549ae9741a19dd59651e1 | https://github.com/NextFaze/power-adapters/blob/cdf00b1b723ed9d6bcd549ae9741a19dd59651e1/power-adapters-data/src/main/java/com/nextfaze/poweradapters/data/Data.java#L420-L429 |
109,254 | NextFaze/power-adapters | power-adapters-data/src/main/java/com/nextfaze/poweradapters/data/Data.java | Data.filter | @CheckResult
@NonNull
public final <O> Data<O> filter(@NonNull final Class<O> type) {
//noinspection unchecked
return (Data<O>) new FilterData<>(this, new Predicate<Object>() {
@Override
public boolean apply(Object o) {
return type.isInstance(o);
... | java | @CheckResult
@NonNull
public final <O> Data<O> filter(@NonNull final Class<O> type) {
//noinspection unchecked
return (Data<O>) new FilterData<>(this, new Predicate<Object>() {
@Override
public boolean apply(Object o) {
return type.isInstance(o);
... | [
"@",
"CheckResult",
"@",
"NonNull",
"public",
"final",
"<",
"O",
">",
"Data",
"<",
"O",
">",
"filter",
"(",
"@",
"NonNull",
"final",
"Class",
"<",
"O",
">",
"type",
")",
"{",
"//noinspection unchecked",
"return",
"(",
"Data",
"<",
"O",
">",
")",
"new... | Filter this data by class. The resulting elements are guaranteed to be of the given type. | [
"Filter",
"this",
"data",
"by",
"class",
".",
"The",
"resulting",
"elements",
"are",
"guaranteed",
"to",
"be",
"of",
"the",
"given",
"type",
"."
] | cdf00b1b723ed9d6bcd549ae9741a19dd59651e1 | https://github.com/NextFaze/power-adapters/blob/cdf00b1b723ed9d6bcd549ae9741a19dd59651e1/power-adapters-data/src/main/java/com/nextfaze/poweradapters/data/Data.java#L457-L467 |
109,255 | NextFaze/power-adapters | power-adapters-data/src/main/java/com/nextfaze/poweradapters/data/IncrementalArrayData.java | IncrementalArrayData.loadLoop | private void loadLoop() throws InterruptedException {
boolean firstItem = true;
boolean moreAvailable = true;
// Loop until all loaded.
while (moreAvailable) {
// Thread interruptions terminate the loop.
if (currentThread().isInterrupted()) {
thro... | java | private void loadLoop() throws InterruptedException {
boolean firstItem = true;
boolean moreAvailable = true;
// Loop until all loaded.
while (moreAvailable) {
// Thread interruptions terminate the loop.
if (currentThread().isInterrupted()) {
thro... | [
"private",
"void",
"loadLoop",
"(",
")",
"throws",
"InterruptedException",
"{",
"boolean",
"firstItem",
"=",
"true",
";",
"boolean",
"moreAvailable",
"=",
"true",
";",
"// Loop until all loaded.",
"while",
"(",
"moreAvailable",
")",
"{",
"// Thread interruptions termi... | Loads each increment until full range has been loading, halting in between increment until instructed to
proceed. | [
"Loads",
"each",
"increment",
"until",
"full",
"range",
"has",
"been",
"loading",
"halting",
"in",
"between",
"increment",
"until",
"instructed",
"to",
"proceed",
"."
] | cdf00b1b723ed9d6bcd549ae9741a19dd59651e1 | https://github.com/NextFaze/power-adapters/blob/cdf00b1b723ed9d6bcd549ae9741a19dd59651e1/power-adapters-data/src/main/java/com/nextfaze/poweradapters/data/IncrementalArrayData.java#L228-L283 |
109,256 | NextFaze/power-adapters | power-adapters-data/src/main/java/com/nextfaze/poweradapters/data/CursorData.java | CursorData.updateCursorObserver | private void updateCursorObserver() {
Cursor newObservedCursor = getDataObserverCount() > 0 ? mCursor : null;
if (newObservedCursor != mObservedCursor) {
if (mObservedCursor != null) {
mObservedCursor.unregisterContentObserver(mCursorContentObserver);
}
... | java | private void updateCursorObserver() {
Cursor newObservedCursor = getDataObserverCount() > 0 ? mCursor : null;
if (newObservedCursor != mObservedCursor) {
if (mObservedCursor != null) {
mObservedCursor.unregisterContentObserver(mCursorContentObserver);
}
... | [
"private",
"void",
"updateCursorObserver",
"(",
")",
"{",
"Cursor",
"newObservedCursor",
"=",
"getDataObserverCount",
"(",
")",
">",
"0",
"?",
"mCursor",
":",
"null",
";",
"if",
"(",
"newObservedCursor",
"!=",
"mObservedCursor",
")",
"{",
"if",
"(",
"mObserved... | Registers or unregisters with the cursor. Idempotent. | [
"Registers",
"or",
"unregisters",
"with",
"the",
"cursor",
".",
"Idempotent",
"."
] | cdf00b1b723ed9d6bcd549ae9741a19dd59651e1 | https://github.com/NextFaze/power-adapters/blob/cdf00b1b723ed9d6bcd549ae9741a19dd59651e1/power-adapters-data/src/main/java/com/nextfaze/poweradapters/data/CursorData.java#L208-L219 |
109,257 | NextFaze/power-adapters | power-adapters-data/src/main/java/com/nextfaze/poweradapters/data/CursorData.java | CursorData.closeCursor | private void closeCursor() {
if (mCursor != null) {
int count = mCursor.getCount();
mCursor.close();
mCursor = null;
notifyItemRangeRemoved(0, count);
}
updateCursorObserver();
} | java | private void closeCursor() {
if (mCursor != null) {
int count = mCursor.getCount();
mCursor.close();
mCursor = null;
notifyItemRangeRemoved(0, count);
}
updateCursorObserver();
} | [
"private",
"void",
"closeCursor",
"(",
")",
"{",
"if",
"(",
"mCursor",
"!=",
"null",
")",
"{",
"int",
"count",
"=",
"mCursor",
".",
"getCount",
"(",
")",
";",
"mCursor",
".",
"close",
"(",
")",
";",
"mCursor",
"=",
"null",
";",
"notifyItemRangeRemoved"... | Closes the cursor, notifying observers of data changes as necessary. | [
"Closes",
"the",
"cursor",
"notifying",
"observers",
"of",
"data",
"changes",
"as",
"necessary",
"."
] | cdf00b1b723ed9d6bcd549ae9741a19dd59651e1 | https://github.com/NextFaze/power-adapters/blob/cdf00b1b723ed9d6bcd549ae9741a19dd59651e1/power-adapters-data/src/main/java/com/nextfaze/poweradapters/data/CursorData.java#L222-L230 |
109,258 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/util/XmlPrintStream.java | XmlPrintStream.printElement | public void printElement(String elementName, Object value) {
println("<" + elementName + ">" + (value == null ? "" : escape(value.toString())) + "</" + elementName + ">");
} | java | public void printElement(String elementName, Object value) {
println("<" + elementName + ">" + (value == null ? "" : escape(value.toString())) + "</" + elementName + ">");
} | [
"public",
"void",
"printElement",
"(",
"String",
"elementName",
",",
"Object",
"value",
")",
"{",
"println",
"(",
"\"<\"",
"+",
"elementName",
"+",
"\">\"",
"+",
"(",
"value",
"==",
"null",
"?",
"\"\"",
":",
"escape",
"(",
"value",
".",
"toString",
"(",
... | Output a complete element with the given content.
@param elementName Name of element.
@param value Content of element. | [
"Output",
"a",
"complete",
"element",
"with",
"the",
"given",
"content",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/util/XmlPrintStream.java#L109-L111 |
109,259 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/util/XmlPrintStream.java | XmlPrintStream.printElement | public void printElement(String elementName, String value, Map<String, String> attributes) {
print("<" + elementName);
for (Entry<String, String> entry : attributes.entrySet()) {
print(" " + entry.getKey() + "=\"" + escape(entry.getValue()) + "\"");
}
if (value != null) {
println(">" + esc... | java | public void printElement(String elementName, String value, Map<String, String> attributes) {
print("<" + elementName);
for (Entry<String, String> entry : attributes.entrySet()) {
print(" " + entry.getKey() + "=\"" + escape(entry.getValue()) + "\"");
}
if (value != null) {
println(">" + esc... | [
"public",
"void",
"printElement",
"(",
"String",
"elementName",
",",
"String",
"value",
",",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"{",
"print",
"(",
"\"<\"",
"+",
"elementName",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
... | Output a complete element with the given content and attributes.
@param elementName Name of element.
@param value Content of element.
@param attributes A map of name value pairs which will be used to add attributes to
the element. | [
"Output",
"a",
"complete",
"element",
"with",
"the",
"given",
"content",
"and",
"attributes",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/util/XmlPrintStream.java#L133-L145 |
109,260 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/util/XmlPrintStream.java | XmlPrintStream.escape | public String escape(String in) {
StringBuffer out = new StringBuffer();
for (char c : in.toCharArray()) {
switch (c) {
case '<':
out.append("<");
break;
case '>':
out.append(">");
break;
case '&':
out.append("&");
... | java | public String escape(String in) {
StringBuffer out = new StringBuffer();
for (char c : in.toCharArray()) {
switch (c) {
case '<':
out.append("<");
break;
case '>':
out.append(">");
break;
case '&':
out.append("&");
... | [
"public",
"String",
"escape",
"(",
"String",
"in",
")",
"{",
"StringBuffer",
"out",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"char",
"c",
":",
"in",
".",
"toCharArray",
"(",
")",
")",
"{",
"switch",
"(",
"c",
")",
"{",
"case",
"'",
... | Translate reserved XML characters to XML entities.
@param in Input string. | [
"Translate",
"reserved",
"XML",
"characters",
"to",
"XML",
"entities",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/util/XmlPrintStream.java#L167-L190 |
109,261 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/util/XmlPrintStream.java | XmlPrintStream.removeNewLines | public static String removeNewLines(String textContent) {
if (textContent == null) {
return "";
}
StringBuilder s = new StringBuilder();
boolean inNl = false;
for (char c : textContent.toCharArray()) {
if (c == '\n') {
if (!inNl) {
s.append(' ');
inNl = true... | java | public static String removeNewLines(String textContent) {
if (textContent == null) {
return "";
}
StringBuilder s = new StringBuilder();
boolean inNl = false;
for (char c : textContent.toCharArray()) {
if (c == '\n') {
if (!inNl) {
s.append(' ');
inNl = true... | [
"public",
"static",
"String",
"removeNewLines",
"(",
"String",
"textContent",
")",
"{",
"if",
"(",
"textContent",
"==",
"null",
")",
"{",
"return",
"\"\"",
";",
"}",
"StringBuilder",
"s",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"boolean",
"inNl",
"=",
... | Replace multiple newline characters with a single space.
@param textContent input String | [
"Replace",
"multiple",
"newline",
"characters",
"with",
"a",
"single",
"space",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/util/XmlPrintStream.java#L196-L216 |
109,262 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java | Element.buildAll | public void buildAll(MessageMLParser context, org.w3c.dom.Element element) throws InvalidInputException,
ProcessingException {
NamedNodeMap attr = element.getAttributes();
for (int i = 0; i < attr.getLength(); i++) {
buildAttribute(attr.item(i));
}
NodeList children = element.getChildNodes... | java | public void buildAll(MessageMLParser context, org.w3c.dom.Element element) throws InvalidInputException,
ProcessingException {
NamedNodeMap attr = element.getAttributes();
for (int i = 0; i < attr.getLength(); i++) {
buildAttribute(attr.item(i));
}
NodeList children = element.getChildNodes... | [
"public",
"void",
"buildAll",
"(",
"MessageMLParser",
"context",
",",
"org",
".",
"w3c",
".",
"dom",
".",
"Element",
"element",
")",
"throws",
"InvalidInputException",
",",
"ProcessingException",
"{",
"NamedNodeMap",
"attr",
"=",
"element",
".",
"getAttributes",
... | Process a DOM element, descending into its children, and construct the output MessageML tree. | [
"Process",
"a",
"DOM",
"element",
"descending",
"into",
"its",
"children",
"and",
"construct",
"the",
"output",
"MessageML",
"tree",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java#L80-L93 |
109,263 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java | Element.buildAttribute | void buildAttribute(org.w3c.dom.Node item) throws InvalidInputException {
switch (item.getNodeName()) {
case CLASS_ATTR:
attributes.put(CLASS_ATTR, getStringAttribute(item));
break;
case STYLE_ATTR:
final String styleAttribute = getStringAttribute(item);
Styles.validate(s... | java | void buildAttribute(org.w3c.dom.Node item) throws InvalidInputException {
switch (item.getNodeName()) {
case CLASS_ATTR:
attributes.put(CLASS_ATTR, getStringAttribute(item));
break;
case STYLE_ATTR:
final String styleAttribute = getStringAttribute(item);
Styles.validate(s... | [
"void",
"buildAttribute",
"(",
"org",
".",
"w3c",
".",
"dom",
".",
"Node",
"item",
")",
"throws",
"InvalidInputException",
"{",
"switch",
"(",
"item",
".",
"getNodeName",
"(",
")",
")",
"{",
"case",
"CLASS_ATTR",
":",
"attributes",
".",
"put",
"(",
"CLAS... | Parse a DOM attribute into MessageML element properties. | [
"Parse",
"a",
"DOM",
"attribute",
"into",
"MessageML",
"element",
"properties",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java#L98-L112 |
109,264 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java | Element.buildNode | private void buildNode(MessageMLParser context, org.w3c.dom.Node node) throws InvalidInputException, ProcessingException {
switch (node.getNodeType()) {
case org.w3c.dom.Node.TEXT_NODE:
buildText((Text) node);
break;
case org.w3c.dom.Node.ELEMENT_NODE:
buildElement(context, (org... | java | private void buildNode(MessageMLParser context, org.w3c.dom.Node node) throws InvalidInputException, ProcessingException {
switch (node.getNodeType()) {
case org.w3c.dom.Node.TEXT_NODE:
buildText((Text) node);
break;
case org.w3c.dom.Node.ELEMENT_NODE:
buildElement(context, (org... | [
"private",
"void",
"buildNode",
"(",
"MessageMLParser",
"context",
",",
"org",
".",
"w3c",
".",
"dom",
".",
"Node",
"node",
")",
"throws",
"InvalidInputException",
",",
"ProcessingException",
"{",
"switch",
"(",
"node",
".",
"getNodeType",
"(",
")",
")",
"{"... | Build a text node or a MessageML element based on the provided DOM node. | [
"Build",
"a",
"text",
"node",
"or",
"a",
"MessageML",
"element",
"based",
"on",
"the",
"provided",
"DOM",
"node",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java#L117-L131 |
109,265 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java | Element.buildElement | private void buildElement(MessageMLParser context, org.w3c.dom.Element element) throws InvalidInputException,
ProcessingException {
Element child = context.createElement(element, this);
child.buildAll(context, element);
child.validate();
addChild(child);
} | java | private void buildElement(MessageMLParser context, org.w3c.dom.Element element) throws InvalidInputException,
ProcessingException {
Element child = context.createElement(element, this);
child.buildAll(context, element);
child.validate();
addChild(child);
} | [
"private",
"void",
"buildElement",
"(",
"MessageMLParser",
"context",
",",
"org",
".",
"w3c",
".",
"dom",
".",
"Element",
"element",
")",
"throws",
"InvalidInputException",
",",
"ProcessingException",
"{",
"Element",
"child",
"=",
"context",
".",
"createElement",
... | Build a MessageML element based on the provided DOM element and descend into its children. | [
"Build",
"a",
"MessageML",
"element",
"based",
"on",
"the",
"provided",
"DOM",
"element",
"and",
"descend",
"into",
"its",
"children",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java#L136-L142 |
109,266 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java | Element.buildMarkdown | void buildMarkdown(Node parent) throws InvalidInputException {
for (Element child : this.children) {
Node node = child.asMarkdown();
if (node != null) {
parent.appendChild(node);
} else {
node = parent;
}
child.buildMarkdown(node);
}
} | java | void buildMarkdown(Node parent) throws InvalidInputException {
for (Element child : this.children) {
Node node = child.asMarkdown();
if (node != null) {
parent.appendChild(node);
} else {
node = parent;
}
child.buildMarkdown(node);
}
} | [
"void",
"buildMarkdown",
"(",
"Node",
"parent",
")",
"throws",
"InvalidInputException",
"{",
"for",
"(",
"Element",
"child",
":",
"this",
".",
"children",
")",
"{",
"Node",
"node",
"=",
"child",
".",
"asMarkdown",
"(",
")",
";",
"if",
"(",
"node",
"!=",
... | Traverse the element and its children to construct its representation as a Markdown tree. | [
"Traverse",
"the",
"element",
"and",
"its",
"children",
"to",
"construct",
"its",
"representation",
"as",
"a",
"Markdown",
"tree",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java#L154-L165 |
109,267 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java | Element.buildEntityJson | void buildEntityJson(ObjectNode parent) {
for (Element child : this.children) {
ObjectNode node = child.asEntityJson(parent);
if (node != null) {
child.buildEntityJson(node);
} else {
child.buildEntityJson(parent);
}
}
} | java | void buildEntityJson(ObjectNode parent) {
for (Element child : this.children) {
ObjectNode node = child.asEntityJson(parent);
if (node != null) {
child.buildEntityJson(node);
} else {
child.buildEntityJson(parent);
}
}
} | [
"void",
"buildEntityJson",
"(",
"ObjectNode",
"parent",
")",
"{",
"for",
"(",
"Element",
"child",
":",
"this",
".",
"children",
")",
"{",
"ObjectNode",
"node",
"=",
"child",
".",
"asEntityJson",
"(",
"parent",
")",
";",
"if",
"(",
"node",
"!=",
"null",
... | Traverse the element and its children to construct its representation as EntityJSON nodes. | [
"Traverse",
"the",
"element",
"and",
"its",
"children",
"to",
"construct",
"its",
"representation",
"as",
"EntityJSON",
"nodes",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java#L170-L180 |
109,268 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java | Element.asPresentationML | void asPresentationML(XmlPrintStream out) {
out.openElement(getMessageMLTag(), getAttributes());
for (Element child : getChildren()) {
child.asPresentationML(out);
}
out.closeElement();
} | java | void asPresentationML(XmlPrintStream out) {
out.openElement(getMessageMLTag(), getAttributes());
for (Element child : getChildren()) {
child.asPresentationML(out);
}
out.closeElement();
} | [
"void",
"asPresentationML",
"(",
"XmlPrintStream",
"out",
")",
"{",
"out",
".",
"openElement",
"(",
"getMessageMLTag",
"(",
")",
",",
"getAttributes",
"(",
")",
")",
";",
"for",
"(",
"Element",
"child",
":",
"getChildren",
"(",
")",
")",
"{",
"child",
".... | Print a PresentationML representation of the element and its children to the provided PrintStream. | [
"Print",
"a",
"PresentationML",
"representation",
"of",
"the",
"element",
"and",
"its",
"children",
"to",
"the",
"provided",
"PrintStream",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java#L192-L200 |
109,269 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java | Element.asText | public String asText() {
StringBuilder b = new StringBuilder();
for (Element child : children) {
b.append(child.asText());
}
return b.toString();
} | java | public String asText() {
StringBuilder b = new StringBuilder();
for (Element child : children) {
b.append(child.asText());
}
return b.toString();
} | [
"public",
"String",
"asText",
"(",
")",
"{",
"StringBuilder",
"b",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"Element",
"child",
":",
"children",
")",
"{",
"b",
".",
"append",
"(",
"child",
".",
"asText",
"(",
")",
")",
";",
"}",
"ret... | Return a text representation of the element, descending into its children. | [
"Return",
"a",
"text",
"representation",
"of",
"the",
"element",
"descending",
"into",
"its",
"children",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java#L205-L213 |
109,270 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java | Element.getLongAttribute | Long getLongAttribute(org.w3c.dom.Node attribute) throws InvalidInputException {
String s = getStringAttribute(attribute);
if (s == null) {
return null;
}
try {
return Long.parseLong(s);
} catch (NumberFormatException e) {
throw new InvalidInputException("Invalid input: " + attri... | java | Long getLongAttribute(org.w3c.dom.Node attribute) throws InvalidInputException {
String s = getStringAttribute(attribute);
if (s == null) {
return null;
}
try {
return Long.parseLong(s);
} catch (NumberFormatException e) {
throw new InvalidInputException("Invalid input: " + attri... | [
"Long",
"getLongAttribute",
"(",
"org",
".",
"w3c",
".",
"dom",
".",
"Node",
"attribute",
")",
"throws",
"InvalidInputException",
"{",
"String",
"s",
"=",
"getStringAttribute",
"(",
"attribute",
")",
";",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"return",
... | Get a DOM attribute as a Long value. | [
"Get",
"a",
"DOM",
"attribute",
"as",
"a",
"Long",
"value",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java#L238-L251 |
109,271 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java | Element.getBooleanAttribute | Boolean getBooleanAttribute(org.w3c.dom.Node attribute) {
String s = getStringAttribute(attribute);
if (s == null) {
return null;
}
return Boolean.parseBoolean(s);
} | java | Boolean getBooleanAttribute(org.w3c.dom.Node attribute) {
String s = getStringAttribute(attribute);
if (s == null) {
return null;
}
return Boolean.parseBoolean(s);
} | [
"Boolean",
"getBooleanAttribute",
"(",
"org",
".",
"w3c",
".",
"dom",
".",
"Node",
"attribute",
")",
"{",
"String",
"s",
"=",
"getStringAttribute",
"(",
"attribute",
")",
";",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return"... | Get a DOM attribute as a Boolean value. | [
"Get",
"a",
"DOM",
"attribute",
"as",
"a",
"Boolean",
"value",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java#L256-L264 |
109,272 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java | Element.getUrlAttribute | URI getUrlAttribute(org.w3c.dom.Node attribute) throws InvalidInputException {
String s = getStringAttribute(attribute);
if (s == null) {
return null;
}
try {
return new URI(s);
} catch (URISyntaxException e) {
throw new InvalidInputException("Invalid input: " + attribute.getLoca... | java | URI getUrlAttribute(org.w3c.dom.Node attribute) throws InvalidInputException {
String s = getStringAttribute(attribute);
if (s == null) {
return null;
}
try {
return new URI(s);
} catch (URISyntaxException e) {
throw new InvalidInputException("Invalid input: " + attribute.getLoca... | [
"URI",
"getUrlAttribute",
"(",
"org",
".",
"w3c",
".",
"dom",
".",
"Node",
"attribute",
")",
"throws",
"InvalidInputException",
"{",
"String",
"s",
"=",
"getStringAttribute",
"(",
"attribute",
")",
";",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"return",
"... | Get a DOM attribute as a URI. | [
"Get",
"a",
"DOM",
"attribute",
"as",
"a",
"URI",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java#L269-L282 |
109,273 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java | Element.assertNoText | void assertNoText() throws InvalidInputException {
for (Element child : this.getChildren())
if (child instanceof TextNode && StringUtils.isNotBlank(((TextNode) child).getText())) {
throw new InvalidInputException("Element \"" + this.getMessageMLTag() + "\" may not have text content");
}
} | java | void assertNoText() throws InvalidInputException {
for (Element child : this.getChildren())
if (child instanceof TextNode && StringUtils.isNotBlank(((TextNode) child).getText())) {
throw new InvalidInputException("Element \"" + this.getMessageMLTag() + "\" may not have text content");
}
} | [
"void",
"assertNoText",
"(",
")",
"throws",
"InvalidInputException",
"{",
"for",
"(",
"Element",
"child",
":",
"this",
".",
"getChildren",
"(",
")",
")",
"if",
"(",
"child",
"instanceof",
"TextNode",
"&&",
"StringUtils",
".",
"isNotBlank",
"(",
"(",
"(",
"... | Check that the element has no text content. | [
"Check",
"that",
"the",
"element",
"has",
"no",
"text",
"content",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java#L306-L311 |
109,274 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java | Element.assertPhrasingContent | void assertPhrasingContent() throws InvalidInputException {
assertContentModel(Arrays.asList(TextNode.class, Link.class, Chime.class, Bold.class, Italic.class, Image.class,
LineBreak.class, Span.class, Emoji.class, HashTag.class, CashTag.class, Mention.class));
} | java | void assertPhrasingContent() throws InvalidInputException {
assertContentModel(Arrays.asList(TextNode.class, Link.class, Chime.class, Bold.class, Italic.class, Image.class,
LineBreak.class, Span.class, Emoji.class, HashTag.class, CashTag.class, Mention.class));
} | [
"void",
"assertPhrasingContent",
"(",
")",
"throws",
"InvalidInputException",
"{",
"assertContentModel",
"(",
"Arrays",
".",
"asList",
"(",
"TextNode",
".",
"class",
",",
"Link",
".",
"class",
",",
"Chime",
".",
"class",
",",
"Bold",
".",
"class",
",",
"Ital... | Check that the element's children are limited to phrasing content.
@throws InvalidInputException | [
"Check",
"that",
"the",
"element",
"s",
"children",
"are",
"limited",
"to",
"phrasing",
"content",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java#L317-L320 |
109,275 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java | Element.assertContentModel | void assertContentModel(Collection<Class<? extends Element>> permittedChildren) throws InvalidInputException {
for (Element child : this.getChildren()) {
if (!permittedChildren.contains(child.getClass())) {
//Permit whitespace
if (child instanceof TextNode && StringUtils.isBlank(((TextNode) c... | java | void assertContentModel(Collection<Class<? extends Element>> permittedChildren) throws InvalidInputException {
for (Element child : this.getChildren()) {
if (!permittedChildren.contains(child.getClass())) {
//Permit whitespace
if (child instanceof TextNode && StringUtils.isBlank(((TextNode) c... | [
"void",
"assertContentModel",
"(",
"Collection",
"<",
"Class",
"<",
"?",
"extends",
"Element",
">",
">",
"permittedChildren",
")",
"throws",
"InvalidInputException",
"{",
"for",
"(",
"Element",
"child",
":",
"this",
".",
"getChildren",
"(",
")",
")",
"{",
"i... | Check that the element's children are limited to allowed element types. | [
"Check",
"that",
"the",
"element",
"s",
"children",
"are",
"limited",
"to",
"allowed",
"element",
"types",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java#L325-L338 |
109,276 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java | Element.assertParent | void assertParent(Collection<Class<? extends Element>> permittedParents) throws InvalidInputException {
if (!permittedParents.contains(this.getParent().getClass())) {
throw new InvalidInputException("Element \"" + this.getMessageMLTag() + "\" is not allowed as a child of \""
+ this.getParent().getMe... | java | void assertParent(Collection<Class<? extends Element>> permittedParents) throws InvalidInputException {
if (!permittedParents.contains(this.getParent().getClass())) {
throw new InvalidInputException("Element \"" + this.getMessageMLTag() + "\" is not allowed as a child of \""
+ this.getParent().getMe... | [
"void",
"assertParent",
"(",
"Collection",
"<",
"Class",
"<",
"?",
"extends",
"Element",
">",
">",
"permittedParents",
")",
"throws",
"InvalidInputException",
"{",
"if",
"(",
"!",
"permittedParents",
".",
"contains",
"(",
"this",
".",
"getParent",
"(",
")",
... | Check that the element's allowed parents are limited to the specified element types. | [
"Check",
"that",
"the",
"element",
"s",
"allowed",
"parents",
"are",
"limited",
"to",
"the",
"specified",
"element",
"types",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java#L343-L348 |
109,277 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/markdown/MarkdownRenderer.java | MarkdownRenderer.visitChildren | private void visitChildren(Node parent, Collection<Class<? extends Node>> includeNodes) {
Node child = parent.getFirstChild();
while (child != null) {
// A subclass of this visitor might modify the node, resulting in getNext returning a different node or no
// node after visiting it. So get the next... | java | private void visitChildren(Node parent, Collection<Class<? extends Node>> includeNodes) {
Node child = parent.getFirstChild();
while (child != null) {
// A subclass of this visitor might modify the node, resulting in getNext returning a different node or no
// node after visiting it. So get the next... | [
"private",
"void",
"visitChildren",
"(",
"Node",
"parent",
",",
"Collection",
"<",
"Class",
"<",
"?",
"extends",
"Node",
">",
">",
"includeNodes",
")",
"{",
"Node",
"child",
"=",
"parent",
".",
"getFirstChild",
"(",
")",
";",
"while",
"(",
"child",
"!=",... | Recursively visit the children of the node, processing only those specified by the parameter "includeNodes". | [
"Recursively",
"visit",
"the",
"children",
"of",
"the",
"node",
"processing",
"only",
"those",
"specified",
"by",
"the",
"parameter",
"includeNodes",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/markdown/MarkdownRenderer.java#L341-L354 |
109,278 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/entityjson/StructuredObject.java | StructuredObject.validate | public IEntityJsonSchemaContext validate(EntityJsonParser parser) throws SchemaValidationException, NoSchemaException, InvalidSchemaException
{
StringBuffer ubuf = new StringBuffer("https://symphonyosf.github.io/symphony-object/proposed");
for(String part : type_.split("\\."))
{
ubuf.append("/"... | java | public IEntityJsonSchemaContext validate(EntityJsonParser parser) throws SchemaValidationException, NoSchemaException, InvalidSchemaException
{
StringBuffer ubuf = new StringBuffer("https://symphonyosf.github.io/symphony-object/proposed");
for(String part : type_.split("\\."))
{
ubuf.append("/"... | [
"public",
"IEntityJsonSchemaContext",
"validate",
"(",
"EntityJsonParser",
"parser",
")",
"throws",
"SchemaValidationException",
",",
"NoSchemaException",
",",
"InvalidSchemaException",
"{",
"StringBuffer",
"ubuf",
"=",
"new",
"StringBuffer",
"(",
"\"https://symphonyosf.githu... | Validate this object against the specific schema for this type from the official repo.
@param parser A parser to do the validation.
@return A context containing the detailed error report if any.
@throws SchemaValidationException If this object is not valid according to it's schema.
@throws NoSchemaException ... | [
"Validate",
"this",
"object",
"against",
"the",
"specific",
"schema",
"for",
"this",
"type",
"from",
"the",
"official",
"repo",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/entityjson/StructuredObject.java#L143-L167 |
109,279 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/markdown/MarkdownParser.java | MarkdownParser.enrichMarkdown | private String enrichMarkdown(String message, JsonNode entitiesNode, JsonNode mediaNode) throws InvalidInputException {
TreeMap<Integer, JsonNode> entities = new TreeMap<>();
TreeMap<Integer, JsonNode> media = new TreeMap<>();
if (entitiesNode != null) {
validateEntities(entitiesNode);
for (Js... | java | private String enrichMarkdown(String message, JsonNode entitiesNode, JsonNode mediaNode) throws InvalidInputException {
TreeMap<Integer, JsonNode> entities = new TreeMap<>();
TreeMap<Integer, JsonNode> media = new TreeMap<>();
if (entitiesNode != null) {
validateEntities(entitiesNode);
for (Js... | [
"private",
"String",
"enrichMarkdown",
"(",
"String",
"message",
",",
"JsonNode",
"entitiesNode",
",",
"JsonNode",
"mediaNode",
")",
"throws",
"InvalidInputException",
"{",
"TreeMap",
"<",
"Integer",
",",
"JsonNode",
">",
"entities",
"=",
"new",
"TreeMap",
"<>",
... | Generate intermediate markup to delimit custom nodes representing entities for further processing by the
Markdown parser. | [
"Generate",
"intermediate",
"markup",
"to",
"delimit",
"custom",
"nodes",
"representing",
"entities",
"for",
"further",
"processing",
"by",
"the",
"Markdown",
"parser",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/markdown/MarkdownParser.java#L282-L346 |
109,280 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/markdown/MarkdownParser.java | MarkdownParser.validateEntities | private void validateEntities(JsonNode data) throws InvalidInputException {
for (JsonNode node : data.findParents(INDEX_START)) {
for (String key : new String[] {INDEX_START, INDEX_END, ID, TYPE}) {
if (node.path(key).isMissingNode()) {
throw new InvalidInputException("Required field \"" + ... | java | private void validateEntities(JsonNode data) throws InvalidInputException {
for (JsonNode node : data.findParents(INDEX_START)) {
for (String key : new String[] {INDEX_START, INDEX_END, ID, TYPE}) {
if (node.path(key).isMissingNode()) {
throw new InvalidInputException("Required field \"" + ... | [
"private",
"void",
"validateEntities",
"(",
"JsonNode",
"data",
")",
"throws",
"InvalidInputException",
"{",
"for",
"(",
"JsonNode",
"node",
":",
"data",
".",
"findParents",
"(",
"INDEX_START",
")",
")",
"{",
"for",
"(",
"String",
"key",
":",
"new",
"String"... | Verify that JSON entities contain the required fields and that entity indices are correct. | [
"Verify",
"that",
"JSON",
"entities",
"contain",
"the",
"required",
"fields",
"and",
"that",
"entity",
"indices",
"are",
"correct",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/markdown/MarkdownParser.java#L351-L369 |
109,281 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/markdown/MarkdownParser.java | MarkdownParser.validateMedia | private void validateMedia(JsonNode data) throws InvalidInputException {
for (JsonNode node : data.findParents(INDEX)) {
JsonNode text = node.path(TEXT);
if (!text.isMissingNode() && (!text.isArray() || !text.get(0).isArray())) {
throw new InvalidInputException(String.format("Invalid table paylo... | java | private void validateMedia(JsonNode data) throws InvalidInputException {
for (JsonNode node : data.findParents(INDEX)) {
JsonNode text = node.path(TEXT);
if (!text.isMissingNode() && (!text.isArray() || !text.get(0).isArray())) {
throw new InvalidInputException(String.format("Invalid table paylo... | [
"private",
"void",
"validateMedia",
"(",
"JsonNode",
"data",
")",
"throws",
"InvalidInputException",
"{",
"for",
"(",
"JsonNode",
"node",
":",
"data",
".",
"findParents",
"(",
"INDEX",
")",
")",
"{",
"JsonNode",
"text",
"=",
"node",
".",
"path",
"(",
"TEXT... | Verify that JSON media node contains valid table payload. | [
"Verify",
"that",
"JSON",
"media",
"node",
"contains",
"valid",
"table",
"payload",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/markdown/MarkdownParser.java#L374-L381 |
109,282 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/markdown/MarkdownParser.java | MarkdownParser.parse | public MessageML parse(String message, JsonNode entities, JsonNode media) throws InvalidInputException {
this.index = 0;
message = message.replace((char) 160, (char) 32);
String enriched = enrichMarkdown(message, entities, media);
Node markdown = MARKDOWN_PARSER.parse(enriched);
markdown.accept(this... | java | public MessageML parse(String message, JsonNode entities, JsonNode media) throws InvalidInputException {
this.index = 0;
message = message.replace((char) 160, (char) 32);
String enriched = enrichMarkdown(message, entities, media);
Node markdown = MARKDOWN_PARSER.parse(enriched);
markdown.accept(this... | [
"public",
"MessageML",
"parse",
"(",
"String",
"message",
",",
"JsonNode",
"entities",
",",
"JsonNode",
"media",
")",
"throws",
"InvalidInputException",
"{",
"this",
".",
"index",
"=",
"0",
";",
"message",
"=",
"message",
".",
"replace",
"(",
"(",
"char",
... | Parse the Markdown message and entity JSON into a MessageML document. | [
"Parse",
"the",
"Markdown",
"message",
"and",
"entity",
"JSON",
"into",
"a",
"MessageML",
"document",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/markdown/MarkdownParser.java#L386-L394 |
109,283 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/util/AlignedBlock.java | AlignedBlock.align | public void align(Object... o) {
int i = 0;
String s[] = new String[o.length];
for (int ii = 0; ii < o.length; ii++) { if (o[ii] != null) { s[ii] = o[ii].toString(); } }
while (i < s.length && i < maxColumnLength.size()) {
int l = (s[i] == null ? 0 : s[i].length());
if (maxColumnLength.ge... | java | public void align(Object... o) {
int i = 0;
String s[] = new String[o.length];
for (int ii = 0; ii < o.length; ii++) { if (o[ii] != null) { s[ii] = o[ii].toString(); } }
while (i < s.length && i < maxColumnLength.size()) {
int l = (s[i] == null ? 0 : s[i].length());
if (maxColumnLength.ge... | [
"public",
"void",
"align",
"(",
"Object",
"...",
"o",
")",
"{",
"int",
"i",
"=",
"0",
";",
"String",
"s",
"[",
"]",
"=",
"new",
"String",
"[",
"o",
".",
"length",
"]",
";",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"ii",
"<",
"o",
".",
"lengt... | Add a row to the block, each String represents a piece of text which should be aligned.
@param o Variable number of Strings to align. | [
"Add",
"a",
"row",
"to",
"the",
"block",
"each",
"String",
"represents",
"a",
"piece",
"of",
"text",
"which",
"should",
"be",
"aligned",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/util/AlignedBlock.java#L46-L68 |
109,284 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/util/AlignedBlock.java | AlignedBlock.print | public void print(String separator, String terminator) {
for (int i = 0; i < maxColumnLength.size(); i++) {
maxColumnLength.set(i, (((maxColumnLength.get(i) / TAB_SIZE) + 1) * TAB_SIZE));
}
for (int r = 0; r < rows.size(); r++) {
String[] s = rows.get(r);
for (int i = 0; i < s.length; i+... | java | public void print(String separator, String terminator) {
for (int i = 0; i < maxColumnLength.size(); i++) {
maxColumnLength.set(i, (((maxColumnLength.get(i) / TAB_SIZE) + 1) * TAB_SIZE));
}
for (int r = 0; r < rows.size(); r++) {
String[] s = rows.get(r);
for (int i = 0; i < s.length; i+... | [
"public",
"void",
"print",
"(",
"String",
"separator",
",",
"String",
"terminator",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"maxColumnLength",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"maxColumnLength",
".",
"set",
"(",
"... | Outputs the block, with the given separator appended to each line except the last, and the given
terminator appended to the last line.
@param separator text added to each line except the last/
@param terminator text added to the last line. | [
"Outputs",
"the",
"block",
"with",
"the",
"given",
"separator",
"appended",
"to",
"each",
"line",
"except",
"the",
"last",
"and",
"the",
"given",
"terminator",
"appended",
"to",
"the",
"last",
"line",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/util/AlignedBlock.java#L76-L96 |
109,285 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/MessageMLContext.java | MessageMLContext.getPresentationML | public String getPresentationML() throws IllegalStateException {
if (messageML == null) {
throw new IllegalStateException("The message hasn't been parsed yet. "
+ "Please call MessageMLContext.parse() first.");
}
ByteArrayOutputStream bout = new ByteArrayOutputStream();
XmlPrintStream o... | java | public String getPresentationML() throws IllegalStateException {
if (messageML == null) {
throw new IllegalStateException("The message hasn't been parsed yet. "
+ "Please call MessageMLContext.parse() first.");
}
ByteArrayOutputStream bout = new ByteArrayOutputStream();
XmlPrintStream o... | [
"public",
"String",
"getPresentationML",
"(",
")",
"throws",
"IllegalStateException",
"{",
"if",
"(",
"messageML",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"The message hasn't been parsed yet. \"",
"+",
"\"Please call MessageMLContext.parse() ... | Retrieve a string representation of the message in PresentationML.
@throws IllegalStateException thrown if the message hasn't been parsed yet | [
"Retrieve",
"a",
"string",
"representation",
"of",
"the",
"message",
"in",
"PresentationML",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/MessageMLContext.java#L106-L123 |
109,286 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/elements/Styles.java | Styles.validate | public static void validate(String styleAttribute) throws InvalidInputException {
try {
final Map<String, String> styleMap = Splitter.on(";").omitEmptyStrings().withKeyValueSeparator(":").split(styleAttribute);
final HashSet<String> inputStyleProperties = new HashSet<>(styleMap.keySet());
inputSty... | java | public static void validate(String styleAttribute) throws InvalidInputException {
try {
final Map<String, String> styleMap = Splitter.on(";").omitEmptyStrings().withKeyValueSeparator(":").split(styleAttribute);
final HashSet<String> inputStyleProperties = new HashSet<>(styleMap.keySet());
inputSty... | [
"public",
"static",
"void",
"validate",
"(",
"String",
"styleAttribute",
")",
"throws",
"InvalidInputException",
"{",
"try",
"{",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"styleMap",
"=",
"Splitter",
".",
"on",
"(",
"\";\"",
")",
".",
"omitEmptyStr... | Validate that the input style attribute is allowed
@param styleAttribute input style string
@throws InvalidInputException if the styleAttribute is allowed | [
"Validate",
"that",
"the",
"input",
"style",
"attribute",
"is",
"allowed"
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/elements/Styles.java#L135-L146 |
109,287 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/MessageMLParser.java | MessageMLParser.parse | MessageML parse(String message, String entityJson, String version) throws InvalidInputException, ProcessingException,
IOException {
this.index = 0;
String expandedMessage;
if (StringUtils.isBlank(message)) {
throw new InvalidInputException("Error parsing message: the message cannot be null or em... | java | MessageML parse(String message, String entityJson, String version) throws InvalidInputException, ProcessingException,
IOException {
this.index = 0;
String expandedMessage;
if (StringUtils.isBlank(message)) {
throw new InvalidInputException("Error parsing message: the message cannot be null or em... | [
"MessageML",
"parse",
"(",
"String",
"message",
",",
"String",
"entityJson",
",",
"String",
"version",
")",
"throws",
"InvalidInputException",
",",
"ProcessingException",
",",
"IOException",
"{",
"this",
".",
"index",
"=",
"0",
";",
"String",
"expandedMessage",
... | Parse the text contents of the message and optionally EntityJSON into a MessageMLV2 message. Expands
Freemarker templates and generates a MessageML document tree.
@param message string containing a MessageMLV2 message with optional Freemarker templates
@param entityJson string containing EntityJSON data
@param version ... | [
"Parse",
"the",
"text",
"contents",
"of",
"the",
"message",
"and",
"optionally",
"EntityJSON",
"into",
"a",
"MessageMLV2",
"message",
".",
"Expands",
"Freemarker",
"templates",
"and",
"generates",
"a",
"MessageML",
"document",
"tree",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/MessageMLParser.java#L80-L117 |
109,288 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/MessageMLParser.java | MessageMLParser.validateMessageText | private static void validateMessageText(String messageML) throws InvalidInputException {
if (messageML == null) { throw new InvalidInputException("Message input is NULL"); }
for (char ch : messageML.toCharArray()) {
if (ch != '\n' && ch != '\r' && ch != '\t' && (ch < ' ')) {
throw new InvalidInpu... | java | private static void validateMessageText(String messageML) throws InvalidInputException {
if (messageML == null) { throw new InvalidInputException("Message input is NULL"); }
for (char ch : messageML.toCharArray()) {
if (ch != '\n' && ch != '\r' && ch != '\t' && (ch < ' ')) {
throw new InvalidInpu... | [
"private",
"static",
"void",
"validateMessageText",
"(",
"String",
"messageML",
")",
"throws",
"InvalidInputException",
"{",
"if",
"(",
"messageML",
"==",
"null",
")",
"{",
"throw",
"new",
"InvalidInputException",
"(",
"\"Message input is NULL\"",
")",
";",
"}",
"... | Check the input message text for null value and restricted characters. | [
"Check",
"the",
"input",
"message",
"text",
"for",
"null",
"value",
"and",
"restricted",
"characters",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/MessageMLParser.java#L129-L137 |
109,289 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/MessageMLParser.java | MessageMLParser.expandTemplates | private String expandTemplates(String message, JsonNode entityJson) throws IOException, TemplateException {
// Read entityJSON data
Map<String, Object> data = new HashMap<>();
data.put("data", MAPPER.convertValue(entityJson, Map.class));
data.put("entity", MAPPER.convertValue(entityJson, Map.class));
... | java | private String expandTemplates(String message, JsonNode entityJson) throws IOException, TemplateException {
// Read entityJSON data
Map<String, Object> data = new HashMap<>();
data.put("data", MAPPER.convertValue(entityJson, Map.class));
data.put("entity", MAPPER.convertValue(entityJson, Map.class));
... | [
"private",
"String",
"expandTemplates",
"(",
"String",
"message",
",",
"JsonNode",
"entityJson",
")",
"throws",
"IOException",
",",
"TemplateException",
"{",
"// Read entityJSON data",
"Map",
"<",
"String",
",",
"Object",
">",
"data",
"=",
"new",
"HashMap",
"<>",
... | Expand Freemarker templates. | [
"Expand",
"Freemarker",
"templates",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/MessageMLParser.java#L182-L196 |
109,290 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/MessageMLParser.java | MessageMLParser.parseMessageML | private MessageML parseMessageML(String messageML, String version) throws InvalidInputException, ProcessingException {
validateMessageText(messageML);
org.w3c.dom.Element docElement = parseDocument(messageML);
validateEntities(docElement, entityJson);
switch (docElement.getTagName()) {
case Mes... | java | private MessageML parseMessageML(String messageML, String version) throws InvalidInputException, ProcessingException {
validateMessageText(messageML);
org.w3c.dom.Element docElement = parseDocument(messageML);
validateEntities(docElement, entityJson);
switch (docElement.getTagName()) {
case Mes... | [
"private",
"MessageML",
"parseMessageML",
"(",
"String",
"messageML",
",",
"String",
"version",
")",
"throws",
"InvalidInputException",
",",
"ProcessingException",
"{",
"validateMessageText",
"(",
"messageML",
")",
";",
"org",
".",
"w3c",
".",
"dom",
".",
"Element... | Parse the message string into its MessageML representation. | [
"Parse",
"the",
"message",
"string",
"into",
"its",
"MessageML",
"representation",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/MessageMLParser.java#L201-L230 |
109,291 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/MessageMLParser.java | MessageMLParser.parseDocument | org.w3c.dom.Element parseDocument(String messageML) throws InvalidInputException, ProcessingException {
try {
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
//XXE prevention as per https://www.owasp.org/index.php/XML_External_Entity_(XXE)_Prevention_Cheat_Sheet
dbFactory.... | java | org.w3c.dom.Element parseDocument(String messageML) throws InvalidInputException, ProcessingException {
try {
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
//XXE prevention as per https://www.owasp.org/index.php/XML_External_Entity_(XXE)_Prevention_Cheat_Sheet
dbFactory.... | [
"org",
".",
"w3c",
".",
"dom",
".",
"Element",
"parseDocument",
"(",
"String",
"messageML",
")",
"throws",
"InvalidInputException",
",",
"ProcessingException",
"{",
"try",
"{",
"DocumentBuilderFactory",
"dbFactory",
"=",
"DocumentBuilderFactory",
".",
"newInstance",
... | Parse the message string into a DOM element tree. | [
"Parse",
"the",
"message",
"string",
"into",
"a",
"DOM",
"element",
"tree",
"."
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/MessageMLParser.java#L235-L262 |
109,292 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/util/IndentedPrintStream.java | IndentedPrintStream.align | public void align(Object... s) {
if (alignedBlock == null) {
alignedBlock = new AlignedBlock(this);
}
alignedBlock.align(s);
} | java | public void align(Object... s) {
if (alignedBlock == null) {
alignedBlock = new AlignedBlock(this);
}
alignedBlock.align(s);
} | [
"public",
"void",
"align",
"(",
"Object",
"...",
"s",
")",
"{",
"if",
"(",
"alignedBlock",
"==",
"null",
")",
"{",
"alignedBlock",
"=",
"new",
"AlignedBlock",
"(",
"this",
")",
";",
"}",
"alignedBlock",
".",
"align",
"(",
"s",
")",
";",
"}"
] | Takes an array of strings to be aligned in separate columns, and adds them to the alignedblock | [
"Takes",
"an",
"array",
"of",
"strings",
"to",
"be",
"aligned",
"in",
"separate",
"columns",
"and",
"adds",
"them",
"to",
"the",
"alignedblock"
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/util/IndentedPrintStream.java#L64-L69 |
109,293 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/util/IndentedPrintStream.java | IndentedPrintStream.printAlignedBlock | private void printAlignedBlock(String separator, String terminator) {
if (alignedBlock != null) {
alignedBlock.print(separator, terminator);
alignedBlock = null;
}
} | java | private void printAlignedBlock(String separator, String terminator) {
if (alignedBlock != null) {
alignedBlock.print(separator, terminator);
alignedBlock = null;
}
} | [
"private",
"void",
"printAlignedBlock",
"(",
"String",
"separator",
",",
"String",
"terminator",
")",
"{",
"if",
"(",
"alignedBlock",
"!=",
"null",
")",
"{",
"alignedBlock",
".",
"print",
"(",
"separator",
",",
"terminator",
")",
";",
"alignedBlock",
"=",
"n... | Prints the alignedblock, with all strings aligned in columns dependent on the order in which they were declared in Align
@param separator text added to the end of each line except the last line
@param terminator text added to the end of the last line of the block | [
"Prints",
"the",
"alignedblock",
"with",
"all",
"strings",
"aligned",
"in",
"columns",
"dependent",
"on",
"the",
"order",
"in",
"which",
"they",
"were",
"declared",
"in",
"Align"
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/util/IndentedPrintStream.java#L76-L81 |
109,294 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/util/IndentedPrintStream.java | IndentedPrintStream.println | public void println(int tempIndent, char x) {
if (startOfLine) {
doIndent(tempIndent);
}
super.println(x);
startOfLine = true;
} | java | public void println(int tempIndent, char x) {
if (startOfLine) {
doIndent(tempIndent);
}
super.println(x);
startOfLine = true;
} | [
"public",
"void",
"println",
"(",
"int",
"tempIndent",
",",
"char",
"x",
")",
"{",
"if",
"(",
"startOfLine",
")",
"{",
"doIndent",
"(",
"tempIndent",
")",
";",
"}",
"super",
".",
"println",
"(",
"x",
")",
";",
"startOfLine",
"=",
"true",
";",
"}"
] | Indent the current line and print a character on the same line,
then print a line break
@param tempIndent magnitude of the indent (number of tab spaces)
@param x character to be printed | [
"Indent",
"the",
"current",
"line",
"and",
"print",
"a",
"character",
"on",
"the",
"same",
"line",
"then",
"print",
"a",
"line",
"break"
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/util/IndentedPrintStream.java#L302-L308 |
109,295 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/util/IndentedPrintStream.java | IndentedPrintStream.println | public void println(int tempIndent, String x) {
if (startOfLine) {
doIndent(tempIndent);
}
if (noNl) {
super.print(x);
} else {
super.println(x);
if (oNlCr) { super.write('\r'); }
}
startOfLine = true;
} | java | public void println(int tempIndent, String x) {
if (startOfLine) {
doIndent(tempIndent);
}
if (noNl) {
super.print(x);
} else {
super.println(x);
if (oNlCr) { super.write('\r'); }
}
startOfLine = true;
} | [
"public",
"void",
"println",
"(",
"int",
"tempIndent",
",",
"String",
"x",
")",
"{",
"if",
"(",
"startOfLine",
")",
"{",
"doIndent",
"(",
"tempIndent",
")",
";",
"}",
"if",
"(",
"noNl",
")",
"{",
"super",
".",
"print",
"(",
"x",
")",
";",
"}",
"e... | Indent the current line and print a string on the same line,
then print a line break
@param tempIndent magnitude of the indent (number of tab spaces)
@param x string to be printed | [
"Indent",
"the",
"current",
"line",
"and",
"print",
"a",
"string",
"on",
"the",
"same",
"line",
"then",
"print",
"a",
"line",
"break"
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/util/IndentedPrintStream.java#L370-L382 |
109,296 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/util/IndentedPrintStream.java | IndentedPrintStream.print | public void print(String pattern, Object... arguments) {
print(String.format(pattern, arguments));
} | java | public void print(String pattern, Object... arguments) {
print(String.format(pattern, arguments));
} | [
"public",
"void",
"print",
"(",
"String",
"pattern",
",",
"Object",
"...",
"arguments",
")",
"{",
"print",
"(",
"String",
".",
"format",
"(",
"pattern",
",",
"arguments",
")",
")",
";",
"}"
] | Convenience method for calling string.format and printing | [
"Convenience",
"method",
"for",
"calling",
"string",
".",
"format",
"and",
"printing"
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/util/IndentedPrintStream.java#L577-L579 |
109,297 | symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/util/IndentedPrintStream.java | IndentedPrintStream.println | public void println(String pattern, Object... arguments) {
println(String.format(pattern, arguments));
} | java | public void println(String pattern, Object... arguments) {
println(String.format(pattern, arguments));
} | [
"public",
"void",
"println",
"(",
"String",
"pattern",
",",
"Object",
"...",
"arguments",
")",
"{",
"println",
"(",
"String",
".",
"format",
"(",
"pattern",
",",
"arguments",
")",
")",
";",
"}"
] | Convenience method for calling string.format and printing
with line breaks | [
"Convenience",
"method",
"for",
"calling",
"string",
".",
"format",
"and",
"printing",
"with",
"line",
"breaks"
] | 68daed66267062d144a05b3ee9a9bf4b715e3f95 | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/util/IndentedPrintStream.java#L585-L587 |
109,298 | irmen/Serpent | java/src/main/java/net/razorvine/serpent/SeekableStringReader.java | SeekableStringReader.peek | public String peek(int count)
{
return str.substring(cursor, cursor+Math.min(count, str.length()-cursor));
} | java | public String peek(int count)
{
return str.substring(cursor, cursor+Math.min(count, str.length()-cursor));
} | [
"public",
"String",
"peek",
"(",
"int",
"count",
")",
"{",
"return",
"str",
".",
"substring",
"(",
"cursor",
",",
"cursor",
"+",
"Math",
".",
"min",
"(",
"count",
",",
"str",
".",
"length",
"(",
")",
"-",
"cursor",
")",
")",
";",
"}"
] | What are the next characters that will be read? | [
"What",
"are",
"the",
"next",
"characters",
"that",
"will",
"be",
"read?"
] | 763a6e15f75c4d5937cd16dfc70b0930a442b541 | https://github.com/irmen/Serpent/blob/763a6e15f75c4d5937cd16dfc70b0930a442b541/java/src/main/java/net/razorvine/serpent/SeekableStringReader.java#L58-L61 |
109,299 | irmen/Serpent | java/src/main/java/net/razorvine/serpent/SeekableStringReader.java | SeekableStringReader.read | public String read(int count)
{
if(count<0)
throw new ParseException("use Rewind to seek back");
int safecount = Math.min(count, str.length()-cursor);
if(safecount==0 && count>0)
throw new ParseException("no more data");
String result = str.substring(cursor, cursor+safecount);
cursor += safecount;
... | java | public String read(int count)
{
if(count<0)
throw new ParseException("use Rewind to seek back");
int safecount = Math.min(count, str.length()-cursor);
if(safecount==0 && count>0)
throw new ParseException("no more data");
String result = str.substring(cursor, cursor+safecount);
cursor += safecount;
... | [
"public",
"String",
"read",
"(",
"int",
"count",
")",
"{",
"if",
"(",
"count",
"<",
"0",
")",
"throw",
"new",
"ParseException",
"(",
"\"use Rewind to seek back\"",
")",
";",
"int",
"safecount",
"=",
"Math",
".",
"min",
"(",
"count",
",",
"str",
".",
"l... | Read a number of characters. | [
"Read",
"a",
"number",
"of",
"characters",
"."
] | 763a6e15f75c4d5937cd16dfc70b0930a442b541 | https://github.com/irmen/Serpent/blob/763a6e15f75c4d5937cd16dfc70b0930a442b541/java/src/main/java/net/razorvine/serpent/SeekableStringReader.java#L74-L85 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.