com.phasmidsoftware.number.top

Members list

Type members

Classlikes

trait Attribute

A trait representing a generic attribute with an integer mapping.

A trait representing a generic attribute with an integer mapping.

Implementations of this trait are expected to provide a concrete definition of the toInt method, which maps the attribute to a corresponding integer value. This may be used for comparison, serialization, or other domain-specific purposes.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
enum Color
enum Number
enum Shading
enum Shape
case class Card(number: Number, shape: Shape, color: Color, shading: Shading)

Represents a card with specific attributes.

Represents a card with specific attributes.

Value parameters

color

The color attribute of the card, represented as an integer. There are three colors: red (1), green (2), and purple (3).

number

The number attribute of the card, represented as an integer from 1 to 3.

shading

The shading attribute of the card, represented as an integer. There are three shadings: solid (1), striped (2), and open (3).

shape

The shape attribute of the card, represented as an integer. There are three shapes: diamond (1), oval (2), and squiggle (3).

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
enum Color(val toInt: Int) extends Attribute

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
trait Attribute
class Object
trait Matchable
class Any
Show all
sealed trait Natural

A sealed trait representing natural numbers (non-negative integers). Natural numbers are either Zero or a Successor of another natural number. This trait provides methods for basic arithmetic operations including addition, subtraction, and multiplication.

A sealed trait representing natural numbers (non-negative integers). Natural numbers are either Zero or a Successor of another natural number. This trait provides methods for basic arithmetic operations including addition, subtraction, and multiplication.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Successor
object Zero
object Natural

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Natural.type
enum Number(val toInt: Int) extends Attribute

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
trait Attribute
class Object
trait Matchable
class Any
Show all

The PhysicalConstants object serves as a collection of fundamental physical constants, including both exact (defined by the SI system) and measured values (with uncertainties). Each constant is encapsulated as a Quantity with its respective dimension and unit.

The PhysicalConstants object serves as a collection of fundamental physical constants, including both exact (defined by the SI system) and measured values (with uncertainties). Each constant is encapsulated as a Quantity with its respective dimension and unit.

These constants are essential for a wide range of scientific and engineering calculations in disciplines such as electromagnetism, thermodynamics, quantum mechanics, and relativity.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
case class Quantity[D <: Dimension](value: Valuable, unit: Unit[D]) extends Renderable

Represents a measurable quantity defined by a numerical value and a physical unit. The type parameter D specifies the dimension of the quantity.

Represents a measurable quantity defined by a numerical value and a physical unit. The type parameter D specifies the dimension of the quantity.

This case class is useful for performing unit-aware numerical operations and rendering quantities in a human-readable format.

Value parameters

unit

the physical unit associated with the quantity, specified as a PhysicalUnit[D]

value

the numerical value of the quantity, which is represented as a Valuable

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait Renderable
class Object
trait Matchable
class Any
Show all
object Quantity

Provides factory methods for creating instances of the Quantity class.

Provides factory methods for creating instances of the Quantity class.

Quantities represent measurable values associated with physical units and are parameterized by their dimension type D, which defines the specific physical property of the quantity (e.G., length, time, etc.).

The companion object offers multiple overloaded apply methods for constructing quantities using different types of numerical input.

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Quantity.type
case class QuantityException(message: String) extends Exception

Represents an exception specific to quantity-related errors.

Represents an exception specific to quantity-related errors.

The QuantityException is used to signal issues or invalid operations related to quantities within the application. It extends the base Exception class and includes a customizable error message to provide additional context about the exception's cause.

Value parameters

message

Detailed message describing the nature of the quantity-related error.

Attributes

Supertypes
trait Product
trait Equals
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
object QuantityParser extends RegexParsers, UnitsParser

An object that provides utilities for parsing textual representations of quantities. A quantity is composed of a numerical value, optionally followed by a physical unit.

An object that provides utilities for parsing textual representations of quantities. A quantity is composed of a numerical value, optionally followed by a physical unit.

Attributes

Supertypes
trait UnitsParser
trait RegexParsers
trait Parsers
class Object
trait Matchable
class Any
Show all
Self type
object Roman

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Roman.type
class RomanParser extends JavaTokenParsers

The RomanParser class provides functionality for parsing Roman numerals and converting them into their respective natural number representations using the Natural type system.

The RomanParser class provides functionality for parsing Roman numerals and converting them into their respective natural number representations using the Natural type system.

The class uses combinator parsers to validate and parse the Roman numeral strings. Supported Roman numeral characters are M, D, C, L, X, V, and I. The parser respects the rules of Roman numeral construction, including subtractive combinations like IV and IX.

Attributes

Supertypes
trait JavaTokenParsers
trait RegexParsers
trait Parsers
class Object
trait Matchable
class Any
Show all
case class Set(cards: Seq[Card])

Represents a set of three cards in the game of Set. A valid Set consists of exactly three cards, where for each attribute (shape, color, number, and shading), the values must either all be the same or all be different across the three cards.

Represents a set of three cards in the game of Set. A valid Set consists of exactly three cards, where for each attribute (shape, color, number, and shading), the values must either all be the same or all be different across the three cards.

Value parameters

cards

The sequence of three Card objects that make up the set.

Attributes

Constructor

Creates a Set with a specified sequence of three cards. Ensures the sequence contains exactly three cards.

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
class SetGame(random: Random = ...)

Represents the game logic for the card game "Set". See https://en.wikipedia.org/wiki/Set_(card_game).

Represents the game logic for the card game "Set". See https://en.wikipedia.org/wiki/Set_(card_game).

The SetGame class encapsulates functionality for managing and executing the rules and behavior of the game. The game involves identifying sets of three cards from a collection that satisfy specific matching conditions.

This class may include operations such as dealing cards, validating sets, and tracking the state of the game. It is designed to support the core mechanics of the "Set" game.

Attributes

Supertypes
class Object
trait Matchable
class Any
enum Shading(val toInt: Int) extends Attribute

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
trait Attribute
class Object
trait Matchable
class Any
Show all
enum Shape(val toInt: Int) extends Attribute

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
trait Attribute
class Object
trait Matchable
class Any
Show all
case class Successor(natural: Natural) extends Natural

Represents the successor of a natural number in the Peano arithmetic system.

Represents the successor of a natural number in the Peano arithmetic system.

A Successor object encapsulates a natural number, providing various operations for arithmetic and representation. It extends the Natural trait and defines the following functionalities:

  • next: Returns the next natural number by creating a new Successor object.
  • add: Recursively adds another natural number to this natural number.
  • toString: Returns a Roman numeral representation of the natural number.

Value parameters

natural

A natural number representing the predecessor of this number.

Attributes

Constructor

Creates a Successor object with the given natural number.

Supertypes
trait Serializable
trait Product
trait Equals
trait Natural
class Object
trait Matchable
class Any
Show all
case object Zero extends Natural

Zero represents the natural number zero in the Peano arithmetic system.

Zero represents the natural number zero in the Peano arithmetic system.

It is the base case of the natural numbers and does not have a predecessor. The Zero object extends the Natural trait and provides implementations for its methods.

  • next: Returns the successor of zero, which is the natural number one.
  • add: Returns the input natural number as the result of adding zero to it.
  • toString: Overrides the string representation to an empty string.

Attributes

Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait Natural
class Object
trait Matchable
class Any
Show all
Self type
Zero.type
final class exampleMainProgram

Attributes

Supertypes
class Object
trait Matchable
class Any
object expr

Aggregator object providing convenient imports for working with Expressions.

Aggregator object providing convenient imports for working with Expressions.

Usage:

 import expr._

 val result = ∅ + 1 + 2 * 3
 val expr = math"x^2 + 3x - 5"

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
expr.type
final class main

Attributes

Supertypes
class Object
trait Matchable
class Any

Types

type PhysicalUnit[D <: Dimension] = Unit[D]

Value members

Concrete methods

def exampleMainProgram(): Unit
def main(args: String*): Unit