99import ReactiveCocoa
1010
1111extension PropertyType where Value == Bool {
12+ /// The conjunction of `self` and `other`.
1213 public func and< P: PropertyType where P. Value == Bool > ( other: P ) -> AndProperty {
1314 return AndProperty ( terms: [ AnyProperty ( self ) , AnyProperty ( other) ] )
1415 }
1516
17+ /// The conjunction of `self` and `other`.
1618 public func and( other: AnyProperty < Bool > ) -> AndProperty {
1719 return AndProperty ( terms: [ AnyProperty ( self ) , other] )
1820 }
1921
22+ /// The disjunction of `self` and `other`.
2023 public func or< P: PropertyType where P. Value == Bool > ( other: P ) -> OrProperty {
2124 return OrProperty ( terms: [ AnyProperty ( self ) , AnyProperty ( other) ] )
2225 }
2326
27+ /// The disjunction of `self` and `other`.
2428 public func or( other: AnyProperty < Bool > ) -> OrProperty {
2529 return OrProperty ( terms: [ AnyProperty ( self ) , other] )
2630 }
2731
32+ /// A negated property of `self`.
2833 public func not( ) -> NotProperty {
2934 return NotProperty ( source: AnyProperty ( self ) , invert: true )
3035 }
3136}
3237
38+ /// Specialized `PropertyType` for the conjuction of a set of boolean properties.
3339public struct AndProperty : PropertyType {
3440 public let terms : [ AnyProperty < Bool > ]
3541
@@ -44,10 +50,12 @@ public struct AndProperty: PropertyType {
4450 }
4551 }
4652
53+ /// Creates a new property with an additional conjunctive term.
4754 public func and< P : PropertyType where P. Value == Bool > ( other: P ) -> AndProperty {
4855 return AndProperty ( terms: terms + [ AnyProperty ( other) ] )
4956 }
5057
58+ /// Creates a new property with an additional conjunctive term.
5159 public func and( other: AnyProperty < Bool > ) -> AndProperty {
5260 return AndProperty ( terms: terms + [ other] )
5361 }
@@ -57,6 +65,7 @@ public struct AndProperty: PropertyType {
5765 }
5866}
5967
68+ /// Specialized `PropertyType` for the disjunction of a set of boolean properties.
6069public struct OrProperty : PropertyType {
6170 public let terms : [ AnyProperty < Bool > ]
6271
@@ -71,10 +80,12 @@ public struct OrProperty: PropertyType {
7180 }
7281 }
7382
83+ /// Creates a new property with an additional disjunctive term.
7484 public func or< P : PropertyType where P. Value == Bool > ( other: P ) -> OrProperty {
7585 return OrProperty ( terms: terms + [ AnyProperty ( other) ] )
7686 }
7787
88+ /// Creates a new property with an additional disjunctive term.
7889 public func or( other: AnyProperty < Bool > ) -> OrProperty {
7990 return OrProperty ( terms: terms + [ other] )
8091 }
@@ -84,6 +95,7 @@ public struct OrProperty: PropertyType {
8495 }
8596}
8697
98+ /// Specialized `PropertyType` for the negation of a boolean property.
8799public struct NotProperty : PropertyType {
88100 private let source : AnyProperty < Bool >
89101 private let invert : Bool
@@ -96,6 +108,7 @@ public struct NotProperty: PropertyType {
96108 return source. producer. map { $0 != self . invert }
97109 }
98110
111+ /// A negated property of `self`.
99112 public func not( ) -> NotProperty {
100113 return NotProperty ( source: source, invert: !invert)
101114 }
0 commit comments