Update outdated pods.

This commit is contained in:
Qiu Yuzhou
2017-03-20 21:26:25 +08:00
parent 5f97493f1d
commit 975b544078
209 changed files with 4395 additions and 2293 deletions

View File

@ -6,7 +6,6 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
import Foundation
import Swift
let arrayDictionaryMaxSize = 30
@ -44,6 +43,9 @@ struct Bag<T> : CustomDebugStringConvertible {
var _key0: BagKey? = nil
var _value0: T? = nil
// then fill "array dictionary"
var _pairs = ContiguousArray<Entry>()
// last is sparse dictionary
var _dictionary: [BagKey : T]? = nil
@ -77,6 +79,11 @@ struct Bag<T> : CustomDebugStringConvertible {
return key
}
if _pairs.count < arrayDictionaryMaxSize {
_pairs.append(key: key, value: element)
return key
}
if _dictionary == nil {
_dictionary = [:]
}
@ -89,7 +96,7 @@ struct Bag<T> : CustomDebugStringConvertible {
/// - returns: Number of elements in bag.
var count: Int {
let dictionaryCount: Int = _dictionary?.count ?? 0
return (_value0 != nil ? 1 : 0) + dictionaryCount
return (_value0 != nil ? 1 : 0) + _pairs.count + dictionaryCount
}
/// Removes all elements from bag and clears capacity.
@ -97,6 +104,7 @@ struct Bag<T> : CustomDebugStringConvertible {
_key0 = nil
_value0 = nil
_pairs.removeAll(keepingCapacity: false)
_dictionary?.removeAll(keepingCapacity: false)
}
@ -118,6 +126,14 @@ struct Bag<T> : CustomDebugStringConvertible {
return existingObject
}
for i in 0 ..< _pairs.count {
if _pairs[i].key == key {
let value = _pairs[i].value
_pairs.remove(at: i)
return value
}
}
return nil
}
}
@ -148,6 +164,10 @@ extension Bag {
action(value0)
}
for i in 0 ..< _pairs.count {
action(_pairs[i].value)
}
if dictionary?.count ?? 0 > 0 {
for element in dictionary!.values {
action(element)