Change Contents of the Bubble
View this PageEdit this PageUploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Questions on HW5-Spring2006

Been wondering about Homework 5? Like "What's that supposed to MEAN anyway?"
Here's the place to ask!


So, the way I'm reading it, we're to display several pictures?
Or should we be placing everything on one picture...
~Jim

Yes, please display several pictures. Mark Guzdial

So if we decide to use PositionedSceneElements, should we place our new methods inside of that class? Or is there a specific other class that we're supposed to be modifying?
~Jennifer
Yes, please. Mark Guzdial

That's my understanding of it!
And then we create a class that sets it all up...
~Jim

Also - should we have weave put the picture AT the end? We talked about this with the sound weave... Is it okay if it just weaves between the existing? (If that makes any sense..)
~Jennifer
Weaving between existing is explicitly what I'd like you to do. (We did discuss this in class yesterday.) Mark Guzdial

Thanks, Jim. :)

I'm not sure where to even start.
Is there a pre-existing class we could look at?
Are:

firstpictureinlist.weave(newelement, n) 
firstpictureinlist.addToEndNTimes(newelement,n) 
firstpictureinlist.findAndReplaceRepeat(oldelement,newelement,n)


pre-existing methods that we make unique, or are they the three that we have to create ourselves?
You're creating them yourselves, and if you look at the lecture from yesterday on SoundElement, you'll see pieces of what you need. Mark Guzdial

Create 'em ourselves. Using anything we've seen in class for pictures in linked lists...
Like PositionedSceneElement or LayeredSceneElement. You'd have to add 3 methods to one of those (I think there was another one, too...)
They don't already exist, but we have very similar methods in SongNode :)
~Jim
P.S. I think we can use drawable nodes, too... Am I correct?
Sure, if you'd like! Mark Guzdial

Thanks Jim!

Doing the extra credit?

If you decide to go for the extra credit and make a tiling, and if you're willing to share it, please let me know and I'll set up a gallery. Thanks! Mark Guzdial

Bleh! Turns out DrawableNode doesn't like me. :)
I had PositionedSceneElement extend DrawableNode (so that I could put PositionedSceneElements into a VBranch), and added a drawWith(Turtle) that calls a method I added called drawMeOn(Picture bg, int x, int y) –sets the start position of the PositionedSceneElement to the position of the turtle instead of the bottom left.
The problem was an unexpected one (obviously): I can't redefine getNext in PositionedSceneElement to return a PositionedSceneElement, because its super requires getNext to return a DrawableNode. I had thought that since in my code, a PositionedSceneElement is a DrawableNode, it would all work... :( Oh well...
Anyone have a suggestion? Otherwise, I think I'll abandon the idea. I was going to do a full screen tiling instead of a single row...
~Jim

Hey Jim. I suggest setting up PositionedSceneElement like a DrawableNode, giving it a child and allowing it to position by rows.
~Jim

Wow, that worked! Thanks!
~Jim

Okay for some reason I'm having trouble making my methods do the multiple times thing - like I can get it to insert at the end, but not a few copies of it, same with findAndReplaceRepeat... It's really confusing... I've looked through everything I can think of - any advice?
~Jennifer

Okay I got findAndReplaceRepeat to work.. I did something silly.
~Jennifer

Did you get your insert at end n times to work?
You should only need a for loop– make sure that you add a copy of the node to the end!
setnext(inputNode.copy());
currentNode = getNext();
Something like that in a for loop–you know the rest.
~Jim

Um... Can we name our homework something similar but different than PictureTest? We already have a class with that name...
~Jim

I totally had something just like that!!! But it was written funny I think - I think I'd been staring at it too long - thanks Jim :)
~Jennifer

Do we provide pictures for PictureTest or do we set it up so the tester can use whatever pictures he wants?
Only if you use things not in MediaSources. Mark Guzdial

Oh my God, why is there SceneElementPositioned and PositionedSceneElement in my javasource folder?
Oh, I think I figured it out. SceneElementPositioned extends SceneElement and PositionedSceneElement doesn't extend anything. The SceneElementPositioned class isn't working properly though because the method DrawFromMeOn in SceneElement assumes a y coordinate of 200 instead of bg.getHeight()-1. Is this just me?
No, that's what you SHOULD have. Remember that one of those is a subclass of SceneElement (and important stuff is in there), and the other worked as a standalone class. Mark Guzdial


So the questions that remain for me are:
1) Are we to assume that Manabu will use setMediaPath, or should we include a line of code for him to change?
2) Should we upload our images as well? (stealing someone else's question)
3) I uploaded something called PictureTest_hw5 because I already have a PictureTest. Is that ok, or should I change it?

Thanks,
~Jim
1)Yes, I will use setMediaPath.
2)If you use images which are not in MediaSources, you should upload your images as well.
3)I need to talk to the professor about this, but I believe it will be ok if you already have one. Manabu Shimobe

Am I the only one without the PictureTest main?
~John

no i don't have PictureTest either. i'd like to have it...
~chase
Maybe one was in the CD and wasn't in the download, or vice-versa? Mark Guzdial

What exactly is an "illegal start of expression"? One of my methods start off with:

public PositionedSceneElement last() {

I don't know what is illegal about this.
I'm getting a lot of errors for parts of the code( and classes) that I didn't edit at all. I tried to compile my edited PositionedSceneElement class file, and ending up with 20 or so errors relating to the Picture class file. Plus I've gotten errors for the drawFromMeOn and copy methods as well. Only 1 or 2 errors are in the code I wrote, so what can I do to fix this?
"illegal start of expression" often means that you forgot to put a semi-colon or a close quote or a close parenthesis in lines above. The line that Java tells you is the line where it figured out that it had no idea what was going on. All the errors WILL be in the code you wrote – that's how Java and compilers work. But it may take some hunting. Mark Guzdial

Well, the errors in other stuff are not caused by the other stuff itself...
So, if you call a new Picture and pass it a Sound, for example, Picture will throw an error.
REMOVEDces are, your code has type mismatches and so forth.
~Jim
hi guys...it's a little late now. but for future reference, you can go to the "course notes and other materials" page and get it from the zip file here: http://coweb.cc.gatech.edu/cs1316/uploads/2/java-source-Jan06.zip



Link to this Page