String dirName = polarity == 1 ? PropertiesGetter.getProperty("PosReviewsDir") : PropertiesGetter.getProperty("NegReviewsDir");
File dir = new File(dirName);
String reviewBody;
ArrayList<DataUnit> theReviews = new ArrayList<DataUnit>();
String[] fileNames = dir.list();
MovieReview tempReview;
if (fileNames != null) {
for (String fileName : fileNames) {
tempReview = new MovieReview();
tempReview.setSentiment(polarity);
reviewBody = readFile(dirName + "//" + fileName);
tempReview.setDataBody(reviewBody);
theReviews.add(tempReview);
}
}
return theReviews;
}