Class Expression
java.lang.Object
com.realtime.crossfire.jxclient.gui.gui.Expression
An expression yielding an integer value derived from a screen resolution.
-
Constructor Summary
ConstructorsConstructorDescriptionExpression(int constant, float widthFactor, float heightFactor, float prefWidthFactor, float prefHeightFactor) Creates a new instance.Expression(@NotNull Expression expression1, boolean negative, @NotNull Expression expression2) Creates a new instance as the sum or difference of two expressions. -
Method Summary
Modifier and TypeMethodDescriptionintevaluate(int width, int height, int prefWidth, int prefHeight) Evaluates the expression into a constant.intEvaluates the expression into a constant.
-
Constructor Details
-
Expression
public Expression(int constant, float widthFactor, float heightFactor, float prefWidthFactor, float prefHeightFactor) Creates a new instance.- Parameters:
constant- the constant termwidthFactor- the screen width dependent factorheightFactor- the screen height dependent factorprefWidthFactor- the preferred width dependent factorprefHeightFactor- the preferred height dependent factor
-
Expression
public Expression(@NotNull @NotNull Expression expression1, boolean negative, @NotNull @NotNull Expression expression2) Creates a new instance as the sum or difference of two expressions.- Parameters:
expression1- the left expressionnegative- whether the right expression should be added (false) or subtracted (true)expression2- the right expression
-
-
Method Details
-
evaluate
public int evaluate(int width, int height, int prefWidth, int prefHeight) Evaluates the expression into a constant.- Parameters:
width- the screen widthheight- the screen heightprefWidth- the preferred width dependent factorprefHeight- the preferred height dependent factor- Returns:
- the constant
-
evaluateConstant
public int evaluateConstant()Evaluates the expression into a constant.- Returns:
- the constant
-