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

Questions on HW5-Spring07


Question: So, in this hw, we have to create all three methods from the scratch right?
Guzdial is the man

Question: Are we going to make these new methods in PositionedSceneElement.java, if not, where should we make them? I know we are going to use them in our PictureTest class.

Question: Looking at the instructions for the homework, the lines...
"firstpictureinlist.findAndReplaceRepeat(oldelement,newelement,n) Find oldelement (it's a node, not a picture,... blah"
"firstnodeinlist.replaceWithModification(findelement,int type) Find the node findelement (a node, not a picture,...blah"
"firstnodeinlist.replaceWithModifications(findelement,double[] types) Find the node findelement (a node,... blah"

Are the classes "firstpictureinlist" and "firstnodeinlist" simply made up to explain that findAndReplaceRepeat and replaceWithModification and replaceWithModifications are methods?

Question: PositionScenedElement is a node in itself right? just wanted clarification.

Question: For our first method, is it okay to assume that n is greater than equal to one?

Question: Considering the code for methods 2 and 3 (I'm writing my methods in SceneElement) This class doesn't know the methods negate, mirrorVertical, mirrorHorizontal, and makeSunset does it? So do I have to copy and paste these methods (from Picture) into this class in order to be able to use them here?

Even if I do copy and past those methods into the SceneElement class... would I be able to say something like (one of my inputs for method two is "SceneElement oldelement") oldelement.negate(); ??

Or am I just way off base?

Question: I'm a bit confused...On pg. 160 in the course notes, it says that SceneElementPositioned will have an x and y for positioned, but SceneElementLayered will not. However, it's SceneElementLayered that has x and y variables. Am I looking at this wrong or is something incorrect?

Question: To access a picture of a node called node1 do we type node1.myPic ? Also suppose we have a picture p and want to set it to the picture that node1 contains do I type p = node1.myPic ?

Question: "Using any of the linked lists of pictures that we created (where ordering represented linearity, or layering, or using turtles to walk the list), implement three additional methods (where firstpicturnodeinlist is a node, not actually a picture)"
– where are these linked lists of pictures that we have created?

Question: public void replaceWithModification( PositionedSceneElement findelement, int type)

When I type this line in, these are the errors I get:
9 errors found:
File: C:\cs1316\java-source\PositionedSceneElement.java  [line: 205]
Error: C:\cs1316\java-source\PositionedSceneElement.java:205: class, interface, or enum expected
File: C:\cs1316\java-source\PositionedSceneElement.java  [line: 207]
Error: C:\cs1316\java-source\PositionedSceneElement.java:207: class, interface, or enum expected
File: C:\cs1316\java-source\PositionedSceneElement.java  [line: 212]
Error: C:\cs1316\java-source\PositionedSceneElement.java:212: class, interface, or enum expected
File: C:\cs1316\java-source\PositionedSceneElement.java  [line: 216]
Error: C:\cs1316\java-source\PositionedSceneElement.java:216: class, interface, or enum expected
File: C:\cs1316\java-source\PositionedSceneElement.java  [line: 217]
Error: C:\cs1316\java-source\PositionedSceneElement.java:217: class, interface, or enum expected
File: C:\cs1316\java-source\PositionedSceneElement.java  [line: 220]
Error: C:\cs1316\java-source\PositionedSceneElement.java:220: class, interface, or enum expected
File: C:\cs1316\java-source\PositionedSceneElement.java  [line: 222]
Error: C:\cs1316\java-source\PositionedSceneElement.java:222: class, interface, or enum expected
File: C:\cs1316\java-source\PositionedSceneElement.java  [line: 224]
What do you think is wrong? I'm kind of confused.

Question: Why does Dawn do all the work?

Question: In part a, is newElement also a node? or is it a picture?

Question: On part a, if n was 0, would the function just delete oldelement?

Question: i think the double in method 3 is supposed to be int. that's what one of the ta's said.

Question: For our PictureTest class, we show a background with the original pictures, and then we show new backgrounds showing the pictures after they have been modified. My question is: Should each method modify the original linked list, or should they just modify the result of the previous method? In other words, after we do findAndReplaceRepeat, do we do a replaceWithModification on the result of that or do we go back to the original linked list?

Question: When I run my PictureTest, why do I get the following:
java PictureTest
ArrayIndexOutOfBoundsException: Coordinate out of bounds!
  at sun.awt.image.ByteInterleavedRaster.getDataElements(Unknown Source)
  at java.awt.image.BufferedImage.getRGB(Unknown Source)
  at SimplePicture.getBasicPixel(SimplePicture.java:270)
  at Pixel.getAlpha(Pixel.java:71)
  at Pixel.setColor(Pixel.java:211)
  at Picture.bluescreen(Picture.java:2220)
  at PositionedSceneElement.drawMeOn(PositionedSceneElement.java:78)
  at PositionedSceneElement.drawFromMeOn(PositionedSceneElement.java:63)
  at PictureTest.main(PictureTest.java:17)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  at java.lang.reflect.Method.invoke(Unknown Source)

Question: with replaceWithModifications(PositionedSceneElement findelement, double [] types), when i try to test my method i use replaceWithModifications( fly, {1,2,3}) i get a syntax error for using {, what am i suppose to use?

Question: are we supposed to hardcode the pictures in?
I mean are we specifying the pictures inside the code or are we going to type them in interactions pane?

Question: are these three methods we are making similar in structure to remove() or repeatInserting()?

Question: Say my REMOVEDked List is Tree1>Dog1>Tree2>Dog2. When I run:

–findAndReplaceRepeat(dog, house, 2): Does it need to replace both dogs with 2 houses, or just the first one?
–replaceWithModification(dog, 1): Does it need to negate both dogs or just the first one?
–replaceWithModifications(dog, {1,2}): When it's done, should both dogs be replaced with a negated and mirrored dog, or should the first dog be the only one changed?

Question: In the interactions panel I entered this command:
FileChooser.getMediaPath("tree-blue.jpg"), and it returned the proper path which was "D:/cs1316/mediasources/tree-blue.jpg"

Two seconds later I simply ran my PictureTest main method, and it gave me an error message saying that it couldn't load "nulltree-blue.jpg". So to see what was wrong I re-entered the same FileChooser.getMediaPath("tree-blue.jpg") in the interactions panel and it did this:
> FileChooser.getMediaPath("tree-blue.jpg")
"nulltree-blue.jpg"
meaning that it can no longer find the path to the file.
I re did the whole process from the beginning and got the exact same results. If I do the FileChooser.getMediaPath("tree-blue.jpg") in the interactions panel before I run my PictureTest main method, it works just fine. If I run the PictureTest main method and then try, it tells me the path is "nulltree-blue.jpg".

why do bad things happen to good people?

Question When I try to retrieve the picture file from the PositionedSceneElement findelement, I get this error.
public void replaceWithModification(PositionedSceneElement findelement, int type) {
      
PositionedSceneElement current = this;
if (current == findelement);  {
        Picture p = getPicture(findelement);

Error: C:\Documents and Settings\Owner\My Documents\GT\Spring 2007\CS 1316\java-source-Fall06\PositionedSceneElement.java:175: getPicture() in PositionedSceneElement cannot be applied to (PositionedSceneElement)
I thought PositionedSceneElement is a node, and has the properties of a node such as getPicture()....?

Question: In replaceWithModifications, I have 4 if statements to change the picture, and then I define the new picture (actually I've defined it as a PositionedSceneElement) as p (PositionedSceneElement p = new PositionedSceneElement(oldelement.getPicture().....etc). But, when I try to put this new node back into my linked list, 'current.insertAfter(p)' I get an error saying cannot find symbol variable p in PositionedSceneElement. Why won't it recognize what p is??

Question: What is the method in the class double to find the length of an array of doubles? Am I asking the right question? If not, is the right question, is there a class array that knows is length? I think the second question is way off but I'm confused on the array of doubles that we have in replaceWithModifications().

Question My picture test is taking a superrrr long time to run my three methods. Should it take a really long time or is there something wrong with my methods?

Question: In the homework question it says that our class PictureTest needs to show a "background" with the pictures on it. Does it have to be a background or can it just be a white background (one that you get when you create a picture like Picture bg=new Picture(1000,500);

Question: Some of the pictures that I used for my PictureTest class look choppy(some parts missing or white where it should not be). Is this because they are not pictures like the tree.jpeg in our Mediasources, which is a blue chromakey picture. Is it ok if our pictures look like that???

Hey Dawn,
Thanks a lot for your help.



Link to this Page