From 0cf02872a03c34caf1d3ed95cc93db601c957c7b Mon Sep 17 00:00:00 2001 From: felix Date: Thu, 17 May 2007 14:43:23 +0000 Subject: [PATCH] - Code Formatierung durch eclipse git-svn-id: https://www.internetallee.de/svn/bytewurf@42 a944a559-bf0e-0410-8ddc-85264b264b6c --- .../bytewurf/projekte/netzschalter/HostConfig.java | 26 ++++++++++++++-------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/projekte/netzschalter/src/de/bytewurf/projekte/netzschalter/HostConfig.java b/projekte/netzschalter/src/de/bytewurf/projekte/netzschalter/HostConfig.java index 3135134..3d73419 100644 --- a/projekte/netzschalter/src/de/bytewurf/projekte/netzschalter/HostConfig.java +++ b/projekte/netzschalter/src/de/bytewurf/projekte/netzschalter/HostConfig.java @@ -14,18 +14,22 @@ import java.net.UnknownHostException; */ public class HostConfig { public static final int MIN_PORT_NUMBER = 0; - public static final int MAX_PORT_NUMBER = (1<<16); + + public static final int MAX_PORT_NUMBER = (1 << 16); + private InetAddress host; + private int portA = 0; + private int portB = 0; - + public String getHostname() { if (host == null) return "localhost"; - + return host.getHostName(); } - + public void setHostname(String hostname) { try { host = InetAddress.getByName(hostname); @@ -33,27 +37,31 @@ public class HostConfig { throw new IllegalArgumentException("Hostname nicht gültig"); } } - + public int getPortA() { return portA; } - + public void setPortA(int portA) { if (!isValidPortnumber(portA)) - throw new IllegalArgumentException("Port ausserhalb des gültigen Bereichs"); + throw new IllegalArgumentException( + "Port ausserhalb des gültigen Bereichs"); this.portA = portA; } private boolean isValidPortnumber(int portA) { return ((portA > MIN_PORT_NUMBER) && (portA < MAX_PORT_NUMBER)); } + public int getPortB() { return portB; } + public void setPortB(int portB) { if (!isValidPortnumber(portB)) - throw new IllegalArgumentException("Port ausserhalb des gültigen Bereichs"); + throw new IllegalArgumentException( + "Port ausserhalb des gültigen Bereichs"); this.portB = portB; } - + } -- 2.11.0