//\r
private List<String> nameList = new ArrayList<String>();\r
\r
+ /**\r
+ Insert content in the newElement into this NestElement\r
+\r
+ @param newElement The new NestElement\r
+ **/\r
+ public void insert(NestElement newElement) {\r
+ this.nameList.addAll(newElement.getNameList());\r
+ }\r
+\r
/**\r
Handle "name" attribute. No delimiter and special treatment are assumed.\r
\r
**/\r
public void setName(String name) {\r
if (name.length() > 0) {\r
- nameList.add(name);\r
+ this.nameList.clear();\r
+ this.nameList.add(name);\r
+ }\r
+ }\r
+\r
+ public void insName(String name) {\r
+ if (name.length() > 0) {\r
+ this.nameList.add(name);\r
}\r
}\r
\r
return;\r
}\r
\r
+ this.nameList.clear();\r
StringTokenizer tokens = new StringTokenizer(nameList, " \t,;", false);\r
while (tokens.hasMoreTokens()) {\r
String name = tokens.nextToken().trim();\r
//\r
// Read line by line\r
// \r
+ nameList.clear();\r
while((str = in.readLine()) != null){\r
str = str.trim();\r
if (str.length() == 0){\r
}\r
\r
//getProject().replaceProperties(str);\r
- nameList.add(str);\r
+ this.nameList.add(str);\r
}\r
} catch (Exception e){\r
throw new BuildException(e.getMessage()); \r
setPath(file);\r
}\r
\r
+ /**\r
+ Add a file or file list into the file list\r
+\r
+ @param file The path of a file\r
+ **/\r
+ public void insFile(String file) {\r
+ insPath(file);\r
+ }\r
+\r
/**\r
Handle "path" attribute. The value of "path" may contain compound path\r
separator (/ or \) which should be cleaned up. Because the "path" string\r
@param path String value of a file system path\r
**/\r
public void setPath(String path) {\r
+ this.nameList.clear();\r
+ insPath(path);\r
+ }\r
+\r
+ /**\r
+ Add a path or path list into the path list\r
+\r
+ @param path The path string\r
+ **/\r
+ public void insPath(String path) {\r
if (path.length() == 0) {\r
return;\r
}\r
//\r
// Read the file line by line, skipping empty ones\r
// \r
+ nameList.clear();\r
while((path = in.readLine()) != null){\r
path = path.trim();\r
if (path.length() == 0){\r
return string.toString();\r
}\r
\r
+ /**\r
+ Compose and return the name/path string concatenated by space and\r
+ with only one "prefix".\r
+\r
+ @param prefix The prefix at the beginning of the string\r
+ \r
+ @return String The string with one prefix at the beginning\r
+ **/\r
+ public String toStringWithSinglepPrefix(String prefix) {\r
+ return prefix + toString(" ");\r
+ }\r
+\r
+ /**\r
+ Compose a string list with file names only, separated by spcified string\r
+\r
+ @param separator The separator string\r
+ \r
+ @return String The file list\r
+ **/\r
+ public String toFileList(String separator) {\r
+ StringBuffer string = new StringBuffer(1024);\r
+ int length = nameList.size();\r
+\r
+ for (int i = 0; i < length; ++i) {\r
+ File file = new File(nameList.get(i));\r
+ string.append(file.getName());\r
+ string.append(separator);\r
+ }\r
+\r
+ return string.toString();\r
+ }\r
+\r
+ /**\r
+ Compose a string list with file names only, separated by space\r
+\r
+ @return String The list string\r
+ **/\r
+ public String toFileList() {\r
+ return toFileList(" ");\r
+ }\r
+\r
//\r
// Remove any duplicated path separator or inconsistent path separator\r
//\r