-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathGraph.swift
More file actions
80 lines (59 loc) · 2.54 KB
/
Graph.swift
File metadata and controls
80 lines (59 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//=----------------------------------------------------------------------------=
// This source file is part of the DiffableTextViews open source project.
//
// Copyright (c) 2022 Oscar Byström Ericsson
// Licensed under Apache License, Version 2.0
//
// See http://www.apache.org/licenses/LICENSE-2.0 for license information.
//=----------------------------------------------------------------------------=
import Foundation
//*============================================================================*
// MARK: * Graph
//*============================================================================*
public protocol _Graph {
associatedtype Value: _Value // where Value.NumberTextGraph == Self
associatedtype Input: _Input
//=------------------------------------------------------------------------=
// MARK: State
//=------------------------------------------------------------------------=
@inlinable var min: Input { get }
@inlinable var max: Input { get }
@inlinable var zero: Input { get }
@inlinable var precision: Int { get }
@inlinable var optional: Bool { get }
@inlinable var unsigned: Bool { get }
@inlinable var integer: Bool { get }
}
//*============================================================================*
// MARK: * Graph x Numberable
//*============================================================================*
public protocol _Numberable: _Graph {
associatedtype Number: _Style where
Number: _Standard,
Number.Value == Value,
Number.Input == Input
}
//*============================================================================*
// MARK: * Graph x Percentable
//*============================================================================*
public protocol _Percentable: _Graph {
associatedtype Percent: _Style where
Percent: _Standard,
Percent.Value == Value,
Percent.Input == Input
}
public extension _Style where Graph: _Percentable, Graph: _Numberable, Graph.Number == Self {
typealias Percent = Graph.Percent
}
//*============================================================================*
// MARK: * Graph x Currency
//*============================================================================*
public protocol _Currencyable: _Graph {
associatedtype Currency: _Style where
Currency: _Currency,
Currency.Value == Value,
Currency.Input == Input
}
public extension _Style where Graph: _Currencyable, Graph: _Numberable, Graph.Number == Self {
typealias Currency = Graph.Currency
}