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 the3
* implementation.4
*/5
public interface Add<Rhs, Result> {6
/**7
* Implements `a + b` for this receiver; domain restrictions and failure behavior belong to the8
* implementing type.9
*/10
public operator fun plus(other: Rhs): Result11
}13
/**14
* The generic operator contract used for `a - b`. Operand and result types are chosen by the15
* implementation.16
*/17
public interface Sub<Rhs, Result> {18
/**19
* Implements `a - b` for this receiver; domain restrictions and failure behavior belong to the20
* implementing type.21
*/22
public operator fun minus(other: Rhs): Result23
}25
/**26
* The generic operator contract used for `a * b`. Operand and result types are chosen by the27
* implementation.28
*/29
public interface Mul<Rhs, Result> {30
/**31
* Implements `a * b` for this receiver; domain restrictions and failure behavior belong to the32
* implementing type.33
*/34
public operator fun times(other: Rhs): Result35
}37
/**38
* The generic operator contract used for `a / b`. Operand and result types are chosen by the39
* implementation.40
*/41
public interface Div<Rhs, Result> {42
/**43
* Implements `a / b` for this receiver; domain restrictions and failure behavior belong to the44
* implementing type.45
*/46
public operator fun div(other: Rhs): Result47
}49
/**50
* The generic operator contract used for `a % b`. Operand and result types are chosen by the51
* implementation.52
*/53
public interface Rem<Rhs, Result> {54
/**55
* Implements `a % b` for this receiver; domain restrictions and failure behavior belong to the56
* implementing type.57
*/58
public operator fun rem(other: Rhs): Result59
}61
/**62
* The generic operator contract used for `+a`. Operand and result types are chosen by the63
* implementation.64
*/65
public interface UnaryPlus<Result> {66
/**67
* Implements `+a` for this receiver; domain restrictions and failure behavior belong to the68
* implementing type.69
*/70
public operator fun unaryPlus(): Result71
}73
/**74
* The generic operator contract used for `-a`. Operand and result types are chosen by the75
* implementation.76
*/77
public interface UnaryMinus<Result> {78
/**79
* Implements `-a` for this receiver; domain restrictions and failure behavior belong to the80
* implementing type.81
*/82
public operator fun unaryMinus(): Result83
}85
/**86
* The generic operator contract used for `++a or a++`. Operand and result types are chosen by the87
* implementation.88
*/89
public interface Increment<Result : Increment<Result>> {90
/**91
* Implements `++a or a++` for this receiver; domain restrictions and failure behavior belong92
* to the implementing type.93
*/94
public operator fun inc(): Result95
}97
/**98
* The generic operator contract used for `--a or a--`. Operand and result types are chosen by the99
* implementation.100
*/101
public interface Decrement<Result : Decrement<Result>> {102
/**103
* Implements `--a or a--` for this receiver; domain restrictions and failure behavior belong104
* to the implementing type.105
*/106
public operator fun dec(): Result107
}109
/**110
* The generic operator contract used for `!a`. Operand and result types are chosen by the111
* implementation.112
*/113
public interface Not<Result> {114
/**115
* Implements `!a` for this receiver; domain restrictions and failure behavior belong to the116
* implementing type.117
*/118
public operator fun not(): Result119
}121
/**122
* The generic ordered-comparison protocol. Only the sign of compareTo matters to relational123
* operators.124
*/125
public 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): Long131
}133
/**134
* The generic operator contract used for `a..b`. Operand and result types are chosen by the135
* implementation.136
*/137
public interface RangeTo<Rhs, Result> {138
/**139
* Implements `a..b` for this receiver; domain restrictions and failure behavior belong to the140
* implementing type.141
*/142
public operator fun rangeTo(endpoint: Rhs): Result143
}145
/**146
* The generic operator contract used for `a..<b`. Operand and result types are chosen by the147
* implementation.148
*/149
public interface RangeUntil<Rhs, Result> {150
/**151
* Implements `a..<b` for this receiver; domain restrictions and failure behavior belong to the152
* implementing type.153
*/154
public operator fun rangeUntil(endpoint: Rhs): Result155
}157
/**158
* The generic operator contract used for `element in container`. Operand and result types are159
* chosen by the implementation.160
*/161
public interface Contains<Element> {162
/**163
* Implements `element in container` for this receiver; domain restrictions and failure164
* behavior belong to the implementing type.165
*/166
public operator fun contains(value: Element): Boolean167
}