mirror of
https://github.com/GayPizzaSpecifications/darwin-apk.git
synced 2025-08-03 13:31:32 +00:00
36 lines
1.0 KiB
Swift
36 lines
1.0 KiB
Swift
/*
|
|
* darwin-apk © 2024 Gay Pizza Specifications
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import Foundation
|
|
|
|
public class ApkPackageGraphNode {
|
|
private weak var graph: ApkPackageGraph!
|
|
let package: ApkIndexPackage
|
|
|
|
//private var _parents = NSHashTable<ApkPackageGraphNode>.weakObjects()
|
|
//private var _children = NSHashTable<ApkPackageGraphNode>.weakObjects()
|
|
var parents = [ApkIndexRequirementRef]()
|
|
var children: [ApkIndexRequirementRef]
|
|
|
|
internal init(package: ApkIndexPackage, children: [ApkIndexRequirementRef]) {
|
|
self.package = package
|
|
self.children = children
|
|
}
|
|
}
|
|
|
|
extension ApkPackageGraphNode: CustomStringConvertible {
|
|
public var description: String {
|
|
var result = "node[\(self.package.name)]"
|
|
if !self.parents.isEmpty {
|
|
result += ", parents[\(self.parents.lazy.map(\.description).joined(separator: ", "))]"
|
|
}
|
|
if !self.children.isEmpty {
|
|
result += ", children[\(self.children.lazy.map(\.description).joined(separator: ", "))]"
|
|
|
|
}
|
|
return result
|
|
}
|
|
}
|