I am trying to compile what I have written, and I've encountered only two errors:
File: /Users/Will/Projects/Computers/a5/a5-basic-lib/a5-code/Playlist.java [line: 136]
Error: cannot find symbol
symbol : method createSong(java.lang.String)
location: class Playlist
and
File: /Users/Will/Projects/Computers/a5/a5-basic-lib/a5-code/Playlist.java [line: 152]
Error: cannot find symbol
symbol : method getSong(java.io.File)
location: class Playlist
Both of them refer to methods that I am calling from within Playlist.java, but the methods belong to other classes. I've called methods from the other classes successfully, but for some reason these two give me trouble.
The entire class is very long, so I'll just include the methods that I'm having trouble with and the import statements/constructors.
import java.util.ArrayList;
import java.util.Scanner;
import java.io.FileReader;
import java.io.PrintWriter;
import comp202.fall2007.a5.comparator.*;
import comp202.fall2007.a5.filter.*;
import comp202.fall2007.a5.util.*;
import java.io.File;
public class Playlist {
ArrayList<Song> playlist = new ArrayList<Song>();
public Playlist () {
}
public Playlist (Playlist playlist) {
playlist = playlist;
}
public java.util.ArrayList<String> load (java.io.File path, MusicCollection collection) {
//first the playlist is cleared
playlist.clear();
//then the file is read
try {
FileReader reader = new FileReader (path);
Scanner scan = new Scanner(reader);
//the playlist index advances as there are next lines in the file
for (int i=0; scan.hasNextLine(); i++) {
//getting next line
String nextPath = scan.nextLine();
File nextFile = new File (nextPath);
//does nothing if the line is empty
if (nextPath.length() != 0) {
//if a null is returned
if (null == collection.getSong(nextFile)) {
try{
//adding the song's info to the playlist
playlist.set(i, createSong(nextPath));
}
//*SONGFACTORY ERRORS*//
catch (IncorrectFileExtensionException ee){
System.out.println("The file " + nextPath + " had an incorrect file extension");
}
catch (java.io.IOException io){
System.out.println("There was an error reading the file " + nextPath);
}
//*END SONGFACTORY ERRORS*//
}
else {
//getting the song from the MusicCollection when it doesn't return null
playlist.set(i, (getSong(nextFile)));
}
}//the line has either added to the playlist or has been skipped for being empty
}//all of the lines have been read in the file
}//the task has been completed
//*SCANNER AND FILEREADER ERRORS*//
catch (java.io.FileNotFoundException fnf){
System.out.println("The file " + path + " was not found");
}
catch (java.lang.IllegalStateException is){
System.out.println("An error has been encountered: Scanner Illegal State.");
}
//*END SCANNER AND FILEREADER ERRORS*//
}//end
I've looked everywhere and I can't seem to find the problem. I've verified that createSong is in comp202.fall2007.a5.util.SongFactory, which I've imported, and it does take a String. I've also verified that getSong is located in MusicCollection.java and it does take a java.io.File.
Thanks sincerely for any help!
This post has been edited by thure: 29 November 2007 - 05:11 PM

New Topic/Question
Reply




MultiQuote




|