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 AnyRef.G.Buffer[(String, String)] with _core with scala.Product

General Instance Documentation

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

Source
__.scala
class Doc extends AnyRef.G.Buffer[(String, String)] with _core with scala.Product

General Instance Documentation

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

Source
__.scala
object Event

This object holds the event building framework

Source
__.scala
object Math

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

Source
__.scala
class Request

General Request

General Request types establish some concept. They are always available without need to import.

Application classes and traits can have implicit conversions from General Request type to a local definition (for example).

Using general request singleton objects can make code more readable. There is no overhead because conversions are inlined.

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

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

   val b: Int.Buffer = NEW
   // vs.
   val b: Int.Buffer = Int.Buffer()

   val j: java.util.List[String] = NEW
   // vs.
   val j: java.util.List[String] = new java.util.ArrayList()

   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 VOID, which is a request for a void instance

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

General Request

General Request types establish some concept. They are always available without need to import.

Application classes and traits can have implicit conversions from General Request type to a local definition (for example).

Using general request singleton objects can make code more readable. There is no overhead because conversions are inlined.

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

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

   val b: Int.Buffer = NEW
   // vs.
   val b: Int.Buffer = Int.Buffer()

   val j: java.util.List[String] = NEW
   // vs.
   val j: java.util.List[String] = new java.util.ArrayList()

   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 VOID, which is a request for a void instance

var s: Stream[Int]  = VOID     // Assigning empty stream of Ints
var o: Opt[String]  = VOID     // Assigning empty optional value of String
var i: Long.Idx     = VOID     // 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 Stream 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
  • scala.Nil is a void instance, re-used for all parameterized scala.List types

Void objects have a standard way to declare their voidness by mixing this Void trait. Alternatively, Able.Void trait can be mixed and "def isVoid" test added explicitly. For standard opaque types "def value_isVoid" has to be overridden in companion object.

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

class Foo

object Foo:
 val void = new Foo with Void
 implicit inline def implicitRequest(v:VOID): Foo = void

// Standard void assignment is:
val v: Foo=VOID

A standard way to test for voidness is universal .isVoid method available for all types (including opaque).

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 Stream 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
  • scala.Nil is a void instance, re-used for all parameterized scala.List types

Void objects have a standard way to declare their voidness by mixing this Void trait. Alternatively, Able.Void trait can be mixed and "def isVoid" test added explicitly. For standard opaque types "def value_isVoid" has to be overridden in companion object.

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

class Foo

object Foo:
 val void = new Foo with Void
 implicit inline def implicitRequest(v:VOID): Foo = void

// Standard void assignment is:
val v: Foo=VOID

A standard way to test for voidness is universal .isVoid method available for all types (including opaque).

Source
__.scala

Alias

Type alias

Type alias

Shortcut to Gen.Math.BigDecimal

Source
__.scala

Type companion alias

Type companion alias

Shortcut to Gen.Math.BigDecimal

Source
__.scala

Type alias

Type alias

Shortcut to Gen.Math.BigInteger

Source
__.scala

Type companion alias

Type companion alias

Shortcut to Gen.Math.BigInteger

Source
__.scala

Type alias

Type alias

Shortcut to Gen.Util.ByteCount

Source
__.scala

Type companion alias

Type companion alias

Shortcut to Gen.Util.ByteCount

Source
__.scala

Type alias

Type alias

Shortcut to Gen.Calendar.Day

Source
__.scala
inline def Day: Gen.Calendar.Day

Type companion alias

Type companion alias

Shortcut to Gen.Calendar.Day

Source
__.scala

Type alias

Type alias

Shortcut to Gen.Time.DayTime

Source
__.scala

Type companion alias

Type companion alias

Shortcut to Gen.Time.DayTime

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

Type alias

Type alias

Shortcut to Gen.Util.EnumCompanion

Source
__.scala

Type alias

Type alias

Shortcut to Gen.Calendar.Month

Source
__.scala

Type companion alias

Type companion alias

Shortcut to Gen.Calendar.Month

Source
__.scala

Type alias

Type alias

Shortcut to Gen.Event.Observable

Source
__.scala
inline def Observable: Gen.O

Type companion alias

Type companion alias

Shortcut to Gen.Event.Observable

Source
__.scala
type Ordering[A] = scala.math.Ordering[A]

Type alias

Type alias

Shortcut to Gen.Math.Ordering

Source
__.scala
inline def Ordering: Ordering

Type companion alias

Type companion alias

Shortcut to Gen.Math.Ordering

Source
__.scala

Type alias

Type alias

Shortcut to Gen.Util.Percent

Source
__.scala

Type companion alias

Type companion alias

Shortcut to Gen.Util.Percent

Source
__.scala

Type alias

Type alias

Shortcut to Gen.Time.Period

Source
__.scala

Type companion alias

Type companion alias

Shortcut to Gen.Time.Period

Source
__.scala

Type alias

Type alias

Shortcut to Gen.Math.Rounding

Source
__.scala

Type companion alias

Type companion alias

Shortcut to Gen.Math.Rounding

Source
__.scala

Type alias

Type alias

Shortcut to Gen.Util.TwoWayFunction

Source
__.scala

Type companion alias

Type companion alias

Shortcut to Gen.Util.TwoWayFunction

Source
__.scala

Type alias

Type alias

Shortcut to Gen.Calendar.Week

Source
__.scala

Type companion alias

Type companion alias

Shortcut to Gen.Calendar.Week

Source
__.scala

Type alias

Type alias

Shortcut to Gen.Calendar.Year

Source
__.scala

Type companion alias

Type companion alias

Shortcut to Gen.Calendar.Year

Source
__.scala