Gen

object Gen

General Utilities

Gen is fully exported to scalqa root, thus all members and aliases of Gen can be called with or without "Gen." prefix.

For example:

val v: Gen.Number.Percent = ???
// is same as
val v: Gen.Percent     = ???
// is same as
val v: Percent     = ???
Source
__.scala
class java.lang.Object
trait scala.Matchable
class Any

Member

object Able

Able contains a set of fundamentally generic interfaces

Source
__.scala
class Doc extends Ref.Buffer[(String, String)] with Able.Tag with scala.Product

General Instance Documentation

Doc is a buffer of (name,value) pairs, describing all instance properties

Methods .tag and .text return Doc description as single and multi line String.

Note: There are additional convenience methods like:

   def += (name: String, value: A)
   def add(name: String, value: A)

which allow adding name/values pairs without tupling

Source
__.scala
class Doc extends Ref.Buffer[(String, String)] with Able.Tag with scala.Product

General Instance Documentation

Doc is a buffer of (name,value) pairs, describing all instance properties

Methods .tag and .text return Doc description as single and multi line String.

Note: There are additional convenience methods like:

   def += (name: String, value: A)
   def add(name: String, value: A)

which allow adding name/values pairs without tupling

Source
__.scala
object Event

This object holds the event building framework

Source
__.scala
object Given
Source
__.scala
object Math

General Math

Math type in Scalqa is an alias to scala.math.Numeric. Generally "Math" is a better name for what Numeric stands for.

Math object contains few shortcuts to java.lang.Math static methods.

Source
__.scala
class Request

General Request

Request objects establish some concept

Application classes and traits can have implicit conversions from Request type to local definitions

Using universal instead of local values can reduce and clarify code


   Time().roundTo(1.Second)(using UP)
   // vs.
   Time().roundTo(1.Second)(using Gen.Rounding.Up)

   Time().roundTo(1.Minute)(using DOWN)
   // vs.
   Time().roundTo(1.Minute)(using Gen.Rounding.Down)

   val l: Long = MAX
   // vs.
   val l: Long = Long.max

   new Fx.Label("XYZ") {
      alignment = RIGHT
      // vs.
      alignment = Fx.Pos.CenterRight
   }

   new Fx.Pane.Split{
      orientation = VERTICAL
      // vs.
      orientation = Fx.Orientation.Vertical
   }

   new Fx.Menu {
      items += SEPARATOR
      // vs.
      items += Fx.Menu.Item.separator
   }

By far the most common request is \/, which is request for void object

var s: ~[Int]       = \/     // Assigning empty stream of Ints
var o: Opt[String]  = \/     // Assigning empty optional value of String
var i: Long.Idx     = \/     // Assigning empty indexed collection of Long
Source
__.scala
class Request

General Request

Request objects establish some concept

Application classes and traits can have implicit conversions from Request type to local definitions

Using universal instead of local values can reduce and clarify code


   Time().roundTo(1.Second)(using UP)
   // vs.
   Time().roundTo(1.Second)(using Gen.Rounding.Up)

   Time().roundTo(1.Minute)(using DOWN)
   // vs.
   Time().roundTo(1.Minute)(using Gen.Rounding.Down)

   val l: Long = MAX
   // vs.
   val l: Long = Long.max

   new Fx.Label("XYZ") {
      alignment = RIGHT
      // vs.
      alignment = Fx.Pos.CenterRight
   }

   new Fx.Pane.Split{
      orientation = VERTICAL
      // vs.
      orientation = Fx.Orientation.Vertical
   }

   new Fx.Menu {
      items += SEPARATOR
      // vs.
      items += Fx.Menu.Item.separator
   }

By far the most common request is \/, which is request for void object

var s: ~[Int]       = \/     // Assigning empty stream of Ints
var o: Opt[String]  = \/     // Assigning empty optional value of String
var i: Long.Idx     = \/     // Assigning empty indexed collection of Long
Source
__.scala
opaque type Time

Time is an opaque Long value, holding milliseconds since start of 1970

Source
__.scala
object Util
Source
__.scala
trait Void extends Able.Void

General Void

Scalqa supports a concept of "void object" ("empty object"), which can be defined for any type. This is similar to Null Object Pattern

Unlike 'null', void object can have methods invoked, getting some behavior pertinent to 'voidness'

Examples:

  • Void ~ is a singleton object of empty stream, which can be re-used for any type
  • Void Opt, is a singleton optional value with no value, which can be re-used for any type
  • Void String, is a string of zero length, which can be re-used for String type instead of null

Void objects have a standard way to declare their voidness by mixing this trait. Alternatively, Able.Void trait can be mixed and isVoid test added explicitly

Types with void values have to define implicit conversions from \/

   class Foo

   object Foo{
     val void = new Foo with Gen.Void

     implicit def implicitRequest(inline v: \/) = void
   }

   var v: Foo = \/   // Standard void assignment

A standard way to test for non voidness is <any>.^.isVoid method

Source
__.scala
trait Void extends Able.Void

General Void

Scalqa supports a concept of "void object" ("empty object"), which can be defined for any type. This is similar to Null Object Pattern

Unlike 'null', void object can have methods invoked, getting some behavior pertinent to 'voidness'

Examples:

  • Void ~ is a singleton object of empty stream, which can be re-used for any type
  • Void Opt, is a singleton optional value with no value, which can be re-used for any type
  • Void String, is a string of zero length, which can be re-used for String type instead of null

Void objects have a standard way to declare their voidness by mixing this trait. Alternatively, Able.Void trait can be mixed and isVoid test added explicitly

Types with void values have to define implicit conversions from \/

   class Foo

   object Foo{
     val void = new Foo with Gen.Void

     implicit def implicitRequest(inline v: \/) = void
   }

   var v: Foo = \/   // Standard void assignment

A standard way to test for non voidness is <any>.^.isVoid method

Source
__.scala

Alias

Type alias

Type alias

Shortcut to Gen.Math.BigDecimal

Source
__.scala

Companion alias

Companion alias

Shortcut to Gen.Math.BigDecimal

Source
__.scala

Type alias

Type alias

Shortcut to Gen.Math.BigInteger

Source
__.scala

Companion alias

Companion alias

Shortcut to Gen.Math.BigInteger

Source
__.scala

Type alias

Type alias

Shortcut to Gen.Util.ByteCount

Source
__.scala
inline def ByteCount: ByteCount

Companion alias

Companion alias

Shortcut to Gen.Util.ByteCount

Source
__.scala
type Day = Day

Type alias

Type alias

Shortcut to Gen.Calendar.Day

Source
__.scala
inline def Day: Day

Companion alias

Companion alias

Shortcut to Gen.Calendar.Day

Source
__.scala

Type alias

Type alias

Shortcut to Gen.Time.DayTime

Source
__.scala
inline def DayTime: DayTime

Companion alias

Companion alias

Shortcut to Gen.Time.DayTime

Source
__.scala
type EnumCompanion[A <: scala.reflect.Enum] = EnumCompanion[A]
Source
__.scala
type Month = Month

Type alias

Type alias

Shortcut to Gen.Calendar.Month

Source
__.scala
inline def Month: Month

Companion alias

Companion alias

Shortcut to Gen.Calendar.Month

Source
__.scala

Type alias

Type alias

Shortcut to Gen.Event.Observable

Source
__.scala

Companion alias

Companion alias

Shortcut to Gen.Event.Observable

Source
__.scala

Type alias

Type alias

Shortcut to Gen.Util.Percent

Source
__.scala
inline def Percent: Percent

Companion alias

Companion alias

Shortcut to Gen.Util.Percent

Source
__.scala
type Period = Period

Type alias

Type alias

Shortcut to Gen.Time.Period

Source
__.scala
inline def Period: Period

Companion alias

Companion alias

Shortcut to Gen.Time.Period

Source
__.scala

Type alias

Type alias

Shortcut to Gen.Util.ReversibleFunction

Source
__.scala

Companion alias

Companion alias

Shortcut to Gen.Util.ReversibleFunction

Source
__.scala

Type alias

Type alias

Shortcut to Gen.Math.Rounding

Source
__.scala

Companion alias

Companion alias

Shortcut to Gen.Math.Rounding

Source
__.scala
type Week = Week

Type alias

Type alias

Shortcut to Gen.Calendar.Week

Source
__.scala
inline def Week: Week

Companion alias

Companion alias

Shortcut to Gen.Calendar.Week

Source
__.scala
type Year = Year

Type alias

Type alias

Shortcut to Gen.Calendar.Year

Source
__.scala
inline def Year: Year

Companion alias

Companion alias

Shortcut to Gen.Calendar.Year

Source
__.scala