From 0f63e33da8eb610d9e75d784bd45f9e8d8f5aaa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Ple=C3=9F?= Date: Tue, 6 Mar 2012 17:57:43 +0100 Subject: [PATCH] changed toString method to use StringBuilder --- .../java/de/ctdo/bunti/model/Par56Spot.java | 17 ++++++++++++--- .../java/de/ctdo/bunti/model/Strobe1500.java | 21 ++++++++++++++----- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/main/java/de/ctdo/bunti/model/Par56Spot.java b/src/main/java/de/ctdo/bunti/model/Par56Spot.java index 78c2446..e1b3b82 100644 --- a/src/main/java/de/ctdo/bunti/model/Par56Spot.java +++ b/src/main/java/de/ctdo/bunti/model/Par56Spot.java @@ -60,8 +60,19 @@ public class Par56Spot extends BuntiDMXDevice { @Override public final String toString() { - return "Par56Spot " + getDeviceId() + ", " + getDeviceName() + " " + - "[" + getColorRed() + "," + getColorGreen() + "," + getColorBlue() + "]"; + StringBuilder sb = new StringBuilder(); + sb.append("Par56Spot "); + sb.append(getDeviceId()); + sb.append(", "); + sb.append(getDeviceName()); + sb.append(" ["); + sb.append(getColorRed()); + sb.append(","); + sb.append(getColorGreen()); + sb.append(","); + sb.append(getColorBlue()); + sb.append("]"); + return sb.toString(); } - + } diff --git a/src/main/java/de/ctdo/bunti/model/Strobe1500.java b/src/main/java/de/ctdo/bunti/model/Strobe1500.java index a0a12bd..36d63d0 100644 --- a/src/main/java/de/ctdo/bunti/model/Strobe1500.java +++ b/src/main/java/de/ctdo/bunti/model/Strobe1500.java @@ -55,10 +55,21 @@ public class Strobe1500 extends BuntiDMXDevice { setChannelValueByName(CHANNEL_INTENSITY, DMX.DMX_CHANNEL_VALUE_MAX); } - @Override - public final String toString() { - return "Strobe1500 " + getDeviceId() + ", " + getDeviceName() + - " [" + getSpeed() + "," + getIntensity() + "," + getMode() + "]"; - } + @Override + public final String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("Strobe1500 "); + sb.append(getDeviceId()); + sb.append(", "); + sb.append(getDeviceName()); + sb.append(" ["); + sb.append(getSpeed()); + sb.append(","); + sb.append(getIntensity()); + sb.append(","); + sb.append(getMode()); + sb.append("]"); + return sb.toString(); + } }