01: /*
02: * (c) Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
03: * [See end of file]
04: */
05:
06: package jena.cmdline;
07:
08: import java.util.*;
09:
10: /** A command line argument that has been foundspecification.
11: *
12: * @author Andy Seaborne
13: * @version $Id: Arg.java,v 1.9 2008/01/02 12:09:54 andy_seaborne Exp $
14: */
15: public class Arg {
16: String name;
17: String value;
18: List values = new ArrayList();
19:
20: Arg() {
21: name = null;
22: value = null;
23: }
24:
25: Arg(String _name) {
26: this ();
27: setName(_name);
28: }
29:
30: Arg(String _name, String _value) {
31: this ();
32: setName(_name);
33: setValue(_value);
34: }
35:
36: void setName(String n) {
37: name = n;
38: }
39:
40: void setValue(String v) {
41: value = v;
42: }
43:
44: void addValue(String v) {
45: values.add(v);
46: }
47:
48: public String getName() {
49: return name;
50: }
51:
52: public String getValue() {
53: return value;
54: }
55:
56: public List getValues() {
57: return values;
58: }
59:
60: public boolean hasValue() {
61: return value != null;
62: }
63:
64: public boolean matches(ArgDecl decl) {
65: return decl.getNames().contains(name);
66: }
67:
68: }
69: /*
70: * (c) Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
71: * All rights reserved.
72: *
73: * Redistribution and use in source and binary forms, with or without
74: * modification, are permitted provided that the following conditions
75: * are met:
76: * 1. Redistributions of source code must retain the above copyright
77: * notice, this list of conditions and the following disclaimer.
78: * 2. Redistributions in binary form must reproduce the above copyright
79: * notice, this list of conditions and the following disclaimer in the
80: * documentation and/or other materials provided with the distribution.
81: * 3. The name of the author may not be used to endorse or promote products
82: * derived from this software without specific prior written permission.
83: *
84: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
85: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
86: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
87: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
88: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
89: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
90: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
91: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
92: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
93: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
94: */
|