AutoTestCellInfo.swift 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. //
  2. // AutoTestCellInfo.swift
  3. // KdanAuto
  4. //
  5. // Created by 朱东勇 on 2022/12/19.
  6. //
  7. import Foundation
  8. class AutoTestCellInfo : NSObject {
  9. var _isFileType : Bool! = false
  10. var _fileType:String = ""
  11. var _isType : Bool! = false
  12. var _typeInfo: NSDictionary = NSDictionary()
  13. var _row : Int! = 0
  14. class func initWithRow(_ row:Int) -> AutoTestCellInfo {
  15. let cellInfo = AutoTestCellInfo()
  16. cellInfo._row = row
  17. var index = 0
  18. for fileType in testFileTypes {
  19. // 当前行是否为 文件类型行
  20. if ((row - index) == 0) {
  21. cellInfo.setFileType(fileType)
  22. cellInfo.setIsFileType(true)
  23. return cellInfo
  24. }
  25. index = index + 1;
  26. //当前文件类型是否为展开
  27. if (DataModel.shared.isExpand(fileType)) {
  28. let testTypes = testTypeInfo[fileType] as! NSArray
  29. if (row - index < testTypes.count) {
  30. let typeInfo = testTypes[row - index] as! NSDictionary
  31. cellInfo.setFileType(fileType)
  32. cellInfo.setTypeInfo(typeInfo)
  33. cellInfo.setIsType(true)
  34. return cellInfo
  35. }
  36. index = index + testTypes.count
  37. }
  38. }
  39. return cellInfo
  40. }
  41. /// Setter & Getter
  42. func isFileType() -> Bool {
  43. return _isFileType
  44. }
  45. private func setIsFileType(_ isFileType:Bool) {
  46. _isFileType = isFileType
  47. }
  48. func fileType() -> String {
  49. return _fileType
  50. }
  51. private func setFileType(_ fileType:String) {
  52. _fileType = fileType
  53. }
  54. func isType() -> Bool {
  55. return _isType
  56. }
  57. private func setIsType(_ isType:Bool) {
  58. _isType = isType
  59. }
  60. func typeInfo() -> NSDictionary {
  61. return _typeInfo
  62. }
  63. private func setTypeInfo(_ typeInfo:NSDictionary) {
  64. _typeInfo = typeInfo
  65. }
  66. }