Guest User

Untitled

a guest
Jul 3rd, 2014
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.20 KB | None | 0 0
  1. package com.AandC.homework.Assignments;
  2.  
  3. import java.io.*;
  4.  
  5. public class AppFiles
  6. {
  7.     public static File[] returnAssignments() {
  8.         Assignments assignments = new Assignments();
  9.         if (assignments.filePath.exists()) {
  10.             return assignments.filePath.listFiles();
  11.         }
  12.         return null;
  13.     }
  14.     public static File[] returnFinals() {
  15.         Final assignments = new Final();
  16.         if (assignments.filePath.exists()) {
  17.             return assignments.filePath.listFiles();
  18.         }
  19.         return null;
  20.     }
  21.     public static File[] returnHomework() {
  22.         Homework assignments = new Homework();
  23.         if (assignments.filePath.exists()) {
  24.             return assignments.filePath.listFiles();
  25.         }
  26.         return null;
  27.     }
  28.     public static File[] returnProjects() {
  29.         Project assignments = new Project();
  30.         if (assignments.filePath.exists()) {
  31.             return assignments.filePath.listFiles();
  32.         }
  33.         return null;
  34.     }
  35.     public static File[] returnTests() {
  36.         Test assignments = new Test();
  37.         if (assignments.filePath.exists()) {
  38.             return assignments.filePath.listFiles();
  39.         }
  40.         return null;
  41.     }
  42.     public static File[] returnQuiz() {
  43.         Quiz assignments = new Quiz();
  44.         if (assignments.filePath.exists()) {
  45.             return assignments.filePath.listFiles();
  46.         }
  47.         return null;
  48.     }
  49.     public static String[] itemStrings;
  50.     public static int getFileCount(String type) {
  51.         int setCount = 0; //Project Quiz Teat
  52.         if (type.equals("Assignments")) {
  53.             for (File file:returnAssignments()) {
  54.                 setCount++;
  55.                 itemStrings[setCount] = file.getName();
  56.             }
  57.         } else if (type.equals("Finals")) {
  58.             for (File file:returnFinals()) {
  59.                 setCount++;
  60.                 itemStrings[setCount] = file.getName();
  61.             }
  62.         } else if (type.equals("Homework")) {
  63.             for (File file:returnHomework()) {
  64.                 setCount++;
  65.                 itemStrings[setCount] = file.getName();
  66.             }
  67.         } else if (type.equals("Project")) {
  68.             for (File file:returnProjects()) {
  69.                 setCount++;
  70.                 itemStrings[setCount] = file.getName();
  71.             }
  72.         } else if (type.equals("Quiz")) {
  73.             for (File file:returnQuiz()) {
  74.                 setCount++;
  75.                 itemStrings[setCount] = file.getName();
  76.             }
  77.         } else if (type.equals("Test")) {
  78.             for (File file:returnTests()) {
  79.                 setCount++;
  80.                 itemStrings[setCount] = file.getName();
  81.             }
  82.         }
  83.         return setCount;
  84.     }
  85. }
Advertisement
Add Comment
Please, Sign In to add comment