Class Formula


public class Formula extends TypePart
Represents a formula in a ProductCmptType.
Since:
24.7
  • Field Details

  • Constructor Details

    • Formula

      public Formula(Type type, Method getter, boolean changingOverTime)
  • Method Details

    • isChangingOverTime

      public boolean isChangingOverTime()
      Description copied from class: TypePart
      Checks whether this part is changing over time (resides in the generation) or not (resides in the product component).
      Specified by:
      isChangingOverTime in class TypePart
      Returns:
      whether this association is changing over time
    • getFormulaText

      public String getFormulaText(IProductComponent productComponent, @CheckForNull Calendar effectiveDate)
      Returns the formula text of this formula in the given product component.
      Parameters:
      productComponent - a product component based on the product component type this formula belongs to.
      effectiveDate - (optional) the date to use for selecting the product component's generation, if this formula isChangingOverTime()
    • setFormulaText

      public void setFormulaText(IProductComponent productComponent, @CheckForNull Calendar effectiveDate, String formulaText)
      Sets the formula text of this formula in the given product component.
      Parameters:
      productComponent - a product component based on the product component type this formula belongs to.
      effectiveDate - (optional) the date to use for selecting the product component's generation, if this formula isChangingOverTime()
      formulaText - the new formula text
    • setFormulaText

      public void setFormulaText(IProductComponentGeneration generation, String formulaText)
      Sets the formula text of this formula in the given product component.

      If the formula is not changing over time, the underlying product component is used directly; otherwise, the given generation is used.

      Parameters:
      generation - the product component generation to base the formula text update on
      formulaText - the new formula text
      Since:
      25.1
    • getFormulaName

      public String getFormulaName()
      Returns the name of the formula.
    • isRequired

      public boolean isRequired()
      Returns:
      true if the formula is required, false otherwise
      Since:
      25.1
    • toString

      public String toString()
      Overrides:
      toString in class ModelElement
    • validate

      public void validate(MessageList list, IValidationContext context, IProductComponent productComponent, Calendar effectiveDate)
      Description copied from class: TypePart
      Validates this part's configuration in the given product against the model.
      Overrides:
      validate in class TypePart
      Parameters:
      list - a MessageList, to which validation messages may be added
      context - the IValidationContext, needed to determine the Locale in which to create Messages
      productComponent - the IProductComponent to validate
      effectiveDate - the date that determines which IProductComponentGeneration is to be validated, if the IProductComponent has any and this part is changing over time