From: felix Date: Thu, 17 May 2007 14:44:26 +0000 (+0000) Subject: - Code Formatierung durch eclipse X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=64c57cf6d47211412d1ee70f8c7f045f11c73f48;p=bytewurf.git - Code Formatierung durch eclipse git-svn-id: https://www.internetallee.de/svn/bytewurf@44 a944a559-bf0e-0410-8ddc-85264b264b6c --- diff --git a/projekte/netzschalter/src/de/bytewurf/projekte/netzschalter/Command.java b/projekte/netzschalter/src/de/bytewurf/projekte/netzschalter/Command.java index 3816478..23c8380 100644 --- a/projekte/netzschalter/src/de/bytewurf/projekte/netzschalter/Command.java +++ b/projekte/netzschalter/src/de/bytewurf/projekte/netzschalter/Command.java @@ -11,37 +11,40 @@ package de.bytewurf.projekte.netzschalter; */ public class Command { byte[] commandBytes; - + Command(String commandString) { String[] commands = commandString.trim().split("[\t\n ,]+", 100); commandBytes = new byte[commands.length]; try { for (int i = 0; i < commands.length; i++) { - commandBytes[i] = Integer.decode(commands[i]).byteValue(); + commandBytes[i] = Integer.decode(commands[i]).byteValue(); } } catch (NumberFormatException e) { commandBytes = null; - throw new RuntimeException("Ungültige Zahlen eingegeben" + e.toString()); + throw new RuntimeException("Ungültige Zahlen eingegeben" + + e.toString()); } } - + Command(byte[] commandBytes) { if (commandBytes == null) - throw new IllegalArgumentException("Es muss ein Array mit bytes übergeben werden"); - + throw new IllegalArgumentException( + "Es muss ein Array mit bytes übergeben werden"); + this.commandBytes = commandBytes; } - + public String toString() { StringBuffer result = new StringBuffer(); for (int i = 0; i < commandBytes.length; i++) { result.append("0x" + Integer.toHexString(commandBytes[i] & 0xFF)); - if (i < commandBytes.length - 1); - result.append(", "); + if (i < commandBytes.length - 1) + ; + result.append(", "); } return result.toString(); } - + public byte[] getCommandBytes() { if (commandBytes == null) throw new RuntimeException("No Command configured yet.");