Advertisement
Guest User

Untitled

a guest
Feb 11th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.67 KB | None | 0 0
  1. diff --git a/stdlib/public/core/SetAlgebra.swift b/stdlib/public/core/SetAlgebra.swift
  2. index 822d5bc..9386cd5 100644
  3. --- a/stdlib/public/core/SetAlgebra.swift
  4. +++ b/stdlib/public/core/SetAlgebra.swift
  5. @@ -20,7 +20,7 @@
  6. /// In a model of `SetAlgebra`, some elements may subsume other
  7. /// elements, where
  8. ///
  9. -/// > `a` **subsumes** `b` iff `([a] as Self).isSupersetOf([b])`
  10. +/// > `a` **subsumes** `b` iff `([a] as Self).isSuperset(of: [b])`
  11. ///
  12. /// In many models of `SetAlgebra` such as `Set<Element>`, `a`
  13. /// *subsumes* `b` if and only if `a == b`, but that is not always the
  14. @@ -35,16 +35,16 @@
  15. /// of type `S`, and `e` is of type `S.Element`:
  16. ///
  17. /// - `S() == []`
  18. -/// - `x.intersect(x) == x`
  19. -/// - `x.intersect([]) == []`
  20. -/// - `x.union(x) == x`
  21. -/// - `x.union([]) == x`
  22. +/// - `x.intersection(with: x) == x`
  23. +/// - `x.intersection(with: []) == []`
  24. +/// - `x.unioning(with: x) == x`
  25. +/// - `x.unioning(with: []) == x`
  26. /// - `x.contains(e)` implies `x.union(y).contains(e)`
  27. -/// - `x.union(y).contains(e)` implies `x.contains(e) || y.contains(e)`
  28. -/// - `x.contains(e) && y.contains(e)` iff `x.intersect(y).contains(e)`
  29. -/// - `x.isSubsetOf(y)` iff `y.isSupersetOf(x)`
  30. -/// - `x.isStrictSupersetOf(y)` iff `x.isSupersetOf(y) && x != y`
  31. -/// - `x.isStrictSubsetOf(y)` iff `x.isSubsetOf(y) && x != y`
  32. +/// - `x.unioning(with: y).contains(e)` implies `x.contains(e) || y.contains(e)`
  33. +/// - `x.contains(e) && y.contains(e)` iff `x.intersection(with: y).contains(e)`
  34. +/// - `x.isSubset(of: y)` iff `y.isSuperset(of: x)`
  35. +/// - `x.isStrictSuperset(of: y)` iff `x.isSuperset(of: y) && x != y`
  36. +/// - `x.isStrictSubset(of: y)` iff `x.isSubset(of: y) && x != y`
  37. public protocol SetAlgebra : Equatable, ArrayLiteralConvertible {
  38. /// A type for which `Self` provides a containment test.
  39. associatedtype Element
  40. @@ -63,16 +63,16 @@ public protocol SetAlgebra : Equatable, ArrayLiteralConvertible {
  41. /// Returns the set of elements contained in `self`, in `other`, or in
  42. /// both `self` and `other`.
  43. @warn_unused_result
  44. - func union(other: Self) -> Self
  45. + func unioning(with other: Self) -> Self
  46.  
  47. /// Returns the set of elements contained in both `self` and `other`.
  48. @warn_unused_result
  49. - func intersect(other: Self) -> Self
  50. + func intersection(with other: Self) -> Self
  51.  
  52. /// Returns the set of elements contained in `self` or in `other`,
  53. /// but not in both `self` and `other`.
  54. @warn_unused_result
  55. - func exclusiveOr(other: Self) -> Self
  56. + func exclusiveOring(with other: Self) -> Self
  57.  
  58. /// If `member` is not already contained in `self`, inserts it.
  59. ///
  60. @@ -90,53 +90,53 @@ public protocol SetAlgebra : Equatable, ArrayLiteralConvertible {
  61. /// Insert all elements of `other` into `self`.
  62. ///
  63. /// - Equivalent to replacing `self` with `self.union(other)`.
  64. - /// - Postcondition: `self.isSupersetOf(other)`
  65. - mutating func unionInPlace(other: Self)
  66. + /// - Postcondition: `self.isSuperset(of other)`
  67. + mutating func union(with other: Self)
  68.  
  69. /// Removes all elements of `self` that are not also present in
  70. /// `other`.
  71. ///
  72. /// - Equivalent to replacing `self` with `self.intersect(other)`
  73. - /// - Postcondition: `self.isSubsetOf(other)`
  74. - mutating func intersectInPlace(other: Self)
  75. + /// - Postcondition: `self.isSubset(of other)`
  76. + mutating func intersect(with other: Self)
  77.  
  78. /// Replaces `self` with a set containing all elements contained in
  79. /// either `self` or `other`, but not both.
  80. ///
  81. /// - Equivalent to replacing `self` with `self.exclusiveOr(other)`
  82. - mutating func exclusiveOrInPlace(other: Self)
  83. + mutating func exclusiveOr(with other: Self)
  84.  
  85. //===--- Requirements with default implementations ----------------------===//
  86. /// Returns the set of elements contained in `self` but not in `other`.
  87. @warn_unused_result
  88. - func subtract(other: Self) -> Self
  89. + func subtracting(other: Self) -> Self
  90.  
  91. /// Return true iff every element of `self` is contained in `other`.
  92. @warn_unused_result
  93. - func isSubsetOf(other: Self) -> Bool
  94. + func isSubset(of other: Self) -> Bool
  95.  
  96. /// Return true iff `self.intersect(other).isEmpty`.
  97. @warn_unused_result
  98. - func isDisjointWith(other: Self) -> Bool
  99. + func isDisjoint(with other: Self) -> Bool
  100.  
  101. /// Return true iff every element of `other` is contained in `self`.
  102. @warn_unused_result
  103. - func isSupersetOf(other: Self) -> Bool
  104. + func isSuperset(of other: Self) -> Bool
  105.  
  106. /// Return true iff `self.contains(e)` is `false` for all `e`.
  107. var isEmpty: Bool { get }
  108.  
  109. /// Creates the set containing all elements of `sequence`.
  110. - init<S : Sequence where S.Iterator.Element == Element>(_ sequence: S)
  111. + init<S : SequenceType where S.Generator.Element == Element>(_ sequence: S)
  112.  
  113. /// Removes all elements of `other` from `self`.
  114. ///
  115. /// - Equivalent to replacing `self` with `self.subtract(other)`.
  116. - mutating func subtractInPlace(other: Self)
  117. + mutating func subtract(other: Self)
  118.  
  119. /// Returns `true` iff `a` subsumes `b`.
  120. ///
  121. - /// - Equivalent to `([a] as Self).isSupersetOf([b])`
  122. + /// - Equivalent to `([a] as Self).isSuperset(of: [b])`
  123. @warn_unused_result
  124. static func element(a: Element, subsumes b: Element) -> Bool
  125.  
  126. @@ -182,13 +182,13 @@ extension SetAlgebra {
  127.  
  128. /// Returns true iff every element of `self` is contained in `other`.
  129. @warn_unused_result
  130. - public func isSubsetOf(other: Self) -> Bool {
  131. + public func isSubset(of other: Self) -> Bool {
  132. return self.intersect(other) == self
  133. }
  134.  
  135. /// Returns true iff every element of `other` is contained in `self`.
  136. @warn_unused_result
  137. - public func isSupersetOf(other: Self) -> Bool {
  138. + public func isSuperset(of other: Self) -> Bool {
  139. return other.isSubsetOf(self)
  140. }
  141.  
  142. @@ -212,20 +212,20 @@ extension SetAlgebra {
  143. /// Returns true iff every element of `other` is contained in `self`
  144. /// and `self` contains an element that is not contained in `other`.
  145. @warn_unused_result
  146. - public func isStrictSupersetOf(other: Self) -> Bool {
  147. + public func isStrictSuperset(of other: Self) -> Bool {
  148. return self.isSupersetOf(other) && self != other
  149. }
  150.  
  151. /// Return true iff every element of `self` is contained in `other`
  152. /// and `other` contains an element that is not contained in `self`.
  153. @warn_unused_result
  154. - public func isStrictSubsetOf(other: Self) -> Bool {
  155. + public func isStrictSubset(of other: Self) -> Bool {
  156. return other.isStrictSupersetOf(self)
  157. }
  158.  
  159. /// Returns `true` iff `a` subsumes `b`.
  160. ///
  161. - /// - Equivalent to `([a] as Self).isSupersetOf([b])`
  162. + /// - Equivalent to `([a] as Self).isSuperset(of: [b])`
  163. @warn_unused_result
  164. public static func element(a: Element, subsumes b: Element) -> Bool {
  165. return ([a] as Self).isSupersetOf([b])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement