Skip to content

Commit

Permalink
Change package name and fix javadoc comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitra-karadima committed Jan 7, 2019
1 parent 308ae02 commit b639c1e
Show file tree
Hide file tree
Showing 10 changed files with 115 additions and 54 deletions.
Binary file modified ArrayListLine.class
Binary file not shown.
82 changes: 43 additions & 39 deletions ArrayListLine.java
Original file line number Diff line number Diff line change
@@ -1,48 +1,52 @@
package dds.gr.aueb.dmst.crazydevelopers;
package gr.aueb.dmst.dds.CrazyDevelopers;

/** ArrayListLine class.
* *that will be used as a whole different line in our database
*
* @author oneofthecraziest
*/

public class ArrayListLine {
protected String[] line;
// theoretical columns of our data base
protected String[] line;
// theoretical columns of our data base

/**
* Constructor of our class.
*
*/
public ArrayListLine(String[] line) {
this.line = line;
}
/**
* Constructor of our class.
* @param line String Array
*/
public ArrayListLine(String[] line) {
this.line = line;
}

/**
* method that helps changing a specific column of our line.
*/
public void changeColumn(int column, String x) {
line[column] = x;
}
/**
* @param column first int value
* @param x second string value
* method that helps changing a specific column of our line.
*/
public void changeColumn(int column, String x) {
line[column] = x;
}

/**
* Method that prints specific Line, will be used in the class Functions.
*/
public void printLine() {
System.out.print("|");
for (int i = 0; i < line.length; i++) {
System.out.printf("%15s %5s|",line[i],"");
}
System.out.println("\t");
}
/**
* Method that prints specific Line, will be used in the class Functions.
*/
public void printLine() {
System.out.print("|");
for (int i = 0; i < line.length; i++) {
System.out.printf("%15s %5s|",line[i],"");
}
System.out.println("\t");
}

/**
* Method that returns specific Line in an array, will be used in the class.
* Functions
*/
public String[] getLine() {
String[] x = new String[line.length];
for (int i = 0; i < line.length; i++) {
x[i] = line[i];
}
return x;
}
/**
* Method that returns specific Line in an array, will be used in the class.
* Functions
* @return specific line x
*/
public String[] getLine() {
String[] x = new String[line.length];
for (int i = 0; i < line.length; i++) {
x[i] = line[i];
}
return x;
}
}
Binary file modified Exceptions.class
Binary file not shown.
30 changes: 26 additions & 4 deletions Exceptions.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package dds.gr.aueb.dmst.crazydevelopers;
package gr.aueb.dmst.dds.CrazyDevelopers;

/*
* Class that will be used to check whether an Exception is thrown or not
* to guarantee that the program will end normally
*/
/**
* @author oneofthecraziest
*/


import java.util.ArrayList;
import java.util.InputMismatchException;
Expand All @@ -16,6 +20,7 @@ public class Exceptions {
* Method that reads the choice of the user and checks to see if the value of.
* the choice produces the InputMismatchException and ends when the value is
* valid and no Exception is thrown
* @return choice of the user
*/
public int notIntegerException() {
int choice = 0;
Expand All @@ -35,7 +40,10 @@ public int notIntegerException() {
return choice;
}

// Method that it initializes the variable x
/**
* Method that it initializes the variable x
* @param x string value
*/
public void display(String x) {
text = x;
}
Expand All @@ -44,6 +52,9 @@ public void display(String x) {
* Method that checks if the value that the user gives throws the.
* InputMismatchException or the ArrayOutOfBoundsException and ends when none of
* the above Exceptions are thrown
* @param x1 int value
* @param lists ArrayList of ArrayListLine
* @return x1
*/
public int outOfBoundsException(ArrayList<ArrayListLine>[] lists, int x1) {
int exit = 0;
Expand All @@ -61,6 +72,10 @@ public int outOfBoundsException(ArrayList<ArrayListLine>[] lists, int x1) {
/**
* Method used for the same reason but with one more argument because we need to.
* get to second dimension of the array lists
* @param x1 first int value
* @param list second int value
* @param lists ArrayList of ArrayListLine
* @return x1
*/
public int outOfBoundsException(ArrayList<ArrayListLine>[] lists, int x1, int list) {
int exit = 0;
Expand All @@ -76,8 +91,12 @@ public int outOfBoundsException(ArrayList<ArrayListLine>[] lists, int x1, int li
}

/**
* Method used for the same reason but with different arguments because we need.
* to use the features for every list
* Method used for the same reason but with one more argument because we need to.
* get to second dimension of the array lists
* @param x1 first int value
* @param list second int value
* @param arrayNumberColumns String Array
* @return x1
*/
public int outOfBoundsException(int[] arrayNumberColumns, int x1, int list) {
int exit = 0;
Expand All @@ -95,6 +114,9 @@ public int outOfBoundsException(int[] arrayNumberColumns, int x1, int list) {
/**
* Method used to check if there is data to a specific table.
* If there is no data in the DataBase return true otherwise false
* @param list first int value
* @param lists ArrayList of ArrayListLine
* @return exit boolean value
*/
public boolean noDataBaseException(ArrayList<ArrayListLine>[] lists, int list) {
boolean exit = false;
Expand Down
Binary file modified Functions.class
Binary file not shown.
32 changes: 27 additions & 5 deletions Functions.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package dds.gr.aueb.dmst.crazydevelopers;
package gr.aueb.dmst.dds.CrazyDevelopers;

/**
*Class that contains necessary functions for our database:
* input of data , data presentation, delete and change of data
*/

import dds.gr.aueb.dmst.crazydevelopers.Exceptions;
import java.io.IOException;
import java.io.PrintWriter;

Expand All @@ -20,6 +19,7 @@ public class Functions {

/**
* Constructor of our class Sets length of our array of array lists.
* @param num int value
*/

@SuppressWarnings("unchecked")
Expand All @@ -30,8 +30,10 @@ public Functions(int num) {
}
}

/*
/**
* Method that adds a new object(line) to a specific list
* @param num int value
* @param object arraylistline
*/
public void addLine(ArrayListLine object, int num) {
lists[num].add(object);
Expand All @@ -41,6 +43,8 @@ public void addLine(ArrayListLine object, int num) {
* Method that allows user to add the new line to a table Asks for the number of
* table to add a new line and then asks for the Strings for every column After
* it creates a new line using the addLine(...) method.
* @param arrayNumberColumns array of int values
* @param names array of string values
*/
public void addChoice(int[] arrayNumberColumns, String[][] names) {
features = arrayNumberColumns;
Expand All @@ -57,8 +61,10 @@ public void addChoice(int[] arrayNumberColumns, String[][] names) {
addLine(xx, tableAdd - 1);
}

/*
/**
* Method that deletes an object(line)
* @param rem first int value
* @param num second int value
*/
public void delete(int rem, int num) {
lists[num].remove(rem);
Expand All @@ -68,6 +74,7 @@ public void delete(int rem, int num) {
* Method that deletes a specific line of a specific table Asks user to input
* number of table and number of line Uses method delete of class Functions to
* do so.
*
*/
public void deleteChoice() {
ex.display("Select list to delete an item: ");
Expand All @@ -87,6 +94,9 @@ public void deleteChoice() {
/**
* Method that prints a specific object of a list and the names of the columns,
* all given by the user.
* @param list first int value
* @param num2 second int value
* @param names array of string values
*/
public void print(int list, int num2, String[][] names) {
if (num2 == 0) {
Expand All @@ -102,6 +112,8 @@ public void print(int list, int num2, String[][] names) {
/**
* Method that prints all the lines and columns(all the objects ArrayListLine
* there are) of the existing tables Uses the method print of Functions to do so.
* @param names array of string values
* @param namesT array of string values
*/
public void printChoice(String[] namesT, String[][] names) {
for (int i = 0; i < lists.length; i++) {
Expand All @@ -113,8 +125,13 @@ public void printChoice(String[] namesT, String[][] names) {
}
}

/*

/**
* Method that changes an object of a specific line
* @param list first int value
* @param line second int value
* @param column third int value
* @param change fourth string value
*/
public void change(int list, int line, int column, String change) {
lists[list].get(line).changeColumn(column, change);
Expand All @@ -127,6 +144,7 @@ public void change(int list, int line, int column, String change) {
* whole line , he inputs all the different columns otherwise he clarifies which
* column he wants to change and goes on to change it This method uses the
* method change of class Functions to do so.
* @param arrayNumberColumns array of int values
*/
public void changeChoice(int[] arrayNumberColumns) {
ex.display("Select 1 to change a whole line and 2 to change a specific column: ");
Expand Down Expand Up @@ -168,6 +186,10 @@ public void changeChoice(int[] arrayNumberColumns) {
/**
* Method to add to an already existing file named by the user file has the same
* output as the print choice above.
* @param path string value
* @param name string value
* @param names array of string values
* @param namesT array of string values
*/
public void fileAdd(String path, String name, String[]namesT, String[][] names) {
try {
Expand Down
Binary file modified Main2.class
Binary file not shown.
8 changes: 5 additions & 3 deletions Main2.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package dds.gr.aueb.dmst.crazydevelopers;
package gr.aueb.dmst.dds.CrazyDevelopers;

import dds.gr.aueb.dmst.crazydevelopers.Functions;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;

/**
* @author oneofthecraziest
*/

/*
* Main method to run the program
Expand All @@ -16,8 +18,8 @@ public class Main2 {
static String[] testnamesT;
/**
* Main method.
* @param args String Array
*/

public static void main(String[] args) {
Menu menu = new Menu(); //new Menu object called menu
int numTables = menu.openingMenu(); // User enters amount of tables for data base
Expand Down
Binary file modified Menu.class
Binary file not shown.
17 changes: 14 additions & 3 deletions Menu.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package dds.gr.aueb.dmst.crazydevelopers;
package gr.aueb.dmst.dds.CrazyDevelopers;

/*
* Class that contains all the menus needed for the program
*/
/**
* @author oneofthecraziest
*/

import java.util.Scanner;

Expand All @@ -14,7 +17,7 @@ public class Menu {
Scanner input = new Scanner(System.in);
/**
* Method that asks user to enter the number of tables for the database and
* return this integer.
* @return this integer.
*/

public int openingMenu() {
Expand All @@ -28,6 +31,7 @@ public int openingMenu() {
}
/**
* Method that prints the menu to the screen and returns the choice of the user.
* @return choice for function
*/

public int choiceForFunctions() {
Expand All @@ -42,6 +46,9 @@ public int choiceForFunctions() {
* position of the table by asking user to enter positive numbers for example if
* columnPerTable={3,5,1} means that table 1 has 3 columns , table 2 has 5
* columns, table 3 has 1 column returns this table.
* @param tables int value
* @return columnPerTable
*
*/
public int[] menuColumns(int tables) {
columnPerTable = new int[tables];
Expand All @@ -63,6 +70,7 @@ public int[] menuColumns(int tables) {
* user wants and columns the number of columns of the specific table. The user
* gives the names for each column of every table and the method inserts these names
* into the two-dimension array names[][]
* @param columnPerTable array of int values
*/
public void addNames(int[] columnPerTable) {
names = new String[columnPerTable.length][];
Expand All @@ -78,6 +86,7 @@ public void addNames(int[] columnPerTable) {
/**
* Method to give user the opportunity to name every table of the DataBase
* The table names are saved in the one-dimension array namesT[].
* @param tables int value
*/
public void nameTables(int tables) {
namesT = new String[tables];
Expand All @@ -92,6 +101,7 @@ public void nameTables(int tables) {
* or wants to use the default one (User press 1)
* The default path is C:\\Users/Public\\ and it is declared by us (User press 2)
* Returns the choice that the user makes,which is 1 or 2.
* @return choice of customer
*/
public int findChoice() {
ex.display("Enter 1 if you want it to enter the path you want to save the file in"
Expand Down Expand Up @@ -130,10 +140,11 @@ public void printModel() {
}
}

/*
/**
* Simple get methods for names[][] and namesT[]
* Will be used by Main2 class
* Useful for the addChoice() and printChoice()
* @return names
*/
public String[][] getNames() {
return names;
Expand Down

0 comments on commit b639c1e

Please sign in to comment.