def __init__(self, al_branchNodes): ''' Constructor. If instantiated with a list of nodes, will create/populate internal dictionary with appropriate C_snodes. ''' self.str_obj = 'C_snodeBranch' # name of object class self.str_name = 'void' # name of object variable self._id = -1 # id of agent self._iter = 0 # current iteration in an # arbitrary processing # scheme self._verbosity = 0 # debug related value for # object self._warnings = 0 # show warnings self.dict_branch = {} self.sCore = C_stringCore() element = al_branchNodes[0] if isinstance(element, C_snode): for node in al_branchNodes: self.dict_branch[node] = node else: for node in al_branchNodes: self.dict_branch[node] = C_snode(node)
def __init__(self, al_mustInclude=[], al_mustNotInclude=[]): self._hitCount = 0 self.l_canInclude = [] self.l_mustInclude = al_mustInclude self.l_mustNotInclude = al_mustNotInclude self.b_printPre = False self.sCore = C_stringCore() self._depth = 0 self.str_pre = ' '
def __init__(self, astr_nodeName = "", al_mustInclude = [], al_mustNotInclude = [], ): self.core_construct() self.m_str = C_stringCore() self.mstr_nodeName = astr_nodeName self.ml_mustInclude = al_mustInclude self.ml_mustNotInclude = al_mustNotInclude self.mdict_contents = {}
def __init__(self, astr_nodeName="", al_mustInclude=[], al_mustNotInclude=[]): # - Core variables self.str_obj = 'C_snode' # name of object class self.str_name = 'void' # name of object variable self._id = -1 # id of agent self._iter = 0 # current iteration in an # arbitrary processing # scheme self._verbosity = 0 # debug related value for # object self._warnings = 0 # show warnings self.sCore = C_stringCore() # The d_nodes is the basic building block of the C_snode container #+ class. It is simply a dictionary that contains 'nodes' that #+ satisfy a given feature set described by 'mustInclude' and #+ 'mustNotInclude'. #+ #+ In general: #+ 'snode_parent' : the parent node of this node -- useful #+ for tree structuring. #+ '_hitCount' : count of hits for all items branching #+ at this level. At the leaf level, this #+ contains the length of 'contents'. #+ 'l_mustInclude' : descriptive trait for specific feature #+ level #+ 'l_mustNotInclude' : exclusion trait for specific feature #+ level #+ 'd_nodes' : dictionary of child nodes branching #+ from this node #+ 'd_data' : a dictionary of data for *this* node #+ #+ The pattern of 'mustInclude' and 'mustNotInclude' uniquely #+ characterizes a particular level. "Deeper" features (i.e. features #+ further along the dictionary tree) must satisfy the combined set #+ described by all the 'mustInclude' and 'mustNotInclude' traits of #+ each higher level. self.meta = C_meta() self.snode_parent = None self.d_nodes = {} self.d_data = {} self.b_printMetaData = True self.b_printContents = True self.b_printPre = False self.str_nodeName = astr_nodeName self.b_printPre = False
def __init__(self, al_branchNodes): self.core_construct() self.m_str = C_stringCore() self.mdict_branch = {} element = al_branchNodes[0] if isinstance(element, C_snode): for node in al_branchNodes: self.mdict_branch[node] = node else: for node in al_branchNodes: self.mdict_branch[node] = C_snode(node)
def __init__(self, al_rootBranch=[]): """ Creates a tree structure and populates the "root" branch. """ # # Member variables # # - Core variables self.str_obj = 'C_stree' # name of object class self.str_name = 'void' # name of object variable self._id = -1 # id of agent self._iter = 0 # current iteration in an # arbitrary processing # scheme self._verbosity = 0 # debug related value for # object self._warnings = 0 # show warnings self.b_printMetaData = False self.l_allPaths = [] # Each time a new C_snode is #+ added to the tree, its path #+ list is appended to this #+ list variable. if not len(al_rootBranch): al_rootBranch = ['/'] if len(al_rootBranch): if not isinstance(al_rootBranch, list): al_rootBranch = ['/'] self.sCore = C_stringCore() str_treeRoot = '/' self.l_cwd = [str_treeRoot] self.sbranch_root = C_snodeBranch([str_treeRoot]) self.snode_current = None self.snode_root = self.sbranch_root.dict_branch[str_treeRoot] self.snode_root.depth(0) self.snode_root.snode_parent = self.snode_root self.root() self.l_allPaths = self.l_cwd[:] if len(al_rootBranch) and al_rootBranch != ['/']: self.mknode(al_rootBranch)
def __init__(self, al_rootBranch=[]): """ Creates a tree structure and populates the "root" branch. """ if not len(al_rootBranch): al_rootBranch = ['/'] if len(al_rootBranch): if not isinstance(al_rootBranch, list): al_rootBranch = ['/'] self.core_construct() self.m_str = C_stringCore() str_treeRoot = '/' self.ml_cwd = [str_treeRoot] self.msbranch_root = C_snodeBranch([str_treeRoot]) self.msnode_root = self.msbranch_root.mdict_branch[str_treeRoot] self.msnode_root.msnode_parent = self.msnode_root self.root() self.ml_allPaths = self.ml_cwd[:] if len(al_rootBranch) and al_rootBranch != ['/']: self.mknode(al_rootBranch)