Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.AandC.homework.Assignments;
- import java.io.*;
- public class AppFiles
- {
- public static File[] returnAssignments() {
- Assignments assignments = new Assignments();
- if (assignments.filePath.exists()) {
- return assignments.filePath.listFiles();
- }
- return null;
- }
- public static File[] returnFinals() {
- Final assignments = new Final();
- if (assignments.filePath.exists()) {
- return assignments.filePath.listFiles();
- }
- return null;
- }
- public static File[] returnHomework() {
- Homework assignments = new Homework();
- if (assignments.filePath.exists()) {
- return assignments.filePath.listFiles();
- }
- return null;
- }
- public static File[] returnProjects() {
- Project assignments = new Project();
- if (assignments.filePath.exists()) {
- return assignments.filePath.listFiles();
- }
- return null;
- }
- public static File[] returnTests() {
- Test assignments = new Test();
- if (assignments.filePath.exists()) {
- return assignments.filePath.listFiles();
- }
- return null;
- }
- public static File[] returnQuiz() {
- Quiz assignments = new Quiz();
- if (assignments.filePath.exists()) {
- return assignments.filePath.listFiles();
- }
- return null;
- }
- public static String[] itemStrings;
- public static int getFileCount(String type) {
- int setCount = 0; //Project Quiz Teat
- if (type.equals("Assignments")) {
- for (File file:returnAssignments()) {
- setCount++;
- itemStrings[setCount] = file.getName();
- }
- } else if (type.equals("Finals")) {
- for (File file:returnFinals()) {
- setCount++;
- itemStrings[setCount] = file.getName();
- }
- } else if (type.equals("Homework")) {
- for (File file:returnHomework()) {
- setCount++;
- itemStrings[setCount] = file.getName();
- }
- } else if (type.equals("Project")) {
- for (File file:returnProjects()) {
- setCount++;
- itemStrings[setCount] = file.getName();
- }
- } else if (type.equals("Quiz")) {
- for (File file:returnQuiz()) {
- setCount++;
- itemStrings[setCount] = file.getName();
- }
- } else if (type.equals("Test")) {
- for (File file:returnTests()) {
- setCount++;
- itemStrings[setCount] = file.getName();
- }
- }
- return setCount;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment