• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Walking an Object's Relationships
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Walking an Object's Relationships


  • Subject: Re: Walking an Object's Relationships
  • From: Florijan Stamenkovic <email@hidden>
  • Date: Tue, 23 Aug 2005 17:48:17 +0200


On Aug 22, 2005, at 21:12, email@hidden wrote:

I am trying to create a virtual tree based on the relationships (not
inheritance) of objects in an array and not sure how to go about doing it.


I am looking into using a tree set as a possible solution.

You refer to Java Collection's TreeSet? All that the TreeSet does is implement a Set interface (so, no duplicates in the collection), and keeps them sorted depending on the comparator you feed to the TreeSet (see API). And as I understand, you want to have a tree structure (as in file-system's tree organization?), which the TreeSet has nothing to do with. Just one more fine example of Java class naming...


If you could be more specific, maybe somebody could help you more easily. What do you want to do? Display? Scan? Relate? Organize? Sum? ...

Tip: if you have a tree with non defined max depth, you are looking for a recursive function...

Simple example:
public int countOfSubtree(MyEO eo)
{
int count;
NSArray objects = eo.relationship();
for(int i = 0 ; i < objects.count ; i++)
count += countOfSubtree( (MyEO)objects.objectAtIndex(i) ); //recursion
return count;
}


Cheers
Flor

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Walking an Object's Relationships
      • From: Florijan Stamenkovic <email@hidden>
References: 
 >Walking an Object's Relationships (From: email@hidden)

  • Prev by Date: Re: Updating EOObjects/Selecting EOObjects
  • Next by Date: Re: WOContext->completeURLWithRequestHandlerKey's aRequestHandlerPath
  • Previous by thread: Walking an Object's Relationships
  • Next by thread: Re: Walking an Object's Relationships
  • Index(es):
    • Date
    • Thread