From 5a31d9cdabed88742547f99c6ebadd34f44f0742 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Mon, 22 Nov 2004 02:07:37 +0000 Subject: [PATCH] remove setters, just use the fields --- .../java/src/net/hyperic/sigar/CpuPerc.java | 43 ++++++------------- 1 file changed, 12 insertions(+), 31 deletions(-) diff --git a/bindings/java/src/net/hyperic/sigar/CpuPerc.java b/bindings/java/src/net/hyperic/sigar/CpuPerc.java index 6fbfb950..2c51a633 100644 --- a/bindings/java/src/net/hyperic/sigar/CpuPerc.java +++ b/bindings/java/src/net/hyperic/sigar/CpuPerc.java @@ -10,7 +10,7 @@ public class CpuPerc { private double idle; private double wait; - CpuPerc(){ } + CpuPerc() {} static CpuPerc calculate(Cpu oldCpu, Cpu curCpu) { double diffUser, diffSys, diffNice, diffIdle, diffWait, diffTotal; @@ -32,54 +32,34 @@ public class CpuPerc { diffTotal = diffUser + diffSys + diffNice + diffIdle + diffWait; CpuPerc perc = new CpuPerc(); - perc.setUser(diffUser / diffTotal); - perc.setSys(diffSys / diffTotal); - perc.setNice(diffNice / diffTotal); - perc.setIdle(diffIdle / diffTotal); - perc.setWait(diffWait / diffTotal); + perc.user = diffUser / diffTotal; + perc.sys = diffSys / diffTotal; + perc.nice = diffNice / diffTotal; + perc.idle = diffIdle / diffTotal; + perc.wait = diffWait / diffTotal; return perc; } - public double getUser(){ + public double getUser() { return this.user; } - void setUser(double user){ - this.user = user; - } - - public double getSys(){ + public double getSys() { return this.sys; } - void setSys(double sys){ - this.sys = sys; - } - - public double getNice(){ + public double getNice() { return this.nice; } - void setNice(double nice){ - this.nice = nice; - } - - public double getIdle(){ + public double getIdle() { return this.idle; } - void setIdle(double idle){ - this.idle = idle; - } - - public double getWait(){ + public double getWait() { return this.wait; } - void setWait(double wait){ - this.wait = wait; - } - public double getCombined() { return this.user + this.sys; } @@ -100,6 +80,7 @@ public class CpuPerc { format(this.user) + " user, " + format(this.sys) + " system, " + format(this.nice) + " nice, " + + format(this.wait) + " wait, " + format(this.idle) + " idle"; } }