remove setters, just use the fields
This commit is contained in:
parent
df88ea5bb4
commit
5a31d9cdab
|
@ -32,11 +32,11 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -44,42 +44,22 @@ public class CpuPerc {
|
|||
return this.user;
|
||||
}
|
||||
|
||||
void setUser(double user){
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public double getSys() {
|
||||
return this.sys;
|
||||
}
|
||||
|
||||
void setSys(double sys){
|
||||
this.sys = sys;
|
||||
}
|
||||
|
||||
public double getNice() {
|
||||
return this.nice;
|
||||
}
|
||||
|
||||
void setNice(double nice){
|
||||
this.nice = nice;
|
||||
}
|
||||
|
||||
public double getIdle() {
|
||||
return this.idle;
|
||||
}
|
||||
|
||||
void setIdle(double idle){
|
||||
this.idle = idle;
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue