]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | /** @file\r |
2 | Database class.\r | |
3 | \r | |
4 | Database represents an exceplicity name list of database file. \r | |
5 | \r | |
6 | Copyright (c) 2006, Intel Corporation\r | |
7 | All rights reserved. This program and the accompanying materials\r | |
8 | are licensed and made available under the terms and conditions of the BSD License\r | |
9 | which accompanies this distribution. The full text of the license may be found at\r | |
10 | http://opensource.org/licenses/bsd-license.php\r | |
11 | \r | |
12 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
13 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
14 | \r | |
15 | **/\r | |
16 | package org.tianocore.framework.tasks;\r | |
17 | \r | |
18 | import java.io.File;\r | |
19 | import java.util.ArrayList;\r | |
20 | import java.util.List;\r | |
21 | import java.util.StringTokenizer;\r | |
22 | \r | |
23 | /**\r | |
24 | Database\r | |
25 | \r | |
26 | Database represents an exceplicity name list of database file. \r | |
27 | \r | |
28 | **/\r | |
29 | public class Database implements NestElement{\r | |
30 | ///\r | |
31 | /// name of database file\r | |
32 | ///\r | |
33 | private String name = "";\r | |
34 | ///\r | |
35 | /// name of file including database files\r | |
36 | /// \r | |
37 | private File file;\r | |
38 | ///\r | |
39 | /// the database file name list\r | |
40 | ///\r | |
41 | private List<String> nameList = new ArrayList<String>();\r | |
42 | \r | |
43 | /**\r | |
44 | getName\r | |
45 | \r | |
46 | This function is to get class member "name".\r | |
47 | \r | |
48 | @return class member "name".\r | |
49 | **/\r | |
50 | public String getName() {\r | |
51 | return this.name;\r | |
52 | }\r | |
53 | /**\r | |
54 | setName\r | |
55 | \r | |
56 | This function is to set class member "name".\r | |
57 | \r | |
58 | @param name : name of database file.\r | |
59 | **/\r | |
60 | public void setName(String name) {\r | |
61 | this.name = " -db " + name;\r | |
62 | }\r | |
63 | \r | |
64 | /**\r | |
65 | toString\r | |
66 | \r | |
67 | This function is to call getName() function.\r | |
68 | @return class member "name". \r | |
69 | **/\r | |
70 | public String toString() {\r | |
71 | return getName();\r | |
72 | }\r | |
73 | \r | |
74 | /**\r | |
75 | getFile\r | |
76 | \r | |
77 | This function is to get file which include the database file list.\r | |
78 | \r | |
79 | @return class member "file"\r | |
80 | \r | |
81 | **/\r | |
82 | public File getFile() {\r | |
83 | return this.file;\r | |
84 | }\r | |
85 | /**\r | |
86 | setFile\r | |
87 | \r | |
88 | This function is to set class member "file".\r | |
89 | \r | |
90 | @param file The file which include the database file list. \r | |
91 | **/\r | |
92 | public void setFile(File file) {\r | |
93 | this.file = file;\r | |
94 | }\r | |
95 | \r | |
96 | \r | |
97 | public void setList(String fileNameList) {\r | |
98 | if (fileNameList != null && fileNameList.length() > 0) {\r | |
99 | StringTokenizer tokens = new StringTokenizer(fileNameList, " \t,;", false);\r | |
100 | while (tokens.hasMoreTokens()) {\r | |
101 | String fileName = tokens.nextToken().trim();\r | |
102 | if (fileName.length() > 0) {\r | |
103 | this.nameList.add(fileName);\r | |
104 | }\r | |
105 | }\r | |
106 | }\r | |
107 | }\r | |
108 | \r | |
109 | public List<String> getList() {\r | |
110 | return nameList;\r | |
111 | }\r | |
112 | } |