-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPercent.java
More file actions
63 lines (56 loc) · 1.29 KB
/
Copy pathPercent.java
File metadata and controls
63 lines (56 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package sysmlinjava.valuetypes;
import sysmlinjava.probability.SysMLProbabilityDistribution;
import sysmlinjava.units.SysMLinJavaUnits;
/**
* SysMLinJava value type for percent as real number 0.0 thru 100.0.
*
* @author ModelerOne
*
*/
public class Percent extends RReal
{
/** Serializable ID*/private static final long serialVersionUID = -1566489011777283872L;
/**
* Constructor
*
* @param value double value to be the initial value
*/
public Percent(double value)
{
super(value);
}
/**
* Constructor for initial value and probability distribution
*
* @param value initial value
* @param distribution probability distribution used to produce random values
* via consecutive {@code getValue()} calls.
*/
public Percent(double value, SysMLProbabilityDistribution distribution)
{
super(value, distribution);
}
/**
* Constructor - copy
*
* @param copied value to be used as the initial value of the copy
*/
public Percent(Percent copied)
{
super(copied);
}
/**
* Percent as fraction (0.0 thru 1.0)
*
* @return value / 100
*/
public double asFraction()
{
return value / 100;
}
@Override
protected void createUnits()
{
units = SysMLinJavaUnits.Percent;
}
}