Merge pull request #2119 from ewanmellor/swift-remove-triple

[Swift] Remove Triple.swift.
This commit is contained in:
Terence Parr 2017-11-29 09:55:11 -08:00 committed by GitHub
commit 406b1816c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 38 deletions

View File

@ -1,38 +0,0 @@
///
/// Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
/// Use of this file is governed by the BSD 3-clause license that
/// can be found in the LICENSE.txt file in the project root.
///
public class Triple<A:Hashable, B:Hashable, C:Hashable>: Hashable, CustomStringConvertible {
public let a: A
public let b: B
public let c: C
public init(_ a: A, _ b: B, _ c: C) {
self.a = a
self.b = b
self.c = c
}
public var hashValue: Int {
var hash = MurmurHash.initialize()
hash = MurmurHash.update(hash, a)
hash = MurmurHash.update(hash, b)
hash = MurmurHash.update(hash, c)
return MurmurHash.finish(hash, 3)
}
public var description: String {
return "\(a),\(b),(c)"
}
}
public func ==<A, B, C>(lhs: Triple<A, B, C>, rhs: Triple<A, B, C>) -> Bool {
if lhs === rhs {
return true
}
// return false
return lhs.a == rhs.a && lhs.b == rhs.b && lhs.c == rhs.c
}