repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
wcm-io-caravan/caravan-hal | docs-maven-plugin/src/main/java/io/wcm/caravan/maven/plugins/haldocs/AbstractBaseMojo.java | AbstractBaseMojo.getCompileClasspathElementURLs | protected URL[] getCompileClasspathElementURLs() throws DependencyResolutionRequiredException {
// build class loader to get classes to generate resources for
return project.getCompileClasspathElements().stream()
.map(path -> {
try {
return new File(path).toURI().toURL();
... | java | protected URL[] getCompileClasspathElementURLs() throws DependencyResolutionRequiredException {
// build class loader to get classes to generate resources for
return project.getCompileClasspathElements().stream()
.map(path -> {
try {
return new File(path).toURI().toURL();
... | [
"protected",
"URL",
"[",
"]",
"getCompileClasspathElementURLs",
"(",
")",
"throws",
"DependencyResolutionRequiredException",
"{",
"// build class loader to get classes to generate resources for",
"return",
"project",
".",
"getCompileClasspathElements",
"(",
")",
".",
"stream",
... | Get a List of URLs of all "compile" dependencies of this project.
@return Class path URLs
@throws DependencyResolutionRequiredException | [
"Get",
"a",
"List",
"of",
"URLs",
"of",
"all",
"compile",
"dependencies",
"of",
"this",
"project",
"."
] | 25d58756b58c70c8c48a17fe781e673dd93d5085 | https://github.com/wcm-io-caravan/caravan-hal/blob/25d58756b58c70c8c48a17fe781e673dd93d5085/docs-maven-plugin/src/main/java/io/wcm/caravan/maven/plugins/haldocs/AbstractBaseMojo.java#L48-L60 | train |
wcm-io-caravan/caravan-hal | docs-maven-plugin/src/main/java/io/wcm/caravan/maven/plugins/haldocs/AbstractBaseMojo.java | AbstractBaseMojo.getGeneratedResourcesDirectory | protected File getGeneratedResourcesDirectory() {
if (generatedResourcesFolder == null) {
String generatedResourcesFolderAbsolutePath = this.project.getBuild().getDirectory() + "/" + getGeneratedResourcesDirectoryPath();
generatedResourcesFolder = new File(generatedResourcesFolderAbsolutePath);
if... | java | protected File getGeneratedResourcesDirectory() {
if (generatedResourcesFolder == null) {
String generatedResourcesFolderAbsolutePath = this.project.getBuild().getDirectory() + "/" + getGeneratedResourcesDirectoryPath();
generatedResourcesFolder = new File(generatedResourcesFolderAbsolutePath);
if... | [
"protected",
"File",
"getGeneratedResourcesDirectory",
"(",
")",
"{",
"if",
"(",
"generatedResourcesFolder",
"==",
"null",
")",
"{",
"String",
"generatedResourcesFolderAbsolutePath",
"=",
"this",
".",
"project",
".",
"getBuild",
"(",
")",
".",
"getDirectory",
"(",
... | Get folder to temporarily generate the resources to.
@return Folder | [
"Get",
"folder",
"to",
"temporarily",
"generate",
"the",
"resources",
"to",
"."
] | 25d58756b58c70c8c48a17fe781e673dd93d5085 | https://github.com/wcm-io-caravan/caravan-hal/blob/25d58756b58c70c8c48a17fe781e673dd93d5085/docs-maven-plugin/src/main/java/io/wcm/caravan/maven/plugins/haldocs/AbstractBaseMojo.java#L84-L93 | train |
pressgang-ccms/PressGangCCMSCommonUtilities | src/main/java/org/jboss/pressgang/ccms/utils/common/VersionUtilities.java | VersionUtilities.getAPIVersion | public static String getAPIVersion(final String resourceFileName, final String versionProperty) {
final Properties props = new Properties();
final URL url = ClassLoader.getSystemResource(resourceFileName);
if (url != null) {
InputStream is = null;
try {
is... | java | public static String getAPIVersion(final String resourceFileName, final String versionProperty) {
final Properties props = new Properties();
final URL url = ClassLoader.getSystemResource(resourceFileName);
if (url != null) {
InputStream is = null;
try {
is... | [
"public",
"static",
"String",
"getAPIVersion",
"(",
"final",
"String",
"resourceFileName",
",",
"final",
"String",
"versionProperty",
")",
"{",
"final",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"final",
"URL",
"url",
"=",
"ClassLoader",
... | Get the Version Number from a properties file in the Application Classpath.
@param resourceFileName The name of the properties file.
@param versionProperty The name of the version property in the properties file.
@return The Version number or "unknown" if the version couldn't be found. | [
"Get",
"the",
"Version",
"Number",
"from",
"a",
"properties",
"file",
"in",
"the",
"Application",
"Classpath",
"."
] | 5ebf5ed30a94c34c33f4708caa04a8da99cbb15c | https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/VersionUtilities.java#L56-L80 | train |
cycorp/model-generator-suite | model-generator/src/main/java/com/cyc/model/objects/InterfaceObj.java | InterfaceObj.getExtendsInterface | public String getExtendsInterface() {
if (this.getExtendsInterfaces().isEmpty()){
// return "Empty";
return this.getInstanceType();
} else {
String tName = this.getExtendsInterfaces().get(0).replaceAll("\\W+", "");
return tName;
}
} | java | public String getExtendsInterface() {
if (this.getExtendsInterfaces().isEmpty()){
// return "Empty";
return this.getInstanceType();
} else {
String tName = this.getExtendsInterfaces().get(0).replaceAll("\\W+", "");
return tName;
}
} | [
"public",
"String",
"getExtendsInterface",
"(",
")",
"{",
"if",
"(",
"this",
".",
"getExtendsInterfaces",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"// return \"Empty\";",
"return",
"this",
".",
"getInstanceType",
"(",
")",
";",
"}",
"else",
"{",
"Stri... | will have issues!!!!! | [
"will",
"have",
"issues!!!!!"
] | 8995984c5dcf668acad813d24e4fe9c544b7aa91 | https://github.com/cycorp/model-generator-suite/blob/8995984c5dcf668acad813d24e4fe9c544b7aa91/model-generator/src/main/java/com/cyc/model/objects/InterfaceObj.java#L229-L237 | train |
pressgang-ccms/PressGangCCMSCommonUtilities | src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java | DocBookUtilities.escapeTitle | public static String escapeTitle(final String title) {
final String escapedTitle = title.replaceAll("^[^" + UNICODE_TITLE_START_CHAR + "]*", "").replaceAll("[^" + UNICODE_WORD + ". -]",
"");
if (isNullOrEmpty(escapedTitle)) {
return "";
} else {
// Remove ... | java | public static String escapeTitle(final String title) {
final String escapedTitle = title.replaceAll("^[^" + UNICODE_TITLE_START_CHAR + "]*", "").replaceAll("[^" + UNICODE_WORD + ". -]",
"");
if (isNullOrEmpty(escapedTitle)) {
return "";
} else {
// Remove ... | [
"public",
"static",
"String",
"escapeTitle",
"(",
"final",
"String",
"title",
")",
"{",
"final",
"String",
"escapedTitle",
"=",
"title",
".",
"replaceAll",
"(",
"\"^[^\"",
"+",
"UNICODE_TITLE_START_CHAR",
"+",
"\"]*\"",
",",
"\"\"",
")",
".",
"replaceAll",
"("... | Escapes a title so that it is alphanumeric or has a fullstop, underscore or hyphen only.
It also removes anything from the front of the title that isn't alphanumeric.
@param title The title to be escaped
@return The escaped title string. | [
"Escapes",
"a",
"title",
"so",
"that",
"it",
"is",
"alphanumeric",
"or",
"has",
"a",
"fullstop",
"underscore",
"or",
"hyphen",
"only",
".",
"It",
"also",
"removes",
"anything",
"from",
"the",
"front",
"of",
"the",
"title",
"that",
"isn",
"t",
"alphanumeric... | 5ebf5ed30a94c34c33f4708caa04a8da99cbb15c | https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java#L2186-L2195 | train |
pressgang-ccms/PressGangCCMSCommonUtilities | src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java | DocBookUtilities.escapeForXML | public static String escapeForXML(final String content) {
if (content == null) return "";
/*
* Note: The following characters should be escaped: & < > " '
*
* However, all but ampersand pose issues when other elements are included in the title.
*
* eg <title... | java | public static String escapeForXML(final String content) {
if (content == null) return "";
/*
* Note: The following characters should be escaped: & < > " '
*
* However, all but ampersand pose issues when other elements are included in the title.
*
* eg <title... | [
"public",
"static",
"String",
"escapeForXML",
"(",
"final",
"String",
"content",
")",
"{",
"if",
"(",
"content",
"==",
"null",
")",
"return",
"\"\"",
";",
"/*\n * Note: The following characters should be escaped: & < > \" '\n *\n * However, all but amper... | Escapes a String so that it can be used in a Docbook Element, ensuring that any entities or elements are maintained.
@param content The string to be escaped.
@return The escaped string that can be used in XML. | [
"Escapes",
"a",
"String",
"so",
"that",
"it",
"can",
"be",
"used",
"in",
"a",
"Docbook",
"Element",
"ensuring",
"that",
"any",
"entities",
"or",
"elements",
"are",
"maintained",
"."
] | 5ebf5ed30a94c34c33f4708caa04a8da99cbb15c | https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java#L2297-L2353 | train |
pressgang-ccms/PressGangCCMSCommonUtilities | src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java | DocBookUtilities.validateTableRows | public static boolean validateTableRows(final Element table) {
assert table != null;
assert table.getNodeName().equals("table") || table.getNodeName().equals("informaltable");
final NodeList tgroups = table.getElementsByTagName("tgroup");
for (int i = 0; i < tgroups.getLength(); i++) {
... | java | public static boolean validateTableRows(final Element table) {
assert table != null;
assert table.getNodeName().equals("table") || table.getNodeName().equals("informaltable");
final NodeList tgroups = table.getElementsByTagName("tgroup");
for (int i = 0; i < tgroups.getLength(); i++) {
... | [
"public",
"static",
"boolean",
"validateTableRows",
"(",
"final",
"Element",
"table",
")",
"{",
"assert",
"table",
"!=",
"null",
";",
"assert",
"table",
".",
"getNodeName",
"(",
")",
".",
"equals",
"(",
"\"table\"",
")",
"||",
"table",
".",
"getNodeName",
... | Check to ensure that a table isn't missing any entries in its rows.
@param table The DOM table node to be checked.
@return True if the table has the required number of entries, otherwise false. | [
"Check",
"to",
"ensure",
"that",
"a",
"table",
"isn",
"t",
"missing",
"any",
"entries",
"in",
"its",
"rows",
"."
] | 5ebf5ed30a94c34c33f4708caa04a8da99cbb15c | https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java#L3074-L3085 | train |
pressgang-ccms/PressGangCCMSCommonUtilities | src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java | DocBookUtilities.validateTableGroup | public static boolean validateTableGroup(final Element tgroup) {
assert tgroup != null;
assert tgroup.getNodeName().equals("tgroup");
final Integer numColumns = Integer.parseInt(tgroup.getAttribute("cols"));
// Check that all the thead, tbody and tfoot elements have the correct number ... | java | public static boolean validateTableGroup(final Element tgroup) {
assert tgroup != null;
assert tgroup.getNodeName().equals("tgroup");
final Integer numColumns = Integer.parseInt(tgroup.getAttribute("cols"));
// Check that all the thead, tbody and tfoot elements have the correct number ... | [
"public",
"static",
"boolean",
"validateTableGroup",
"(",
"final",
"Element",
"tgroup",
")",
"{",
"assert",
"tgroup",
"!=",
"null",
";",
"assert",
"tgroup",
".",
"getNodeName",
"(",
")",
".",
"equals",
"(",
"\"tgroup\"",
")",
";",
"final",
"Integer",
"numCol... | Check to ensure that a Docbook tgroup isn't missing an row entries, using number of cols defined for the tgroup.
@param tgroup The DOM tgroup element to be checked.
@return True if the tgroup has the required number of entries, otherwise false. | [
"Check",
"to",
"ensure",
"that",
"a",
"Docbook",
"tgroup",
"isn",
"t",
"missing",
"an",
"row",
"entries",
"using",
"number",
"of",
"cols",
"defined",
"for",
"the",
"tgroup",
"."
] | 5ebf5ed30a94c34c33f4708caa04a8da99cbb15c | https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java#L3093-L3113 | train |
pressgang-ccms/PressGangCCMSCommonUtilities | src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java | DocBookUtilities.validateTableRow | public static boolean validateTableRow(final Node row, final int numColumns) {
assert row != null;
assert row.getNodeName().equals("row") || row.getNodeName().equals("tr");
if (row.getNodeName().equals("row")) {
final List<Node> entries = XMLUtilities.getDirectChildNodes(row, "entry... | java | public static boolean validateTableRow(final Node row, final int numColumns) {
assert row != null;
assert row.getNodeName().equals("row") || row.getNodeName().equals("tr");
if (row.getNodeName().equals("row")) {
final List<Node> entries = XMLUtilities.getDirectChildNodes(row, "entry... | [
"public",
"static",
"boolean",
"validateTableRow",
"(",
"final",
"Node",
"row",
",",
"final",
"int",
"numColumns",
")",
"{",
"assert",
"row",
"!=",
"null",
";",
"assert",
"row",
".",
"getNodeName",
"(",
")",
".",
"equals",
"(",
"\"row\"",
")",
"||",
"row... | Check to ensure that a docbook row has the required number of columns for a table.
@param row The DOM row element to be checked.
@param numColumns The number of entry elements that should exist in the row.
@return True if the row has the required number of entries, otherwise false. | [
"Check",
"to",
"ensure",
"that",
"a",
"docbook",
"row",
"has",
"the",
"required",
"number",
"of",
"columns",
"for",
"a",
"table",
"."
] | 5ebf5ed30a94c34c33f4708caa04a8da99cbb15c | https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java#L3122-L3143 | train |
pressgang-ccms/PressGangCCMSCommonUtilities | src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java | DocBookUtilities.getTranslatableStringsV3 | public static List<StringToNodeCollection> getTranslatableStringsV3(final Document xml, final boolean allowDuplicates) {
if (xml == null) return null;
return getTranslatableStringsV3(xml.getDocumentElement(), allowDuplicates);
} | java | public static List<StringToNodeCollection> getTranslatableStringsV3(final Document xml, final boolean allowDuplicates) {
if (xml == null) return null;
return getTranslatableStringsV3(xml.getDocumentElement(), allowDuplicates);
} | [
"public",
"static",
"List",
"<",
"StringToNodeCollection",
">",
"getTranslatableStringsV3",
"(",
"final",
"Document",
"xml",
",",
"final",
"boolean",
"allowDuplicates",
")",
"{",
"if",
"(",
"xml",
"==",
"null",
")",
"return",
"null",
";",
"return",
"getTranslata... | Get the Translatable Strings from an XML Document. This method will return of Translation strings to XML DOM nodes within
the XML Document.
@param xml The XML to get the translatable strings from.
@param allowDuplicates If duplicate translation strings should be created in the returned list.
@return A list... | [
"Get",
"the",
"Translatable",
"Strings",
"from",
"an",
"XML",
"Document",
".",
"This",
"method",
"will",
"return",
"of",
"Translation",
"strings",
"to",
"XML",
"DOM",
"nodes",
"within",
"the",
"XML",
"Document",
"."
] | 5ebf5ed30a94c34c33f4708caa04a8da99cbb15c | https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java#L3340-L3344 | train |
pressgang-ccms/PressGangCCMSCommonUtilities | src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java | DocBookUtilities.getTranslatableStringsV3 | public static List<StringToNodeCollection> getTranslatableStringsV3(final Node node, final boolean allowDuplicates) {
if (node == null) return null;
final List<StringToNodeCollection> retValue = new LinkedList<StringToNodeCollection>();
final NodeList nodes = node.getChildNodes();
for ... | java | public static List<StringToNodeCollection> getTranslatableStringsV3(final Node node, final boolean allowDuplicates) {
if (node == null) return null;
final List<StringToNodeCollection> retValue = new LinkedList<StringToNodeCollection>();
final NodeList nodes = node.getChildNodes();
for ... | [
"public",
"static",
"List",
"<",
"StringToNodeCollection",
">",
"getTranslatableStringsV3",
"(",
"final",
"Node",
"node",
",",
"final",
"boolean",
"allowDuplicates",
")",
"{",
"if",
"(",
"node",
"==",
"null",
")",
"return",
"null",
";",
"final",
"List",
"<",
... | Get the Translatable Strings from an XML Node. This method will return of Translation strings to XML DOM nodes within
the XML Document.
@param node The XML to get the translatable strings from.
@param allowDuplicates If duplicate translation strings should be created in the returned list.
@return A list of... | [
"Get",
"the",
"Translatable",
"Strings",
"from",
"an",
"XML",
"Node",
".",
"This",
"method",
"will",
"return",
"of",
"Translation",
"strings",
"to",
"XML",
"DOM",
"nodes",
"within",
"the",
"XML",
"Document",
"."
] | 5ebf5ed30a94c34c33f4708caa04a8da99cbb15c | https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java#L3354-L3366 | train |
pressgang-ccms/PressGangCCMSCommonUtilities | src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java | DocBookUtilities.cleanTranslationText | private static String cleanTranslationText(final String input, final boolean removeWhitespaceFromStart,
final boolean removeWhitespaceFromEnd) {
String retValue = XMLUtilities.cleanText(input);
retValue = retValue.trim();
/*
* When presenting the contents of a childless XM... | java | private static String cleanTranslationText(final String input, final boolean removeWhitespaceFromStart,
final boolean removeWhitespaceFromEnd) {
String retValue = XMLUtilities.cleanText(input);
retValue = retValue.trim();
/*
* When presenting the contents of a childless XM... | [
"private",
"static",
"String",
"cleanTranslationText",
"(",
"final",
"String",
"input",
",",
"final",
"boolean",
"removeWhitespaceFromStart",
",",
"final",
"boolean",
"removeWhitespaceFromEnd",
")",
"{",
"String",
"retValue",
"=",
"XMLUtilities",
".",
"cleanText",
"("... | Cleans a string for presentation to a translator | [
"Cleans",
"a",
"string",
"for",
"presentation",
"to",
"a",
"translator"
] | 5ebf5ed30a94c34c33f4708caa04a8da99cbb15c | https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java#L3990-L4013 | train |
pressgang-ccms/PressGangCCMSCommonUtilities | src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java | DocBookUtilities.wrapForValidation | public static Pair<String, String> wrapForValidation(final DocBookVersion docBookVersion, final String xml) {
final String rootEleName = XMLUtilities.findRootElementName(xml);
if (docBookVersion == DocBookVersion.DOCBOOK_50) {
if (rootEleName.equals("abstract") || rootEleName.equals("legalno... | java | public static Pair<String, String> wrapForValidation(final DocBookVersion docBookVersion, final String xml) {
final String rootEleName = XMLUtilities.findRootElementName(xml);
if (docBookVersion == DocBookVersion.DOCBOOK_50) {
if (rootEleName.equals("abstract") || rootEleName.equals("legalno... | [
"public",
"static",
"Pair",
"<",
"String",
",",
"String",
">",
"wrapForValidation",
"(",
"final",
"DocBookVersion",
"docBookVersion",
",",
"final",
"String",
"xml",
")",
"{",
"final",
"String",
"rootEleName",
"=",
"XMLUtilities",
".",
"findRootElementName",
"(",
... | Wraps the xml if required so that validation can be performed. An example of where this is required is if you are validating
against Abstracts, Author Groups or Legal Notices for DocBook 5.0.
@param docBookVersion The DocBook version the document will be validated against.
@param xml The xml that needs to b... | [
"Wraps",
"the",
"xml",
"if",
"required",
"so",
"that",
"validation",
"can",
"be",
"performed",
".",
"An",
"example",
"of",
"where",
"this",
"is",
"required",
"is",
"if",
"you",
"are",
"validating",
"against",
"Abstracts",
"Author",
"Groups",
"or",
"Legal",
... | 5ebf5ed30a94c34c33f4708caa04a8da99cbb15c | https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java#L4023-L4054 | train |
pressgang-ccms/PressGangCCMSCommonUtilities | src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java | DocBookUtilities.wrapForRendering | public static void wrapForRendering(final Document xmlDoc) {
// Some topics need to be wrapped up to be rendered properly
final String documentElementNodeName = xmlDoc.getDocumentElement().getNodeName();
if (documentElementNodeName.equals("authorgroup") || documentElementNodeName.equals("legalno... | java | public static void wrapForRendering(final Document xmlDoc) {
// Some topics need to be wrapped up to be rendered properly
final String documentElementNodeName = xmlDoc.getDocumentElement().getNodeName();
if (documentElementNodeName.equals("authorgroup") || documentElementNodeName.equals("legalno... | [
"public",
"static",
"void",
"wrapForRendering",
"(",
"final",
"Document",
"xmlDoc",
")",
"{",
"// Some topics need to be wrapped up to be rendered properly",
"final",
"String",
"documentElementNodeName",
"=",
"xmlDoc",
".",
"getDocumentElement",
"(",
")",
".",
"getNodeName"... | Some docbook elements need to be wrapped up so they can be properly transformed by the docbook XSL.
@param xmlDoc | [
"Some",
"docbook",
"elements",
"need",
"to",
"be",
"wrapped",
"up",
"so",
"they",
"can",
"be",
"properly",
"transformed",
"by",
"the",
"docbook",
"XSL",
"."
] | 5ebf5ed30a94c34c33f4708caa04a8da99cbb15c | https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java#L4061-L4080 | train |
pressgang-ccms/PressGangCCMSCommonUtilities | src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java | DocBookUtilities.validateTables | public static boolean validateTables(final Document doc) {
final NodeList tables = doc.getElementsByTagName("table");
for (int i = 0; i < tables.getLength(); i++) {
final Element table = (Element) tables.item(i);
if (!validateTableRows(table)) {
return false;
... | java | public static boolean validateTables(final Document doc) {
final NodeList tables = doc.getElementsByTagName("table");
for (int i = 0; i < tables.getLength(); i++) {
final Element table = (Element) tables.item(i);
if (!validateTableRows(table)) {
return false;
... | [
"public",
"static",
"boolean",
"validateTables",
"(",
"final",
"Document",
"doc",
")",
"{",
"final",
"NodeList",
"tables",
"=",
"doc",
".",
"getElementsByTagName",
"(",
"\"table\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"tables",
"."... | Checks to see if the Rows, in XML Tables exceed the maximum number of columns.
@param doc The XML DOM Document to be validated.
@return True if the XML is valid, otherwise false. | [
"Checks",
"to",
"see",
"if",
"the",
"Rows",
"in",
"XML",
"Tables",
"exceed",
"the",
"maximum",
"number",
"of",
"columns",
"."
] | 5ebf5ed30a94c34c33f4708caa04a8da99cbb15c | https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java#L4088-L4106 | train |
pressgang-ccms/PressGangCCMSCommonUtilities | src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java | DocBookUtilities.checkForInvalidInfoElements | public static boolean checkForInvalidInfoElements(final Document doc) {
final List<Node> invalidElements = XMLUtilities.getDirectChildNodes(doc.getDocumentElement(), "title", "subtitle", "titleabbrev");
return invalidElements != null && !invalidElements.isEmpty();
} | java | public static boolean checkForInvalidInfoElements(final Document doc) {
final List<Node> invalidElements = XMLUtilities.getDirectChildNodes(doc.getDocumentElement(), "title", "subtitle", "titleabbrev");
return invalidElements != null && !invalidElements.isEmpty();
} | [
"public",
"static",
"boolean",
"checkForInvalidInfoElements",
"(",
"final",
"Document",
"doc",
")",
"{",
"final",
"List",
"<",
"Node",
">",
"invalidElements",
"=",
"XMLUtilities",
".",
"getDirectChildNodes",
"(",
"doc",
".",
"getDocumentElement",
"(",
")",
",",
... | Checks that the
@param doc
@return | [
"Checks",
"that",
"the"
] | 5ebf5ed30a94c34c33f4708caa04a8da99cbb15c | https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java#L4114-L4117 | train |
pressgang-ccms/PressGangCCMSCommonUtilities | src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java | DocBookUtilities.validateRevisionHistory | public static String validateRevisionHistory(final Document doc, final String[] dateFormats) {
final List<String> invalidRevNumbers = new ArrayList<String>();
// Find each <revnumber> element and make sure it matches the publican regex
final NodeList revisions = doc.getElementsByTagName("revisi... | java | public static String validateRevisionHistory(final Document doc, final String[] dateFormats) {
final List<String> invalidRevNumbers = new ArrayList<String>();
// Find each <revnumber> element and make sure it matches the publican regex
final NodeList revisions = doc.getElementsByTagName("revisi... | [
"public",
"static",
"String",
"validateRevisionHistory",
"(",
"final",
"Document",
"doc",
",",
"final",
"String",
"[",
"]",
"dateFormats",
")",
"{",
"final",
"List",
"<",
"String",
">",
"invalidRevNumbers",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"... | Validates a Revision History XML DOM Document to ensure that the content is valid for use with Publican.
@param doc The DOM Document that represents the XML that is to be validated.
@param dateFormats The valid date formats that can be used.
@return Null if there weren't any errors otherwise an error message t... | [
"Validates",
"a",
"Revision",
"History",
"XML",
"DOM",
"Document",
"to",
"ensure",
"that",
"the",
"content",
"is",
"valid",
"for",
"use",
"with",
"Publican",
"."
] | 5ebf5ed30a94c34c33f4708caa04a8da99cbb15c | https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java#L4126-L4177 | train |
pressgang-ccms/PressGangCCMSCommonUtilities | src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java | DocBookUtilities.cleanDate | private static String cleanDate(final String dateString) {
if (dateString == null) {
return dateString;
}
String retValue = dateString;
retValue = THURSDAY_DATE_RE.matcher(retValue).replaceAll("Thu");
retValue = TUESDAY_DATE_RE.matcher(retValue).replaceAll("Tue");
... | java | private static String cleanDate(final String dateString) {
if (dateString == null) {
return dateString;
}
String retValue = dateString;
retValue = THURSDAY_DATE_RE.matcher(retValue).replaceAll("Thu");
retValue = TUESDAY_DATE_RE.matcher(retValue).replaceAll("Tue");
... | [
"private",
"static",
"String",
"cleanDate",
"(",
"final",
"String",
"dateString",
")",
"{",
"if",
"(",
"dateString",
"==",
"null",
")",
"{",
"return",
"dateString",
";",
"}",
"String",
"retValue",
"=",
"dateString",
";",
"retValue",
"=",
"THURSDAY_DATE_RE",
... | Basic method to clean a date string to fix any partial day names. It currently cleans "Thur", "Thurs" and "Tues".
@param dateString
@return | [
"Basic",
"method",
"to",
"clean",
"a",
"date",
"string",
"to",
"fix",
"any",
"partial",
"day",
"names",
".",
"It",
"currently",
"cleans",
"Thur",
"Thurs",
"and",
"Tues",
"."
] | 5ebf5ed30a94c34c33f4708caa04a8da99cbb15c | https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java#L4185-L4195 | train |
EsfingeFramework/ClassMock | ClassMock/src/main/java/net/sf/esfinge/classmock/ClassMockUtils.java | ClassMockUtils.get | public static Object get(final Object bean, final String property) {
try {
if (property.indexOf(".") >= 0) {
final Object subBean = ClassMockUtils.get(bean, property.substring(0, property.indexOf(".")));
if (subBean == null) {
return null;
... | java | public static Object get(final Object bean, final String property) {
try {
if (property.indexOf(".") >= 0) {
final Object subBean = ClassMockUtils.get(bean, property.substring(0, property.indexOf(".")));
if (subBean == null) {
return null;
... | [
"public",
"static",
"Object",
"get",
"(",
"final",
"Object",
"bean",
",",
"final",
"String",
"property",
")",
"{",
"try",
"{",
"if",
"(",
"property",
".",
"indexOf",
"(",
"\".\"",
")",
">=",
"0",
")",
"{",
"final",
"Object",
"subBean",
"=",
"ClassMockU... | Access the value in the property of the bean.
@param bean
to inspect
@param property
the name of the property to be access
@return the value | [
"Access",
"the",
"value",
"in",
"the",
"property",
"of",
"the",
"bean",
"."
] | a354c9dc68e8813fc4e995eef13e34796af58892 | https://github.com/EsfingeFramework/ClassMock/blob/a354c9dc68e8813fc4e995eef13e34796af58892/ClassMock/src/main/java/net/sf/esfinge/classmock/ClassMockUtils.java#L24-L55 | train |
EsfingeFramework/ClassMock | ClassMock/src/main/java/net/sf/esfinge/classmock/ClassMockUtils.java | ClassMockUtils.newInstance | public static Object newInstance(final IClassWriter classMock) {
try {
final Class<?> clazz = classMock.build();
return clazz.newInstance();
} catch (final Exception e) {
throw new RuntimeException("Can't intanciate class", e);
}
} | java | public static Object newInstance(final IClassWriter classMock) {
try {
final Class<?> clazz = classMock.build();
return clazz.newInstance();
} catch (final Exception e) {
throw new RuntimeException("Can't intanciate class", e);
}
} | [
"public",
"static",
"Object",
"newInstance",
"(",
"final",
"IClassWriter",
"classMock",
")",
"{",
"try",
"{",
"final",
"Class",
"<",
"?",
">",
"clazz",
"=",
"classMock",
".",
"build",
"(",
")",
";",
"return",
"clazz",
".",
"newInstance",
"(",
")",
";",
... | Creates a new instance from class generated by IClassWriter
@param classMock
the class definition
@return instance of your class defined by IClassWriter | [
"Creates",
"a",
"new",
"instance",
"from",
"class",
"generated",
"by",
"IClassWriter"
] | a354c9dc68e8813fc4e995eef13e34796af58892 | https://github.com/EsfingeFramework/ClassMock/blob/a354c9dc68e8813fc4e995eef13e34796af58892/ClassMock/src/main/java/net/sf/esfinge/classmock/ClassMockUtils.java#L184-L196 | train |
triceo/splitlog | splitlog-api/src/main/java/com/github/triceo/splitlog/api/LogWatchBuilder.java | LogWatchBuilder.withDelayBetweenReads | public LogWatchBuilder withDelayBetweenReads(final int length, final TimeUnit unit) {
this.delayBetweenReads = LogWatchBuilder.getDelay(length, unit);
return this;
} | java | public LogWatchBuilder withDelayBetweenReads(final int length, final TimeUnit unit) {
this.delayBetweenReads = LogWatchBuilder.getDelay(length, unit);
return this;
} | [
"public",
"LogWatchBuilder",
"withDelayBetweenReads",
"(",
"final",
"int",
"length",
",",
"final",
"TimeUnit",
"unit",
")",
"{",
"this",
".",
"delayBetweenReads",
"=",
"LogWatchBuilder",
".",
"getDelay",
"(",
"length",
",",
"unit",
")",
";",
"return",
"this",
... | Specify the delay between attempts to read the file.
@param length
Length of time.
@param unit
Unit of that length.
@return This. | [
"Specify",
"the",
"delay",
"between",
"attempts",
"to",
"read",
"the",
"file",
"."
] | 4e1b188e8c814119f5cf7343bbc53917843d68a2 | https://github.com/triceo/splitlog/blob/4e1b188e8c814119f5cf7343bbc53917843d68a2/splitlog-api/src/main/java/com/github/triceo/splitlog/api/LogWatchBuilder.java#L314-L317 | train |
triceo/splitlog | splitlog-api/src/main/java/com/github/triceo/splitlog/api/LogWatchBuilder.java | LogWatchBuilder.withDelayBetweenSweeps | public LogWatchBuilder withDelayBetweenSweeps(final int length, final TimeUnit unit) {
this.delayBetweenSweeps = LogWatchBuilder.getDelay(length, unit);
return this;
} | java | public LogWatchBuilder withDelayBetweenSweeps(final int length, final TimeUnit unit) {
this.delayBetweenSweeps = LogWatchBuilder.getDelay(length, unit);
return this;
} | [
"public",
"LogWatchBuilder",
"withDelayBetweenSweeps",
"(",
"final",
"int",
"length",
",",
"final",
"TimeUnit",
"unit",
")",
"{",
"this",
".",
"delayBetweenSweeps",
"=",
"LogWatchBuilder",
".",
"getDelay",
"(",
"length",
",",
"unit",
")",
";",
"return",
"this",
... | Specify the delay between attempts to sweep the log watch from
unreachable messages.
@param length
Length of time.
@param unit
Unit of that length.
@return This. | [
"Specify",
"the",
"delay",
"between",
"attempts",
"to",
"sweep",
"the",
"log",
"watch",
"from",
"unreachable",
"messages",
"."
] | 4e1b188e8c814119f5cf7343bbc53917843d68a2 | https://github.com/triceo/splitlog/blob/4e1b188e8c814119f5cf7343bbc53917843d68a2/splitlog-api/src/main/java/com/github/triceo/splitlog/api/LogWatchBuilder.java#L329-L332 | train |
misha/iroh | src/main/java/com/github/msoliter/iroh/container/services/Registrar.java | Registrar.register | private Source register(Source source) {
/**
* As promised, the registrar simply abstracts away internal resolvers
* by iterating over them during the registration process.
*/
for (Resolver resolver : resolvers) {
resolver.register(source);
}
... | java | private Source register(Source source) {
/**
* As promised, the registrar simply abstracts away internal resolvers
* by iterating over them during the registration process.
*/
for (Resolver resolver : resolvers) {
resolver.register(source);
}
... | [
"private",
"Source",
"register",
"(",
"Source",
"source",
")",
"{",
"/**\n * As promised, the registrar simply abstracts away internal resolvers\n * by iterating over them during the registration process.\n */",
"for",
"(",
"Resolver",
"resolver",
":",
"resolvers"... | Registers a source of instances with all the internal resolvers.
@param source The source to be registered.
@return The argument source, for chaining. | [
"Registers",
"a",
"source",
"of",
"instances",
"with",
"all",
"the",
"internal",
"resolvers",
"."
] | 5dc92a01d3b2f3ba63e8ad1bf9b5fe342d0b679a | https://github.com/misha/iroh/blob/5dc92a01d3b2f3ba63e8ad1bf9b5fe342d0b679a/src/main/java/com/github/msoliter/iroh/container/services/Registrar.java#L151-L162 | train |
misha/iroh | src/main/java/com/github/msoliter/iroh/container/services/Registrar.java | Registrar.checkForCycles | private void checkForCycles(
Class<?> target,
Class<?> in,
Stack<Class<?>> trace) {
for (Field field : in.getDeclaredFields()) {
if (field.getAnnotation(Autowired.class) != null) {
Class<?> type = field.getType();
trace.push(type);... | java | private void checkForCycles(
Class<?> target,
Class<?> in,
Stack<Class<?>> trace) {
for (Field field : in.getDeclaredFields()) {
if (field.getAnnotation(Autowired.class) != null) {
Class<?> type = field.getType();
trace.push(type);... | [
"private",
"void",
"checkForCycles",
"(",
"Class",
"<",
"?",
">",
"target",
",",
"Class",
"<",
"?",
">",
"in",
",",
"Stack",
"<",
"Class",
"<",
"?",
">",
">",
"trace",
")",
"{",
"for",
"(",
"Field",
"field",
":",
"in",
".",
"getDeclaredFields",
"("... | A simple recursive cycle-checker implementation that records the current
stack trace as an argument parameter for the purpose of producing an
accurate error message in the case of an error.
@param target The target type to be checked for cyclic dependencies. This
should not change across recursive calls to the method.... | [
"A",
"simple",
"recursive",
"cycle",
"-",
"checker",
"implementation",
"that",
"records",
"the",
"current",
"stack",
"trace",
"as",
"an",
"argument",
"parameter",
"for",
"the",
"purpose",
"of",
"producing",
"an",
"accurate",
"error",
"message",
"in",
"the",
"c... | 5dc92a01d3b2f3ba63e8ad1bf9b5fe342d0b679a | https://github.com/misha/iroh/blob/5dc92a01d3b2f3ba63e8ad1bf9b5fe342d0b679a/src/main/java/com/github/msoliter/iroh/container/services/Registrar.java#L190-L210 | train |
gtrght/jtuples | src/main/java/com/othelle/jtuples/serialize/JacksonConverter.java | JacksonConverter.getTupleMapperModule | public static SimpleModule getTupleMapperModule() {
SimpleModule module = new SimpleModule("1", Version.unknownVersion());
SimpleAbstractTypeResolver resolver = getTupleTypeResolver();
module.setAbstractTypes(resolver);
module.setKeyDeserializers(new SimpleKeyDeserializers());
r... | java | public static SimpleModule getTupleMapperModule() {
SimpleModule module = new SimpleModule("1", Version.unknownVersion());
SimpleAbstractTypeResolver resolver = getTupleTypeResolver();
module.setAbstractTypes(resolver);
module.setKeyDeserializers(new SimpleKeyDeserializers());
r... | [
"public",
"static",
"SimpleModule",
"getTupleMapperModule",
"(",
")",
"{",
"SimpleModule",
"module",
"=",
"new",
"SimpleModule",
"(",
"\"1\"",
",",
"Version",
".",
"unknownVersion",
"(",
")",
")",
";",
"SimpleAbstractTypeResolver",
"resolver",
"=",
"getTupleTypeReso... | Returns the default mapping for all the possible TupleN
@return | [
"Returns",
"the",
"default",
"mapping",
"for",
"all",
"the",
"possible",
"TupleN"
] | f76a6c710cc7b8360130fc4f83be4e5a1bb2de6e | https://github.com/gtrght/jtuples/blob/f76a6c710cc7b8360130fc4f83be4e5a1bb2de6e/src/main/java/com/othelle/jtuples/serialize/JacksonConverter.java#L28-L35 | train |
keenon/loglinear | src/main/java/com/github/keenon/loglinear/learning/AbstractBatchOptimizer.java | AbstractBatchOptimizer.addSparseConstraint | public void addSparseConstraint(int component, int index, double value) {
constraints.add(new Constraint(component, index, value));
} | java | public void addSparseConstraint(int component, int index, double value) {
constraints.add(new Constraint(component, index, value));
} | [
"public",
"void",
"addSparseConstraint",
"(",
"int",
"component",
",",
"int",
"index",
",",
"double",
"value",
")",
"{",
"constraints",
".",
"add",
"(",
"new",
"Constraint",
"(",
"component",
",",
"index",
",",
"value",
")",
")",
";",
"}"
] | This adds a constraint on the weight vector, that a certain component must be set to a sparse index=value
@param component the component to fix
@param index the index of the fixed sparse component
@param value the value to fix at | [
"This",
"adds",
"a",
"constraint",
"on",
"the",
"weight",
"vector",
"that",
"a",
"certain",
"component",
"must",
"be",
"set",
"to",
"a",
"sparse",
"index",
"=",
"value"
] | fa0c370ab6782015412f676ef2ab11c97be58e29 | https://github.com/keenon/loglinear/blob/fa0c370ab6782015412f676ef2ab11c97be58e29/src/main/java/com/github/keenon/loglinear/learning/AbstractBatchOptimizer.java#L106-L108 | train |
josueeduardo/snappy | plugin-parent/snappy-maven-plugin/src/main/java/io/joshworks/snappy/maven/tools/RunProcess.java | RunProcess.isInheritIOBroken | private static boolean isInheritIOBroken() {
if (!System.getProperty("os.name", "none").toLowerCase().contains("windows")) {
return false;
}
String runtime = System.getProperty("java.runtime.version");
if (!runtime.startsWith("1.7")) {
return false;
}
... | java | private static boolean isInheritIOBroken() {
if (!System.getProperty("os.name", "none").toLowerCase().contains("windows")) {
return false;
}
String runtime = System.getProperty("java.runtime.version");
if (!runtime.startsWith("1.7")) {
return false;
}
... | [
"private",
"static",
"boolean",
"isInheritIOBroken",
"(",
")",
"{",
"if",
"(",
"!",
"System",
".",
"getProperty",
"(",
"\"os.name\"",
",",
"\"none\"",
")",
".",
"toLowerCase",
"(",
")",
".",
"contains",
"(",
"\"windows\"",
")",
")",
"{",
"return",
"false",... | that means we need to avoid inheritIO | [
"that",
"means",
"we",
"need",
"to",
"avoid",
"inheritIO"
] | d95a9e811eda3c24a5e53086369208819884fa49 | https://github.com/josueeduardo/snappy/blob/d95a9e811eda3c24a5e53086369208819884fa49/plugin-parent/snappy-maven-plugin/src/main/java/io/joshworks/snappy/maven/tools/RunProcess.java#L56-L77 | train |
dbracewell/mango | src/main/java/com/davidbracewell/logging/LogManager.java | LogManager.setFormatter | public synchronized static void setFormatter(Formatter formatter) {
java.util.logging.Logger root = java.util.logging.LogManager.getLogManager().getLogger(StringUtils.EMPTY);
for (Handler h : root.getHandlers()) {
h.setFormatter(formatter);
}
} | java | public synchronized static void setFormatter(Formatter formatter) {
java.util.logging.Logger root = java.util.logging.LogManager.getLogManager().getLogger(StringUtils.EMPTY);
for (Handler h : root.getHandlers()) {
h.setFormatter(formatter);
}
} | [
"public",
"synchronized",
"static",
"void",
"setFormatter",
"(",
"Formatter",
"formatter",
")",
"{",
"java",
".",
"util",
".",
"logging",
".",
"Logger",
"root",
"=",
"java",
".",
"util",
".",
"logging",
".",
"LogManager",
".",
"getLogManager",
"(",
")",
".... | Sets the formatter to use for all handlers.
@param formatter the formatter to use | [
"Sets",
"the",
"formatter",
"to",
"use",
"for",
"all",
"handlers",
"."
] | 2cec08826f1fccd658694dd03abce10fc97618ec | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/logging/LogManager.java#L77-L82 | train |
dbracewell/mango | src/main/java/com/davidbracewell/logging/LogManager.java | LogManager.clearHandlers | public synchronized static void clearHandlers() {
java.util.logging.Logger root = java.util.logging.LogManager.getLogManager().getLogger(StringUtils.EMPTY);
Handler[] handlers = root.getHandlers();
for (Handler h : handlers) {
root.removeHandler(h);
}
} | java | public synchronized static void clearHandlers() {
java.util.logging.Logger root = java.util.logging.LogManager.getLogManager().getLogger(StringUtils.EMPTY);
Handler[] handlers = root.getHandlers();
for (Handler h : handlers) {
root.removeHandler(h);
}
} | [
"public",
"synchronized",
"static",
"void",
"clearHandlers",
"(",
")",
"{",
"java",
".",
"util",
".",
"logging",
".",
"Logger",
"root",
"=",
"java",
".",
"util",
".",
"logging",
".",
"LogManager",
".",
"getLogManager",
"(",
")",
".",
"getLogger",
"(",
"S... | Clears all handlers from the logger | [
"Clears",
"all",
"handlers",
"from",
"the",
"logger"
] | 2cec08826f1fccd658694dd03abce10fc97618ec | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/logging/LogManager.java#L87-L93 | train |
dbracewell/mango | src/main/java/com/davidbracewell/logging/LogManager.java | LogManager.addHandler | public synchronized static void addHandler(Handler handler) {
java.util.logging.Logger root = java.util.logging.LogManager.getLogManager().getLogger(StringUtils.EMPTY);
root.addHandler(handler);
} | java | public synchronized static void addHandler(Handler handler) {
java.util.logging.Logger root = java.util.logging.LogManager.getLogManager().getLogger(StringUtils.EMPTY);
root.addHandler(handler);
} | [
"public",
"synchronized",
"static",
"void",
"addHandler",
"(",
"Handler",
"handler",
")",
"{",
"java",
".",
"util",
".",
"logging",
".",
"Logger",
"root",
"=",
"java",
".",
"util",
".",
"logging",
".",
"LogManager",
".",
"getLogManager",
"(",
")",
".",
"... | Adds a handler to the root.
@param handler the handler to add | [
"Adds",
"a",
"handler",
"to",
"the",
"root",
"."
] | 2cec08826f1fccd658694dd03abce10fc97618ec | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/logging/LogManager.java#L113-L116 | train |
dbracewell/mango | src/main/java/com/davidbracewell/logging/LogManager.java | LogManager.getLogger | public Logger getLogger(Class<?> clazz) {
if (clazz == null) {
return getGlobalLogger();
}
return getLogger(clazz.getName());
} | java | public Logger getLogger(Class<?> clazz) {
if (clazz == null) {
return getGlobalLogger();
}
return getLogger(clazz.getName());
} | [
"public",
"Logger",
"getLogger",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"if",
"(",
"clazz",
"==",
"null",
")",
"{",
"return",
"getGlobalLogger",
"(",
")",
";",
"}",
"return",
"getLogger",
"(",
"clazz",
".",
"getName",
"(",
")",
")",
";",
"... | Gets the logger for the given class.
@param clazz The class whose logger we want
@return A logger associated with the given class | [
"Gets",
"the",
"logger",
"for",
"the",
"given",
"class",
"."
] | 2cec08826f1fccd658694dd03abce10fc97618ec | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/logging/LogManager.java#L124-L129 | train |
dbracewell/mango | src/main/java/com/davidbracewell/logging/LogManager.java | LogManager.getGlobalLogger | public Logger getGlobalLogger() {
return new Logger(java.util.logging.Logger
.getLogger(java.util.logging.Logger.GLOBAL_LOGGER_NAME));
} | java | public Logger getGlobalLogger() {
return new Logger(java.util.logging.Logger
.getLogger(java.util.logging.Logger.GLOBAL_LOGGER_NAME));
} | [
"public",
"Logger",
"getGlobalLogger",
"(",
")",
"{",
"return",
"new",
"Logger",
"(",
"java",
".",
"util",
".",
"logging",
".",
"Logger",
".",
"getLogger",
"(",
"java",
".",
"util",
".",
"logging",
".",
"Logger",
".",
"GLOBAL_LOGGER_NAME",
")",
")",
";",... | Gets the global Logger
@return The global logger | [
"Gets",
"the",
"global",
"Logger"
] | 2cec08826f1fccd658694dd03abce10fc97618ec | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/logging/LogManager.java#L145-L148 | train |
dbracewell/mango | src/main/java/com/davidbracewell/logging/LogManager.java | LogManager.getLoggerNames | public List<String> getLoggerNames() {
return Collections.list(java.util.logging.LogManager.getLogManager().getLoggerNames());
} | java | public List<String> getLoggerNames() {
return Collections.list(java.util.logging.LogManager.getLogManager().getLoggerNames());
} | [
"public",
"List",
"<",
"String",
">",
"getLoggerNames",
"(",
")",
"{",
"return",
"Collections",
".",
"list",
"(",
"java",
".",
"util",
".",
"logging",
".",
"LogManager",
".",
"getLogManager",
"(",
")",
".",
"getLoggerNames",
"(",
")",
")",
";",
"}"
] | Gets an Enumeration of all of the current loggers.
@return An of logger names | [
"Gets",
"an",
"Enumeration",
"of",
"all",
"of",
"the",
"current",
"loggers",
"."
] | 2cec08826f1fccd658694dd03abce10fc97618ec | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/logging/LogManager.java#L155-L157 | train |
dbracewell/mango | src/main/java/com/davidbracewell/logging/LogManager.java | LogManager.setLevel | public void setLevel(String logger, Level level) {
Logger log = getLogger(logger);
log.setLevel(level);
for (String loggerName : getLoggerNames()) {
if (loggerName.startsWith(logger) && !loggerName.equals(logger)) {
getLogger(loggerName).setLevel(level);
}
}
} | java | public void setLevel(String logger, Level level) {
Logger log = getLogger(logger);
log.setLevel(level);
for (String loggerName : getLoggerNames()) {
if (loggerName.startsWith(logger) && !loggerName.equals(logger)) {
getLogger(loggerName).setLevel(level);
}
}
} | [
"public",
"void",
"setLevel",
"(",
"String",
"logger",
",",
"Level",
"level",
")",
"{",
"Logger",
"log",
"=",
"getLogger",
"(",
"logger",
")",
";",
"log",
".",
"setLevel",
"(",
"level",
")",
";",
"for",
"(",
"String",
"loggerName",
":",
"getLoggerNames",... | Sets the level of a logger
@param logger The name of the logger to set the level for.
@param level The level to set the logger at | [
"Sets",
"the",
"level",
"of",
"a",
"logger"
] | 2cec08826f1fccd658694dd03abce10fc97618ec | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/logging/LogManager.java#L165-L173 | train |
wcm-io-caravan/caravan-hal | docs/src/main/java/io/wcm/caravan/hal/docs/impl/TemplateRenderer.java | TemplateRenderer.renderServiceHtml | public String renderServiceHtml(io.wcm.caravan.hal.docs.impl.model.Service service) throws IOException {
Map<String, Object> model = ImmutableMap.<String, Object>builder()
.put("service", service)
.build();
return render(service, model, serviceTemplate);
} | java | public String renderServiceHtml(io.wcm.caravan.hal.docs.impl.model.Service service) throws IOException {
Map<String, Object> model = ImmutableMap.<String, Object>builder()
.put("service", service)
.build();
return render(service, model, serviceTemplate);
} | [
"public",
"String",
"renderServiceHtml",
"(",
"io",
".",
"wcm",
".",
"caravan",
".",
"hal",
".",
"docs",
".",
"impl",
".",
"model",
".",
"Service",
"service",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"model",
"=",
"I... | Generate HTML file for service.
@param service Service
@return Rendered markup
@throws IOException | [
"Generate",
"HTML",
"file",
"for",
"service",
"."
] | 25d58756b58c70c8c48a17fe781e673dd93d5085 | https://github.com/wcm-io-caravan/caravan-hal/blob/25d58756b58c70c8c48a17fe781e673dd93d5085/docs/src/main/java/io/wcm/caravan/hal/docs/impl/TemplateRenderer.java#L69-L74 | train |
wcm-io-caravan/caravan-hal | docs/src/main/java/io/wcm/caravan/hal/docs/impl/TemplateRenderer.java | TemplateRenderer.renderLinkRelationHtml | public String renderLinkRelationHtml(io.wcm.caravan.hal.docs.impl.model.Service service, LinkRelation linkRelation)
throws IOException {
Map<String, Object> model = ImmutableMap.<String, Object>builder()
.put("service", service)
.put("linkRelation", linkRelation)
.build();
return r... | java | public String renderLinkRelationHtml(io.wcm.caravan.hal.docs.impl.model.Service service, LinkRelation linkRelation)
throws IOException {
Map<String, Object> model = ImmutableMap.<String, Object>builder()
.put("service", service)
.put("linkRelation", linkRelation)
.build();
return r... | [
"public",
"String",
"renderLinkRelationHtml",
"(",
"io",
".",
"wcm",
".",
"caravan",
".",
"hal",
".",
"docs",
".",
"impl",
".",
"model",
".",
"Service",
"service",
",",
"LinkRelation",
"linkRelation",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"String",
... | Generate HTML file for link relation.
@param service Service
@param linkRelation Link relation
@return Rendered markup
@throws IOException | [
"Generate",
"HTML",
"file",
"for",
"link",
"relation",
"."
] | 25d58756b58c70c8c48a17fe781e673dd93d5085 | https://github.com/wcm-io-caravan/caravan-hal/blob/25d58756b58c70c8c48a17fe781e673dd93d5085/docs/src/main/java/io/wcm/caravan/hal/docs/impl/TemplateRenderer.java#L83-L90 | train |
wcm-io-caravan/caravan-hal | docs/src/main/java/io/wcm/caravan/hal/docs/impl/TemplateRenderer.java | TemplateRenderer.render | private String render(io.wcm.caravan.hal.docs.impl.model.Service service, Map<String, Object> model,
Template template) throws IOException {
Map<String, Object> mergedModel = ImmutableMap.<String, Object>builder()
.putAll(model)
.put("docsContext", ImmutableMap.<String, Object>builder()
... | java | private String render(io.wcm.caravan.hal.docs.impl.model.Service service, Map<String, Object> model,
Template template) throws IOException {
Map<String, Object> mergedModel = ImmutableMap.<String, Object>builder()
.putAll(model)
.put("docsContext", ImmutableMap.<String, Object>builder()
... | [
"private",
"String",
"render",
"(",
"io",
".",
"wcm",
".",
"caravan",
".",
"hal",
".",
"docs",
".",
"impl",
".",
"model",
".",
"Service",
"service",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"model",
",",
"Template",
"template",
")",
"throws",
"... | Generate templated file with handlebars
@param model Model
@param template Template
@return Rendered markup | [
"Generate",
"templated",
"file",
"with",
"handlebars"
] | 25d58756b58c70c8c48a17fe781e673dd93d5085 | https://github.com/wcm-io-caravan/caravan-hal/blob/25d58756b58c70c8c48a17fe781e673dd93d5085/docs/src/main/java/io/wcm/caravan/hal/docs/impl/TemplateRenderer.java#L98-L108 | train |
triceo/splitlog | splitlog-core/src/main/java/com/github/triceo/splitlog/LogWatchStorageSweeper.java | LogWatchStorageSweeper.start | public boolean start() {
if (!this.isStarted.compareAndSet(false, true)) {
return false;
}
final long delay = this.delayBetweenSweeps;
this.timer.scheduleWithFixedDelay(this, delay, delay, TimeUnit.MILLISECONDS);
LogWatchStorageSweeper.LOGGER.info(
"Sc... | java | public boolean start() {
if (!this.isStarted.compareAndSet(false, true)) {
return false;
}
final long delay = this.delayBetweenSweeps;
this.timer.scheduleWithFixedDelay(this, delay, delay, TimeUnit.MILLISECONDS);
LogWatchStorageSweeper.LOGGER.info(
"Sc... | [
"public",
"boolean",
"start",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"isStarted",
".",
"compareAndSet",
"(",
"false",
",",
"true",
")",
")",
"{",
"return",
"false",
";",
"}",
"final",
"long",
"delay",
"=",
"this",
".",
"delayBetweenSweeps",
";",
... | Start the sweeping if not started already.
@return False if already called before, true otherwise. | [
"Start",
"the",
"sweeping",
"if",
"not",
"started",
"already",
"."
] | 4e1b188e8c814119f5cf7343bbc53917843d68a2 | https://github.com/triceo/splitlog/blob/4e1b188e8c814119f5cf7343bbc53917843d68a2/splitlog-core/src/main/java/com/github/triceo/splitlog/LogWatchStorageSweeper.java#L60-L70 | train |
triceo/splitlog | splitlog-core/src/main/java/com/github/triceo/splitlog/LogWatchStorageSweeper.java | LogWatchStorageSweeper.stop | public boolean stop() {
if (!this.isStarted.get() || !this.isStopped.compareAndSet(false, true)) {
return false;
}
this.timer.shutdown();
LogWatchStorageSweeper.LOGGER.info("Cancelled automated unreachable message sweep in {}.",
this.messaging.getLogWatch());
... | java | public boolean stop() {
if (!this.isStarted.get() || !this.isStopped.compareAndSet(false, true)) {
return false;
}
this.timer.shutdown();
LogWatchStorageSweeper.LOGGER.info("Cancelled automated unreachable message sweep in {}.",
this.messaging.getLogWatch());
... | [
"public",
"boolean",
"stop",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"isStarted",
".",
"get",
"(",
")",
"||",
"!",
"this",
".",
"isStopped",
".",
"compareAndSet",
"(",
"false",
",",
"true",
")",
")",
"{",
"return",
"false",
";",
"}",
"this",
... | Stop the sweeping if not stopped already.
@return False if {@link #start()} not called or {@link #stop()} called
already. | [
"Stop",
"the",
"sweeping",
"if",
"not",
"stopped",
"already",
"."
] | 4e1b188e8c814119f5cf7343bbc53917843d68a2 | https://github.com/triceo/splitlog/blob/4e1b188e8c814119f5cf7343bbc53917843d68a2/splitlog-core/src/main/java/com/github/triceo/splitlog/LogWatchStorageSweeper.java#L78-L86 | train |
syphr42/prom | src/main/java/org/syphr/prom/ManagedProperties.java | ManagedProperties.copyProperties | private Properties copyProperties(Properties source)
{
Properties copy = new Properties();
if (source != null)
{
copy.putAll(source);
}
return copy;
} | java | private Properties copyProperties(Properties source)
{
Properties copy = new Properties();
if (source != null)
{
copy.putAll(source);
}
return copy;
} | [
"private",
"Properties",
"copyProperties",
"(",
"Properties",
"source",
")",
"{",
"Properties",
"copy",
"=",
"new",
"Properties",
"(",
")",
";",
"if",
"(",
"source",
"!=",
"null",
")",
"{",
"copy",
".",
"putAll",
"(",
"source",
")",
";",
"}",
"return",
... | Copy the given properties to a new object.
@param source
the source from which to copy
@return a copy of the source or <code>null</code> if the source is
<code>null</code> | [
"Copy",
"the",
"given",
"properties",
"to",
"a",
"new",
"object",
"."
] | 074d67c4ebb3afb0b163fcb0bc4826ee577ac803 | https://github.com/syphr42/prom/blob/074d67c4ebb3afb0b163fcb0bc4826ee577ac803/src/main/java/org/syphr/prom/ManagedProperties.java#L98-L108 | train |
syphr42/prom | src/main/java/org/syphr/prom/ManagedProperties.java | ManagedProperties.save | public void save(File file, String comment, boolean saveDefaults) throws IOException
{
save(file, comment, saveDefaults, null);
} | java | public void save(File file, String comment, boolean saveDefaults) throws IOException
{
save(file, comment, saveDefaults, null);
} | [
"public",
"void",
"save",
"(",
"File",
"file",
",",
"String",
"comment",
",",
"boolean",
"saveDefaults",
")",
"throws",
"IOException",
"{",
"save",
"(",
"file",
",",
"comment",
",",
"saveDefaults",
",",
"null",
")",
";",
"}"
] | Save the current state of the properties within this instance to the
given file.
@param file
the file to which the current properties and their values will
be written
@param comment
an optional comment to put at the top of the file (
<code>null</code> means no comment)
@param saveDefaults
if <code>true</code>, values ... | [
"Save",
"the",
"current",
"state",
"of",
"the",
"properties",
"within",
"this",
"instance",
"to",
"the",
"given",
"file",
"."
] | 074d67c4ebb3afb0b163fcb0bc4826ee577ac803 | https://github.com/syphr42/prom/blob/074d67c4ebb3afb0b163fcb0bc4826ee577ac803/src/main/java/org/syphr/prom/ManagedProperties.java#L237-L240 | train |
syphr42/prom | src/main/java/org/syphr/prom/ManagedProperties.java | ManagedProperties.save | public void save(File file,
String comment,
boolean saveDefaults,
String propertyName) throws IOException
{
gatekeeper.lock();
try
{
File parent = file.getParentFile();
if (!parent.exists() && !parent.mkdi... | java | public void save(File file,
String comment,
boolean saveDefaults,
String propertyName) throws IOException
{
gatekeeper.lock();
try
{
File parent = file.getParentFile();
if (!parent.exists() && !parent.mkdi... | [
"public",
"void",
"save",
"(",
"File",
"file",
",",
"String",
"comment",
",",
"boolean",
"saveDefaults",
",",
"String",
"propertyName",
")",
"throws",
"IOException",
"{",
"gatekeeper",
".",
"lock",
"(",
")",
";",
"try",
"{",
"File",
"parent",
"=",
"file",
... | Save the current state of the given property to the given file without
saving all of the other properties within this instance.
@param file
the file to which the current properties and their values will
be written
@param comment
an optional comment to put at the top of the file (
<code>null</code> means no comment)
@p... | [
"Save",
"the",
"current",
"state",
"of",
"the",
"given",
"property",
"to",
"the",
"given",
"file",
"without",
"saving",
"all",
"of",
"the",
"other",
"properties",
"within",
"this",
"instance",
"."
] | 074d67c4ebb3afb0b163fcb0bc4826ee577ac803 | https://github.com/syphr42/prom/blob/074d67c4ebb3afb0b163fcb0bc4826ee577ac803/src/main/java/org/syphr/prom/ManagedProperties.java#L264-L312 | train |
syphr42/prom | src/main/java/org/syphr/prom/ManagedProperties.java | ManagedProperties.getProperty | public String getProperty(String propertyName)
{
ChangeStack<String> stack = properties.get(propertyName);
if (stack == null)
{
return null;
}
return stack.getCurrentValue();
} | java | public String getProperty(String propertyName)
{
ChangeStack<String> stack = properties.get(propertyName);
if (stack == null)
{
return null;
}
return stack.getCurrentValue();
} | [
"public",
"String",
"getProperty",
"(",
"String",
"propertyName",
")",
"{",
"ChangeStack",
"<",
"String",
">",
"stack",
"=",
"properties",
".",
"get",
"(",
"propertyName",
")",
";",
"if",
"(",
"stack",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
... | Retrieve the value associated with the given property.
@param propertyName
the property whose value is requested
@return the value associated with the given property or <code>null</code>
if no such property exists | [
"Retrieve",
"the",
"value",
"associated",
"with",
"the",
"given",
"property",
"."
] | 074d67c4ebb3afb0b163fcb0bc4826ee577ac803 | https://github.com/syphr42/prom/blob/074d67c4ebb3afb0b163fcb0bc4826ee577ac803/src/main/java/org/syphr/prom/ManagedProperties.java#L322-L331 | train |
syphr42/prom | src/main/java/org/syphr/prom/ManagedProperties.java | ManagedProperties.setProperty | public boolean setProperty(String propertyName, String value) throws NullPointerException
{
return setValue(propertyName, value, false);
} | java | public boolean setProperty(String propertyName, String value) throws NullPointerException
{
return setValue(propertyName, value, false);
} | [
"public",
"boolean",
"setProperty",
"(",
"String",
"propertyName",
",",
"String",
"value",
")",
"throws",
"NullPointerException",
"{",
"return",
"setValue",
"(",
"propertyName",
",",
"value",
",",
"false",
")",
";",
"}"
] | Set a new value for the given property.
@param propertyName
the property whose value will be set
@param value
the new value to set
@return <code>true</code> if the value of the given property changed as a
result of this call; <code>false</code> otherwise
@throws NullPointerException
if the give value is <code>null</co... | [
"Set",
"a",
"new",
"value",
"for",
"the",
"given",
"property",
"."
] | 074d67c4ebb3afb0b163fcb0bc4826ee577ac803 | https://github.com/syphr42/prom/blob/074d67c4ebb3afb0b163fcb0bc4826ee577ac803/src/main/java/org/syphr/prom/ManagedProperties.java#L345-L348 | train |
syphr42/prom | src/main/java/org/syphr/prom/ManagedProperties.java | ManagedProperties.setValue | private boolean setValue(String propertyName, String value, boolean sync) throws NullPointerException
{
gatekeeper.signIn();
try
{
ChangeStack<String> stack = properties.get(propertyName);
if (stack == null)
{
ChangeStack<String> newStack =... | java | private boolean setValue(String propertyName, String value, boolean sync) throws NullPointerException
{
gatekeeper.signIn();
try
{
ChangeStack<String> stack = properties.get(propertyName);
if (stack == null)
{
ChangeStack<String> newStack =... | [
"private",
"boolean",
"setValue",
"(",
"String",
"propertyName",
",",
"String",
"value",
",",
"boolean",
"sync",
")",
"throws",
"NullPointerException",
"{",
"gatekeeper",
".",
"signIn",
"(",
")",
";",
"try",
"{",
"ChangeStack",
"<",
"String",
">",
"stack",
"... | Push or sync the given value to the appropriate stack. This method will
create a new stack if this property has never had a value before.
@param propertyName
the property whose value will be set
@param value
the value to set
@param sync
a flag to determine whether the value is
{@link ChangeStack#sync(Object) synced} o... | [
"Push",
"or",
"sync",
"the",
"given",
"value",
"to",
"the",
"appropriate",
"stack",
".",
"This",
"method",
"will",
"create",
"a",
"new",
"stack",
"if",
"this",
"property",
"has",
"never",
"had",
"a",
"value",
"before",
"."
] | 074d67c4ebb3afb0b163fcb0bc4826ee577ac803 | https://github.com/syphr42/prom/blob/074d67c4ebb3afb0b163fcb0bc4826ee577ac803/src/main/java/org/syphr/prom/ManagedProperties.java#L367-L390 | train |
syphr42/prom | src/main/java/org/syphr/prom/ManagedProperties.java | ManagedProperties.resetToDefault | public boolean resetToDefault(String propertyName)
{
gatekeeper.signIn();
try
{
/*
* If this property was added with no default value, all we can do
* is remove the property entirely.
*/
String defaultValue = getDefaultValue(prop... | java | public boolean resetToDefault(String propertyName)
{
gatekeeper.signIn();
try
{
/*
* If this property was added with no default value, all we can do
* is remove the property entirely.
*/
String defaultValue = getDefaultValue(prop... | [
"public",
"boolean",
"resetToDefault",
"(",
"String",
"propertyName",
")",
"{",
"gatekeeper",
".",
"signIn",
"(",
")",
";",
"try",
"{",
"/*\n * If this property was added with no default value, all we can do\n * is remove the property entirely.\n *... | Reset the value associated with specified property to its default value.
@param propertyName
the property whose associated value should be reset
@return <code>true</code> if the value of the given property changed as a
result of this call; <code>false</code> otherwise | [
"Reset",
"the",
"value",
"associated",
"with",
"specified",
"property",
"to",
"its",
"default",
"value",
"."
] | 074d67c4ebb3afb0b163fcb0bc4826ee577ac803 | https://github.com/syphr42/prom/blob/074d67c4ebb3afb0b163fcb0bc4826ee577ac803/src/main/java/org/syphr/prom/ManagedProperties.java#L413-L439 | train |
syphr42/prom | src/main/java/org/syphr/prom/ManagedProperties.java | ManagedProperties.resetToDefaults | public void resetToDefaults()
{
gatekeeper.signIn();
try
{
for (Iterator<Entry<String, ChangeStack<String>>> iter = properties.entrySet()
.iterator(); iter.hasNext();)
{
Ent... | java | public void resetToDefaults()
{
gatekeeper.signIn();
try
{
for (Iterator<Entry<String, ChangeStack<String>>> iter = properties.entrySet()
.iterator(); iter.hasNext();)
{
Ent... | [
"public",
"void",
"resetToDefaults",
"(",
")",
"{",
"gatekeeper",
".",
"signIn",
"(",
")",
";",
"try",
"{",
"for",
"(",
"Iterator",
"<",
"Entry",
"<",
"String",
",",
"ChangeStack",
"<",
"String",
">",
">",
">",
"iter",
"=",
"properties",
".",
"entrySet... | Reset all values to the default values. | [
"Reset",
"all",
"values",
"to",
"the",
"default",
"values",
"."
] | 074d67c4ebb3afb0b163fcb0bc4826ee577ac803 | https://github.com/syphr42/prom/blob/074d67c4ebb3afb0b163fcb0bc4826ee577ac803/src/main/java/org/syphr/prom/ManagedProperties.java#L444-L468 | train |
syphr42/prom | src/main/java/org/syphr/prom/ManagedProperties.java | ManagedProperties.isModified | public boolean isModified(String propertyName)
{
gatekeeper.signIn();
try
{
ChangeStack<String> stack = properties.get(propertyName);
if (stack == null)
{
return false;
}
return stack.isModified();
}
... | java | public boolean isModified(String propertyName)
{
gatekeeper.signIn();
try
{
ChangeStack<String> stack = properties.get(propertyName);
if (stack == null)
{
return false;
}
return stack.isModified();
}
... | [
"public",
"boolean",
"isModified",
"(",
"String",
"propertyName",
")",
"{",
"gatekeeper",
".",
"signIn",
"(",
")",
";",
"try",
"{",
"ChangeStack",
"<",
"String",
">",
"stack",
"=",
"properties",
".",
"get",
"(",
"propertyName",
")",
";",
"if",
"(",
"stac... | Determine whether or not the given property has been modified since it
was last load or saved.
@param propertyName
the property to check
@return <code>true</code> if this property has been modified since the
last time it was loaded or saved; <code>false</code> otherwise | [
"Determine",
"whether",
"or",
"not",
"the",
"given",
"property",
"has",
"been",
"modified",
"since",
"it",
"was",
"last",
"load",
"or",
"saved",
"."
] | 074d67c4ebb3afb0b163fcb0bc4826ee577ac803 | https://github.com/syphr42/prom/blob/074d67c4ebb3afb0b163fcb0bc4826ee577ac803/src/main/java/org/syphr/prom/ManagedProperties.java#L479-L496 | train |
syphr42/prom | src/main/java/org/syphr/prom/ManagedProperties.java | ManagedProperties.isModified | public boolean isModified()
{
gatekeeper.signIn();
try
{
for (ChangeStack<String> stack : properties.values())
{
if (stack.isModified())
{
return true;
}
}
return false;
... | java | public boolean isModified()
{
gatekeeper.signIn();
try
{
for (ChangeStack<String> stack : properties.values())
{
if (stack.isModified())
{
return true;
}
}
return false;
... | [
"public",
"boolean",
"isModified",
"(",
")",
"{",
"gatekeeper",
".",
"signIn",
"(",
")",
";",
"try",
"{",
"for",
"(",
"ChangeStack",
"<",
"String",
">",
"stack",
":",
"properties",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"stack",
".",
"isModifi... | Determine whether or not any property has been modified since the last
load or save.
@return <code>true</code> if any property known to this instance has been
modified since the last load or save; <code>false</code>
otherwise | [
"Determine",
"whether",
"or",
"not",
"any",
"property",
"has",
"been",
"modified",
"since",
"the",
"last",
"load",
"or",
"save",
"."
] | 074d67c4ebb3afb0b163fcb0bc4826ee577ac803 | https://github.com/syphr42/prom/blob/074d67c4ebb3afb0b163fcb0bc4826ee577ac803/src/main/java/org/syphr/prom/ManagedProperties.java#L506-L525 | train |
dbracewell/mango | src/main/java/com/davidbracewell/io/Resources.java | Resources.from | public static Resource from(String resource) {
if (StringUtils.isNullOrBlank(resource)) {
return new StringResource();
}
Matcher matcher = protocolPattern.matcher(resource);
if (matcher.find()) {
String schema = matcher.group("PROTOCOL");
String options = matcher.group... | java | public static Resource from(String resource) {
if (StringUtils.isNullOrBlank(resource)) {
return new StringResource();
}
Matcher matcher = protocolPattern.matcher(resource);
if (matcher.find()) {
String schema = matcher.group("PROTOCOL");
String options = matcher.group... | [
"public",
"static",
"Resource",
"from",
"(",
"String",
"resource",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isNullOrBlank",
"(",
"resource",
")",
")",
"{",
"return",
"new",
"StringResource",
"(",
")",
";",
"}",
"Matcher",
"matcher",
"=",
"protocolPattern",
... | Constructs a resource from a string representation. Defaults to a file based resource if no schema is present.
@param resource The string representation of the resource
@return A resource representing the string representation | [
"Constructs",
"a",
"resource",
"from",
"a",
"string",
"representation",
".",
"Defaults",
"to",
"a",
"file",
"based",
"resource",
"if",
"no",
"schema",
"is",
"present",
"."
] | 2cec08826f1fccd658694dd03abce10fc97618ec | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/io/Resources.java#L70-L105 | train |
dbracewell/mango | src/main/java/com/davidbracewell/io/Resources.java | Resources.temporaryDirectory | public static Resource temporaryDirectory() {
File tempDir = new File(SystemInfo.JAVA_IO_TMPDIR);
String baseName = System.currentTimeMillis() + "-";
for (int i = 0; i < 1_000_000; i++) {
File tmp = new File(tempDir, baseName + i);
if (tmp.mkdir()) {
return new FileResour... | java | public static Resource temporaryDirectory() {
File tempDir = new File(SystemInfo.JAVA_IO_TMPDIR);
String baseName = System.currentTimeMillis() + "-";
for (int i = 0; i < 1_000_000; i++) {
File tmp = new File(tempDir, baseName + i);
if (tmp.mkdir()) {
return new FileResour... | [
"public",
"static",
"Resource",
"temporaryDirectory",
"(",
")",
"{",
"File",
"tempDir",
"=",
"new",
"File",
"(",
"SystemInfo",
".",
"JAVA_IO_TMPDIR",
")",
";",
"String",
"baseName",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"+",
"\"-\"",
";",
"for",... | Creates a new Resource that points to a temporary directory.
@return A resource which is a temporary directory on disk | [
"Creates",
"a",
"new",
"Resource",
"that",
"points",
"to",
"a",
"temporary",
"directory",
"."
] | 2cec08826f1fccd658694dd03abce10fc97618ec | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/io/Resources.java#L240-L250 | train |
dbracewell/mango | src/main/java/com/davidbracewell/io/Resources.java | Resources.temporaryFile | public static Resource temporaryFile(String name, String extension) throws IOException {
return new FileResource(File.createTempFile(name, extension));
} | java | public static Resource temporaryFile(String name, String extension) throws IOException {
return new FileResource(File.createTempFile(name, extension));
} | [
"public",
"static",
"Resource",
"temporaryFile",
"(",
"String",
"name",
",",
"String",
"extension",
")",
"throws",
"IOException",
"{",
"return",
"new",
"FileResource",
"(",
"File",
".",
"createTempFile",
"(",
"name",
",",
"extension",
")",
")",
";",
"}"
] | Creates a resource wrapping a temporary file
@param name The file name
@param extension The file extension
@return The resource representing the temporary file
@throws IOException the io exception | [
"Creates",
"a",
"resource",
"wrapping",
"a",
"temporary",
"file"
] | 2cec08826f1fccd658694dd03abce10fc97618ec | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/io/Resources.java#L270-L272 | train |
triceo/splitlog | splitlog-core/src/main/java/com/github/triceo/splitlog/expectations/AbstractExpectationManager.java | AbstractExpectationManager.setExpectation | public synchronized Future<Message> setExpectation(final C condition, final MessageAction<P> action) {
if (this.isStopped()) {
throw new IllegalStateException("Already stopped.");
}
final AbstractExpectation<C, P> expectation = this.createExpectation(condition, action);
final... | java | public synchronized Future<Message> setExpectation(final C condition, final MessageAction<P> action) {
if (this.isStopped()) {
throw new IllegalStateException("Already stopped.");
}
final AbstractExpectation<C, P> expectation = this.createExpectation(condition, action);
final... | [
"public",
"synchronized",
"Future",
"<",
"Message",
">",
"setExpectation",
"(",
"final",
"C",
"condition",
",",
"final",
"MessageAction",
"<",
"P",
">",
"action",
")",
"{",
"if",
"(",
"this",
".",
"isStopped",
"(",
")",
")",
"{",
"throw",
"new",
"Illegal... | The resulting future will only return after such a message is received
that makes the condition true.
@param condition
Condition to be true.
@return The future. | [
"The",
"resulting",
"future",
"will",
"only",
"return",
"after",
"such",
"a",
"message",
"is",
"received",
"that",
"makes",
"the",
"condition",
"true",
"."
] | 4e1b188e8c814119f5cf7343bbc53917843d68a2 | https://github.com/triceo/splitlog/blob/4e1b188e8c814119f5cf7343bbc53917843d68a2/splitlog-core/src/main/java/com/github/triceo/splitlog/expectations/AbstractExpectationManager.java#L78-L87 | train |
triceo/splitlog | splitlog-core/src/main/java/com/github/triceo/splitlog/expectations/AbstractExpectationManager.java | AbstractExpectationManager.unsetExpectation | protected synchronized boolean unsetExpectation(final AbstractExpectation<C, P> expectation) {
if (this.expectations.containsKey(expectation)) {
this.expectations.remove(expectation);
AbstractExpectationManager.LOGGER.info("Unregistered expectation {}.", expectation);
return ... | java | protected synchronized boolean unsetExpectation(final AbstractExpectation<C, P> expectation) {
if (this.expectations.containsKey(expectation)) {
this.expectations.remove(expectation);
AbstractExpectationManager.LOGGER.info("Unregistered expectation {}.", expectation);
return ... | [
"protected",
"synchronized",
"boolean",
"unsetExpectation",
"(",
"final",
"AbstractExpectation",
"<",
"C",
",",
"P",
">",
"expectation",
")",
"{",
"if",
"(",
"this",
".",
"expectations",
".",
"containsKey",
"(",
"expectation",
")",
")",
"{",
"this",
".",
"ex... | Stop tracking this expectation. Calls from the internal code only.
@param expectation
The expectation to stop.
@return If stopped, false if stopped already. | [
"Stop",
"tracking",
"this",
"expectation",
".",
"Calls",
"from",
"the",
"internal",
"code",
"only",
"."
] | 4e1b188e8c814119f5cf7343bbc53917843d68a2 | https://github.com/triceo/splitlog/blob/4e1b188e8c814119f5cf7343bbc53917843d68a2/splitlog-core/src/main/java/com/github/triceo/splitlog/expectations/AbstractExpectationManager.java#L109-L116 | train |
geomajas/geomajas-project-hammer-gwt | hammer-gwt/src/main/java/org/geomajas/hammergwt/client/HammerTime.java | HammerTime.setOption | @Api
public <T> void setOption(GestureOption<T> option, T value) {
if (value == null) {
throw new IllegalArgumentException("Null value passed.");
}
if (value instanceof Boolean) {
setOption(this, (Boolean) value, option.getName());
} else if (value instanceof Integer) {
setOption(this, (Integer) valu... | java | @Api
public <T> void setOption(GestureOption<T> option, T value) {
if (value == null) {
throw new IllegalArgumentException("Null value passed.");
}
if (value instanceof Boolean) {
setOption(this, (Boolean) value, option.getName());
} else if (value instanceof Integer) {
setOption(this, (Integer) valu... | [
"@",
"Api",
"public",
"<",
"T",
">",
"void",
"setOption",
"(",
"GestureOption",
"<",
"T",
">",
"option",
",",
"T",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Null value passed.\"",
"... | Change the initial settings of hammer Gwt.
@param option {@link org.geomajas.hammergwt.client.option.GestureOption}
@param value T look at {@link org.geomajas.hammergwt.client.option.GestureOptions}
interface for all possible types
@param <T>
@since 1.0.0 | [
"Change",
"the",
"initial",
"settings",
"of",
"hammer",
"Gwt",
"."
] | bc764171bed55e5a9eced72f0078ec22b8105b62 | https://github.com/geomajas/geomajas-project-hammer-gwt/blob/bc764171bed55e5a9eced72f0078ec22b8105b62/hammer-gwt/src/main/java/org/geomajas/hammergwt/client/HammerTime.java#L56-L73 | train |
dbracewell/mango | src/main/java/com/davidbracewell/Regex.java | Regex.toChars | static String toChars(String p) {
if (p.length() >= 3 && p.charAt(0) == '[' && p.charAt(p.length() - 1) == ']') {
return p.substring(1, p.length() - 1);
}
return p;
} | java | static String toChars(String p) {
if (p.length() >= 3 && p.charAt(0) == '[' && p.charAt(p.length() - 1) == ']') {
return p.substring(1, p.length() - 1);
}
return p;
} | [
"static",
"String",
"toChars",
"(",
"String",
"p",
")",
"{",
"if",
"(",
"p",
".",
"length",
"(",
")",
">=",
"3",
"&&",
"p",
".",
"charAt",
"(",
"0",
")",
"==",
"'",
"'",
"&&",
"p",
".",
"charAt",
"(",
"p",
".",
"length",
"(",
")",
"-",
"1",... | To chars string.
@param p the p
@return the string | [
"To",
"chars",
"string",
"."
] | 2cec08826f1fccd658694dd03abce10fc97618ec | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/Regex.java#L47-L52 | train |
dbracewell/mango | src/main/java/com/davidbracewell/Regex.java | Regex.then | public Regex then(Regex regex) {
if (regex == null) {
return this;
}
return re(this.pattern + regex.pattern);
} | java | public Regex then(Regex regex) {
if (regex == null) {
return this;
}
return re(this.pattern + regex.pattern);
} | [
"public",
"Regex",
"then",
"(",
"Regex",
"regex",
")",
"{",
"if",
"(",
"regex",
"==",
"null",
")",
"{",
"return",
"this",
";",
"}",
"return",
"re",
"(",
"this",
".",
"pattern",
"+",
"regex",
".",
"pattern",
")",
";",
"}"
] | Concatenates the given regex with this one.
@param regex the regex to concatenate with this one
@return the regex | [
"Concatenates",
"the",
"given",
"regex",
"with",
"this",
"one",
"."
] | 2cec08826f1fccd658694dd03abce10fc97618ec | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/Regex.java#L60-L65 | train |
dbracewell/mango | src/main/java/com/davidbracewell/Regex.java | Regex.group | public Regex group(String name) {
return re("(" + (StringUtils.isNotNullOrBlank(name) ? "?<" + name + ">" : StringUtils.EMPTY) + pattern + ")");
} | java | public Regex group(String name) {
return re("(" + (StringUtils.isNotNullOrBlank(name) ? "?<" + name + ">" : StringUtils.EMPTY) + pattern + ")");
} | [
"public",
"Regex",
"group",
"(",
"String",
"name",
")",
"{",
"return",
"re",
"(",
"\"(\"",
"+",
"(",
"StringUtils",
".",
"isNotNullOrBlank",
"(",
"name",
")",
"?",
"\"?<\"",
"+",
"name",
"+",
"\">\"",
":",
"StringUtils",
".",
"EMPTY",
")",
"+",
"patter... | Converts the regex into a group. If the supplied name is not null or blank, the group will be named.
@param name the name of the group
@return the regex | [
"Converts",
"the",
"regex",
"into",
"a",
"group",
".",
"If",
"the",
"supplied",
"name",
"is",
"not",
"null",
"or",
"blank",
"the",
"group",
"will",
"be",
"named",
"."
] | 2cec08826f1fccd658694dd03abce10fc97618ec | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/Regex.java#L109-L111 | train |
dbracewell/mango | src/main/java/com/davidbracewell/Regex.java | Regex.not | public Regex not() {
if (this.pattern.length() > 0) {
if (this.pattern.charAt(0) == '[' && this.pattern.length() > 1) {
return re("[^" + this.pattern.substring(1));
}
return re("^" + this.pattern);
}
return this;
} | java | public Regex not() {
if (this.pattern.length() > 0) {
if (this.pattern.charAt(0) == '[' && this.pattern.length() > 1) {
return re("[^" + this.pattern.substring(1));
}
return re("^" + this.pattern);
}
return this;
} | [
"public",
"Regex",
"not",
"(",
")",
"{",
"if",
"(",
"this",
".",
"pattern",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"if",
"(",
"this",
".",
"pattern",
".",
"charAt",
"(",
"0",
")",
"==",
"'",
"'",
"&&",
"this",
".",
"pattern",
".",
"leng... | Negates the regex
@return the negated regex | [
"Negates",
"the",
"regex"
] | 2cec08826f1fccd658694dd03abce10fc97618ec | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/Regex.java#L136-L144 | train |
dbracewell/mango | src/main/java/com/davidbracewell/Regex.java | Regex.range | public Regex range(int min, int max) {
return re(this.pattern + "{" + Integer.toString(min) + "," + Integer.toString(max) + "}");
} | java | public Regex range(int min, int max) {
return re(this.pattern + "{" + Integer.toString(min) + "," + Integer.toString(max) + "}");
} | [
"public",
"Regex",
"range",
"(",
"int",
"min",
",",
"int",
"max",
")",
"{",
"return",
"re",
"(",
"this",
".",
"pattern",
"+",
"\"{\"",
"+",
"Integer",
".",
"toString",
"(",
"min",
")",
"+",
"\",\"",
"+",
"Integer",
".",
"toString",
"(",
"max",
")",... | Specifies the minimum and maximum times for this regex to repeat.
@param min the minimum times the pattern should repeat
@param max the maximum times the pattern should repeat
@return the regex | [
"Specifies",
"the",
"minimum",
"and",
"maximum",
"times",
"for",
"this",
"regex",
"to",
"repeat",
"."
] | 2cec08826f1fccd658694dd03abce10fc97618ec | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/Regex.java#L163-L165 | train |
wcm-io-caravan/caravan-hal | resource/src/main/java/io/wcm/caravan/hal/resource/util/HalUtil.java | HalUtil.getAllLinks | public static ListMultimap<String, Link> getAllLinks(HalResource hal, Predicate<Pair<String, Link>> predicate) {
return getAllLinks(hal, "self", predicate);
} | java | public static ListMultimap<String, Link> getAllLinks(HalResource hal, Predicate<Pair<String, Link>> predicate) {
return getAllLinks(hal, "self", predicate);
} | [
"public",
"static",
"ListMultimap",
"<",
"String",
",",
"Link",
">",
"getAllLinks",
"(",
"HalResource",
"hal",
",",
"Predicate",
"<",
"Pair",
"<",
"String",
",",
"Link",
">",
">",
"predicate",
")",
"{",
"return",
"getAllLinks",
"(",
"hal",
",",
"\"self\"",... | Returns all links in a HAL resource and its embedded resources except CURI links fitting the given predicate.
@param hal HAL resource
@param predicate Predicate to filter
@return Map of Relations and Links | [
"Returns",
"all",
"links",
"in",
"a",
"HAL",
"resource",
"and",
"its",
"embedded",
"resources",
"except",
"CURI",
"links",
"fitting",
"the",
"given",
"predicate",
"."
] | 25d58756b58c70c8c48a17fe781e673dd93d5085 | https://github.com/wcm-io-caravan/caravan-hal/blob/25d58756b58c70c8c48a17fe781e673dd93d5085/resource/src/main/java/io/wcm/caravan/hal/resource/util/HalUtil.java#L62-L64 | train |
wcm-io-caravan/caravan-hal | resource/src/main/java/io/wcm/caravan/hal/resource/util/HalUtil.java | HalUtil.getAllLinksForRelation | public static List<Link> getAllLinksForRelation(HalResource hal, String relation) {
List<Link> links = Lists.newArrayList(hal.getLinks(relation));
List<Link> embeddedLinks = hal.getEmbedded().values().stream()
.flatMap(embedded -> getAllLinksForRelation(embedded, relation).stream())
.collect(Co... | java | public static List<Link> getAllLinksForRelation(HalResource hal, String relation) {
List<Link> links = Lists.newArrayList(hal.getLinks(relation));
List<Link> embeddedLinks = hal.getEmbedded().values().stream()
.flatMap(embedded -> getAllLinksForRelation(embedded, relation).stream())
.collect(Co... | [
"public",
"static",
"List",
"<",
"Link",
">",
"getAllLinksForRelation",
"(",
"HalResource",
"hal",
",",
"String",
"relation",
")",
"{",
"List",
"<",
"Link",
">",
"links",
"=",
"Lists",
".",
"newArrayList",
"(",
"hal",
".",
"getLinks",
"(",
"relation",
")",... | Returns all links in a HAL resource and its embedded resources fitting the supplied relation.
@param hal HAL resource
@param relation Link relation
@return List of all fitting links | [
"Returns",
"all",
"links",
"in",
"a",
"HAL",
"resource",
"and",
"its",
"embedded",
"resources",
"fitting",
"the",
"supplied",
"relation",
"."
] | 25d58756b58c70c8c48a17fe781e673dd93d5085 | https://github.com/wcm-io-caravan/caravan-hal/blob/25d58756b58c70c8c48a17fe781e673dd93d5085/resource/src/main/java/io/wcm/caravan/hal/resource/util/HalUtil.java#L94-L102 | train |
duraspace/fcrepo-cloudsync | fcrepo-cloudsync-service/src/main/java/org/duraspace/fcrepo/cloudsync/service/backend/TaskManager.java | TaskManager.cleanup | private void cleanup(boolean atStartup) {
boolean allTasksIdle = false;
while (!allTasksIdle) {
int activeCount = 0;
for (Task task: taskDao.listTasks()) {
if (!task.getState().equals(Task.IDLE)) {
activeCount++;
if (!task.g... | java | private void cleanup(boolean atStartup) {
boolean allTasksIdle = false;
while (!allTasksIdle) {
int activeCount = 0;
for (Task task: taskDao.listTasks()) {
if (!task.getState().equals(Task.IDLE)) {
activeCount++;
if (!task.g... | [
"private",
"void",
"cleanup",
"(",
"boolean",
"atStartup",
")",
"{",
"boolean",
"allTasksIdle",
"=",
"false",
";",
"while",
"(",
"!",
"allTasksIdle",
")",
"{",
"int",
"activeCount",
"=",
"0",
";",
"for",
"(",
"Task",
"task",
":",
"taskDao",
".",
"listTas... | Cancel any non-idle tasks and wait for them to go idle | [
"Cancel",
"any",
"non",
"-",
"idle",
"tasks",
"and",
"wait",
"for",
"them",
"to",
"go",
"idle"
] | 2d90e2c9c84a827f2605607ff40e116c67eff9b9 | https://github.com/duraspace/fcrepo-cloudsync/blob/2d90e2c9c84a827f2605607ff40e116c67eff9b9/fcrepo-cloudsync-service/src/main/java/org/duraspace/fcrepo/cloudsync/service/backend/TaskManager.java#L112-L145 | train |
dbracewell/mango | src/main/java/com/davidbracewell/io/FileUtils.java | FileUtils.createFilePattern | public static Pattern createFilePattern(String filePattern) {
filePattern = StringUtils.isNullOrBlank(filePattern) ? "\\*" : filePattern;
filePattern = filePattern.replaceAll("\\.", "\\.");
filePattern = filePattern.replaceAll("\\*", ".*");
return Pattern.compile("^" + filePattern + "$");
} | java | public static Pattern createFilePattern(String filePattern) {
filePattern = StringUtils.isNullOrBlank(filePattern) ? "\\*" : filePattern;
filePattern = filePattern.replaceAll("\\.", "\\.");
filePattern = filePattern.replaceAll("\\*", ".*");
return Pattern.compile("^" + filePattern + "$");
} | [
"public",
"static",
"Pattern",
"createFilePattern",
"(",
"String",
"filePattern",
")",
"{",
"filePattern",
"=",
"StringUtils",
".",
"isNullOrBlank",
"(",
"filePattern",
")",
"?",
"\"\\\\*\"",
":",
"filePattern",
";",
"filePattern",
"=",
"filePattern",
".",
"replac... | Create file pattern pattern.
@param filePattern the file pattern
@return the pattern | [
"Create",
"file",
"pattern",
"pattern",
"."
] | 2cec08826f1fccd658694dd03abce10fc97618ec | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/io/FileUtils.java#L51-L56 | train |
dbracewell/mango | src/main/java/com/davidbracewell/io/FileUtils.java | FileUtils.isCompressed | public static boolean isCompressed(PushbackInputStream pushbackInputStream) throws IOException {
if (pushbackInputStream == null) {
return false;
}
byte[] buffer = new byte[2];
int read = pushbackInputStream.read(buffer);
boolean isCompressed = false;
if (read == 2) {
... | java | public static boolean isCompressed(PushbackInputStream pushbackInputStream) throws IOException {
if (pushbackInputStream == null) {
return false;
}
byte[] buffer = new byte[2];
int read = pushbackInputStream.read(buffer);
boolean isCompressed = false;
if (read == 2) {
... | [
"public",
"static",
"boolean",
"isCompressed",
"(",
"PushbackInputStream",
"pushbackInputStream",
")",
"throws",
"IOException",
"{",
"if",
"(",
"pushbackInputStream",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"byte",
"[",
"]",
"buffer",
"=",
"new",
... | Is compressed boolean.
@param pushbackInputStream the pushback input stream
@return the boolean
@throws IOException the io exception | [
"Is",
"compressed",
"boolean",
"."
] | 2cec08826f1fccd658694dd03abce10fc97618ec | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/io/FileUtils.java#L65-L82 | train |
dbracewell/mango | src/main/java/com/davidbracewell/io/FileUtils.java | FileUtils.toUnix | public static String toUnix(String spec) {
if (spec == null) {
return StringUtils.EMPTY;
}
return spec.replaceAll("\\\\+", "/");
} | java | public static String toUnix(String spec) {
if (spec == null) {
return StringUtils.EMPTY;
}
return spec.replaceAll("\\\\+", "/");
} | [
"public",
"static",
"String",
"toUnix",
"(",
"String",
"spec",
")",
"{",
"if",
"(",
"spec",
"==",
"null",
")",
"{",
"return",
"StringUtils",
".",
"EMPTY",
";",
"}",
"return",
"spec",
".",
"replaceAll",
"(",
"\"\\\\\\\\+\"",
",",
"\"/\"",
")",
";",
"}"
... | Converts file spec to unix path separators
@param spec The file spec
@return Unix style path spec | [
"Converts",
"file",
"spec",
"to",
"unix",
"path",
"separators"
] | 2cec08826f1fccd658694dd03abce10fc97618ec | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/io/FileUtils.java#L114-L119 | train |
dbracewell/mango | src/main/java/com/davidbracewell/io/FileUtils.java | FileUtils.toWindows | public static String toWindows(String spec) {
if (spec == null) {
return StringUtils.EMPTY;
}
return spec.replaceAll("/+", "\\\\");
} | java | public static String toWindows(String spec) {
if (spec == null) {
return StringUtils.EMPTY;
}
return spec.replaceAll("/+", "\\\\");
} | [
"public",
"static",
"String",
"toWindows",
"(",
"String",
"spec",
")",
"{",
"if",
"(",
"spec",
"==",
"null",
")",
"{",
"return",
"StringUtils",
".",
"EMPTY",
";",
"}",
"return",
"spec",
".",
"replaceAll",
"(",
"\"/+\"",
",",
"\"\\\\\\\\\"",
")",
";",
"... | Converts file spec to windows path separators
@param spec The file spec
@return windows style path spec | [
"Converts",
"file",
"spec",
"to",
"windows",
"path",
"separators"
] | 2cec08826f1fccd658694dd03abce10fc97618ec | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/io/FileUtils.java#L127-L132 | train |
dbracewell/mango | src/main/java/com/davidbracewell/io/FileUtils.java | FileUtils.addTrailingSlashIfNeeded | public static String addTrailingSlashIfNeeded(String directory) {
if (StringUtils.isNullOrBlank(directory)) {
return StringUtils.EMPTY;
}
int separator = indexOfLastSeparator(directory);
String slash = SystemInfo.isUnix() ? Character.toString(UNIX_SEPARATOR) : Character.toString(WINDOWS... | java | public static String addTrailingSlashIfNeeded(String directory) {
if (StringUtils.isNullOrBlank(directory)) {
return StringUtils.EMPTY;
}
int separator = indexOfLastSeparator(directory);
String slash = SystemInfo.isUnix() ? Character.toString(UNIX_SEPARATOR) : Character.toString(WINDOWS... | [
"public",
"static",
"String",
"addTrailingSlashIfNeeded",
"(",
"String",
"directory",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isNullOrBlank",
"(",
"directory",
")",
")",
"{",
"return",
"StringUtils",
".",
"EMPTY",
";",
"}",
"int",
"separator",
"=",
"indexOfL... | Adds a trailing slash if its needed. Tries to determine the slash style, but defaults to unix. Assumes that what
is passed in is a directory.
@param directory The directory to possibly add a trailing slash to
@return A directory name with a trailing slash | [
"Adds",
"a",
"trailing",
"slash",
"if",
"its",
"needed",
".",
"Tries",
"to",
"determine",
"the",
"slash",
"style",
"but",
"defaults",
"to",
"unix",
".",
"Assumes",
"that",
"what",
"is",
"passed",
"in",
"is",
"a",
"directory",
"."
] | 2cec08826f1fccd658694dd03abce10fc97618ec | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/io/FileUtils.java#L195-L205 | train |
dbracewell/mango | src/main/java/com/davidbracewell/io/FileUtils.java | FileUtils.parent | public static String parent(String file) {
if (StringUtils.isNullOrBlank(file)) {
return StringUtils.EMPTY;
}
file = StringUtils.trim(file);
String path = path(file);
int index = indexOfLastSeparator(path);
if (index <= 0) {
return SystemInfo.isUnix() ? Character.to... | java | public static String parent(String file) {
if (StringUtils.isNullOrBlank(file)) {
return StringUtils.EMPTY;
}
file = StringUtils.trim(file);
String path = path(file);
int index = indexOfLastSeparator(path);
if (index <= 0) {
return SystemInfo.isUnix() ? Character.to... | [
"public",
"static",
"String",
"parent",
"(",
"String",
"file",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isNullOrBlank",
"(",
"file",
")",
")",
"{",
"return",
"StringUtils",
".",
"EMPTY",
";",
"}",
"file",
"=",
"StringUtils",
".",
"trim",
"(",
"file",
... | Returns the parent directory for the given file. If the file passed in is actually a directory it will get the
directory's parent.
@param file The file
@return The parent or null if the file is null or empty | [
"Returns",
"the",
"parent",
"directory",
"for",
"the",
"given",
"file",
".",
"If",
"the",
"file",
"passed",
"in",
"is",
"actually",
"a",
"directory",
"it",
"will",
"get",
"the",
"directory",
"s",
"parent",
"."
] | 2cec08826f1fccd658694dd03abce10fc97618ec | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/io/FileUtils.java#L238-L249 | train |
bsblabs/embed-for-vaadin | com.bsb.common.vaadin.embed/src/main/java/com/bsb/common/vaadin/embed/util/BrowserUtils.java | BrowserUtils.openBrowserJava6 | private static boolean openBrowserJava6(String url) throws Exception {
final Class<?> desktopClass;
try {
desktopClass = Class.forName("java.awt.Desktop");
} catch (ClassNotFoundException e) {
return false;
}
Boolean supported = (Boolean) desktopClass.getM... | java | private static boolean openBrowserJava6(String url) throws Exception {
final Class<?> desktopClass;
try {
desktopClass = Class.forName("java.awt.Desktop");
} catch (ClassNotFoundException e) {
return false;
}
Boolean supported = (Boolean) desktopClass.getM... | [
"private",
"static",
"boolean",
"openBrowserJava6",
"(",
"String",
"url",
")",
"throws",
"Exception",
"{",
"final",
"Class",
"<",
"?",
">",
"desktopClass",
";",
"try",
"{",
"desktopClass",
"=",
"Class",
".",
"forName",
"(",
"\"java.awt.Desktop\"",
")",
";",
... | Tries to open the browser using java.awt.Desktop.
@param url the url to open
@return true if succeeded, false if java.awt.Desktop is not available not or not supported.
@throws Exception if the feature is supported but opening a browser failed | [
"Tries",
"to",
"open",
"the",
"browser",
"using",
"java",
".",
"awt",
".",
"Desktop",
"."
] | f902e70def56ab54d287d2600f9c6eef9e66c225 | https://github.com/bsblabs/embed-for-vaadin/blob/f902e70def56ab54d287d2600f9c6eef9e66c225/com.bsb.common.vaadin.embed/src/main/java/com/bsb/common/vaadin/embed/util/BrowserUtils.java#L92-L106 | train |
bsblabs/embed-for-vaadin | com.bsb.common.vaadin.embed/src/main/java/com/bsb/common/vaadin/embed/util/BrowserUtils.java | BrowserUtils.getOpenBrowserCommand | private static String[] getOpenBrowserCommand(String url) throws IOException, InterruptedException {
if (IS_WINDOWS) {
return new String[]{"rundll32", "url.dll,FileProtocolHandler", url};
} else if (IS_MAC) {
return new String[]{"/usr/bin/open", url};
} else if (IS_LINUX)... | java | private static String[] getOpenBrowserCommand(String url) throws IOException, InterruptedException {
if (IS_WINDOWS) {
return new String[]{"rundll32", "url.dll,FileProtocolHandler", url};
} else if (IS_MAC) {
return new String[]{"/usr/bin/open", url};
} else if (IS_LINUX)... | [
"private",
"static",
"String",
"[",
"]",
"getOpenBrowserCommand",
"(",
"String",
"url",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"if",
"(",
"IS_WINDOWS",
")",
"{",
"return",
"new",
"String",
"[",
"]",
"{",
"\"rundll32\"",
",",
"\"url.dll... | Returns the command to execute to open the specified URL, according to the
current OS.
@param url the url to open
@return the command to execute to open the url with the default browser
@throws java.io.IOException if an I/O exception occurred while locating the browser
@throws InterruptedException if the thread is int... | [
"Returns",
"the",
"command",
"to",
"execute",
"to",
"open",
"the",
"specified",
"URL",
"according",
"to",
"the",
"current",
"OS",
"."
] | f902e70def56ab54d287d2600f9c6eef9e66c225 | https://github.com/bsblabs/embed-for-vaadin/blob/f902e70def56ab54d287d2600f9c6eef9e66c225/com.bsb.common.vaadin.embed/src/main/java/com/bsb/common/vaadin/embed/util/BrowserUtils.java#L117-L133 | train |
dbracewell/mango | src/main/java/com/davidbracewell/parsing/ParserTokenStream.java | ParserTokenStream.lookAhead | public ParserToken lookAhead(int distance) {
while (distance >= buffer.size() && tokenIterator.hasNext()) {
buffer.addLast(tokenIterator.next());
}
return buffer.size() > distance ? buffer.getLast() : null;
} | java | public ParserToken lookAhead(int distance) {
while (distance >= buffer.size() && tokenIterator.hasNext()) {
buffer.addLast(tokenIterator.next());
}
return buffer.size() > distance ? buffer.getLast() : null;
} | [
"public",
"ParserToken",
"lookAhead",
"(",
"int",
"distance",
")",
"{",
"while",
"(",
"distance",
">=",
"buffer",
".",
"size",
"(",
")",
"&&",
"tokenIterator",
".",
"hasNext",
"(",
")",
")",
"{",
"buffer",
".",
"addLast",
"(",
"tokenIterator",
".",
"next... | Looks ahead in the token stream
@param distance The number of tokens to look ahead
@return The token a given distance from the current position in the stream or null if end of stream | [
"Looks",
"ahead",
"in",
"the",
"token",
"stream"
] | 2cec08826f1fccd658694dd03abce10fc97618ec | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/parsing/ParserTokenStream.java#L89-L94 | train |
dbracewell/mango | src/main/java/com/davidbracewell/parsing/ParserTokenStream.java | ParserTokenStream.lookAheadType | public ParserTokenType lookAheadType(int distance) {
ParserToken token = lookAhead(distance);
return token == null ? null : token.type;
} | java | public ParserTokenType lookAheadType(int distance) {
ParserToken token = lookAhead(distance);
return token == null ? null : token.type;
} | [
"public",
"ParserTokenType",
"lookAheadType",
"(",
"int",
"distance",
")",
"{",
"ParserToken",
"token",
"=",
"lookAhead",
"(",
"distance",
")",
";",
"return",
"token",
"==",
"null",
"?",
"null",
":",
"token",
".",
"type",
";",
"}"
] | Looks ahead to determine the type of the token a given distance from the front of the stream.
@param distance The number of tokens from the front of the stream
@return The token type | [
"Looks",
"ahead",
"to",
"determine",
"the",
"type",
"of",
"the",
"token",
"a",
"given",
"distance",
"from",
"the",
"front",
"of",
"the",
"stream",
"."
] | 2cec08826f1fccd658694dd03abce10fc97618ec | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/parsing/ParserTokenStream.java#L103-L106 | train |
dbracewell/mango | src/main/java/com/davidbracewell/parsing/ParserTokenStream.java | ParserTokenStream.nonConsumingMatch | public boolean nonConsumingMatch(ParserTokenType rhs) {
ParserToken token = lookAhead(0);
return token != null && token.type.isInstance(rhs);
} | java | public boolean nonConsumingMatch(ParserTokenType rhs) {
ParserToken token = lookAhead(0);
return token != null && token.type.isInstance(rhs);
} | [
"public",
"boolean",
"nonConsumingMatch",
"(",
"ParserTokenType",
"rhs",
")",
"{",
"ParserToken",
"token",
"=",
"lookAhead",
"(",
"0",
")",
";",
"return",
"token",
"!=",
"null",
"&&",
"token",
".",
"type",
".",
"isInstance",
"(",
"rhs",
")",
";",
"}"
] | Determines if the token at the front of the stream is a match for a given type without consuming the token.
@param rhs The token type
@return True if there is a match, False otherwise | [
"Determines",
"if",
"the",
"token",
"at",
"the",
"front",
"of",
"the",
"stream",
"is",
"a",
"match",
"for",
"a",
"given",
"type",
"without",
"consuming",
"the",
"token",
"."
] | 2cec08826f1fccd658694dd03abce10fc97618ec | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/parsing/ParserTokenStream.java#L114-L117 | train |
dbracewell/mango | src/main/java/com/davidbracewell/parsing/ParserTokenStream.java | ParserTokenStream.match | public boolean match(ParserTokenType expected) {
ParserToken next = lookAhead(0);
if (next == null || !next.type.isInstance(expected)) {
return false;
}
consume();
return true;
} | java | public boolean match(ParserTokenType expected) {
ParserToken next = lookAhead(0);
if (next == null || !next.type.isInstance(expected)) {
return false;
}
consume();
return true;
} | [
"public",
"boolean",
"match",
"(",
"ParserTokenType",
"expected",
")",
"{",
"ParserToken",
"next",
"=",
"lookAhead",
"(",
"0",
")",
";",
"if",
"(",
"next",
"==",
"null",
"||",
"!",
"next",
".",
"type",
".",
"isInstance",
"(",
"expected",
")",
")",
"{",... | Determines if the next token in the stream is of an expected type and consumes it if it is
@param expected The expected type
@return True if the next token is of the expected type, false otherwise | [
"Determines",
"if",
"the",
"next",
"token",
"in",
"the",
"stream",
"is",
"of",
"an",
"expected",
"type",
"and",
"consumes",
"it",
"if",
"it",
"is"
] | 2cec08826f1fccd658694dd03abce10fc97618ec | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/parsing/ParserTokenStream.java#L166-L173 | train |
jbundle/webapp | sample/src/main/java/org/jbundle/util/webapp/sample/App.java | App.main | public static void main(String[] args)
{
JFrame frame;
App biorhythm = new App();
try {
frame = new JFrame("Biorhythm");
frame.addWindowListener(new AppCloser(frame, biorhythm));
} catch (java.lang.Throwable ivjExc) {
frame = null;
Syst... | java | public static void main(String[] args)
{
JFrame frame;
App biorhythm = new App();
try {
frame = new JFrame("Biorhythm");
frame.addWindowListener(new AppCloser(frame, biorhythm));
} catch (java.lang.Throwable ivjExc) {
frame = null;
Syst... | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"JFrame",
"frame",
";",
"App",
"biorhythm",
"=",
"new",
"App",
"(",
")",
";",
"try",
"{",
"frame",
"=",
"new",
"JFrame",
"(",
"\"Biorhythm\"",
")",
";",
"frame",
".",
"a... | main entrypoint - starts the applet when it is run as an application
@param args java.lang.String[] | [
"main",
"entrypoint",
"-",
"starts",
"the",
"applet",
"when",
"it",
"is",
"run",
"as",
"an",
"application"
] | af2cf32bd92254073052f1f9b4bcd47c2f76ba7d | https://github.com/jbundle/webapp/blob/af2cf32bd92254073052f1f9b4bcd47c2f76ba7d/sample/src/main/java/org/jbundle/util/webapp/sample/App.java#L38-L61 | train |
jbundle/webapp | sample/src/main/java/org/jbundle/util/webapp/sample/App.java | App.init | public void init()
{
JPanel view = new JPanel();
view.setLayout(new BorderLayout());
label = new JLabel(INITIAL_TEXT);
Font font = new Font(Font.SANS_SERIF, Font.BOLD, 32);
label.setFont(font);
view.add(BorderLayout.CENTER, label);
this.getContentPane... | java | public void init()
{
JPanel view = new JPanel();
view.setLayout(new BorderLayout());
label = new JLabel(INITIAL_TEXT);
Font font = new Font(Font.SANS_SERIF, Font.BOLD, 32);
label.setFont(font);
view.add(BorderLayout.CENTER, label);
this.getContentPane... | [
"public",
"void",
"init",
"(",
")",
"{",
"JPanel",
"view",
"=",
"new",
"JPanel",
"(",
")",
";",
"view",
".",
"setLayout",
"(",
"new",
"BorderLayout",
"(",
")",
")",
";",
"label",
"=",
"new",
"JLabel",
"(",
"INITIAL_TEXT",
")",
";",
"Font",
"font",
... | Initialize this applet. | [
"Initialize",
"this",
"applet",
"."
] | af2cf32bd92254073052f1f9b4bcd47c2f76ba7d | https://github.com/jbundle/webapp/blob/af2cf32bd92254073052f1f9b4bcd47c2f76ba7d/sample/src/main/java/org/jbundle/util/webapp/sample/App.java#L66-L78 | train |
wanglinsong/testharness | src/main/java/com/tascape/qa/th/comm/MySqlCommunication.java | MySqlCommunication.replicateTable | public String replicateTable(String tableName, boolean toCopyData) throws SQLException {
String tempTableName = MySqlCommunication.getTempTableName(tableName);
LOG.debug("Replicate table {} into {}", tableName, tempTableName);
if (this.tableExists(tempTableName)) {
this.truncateT... | java | public String replicateTable(String tableName, boolean toCopyData) throws SQLException {
String tempTableName = MySqlCommunication.getTempTableName(tableName);
LOG.debug("Replicate table {} into {}", tableName, tempTableName);
if (this.tableExists(tempTableName)) {
this.truncateT... | [
"public",
"String",
"replicateTable",
"(",
"String",
"tableName",
",",
"boolean",
"toCopyData",
")",
"throws",
"SQLException",
"{",
"String",
"tempTableName",
"=",
"MySqlCommunication",
".",
"getTempTableName",
"(",
"tableName",
")",
";",
"LOG",
".",
"debug",
"(",... | Replicates table structure and data from source to temporary table.
@param tableName existing table name
@param toCopyData boolean
@return new table name
@throws SQLException for any issue | [
"Replicates",
"table",
"structure",
"and",
"data",
"from",
"source",
"to",
"temporary",
"table",
"."
] | 76f3e4546648e0720f6f87a58cb91a09cd36dfca | https://github.com/wanglinsong/testharness/blob/76f3e4546648e0720f6f87a58cb91a09cd36dfca/src/main/java/com/tascape/qa/th/comm/MySqlCommunication.java#L118-L131 | train |
wanglinsong/testharness | src/main/java/com/tascape/qa/th/comm/MySqlCommunication.java | MySqlCommunication.restoreTable | public void restoreTable(String tableName, String tempTableName) throws SQLException {
LOG.debug("Restore table {} from {}", tableName, tempTableName);
try {
this.setForeignKeyCheckEnabled(false);
this.truncateTable(tableName);
final String sql = "INSERT INTO " +... | java | public void restoreTable(String tableName, String tempTableName) throws SQLException {
LOG.debug("Restore table {} from {}", tableName, tempTableName);
try {
this.setForeignKeyCheckEnabled(false);
this.truncateTable(tableName);
final String sql = "INSERT INTO " +... | [
"public",
"void",
"restoreTable",
"(",
"String",
"tableName",
",",
"String",
"tempTableName",
")",
"throws",
"SQLException",
"{",
"LOG",
".",
"debug",
"(",
"\"Restore table {} from {}\"",
",",
"tableName",
",",
"tempTableName",
")",
";",
"try",
"{",
"this",
".",... | Restores table content.
@param tableName table to be restored
@param tempTableName temporary table name
@throws SQLException for any issue | [
"Restores",
"table",
"content",
"."
] | 76f3e4546648e0720f6f87a58cb91a09cd36dfca | https://github.com/wanglinsong/testharness/blob/76f3e4546648e0720f6f87a58cb91a09cd36dfca/src/main/java/com/tascape/qa/th/comm/MySqlCommunication.java#L141-L151 | train |
wanglinsong/testharness | src/main/java/com/tascape/qa/th/comm/MySqlCommunication.java | MySqlCommunication.removeTempTable | public void removeTempTable(String tempTableName) throws SQLException {
if (tempTableName == null) {
return;
}
if (!tempTableName.contains(TEMP_TABLE_NAME_SUFFIX)) {
throw new SQLException(tempTableName + " is not a valid temp table name");
}
try (C... | java | public void removeTempTable(String tempTableName) throws SQLException {
if (tempTableName == null) {
return;
}
if (!tempTableName.contains(TEMP_TABLE_NAME_SUFFIX)) {
throw new SQLException(tempTableName + " is not a valid temp table name");
}
try (C... | [
"public",
"void",
"removeTempTable",
"(",
"String",
"tempTableName",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"tempTableName",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"tempTableName",
".",
"contains",
"(",
"TEMP_TABLE_NAME_SUFFIX",
")... | Drops a temporary table.
@param tempTableName temporary table name
@throws SQLException for any issue | [
"Drops",
"a",
"temporary",
"table",
"."
] | 76f3e4546648e0720f6f87a58cb91a09cd36dfca | https://github.com/wanglinsong/testharness/blob/76f3e4546648e0720f6f87a58cb91a09cd36dfca/src/main/java/com/tascape/qa/th/comm/MySqlCommunication.java#L160-L172 | train |
fuinorg/srcgen4j-commons | src/main/java/org/fuin/srcgen4j/commons/Parsers.java | Parsers.addParser | public final void addParser(@NotNull final ParserConfig parser) {
Contract.requireArgNotNull("parser", parser);
if (list == null) {
list = new ArrayList<>();
}
list.add(parser);
} | java | public final void addParser(@NotNull final ParserConfig parser) {
Contract.requireArgNotNull("parser", parser);
if (list == null) {
list = new ArrayList<>();
}
list.add(parser);
} | [
"public",
"final",
"void",
"addParser",
"(",
"@",
"NotNull",
"final",
"ParserConfig",
"parser",
")",
"{",
"Contract",
".",
"requireArgNotNull",
"(",
"\"parser\"",
",",
"parser",
")",
";",
"if",
"(",
"list",
"==",
"null",
")",
"{",
"list",
"=",
"new",
"Ar... | Adds a parser to the list. If the list does not exist it's created.
@param parser
Parser to add. | [
"Adds",
"a",
"parser",
"to",
"the",
"list",
".",
"If",
"the",
"list",
"does",
"not",
"exist",
"it",
"s",
"created",
"."
] | bce26fd3167ea91fb2f3ad3fc9a1836d3d9fb14b | https://github.com/fuinorg/srcgen4j-commons/blob/bce26fd3167ea91fb2f3ad3fc9a1836d3d9fb14b/src/main/java/org/fuin/srcgen4j/commons/Parsers.java#L78-L84 | train |
pressgang-ccms/PressGangCCMSCommonUtilities | src/main/java/org/jboss/pressgang/ccms/utils/common/XMLValidator.java | XMLValidator.setXmlPreambleAndDTD | private String setXmlPreambleAndDTD(final String xml, final String dtdFileName, final String entities, final String dtdRootEleName) {
// Check if the XML already has a DOCTYPE. If it does then replace the values and remove entities for processing
final Matcher matcher = DOCTYPE_PATTERN.matcher(xml);
... | java | private String setXmlPreambleAndDTD(final String xml, final String dtdFileName, final String entities, final String dtdRootEleName) {
// Check if the XML already has a DOCTYPE. If it does then replace the values and remove entities for processing
final Matcher matcher = DOCTYPE_PATTERN.matcher(xml);
... | [
"private",
"String",
"setXmlPreambleAndDTD",
"(",
"final",
"String",
"xml",
",",
"final",
"String",
"dtdFileName",
",",
"final",
"String",
"entities",
",",
"final",
"String",
"dtdRootEleName",
")",
"{",
"// Check if the XML already has a DOCTYPE. If it does then replace the... | Sets the DTD for an xml file. If there are any entities then they are removed. This function will also add the preamble to the XML
if it doesn't exist.
@param xml The XML to add the DTD for.
@param dtdFileName The file/url name of the DTD.
@param dtdRootEleName The name of the root element in the XML tha... | [
"Sets",
"the",
"DTD",
"for",
"an",
"xml",
"file",
".",
"If",
"there",
"are",
"any",
"entities",
"then",
"they",
"are",
"removed",
".",
"This",
"function",
"will",
"also",
"add",
"the",
"preamble",
"to",
"the",
"XML",
"if",
"it",
"doesn",
"t",
"exist",
... | 5ebf5ed30a94c34c33f4708caa04a8da99cbb15c | https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/XMLValidator.java#L290-L332 | train |
probedock/probedock-demo-junit | src/main/java/io/probedock/demo/junit/Operation.java | Operation.process | public int process() {
// Calculate the result of the left operation if any
if (leftOperation != null) {
leftOperand = leftOperation.process();
}
// Calculate the result of the right operation if any
if (rightOperation != null) {
rightOperand = rightOperation.process();
}
// Process the operation ... | java | public int process() {
// Calculate the result of the left operation if any
if (leftOperation != null) {
leftOperand = leftOperation.process();
}
// Calculate the result of the right operation if any
if (rightOperation != null) {
rightOperand = rightOperation.process();
}
// Process the operation ... | [
"public",
"int",
"process",
"(",
")",
"{",
"// Calculate the result of the left operation if any",
"if",
"(",
"leftOperation",
"!=",
"null",
")",
"{",
"leftOperand",
"=",
"leftOperation",
".",
"process",
"(",
")",
";",
"}",
"// Calculate the result of the right operatio... | Process the operation and take care about the composition of the operations
@return The result of all the operation | [
"Process",
"the",
"operation",
"and",
"take",
"care",
"about",
"the",
"composition",
"of",
"the",
"operations"
] | 63360115887bfefd8a74e068620e62f77cad1e9b | https://github.com/probedock/probedock-demo-junit/blob/63360115887bfefd8a74e068620e62f77cad1e9b/src/main/java/io/probedock/demo/junit/Operation.java#L65-L78 | train |
gsi-upm/Shanks | shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/action/SimpleShanksAgentAction.java | SimpleShanksAgentAction.executeAction | public void executeAction(ShanksSimulation simulation, ShanksAgent agent,
List<NetworkElement> arguments) throws ShanksException {
for (NetworkElement ne : arguments) {
this.addAffectedElement(ne);
}
this.launchEvent();
} | java | public void executeAction(ShanksSimulation simulation, ShanksAgent agent,
List<NetworkElement> arguments) throws ShanksException {
for (NetworkElement ne : arguments) {
this.addAffectedElement(ne);
}
this.launchEvent();
} | [
"public",
"void",
"executeAction",
"(",
"ShanksSimulation",
"simulation",
",",
"ShanksAgent",
"agent",
",",
"List",
"<",
"NetworkElement",
">",
"arguments",
")",
"throws",
"ShanksException",
"{",
"for",
"(",
"NetworkElement",
"ne",
":",
"arguments",
")",
"{",
"t... | Method called when the action has to be performed.
@param simulation
The hole shanks simulation instance, form which the action can
consult parameters or other data that needs to perform his
action.
@param agent
The instance of the agent that contains this action.
@param arguments
Extra arguments needed to perform the... | [
"Method",
"called",
"when",
"the",
"action",
"has",
"to",
"be",
"performed",
"."
] | 35d87a81c22731f4f83bbd0571c9c6d466bd16be | https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/action/SimpleShanksAgentAction.java#L74-L80 | train |
triceo/splitlog | splitlog-core/src/main/java/com/github/triceo/splitlog/DefaultLogWatch.java | DefaultLogWatch.stopFollowing | @Override
public synchronized boolean stopFollowing(final Follower follower) {
if (!this.isFollowedBy(follower)) {
return false;
}
this.stopConsuming(follower);
DefaultLogWatch.LOGGER.info("Unregistered {} for {}.", follower, this);
return true;
} | java | @Override
public synchronized boolean stopFollowing(final Follower follower) {
if (!this.isFollowedBy(follower)) {
return false;
}
this.stopConsuming(follower);
DefaultLogWatch.LOGGER.info("Unregistered {} for {}.", follower, this);
return true;
} | [
"@",
"Override",
"public",
"synchronized",
"boolean",
"stopFollowing",
"(",
"final",
"Follower",
"follower",
")",
"{",
"if",
"(",
"!",
"this",
".",
"isFollowedBy",
"(",
"follower",
")",
")",
"{",
"return",
"false",
";",
"}",
"this",
".",
"stopConsuming",
"... | Is synchronized since we want to prevent multiple stops of the same
follower. | [
"Is",
"synchronized",
"since",
"we",
"want",
"to",
"prevent",
"multiple",
"stops",
"of",
"the",
"same",
"follower",
"."
] | 4e1b188e8c814119f5cf7343bbc53917843d68a2 | https://github.com/triceo/splitlog/blob/4e1b188e8c814119f5cf7343bbc53917843d68a2/splitlog-core/src/main/java/com/github/triceo/splitlog/DefaultLogWatch.java#L296-L304 | train |
gdfm/shobai-dogu | src/main/java/com/github/gdfm/shobaidogu/ProgressTracker.java | ProgressTracker.progress | public void progress() {
count++;
if (count % period == 0 && LOG.isInfoEnabled()) {
final double percent = 100 * (count / (double) totalIterations);
final long tock = System.currentTimeMillis();
final long timeInterval = tock - tick;
final long linesPerSec = (count - prevCount) * 1000 / ... | java | public void progress() {
count++;
if (count % period == 0 && LOG.isInfoEnabled()) {
final double percent = 100 * (count / (double) totalIterations);
final long tock = System.currentTimeMillis();
final long timeInterval = tock - tick;
final long linesPerSec = (count - prevCount) * 1000 / ... | [
"public",
"void",
"progress",
"(",
")",
"{",
"count",
"++",
";",
"if",
"(",
"count",
"%",
"period",
"==",
"0",
"&&",
"LOG",
".",
"isInfoEnabled",
"(",
")",
")",
"{",
"final",
"double",
"percent",
"=",
"100",
"*",
"(",
"count",
"/",
"(",
"double",
... | Logs the progress. | [
"Logs",
"the",
"progress",
"."
] | 2de6bd1afb870ede2e4f75f1ae82c85745367dd9 | https://github.com/gdfm/shobai-dogu/blob/2de6bd1afb870ede2e4f75f1ae82c85745367dd9/src/main/java/com/github/gdfm/shobaidogu/ProgressTracker.java#L55-L71 | train |
josueeduardo/snappy | plugin-parent/snappy-maven-plugin/src/main/java/io/joshworks/snappy/maven/tools/JarWriter.java | JarWriter.writeEntries | public void writeEntries(JarFile jarFile) throws IOException {
Enumeration<JarEntry> entries = jarFile.entries();
while (entries.hasMoreElements()) {
JarEntry entry = entries.nextElement();
ZipHeaderPeekInputStream inputStream = new ZipHeaderPeekInputStream(
j... | java | public void writeEntries(JarFile jarFile) throws IOException {
Enumeration<JarEntry> entries = jarFile.entries();
while (entries.hasMoreElements()) {
JarEntry entry = entries.nextElement();
ZipHeaderPeekInputStream inputStream = new ZipHeaderPeekInputStream(
j... | [
"public",
"void",
"writeEntries",
"(",
"JarFile",
"jarFile",
")",
"throws",
"IOException",
"{",
"Enumeration",
"<",
"JarEntry",
">",
"entries",
"=",
"jarFile",
".",
"entries",
"(",
")",
";",
"while",
"(",
"entries",
".",
"hasMoreElements",
"(",
")",
")",
"... | Write all entries from the specified jar file.
@param jarFile the source jar file
@throws IOException if the entries cannot be written | [
"Write",
"all",
"entries",
"from",
"the",
"specified",
"jar",
"file",
"."
] | d95a9e811eda3c24a5e53086369208819884fa49 | https://github.com/josueeduardo/snappy/blob/d95a9e811eda3c24a5e53086369208819884fa49/plugin-parent/snappy-maven-plugin/src/main/java/io/joshworks/snappy/maven/tools/JarWriter.java#L125-L144 | train |
akberc/ceylon-maven-plugin | src/main/java/com/dgwave/car/maven/CeylonLifecycleParticipant.java | CeylonLifecycleParticipant.afterProjectsRead | @Override
public void afterProjectsRead(final MavenSession session) throws MavenExecutionException {
boolean anyProject = false;
for (MavenProject project : session.getProjects()) {
if (project.getPlugin("ceylon") != null
|| project.getPlugin("ceylon-maven-plugin") != n... | java | @Override
public void afterProjectsRead(final MavenSession session) throws MavenExecutionException {
boolean anyProject = false;
for (MavenProject project : session.getProjects()) {
if (project.getPlugin("ceylon") != null
|| project.getPlugin("ceylon-maven-plugin") != n... | [
"@",
"Override",
"public",
"void",
"afterProjectsRead",
"(",
"final",
"MavenSession",
"session",
")",
"throws",
"MavenExecutionException",
"{",
"boolean",
"anyProject",
"=",
"false",
";",
"for",
"(",
"MavenProject",
"project",
":",
"session",
".",
"getProjects",
"... | Interception after projects are known.
@param session The Maven session
@throws MavenExecutionException In case of error | [
"Interception",
"after",
"projects",
"are",
"known",
"."
] | b7f6c4a2b24f2fa237350c9e715f4193e83415ef | https://github.com/akberc/ceylon-maven-plugin/blob/b7f6c4a2b24f2fa237350c9e715f4193e83415ef/src/main/java/com/dgwave/car/maven/CeylonLifecycleParticipant.java#L73-L95 | train |
akberc/ceylon-maven-plugin | src/main/java/com/dgwave/car/maven/CeylonLifecycleParticipant.java | CeylonLifecycleParticipant.usesCeylonRepo | private boolean usesCeylonRepo(final MavenProject project) {
for (Repository repo : project.getRepositories()) {
if ("ceylon".equals(repo.getLayout())) {
return true;
}
}
for (Artifact ext : project.getPluginArtifacts()) {
if (... | java | private boolean usesCeylonRepo(final MavenProject project) {
for (Repository repo : project.getRepositories()) {
if ("ceylon".equals(repo.getLayout())) {
return true;
}
}
for (Artifact ext : project.getPluginArtifacts()) {
if (... | [
"private",
"boolean",
"usesCeylonRepo",
"(",
"final",
"MavenProject",
"project",
")",
"{",
"for",
"(",
"Repository",
"repo",
":",
"project",
".",
"getRepositories",
"(",
")",
")",
"{",
"if",
"(",
"\"ceylon\"",
".",
"equals",
"(",
"repo",
".",
"getLayout",
... | Checks that a project use the Ceylon Maven plugin.
@param project Project
@return true if the Ceylon plugin is used, false if not used | [
"Checks",
"that",
"a",
"project",
"use",
"the",
"Ceylon",
"Maven",
"plugin",
"."
] | b7f6c4a2b24f2fa237350c9e715f4193e83415ef | https://github.com/akberc/ceylon-maven-plugin/blob/b7f6c4a2b24f2fa237350c9e715f4193e83415ef/src/main/java/com/dgwave/car/maven/CeylonLifecycleParticipant.java#L102-L115 | train |
josueeduardo/snappy | snappy/src/main/java/io/joshworks/snappy/Exchange.java | Exchange.stream | public void stream(InputStream inputStream, MediaType mediaType) {
try {
OutputStream outputStream = exchange.getOutputStream();
setResponseMediaType(mediaType);
byte[] buffer = new byte[10240];
int len;
while ((len = inputStream.read(buffer)) != -1) ... | java | public void stream(InputStream inputStream, MediaType mediaType) {
try {
OutputStream outputStream = exchange.getOutputStream();
setResponseMediaType(mediaType);
byte[] buffer = new byte[10240];
int len;
while ((len = inputStream.read(buffer)) != -1) ... | [
"public",
"void",
"stream",
"(",
"InputStream",
"inputStream",
",",
"MediaType",
"mediaType",
")",
"{",
"try",
"{",
"OutputStream",
"outputStream",
"=",
"exchange",
".",
"getOutputStream",
"(",
")",
";",
"setResponseMediaType",
"(",
"mediaType",
")",
";",
"byte"... | Transfers blocking the bytes from a given InputStream to this response
@param inputStream The data to be sent
@param mediaType The stream Content-Type | [
"Transfers",
"blocking",
"the",
"bytes",
"from",
"a",
"given",
"InputStream",
"to",
"this",
"response"
] | d95a9e811eda3c24a5e53086369208819884fa49 | https://github.com/josueeduardo/snappy/blob/d95a9e811eda3c24a5e53086369208819884fa49/snappy/src/main/java/io/joshworks/snappy/Exchange.java#L263-L276 | train |
NessComputing/service-discovery | client/src/main/java/com/nesscomputing/service/discovery/client/internal/ConsistentHashRing.java | ConsistentHashRing.get | public ServiceInformation get(String key) {
ServiceInformation info = null;
long hash = algorithm.hash(key);
//Find the first server with a hash key after this one
final SortedMap<Long, ServiceInformation> tailMap = ring.tailMap(hash);
//Wrap around to the beginning of the ring, ... | java | public ServiceInformation get(String key) {
ServiceInformation info = null;
long hash = algorithm.hash(key);
//Find the first server with a hash key after this one
final SortedMap<Long, ServiceInformation> tailMap = ring.tailMap(hash);
//Wrap around to the beginning of the ring, ... | [
"public",
"ServiceInformation",
"get",
"(",
"String",
"key",
")",
"{",
"ServiceInformation",
"info",
"=",
"null",
";",
"long",
"hash",
"=",
"algorithm",
".",
"hash",
"(",
"key",
")",
";",
"//Find the first server with a hash key after this one",
"final",
"SortedMap"... | Returns the appropriate server for the given key.
Running time: O(1)
@param key
@throws java.util.NoSuchElementException if the ring is empty
@return | [
"Returns",
"the",
"appropriate",
"server",
"for",
"the",
"given",
"key",
"."
] | 5091ffdb1de6b12d216d1c238f72858037c7b765 | https://github.com/NessComputing/service-discovery/blob/5091ffdb1de6b12d216d1c238f72858037c7b765/client/src/main/java/com/nesscomputing/service/discovery/client/internal/ConsistentHashRing.java#L84-L93 | train |
gsi-upm/Shanks | shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/ComplexScenario.java | ComplexScenario.addScenario | public void addScenario(Class<? extends Scenario> scenarioClass,
String scenarioID, String initialState, Properties properties,
String gatewayDeviceID, String externalLinkID)
throws ShanksException {
// throws NonGatewayDeviceException, TooManyConnectionException,
// ... | java | public void addScenario(Class<? extends Scenario> scenarioClass,
String scenarioID, String initialState, Properties properties,
String gatewayDeviceID, String externalLinkID)
throws ShanksException {
// throws NonGatewayDeviceException, TooManyConnectionException,
// ... | [
"public",
"void",
"addScenario",
"(",
"Class",
"<",
"?",
"extends",
"Scenario",
">",
"scenarioClass",
",",
"String",
"scenarioID",
",",
"String",
"initialState",
",",
"Properties",
"properties",
",",
"String",
"gatewayDeviceID",
",",
"String",
"externalLinkID",
")... | Add the scenario to the complex scenario.
@param scenarioClass
@param scenarioID
@param initialState
@param properties
@param gatewayDeviceID
@param externalLinkID
@throws ShanksException | [
"Add",
"the",
"scenario",
"to",
"the",
"complex",
"scenario",
"."
] | 35d87a81c22731f4f83bbd0571c9c6d466bd16be | https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/ComplexScenario.java#L110-L160 | train |
gsi-upm/Shanks | shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/ComplexScenario.java | ComplexScenario.addPossiblesFailuresComplex | public void addPossiblesFailuresComplex() {
Set<Scenario> scenarios = this.getScenarios();
for (Scenario s : scenarios) {
for (Class<? extends Failure> c : s.getPossibleFailures().keySet()) {
if (!this.getPossibleFailures().containsKey(c)) {
this.addPossib... | java | public void addPossiblesFailuresComplex() {
Set<Scenario> scenarios = this.getScenarios();
for (Scenario s : scenarios) {
for (Class<? extends Failure> c : s.getPossibleFailures().keySet()) {
if (!this.getPossibleFailures().containsKey(c)) {
this.addPossib... | [
"public",
"void",
"addPossiblesFailuresComplex",
"(",
")",
"{",
"Set",
"<",
"Scenario",
">",
"scenarios",
"=",
"this",
".",
"getScenarios",
"(",
")",
";",
"for",
"(",
"Scenario",
"s",
":",
"scenarios",
")",
"{",
"for",
"(",
"Class",
"<",
"?",
"extends",
... | Idem que con los eventos y los dupes | [
"Idem",
"que",
"con",
"los",
"eventos",
"y",
"los",
"dupes"
] | 35d87a81c22731f4f83bbd0571c9c6d466bd16be | https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/ComplexScenario.java#L255-L274 | train |
gsi-upm/Shanks | shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/ComplexScenario.java | ComplexScenario.addPossiblesEventsComplex | public void addPossiblesEventsComplex() {
Set<Scenario> scenarios = this.getScenarios();
for (Scenario s : scenarios) {
for (Class<? extends Event> c : s.getPossibleEventsOfNE().keySet()) {
if (!this.getPossibleEventsOfNE().containsKey(c)) {
this.addPossib... | java | public void addPossiblesEventsComplex() {
Set<Scenario> scenarios = this.getScenarios();
for (Scenario s : scenarios) {
for (Class<? extends Event> c : s.getPossibleEventsOfNE().keySet()) {
if (!this.getPossibleEventsOfNE().containsKey(c)) {
this.addPossib... | [
"public",
"void",
"addPossiblesEventsComplex",
"(",
")",
"{",
"Set",
"<",
"Scenario",
">",
"scenarios",
"=",
"this",
".",
"getScenarios",
"(",
")",
";",
"for",
"(",
"Scenario",
"s",
":",
"scenarios",
")",
"{",
"for",
"(",
"Class",
"<",
"?",
"extends",
... | J Anadido eventos de escenario, y evitado la adiccion de duplicados | [
"J",
"Anadido",
"eventos",
"de",
"escenario",
"y",
"evitado",
"la",
"adiccion",
"de",
"duplicados"
] | 35d87a81c22731f4f83bbd0571c9c6d466bd16be | https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/ComplexScenario.java#L278-L316 | train |
geomajas/geomajas-project-hammer-gwt | hammer-gwt/src/main/java/org/geomajas/hammergwt/client/HammerWidget.java | HammerWidget.setOption | @Api
public <T> void setOption(GestureOption<T> option, T value) {
hammertime.setOption(option, value);
} | java | @Api
public <T> void setOption(GestureOption<T> option, T value) {
hammertime.setOption(option, value);
} | [
"@",
"Api",
"public",
"<",
"T",
">",
"void",
"setOption",
"(",
"GestureOption",
"<",
"T",
">",
"option",
",",
"T",
"value",
")",
"{",
"hammertime",
".",
"setOption",
"(",
"option",
",",
"value",
")",
";",
"}"
] | Change initial settings of this widget.
@param option {@link org.geomajas.hammergwt.client.option.GestureOption}
@param value T look at {@link org.geomajas.hammergwt.client.option.GestureOptions}
interface for all possible types
@param <T>
@since 1.0.0 | [
"Change",
"initial",
"settings",
"of",
"this",
"widget",
"."
] | bc764171bed55e5a9eced72f0078ec22b8105b62 | https://github.com/geomajas/geomajas-project-hammer-gwt/blob/bc764171bed55e5a9eced72f0078ec22b8105b62/hammer-gwt/src/main/java/org/geomajas/hammergwt/client/HammerWidget.java#L81-L84 | train |
geomajas/geomajas-project-hammer-gwt | hammer-gwt/src/main/java/org/geomajas/hammergwt/client/HammerWidget.java | HammerWidget.unregisterHandler | @Api
public void unregisterHandler(EventType eventType) {
if (!jsHandlersMap.containsKey(eventType)) {
return;
}
HammerGwt.off(hammertime, eventType, (NativeHammmerHandler) jsHandlersMap.remove(eventType));
} | java | @Api
public void unregisterHandler(EventType eventType) {
if (!jsHandlersMap.containsKey(eventType)) {
return;
}
HammerGwt.off(hammertime, eventType, (NativeHammmerHandler) jsHandlersMap.remove(eventType));
} | [
"@",
"Api",
"public",
"void",
"unregisterHandler",
"(",
"EventType",
"eventType",
")",
"{",
"if",
"(",
"!",
"jsHandlersMap",
".",
"containsKey",
"(",
"eventType",
")",
")",
"{",
"return",
";",
"}",
"HammerGwt",
".",
"off",
"(",
"hammertime",
",",
"eventTyp... | Unregister Hammer Gwt handler.
@param eventType {@link org.geomajas.hammergwt.client.event.EventType}
@since 1.0.0 | [
"Unregister",
"Hammer",
"Gwt",
"handler",
"."
] | bc764171bed55e5a9eced72f0078ec22b8105b62 | https://github.com/geomajas/geomajas-project-hammer-gwt/blob/bc764171bed55e5a9eced72f0078ec22b8105b62/hammer-gwt/src/main/java/org/geomajas/hammergwt/client/HammerWidget.java#L137-L145 | train |
mauriciogior/android-easy-db | src/main/java/com/mauriciogiordano/easydb/bean/HasManyModel.java | HasManyModel.getChildrenList | private List<String> getChildrenList() {
if (childrenList != null) return childrenList;
SharedPreferences prefs = loadSharedPreferences("children");
String list = prefs.getString(getId(), null);
childrenList = (list == null) ? new ArrayList<String>() : new ArrayList<>(Arrays.asList(li... | java | private List<String> getChildrenList() {
if (childrenList != null) return childrenList;
SharedPreferences prefs = loadSharedPreferences("children");
String list = prefs.getString(getId(), null);
childrenList = (list == null) ? new ArrayList<String>() : new ArrayList<>(Arrays.asList(li... | [
"private",
"List",
"<",
"String",
">",
"getChildrenList",
"(",
")",
"{",
"if",
"(",
"childrenList",
"!=",
"null",
")",
"return",
"childrenList",
";",
"SharedPreferences",
"prefs",
"=",
"loadSharedPreferences",
"(",
"\"children\"",
")",
";",
"String",
"list",
"... | Get a list of child objects ids.
@throws com.mauriciogiordano.easydb.exception.NoContextFoundException in case of null..
context.
@return List of all children. | [
"Get",
"a",
"list",
"of",
"child",
"objects",
"ids",
"."
] | 2284524ed2ab3678a3a87b2dbe62e4402a876049 | https://github.com/mauriciogior/android-easy-db/blob/2284524ed2ab3678a3a87b2dbe62e4402a876049/src/main/java/com/mauriciogiordano/easydb/bean/HasManyModel.java#L61-L70 | train |
mauriciogior/android-easy-db | src/main/java/com/mauriciogiordano/easydb/bean/HasManyModel.java | HasManyModel.addChild | public void addChild(C child) {
SharedPreferences prefs = loadSharedPreferences("children");
List<String> objects = getChildrenList();
Model toPut = (Model) child;
if (objects.indexOf(toPut.getId()) != ArrayUtils.INDEX_NOT_FOUND) {
return;
}
objects.add(to... | java | public void addChild(C child) {
SharedPreferences prefs = loadSharedPreferences("children");
List<String> objects = getChildrenList();
Model toPut = (Model) child;
if (objects.indexOf(toPut.getId()) != ArrayUtils.INDEX_NOT_FOUND) {
return;
}
objects.add(to... | [
"public",
"void",
"addChild",
"(",
"C",
"child",
")",
"{",
"SharedPreferences",
"prefs",
"=",
"loadSharedPreferences",
"(",
"\"children\"",
")",
";",
"List",
"<",
"String",
">",
"objects",
"=",
"getChildrenList",
"(",
")",
";",
"Model",
"toPut",
"=",
"(",
... | Adds the object to the child ids list.
@param child The child to be added.
@throws com.mauriciogiordano.easydb.exception.NoContextFoundException in case of null context. | [
"Adds",
"the",
"object",
"to",
"the",
"child",
"ids",
"list",
"."
] | 2284524ed2ab3678a3a87b2dbe62e4402a876049 | https://github.com/mauriciogior/android-easy-db/blob/2284524ed2ab3678a3a87b2dbe62e4402a876049/src/main/java/com/mauriciogiordano/easydb/bean/HasManyModel.java#L90-L106 | train |
mauriciogior/android-easy-db | src/main/java/com/mauriciogiordano/easydb/bean/HasManyModel.java | HasManyModel.removeChild | public boolean removeChild(String id) {
SharedPreferences prefs = loadSharedPreferences("children");
List<String> objects = getChildrenList();
if (objects.indexOf(id) == ArrayUtils.INDEX_NOT_FOUND) {
return false;
}
objects.remove(id);
prefs.edit().putStrin... | java | public boolean removeChild(String id) {
SharedPreferences prefs = loadSharedPreferences("children");
List<String> objects = getChildrenList();
if (objects.indexOf(id) == ArrayUtils.INDEX_NOT_FOUND) {
return false;
}
objects.remove(id);
prefs.edit().putStrin... | [
"public",
"boolean",
"removeChild",
"(",
"String",
"id",
")",
"{",
"SharedPreferences",
"prefs",
"=",
"loadSharedPreferences",
"(",
"\"children\"",
")",
";",
"List",
"<",
"String",
">",
"objects",
"=",
"getChildrenList",
"(",
")",
";",
"if",
"(",
"objects",
... | Removes the object from the child ids list.
@param id The child's id to be removed.
@throws com.mauriciogiordano.easydb.exception.NoContextFoundException in case of null context.
@return True if removed successfully and false otherwise. | [
"Removes",
"the",
"object",
"from",
"the",
"child",
"ids",
"list",
"."
] | 2284524ed2ab3678a3a87b2dbe62e4402a876049 | https://github.com/mauriciogior/android-easy-db/blob/2284524ed2ab3678a3a87b2dbe62e4402a876049/src/main/java/com/mauriciogiordano/easydb/bean/HasManyModel.java#L115-L128 | train |
mauriciogior/android-easy-db | src/main/java/com/mauriciogiordano/easydb/bean/HasManyModel.java | HasManyModel.findChild | public C findChild(String id) {
int index = getChildrenList().indexOf(id);
if (index == ArrayUtils.INDEX_NOT_FOUND) {
return null;
}
C child = null;
try {
Model dummy = (Model) childClazz.newInstance();
dummy.setContext(context);
... | java | public C findChild(String id) {
int index = getChildrenList().indexOf(id);
if (index == ArrayUtils.INDEX_NOT_FOUND) {
return null;
}
C child = null;
try {
Model dummy = (Model) childClazz.newInstance();
dummy.setContext(context);
... | [
"public",
"C",
"findChild",
"(",
"String",
"id",
")",
"{",
"int",
"index",
"=",
"getChildrenList",
"(",
")",
".",
"indexOf",
"(",
"id",
")",
";",
"if",
"(",
"index",
"==",
"ArrayUtils",
".",
"INDEX_NOT_FOUND",
")",
"{",
"return",
"null",
";",
"}",
"C... | Find a specific object from the child list.
TODO: Figure out how to make this accesible without...
creating a dummy instance.
@param id Child's id
@throws com.mauriciogiordano.easydb.exception.NoContextFoundException in case of null context.
@return The child if found, null otherwise. | [
"Find",
"a",
"specific",
"object",
"from",
"the",
"child",
"list",
"."
] | 2284524ed2ab3678a3a87b2dbe62e4402a876049 | https://github.com/mauriciogior/android-easy-db/blob/2284524ed2ab3678a3a87b2dbe62e4402a876049/src/main/java/com/mauriciogiordano/easydb/bean/HasManyModel.java#L164-L185 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.