litesoft
Diff Revisions
287
vs
289
for /trunk/Java/ScarPlus/src/com/esotericsoftware/scar/support/Arguments.java
|
@@ -19,14 +19,9 @@ |
19 |
19 |
|
|
20 |
20 |
|
public Arguments( String[] pArgs ) |
21 |
21 |
|
{ |
22 |
|
- |
this( pArgs, 0 ); |
23 |
|
- |
} |
24 |
|
- |
|
25 |
|
- |
public Arguments( String[] pArgs, int pIndex ) |
26 |
|
- |
{ |
27 |
|
- |
while ( pIndex < pArgs.length ) |
|
22 |
+ |
for ( int i = 0; i < pArgs.length; i++ ) |
28 |
23 |
|
{ |
29 |
|
- |
String zArg = pArgs[pIndex++]; |
|
24 |
+ |
String zArg = pArgs[i]; |
30 |
25 |
|
int at = zArg.indexOf( '=' ); |
31 |
26 |
|
if ( at == -1 ) |
32 |
27 |
|
{ |
|
@@ -40,20 +35,24 @@ |
40 |
35 |
|
} |
41 |
36 |
|
|
42 |
37 |
|
/** |
43 |
|
- |
* Returns true if the argument was specified. |
|
38 |
+ |
* Get the value assocciated w/ pName, and remove the entry if found. |
|
39 |
+ |
* |
|
40 |
+ |
* Returns the value of the argument with the specified Name, or "" if the argument was specified without a value or null if it was not |
|
41 |
+ |
* specified. |
44 |
42 |
|
*/ |
45 |
|
- |
public boolean has( String pName ) |
|
43 |
+ |
public String get( String pName ) |
46 |
44 |
|
{ |
47 |
|
- |
return mParameters.containsKey( normalizeName( pName ) ); |
|
45 |
+ |
return mParameters.get( normalizeName( pName ) ); |
48 |
46 |
|
} |
49 |
47 |
|
|
50 |
48 |
|
/** |
51 |
|
- |
* Returns the value of the argument with the specified Name, or null if the argument was specified without a value or was not |
52 |
|
- |
* specified. |
|
49 |
+ |
* Returns the value of the argument with the specified Name, or the specified default value if the argument was specified |
|
50 |
+ |
* without a value or was not specified. |
53 |
51 |
|
*/ |
54 |
|
- |
public String get( String pName ) |
|
52 |
+ |
public String get( String pName, String pDefaultValue ) |
55 |
53 |
|
{ |
56 |
|
- |
return mParameters.get( normalizeName( pName ) ); |
|
54 |
+ |
String zValue = get( pName ); |
|
55 |
+ |
return (zValue != null) ? zValue : pDefaultValue; |
57 |
56 |
|
} |
58 |
57 |
|
|
59 |
58 |
|
public void set( String pName, String pValue ) |
|
@@ -76,19 +75,9 @@ |
76 |
75 |
|
mParameters.clear(); |
77 |
76 |
|
} |
78 |
77 |
|
|
79 |
|
- |
/** |
80 |
|
- |
* Returns the value of the argument with the specified Name, or the specified default value if the argument was specified |
81 |
|
- |
* without a value or was not specified. |
82 |
|
- |
*/ |
83 |
|
- |
public String get( String pName, String pDefaultValue ) |
84 |
|
- |
{ |
85 |
|
- |
String zValue = get( pName ); |
86 |
|
- |
return (zValue != null) ? zValue : pDefaultValue; |
87 |
|
- |
} |
88 |
|
- |
|
89 |
78 |
|
public void set( String pName ) |
90 |
79 |
|
{ |
91 |
|
- |
set( pName, null ); |
|
80 |
+ |
set( pName, "" ); |
92 |
81 |
|
} |
93 |
82 |
|
|
94 |
83 |
|
private String normalizeName( String pName ) |