hierarchy

Hierarchy from Flat Data

試著忘記壹切 提交于 2019-11-30 16:27:56
问题 I have an employee class that has an employeeId (int), parent(int) and children property List<Employee> . I get the employee list from the database in the correct order and now need to build the hierarchy , but I am failing miserably...I know this is programming 101, but I am having a hard time with it. public class Employee { public int EmployeeId { get; set;} public int ParentId;{ get; set;} public List<Employee> Children; { get; set;} } Data Example EmployeeId, ManagerId 1, 0 //no one 2, 1

Move separator elements upwards in xml hierarchy

白昼怎懂夜的黑 提交于 2019-11-30 16:00:20
问题 I have an xml document with separators deep down in the hierarchy. <A> <B> <C id='1'/> <separator/> <C id='2'/> </B> <B> <C id='3'/> <separator/> </B> <B> <C id='4'/> </B> </A> I want to move the separators upwards, keeping elements in order. So the desired output is <A> <B> <C id='1'/> </B> </A> <separator/> <A> <B> <C id='2'/> </B> <B> <C id='3'/> </B> </A> <separator/> <A> <B> <C id='4'/> </B> </A> How can it be done using xslt 1.0 only? Can it be done without for-each , using template

How to retrieve hierarchical data from a SQL Table?

最后都变了- 提交于 2019-11-30 15:50:31
问题 I have got the below stored procedure to return the list of Id, parentId and absoluteUrls which works fine: ALTER PROCEDURE [dbo].[SearchDataManager.HierarchyById] @currentId AS int AS BEGIN DECLARE @id INT DECLARE @parentId INT DECLARE @absoluteUrl NVARCHAR(1000) DECLARE @Hierarchy TABLE (Id int, ParentId int, AbsoluteUrl nvarchar(1000)) WHILE @currentId != 0 BEGIN SELECT @id = Id, @parentId = ParentId, @absoluteUrl = AbsoluteUrl FROM dbo.[SearchDataManager.NiceUrls] WHERE id = @currentId

Move separator elements upwards in xml hierarchy

回眸只為那壹抹淺笑 提交于 2019-11-30 15:50:16
I have an xml document with separators deep down in the hierarchy. <A> <B> <C id='1'/> <separator/> <C id='2'/> </B> <B> <C id='3'/> <separator/> </B> <B> <C id='4'/> </B> </A> I want to move the separators upwards, keeping elements in order. So the desired output is <A> <B> <C id='1'/> </B> </A> <separator/> <A> <B> <C id='2'/> </B> <B> <C id='3'/> </B> </A> <separator/> <A> <B> <C id='4'/> </B> </A> How can it be done using xslt 1.0 only? Can it be done without for-each , using template match only? UPDATE: I actually got 4 brilliant answers of different levels of generality, thank you, guys.

How to build an hierarchy tree of categories in java using enums or any other way?

喜夏-厌秋 提交于 2019-11-30 15:45:48
Assuming that we have a set of categories: categories={A,B}. Let's assume more that A consists of subcategories: {A1,A2,A3} and B consists of subcategories: {B1,B2}.In addition, there are even more subcategories as follows: for A1:{A1a,A1b}, for A2:{A2a,A2b}, for A3:{A3a,A3b,A3c}, for B1:{B1a,B1b,B1c}, for B2:{B2a,B2b}. How can I build an hierarchical structure in java? Since the cardinality of each set is fixed and known in advance, my initial approach is to use enum types instead of building classes with inheritance, but I am open to any suggestion. I do not know how to approach this problem

Rounded Corners in Parent DIV not effecting Child DIVs

不问归期 提交于 2019-11-30 13:17:22
So, I'm experimenting with using rounded-corners in CSS3 (not in IE, don't care if it works there), and I have the DIV where all of my content lives looking quite nice. The problem I'm having is that there are child DIVs that are not getting "masked" by the parent's rounded corners. I'm not looking for the child to inherit the rounded-corners. I just want to have any content inside the parent to not be visible where it is rounded, as if it were masked. I tried using "overflow: hidden;", but that doesn't seem to do the trick. Does anyone have any ideas how the children of the rounded-cornered

Java inheritance vs. C# inheritance

会有一股神秘感。 提交于 2019-11-30 11:49:28
Let's say Java has these hierarchical classes: class A { } class B extends A { public void m() { System.out.println("B\n"); } } class C extends B { public void m() { System.out.println("C\n"); } } class D extends C { public static void main(String[] args) { A a = new D(); // a.m(); // doesn't work B b = new D(); b.m(); C c = new D(); c.m(); D d = new D(); d.m(); } } This is the (blind) duplication of the same code in C#: using System; class A { } class B : A { public void M() { Console.WriteLine("B"); } } class C : B { public void M() // I need to use public new void M() to avoid the warning {

How should a REST URL schema look like for a tree hierarchy?

空扰寡人 提交于 2019-11-30 10:59:35
问题 Let's assume that I have stores, shelves in a store, and products on a shelf. So in order to get a list of products on a shelf in a store, I'd use the following request: GET http://server/stores/123/shelves/456/products From here, how would I get an individual product? Should I use: GET http://server/products/789 Or: GET http://server/stores/123/shelves/456/products/789 The first method is more concise, since once you get a list of products, you don't really care which store it belongs to if

C# algorithm for generating hierarchy

ぃ、小莉子 提交于 2019-11-30 10:22:44
问题 I've got a text file that looks like this: { Id = 1, ParentId = 0, Position = 0, Title = "root" } { Id = 2, ParentId = 1, Position = 0, Title = "child 1" } { Id = 3, ParentId = 1, Position = 1, Title = "child 2" } { Id = 4, ParentId = 1, Position = 2, Title = "child 3" } { Id = 5, ParentId = 4, Position = 0, Title = "grandchild 1" } I'm looking for a generic C# algorithm that will create an object hierarchy from this. A "Hierarchize" function, if you will, that turns this data into an object

Smooth transitioning between tree, cluster, radial tree, and radial cluster layouts

浪子不回头ぞ 提交于 2019-11-30 10:16:18
问题 For a project, I need to interactively change hierarchical data layout of a visualization - without any change of the underlying data whatsoever. The layouts capable of switching between themselves should be tree, cluster, radial tree, and radial cluster. And transitioning should be preferably an animation. I thought that would be relatively easy task with D3 . I started, but I got lost in translations and rotations, data bindings, and similar, so I am asking you for help. Also, probably I am