BMLTiOSLibHierarchicalServiceBodyNode

public class BMLTiOSLibHierarchicalServiceBodyNode : NSObject

This is a special “micro class” for aggregating a hierarchical Service body map.

We create the map when we connect to the Root Server, and the map is a doubly-linked list, with each node containing the basic dictionary for a Service body, and references to parents and contained (“children”) nodes.

Public Properties.

  • The parent node for this object. Nil if top-level.

    Declaration

    Swift

    public var parent: BMLTiOSLibHierarchicalServiceBodyNode!
  • The Service body information for this node.

    Declaration

    Swift

    public var serviceBody: [String : String]!
  • An array of “child” nodes. May be empty, if we are a “leaf.”

    Declaration

    Swift

    public var children: [BMLTiOSLibHierarchicalServiceBodyNode]
  • This is whatever data the user wants to attach to the node.

    Declaration

    Swift

    public var extraData: AnyObject?

Public Calculated Properties.

  • Declaration

    Swift

    public var keys: [String] { get }

    Return Value

    all of the available keys in our dictionary.

  • id

    Declaration

    Swift

    public var id: Int { get }

    Return Value

    the Service body ID as an Int. If there is no ID, it returns 0 (Should never happen).

  • Declaration

    Swift

    public var name: String { get }

    Return Value

    the Service body name as a String. If there is no name, it returns blank.

  • Declaration

    Swift

    override public var description: String { get }

    Return Value

    the Service body description as a String. If there is no description, it returns the name.

  • Declaration

    Swift

    public var iCanAdminister: Bool { get }

    Return Value

    If we are logged in as an admin, and have administrator rights for this Service body, we get a true.

  • Declaration

    Swift

    public var iCanEdit: Bool { get }

    Return Value

    If we are logged in as an admin, and have edit rights for this Service body, we get a true.

  • Declaration

    Swift

    public var iCanObserve: Bool { get }

    Return Value

    If we are logged in as an admin, and have observer rights for this Service body, we get a true.

  • Declaration

    Swift

    public var permissions: BMLTiOSLibPermissions { get }

    Return Value

    If we are logged in as an admin, this will indicate the level of permission we have with this Service body.

  • Declaration

    Swift

    public var hasParent: Bool { get }

    Return Value

    true, if we have a parent.

  • Declaration

    Swift

    public var hasChildren: Bool { get }

    Return Value

    true, if we have children.

  • Declaration

    Swift

    public var completeChildCount: Int { get }

    Return Value

    the total number of children, including children of children, etc.

  • Declaration

    Swift

    public var howDeepInTheRabbitHoleAmI: Int { get }

    Return Value

    how many levels down we are. 0 is top-level (no parent).

Public Initializers.

  • Copy initializer.

    Declaration

    Swift

    public init(_ inObject: BMLTiOSLibHierarchicalServiceBodyNode)

    Parameters

    inObject

    This references an object we will adopt.

  • Default initializer. We must have at least the server comm.

    Declaration

    Swift

    public init(inServerComm: BMLTiOSLib)

    Parameters

    inServerComm

    This is a reference to the BMLTiOSLib instance that “owns” this.

  • Basic initializer with full data.

    Declaration

    Swift

    public init(inServerComm: BMLTiOSLib, parent: BMLTiOSLibHierarchicalServiceBodyNode!, serviceBody: [String : String]!, children: [BMLTiOSLibHierarchicalServiceBodyNode])

    Parameters

    inServerComm

    This is a reference to the BMLTiOSLib instance that “owns” this.

    parent

    any parent node in a hierarchy.

    serviceBody

    a Dictionary, containing the Service body information.

    chidren

    This is an Array of BMLTiOSLibHierarchicalServiceBodyNode objects, which are the children for this node.

Public Instance Methods.

  • This checks a given Service Body node, and sees if it is in the hierarchy.

    Declaration

    Swift

    public func isInHierarchy(_ inSBNode: BMLTiOSLibHierarchicalServiceBodyNode) -> Bool

    Parameters

    inSBNode

    this is the node to check.

    Return Value

    true, if the node is somewhere in our woodpile.

  • This checks a given Service Body node by its ID, and sees if it is in the hierarchy.

    Declaration

    Swift

    public func isSBIDInHierarchy(_ inID: Int) -> Bool

    Parameters

    inID

    the integer ID of the Service body to check.

    Return Value

    true, if the ID represents a Service body somewhere in our woodpile.