java.lang.Object com.realtime.crossfire.jxclient.skin.skin.Expression
public class Expression
An expression yielding an integer value derived from a screen resolution.
Field Summary | |
---|---|
private int |
constant
The constant term. |
private int |
heightFactor
The screen height dependent factor. |
private int |
widthFactor
The screen width dependent factor. |
Constructor Summary | |
---|---|
Expression(Expression expression1,
boolean negative,
Expression expression2)
Creates a new instance as the sum or difference of two expressions. |
|
Expression(int constant,
int widthFactor,
int heightFactor)
Creates a new instance. |
Method Summary | |
---|---|
Expression |
addConstant(int value)
Returns this expression plus a constant value. |
private static int |
applyFactor(int value,
int factor)
Applies a factor to a value. |
int |
evaluate(int width,
int height)
Evaluates the expression into a constant. |
int |
evaluateConstant()
Evaluates the expression into a constant. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final int constant
private final int heightFactor
private final int widthFactor
Constructor Detail |
---|
public Expression(@NotNull Expression expression1, boolean negative, @NotNull Expression expression2)
expression1
- the left expressionnegative
- whether the right expression should be added
(false
) or subtracted (true
)expression2
- the right expressionpublic Expression(int constant, int widthFactor, int heightFactor)
constant
- the constant termwidthFactor
- the screen width dependent factorheightFactor
- the screen height dependent factorMethod Detail |
---|
@NotNull public Expression addConstant(int value)
value
- the constant value
private static int applyFactor(int value, int factor)
value
- the valuefactor
- the factor
public int evaluate(int width, int height)
width
- the screen widthheight
- the screen height
public int evaluateConstant()