public class Expression
extends java.lang.Object
Constructor and Description |
---|
Expression(@NotNull Expression expression1,
boolean negative,
@NotNull Expression expression2)
Creates a new instance as the sum or difference of two expressions.
|
Expression(int constant,
float widthFactor,
float heightFactor,
float prefWidthFactor,
float prefHeightFactor)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
int |
evaluate(int width,
int height,
int prefWidth,
int prefHeight)
Evaluates the expression into a constant.
|
int |
evaluateConstant()
Evaluates the expression into a constant.
|
public Expression(int constant, float widthFactor, float heightFactor, float prefWidthFactor, float prefHeightFactor)
constant
- the constant termwidthFactor
- the screen width dependent factorheightFactor
- the screen height dependent factorprefWidthFactor
- the preferred width dependent factorprefHeightFactor
- the preferred height dependent factorpublic Expression(@NotNull @NotNull Expression expression1, boolean negative, @NotNull @NotNull Expression expression2)
expression1
- the left expressionnegative
- whether the right expression should be added
(false
) or subtracted (true
)expression2
- the right expressionpublic int evaluate(int width, int height, int prefWidth, int prefHeight)
width
- the screen widthheight
- the screen heightprefWidth
- the preferred width dependent factorprefHeight
- the preferred height dependent factorpublic int evaluateConstant()