# interval

package module
v0.0.0-...-194845b Latest Latest

Go to latest
Published: Nov 22, 2018 License: BSD-3-Clause

`github.com/cznic/interval` has moved to `modernc.org/interval` (vcs).

Please update your import paths to `modernc.org/interval`.

This repo is now archived.

## Documentation ¶

### Overview ¶

Package interval handles sets of ordered values laying between two, possibly infinite, bounds.

Note: Intervals are usually defined as a set of [extended] real numbers. The model of the interval provided by Interface does not know - and thus does not care about the type of the bounds, if any. That may lead to correct but possibly surprising effects when the bounds domain is not ℝ. An interval may be non empty, like for example the open interval (1, 2), but no integer value lies between the bounds.

### Constants ¶

This section is empty.

### Variables ¶

This section is empty.

### Functions ¶

This section is empty.

### Types ¶

#### type BigInt ¶

```type BigInt struct {
Cls  Class
A, B *big.Int
}```

BigInt is an interval having math/big.Int bounds.

Example
```x := &BigInt{LeftOpen, big.NewInt(1), big.NewInt(2)}
y := &BigInt{LeftClosed, big.NewInt(2), big.NewInt(3)}
fmt.Printf("x %v, y %v: x ∩ y %v, x ∪ y %v", x, y, Intersection(x, y), Union(x, y))
```
```Output:

x (1, 2], y [2, 3): x ∩ y {2}, x ∪ y (1, 3)
```

#### func (*BigInt) Class ¶

`func (i *BigInt) Class() Class`

Class implements Interface.

#### func (*BigInt) Clone ¶

`func (i *BigInt) Clone() Interface`

Clone implements Interface.

#### func (*BigInt) CompareAA ¶

`func (i *BigInt) CompareAA(other Interface) int`

CompareAA implements Interface.

#### func (*BigInt) CompareAB ¶

`func (i *BigInt) CompareAB(other Interface) int`

CompareAB implements Interface.

#### func (*BigInt) CompareBB ¶

`func (i *BigInt) CompareBB(other Interface) int`

CompareBB implements Interface.

#### func (*BigInt) SetAB ¶

`func (i *BigInt) SetAB()`

SetAB implements Interface.

#### func (*BigInt) SetB ¶

`func (i *BigInt) SetB(other Interface)`

SetB implements Interface.

#### func (*BigInt) SetBA ¶

`func (i *BigInt) SetBA(other Interface)`

SetBA implements Interface.

#### func (*BigInt) SetClass ¶

`func (i *BigInt) SetClass(c Class)`

SetClass implements Interface.

#### func (*BigInt) String ¶

`func (i *BigInt) String() string`

String implements fmt.Stringer.

#### type BigRat ¶

```type BigRat struct {
Cls  Class
A, B *big.Rat
}```

BigRat is an interval having math/big.Rat bounds.

Example
```x := &BigRat{LeftOpen, big.NewRat(1, 1), big.NewRat(2, 1)}
y := &BigRat{LeftClosed, big.NewRat(2, 1), big.NewRat(3, 1)}
fmt.Printf("x %v, y %v: x ∩ y %v, x ∪ y %v", x, y, Intersection(x, y), Union(x, y))
```
```Output:

x (1/1, 2/1], y [2/1, 3/1): x ∩ y {2/1}, x ∪ y (1/1, 3/1)
```

#### func (*BigRat) Class ¶

`func (i *BigRat) Class() Class`

Class implements Interface.

#### func (*BigRat) Clone ¶

`func (i *BigRat) Clone() Interface`

Clone implements Interface.

#### func (*BigRat) CompareAA ¶

`func (i *BigRat) CompareAA(other Interface) int`

CompareAA implements Interface.

#### func (*BigRat) CompareAB ¶

`func (i *BigRat) CompareAB(other Interface) int`

CompareAB implements Interface.

#### func (*BigRat) CompareBB ¶

`func (i *BigRat) CompareBB(other Interface) int`

CompareBB implements Interface.

#### func (*BigRat) SetAB ¶

`func (i *BigRat) SetAB()`

SetAB implements Interface.

#### func (*BigRat) SetB ¶

`func (i *BigRat) SetB(other Interface)`

SetB implements Interface.

#### func (*BigRat) SetBA ¶

`func (i *BigRat) SetBA(other Interface)`

SetBA implements Interface.

#### func (*BigRat) SetClass ¶

`func (i *BigRat) SetClass(c Class)`

SetClass implements Interface.

#### func (*BigRat) String ¶

`func (i *BigRat) String() string`

String implements fmt.Stringer.

#### type Byte ¶

```type Byte struct {
Cls  Class
A, B byte
}```

Byte is an interval having byte bounds.

Example
```x := &Byte{LeftOpen, 1, 2}
y := &Byte{LeftClosed, 2, 3}
fmt.Printf("x %v, y %v: x ∩ y %v, x ∪ y %v", x, y, Intersection(x, y), Union(x, y))
```
```Output:

x (1, 2], y [2, 3): x ∩ y {2}, x ∪ y (1, 3)
```

#### func (*Byte) Class ¶

`func (i *Byte) Class() Class`

Class implements Interface.

#### func (*Byte) Clone ¶

`func (i *Byte) Clone() Interface`

Clone implements Interface.

#### func (*Byte) CompareAA ¶

`func (i *Byte) CompareAA(other Interface) int`

CompareAA implements Interface.

#### func (*Byte) CompareAB ¶

`func (i *Byte) CompareAB(other Interface) int`

CompareAB implements Interface.

#### func (*Byte) CompareBB ¶

`func (i *Byte) CompareBB(other Interface) int`

CompareBB implements Interface.

#### func (*Byte) SetAB ¶

`func (i *Byte) SetAB()`

SetAB implements Interface.

#### func (*Byte) SetB ¶

`func (i *Byte) SetB(other Interface)`

SetB implements Interface.

#### func (*Byte) SetBA ¶

`func (i *Byte) SetBA(other Interface)`

SetBA implements Interface.

#### func (*Byte) SetClass ¶

`func (i *Byte) SetClass(c Class)`

SetClass implements Interface.

#### func (*Byte) String ¶

`func (i *Byte) String() string`

String implements fmt.Stringer.

#### type Class ¶

`type Class int`

Class represent a type of an interval.

```const (
Unbounded  Class = iota // (-∞, ∞).
Empty                   // {}.
Degenerate              // [a, a] = {a}.

// Proper and bounded:
Open       // (a, b) = {x | a < x < b}.
Closed     // [a, b] = {x | a <= x <= b}.
LeftOpen   // (a, b] = {x | a < x <= b}.
LeftClosed // [a, b) = {x | a <= x < b}.

// Left-bounded and right-unbounded:
LeftBoundedOpen   // (a, ∞) = {x | x > a}.
LeftBoundedClosed // [a, ∞) = {x | x >= a}.

// Left-unbounded and right-bounded:
RightBoundedOpen   // (-∞, b) = {x | x < b}.
RightBoundedClosed // (-∞, b] = {x | x <= b}.

)```

Interval classes.

#### func (Class) String ¶

`func (i Class) String() string`

#### type Duration ¶

```type Duration struct {
Cls  Class
A, B time.Duration
}```

Duration is an interval having time.Duration bounds.

Example
```x := &Duration{LeftOpen, 1, 2}
y := &Duration{LeftClosed, 2, 3}
fmt.Printf("x %v, y %v: x ∩ y %v, x ∪ y %v", x, y, Intersection(x, y), Union(x, y))
```
```Output:

x (1ns, 2ns], y [2ns, 3ns): x ∩ y {2ns}, x ∪ y (1ns, 3ns)
```

#### func (*Duration) Class ¶

`func (i *Duration) Class() Class`

Class implements Interface.

#### func (*Duration) Clone ¶

`func (i *Duration) Clone() Interface`

Clone implements Interface.

#### func (*Duration) CompareAA ¶

`func (i *Duration) CompareAA(other Interface) int`

CompareAA implements Interface.

#### func (*Duration) CompareAB ¶

`func (i *Duration) CompareAB(other Interface) int`

CompareAB implements Interface.

#### func (*Duration) CompareBB ¶

`func (i *Duration) CompareBB(other Interface) int`

CompareBB implements Interface.

#### func (*Duration) SetAB ¶

`func (i *Duration) SetAB()`

SetAB implements Interface.

#### func (*Duration) SetB ¶

`func (i *Duration) SetB(other Interface)`

SetB implements Interface.

#### func (*Duration) SetBA ¶

`func (i *Duration) SetBA(other Interface)`

SetBA implements Interface.

#### func (*Duration) SetClass ¶

`func (i *Duration) SetClass(c Class)`

SetClass implements Interface.

#### func (*Duration) String ¶

`func (i *Duration) String() string`

String implements fmt.Stringer.

#### type Float32 ¶

```type Float32 struct {
Cls  Class
A, B float32
}```

Float32 is an interval having float32 bounds.

Note: Using NaNs as bounds has undefined behavior.

Example
```x := &Float32{LeftOpen, 1, 2}
y := &Float32{LeftClosed, 2, 3}
fmt.Printf("x %v, y %v: x ∩ y %v, x ∪ y %v", x, y, Intersection(x, y), Union(x, y))
```
```Output:

x (1, 2], y [2, 3): x ∩ y {2}, x ∪ y (1, 3)
```

#### func (*Float32) Class ¶

`func (i *Float32) Class() Class`

Class implements Interface.

#### func (*Float32) Clone ¶

`func (i *Float32) Clone() Interface`

Clone implements Interface.

#### func (*Float32) CompareAA ¶

`func (i *Float32) CompareAA(other Interface) int`

CompareAA implements Interface.

#### func (*Float32) CompareAB ¶

`func (i *Float32) CompareAB(other Interface) int`

CompareAB implements Interface.

#### func (*Float32) CompareBB ¶

`func (i *Float32) CompareBB(other Interface) int`

CompareBB implements Interface.

#### func (*Float32) SetAB ¶

`func (i *Float32) SetAB()`

SetAB implements Interface.

#### func (*Float32) SetB ¶

`func (i *Float32) SetB(other Interface)`

SetB implements Interface.

#### func (*Float32) SetBA ¶

`func (i *Float32) SetBA(other Interface)`

SetBA implements Interface.

#### func (*Float32) SetClass ¶

`func (i *Float32) SetClass(c Class)`

SetClass implements Interface.

#### func (*Float32) String ¶

`func (i *Float32) String() string`

String implements fmt.Stringer.

#### type Float64 ¶

```type Float64 struct {
Cls  Class
A, B float64
}```

Float64 is an interval having float64 bounds.

Note: Using NaNs as bounds has undefined behavior.

Example
```x := &Float32{LeftOpen, 1, 2}
y := &Float32{LeftClosed, 2, 3}
fmt.Printf("x %v, y %v: x ∩ y %v, x ∪ y %v", x, y, Intersection(x, y), Union(x, y))
```
```Output:

x (1, 2], y [2, 3): x ∩ y {2}, x ∪ y (1, 3)
```

#### func (*Float64) Class ¶

`func (i *Float64) Class() Class`

Class implements Interface.

#### func (*Float64) Clone ¶

`func (i *Float64) Clone() Interface`

Clone implements Interface.

#### func (*Float64) CompareAA ¶

`func (i *Float64) CompareAA(other Interface) int`

CompareAA implements Interface.

#### func (*Float64) CompareAB ¶

`func (i *Float64) CompareAB(other Interface) int`

CompareAB implements Interface.

#### func (*Float64) CompareBB ¶

`func (i *Float64) CompareBB(other Interface) int`

CompareBB implements Interface.

#### func (*Float64) SetAB ¶

`func (i *Float64) SetAB()`

SetAB implements Interface.

#### func (*Float64) SetB ¶

`func (i *Float64) SetB(other Interface)`

SetB implements Interface.

#### func (*Float64) SetBA ¶

`func (i *Float64) SetBA(other Interface)`

SetBA implements Interface.

#### func (*Float64) SetClass ¶

`func (i *Float64) SetClass(c Class)`

SetClass implements Interface.

#### func (*Float64) String ¶

`func (i *Float64) String() string`

String implements fmt.Stringer.

#### type Int ¶

```type Int struct {
Cls  Class
A, B int
}```

Int is an interval having int bounds.

Example
```x := &Int{LeftOpen, 1, 2}
y := &Int{LeftClosed, 2, 3}
fmt.Printf("x %v, y %v: x ∩ y %v, x ∪ y %v", x, y, Intersection(x, y), Union(x, y))
```
```Output:

x (1, 2], y [2, 3): x ∩ y {2}, x ∪ y (1, 3)
```

#### func (*Int) Class ¶

`func (i *Int) Class() Class`

Class implements Interface.

#### func (*Int) Clone ¶

`func (i *Int) Clone() Interface`

Clone implements Interface.

#### func (*Int) CompareAA ¶

`func (i *Int) CompareAA(other Interface) int`

CompareAA implements Interface.

#### func (*Int) CompareAB ¶

`func (i *Int) CompareAB(other Interface) int`

CompareAB implements Interface.

#### func (*Int) CompareBB ¶

`func (i *Int) CompareBB(other Interface) int`

CompareBB implements Interface.

#### func (*Int) SetAB ¶

`func (i *Int) SetAB()`

SetAB implements Interface.

#### func (*Int) SetB ¶

`func (i *Int) SetB(other Interface)`

SetB implements Interface.

#### func (*Int) SetBA ¶

`func (i *Int) SetBA(other Interface)`

SetBA implements Interface.

#### func (*Int) SetClass ¶

`func (i *Int) SetClass(c Class)`

SetClass implements Interface.

#### func (*Int) String ¶

`func (i *Int) String() string`

String implements fmt.Stringer.

#### type Int128 ¶

```type Int128 struct {
Cls  Class
A, B mathutil.Int128
}```

Int128 is an interval having Int128 bounds.

Example
```x := &Int128{LeftOpen, int128.SetInt64(1), int128.SetInt64(2)}
y := &Int128{LeftClosed, int128.SetInt64(2), int128.SetInt64(3)}
fmt.Printf("x %v, y %v: x ∩ y %v, x ∪ y %v", x, y, Intersection(x, y), Union(x, y))
```
```Output:

x (1, 2], y [2, 3): x ∩ y {2}, x ∪ y (1, 3)
```

#### func (*Int128) Class ¶

`func (i *Int128) Class() Class`

Class implements Interface.

#### func (*Int128) Clone ¶

`func (i *Int128) Clone() Interface`

Clone implements Interface.

#### func (*Int128) CompareAA ¶

`func (i *Int128) CompareAA(other Interface) int`

CompareAA implements Interface.

#### func (*Int128) CompareAB ¶

`func (i *Int128) CompareAB(other Interface) int`

CompareAB implements Interface.

#### func (*Int128) CompareBB ¶

`func (i *Int128) CompareBB(other Interface) int`

CompareBB implements Interface.

#### func (*Int128) SetAB ¶

`func (i *Int128) SetAB()`

SetAB implements Interface.

#### func (*Int128) SetB ¶

`func (i *Int128) SetB(other Interface)`

SetB implements Interface.

#### func (*Int128) SetBA ¶

`func (i *Int128) SetBA(other Interface)`

SetBA implements Interface.

#### func (*Int128) SetClass ¶

`func (i *Int128) SetClass(c Class)`

SetClass implements Interface.

#### func (*Int128) String ¶

`func (i *Int128) String() string`

String implements fmt.Stringer.

#### type Int16 ¶

```type Int16 struct {
Cls  Class
A, B int16
}```

Int16 is an interval having int16 bounds.

Example
```x := &Int16{LeftOpen, 1, 2}
y := &Int16{LeftClosed, 2, 3}
fmt.Printf("x %v, y %v: x ∩ y %v, x ∪ y %v", x, y, Intersection(x, y), Union(x, y))
```
```Output:

x (1, 2], y [2, 3): x ∩ y {2}, x ∪ y (1, 3)
```

#### func (*Int16) Class ¶

`func (i *Int16) Class() Class`

Class implements Interface.

#### func (*Int16) Clone ¶

`func (i *Int16) Clone() Interface`

Clone implements Interface.

#### func (*Int16) CompareAA ¶

`func (i *Int16) CompareAA(other Interface) int`

CompareAA implements Interface.

#### func (*Int16) CompareAB ¶

`func (i *Int16) CompareAB(other Interface) int`

CompareAB implements Interface.

#### func (*Int16) CompareBB ¶

`func (i *Int16) CompareBB(other Interface) int`

CompareBB implements Interface.

#### func (*Int16) SetAB ¶

`func (i *Int16) SetAB()`

SetAB implements Interface.

#### func (*Int16) SetB ¶

`func (i *Int16) SetB(other Interface)`

SetB implements Interface.

#### func (*Int16) SetBA ¶

`func (i *Int16) SetBA(other Interface)`

SetBA implements Interface.

#### func (*Int16) SetClass ¶

`func (i *Int16) SetClass(c Class)`

SetClass implements Interface.

#### func (*Int16) String ¶

`func (i *Int16) String() string`

String implements fmt.Stringer.

#### type Int32 ¶

```type Int32 struct {
Cls  Class
A, B int32
}```

Int32 is an interval having int32 bounds.

Example
```x := &Int32{LeftOpen, 1, 2}
y := &Int32{LeftClosed, 2, 3}
fmt.Printf("x %v, y %v: x ∩ y %v, x ∪ y %v", x, y, Intersection(x, y), Union(x, y))
```
```Output:

x (1, 2], y [2, 3): x ∩ y {2}, x ∪ y (1, 3)
```

#### func (*Int32) Class ¶

`func (i *Int32) Class() Class`

Class implements Interface.

#### func (*Int32) Clone ¶

`func (i *Int32) Clone() Interface`

Clone implements Interface.

#### func (*Int32) CompareAA ¶

`func (i *Int32) CompareAA(other Interface) int`

CompareAA implements Interface.

#### func (*Int32) CompareAB ¶

`func (i *Int32) CompareAB(other Interface) int`

CompareAB implements Interface.

#### func (*Int32) CompareBB ¶

`func (i *Int32) CompareBB(other Interface) int`

CompareBB implements Interface.

#### func (*Int32) SetAB ¶

`func (i *Int32) SetAB()`

SetAB implements Interface.

#### func (*Int32) SetB ¶

`func (i *Int32) SetB(other Interface)`

SetB implements Interface.

#### func (*Int32) SetBA ¶

`func (i *Int32) SetBA(other Interface)`

SetBA implements Interface.

#### func (*Int32) SetClass ¶

`func (i *Int32) SetClass(c Class)`

SetClass implements Interface.

#### func (*Int32) String ¶

`func (i *Int32) String() string`

String implements fmt.Stringer.

#### type Int64 ¶

```type Int64 struct {
Cls  Class
A, B int64
}```

Int64 is an interval having int64 bounds.

Example
```x := &Int64{LeftOpen, 1, 2}
y := &Int64{LeftClosed, 2, 3}
fmt.Printf("x %v, y %v: x ∩ y %v, x ∪ y %v", x, y, Intersection(x, y), Union(x, y))
```
```Output:

x (1, 2], y [2, 3): x ∩ y {2}, x ∪ y (1, 3)
```

#### func (*Int64) Class ¶

`func (i *Int64) Class() Class`

Class implements Interface.

#### func (*Int64) Clone ¶

`func (i *Int64) Clone() Interface`

Clone implements Interface.

#### func (*Int64) CompareAA ¶

`func (i *Int64) CompareAA(other Interface) int`

CompareAA implements Interface.

#### func (*Int64) CompareAB ¶

`func (i *Int64) CompareAB(other Interface) int`

CompareAB implements Interface.

#### func (*Int64) CompareBB ¶

`func (i *Int64) CompareBB(other Interface) int`

CompareBB implements Interface.

#### func (*Int64) SetAB ¶

`func (i *Int64) SetAB()`

SetAB implements Interface.

#### func (*Int64) SetB ¶

`func (i *Int64) SetB(other Interface)`

SetB implements Interface.

#### func (*Int64) SetBA ¶

`func (i *Int64) SetBA(other Interface)`

SetBA implements Interface.

#### func (*Int64) SetClass ¶

`func (i *Int64) SetClass(c Class)`

SetClass implements Interface.

#### func (*Int64) String ¶

`func (i *Int64) String() string`

String implements fmt.Stringer.

#### type Int8 ¶

```type Int8 struct {
Cls  Class
A, B int8
}```

Int8 is an interval having int8 bounds.

Example
```x := &Int8{LeftOpen, 1, 2}
y := &Int8{LeftClosed, 2, 3}
fmt.Printf("x %v, y %v: x ∩ y %v, x ∪ y %v", x, y, Intersection(x, y), Union(x, y))
```
```Output:

x (1, 2], y [2, 3): x ∩ y {2}, x ∪ y (1, 3)
```

#### func (*Int8) Class ¶

`func (i *Int8) Class() Class`

Class implements Interface.

#### func (*Int8) Clone ¶

`func (i *Int8) Clone() Interface`

Clone implements Interface.

#### func (*Int8) CompareAA ¶

`func (i *Int8) CompareAA(other Interface) int`

CompareAA implements Interface.

#### func (*Int8) CompareAB ¶

`func (i *Int8) CompareAB(other Interface) int`

CompareAB implements Interface.

#### func (*Int8) CompareBB ¶

`func (i *Int8) CompareBB(other Interface) int`

CompareBB implements Interface.

#### func (*Int8) SetAB ¶

`func (i *Int8) SetAB()`

SetAB implements Interface.

#### func (*Int8) SetB ¶

`func (i *Int8) SetB(other Interface)`

SetB implements Interface.

#### func (*Int8) SetBA ¶

`func (i *Int8) SetBA(other Interface)`

SetBA implements Interface.

#### func (*Int8) SetClass ¶

`func (i *Int8) SetClass(c Class)`

SetClass implements Interface.

#### func (*Int8) String ¶

`func (i *Int8) String() string`

String implements fmt.Stringer.

#### type Interface ¶

```type Interface interface {
// Class returns the interval class.
Class() Class
// Clone clones the interval.
Clone() Interface
// CompareAA compares interval.A and other.A.
CompareAA(other Interface) int
// CompareAB compares interval.A and other.B.
CompareAB(other Interface) int
// CompareBB compares interval.B and other.B.
CompareBB(other Interface) int
// SetClass sets the interval class.
SetClass(Class)
// SetAB sets interval.A using interval.B.
SetAB()
// SetB sets interval.B using other.B.
SetB(other Interface)
// SetBA sets interval.B using other.A.
SetBA(other Interface)
}```

Interface represents an unbounded, empty, degenerate, proper, left-bounded or right-bounded interval. Where appropriate, the interval bounds are defined by ordered values, named by convention a and b, when present.

Proper intervals have an invariant: a < b.

CompareXX return value must obey these rules

```< 0 if interval A or B <  other interval A or B
0 if interval A or B == other interval A or B
> 0 if interval A or B >  other interval A or B
```

#### func Intersection ¶

`func Intersection(x, y Interface) Interface`

Intersection returns the intersection of x and y.

#### func Union ¶

`func Union(x, y Interface) Interface`

Union returns the union of x and y. If the union is not an interval, nil is returned instead. The union is not an interval if it is a disjoint set.

#### type String ¶

```type String struct {
Cls  Class
A, B string
}```

String is an interval having string bounds.

Example
```x := &String{LeftOpen, "aqua", "bar"}
y := &String{LeftClosed, "bar", "closed"}
fmt.Printf("x %v, y %v: x ∩ y %v, x ∪ y %v", x, y, Intersection(x, y), Union(x, y))
```
```Output:

x (aqua, bar], y [bar, closed): x ∩ y {bar}, x ∪ y (aqua, closed)
```

#### func (*String) Class ¶

`func (i *String) Class() Class`

Class implements Interface.

#### func (*String) Clone ¶

`func (i *String) Clone() Interface`

Clone implements Interface.

#### func (*String) CompareAA ¶

`func (i *String) CompareAA(other Interface) int`

CompareAA implements Interface.

#### func (*String) CompareAB ¶

`func (i *String) CompareAB(other Interface) int`

CompareAB implements Interface.

#### func (*String) CompareBB ¶

`func (i *String) CompareBB(other Interface) int`

CompareBB implements Interface.

#### func (*String) SetAB ¶

`func (i *String) SetAB()`

SetAB implements Interface.

#### func (*String) SetB ¶

`func (i *String) SetB(other Interface)`

SetB implements Interface.

#### func (*String) SetBA ¶

`func (i *String) SetBA(other Interface)`

SetBA implements Interface.

#### func (*String) SetClass ¶

`func (i *String) SetClass(c Class)`

SetClass implements Interface.

#### func (*String) String ¶

`func (i *String) String() string`

String implements fmt.Stringer.

#### type Time ¶

```type Time struct {
Cls  Class
A, B time.Time
}```

Time is an interval having time.Time bounds.

Example
```x := &Time{LeftOpen, time.Unix(1, 0), time.Unix(2, 0)}
y := &Time{LeftClosed, time.Unix(2, 0), time.Unix(3, 0)}
fmt.Printf("x %v, y %v: x ∩ y %v, x ∪ y %v", x, y, Intersection(x, y), Union(x, y))
```
```Output:

x (1970-01-01 01:00:01 +0100 CET, 1970-01-01 01:00:02 +0100 CET], y [1970-01-01 01:00:02 +0100 CET, 1970-01-01 01:00:03 +0100 CET): x ∩ y {1970-01-01 01:00:02 +0100 CET}, x ∪ y (1970-01-01 01:00:01 +0100 CET, 1970-01-01 01:00:03 +0100 CET)
```

#### func (*Time) Class ¶

`func (i *Time) Class() Class`

Class implements Interface.

#### func (*Time) Clone ¶

`func (i *Time) Clone() Interface`

Clone implements Interface.

#### func (*Time) CompareAA ¶

`func (i *Time) CompareAA(other Interface) int`

CompareAA implements Interface.

#### func (*Time) CompareAB ¶

`func (i *Time) CompareAB(other Interface) int`

CompareAB implements Interface.

#### func (*Time) CompareBB ¶

`func (i *Time) CompareBB(other Interface) int`

CompareBB implements Interface.

#### func (*Time) SetAB ¶

`func (i *Time) SetAB()`

SetAB implements Interface.

#### func (*Time) SetB ¶

`func (i *Time) SetB(other Interface)`

SetB implements Interface.

#### func (*Time) SetBA ¶

`func (i *Time) SetBA(other Interface)`

SetBA implements Interface.

#### func (*Time) SetClass ¶

`func (i *Time) SetClass(c Class)`

SetClass implements Interface.

#### func (*Time) String ¶

`func (i *Time) String() string`

String implements fmt.Stringer.

#### type Uint ¶

```type Uint struct {
Cls  Class
A, B uint
}```

Uint is an interval having uint bounds.

Example
```x := &Uint{LeftOpen, 1, 2}
y := &Uint{LeftClosed, 2, 3}
fmt.Printf("x %v, y %v: x ∩ y %v, x ∪ y %v", x, y, Intersection(x, y), Union(x, y))
```
```Output:

x (1, 2], y [2, 3): x ∩ y {2}, x ∪ y (1, 3)
```

#### func (*Uint) Class ¶

`func (i *Uint) Class() Class`

Class implements Interface.

#### func (*Uint) Clone ¶

`func (i *Uint) Clone() Interface`

Clone implements Interface.

#### func (*Uint) CompareAA ¶

`func (i *Uint) CompareAA(other Interface) int`

CompareAA implements Interface.

#### func (*Uint) CompareAB ¶

`func (i *Uint) CompareAB(other Interface) int`

CompareAB implements Interface.

#### func (*Uint) CompareBB ¶

`func (i *Uint) CompareBB(other Interface) int`

CompareBB implements Interface.

#### func (*Uint) SetAB ¶

`func (i *Uint) SetAB()`

SetAB implements Interface.

#### func (*Uint) SetB ¶

`func (i *Uint) SetB(other Interface)`

SetB implements Interface.

#### func (*Uint) SetBA ¶

`func (i *Uint) SetBA(other Interface)`

SetBA implements Interface.

#### func (*Uint) SetClass ¶

`func (i *Uint) SetClass(c Class)`

SetClass implements Interface.

#### func (*Uint) String ¶

`func (i *Uint) String() string`

String implements fmt.Stringer.

#### type Uint16 ¶

```type Uint16 struct {
Cls  Class
A, B uint16
}```

Uint16 is an interval having uint16 bounds.

Example
```x := &Uint16{LeftOpen, 1, 2}
y := &Uint16{LeftClosed, 2, 3}
fmt.Printf("x %v, y %v: x ∩ y %v, x ∪ y %v", x, y, Intersection(x, y), Union(x, y))
```
```Output:

x (1, 2], y [2, 3): x ∩ y {2}, x ∪ y (1, 3)
```

#### func (*Uint16) Class ¶

`func (i *Uint16) Class() Class`

Class implements Interface.

#### func (*Uint16) Clone ¶

`func (i *Uint16) Clone() Interface`

Clone implements Interface.

#### func (*Uint16) CompareAA ¶

`func (i *Uint16) CompareAA(other Interface) int`

CompareAA implements Interface.

#### func (*Uint16) CompareAB ¶

`func (i *Uint16) CompareAB(other Interface) int`

CompareAB implements Interface.

#### func (*Uint16) CompareBB ¶

`func (i *Uint16) CompareBB(other Interface) int`

CompareBB implements Interface.

#### func (*Uint16) SetAB ¶

`func (i *Uint16) SetAB()`

SetAB implements Interface.

#### func (*Uint16) SetB ¶

`func (i *Uint16) SetB(other Interface)`

SetB implements Interface.

#### func (*Uint16) SetBA ¶

`func (i *Uint16) SetBA(other Interface)`

SetBA implements Interface.

#### func (*Uint16) SetClass ¶

`func (i *Uint16) SetClass(c Class)`

SetClass implements Interface.

#### func (*Uint16) String ¶

`func (i *Uint16) String() string`

String implements fmt.Stringer.

#### type Uint32 ¶

```type Uint32 struct {
Cls  Class
A, B uint32
}```

Uint32 is an interval having uint32 bounds.

Example
```x := &Uint32{LeftOpen, 1, 2}
y := &Uint32{LeftClosed, 2, 3}
fmt.Printf("x %v, y %v: x ∩ y %v, x ∪ y %v", x, y, Intersection(x, y), Union(x, y))
```
```Output:

x (1, 2], y [2, 3): x ∩ y {2}, x ∪ y (1, 3)
```

#### func (*Uint32) Class ¶

`func (i *Uint32) Class() Class`

Class implements Interface.

#### func (*Uint32) Clone ¶

`func (i *Uint32) Clone() Interface`

Clone implements Interface.

#### func (*Uint32) CompareAA ¶

`func (i *Uint32) CompareAA(other Interface) int`

CompareAA implements Interface.

#### func (*Uint32) CompareAB ¶

`func (i *Uint32) CompareAB(other Interface) int`

CompareAB implements Interface.

#### func (*Uint32) CompareBB ¶

`func (i *Uint32) CompareBB(other Interface) int`

CompareBB implements Interface.

#### func (*Uint32) SetAB ¶

`func (i *Uint32) SetAB()`

SetAB implements Interface.

#### func (*Uint32) SetB ¶

`func (i *Uint32) SetB(other Interface)`

SetB implements Interface.

#### func (*Uint32) SetBA ¶

`func (i *Uint32) SetBA(other Interface)`

SetBA implements Interface.

#### func (*Uint32) SetClass ¶

`func (i *Uint32) SetClass(c Class)`

SetClass implements Interface.

#### func (*Uint32) String ¶

`func (i *Uint32) String() string`

String implements fmt.Stringer.

#### type Uint64 ¶

```type Uint64 struct {
Cls  Class
A, B uint64
}```

Uint64 is an interval having uint64 bounds.

Example
```x := &Uint64{LeftOpen, 1, 2}
y := &Uint64{LeftClosed, 2, 3}
fmt.Printf("x %v, y %v: x ∩ y %v, x ∪ y %v", x, y, Intersection(x, y), Union(x, y))
```
```Output:

x (1, 2], y [2, 3): x ∩ y {2}, x ∪ y (1, 3)
```

#### func (*Uint64) Class ¶

`func (i *Uint64) Class() Class`

Class implements Interface.

#### func (*Uint64) Clone ¶

`func (i *Uint64) Clone() Interface`

Clone implements Interface.

#### func (*Uint64) CompareAA ¶

`func (i *Uint64) CompareAA(other Interface) int`

CompareAA implements Interface.

#### func (*Uint64) CompareAB ¶

`func (i *Uint64) CompareAB(other Interface) int`

CompareAB implements Interface.

#### func (*Uint64) CompareBB ¶

`func (i *Uint64) CompareBB(other Interface) int`

CompareBB implements Interface.

#### func (*Uint64) SetAB ¶

`func (i *Uint64) SetAB()`

SetAB implements Interface.

#### func (*Uint64) SetB ¶

`func (i *Uint64) SetB(other Interface)`

SetB implements Interface.

#### func (*Uint64) SetBA ¶

`func (i *Uint64) SetBA(other Interface)`

SetBA implements Interface.

#### func (*Uint64) SetClass ¶

`func (i *Uint64) SetClass(c Class)`

SetClass implements Interface.

#### func (*Uint64) String ¶

`func (i *Uint64) String() string`

String implements fmt.Stringer.