We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › creating a chain using the java Vector class
Page Index Toggle Pages: 1
creating a chain using the java Vector class (Read 609 times)
creating a chain using the java Vector class
Jan 14th, 2008, 12:40pm
 
Hello all!

I wrote a test sketch that will be used with the reacTIVision server and implemented in the P5 client demo.

The idea is to link objects when they are within a certain range.
There are two kind of objects :
-parameterMarkers (these object change the apperance of prototypeMarkers)
-prototypeMarkers (these objects will be transformed if one or several parameterMarkers is close enough)

I want to use the java Vector class to create an expandable list of all linked objects.

Now I don't know how to do that. Here is what I want to do explained in a drawing : http://www.amorphik.com/mid/TUI/TUI_interface_links_explanation.png

and here is the code I've written so far :

http://www.amorphik.com/mid/TUI/TUI_MODULES_PROXIMITY_TEST_VECTOR_CP5.zip

Re: creating a chain using the java Vector class
Reply #1 - Jan 14th, 2008, 2:43pm
 
Hi, just for information, using Vector is not recommended since it is kind of deprecated. You should use an ArrayList or any other java.util.List implementation instead.

What you could do is storing pointers to the connected objects in the object itself :

Code:
class MyObject {
MyObject[] connectedObjects;
}

and store all connected objects in an ArrayList, so you can easily check with java.util.List.contains() if an object is already connected or not.
Re: creating a chain using the java Vector class
Reply #2 - Jan 14th, 2008, 10:10pm
 
Thank you, I will check ArrayList
Page Index Toggle Pages: 1