diff options
author | Marcin Chrzanowski <marcin.j.chrzanowski@gmail.com> | 2019-10-21 21:45:57 +0200 |
---|---|---|
committer | Marcin Chrzanowski <marcin.j.chrzanowski@gmail.com> | 2019-10-21 21:45:57 +0200 |
commit | a0c4b252e5867219871b5c6df10219d916e29bff (patch) | |
tree | 08cc82ec20db1c68ec6002d965209c5168fad7a9 /src/pl/edu/mimuw/cloudatlas/model/ValueContact.java | |
parent | 38847dbb8809a8214a911b120b6b11ee4d7f1399 (diff) |
Tabs to spaces
Diffstat (limited to 'src/pl/edu/mimuw/cloudatlas/model/ValueContact.java')
-rw-r--r-- | src/pl/edu/mimuw/cloudatlas/model/ValueContact.java | 122 |
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; + } } |