예제 #1
0
        public RedBlackTreeNode(BinaryTreeNode <K, V> parent, BinaryTreeNode <K, V> left,
                                BinaryTreeNode <K, V> right, K key, V value, NodeColor color = NodeColor.Red) :
            base(parent, left, right, key, value)

        {
            Color = color;
        }
예제 #2
0
 public TreeNode(T item)
 {
     Item      = item;
     Color     = NodeColor.Red;
     LeftNode  = new NullNode <T>(this);
     RightNode = new NullNode <T>(this);
 }
예제 #3
0
 private static void SetColor(TreeNode node, NodeColor color)
 {
     if (node != null)
     {
         node.IsRed = (color == NodeColor.RED);
     }
 }
예제 #4
0
 public RedBlackTreeNode()
 {
     Parent = Nil;
     Left   = Nil;
     Right  = Nil;
     Color  = NodeColor.Black;
 }
예제 #5
0
 public RedBlackTreeNode()
 {
     this.Parent = RedBlackTreeNode <TItem> .Nil;
     this.Left   = RedBlackTreeNode <TItem> .Nil;
     this.Right  = RedBlackTreeNode <TItem> .Nil;
     this.Color  = NodeColor.Black;
 }
예제 #6
0
 internal Node(K key, V value, int n, NodeColor color)
 {
     this.Key   = key;
     this.Value = value;
     this.N     = n;
     this.Color = color;
 }
예제 #7
0
    public void Init(int point, NodeColor nodeColor)
    {
        var text = GetComponent <TextMesh>();

        text.text = point.ToString();

        //移動
        transform.DOMoveY(moveDistance, moveDuration)
        .SetRelative()
        .SetEase(Ease.OutQuint);

        //色の初期化
        var color = TypeDataHolder.Instance[nodeColor.ToType()].PointTextColor;

        color.a    = 0;
        text.color = color;
        //フェードイン
        DOTween.To(
            () => text.color.a,
            a => text.color = new Color(text.color.r, text.color.g, text.color.b, a),
            1,
            fadeInDuration
            );
        //フェードアウト
        DOVirtual.DelayedCall(
            fadeOutDelay,
            () => DOTween.To(
                () => text.color.a,
                a => text.color = new Color(text.color.r, text.color.g, text.color.b, a),
                0,
                fadeOutDuration
                )
            .onComplete += () => Destroy(gameObject)
            );
    }
        internal void SwapColor(TextAnchorNode node1, TextAnchorNode node2)
        {
            NodeColor tmp = node1.Color;

            node1.Color = node2.Color;
            node2.Color = tmp;
        }
예제 #9
0
 public Node(TKey key, TValue val, Int32 count, NodeColor color)
 {
     this.Key   = key;
     this.Value = val;
     this.Count = count;
     this.Color = color;
 }
예제 #10
0
 public void Init_Node(int height, int width)
 {
     _my_height = height;
     _my_width  = width;
     id         = _my_height + " , " + _my_width;
     _my_color  = (NodeColor)Random.Range(0, GAMENODE_COLOR_COUNT);
 }
예제 #11
0
        private static void FixRedViolation(ref Node <TKey, TValue> parent, ref Node <TKey, TValue> child, uint dir)
        {
            // See if this is the top of the tree... if so then its black
            if (parent == null)
            {
                ((RedBlackNode <TKey, TValue>)child).Color = NodeColor.Black;
            }
            else
            {
                // Figure out which subtrees everything belongs to
                uint thisDir  = object.ReferenceEquals(parent.Left, child) ? LEFT : RIGHT;
                uint otherDir = Opposite(thisDir);

                // Get my sibling and his color
                RedBlackNode <TKey, TValue> sibling = (RedBlackNode <TKey, TValue>)parent[otherDir];
                NodeColor sibColor = (sibling != null) ? sibling.Color : NodeColor.Black;
                if (sibColor == NodeColor.Black)
                {
                    // Need to perform a rotation
                    if (thisDir == dir)
                    {
                        RotateOnce(ref parent, otherDir);
                    }
                    else
                    {
                        RotateTwice(ref parent, otherDir);
                    }
                }

                // Now color flip the parent
                ((RedBlackNode <TKey, TValue>)parent).FlipColor();
            }
        }
예제 #12
0
        internal void SwapColor(DocumentLineNode node1, DocumentLineNode node2)
        {
            NodeColor tmp = node1.Color;

            node1.Color = node2.Color;
            node2.Color = tmp;
        }
예제 #13
0
 /// <summary>
 /// Constructs an RBTNode with Data of a given type. Children default to null.
 /// </summary>
 /// <param name="data">Data of type TData held by this node.</param>
 /// <param name="leftChild">Left child of this Node.
 /// The left child should return 1 when compared to this node.</param>
 /// <param name="rightChild">Right child of this Node.
 /// The right child should return -1 when compared to this node</param>
 public RBTNode(TData data, RBTNode <TData> leftChild = null, RBTNode <TData> rightChild = null, NodeColor color = NodeColor.RED)
 {
     this.data       = data;
     this.leftChild  = leftChild;
     this.rightChild = rightChild;
     this.color      = color;
 }
예제 #14
0
 private static void setColor(Node n, NodeColor c)
 {
     if (n != null)
     {
         n.color = c;
     }
 }
예제 #15
0
 internal RedBlackTreeNode(TKey key, TValue value)
 {
     thisKey      = key;
     thisValue    = value;
     thisColor    = NodeColor.Red;
     leftSubtree  = null;
     rightSubtree = null;
 }
예제 #16
0
 protected Node()
 {
     key    = int.MinValue;
     color  = NodeColor.Black;
     parent = null;
     left   = null;
     right  = null;
 }
 public Tree(int val, Tree parent)
 {
     value  = val;
     Left   = null;
     Right  = null;
     Parent = parent;
     Color  = NodeColor.Red;
 }
예제 #18
0
 public Node(T v, NodeColor c, Node <T> p = null, Node <T> lc = null, Node <T> rc = null)
 {
     Value      = v;
     Color      = c;
     Parent     = p;
     LeftChild  = lc;
     RightChild = rc;
 }
예제 #19
0
 public RBTreeNode(T key, NodeColor color, RBTreeNode <T> parent, RBTreeNode <T> leftNode, RBTreeNode <T> rightNode)
 {
     this.Key       = key;
     this.Color     = color;
     this.Parent    = parent;
     this.LeftNode  = leftNode;
     this.RightNode = rightNode;
 }
예제 #20
0
        //TODO: review later, probaly delete
        //public List<PathNode> MountTreeByType(List<PathNode> pnCollection)
        //{
        //    List<PathNode> tree = new List<PathNode>();

        //    List<PathNode> roots = pnCollection.Where(pn => pn.Parent_Id == Guid.Empty).ToList();

        //    tree.AddRange(roots);

        //    foreach (PathNode root in roots)
        //    {
        //        foreach (PathNode child in pnCollection.Where(pn => pn.Parent_Id == root.Id).ToList())
        //        {
        //            if (tree.Any(pn => pn.Type == child.Type))
        //                continue;

        //            tree.Add(child);

        //            PathNode parent = tree
        //        }
        //    }
        //}

        public List <ElementModel.Element> GetTaskVisualization(string id)
        {
            ElementModel      model        = new ElementModel();
            List <PathNode>   pnCollection = new List <PathNode>();
            List <Breakpoint> bCollection  = new List <Breakpoint>();

            using (SwarmData context = new SwarmData())
            {
                var    sessionFilter = context.Sessions.Where(s => s.Id.ToString() == id).Select(s => new { TaskName = s.TaskName, ProjectName = s.ProjectName }).FirstOrDefault();
                Guid[] sessionIds    = context.Sessions.Where(s => s.TaskName == sessionFilter.TaskName && s.ProjectName == sessionFilter.ProjectName).Select(s => s.Id).ToArray();

                pnCollection = context.PathNodes.Where(pn => sessionIds.Contains(pn.Session.Id)).GroupBy(pn => pn.Type).Select(pn => pn.FirstOrDefault()).OrderBy(pn => pn.Created).ToList();
                bCollection  = context.Breakpoints.Where(b => sessionIds.Contains(b.Session.Id)).GroupBy(b => new { b.Namespace, b.Type, b.LineNumber }).Select(b => b.FirstOrDefault()).ToList();
            }

            NodeColor nodeColor = new NodeColor(bCollection);

            //load nodes
            foreach (PathNode pn in pnCollection)
            {
                model.ElementCollection.Add(new ElementModel.Element()
                {
                    data = new ElementModel.Data()
                    {
                        id        = pn.Id.ToString(),
                        parent_id = model.ElementCollection.Count() == 0 ? null : model.ElementCollection.Last().data.id,
                        method    = pn.Type + " - " + bCollection.Where(b => b.Type == pn.Type).Count().ToString(),
                        size      = bCollection.Where(b => b.Type == pn.Type).Count() + 10,
                        color     = nodeColor.GetColor(pn.Type)
                    }
                });
            }

            //load edges
            List <ElementModel.Element> edgesCollection = new List <ElementModel.Element>();

            foreach (ElementModel.Element element in model.ElementCollection)
            {
                if (String.IsNullOrWhiteSpace(element.data.parent_id))
                {
                    continue;
                }

                edgesCollection.Add(new ElementModel.Element()
                {
                    data = new ElementModel.Data()
                    {
                        id     = element.data.id + "-" + element.data.id,
                        source = element.data.parent_id,
                        target = element.data.id
                    }
                });
            }

            model.ElementCollection.AddRange(edgesCollection);

            return(model.ElementCollection);
        }
예제 #21
0
 public Node(int _key, T _data, NodeColor _color = NodeColor.Red, Node <T> _parent = null)
 {
     key    = _key;
     data   = _data;
     color  = _color;
     parent = _parent;
     left   = null;
     right  = null;
 }
예제 #22
0
 public Class1157(Class1157 A_0, Class1157 A_1, Class1157 A_2, object A_3, object A_4, NodeColor A_5)
 {
     this.class1157_0 = A_0;
     this.class1157_2 = A_1;
     this.class1157_1 = A_2;
     this.object_0    = A_3;
     this.object_1    = A_4;
     this.nodeColor_0 = A_5;
 }
예제 #23
0
 /// <summary>
 /// CTor for node.
 /// </summary>
 /// <param name="key">Key</param>
 /// <param name="value">Value</param>
 /// <param name="rightNode">Right node.</param>
 /// <param name="leftNode">Left node.</param>
 public RedBlackNode(TKey key, TValue value, RedBlackNode rightNode, RedBlackNode leftNode)
 {
     this.nodeKey    = key;
     this.nodeValue  = value;
     this.rightNode  = rightNode;
     this.leftNode   = leftNode;
     this.parentNode = null;
     this.color      = NodeColor.RED;
 }
예제 #24
0
 public Node(GameObject roomObject, int roomNumber, string roomColor)
 {
     this.roomObject = roomObject;
     this.roomNumber = roomNumber;
     this.roomColor  = roomColor;
     this.distance   = 0;
     this.color      = NodeColor.White;
     adjacentRooms   = new List <Node>();
 }
        public static void Node(Rect position, NodeShape shape, NodeColor color, bool selected)
        {
            if (e.type == EventType.Repaint)
            {
                var outerPosition = GetNodeEdgeToOuterPosition(position, shape);

                GetNodeStyle(shape, color).Draw(FixNodePosition(outerPosition, shape, color, selected), false, false, false, selected);
            }
        }
예제 #26
0
        public RBNodeBase <TKey> SingleRotation(bool direction)
        {
            RBNodeBase <TKey> base2 = this[!direction];

            this[!direction] = base2[direction];
            base2[direction] = (RBNodeBase <TKey>) this;
            this.Color       = NodeColor.Red;
            base2.Color      = NodeColor.Black;
            return(base2);
        }
예제 #27
0
 /// <summary>
 /// Creates new instance of red-black tree node
 /// </summary>
 /// <param name="key"> Key of node.</param>
 /// <param name="value"> Value of node.</param>
 /// <param name="color"> Color of node.</param>
 /// <param name="parent"> Parent of node.</param>
 /// <param name="left"> Left child of node.</param>
 /// <param name="right"> Right child of node.</param>
 public NodeRB(TKey key, TValue value, NodeColor color = NodeColor.Black,
               NodeRB <TKey, TValue> parent            = null, NodeRB <TKey, TValue> left = null, NodeRB <TKey, TValue> right = null)
 {
     this.Key    = key;
     this.Value  = value;
     this.Color  = color;
     this.Left   = left;
     this.Right  = right;
     this.Parent = parent;
 }
예제 #28
0
        public RedBlackNode(T key, NodeColor color)
        {
            this.Color = color;

            this.Key = key;

            this.LeftChild = nilNode;

            this.RigthChild = nilNode;
        }
        private static Rect FixNodePosition(Rect position, NodeShape shape, NodeColor color, bool selected)
        {
            // Some background images have weird offsets
            // Fix it on a case-by-case basis

            var offset = Vector2.zero;

            position.position += offset;

            return(position);
        }
예제 #30
0
 private static void SetColor(TreeNode node, NodeColor color)
 {
     if (node != null)
     {
         node.IsRed = (color == NodeColor.RED);
     }
     else
     {
         Debug.Assert(color == NodeColor.BLACK);
     }
 }
 //***************************************************************************
 // Class Constructors
 // 
 protected internal CDFDirectoryStream(int dId, string dirName, byte[] uniqueId, DateTime created, DateTime modified, StreamType type, NodeColor clr, int strmSid, int leftChild, int rightChild, int rootNode, long strmSize)
 {
     this.dId = dId;
     this.dirName = dirName;
     this.uniqueId = uniqueId;
     this.created = created;
     this.modified = modified;
     this.created = created;
     this.modified = modified;
     this.dirType = type;
     this.dirColor = clr;
     this.leftChild = leftChild;
     this.rightChild = rightChild;
     this.rootNode = rootNode;
     this.streamSid = strmSid;
     this.streamSize = strmSize;
 }
        public object GetNodeHeaderStyle(NodeColor color)
        {
            switch (color)
            {
                case NodeColor.DarkGray:
                    return ElementDesignerStyles.NodeHeader1;
                case NodeColor.Blue:
                    return ElementDesignerStyles.NodeHeader2;
                case NodeColor.Gray:
                    return ElementDesignerStyles.NodeHeader3;
                case NodeColor.LightGray:
                    return ElementDesignerStyles.NodeHeader4;
                case NodeColor.Black:
                    return ElementDesignerStyles.NodeHeader5;
                case NodeColor.DarkDarkGray:
                    return ElementDesignerStyles.NodeHeader6;
                case NodeColor.Orange:
                    return ElementDesignerStyles.NodeHeader7;
                case NodeColor.Red:
                    return ElementDesignerStyles.NodeHeader8;
                case NodeColor.YellowGreen:
                    return ElementDesignerStyles.NodeHeader9;
                case NodeColor.Green:
                    return ElementDesignerStyles.NodeHeader10;
                case NodeColor.Purple:
                    return ElementDesignerStyles.NodeHeader11;
                case NodeColor.Pink:
                    return ElementDesignerStyles.NodeHeader12;
                case NodeColor.Yellow:
                    return ElementDesignerStyles.NodeHeader13;

            }
            return ElementDesignerStyles.NodeHeader1;
        }
예제 #33
0
 private static void setColor(Node n, NodeColor c)
 {
     if (n != null)
         n.color = c;
 }
예제 #34
0
 public virtual INodeStyleSchema WithHeaderColor(NodeColor color)
 {
     HeaderColor = color;
     return this;
 }
예제 #35
0
 public NodeFlag(string name, NodeColor color)
 {
     Color = color;
     Name = name;
 }
예제 #36
0
        public static Color GetColor(NodeColor color)
        {
            switch (color)
            {
                case NodeColor.Gray:
                    return new Color32(104, 105, 109, 255);
                case NodeColor.DarkGray:
                    return new Color32(56, 56, 57, 255);
                case NodeColor.Blue:
                    return new Color32(115, 110, 180, 255);
                case NodeColor.LightGray:
                    return new Color32(87, 101, 108, 255);
                case NodeColor.Black:
                    return new Color32(50, 50, 50, 255);
                case NodeColor.DarkDarkGray:
                    return new Color32(51, 56, 58, 255);
                case NodeColor.Orange:
                    return new Color32(235, 126, 21, 255);
                case NodeColor.Red:
                    return new Color32(234, 20, 20, 255);
                case NodeColor.Yellow:
                    return new Color32(134, 134, 18, 255);
                case NodeColor.Green:
                    return new Color32(25, 99, 9, 255);
                case NodeColor.Purple:
                    return new Color32(58, 70, 94, 255);
                case NodeColor.Pink:
                    return new Color32(79, 44, 115, 255);
                case NodeColor.YellowGreen:
                    return new Color32(197, 191, 25, 255);
                case NodeColor.Palevioletred:
                    return new Color32(219,112,147,255);
                case NodeColor.Palevioletred4:
                    return new Color32(139,71,93,255);
                case NodeColor.Violetred2:
                    return new Color32(238,58,140,255);
                case NodeColor.Violetred4:
                    return new Color32(139,71,93,255);
                case NodeColor.Mediumorchid2:
                    return new Color32(209,95,238,255);
                case NodeColor.Mediumorchid4:
                    return new Color32(122,55,139,255);
                case NodeColor.Mediumpurple2:
                    return new Color32(159,121,238,255);
                case NodeColor.Stateblue2:
                    return new Color32(106,90,205,255);
                case NodeColor.Royalblue2:
                    return new Color32(67,110,238,255);         
                case NodeColor.Royalblue4:
                    return new Color32(39,64,139,255);
                case NodeColor.Lightsteelblue3:
                    return new Color32(162,181,205,255);
                case NodeColor.Lightskyblue2:
                    return new Color32(164,211,238,255);
                case NodeColor.Azure3:
                    return new Color32(193,205,205,255);       
                case NodeColor.Azure4:
                    return new Color32(131, 139, 139, 255);
                case NodeColor.Manganeseblue:
                    return new Color32(3, 168, 158, 255);
                case NodeColor.Aquamarine3:
                    return new Color32(102, 205, 170, 255);
                case NodeColor.Seagreen2:
                    return new Color32(78, 238, 148, 255);
                case NodeColor.Seagreen4:
                    return new Color32(46,139,87,255);
                case NodeColor.Darkolivegreen3:
                    return new Color32(162,205,90,255);
                case NodeColor.Darkolivegreen4:
                    return new Color32(110,139,61,255);
                case NodeColor.Olivedrab:
                    return new Color32(107,142,35,255);
                case NodeColor.Lightgoldenrod3:
                    return new Color32(205,190,112,255);
                case NodeColor.Lightgoldenrod4:
                    return new Color32(139,129,76,255);
                case NodeColor.Gold3:
                    return new Color32(205,173,0,255);
                case NodeColor.Tan:
                    return new Color32(210,180,140,255);
                case NodeColor.Carrot:
                    return new Color32(237,145,33,255);
                case NodeColor.Sienna2:
                    return new Color32(238,121,66,255);
                case NodeColor.Salmon2:
                    return new Color32(238,130,98,255);
                case NodeColor.Indianred2:
                    return new Color32(238,99,99,255);
                case NodeColor.Indianred4:
                    return new Color32(139,58,58,255);
                case NodeColor.SgiTeal:
                    return new Color32(56,142,142,255);
                case NodeColor.SgiDarkgrey:
                    return new Color32(85,85,85,255);
                case NodeColor.SgiLightBlue:
                    return new Color32(125,158,192,255);
                case NodeColor.SgiChartReuse:
                    return new Color32(113,198,113,255);
                case NodeColor.SgiBeet:
                    return new Color32(142,56,142,255);
                case NodeColor.SgiSlateBlue:
                    return new Color32(113,113,198,255);
                case NodeColor.SgiBrightGrey:
                    return new Color32(197,193,170,255);


                default:
                    return default(Color);
                    break;

            }
        }
예제 #37
0
 /*
 internal void SetNodeStyle(TreeNode node, Boolean selected)
 {
     SetNodeImageKey(node);
     SetNodeColor(node, (selected) ? NodeColor.Selected : NodeColor.Default);
 }
 */
 internal void SetNodeColor(TreeNode tn, NodeColor color)
 {
     switch (color)
     {
         case NodeColor.Default:
             tn.ForeColor = GetNodeForeColor((OutlinerNode)tn.Tag);
             tn.BackColor = GetNodeBackColor((OutlinerNode)tn.Tag);
             break;
         case NodeColor.Selected:
             tn.ForeColor = this.SelectionForeColor;
             tn.BackColor = this.SelectionBackColor;
             break;
         case NodeColor.ParentOfSelected:
             if (tn.Tag is OutlinerObject)
             {
                 tn.ForeColor = this.ParentForeColor;
                 tn.BackColor = this.ParentBackColor;
             }
             else if (tn.Tag is OutlinerLayer)
             {
                 tn.ForeColor = this.LayerForeColor;
                 tn.BackColor = this.LayerBackColor;
             }
             else
             {
                 tn.ForeColor = GetNodeForeColor((OutlinerNode)tn.Tag);
                 tn.BackColor = GetNodeBackColor((OutlinerNode)tn.Tag);
             }
             break;
         case NodeColor.LinkTarget:
             tn.ForeColor = this.LinkForeColor;
             tn.BackColor = this.LinkBackColor;
             break;
     }
 }
예제 #38
0
	public Node(GameObject roomObject, int roomNumber, string roomColor) {
		this.roomObject = roomObject;
		this.roomNumber = roomNumber;
		this.roomColor = roomColor;
		this.distance = 0;
		this.color = NodeColor.White;
		adjacentRooms = new List<Node>();
    }