com.phasmidsoftware.lascala.values
Created by scalaprof on 1/4/17.
Attributes
Members list
Type members
Classlikes
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
object IntAdditionMonoid
Attributes
- Supertypes
- Known subtypes
-
class BooleanScalarclass BooleanValue
Attributes
- Supertypes
- Known subtypes
-
class DateScalarclass DateValue
Attributes
- Supertypes
- Known subtypes
-
class DoubleScalarclass DoubleValue
Attributes
- Supertypes
- Known subtypes
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
BaseNumericFuzzy.type
Attributes
- Companion
- object
- Supertypes
- Known subtypes
- Self type
CONSIDER merge this and BaseStringScalar appropriately
CONSIDER merge this and BaseStringScalar appropriately
Attributes
- Supertypes
- Known subtypes
-
class QuotedStringScalarclass QuotedStringValue
Attributes
- Supertypes
- Known subtypes
-
class RationalScalarclass RationalValue
Attributes
- Supertypes
- Known subtypes
-
class BaseBooleanScalarclass BooleanScalarclass BooleanValueclass BaseDateScalarclass DateScalarclass DateValueclass BaseDoubleScalarclass DoubleScalarclass DoubleValueclass BaseIntScalarclass IntScalarclass IntValueclass BaseQuotedStringScalarclass QuotedStringScalarclass QuotedStringValueclass BaseRationalScalarclass RationalScalarclass RationalValueclass BaseStringScalarclass StringScalarclass StringValueclass SequenceValueShow all
Attributes
- Supertypes
- Known subtypes
-
class StringScalarclass StringValue
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
BooleanScalar.type
Scalar which is natively a Boolean. Such a value can be converted to Int by invoking asValuable[Int] in which case the result will be 1 for true and 0 for false.
Scalar which is natively a Boolean. Such a value can be converted to Int by invoking asValuable[Int] in which case the result will be 1 for true and 0 for false.
Value parameters
- source
-
the source (which could, conceivably, be a String)
- x
-
the Int value
Attributes
- Companion
- object
- Supertypes
-
trait Producttrait Equalsclass BaseBooleanScalarclass BaseScalartrait Serializabletrait Scalarclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
BooleanValue.type
Value which is natively a Boolean. Such a value can be converted to Int by invoking asValuable[Int] in which case the result will be 1 for true and 0 for false.
Value which is natively a Boolean. Such a value can be converted to Int by invoking asValuable[Int] in which case the result will be 1 for true and 0 for false.
Value parameters
- source
-
the source (which could, conceivably, be a String)
- x
-
the Int value
Attributes
- Companion
- object
- Supertypes
-
trait Producttrait Equalstrait Valueclass BaseBooleanScalarclass BaseScalartrait Serializabletrait Scalarclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass BaseNumericFuzzy[T]trait NumericFuzzy[T]trait Fuzzy[T]trait () => Tclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
DateScalar.type
Scalar which is natively an LocalDate. Such a value, cannot be converted to Int or Double by invoking asValuable. However, it can be converted to some other form of Date by invoking asOrderable[X] where X is the other form--provided that there is an implicit conversion function in scope.
Scalar which is natively an LocalDate. Such a value, cannot be converted to Int or Double by invoking asValuable. However, it can be converted to some other form of Date by invoking asOrderable[X] where X is the other form--provided that there is an implicit conversion function in scope.
Value parameters
- source
-
the source (normally a String)
- x
-
the LocalDate value
Attributes
- Companion
- object
- Supertypes
-
trait Producttrait Equalsclass BaseDateScalarclass BaseScalartrait Serializabletrait Scalarclass Objecttrait Matchableclass AnyShow all
Value which is natively an LocalDate. Such a value, cannot be converted to Int or Double by invoking asValuable. However, it can be converted to some other form of Date by invoking asOrderable[X] where X is the other form--provided that there is an implicit conversion function in scope.
Value which is natively an LocalDate. Such a value, cannot be converted to Int or Double by invoking asValuable. However, it can be converted to some other form of Date by invoking asOrderable[X] where X is the other form--provided that there is an implicit conversion function in scope.
Value parameters
- source
-
the source (normally a String)
- x
-
the LocalDate value
Attributes
- Companion
- object
- Supertypes
-
trait Producttrait Equalstrait Valueclass BaseDateScalarclass BaseScalartrait Serializabletrait Scalarclass Objecttrait Matchableclass AnyShow all
Scalar which is natively a Double. Such a value cannot be converted to Int by invoking asValuable[Int] because of loss of precision.
Scalar which is natively a Double. Such a value cannot be converted to Int by invoking asValuable[Int] because of loss of precision.
Value parameters
- source
-
the source (which could, conceivably, be a String)
- x
-
the Double value
Attributes
- Companion
- object
- Supertypes
-
trait Producttrait Equalsclass BaseDoubleScalarclass BaseScalartrait Serializabletrait Scalarclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
DoubleScalar.type
Value which is natively a Double. Such a value cannot be converted to Int by invoking asValuable[Int] because of loss of precision.
Value which is natively a Double. Such a value cannot be converted to Int by invoking asValuable[Int] because of loss of precision.
Value parameters
- source
-
the source (which could, conceivably, be a String)
- x
-
the Double value
Attributes
- Companion
- object
- Supertypes
-
trait Producttrait Equalstrait Valueclass BaseDoubleScalarclass BaseScalartrait Serializabletrait Scalarclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
DoubleValue.type
Concrete class extending Fuzzy which has zero fuzziness.
Concrete class extending Fuzzy which has zero fuzziness.
Type parameters
- T
-
the underlying type of the value: which must support typeclass Fractional
Value parameters
- t
-
the numerical value
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass BaseNumericFuzzy[T]trait NumericFuzzy[T]trait Fuzzy[T]trait () => Tclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
FiniteIntegral.type
This trait represents the concept of an integral value defined over a finite range. Real-life examples include Long, Integer, Short, etc.
This trait represents the concept of an integral value defined over a finite range. Real-life examples include Long, Integer, Short, etc.
Created by scalaprof on 1/3/17.
Attributes
- Companion
- object
- Supertypes
-
trait Integral[N]trait Numeric[N]trait Ordering[N]trait PartialOrdering[N]trait Equiv[N]trait Serializabletrait Comparator[N]class Objecttrait Matchableclass AnyShow all
- Known subtypes
-
trait BigIntIsFiniteIntegralobject BigIntIsFiniteIntegraltrait FiniteIntegralNumeric[N]trait IntIsFiniteIntegralobject IntIsFiniteIntegraltrait LongIsFiniteIntegralobject LongIsFiniteIntegralShow all
Attributes
- Supertypes
-
trait Producttrait Equalsclass Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
This trait defines the behavior required by Numeric[N]
This trait defines the behavior required by Numeric[N]
Type parameters
- N
-
the underlying integral type, such as Int, Long, BigInt
Attributes
- Supertypes
-
trait FiniteIntegral[N]trait Integral[N]trait Numeric[N]trait Ordering[N]trait PartialOrdering[N]trait Equiv[N]trait Serializabletrait Comparator[N]class Objecttrait Matchableclass AnyShow all
- Known subtypes
-
trait IntIsFiniteIntegralobject IntIsFiniteIntegraltrait LongIsFiniteIntegralobject LongIsFiniteIntegral
Attributes
- Supertypes
-
trait FromString[T]trait Fractional[T]trait Numeric[T]trait Ordering[T]trait PartialOrdering[T]trait Equiv[T]trait Serializabletrait Comparator[T]class Objecttrait Matchableclass AnyShow all
- Known subtypes
-
object FractionalStringDouble
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
trait FractionalString[T]object FractionalStringDoubleobject FractionalStringIntobject FromStringInt
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Typeclass Fuzzy which adds fuzzy behavior to any type.
Typeclass Fuzzy which adds fuzzy behavior to any type.
The method apply() will provide the nominal (i.e. most probable) value
Type parameters
- T
-
the type to which we add the fuzzy behavior
Attributes
- Companion
- object
- Supertypes
- Known subtypes
-
trait NumericFuzzy[T]class BaseNumericFuzzy[T]class Bounded[T]class Exact[T]class Gaussian[T]Show all
Attributes
- Supertypes
-
trait Producttrait Equalsclass Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
Trait which enables Fuzzy[T] to be used in type classes where the context type is a Fractional (or Numeric or Ordering).
Trait which enables Fuzzy[T] to be used in type classes where the context type is a Fractional (or Numeric or Ordering).
Attributes
- Supertypes
- Known subtypes
-
object FuzzyIsFractionalDouble
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
FuzzyParser.type
FuzzyParser is a parser-combinator which parses rules. [Wow, that's a surprise!] Of course, it can also parse any of the constituents of a rule (expression, number, predicate, etc.).
FuzzyParser is a parser-combinator which parses rules. [Wow, that's a surprise!] Of course, it can also parse any of the constituents of a rule (expression, number, predicate, etc.).
A RuleLike is defined as a sealed trait which is extended by several different case classes, each defining a different method of combining rules together into a tree of rules. In general, a leaf rule is a Condition and is made up of two features: a subject and a predicate.
It's important to note that all aspects of these rules are String-based. There is absolutely no conversion to numeric types anywhere in this class.
The trait RuleLike has only one method: asRule which returns a Rule[String]
Created by scalaprof on 5/30/16.
Attributes
- Companion
- object
- Supertypes
-
trait JavaTokenParserstrait RegexParserstrait Parsersclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass BaseNumericFuzzy[T]trait NumericFuzzy[T]trait Fuzzy[T]trait () => Tclass Objecttrait Matchableclass AnyShow all
Probability which is based on a Double
Probability which is based on a Double
Value parameters
- p
-
the probability as a Double
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Probabilitytrait () => Doubleclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
GenericProbability.type
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Incrementable.type
Type class Incrementable. An extension of Orderable with the ability to increment the value by integral units and to initialize such a sequence.
Type class Incrementable. An extension of Orderable with the ability to increment the value by integral units and to initialize such a sequence.
This combination of trait Incrementable and implicit objects comprises the "type class" Incrementable.
Attributes
- Companion
- object
- Supertypes
-
trait Orderable[X]trait Ordering[X]trait PartialOrdering[X]trait Equiv[X]trait Serializabletrait Comparator[X]class Objecttrait Matchableclass AnyShow all
- Known subtypes
-
trait IncrementableIntobject IncrementableInttrait IncrementableLocalDateobject IncrementableLocalDatetrait IncrementableLongobject IncrementableLongtrait IncrementableStringobject IncrementableStringShow all
Attributes
- Supertypes
- Self type
-
IntAdditionMonoid.type
Scalar which is natively an Int. Such a value can be converted to Double by invoking asValuable[Double]
Scalar which is natively an Int. Such a value can be converted to Double by invoking asValuable[Double]
Value parameters
- source
-
the source (which could, conceivably, be a String)
- x
-
the Int value
Attributes
- Companion
- object
- Supertypes
-
trait Producttrait Equalsclass BaseIntScalarclass BaseScalartrait Serializabletrait Scalarclass Objecttrait Matchableclass AnyShow all
Value which is natively an Int. Such a value can be converted to Double by invoking asValuable[Double]
Value which is natively an Int. Such a value can be converted to Double by invoking asValuable[Double]
Value parameters
- source
-
the source (which could, conceivably, be a String)
- x
-
the Int value
Attributes
- Companion
- object
- Supertypes
-
trait Producttrait Equalstrait Valueclass BaseIntScalarclass BaseScalartrait Serializabletrait Scalarclass Objecttrait Matchableclass AnyShow all
NOTE This is experimental code.
NOTE This is experimental code.
Created by scalaprof on 10/5/16.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
object IntAdditionMonoid
Attributes
- Supertypes
- Known subtypes
Type class Orderable.
Type class Orderable.
This combination of trait Orderable and implicit objects comprises the "type class" Orderable.
This has been split off from Valuable by scalaprof on 7/10/16.
CONSIDER extending Ordered instead of Ordering
Attributes
- Companion
- object
- Supertypes
-
trait Ordering[X]trait PartialOrdering[X]trait Equiv[X]trait Serializabletrait Comparator[X]class Objecttrait Matchableclass AnyShow all
- Known subtypes
-
trait Valuable[X]trait ValuableDoubleobject ValuableDoubletrait ValuableIntobject ValuableInttrait ValuableLongobject ValuableLongtrait Incrementable[X]trait IncrementableIntobject IncrementableInttrait IncrementableLocalDateobject IncrementableLocalDatetrait IncrementableLongobject IncrementableLongtrait IncrementableStringobject IncrementableStringtrait OrderableBooleanobject OrderableBooleantrait OrderableDoubleobject OrderableDoubletrait OrderableIntobject OrderableInttrait IntCounterobject intCountertrait OrderableLocalDateobject OrderableLocalDatetrait OrderableLongobject OrderableLongtrait LongCounterobject longCountertrait OrderableRationalobject OrderableRationaltrait OrderableStringobject OrderableStringtrait Counter[X]Show all
This trait defines the operations of a Probability
This trait defines the operations of a Probability
Attributes
- Companion
- object
- Supertypes
-
trait () => Doubleclass Objecttrait Matchableclass Any
- Known subtypes
-
class GenericProbabilityclass RationalProbability[N]
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Probability.type
Created by Bowen Cai on 1/24/2015.
Created by Bowen Cai on 1/24/2015.
Lifted and edited by ScalaProf from http://stackoverflow.com/questions/11305290/is-there-way-to-create-tuple-from-listwithout-codegeneration
Attributes
- Supertypes
-
trait Producttrait Equalsclass Any
- Known subtypes
-
object Tuple0
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
QuotedStringScalar.type
Scalar which is natively a String. Such a value cannot be converted to Int or Double by invoking asValuable.
Scalar which is natively a String. Such a value cannot be converted to Int or Double by invoking asValuable.
Value parameters
- source
-
the source (normally a String but might be enclosed in quotation marks)
- x
-
the String value
Attributes
- Companion
- object
- Supertypes
-
trait Producttrait Equalsclass BaseQuotedStringScalarclass BaseScalartrait Serializabletrait Scalarclass Objecttrait Matchableclass AnyShow all
Value which is natively a String. Such a value cannot be converted to Int or Double by invoking asValuable.
Value which is natively a String. Such a value cannot be converted to Int or Double by invoking asValuable.
Value parameters
- source
-
the source (normally a String but might be enclosed in quotation marks)
- x
-
the String value
Attributes
- Companion
- object
- Supertypes
-
trait Producttrait Equalstrait Valueclass BaseQuotedStringScalarclass BaseScalartrait Serializabletrait Scalarclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
QuotedStringValue.type
A simple Rational type for developers not depending on Spire or something like that. This grew out of a class exercise so is not the last word in sophistication.
A simple Rational type for developers not depending on Spire or something like that. This grew out of a class exercise so is not the last word in sophistication.
NOTE that it is not expected that applications will directly reference this case class constructor. If they do, they must ensure that d is positive and that there are no common factors for n and d
NOTE that the underlying type, N, is invariant.
Type parameters
- N
-
the (invariant) underlying integral type
Value parameters
- denominator
-
the denominator of this Rational
- numerator
-
the numerator of this Rational
Attributes
- Companion
- object
- Supertypes
Attributes
- Supertypes
-
class Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
Probability which is based on a Rational[N]
Probability which is based on a Rational[N]
NOTE that for the | and & methods, we need to convert q into Rational[N]. This is because the unapply method for RationalProbability returns a Rational[Any]
Type parameters
- N
-
the underlying type of Rational[N], with implicit evidence FiniteIntegral[N]
Value parameters
- p
-
the probability as a Rational[N]
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Probabilitytrait () => Doubleclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
RationalProbability.type
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
RationalScalar.type
Scalar which is natively a Double. Such a value cannot be converted to Int by invoking asValuable[Int] because of loss of precision.
Scalar which is natively a Double. Such a value cannot be converted to Int by invoking asValuable[Int] because of loss of precision.
Value parameters
- source
-
the source (which could, conceivably, be a String)
- x
-
the Double value
Attributes
- Companion
- object
- Supertypes
-
trait Producttrait Equalsclass BaseRationalScalarclass BaseScalartrait Serializabletrait Scalarclass Objecttrait Matchableclass AnyShow all
Value which is natively a Double. Such a value cannot be converted to Int by invoking asValuable[Int] because of loss of precision.
Value which is natively a Double. Such a value cannot be converted to Int by invoking asValuable[Int] because of loss of precision.
Value parameters
- source
-
the source (which could, conceivably, be a String)
- x
-
the Double value
Attributes
- Companion
- object
- Supertypes
-
trait Producttrait Equalstrait Valueclass BaseRationalScalarclass BaseScalartrait Serializabletrait Scalarclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
RationalValue.type
Appendix to Rational class: only for Scala 2.11
Appendix to Rational class: only for Scala 2.11
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Rational_Cross.type
Trait Scalar.
Trait Scalar.
The purpose of this trait is to be able to represent quantities -- things that have some ordered (and/or numerical) value -- in a more meaningful way than simply using "Any".
This trait defines six methods: source, asBoolean, asValuable, asOrderable, asIncrementable, asFractional.
For values that you want to consider as numeric, then use asFractional. Valuable is very similar to Numeric/Fractional but has additional methods, in particular fromString, and these methods typically result in a Try[X] as opposed to X.
For values that you want to consider as orderable, then use asOrderable. Orderable extends Ordering. It is used for the type of quantities that do not support arithmetic operations, but do support ordering. A prime example is Date, Datetime, etc.
In the vast majority of cases, you can simply provide a String as the input to Scalar.apply. This is the normal mechanism when you are reading values from HTML, JSON, Config, whatever. Scalars that derive from String representations are normally StringScalars These typically result in an appropriate value when asValuable is invoked, that's to say -- not the String value but the parsed numeric (Valuable) value. If you have a String that you want only to be considered a String, then use QuotedStringScalar
Created by scalaprof on 8/4/16.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
class BaseScalarclass BaseBooleanScalarclass BooleanScalarclass BooleanValueclass BaseDateScalarclass DateScalarclass DateValueclass BaseDoubleScalarclass DoubleScalarclass DoubleValueclass BaseIntScalarclass IntScalarclass IntValueclass BaseQuotedStringScalarclass QuotedStringScalarclass QuotedStringValueclass BaseRationalScalarclass RationalScalarclass RationalValueclass BaseStringScalarclass StringScalarclass StringValueclass SequenceValuetrait ValueShow all
Attributes
- Supertypes
-
class Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Value which is actually a Seq of Values. Such a value, cannot be converted to Int or Double by invoking asValuable, nor by invoking asOrderable. However, when tested by invoking asSequence, such values result in Some(sequence).
Value which is actually a Seq of Values. Such a value, cannot be converted to Int or Double by invoking asValuable, nor by invoking asOrderable. However, when tested by invoking asSequence, such values result in Some(sequence).
Value parameters
- source
-
the source (typically, a Seq of Any objects)
- xs
-
the Seq of Values
Attributes
- Companion
- object
- Supertypes
-
trait Producttrait Equalstrait Valueclass BaseScalartrait Serializabletrait Scalarclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
SequenceValue.type
Scalar which is natively a String. Such a value, providing it is formatted appropriately, can be converted to Int or Double by invoking asValuable[Int] or asValuable[Double], respectively.
Scalar which is natively a String. Such a value, providing it is formatted appropriately, can be converted to Int or Double by invoking asValuable[Int] or asValuable[Double], respectively.
Value parameters
- source
-
the source (normally a String)
- x
-
the String value
Attributes
- Companion
- object
- Supertypes
-
trait Producttrait Equalsclass BaseStringScalarclass BaseScalartrait Serializabletrait Scalarclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
StringScalar.type
Value which is natively a String. Such a value, providing it is formatted appropriately, can be converted to Int or Double by invoking asValuable[Int] or asValuable[Double], respectively.
Value which is natively a String. Such a value, providing it is formatted appropriately, can be converted to Int or Double by invoking asValuable[Int] or asValuable[Double], respectively.
Value parameters
- source
-
the source (normally a String)
- x
-
the String value
Attributes
- Companion
- object
- Supertypes
-
trait Producttrait Equalstrait Valueclass BaseStringScalarclass BaseScalartrait Serializabletrait Scalarclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
StringValue.type
Trait Value.
Trait Value.
The purpose of this trait is to be able to represent quantities -- things that have some ordered (and/or numerical) value -- (or sequences of quantities) in a more meaningful way than simply using "Any".
This trait defines seven methods: source, asBoolean, asValuable, asOrderable, asIncrementable, asFractional, asSequence.
For values that you want to consider as numeric, then use asFractional. Valuable is very similar to Numeric/Fractional but has additional methods, in particular fromString, and these methods typically result in a Try[X] as opposed to X.
For more detail, see Scalar
You can also represent sequences by Value (in particular, SequenceValue). Such values will yield Some(sequence) when asSequence is invoked. Other types of Value will yield None in this situation.
In the vast majority of cases, you can simply provide a String as the input to Value.apply. This is the normal mechanism when you are reading values from HTML, JSON, Config, whatever. Values that derive from String representations are normally StringValues These typically result in an appropriate value when asValuable is invoked, that's to say -- not the String value but the parsed numeric (Valuable) value. If you have a String that you want only to be considered a String, then use QuotedStringValue
Created by scalaprof on 7/8/16.
Attributes
- Companion
- object
- Supertypes
- Known subtypes
-
class BooleanValueclass DateValueclass DoubleValueclass IntValueclass QuotedStringValueclass RationalValueclass SequenceValueclass StringValueShow all
Attributes
- Supertypes
-
class Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes