Rory Marquis

Ranch Hand
+ Follow
since Nov 03, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rory Marquis

Originally posted by Kengkaj Sathianpantarit:


I think its value is near to zero, so I never expect whoever will issue a IDE certification.



I see.

Well I guess not everyone is going to share your opinion, but then that's what is good about the world

Any qualified person surely wants to be qualified in the tools they use right? For example, Do you think that surgeons don't have training and certifications for laser eye surgery machines?
Hey that's what it's all about

Often things like this are far easier to learn once you have something working that you can take apart.

15 years ago
Hi Mark



No problem, glad it worked.

Have a play around with the classes we created, and the objects, and see how they interact. It will give you a better insight into Java Object Orientated Programming.

Good Luck
Ror
15 years ago
Hi

It looks to me as in this example the GLDrawing class is the main class, so what I have done to show you is to put all that we did into this class. Normally I would say don't do this as the drawing and the parsing of the file should be separate purely for cohesive reasons.

I have also embedded the OpenGLCoordinates class into this one, this is something that you can choose to do, in this example it is fine.

However, try this and see how you get on. I haven't compiled it, but you should be able to get the rough idea of how this should all fit together, i hope.

15 years ago
Hi Mark

I mean, pass the List of coordinates directly to your OpenGL class (what is it called, the class?).

When you create a new class for your OpenGL (assuming you are still working in Java) you are creating a new Object, an "instance" of that class.

So in your OpenGL class put in a function which accepts the List as an argument and there you have your parsed and ready List of coordinates in your OpenGL class to do whatever you need with them.

HTH
Ror
15 years ago

Originally posted by Kengkaj Sathianpantarit:
Hmph, an IDE certification? Never expect it.



Never expect what?
You could use Regex or the Scanner API. To make sure there were only the number of String matches you wanted.

Of course your index in the StringBuffer would still change if there were characters append before that index.
15 years ago
Hi

If your OpenGL class is in Java, then you need to create it as an Object and create a function that will take the List in as a parameter.

Inside that function you then need to loop though the List and get the values out as a double as that is what they have been stored as.

HTH
Ror
15 years ago
if the StringBuffer changes outside of your control the index will not be the same.

I don't think you can do what you want without calling indexOf.

What you could do is create your own object that wrapped a StringBuffer (or StringBuilder depending on your needs - or just a List) and then every time a new String was append to your own object, you could control the index that you want to keep in the way Bill said.

However, why is it a problem to call indexOf?
[ November 07, 2008: Message edited by: Rory Marquis ]
15 years ago
Hi

When you get the StringBuffer and call the indexOf method, this will return an int value (representing the index of the sting you looked for). that you can store in a primitive variable reference.

This will be accurate for the indexOf on the StringBuffer, as long as the StringBuffer doesn't change.

HTH
Ror
15 years ago

Originally posted by Steve Luke:

It sounds like you were saying that we would have to clone the String in order to keep them alive in the cloned object.

Yes, I can see that I wasn't as clear as I should have been there.


Since none of the previous posts actually suggested cloning the String, mine only suggested letting the String references get copied, AND you never refer back to re-nulling the copies of the String, this again makes it easy to mis-interpret (or rather hard to interpret the way you meant it to be).

You are correct, I should have referred back to myself. I didn't mean to cause confusion on something that should be simple


Why do I bother writing this? I don't want to dwell, and would normally have stopped at 'It does now', but it irks me when you repeatedly said 'read the thread' as if we hadn't and what you were saying was obvious if only we would read it.
We did read the thread. What you said sounded wrong. Only now after you fill in the context of what was going on in your head (but not written in your posts) does it clear things up.

Sorry, this wasn't meant as a rant, I just wanted you to understand that you weren't really being fair when you repeatedly said 'if you would read the thread...'.



I apologise for that, I was posting quickly. Although I did only ask to read my post once and to read the whole thread (as there was more than just my one post by then)once which I don't feel was "repeatedly", however, I can understand this irked you, which was not my intention.

I was also Irked because I do not like being being told "Incorrect" (which I thought was a bit blunt). That made me feel the thread can't have been read properly, if that makes sense.

However, I realise that my original post wasn't as clear as I had thought I had been. I shall try and be more verbose in order to avoid confusion, thank you for making that observation. Constructive criticism is always welcome.

The last thing I want to do on help forums to argue, so I am glad we were able to resolve this miscommunication.
[ November 07, 2008: Message edited by: Rory Marquis ]
15 years ago

Originally posted by Joanne Neal:
Yes, but Steve and I are referring to your second sentence where the clone does have a reference to the string, so disposing of the original will make no difference.



Hi peeps
I didn't say it would have a reference to it, I said you set the String to null, so as to remove the reference! So if you read the whole thread the first thing I say is remove the reference by setting it to null, everything else I say is based on that answer. You write the clone method yourself, and inside that you set the String to null in the clone. Therefore only the original reference still remains.

In my second sentence, I am saying that if you used my way, that it wouldn't save you any memory until disposed of the original! 'this wouldn't make a difference' - "this" being my solution of making your own clone without the String:

However, as Steve said the clone will simply copy the reference to the String anyway so this wouldn't make any difference until you disposed of the original.



and in context:

However, as Steve said the [basic/original/non overidden] clone will simply copy the reference to the String anyway so this [setting the clone string to null] wouldn't make any difference [in comparison to the original way] until you disposed of the original [where upon the original string would be GCed and you would no longer have a reference to it thus freeing up memory].



Hope that clears everything up.

[ November 07, 2008: Message edited by: Rory Marquis ]
[ November 07, 2008: Message edited by: Rory Marquis ]
15 years ago