m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/pl/edu/mimuw/cloudatlas/model/ValueContact.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/pl/edu/mimuw/cloudatlas/model/ValueContact.java')
-rw-r--r--src/pl/edu/mimuw/cloudatlas/model/ValueContact.java122
1 files changed, 61 insertions, 61 deletions
diff --git a/src/pl/edu/mimuw/cloudatlas/model/ValueContact.java b/src/pl/edu/mimuw/cloudatlas/model/ValueContact.java
index 5101d17..670a025 100644
--- a/src/pl/edu/mimuw/cloudatlas/model/ValueContact.java
+++ b/src/pl/edu/mimuw/cloudatlas/model/ValueContact.java
@@ -36,65 +36,65 @@ import pl.edu.mimuw.cloudatlas.model.ValueContact;
* This class is immutable.
*/
public class ValueContact extends Value {
- private final PathName name;
- private final InetAddress address;
-
- /**
- * Constructs a new <code>ValueContact</code> with the specified path name and IP address.
- *
- * @param name the full path name of a node
- * @param address the IP address of the node
- */
- public ValueContact(PathName name, InetAddress address) {
- this.name = name;
- this.address = address;
- }
-
- @Override
- public Value getDefaultValue() {
- return new ValueContact(null, null);
- }
-
- /**
- * Returns a name stored in this object.
- *
- * @return the name of a node
- */
- public PathName getName() {
- return name;
- }
-
- /**
- * Returns an IP address stored in this object.
- *
- * @return the IP address of a node
- */
- public InetAddress getAddress() {
- return address;
- }
-
- @Override
- public Type getType() {
- return TypePrimitive.CONTACT;
- }
-
- @Override
- public Value convertTo(Type type) {
- switch(type.getPrimaryType()) {
- case CONTACT:
- return this;
- case STRING:
- if(isNull())
- return ValueString.NULL_STRING;
- else
- return new ValueString("(" + name.toString() + ", " + address.toString() + ")");
- default:
- throw new UnsupportedConversionException(getType(), type);
- }
- }
-
- @Override
- public boolean isNull() {
- return name == null || address == null;
- }
+ private final PathName name;
+ private final InetAddress address;
+
+ /**
+ * Constructs a new <code>ValueContact</code> with the specified path name and IP address.
+ *
+ * @param name the full path name of a node
+ * @param address the IP address of the node
+ */
+ public ValueContact(PathName name, InetAddress address) {
+ this.name = name;
+ this.address = address;
+ }
+
+ @Override
+ public Value getDefaultValue() {
+ return new ValueContact(null, null);
+ }
+
+ /**
+ * Returns a name stored in this object.
+ *
+ * @return the name of a node
+ */
+ public PathName getName() {
+ return name;
+ }
+
+ /**
+ * Returns an IP address stored in this object.
+ *
+ * @return the IP address of a node
+ */
+ public InetAddress getAddress() {
+ return address;
+ }
+
+ @Override
+ public Type getType() {
+ return TypePrimitive.CONTACT;
+ }
+
+ @Override
+ public Value convertTo(Type type) {
+ switch(type.getPrimaryType()) {
+ case CONTACT:
+ return this;
+ case STRING:
+ if(isNull())
+ return ValueString.NULL_STRING;
+ else
+ return new ValueString("(" + name.toString() + ", " + address.toString() + ")");
+ default:
+ throw new UnsupportedConversionException(getType(), type);
+ }
+ }
+
+ @Override
+ public boolean isNull() {
+ return name == null || address == null;
+ }
}