Expr

com.phasmidsoftware.number.expression.parse.ArithmeticParser.Expr
case class Expr(t: ArithmeticParser.this.Term, ts: List[String ArithmeticParser.this.~ ArithmeticParser.this.Term]) extends Expression

Represents an expression consisting of a single term and a sequence of additional terms combined with operators, allowing for binary operations such as addition or subtraction.

Value parameters

t

the initial Term of the expression

ts

a list of pairs consisting of an operator and a subsequent Term

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def show(i: Int): String

Generates a string representation of the expression starting from the specified indentation level.

Generates a string representation of the expression starting from the specified indentation level.

This method formats the current expression including its terms and subterms indented by the given level.

Value parameters

i

the indentation level used to format the output

Attributes

Returns

a string representation of the expression with appropriate indentation and structure

def termShow(t: String ArithmeticParser.this.~ ArithmeticParser.this.Term, i: Int): String

Formats a string representation of a term, combining its operator and term at the given indentation level.

Formats a string representation of a term, combining its operator and term at the given indentation level.

Value parameters

i

the current indentation level

t

a tuple consisting of a String representing an operator and a Term

Attributes

Returns

a formatted String representation of the term with proper indentation

def termVal(t: String ArithmeticParser.this.~ ArithmeticParser.this.Term): Try[ArithmeticParser.this.T]
def value: Try[ArithmeticParser.this.T]

Evaluates the value of the expression represented by the Expr instance. This method computes the result by sequentially applying the termVal function to each term in the sequence ts using the operator plus to combine intermediary results.

Evaluates the value of the expression represented by the Expr instance. This method computes the result by sequentially applying the termVal function to each term in the sequence ts using the operator plus to combine intermediary results.

Attributes

Returns

a Try[T] representing the result of the evaluation. If all terms are successfully evaluated, it returns a Success containing the final result. If an error occurs, it returns a Failure describing the issue.

Inherited methods

def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product