/// <summary> /// Constructor /// </summary> public Node(NodeTypeName nodeType) { NodeType = nodeType; if (NodeType == NodeTypeName.Other) { Console.WriteLine("Found other"); } Id = System.Threading.Interlocked.Increment(ref IDNum); NodeName = string.Empty; }
private uint AllocateNextNodeIndex(NodeTypeName nodeType) { int typeIndex = (byte)nodeType; if (rgnid[typeIndex] < NodeID.MaximumNidIndex) { rgnid[typeIndex]++; } else { throw new Exception("Could not allocate nidIndex"); } return(rgnid[typeIndex]); }
/// <summary> /// Constructor /// </summary> /// <param name="nodeType"></param> /// <param name="groupedNodes"></param> /// <param name="globalIDTracker"></param> public Group(NodeTypeName nodeType, NodeChildren <Node> groupedNodes, GlobalIDContainer globalIDTracker) : base(nodeType) { // Copies inputted nodes to be grouped into a list // Copies the grouped nodes' children as the groups children. // In this case since they should be identical we just grab the first member var tempNode = new NodeChildren <Node>(groupedNodes); nodeGroup = new NodeChildren <Node>(groupedNodes); Children = new NodeChildren <Node>(groupedNodes[0].Children); mNodeNameList = new List <string>(); var nodeNameGlobalIDs = new List <int>(); foreach (var item in groupedNodes) { mNodeNameList.Add(item.NodeName); var globalID = globalIDTracker.GetGlobalID(item.NodeName); nodeNameGlobalIDs.Add(globalID); } NodeName = string.Join(LIST_SEP_CHAR.ToString(), nodeNameGlobalIDs); var toRemove = tempNode.Count; foreach (var child in Children) { for (var i = 0; i < toRemove; i++) { child.Children.Remove(tempNode[i]); } } foreach (var child in Children) { child.Children.Add(this); } }
public override int GetHashCode() { int nameHash = NodeTypeName == null ? 0 : NodeTypeName.GetHashCode(); return(NodeID ^ nameHash); }
/// <summary> /// Constructor /// </summary> /// <param name="nodeType"></param> /// <param name="nodeName"></param> public Group(NodeTypeName nodeType, string nodeName) : base(nodeType, nodeName) { }
public NodeID(NodeTypeName nidType, uint nidIndex) { m_nodeID = (byte)((byte)nidType & 0x1F); m_nodeID |= (nidIndex << 5); }
} // afterDeleteNode() protected override void afterPopulateProps() { NodeTypeName.SetOnPropChange(_NodeTypeName_Change); NameTemplateAdd.SetOnPropChange(_NameTemplateAdd_Change); ObjectClassProperty.SetOnPropChange(_ObjectClassProperty_Change); // Prevent renaming "Design" nodetypes if (null != RelationalNodeType && null != RelationalNodeType.getObjectClass() && (RelationalNodeType.getObjectClass().ObjectClass == CswEnumNbtObjectClass.DesignNodeTypeClass || RelationalNodeType.getObjectClass().ObjectClass == CswEnumNbtObjectClass.DesignNodeTypeTabClass || RelationalNodeType.getObjectClass().ObjectClass == CswEnumNbtObjectClass.DesignNodeTypePropClass || RelationalNodeType.getObjectClass().ObjectClass == CswEnumNbtObjectClass.DesignSequenceClass)) { NodeTypeName.setReadOnly(true, true); } // Options for 'Object Class' property SortedList <string, CswNbtNodeTypePropListOption> ObjectClassOptions = new SortedList <string, CswNbtNodeTypePropListOption>(); Dictionary <Int32, CswEnumNbtObjectClass> ObjectClassIds = _CswNbtResources.MetaData.getObjectClassIds(); foreach (Int32 ObjectClassId in ObjectClassIds.Keys) { string thisObjectClassName = ObjectClassIds[ObjectClassId]; ObjectClassOptions.Add(thisObjectClassName, new CswNbtNodeTypePropListOption(thisObjectClassName, ObjectClassId.ToString())); } Collection <CswNbtNodeTypePropListOption> SortedOptions = new Collection <CswNbtNodeTypePropListOption>(ObjectClassOptions.Values.ToList()); ObjectClassProperty.Options.Override(SortedOptions); // Only allowed to edit Object Class on Add, or convert Generics if (_CswNbtResources.EditMode != CswEnumNbtNodeEditMode.Add && CswEnumNbtObjectClass.GenericClass != ObjectClassProperty.Value) { ObjectClassProperty.ServerManaged = true; } else { ObjectClassProperty.ServerManaged = false; } // Options for 'Icon File Name' property Dictionary <string, string> IconOptions = new Dictionary <string, string>(); if (null != HttpContext.Current) { DirectoryInfo d = new DirectoryInfo(HttpContext.Current.Request.PhysicalApplicationPath + CswNbtMetaDataObjectClass.IconPrefix16); FileInfo[] IconFiles = d.GetFiles(); foreach (FileInfo IconFile in IconFiles) { IconOptions.Add(IconFile.Name, IconFile.Name); } IconFileName.ImagePrefix = CswNbtMetaDataObjectClass.IconPrefix16; IconFileName.Options = IconOptions; } // Options for 'DeferSearchTo' - all my Relationships or Locations CswNbtMetaDataObjectClass NodeTypePropOC = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.DesignNodeTypePropClass); CswNbtMetaDataObjectClassProp NTPNodeTypeOCP = NodeTypePropOC.getObjectClassProp(CswNbtObjClassDesignNodeTypeProp.PropertyName.NodeTypeValue); CswNbtMetaDataObjectClassProp NTPFieldTypeOCP = NodeTypePropOC.getObjectClassProp(CswNbtObjClassDesignNodeTypeProp.PropertyName.FieldType); CswNbtView DeferView = new CswNbtView(_CswNbtResources); DeferView.ViewName = "Defer Search To Options"; // my nodetype (me) CswNbtViewRelationship DeferViewRel1 = DeferView.AddViewRelationship(this.ObjectClass, false); DeferViewRel1.NodeIdsToFilterIn.Add(this.NodeId); // and all my properties CswNbtViewRelationship DeferViewRel2 = DeferView.AddViewRelationship(DeferViewRel1, CswEnumNbtViewPropOwnerType.Second, NTPNodeTypeOCP, false); // ... that are relationships DeferView.AddViewPropertyAndFilter(DeferViewRel2, NTPFieldTypeOCP, Conjunction: CswEnumNbtFilterConjunction.And, SubFieldName: CswNbtFieldTypeRuleList.SubFieldName.Value, FilterMode: CswEnumNbtFilterMode.Equals, Value: _CswNbtResources.MetaData.getFieldType(CswEnumNbtFieldType.Relationship).FieldTypeId.ToString()); // ... or locations DeferView.AddViewPropertyAndFilter(DeferViewRel2, NTPFieldTypeOCP, Conjunction: CswEnumNbtFilterConjunction.Or, FilterMode: CswEnumNbtFilterMode.Equals, SubFieldName: CswNbtFieldTypeRuleList.SubFieldName.Value, Value: _CswNbtResources.MetaData.getFieldType(CswEnumNbtFieldType.Location).FieldTypeId.ToString()); DeferSearchTo.OverrideView(DeferView); } //afterPopulateProps()
/// <summary> /// Constructor /// </summary> public Node(NodeTypeName nodeType, string nodeName) : this(nodeType) { NodeName = nodeName; Children = new NodeChildren <Node>(); }
public NodeID AllocateNextNodeID(NodeTypeName nodeType) { uint nodeIndex = AllocateNextNodeIndex(nodeType); return(new NodeID(nodeType, nodeIndex)); }