Factor

com.phasmidsoftware.number.core.inner.Factor
See theFactor companion trait
object Factor

An object that provides a mechanism to map input strings to specific factors such as Radian, NatLog, or PureNumber. It acts as a factory for creating instances of the Factor sealed trait.

The object includes predefined constants representing symbols or keywords associated with certain factors. These constants include mathematical symbols like 'ℯ' and 'π', as well as their textual alternatives.

The apply method takes a string input and matches it to one of the predefined constants to return an appropriate Factor instance.

Matching logic:

  • Strings representing π (like "π", "pi", "Radian", "PI") will return the Radian factor.
  • The symbol 'ℯ' will return the NatLog factor.
  • All other strings default to the PureNumber factor.

Attributes

Companion
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Factor.type

Members list

Value members

Concrete methods

def apply(w: String): Factor

Applies the given string to derive a corresponding Factor instance.

Applies the given string to derive a corresponding Factor instance.

The method matches the input string against predefined constants representing specific factors. Depending on the match, it returns an instance of either Radian, NatLog, or PureNumber.

Value parameters

w

the input string to match, which can represent a mathematical symbol or name. Supported values: - Strings representing π (e.g., sPi, sPiAlt0, sPiAlt1, sPiAlt2) - String representing ℯ (sE) - Any other string is treated as a pure number.

Attributes

Returns

a Factor representing the input: - Radian if the input matches a π-related symbol. - NatLog if the input matches the ℯ symbol. - PureNumber otherwise.

def composeDyadic(x: Value, y: Value)(op: DyadicOperation): Option[Value]

Composes two Value instances using the specified dyadic operation. Evaluate a dyadic operator on this and other, using the various functions passed in. NOTE: this and other must have been aligned by type so that they have the same structure. This method is similar to its namesake in GeneralNumber (which, is soon going to be deprecated).

Composes two Value instances using the specified dyadic operation. Evaluate a dyadic operator on this and other, using the various functions passed in. NOTE: this and other must have been aligned by type so that they have the same structure. This method is similar to its namesake in GeneralNumber (which, is soon going to be deprecated).

This method internally uses the Operations.doComposeValueDyadic function, which evaluates the given dyadic operation on the provided values, based on the associated conversion functions.

Value parameters

op

the dyadic operation to be performed, containing the conversion functions.

x

the first operand, a Value.

y

the second operand, a Value.

Attributes

Returns

an optional Value representing the result of the dyadic operation, or None if the operation fails.

Concrete fields

val sDegree: String

Represents the degree symbol ("°") used to denote angular measurement.

Represents the degree symbol ("°") used to denote angular measurement.

Attributes

val sE: String

Represents the Unicode character ℯ (𝜀), which is commonly used to denote Euler's number in mathematics.

Represents the Unicode character ℯ (𝜀), which is commonly used to denote Euler's number in mathematics.

Attributes

val sEi: String

Represents the Unicode sequence for the mathematical constant ℯ combined with a modifier character.

Represents the Unicode sequence for the mathematical constant ℯ combined with a modifier character.

The value is a combination of:

  • The Unicode character for ℯ (U+1D700)
  • A modifier character (U+02E3)

Attributes

lazy val sPercent: String

Represents the percent symbol (%) as a constant string.

Represents the percent symbol (%) as a constant string.

This field is used within the Factor class to identify specific behavior or matching criteria, potentially related to percentages or division operations.

Attributes

val sPi: String

Represents the symbol for π (pi) in Unicode format. This constant can be used to identify and match the mathematical symbol π within the Factor class operations and logic.

Represents the symbol for π (pi) in Unicode format. This constant can be used to identify and match the mathematical symbol π within the Factor class operations and logic.

Attributes

val sPiAlt0: String

Alternate representation of the mathematical constant π as a string. Used as one of the predefined constants within the Factor class for identifying and handling π-related symbols.

Alternate representation of the mathematical constant π as a string. Used as one of the predefined constants within the Factor class for identifying and handling π-related symbols.

Attributes

val sPiAlt1: String

Represents an alternative designation for the mathematical constant π (pi) in radians.

Represents an alternative designation for the mathematical constant π (pi) in radians.

This string serves as a predefined constant within the Factor class, used for matching and identifying inputs associated with the radian unit when applying the Factor class's methods.

Attributes

val sPiAlt2: String

Represents an alternative string representation for the mathematical constant π (Pi). This value is one of several predefined symbols within the Factor class that correspond to π-related constants.

Represents an alternative string representation for the mathematical constant π (Pi). This value is one of several predefined symbols within the Factor class that correspond to π-related constants.

Attributes