Commit dac434ff authored by Marc Schiller's avatar Marc Schiller
Browse files

Updated models to use doubles instead of longs.

parent fdd4a4ae
......@@ -28,15 +28,15 @@ package de.tud.kom.p2psim.impl.topology.views.fiveg.models;
*/
public class ConstantModel extends AbstractModel {
private long c = 0;
private double c = 0;
public void setC(long c) {
public void setC(double c) {
this.c = c;
}
@Override
public long getLong(int users) {
return this.c;
return (long) this.c;
}
@Override
......
......@@ -27,31 +27,31 @@ package de.tud.kom.p2psim.impl.topology.views.fiveg.models;
*/
public class CutOffModel extends AbstractModel {
private long a = 1;
private double a = 1;
private long b = 0;
private double b = 0;
private long c = 1;
private double c = 1;
private long d = 0;
private double d = 0;
public void setA(long a) {
public void setA(double a) {
this.a = a;
}
public void setB(long b) {
public void setB(double b) {
this.b = b;
}
public void setC(long c) {
public void setC(double c) {
this.c = c;
}
public void setD(long d) {
public void setD(double d) {
this.d = d;
}
private long heaviside(long x) {
private double heaviside(double x) {
if(x < 0) {
return 0;
} else {
......
......@@ -29,27 +29,27 @@ package de.tud.kom.p2psim.impl.topology.views.fiveg.models;
public class ExponentialModel extends AbstractModel {
// exp(u) = a * e ^(c * u + d) + b
private long a = 1;
private double a = 1;
private long b = 0;
private double b = 0;
private long c = 1;
private double c = 1;
private long d = 0;
private double d = 0;
public void setA(long a) {
public void setA(double a) {
this.a = a;
}
public void setB(long b) {
public void setB(double b) {
this.b = b;
}
public void setC(long c) {
public void setC(double c) {
this.c = c;
}
public void setD(long d) {
public void setD(double d) {
this.d = d;
}
......
......@@ -28,25 +28,25 @@ package de.tud.kom.p2psim.impl.topology.views.fiveg.models;
*/
public class LinearModel extends AbstractModel {
private long a = 1;
private long b = 0;
private double a = 1;
private double b = 0;
public void setA(long a) {
public void setA(double a) {
this.a = a;
}
public void setB(long b) {
public void setB(double b) {
this.b = b;
}
@Override
public long getLong(int users) {
return this.a * users + this.b;
return (long) (this.a * users + this.b);
}
@Override
public double getDouble(int users) {
return (double) this.a * users + this.b;
return this.a * users + this.b;
}
public String toString() {
......
......@@ -28,27 +28,27 @@ package de.tud.kom.p2psim.impl.topology.views.fiveg.models;
*/
public class LogarithmicModel extends AbstractModel {
private long a = 1;
private double a = 1;
private long b = 0;
private double b = 0;
private long c = 1;
private double c = 1;
private long d = 0;
private double d = 0;
public void setA(long a) {
public void setA(double a) {
this.a = a;
}
public void setB(long b) {
public void setB(double b) {
this.b = b;
}
public void setC(long c) {
public void setC(double c) {
this.c = c;
}
public void setD(long d) {
public void setD(double d) {
this.d = d;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment