1 package fr.in2p3.jsaga.impl.attributes;
2
3 import org.ogf.saga.error.*;
4
5
6
7
8
9
10
11
12
13
14
15
16
17 public class DefaultAttributeScalar extends DefaultAttributeAbstract implements AttributeScalar {
18 private String m_value;
19
20
21 DefaultAttributeScalar(String key, boolean isSupported, boolean isReadOnly, String value) {
22 super(key, isSupported, isReadOnly);
23 m_value = value;
24 }
25
26 public DefaultAttributeScalar(String key, String value) {
27 super(key);
28 m_value = value;
29 }
30
31
32 public DefaultAttributeScalar clone() throws CloneNotSupportedException {
33 DefaultAttributeScalar clone = (DefaultAttributeScalar) super.clone();
34 clone.m_value = m_value;
35 return clone;
36 }
37
38 public void setValue(String value) throws NotImplementedException, IncorrectStateException, PermissionDeniedException {
39 this.checkSupported();
40 this.checkWritable();
41 m_value = value;
42 }
43
44 public String getValue() throws NotImplementedException, IncorrectStateException {
45 this.checkSupported();
46 return m_value;
47 }
48
49 public boolean equals(Object o) {
50 if (!(o instanceof DefaultAttributeScalar)) {
51 return false;
52 }
53 DefaultAttributeScalar attribute = (DefaultAttributeScalar) o;
54 if (!super.getKey().equals(attribute.getKey())) {
55 return false;
56 }
57 if (m_value==null) {
58 return (attribute.m_value==null);
59 }
60 if (attribute.m_value==null) {
61 return (m_value==null);
62 }
63 return m_value.equals(attribute.m_value);
64 }
65 }