-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTbxItem.swift
executable file
·117 lines (85 loc) · 2.23 KB
/
TbxItem.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
//
// TbxItem.swift
// Tinderbox-Aeon-Exchange
//
// Created by prenez on 6/27/15.
// Copyright © 2015 Michael Prenez-Isbell. All rights reserved.
//
import Foundation
class TbxItem {
var name : String
var value: String
// var ID: String
// var isPrototype: Bool
// var aliasID:String
// var nextNull: Bool
// var hasNoteDescendants: Bool
// var hasNoteSiblings: Bool
// var parent : TbxItem?
var children: Array<TbxItem>
//default
init () {
self.name = ""
self.value = ""
// self.ID = ""
// self.isPrototype = false
// self.aliasID = ""
// self.nextNull = true
// self.hasNoteDescendants = false
// self.hasNoteSiblings = false
// self.parent = nil
self.children = []
}
//designated
init(name: String, value: String, children: Array<TbxItem>) {
self.name = name
self.value = value
self.children = []
}
//convenience
// convenience init (aname: String) {
// self.init(name: aname, age: 25, children: [])
// }
func addChild(item: TbxItem) -> (Void) {
children.append(item)
}
func hasChildren() -> Bool {
return self.children.count != 0
}
}
/*
public class TbxItem : NSObject
{
public string Name { get; set; }
public string Text {get; set; }
public string ID { get; set; }
public bool IsPrototype { get; set;}
public string AliasID { get; set; }
public bool NextNull {get;set;}
public bool HasNoteDescendants { get; set;}
public bool HasNoteSiblings { get; set;}
public TbxItem Parent { get; set; }
public TbxItem () {
this.Name = String.Empty;
this.Text = string.Empty;
this.ID = string.Empty;
this.AliasID = string.Empty;
this.IsPrototype = false;
this.NextNull = false;
}
public IList<TbxItem> Children
{
get { return this.children; }
set { this.children = value; }
}
protected IList<TbxItem> children = new List<TbxItem>();
public bool HasChildren
{
get { return (this.children.Count > 0); }
}
public override string ToString ()
{
return this.Name.ToString ();
}
}
*/