@@ -75,8 +75,8 @@ public struct RedBlackTree<Key: Comparable, Value>: Probable, Collection, Custom
7575 - returns: String
7676 */
7777 public var description : String {
78- var output : String = " [ "
79- let l : Int = count - 1
78+ var output = " [ "
79+ let l = count - 1
8080 for i in 0 ..< count {
8181 output += " \( self [ i] ) "
8282 if i != l {
@@ -119,7 +119,7 @@ public struct RedBlackTree<Key: Comparable, Value>: Probable, Collection, Custom
119119
120120 /**
121121 :name: startIndex
122- :description: Conforms to the CollectionType Protocol.
122+ :description: Conforms to the Collection Protocol.
123123 - returns: Int
124124 */
125125 public var startIndex : Int {
@@ -128,7 +128,7 @@ public struct RedBlackTree<Key: Comparable, Value>: Probable, Collection, Custom
128128
129129 /**
130130 :name: endIndex
131- :description: Conforms to the CollectionType Protocol.
131+ :description: Conforms to the Collection Protocol.
132132 - returns: Int
133133 */
134134 public var endIndex : Int {
@@ -212,7 +212,7 @@ public struct RedBlackTree<Key: Comparable, Value>: Probable, Collection, Custom
212212 /**
213213 The probability of elements.
214214 */
215- public func probability( _ block: ( Key , Value ? ) -> Bool ) -> Double {
215+ public func probability( execute block: ( Key , Value ? ) -> Bool ) -> Double {
216216 if 0 == count {
217217 return 0
218218 }
@@ -246,7 +246,7 @@ public struct RedBlackTree<Key: Comparable, Value>: Probable, Collection, Custom
246246 - returns: Bool
247247 */
248248 @discardableResult
249- mutating public func insert( _ key : Key , value : Value ? ) -> Bool {
249+ mutating public func insert( value : Value ? , for key : Key ) -> Bool {
250250 return sentinel !== internalInsert ( key, value: value)
251251 }
252252
@@ -255,18 +255,18 @@ public struct RedBlackTree<Key: Comparable, Value>: Probable, Collection, Custom
255255 :description: Inserts a list of (Key, Value?) pairs.
256256 - parameter nodes: (Key, Value?)... Elements to insert.
257257 */
258- mutating public func insert( _ nodes: ( Key , Value ? ) ... ) {
259- insert ( nodes)
258+ mutating public func insert( nodes: ( Key , Value ? ) ... ) {
259+ insert ( nodes : nodes)
260260 }
261261
262262 /**
263263 :name: insert
264264 :description: Inserts an array of (Key, Value?) pairs.
265- - parameter nodes: Array< (Key, Value?)> Elements to insert.
265+ - parameter nodes: [ (Key, Value?)] Elements to insert.
266266 */
267- mutating public func insert( _ nodes: Array < ( Key , Value ? ) > ) {
267+ mutating public func insert( nodes: [ ( Key , Value ? ) ] ) {
268268 for (k, v) in nodes {
269- insert ( k , value: v)
269+ insert ( value: v, for : k )
270270 }
271271 }
272272
@@ -277,8 +277,8 @@ public struct RedBlackTree<Key: Comparable, Value>: Probable, Collection, Custom
277277 the given key value will be removed.
278278 - returns: RedBlackTree<Key, Value>?
279279 */
280- mutating public func removeValueForKeys ( _ keys: Key ... ) {
281- return removeValueForKeys ( keys)
280+ mutating public func removeValue ( for keys: Key ... ) {
281+ return removeValue ( for : keys)
282282 }
283283
284284 /**
@@ -288,7 +288,7 @@ public struct RedBlackTree<Key: Comparable, Value>: Probable, Collection, Custom
288288 the given key will be removed.
289289 - returns: RedBlackTree<Key, Value>?
290290 */
291- mutating public func removeValueForKeys ( _ keys: Array < Key > ) {
291+ mutating public func removeValue ( for keys: [ Key ] ) {
292292 for x in keys {
293293 var z = internalRemoveValueForKey ( x)
294294 while sentinel !== z {
@@ -324,8 +324,8 @@ public struct RedBlackTree<Key: Comparable, Value>: Probable, Collection, Custom
324324 If the tree allows non-unique keys, then all keys matching
325325 the given key value will be updated.
326326 */
327- mutating public func updateValue ( _ value: Value ? , forKey : Key ) {
328- internalUpdateValue ( value, forKey: forKey , node: root)
327+ mutating public func update ( value: Value ? , for key : Key ) {
328+ internalUpdateValue ( value, forKey: key , node: root)
329329 }
330330
331331 /**
@@ -334,7 +334,7 @@ public struct RedBlackTree<Key: Comparable, Value>: Probable, Collection, Custom
334334 in isUniquelyKeyed tree of a given keyed node.
335335 - returns: Value?
336336 */
337- public func findValueForKey ( _ key: Key ) -> Value ? {
337+ public func findValue ( for key: Key ) -> Value ? {
338338 return internalFindNodeForKey ( key) . value
339339 }
340340
@@ -381,7 +381,7 @@ public struct RedBlackTree<Key: Comparable, Value>: Probable, Collection, Custom
381381 :description: Returns the Index of a given member, or nil if the member is not present in the set.
382382 - returns: Int
383383 */
384- public func indexOf ( _ key: Key ) -> Int {
384+ public func index ( of key: Key ) -> Int {
385385 let x = internalFindNodeForKey ( key)
386386 return sentinel == x ? - 1 : internalOrder ( x) - 1
387387 }
0 commit comments