Problem with contains() (StackOverflow)
in
Programming Questions
•
1 year ago
Hi...
I'm trying to help someone troubleshoot a sketch which has a series of attractors, and I have an ArrayList of a Rectangle Class which has a contains() method.... first off, their code seemed to have the int and vector syntax mixed up, so I've tried both... (this is in the Component Class, btw...)
As my data is in PVector form, here's the method ...
- boolean contains(PVector ball) {
- if (a.contains(ball) ) {
- return true;
- } else {
- return false;
- }
- }
... which is all called by this code:
- Attractors atr1 = (Attractors) attractor.get(j);
- if( atr1.contains(v1) ) {
which is in a for loop within draw...
Now, the contains method stops me with a console error saying that
The function contains(PVector) does not exist...
(and I've imported java.awt.Component btw).
If I change Line #3 from
a.contains() to this.contains() , it runs, but gives me a StackOverflow almost right away... which I kind of understand... but kind of not...
It's a little late where I am, and I'm a little confused, so if anyone has any suggestions, I'm all ears...
thanks in advance...
1