Package: OptEntry
OptEntry
| name | instruction | branch | complexity | line | method | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| OptEntry(File, List) | 
  | 
  | 
  | 
  | 
  | 
||||||||||||||||||||
| OptEntry(String, String, File, List) | 
  | 
  | 
  | 
  | 
  | 
||||||||||||||||||||
| getAss() | 
  | 
  | 
  | 
  | 
  | 
||||||||||||||||||||
| getAssName() | 
  | 
  | 
  | 
  | 
  | 
||||||||||||||||||||
| getAssValue() | 
  | 
  | 
  | 
  | 
  | 
||||||||||||||||||||
| getDirectory() | 
  | 
  | 
  | 
  | 
  | 
||||||||||||||||||||
| getFile() | 
  | 
  | 
  | 
  | 
  | 
||||||||||||||||||||
| getFileName() | 
  | 
  | 
  | 
  | 
  | 
||||||||||||||||||||
| getOptions() | 
  | 
  | 
  | 
  | 
  | 
||||||||||||||||||||
| getPath() | 
  | 
  | 
  | 
  | 
  | 
||||||||||||||||||||
Coverage
1: package generator;
2: 
3: import generator.option.AbstractOption;
4: import generator.option.NameOption;
5: 
6: import java.io.File;
7: import java.util.Iterator;
8: import java.util.List;
9: 
10: /**
11:  * 
12:  * @author Muri
13:  * 
14:  */
15: public class OptEntry {
16: 
17:         /**
18:          * 
19:          */
20:         private transient String assName = "";
21: 
22:         /**
23:          * 
24:          */
25:         private transient String assValue = "";
26: 
27:         /**
28:          * 
29:          */
30:         private final transient File file;
31: 
32:         /**
33:          * 
34:          */
35:         private final transient List<AbstractOption> options;
36: 
37:         /**
38:          * Constructor.
39:          * 
40:          * @param assName
41:          *            {@link String}
42:          * @param assValue
43:          *            {@link String}
44:          * @param file
45:          *            {@link File}
46:          * @param options
47:          *            {@link List}
48:          */
49:         public OptEntry(final String assName, final String assValue, final File file,
50:                         final List<AbstractOption> options) {
51:                 this.assName = assName;
52:                 this.assValue = assValue;
53:                 this.file = file;
54:                 this.options = options;
55:         }
56: 
57:         /**
58:          * Constructor. For anonymous additions.
59:          * 
60:          * @param file
61:          *            {@link File}
62:          * @param options
63:          *            {@link List}
64:          */
65:         public OptEntry(final File file, final List<AbstractOption> options) {
66: 
67:                 this.file = file;
68:                 this.options = options;
69:         }
70: 
71:         /**
72:          * @return the ass
73:          */
74:         public final String getAss() {
75:                 return this.assName + "=" + this.assValue;
76:         }
77: 
78:         /**
79:          * @return the assName
80:          */
81:         public final String getAssName() {
82:                 return this.assName;
83:         }
84: 
85:         /**
86:          * @return the assValue
87:          */
88:         public final String getAssValue() {
89:                 return this.assValue;
90:         }
91: 
92:         /**
93:          * @return the file
94:          */
95:         public final File getFile() {
96:                 return this.file;
97:         }
98: 
99:         /**
100:          * @return the Files Path (everything before and including the last '/').
101:          */
102:         public final String getDirectory() {
103:                 final Iterator<AbstractOption> iter = this.options.iterator();
104:                 String path = this.file.getPath();
105:•                while (iter.hasNext()) {
106:                         final AbstractOption nextOption = iter.next();
107:•                        if (nextOption.isNameOption()) {
108:                                 final String pathname = ((NameOption) nextOption).getName();
109:                                 final int pos = pathname.lastIndexOf('/');
110:                                 path = pathname.substring(0, pos + 1);
111:                         }
112:                 }
113:                 return path;
114:         }
115: 
116:         /**
117:          * @return only the Files Name (after last '/').
118:          */
119:         public final String getFileName() {
120:                 final Iterator<AbstractOption> iter = this.options.iterator();
121:                 String name = this.file.getName();
122:•                while (iter.hasNext()) {
123:                         final AbstractOption nextOption = iter.next();
124:•                        if (nextOption.isNameOption()) {
125:                                 final String pathname = ((NameOption) nextOption).getName();
126:                                 final int pos = pathname.lastIndexOf('/');
127:                                 name = pathname.substring(pos + 1);
128:                         }
129:                 }
130:                 return name;
131:         }
132: 
133:         /**
134:          * @return the file Path including directory and filename
135:          */
136:         public final String getPath() {
137:                 return this.getDirectory() + this.getFileName();
138:         }
139: 
140:         /**
141:          * @return the options
142:          */
143:         public final List<AbstractOption> getOptions() {
144:                 return this.options;
145:         }
146: 
147: }