Scoop API

scoop:scoop.core:0.1.0

src/operators.scoop

Selected production source · src/operators.scoop

1/**
2 * The generic operator contract used for `a + b`. Operand and result types are chosen by the
3 * implementation.
4 */
5public interface Add<Rhs, Result> {
6 /**
7 * Implements `a + b` for this receiver; domain restrictions and failure behavior belong to the
8 * implementing type.
9 */
10 public operator fun plus(other: Rhs): Result
13/**
14 * The generic operator contract used for `a - b`. Operand and result types are chosen by the
15 * implementation.
16 */
17public interface Sub<Rhs, Result> {
18 /**
19 * Implements `a - b` for this receiver; domain restrictions and failure behavior belong to the
20 * implementing type.
21 */
22 public operator fun minus(other: Rhs): Result
25/**
26 * The generic operator contract used for `a * b`. Operand and result types are chosen by the
27 * implementation.
28 */
29public interface Mul<Rhs, Result> {
30 /**
31 * Implements `a * b` for this receiver; domain restrictions and failure behavior belong to the
32 * implementing type.
33 */
34 public operator fun times(other: Rhs): Result
37/**
38 * The generic operator contract used for `a / b`. Operand and result types are chosen by the
39 * implementation.
40 */
41public interface Div<Rhs, Result> {
42 /**
43 * Implements `a / b` for this receiver; domain restrictions and failure behavior belong to the
44 * implementing type.
45 */
46 public operator fun div(other: Rhs): Result
49/**
50 * The generic operator contract used for `a % b`. Operand and result types are chosen by the
51 * implementation.
52 */
53public interface Rem<Rhs, Result> {
54 /**
55 * Implements `a % b` for this receiver; domain restrictions and failure behavior belong to the
56 * implementing type.
57 */
58 public operator fun rem(other: Rhs): Result
61/**
62 * The generic operator contract used for `+a`. Operand and result types are chosen by the
63 * implementation.
64 */
65public interface UnaryPlus<Result> {
66 /**
67 * Implements `+a` for this receiver; domain restrictions and failure behavior belong to the
68 * implementing type.
69 */
70 public operator fun unaryPlus(): Result
73/**
74 * The generic operator contract used for `-a`. Operand and result types are chosen by the
75 * implementation.
76 */
77public interface UnaryMinus<Result> {
78 /**
79 * Implements `-a` for this receiver; domain restrictions and failure behavior belong to the
80 * implementing type.
81 */
82 public operator fun unaryMinus(): Result
85/**
86 * The generic operator contract used for `++a or a++`. Operand and result types are chosen by the
87 * implementation.
88 */
89public interface Increment<Result : Increment<Result>> {
90 /**
91 * Implements `++a or a++` for this receiver; domain restrictions and failure behavior belong
92 * to the implementing type.
93 */
94 public operator fun inc(): Result
97/**
98 * The generic operator contract used for `--a or a--`. Operand and result types are chosen by the
99 * implementation.
100 */
101public interface Decrement<Result : Decrement<Result>> {
102 /**
103 * Implements `--a or a--` for this receiver; domain restrictions and failure behavior belong
104 * to the implementing type.
105 */
106 public operator fun dec(): Result
109/**
110 * The generic operator contract used for `!a`. Operand and result types are chosen by the
111 * implementation.
112 */
113public interface Not<Result> {
114 /**
115 * Implements `!a` for this receiver; domain restrictions and failure behavior belong to the
116 * implementing type.
117 */
118 public operator fun not(): Result
121/**
122 * The generic ordered-comparison protocol. Only the sign of compareTo matters to relational
123 * operators.
124 */
125public interface Compare<Rhs> {
126 /**
127 * Returns a negative number, zero, or a positive number when this value is before, equal to,
128 * or after the operand in the implementation's ordering.
129 */
130 public operator fun compareTo(other: Rhs): Long
133/**
134 * The generic operator contract used for `a..b`. Operand and result types are chosen by the
135 * implementation.
136 */
137public interface RangeTo<Rhs, Result> {
138 /**
139 * Implements `a..b` for this receiver; domain restrictions and failure behavior belong to the
140 * implementing type.
141 */
142 public operator fun rangeTo(endpoint: Rhs): Result
145/**
146 * The generic operator contract used for `a..<b`. Operand and result types are chosen by the
147 * implementation.
148 */
149public interface RangeUntil<Rhs, Result> {
150 /**
151 * Implements `a..<b` for this receiver; domain restrictions and failure behavior belong to the
152 * implementing type.
153 */
154 public operator fun rangeUntil(endpoint: Rhs): Result
157/**
158 * The generic operator contract used for `element in container`. Operand and result types are
159 * chosen by the implementation.
160 */
161public interface Contains<Element> {
162 /**
163 * Implements `element in container` for this receiver; domain restrictions and failure
164 * behavior belong to the implementing type.
165 */
166 public operator fun contains(value: Element): Boolean