<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Generic (n-ary) Tree in Java</title>
	<atom:link href="http://vivin.net/2010/01/30/generic-n-ary-tree-in-java/feed/" rel="self" type="application/rss+xml" />
	<link>http://vivin.net/2010/01/30/generic-n-ary-tree-in-java/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rss</link>
	<description>random musings of just another computer nerd</description>
	<lastBuildDate>Sun, 05 Feb 2012 22:22:26 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Manoj Rajan</title>
		<link>http://vivin.net/2010/01/30/generic-n-ary-tree-in-java/comment-page-1/#comment-28821</link>
		<dc:creator>Manoj Rajan</dc:creator>
		<pubDate>Mon, 09 Jan 2012 11:54:24 +0000</pubDate>
		<guid isPermaLink="false">http://vivin.net/?p=1395#comment-28821</guid>
		<description>Thanks, vivin.

It was helpful. Implementation was easy and understandable much faster.</description>
		<content:encoded><![CDATA[<p>Thanks, vivin.</p>
<p>It was helpful. Implementation was easy and understandable much faster.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vivin</title>
		<link>http://vivin.net/2010/01/30/generic-n-ary-tree-in-java/comment-page-1/#comment-25766</link>
		<dc:creator>vivin</dc:creator>
		<pubDate>Sun, 11 Dec 2011 19:42:05 +0000</pubDate>
		<guid isPermaLink="false">http://vivin.net/?p=1395#comment-25766</guid>
		<description>&lt;a href=&quot;http://vivin.net/2010/01/30/generic-n-ary-tree-in-java/comment-page-1/#comment-25730&quot; rel=&quot;nofollow&quot;&gt;@John Vorwald&lt;/a&gt;: Thanks!</description>
		<content:encoded><![CDATA[<p><a href="http://vivin.net/2010/01/30/generic-n-ary-tree-in-java/comment-page-1/#comment-25730" rel="nofollow">@John Vorwald</a>: Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vivin</title>
		<link>http://vivin.net/2010/01/30/generic-n-ary-tree-in-java/comment-page-1/#comment-25765</link>
		<dc:creator>vivin</dc:creator>
		<pubDate>Sun, 11 Dec 2011 19:40:57 +0000</pubDate>
		<guid isPermaLink="false">http://vivin.net/?p=1395#comment-25765</guid>
		<description>&lt;a href=&quot;http://vivin.net/2010/01/30/generic-n-ary-tree-in-java/comment-page-1/#comment-25747&quot; rel=&quot;nofollow&quot;&gt;@Fernando&lt;/a&gt;: The purpose of the &quot;build&quot; methods is to return a representation of the tree as a list in either preorder, or postorder form. The &quot;buildWithDepth&quot; returns a representation of the tree with the depths of the node as well, which is useful if you&#039;re trying to provide a graphical representation of the tree.

In hindsight, I believe it would have been better to implement an iterator!</description>
		<content:encoded><![CDATA[<p><a href="http://vivin.net/2010/01/30/generic-n-ary-tree-in-java/comment-page-1/#comment-25747" rel="nofollow">@Fernando</a>: The purpose of the &#8220;build&#8221; methods is to return a representation of the tree as a list in either preorder, or postorder form. The &#8220;buildWithDepth&#8221; returns a representation of the tree with the depths of the node as well, which is useful if you&#8217;re trying to provide a graphical representation of the tree.</p>
<p>In hindsight, I believe it would have been better to implement an iterator!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fernando</title>
		<link>http://vivin.net/2010/01/30/generic-n-ary-tree-in-java/comment-page-1/#comment-25747</link>
		<dc:creator>Fernando</dc:creator>
		<pubDate>Sun, 11 Dec 2011 17:14:37 +0000</pubDate>
		<guid isPermaLink="false">http://vivin.net/?p=1395#comment-25747</guid>
		<description>Hi,

Probably I`m missing the point but what is the real purpose of build* methods? I mean, except for testing, why I would use a List&lt;GenericTreeNode&gt; ? BTW, I don&#039;t think that &quot;build&quot; is the correct name. Can you &quot;build a generic tree&quot; ?

My $,02.

Cheers,

--FM</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Probably I`m missing the point but what is the real purpose of build* methods? I mean, except for testing, why I would use a List&lt;GenericTreeNode&gt; ? BTW, I don&#8217;t think that &#8220;build&#8221; is the correct name. Can you &#8220;build a generic tree&#8221; ?</p>
<p>My $,02.</p>
<p>Cheers,</p>
<p>&#8211;FM</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Vorwald</title>
		<link>http://vivin.net/2010/01/30/generic-n-ary-tree-in-java/comment-page-1/#comment-25730</link>
		<dc:creator>John Vorwald</dc:creator>
		<pubDate>Sun, 11 Dec 2011 12:48:19 +0000</pubDate>
		<guid isPermaLink="false">http://vivin.net/?p=1395#comment-25730</guid>
		<description>Here are two additional routines to allow searching for data.


	public List&lt;GenericTreeNode&gt; locateOccurances(T data) {
		List&lt; GenericTreeNode &gt; occurances = new ArrayList&lt;GenericTreeNode&gt;();
		if (root != null) {
			occurances.addAll( locateOccurances(root, data) );
		}
		return occurances;
	}
	
	public List&lt;GenericTreeNode&gt; locateOccurances(GenericTreeNode node, T data) {
		List&lt; GenericTreeNode &gt; occurances = new ArrayList&lt;GenericTreeNode&gt;();

		if (node.data == data) {
			occurances.add(node);
		}
		for (GenericTreeNode child:node.children) {
			occurances.addAll( locateOccurances(child, data) );
		}
        return occurances;
	}</description>
		<content:encoded><![CDATA[<p>Here are two additional routines to allow searching for data.</p>
<p>	public List&lt;GenericTreeNode&gt; locateOccurances(T data) {<br />
		List&lt; GenericTreeNode &gt; occurances = new ArrayList&lt;GenericTreeNode&gt;();<br />
		if (root != null) {<br />
			occurances.addAll( locateOccurances(root, data) );<br />
		}<br />
		return occurances;<br />
	}</p>
<p>	public List&lt;GenericTreeNode&gt; locateOccurances(GenericTreeNode node, T data) {<br />
		List&lt; GenericTreeNode &gt; occurances = new ArrayList&lt;GenericTreeNode&gt;();</p>
<p>		if (node.data == data) {<br />
			occurances.add(node);<br />
		}<br />
		for (GenericTreeNode child:node.children) {<br />
			occurances.addAll( locateOccurances(child, data) );<br />
		}<br />
        return occurances;<br />
	}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: miliardopiscrat</title>
		<link>http://vivin.net/2010/01/30/generic-n-ary-tree-in-java/comment-page-1/#comment-20449</link>
		<dc:creator>miliardopiscrat</dc:creator>
		<pubDate>Fri, 23 Sep 2011 23:14:42 +0000</pubDate>
		<guid isPermaLink="false">http://vivin.net/?p=1395#comment-20449</guid>
		<description>hi

class GenericTreeNode.java line 68, put there keyword @Override and see if it compile.</description>
		<content:encoded><![CDATA[<p>hi</p>
<p>class GenericTreeNode.java line 68, put there keyword @Override and see if it compile.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Maven project for Generic (n-ary) Tree in Java &#124; Rough Book</title>
		<link>http://vivin.net/2010/01/30/generic-n-ary-tree-in-java/comment-page-1/#comment-15590</link>
		<dc:creator>Maven project for Generic (n-ary) Tree in Java &#124; Rough Book</dc:creator>
		<pubDate>Wed, 25 May 2011 16:14:36 +0000</pubDate>
		<guid isPermaLink="false">http://vivin.net/?p=1395#comment-15590</guid>
		<description>[...] Guus was kind enough to make a maven project for the Generic Tree. He also fixed an error in my equals method for the GenericTreeNode (I intended to do Object.equals(Object obj) but was doing GenericTreeNode.equals(GenericTreeNode obj). Since it&#8217;s a maven project, you can easily create a jar out of it and add it as a dependency to your project. You can download the project here. Thanks Guus! AKPC_IDS += &quot;1405,&quot;;Popularity: unranked [?]    Related PostsGeneric (n-ary) Tree in JavaCherryBlossomIntroducing CherryBlossomif-else in bAdkOdebAdkOde: An Esoteric LanguageJSTL, instanceof, and hasPropertyDuct-tape programmers are not heroesPerformance testing using The GrinderRunning the JavaFX 1.1 SDK on LinuxRunning the JavaFX 1.0 SDK on Linux   Categories: Java, Programming and Development Tags: data structures, generic trees, java, k-ary trees, n-ary trees, programming, software engineering, trees (data structure)       Comments (3) Trackbacks (0) Leave a comment Trackback [...]</description>
		<content:encoded><![CDATA[<p>[...] Guus was kind enough to make a maven project for the Generic Tree. He also fixed an error in my equals method for the GenericTreeNode (I intended to do Object.equals(Object obj) but was doing GenericTreeNode.equals(GenericTreeNode obj). Since it&#8217;s a maven project, you can easily create a jar out of it and add it as a dependency to your project. You can download the project here. Thanks Guus! AKPC_IDS += &quot;1405,&quot;;Popularity: unranked [?]    Related PostsGeneric (n-ary) Tree in JavaCherryBlossomIntroducing CherryBlossomif-else in bAdkOdebAdkOde: An Esoteric LanguageJSTL, instanceof, and hasPropertyDuct-tape programmers are not heroesPerformance testing using The GrinderRunning the JavaFX 1.1 SDK on LinuxRunning the JavaFX 1.0 SDK on Linux   Categories: Java, Programming and Development Tags: data structures, generic trees, java, k-ary trees, n-ary trees, programming, software engineering, trees (data structure)       Comments (3) Trackbacks (0) Leave a comment Trackback [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vivin</title>
		<link>http://vivin.net/2010/01/30/generic-n-ary-tree-in-java/comment-page-1/#comment-14204</link>
		<dc:creator>vivin</dc:creator>
		<pubDate>Wed, 06 Apr 2011 16:39:26 +0000</pubDate>
		<guid isPermaLink="false">http://vivin.net/?p=1395#comment-14204</guid>
		<description>@Akshay glad to be able to help :)</description>
		<content:encoded><![CDATA[<p>@Akshay glad to be able to help <img src='http://vivin.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Akshay</title>
		<link>http://vivin.net/2010/01/30/generic-n-ary-tree-in-java/comment-page-1/#comment-14082</link>
		<dc:creator>Akshay</dc:creator>
		<pubDate>Fri, 01 Apr 2011 16:29:58 +0000</pubDate>
		<guid isPermaLink="false">http://vivin.net/?p=1395#comment-14082</guid>
		<description>Hi Vivin,
             Your Tree implementation was really useful for us in our compilers project for maintaining the relationship between various scopes in a program. Though we needed only a very small subset of Tree operations, your implementation provided a very good view into how to build an n-ary Tree in Java. 
And like you said in your above post, I also needed the parent pointer in every node to traverse back from a node all the way upto the root.
Also, in line#69 in GenericTree.java, there is a redundant \i=0\ assignment. I guess you could remove that.

Thanks a lot</description>
		<content:encoded><![CDATA[<p>Hi Vivin,<br />
             Your Tree implementation was really useful for us in our compilers project for maintaining the relationship between various scopes in a program. Though we needed only a very small subset of Tree operations, your implementation provided a very good view into how to build an n-ary Tree in Java.<br />
And like you said in your above post, I also needed the parent pointer in every node to traverse back from a node all the way upto the root.<br />
Also, in line#69 in GenericTree.java, there is a redundant \i=0\ assignment. I guess you could remove that.</p>
<p>Thanks a lot</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vivin</title>
		<link>http://vivin.net/2010/01/30/generic-n-ary-tree-in-java/comment-page-1/#comment-12295</link>
		<dc:creator>vivin</dc:creator>
		<pubDate>Sat, 12 Feb 2011 18:11:58 +0000</pubDate>
		<guid isPermaLink="false">http://vivin.net/?p=1395#comment-12295</guid>
		<description>&lt;a href=&quot;#comment-12288&quot; rel=&quot;nofollow&quot;&gt;@jens &lt;/a&gt; 
It&#039;s funny you say that because I needed that very same functionality just yesterday! My current implementation does not offer that functionality, however it should be trivial to add. You just need a private property in &lt;i&gt;GenericTreeNode&lt;T&gt;&lt;/i&gt;:

&lt;pre&gt;
private GenericTreeNode&lt;T&gt; parent;
&lt;/pre&gt;

and in the &lt;i&gt;addChild&lt;/i&gt; method, set the parent of the new child node to &lt;i&gt;this&lt;/i&gt;.</description>
		<content:encoded><![CDATA[<p><a href="#comment-12288" rel="nofollow">@jens </a><br />
It&#8217;s funny you say that because I needed that very same functionality just yesterday! My current implementation does not offer that functionality, however it should be trivial to add. You just need a private property in <i>GenericTreeNode<t></t></i>:</p>
<pre>
private GenericTreeNode&lt;T&gt; parent;
</pre>
<p>and in the <i>addChild</i> method, set the parent of the new child node to <i>this</i>.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

