Class Expression

java.lang.Object
com.realtime.crossfire.jxclient.gui.gui.Expression

public class Expression extends Object
An expression yielding an integer value derived from a screen resolution.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Expression(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 Type
    Method
    Description
    int
    evaluate(int width, int height, int prefWidth, int prefHeight)
    Evaluates the expression into a constant.
    int
    Evaluates the expression into a constant.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Expression

      public Expression(int constant, float widthFactor, float heightFactor, float prefWidthFactor, float prefHeightFactor)
      Creates a new instance.
      Parameters:
      constant - the constant term
      widthFactor - the screen width dependent factor
      heightFactor - the screen height dependent factor
      prefWidthFactor - the preferred width dependent factor
      prefHeightFactor - 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 expression
      negative - 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 width
      height - the screen height
      prefWidth - the preferred width dependent factor
      prefHeight - the preferred height dependent factor
      Returns:
      the constant
    • evaluateConstant

      public int evaluateConstant()
      Evaluates the expression into a constant.
      Returns:
      the constant