Add display and displaySelected on NoteBook and create class TestAll
This commit is contained in:
parent
e2ed3083c9
commit
46682ae72d
2 changed files with 42 additions and 5 deletions
|
@ -1,9 +1,7 @@
|
|||
package noteBook;
|
||||
|
||||
import input.Gender;
|
||||
import input.Input;
|
||||
import input.Person;
|
||||
import input.Society;
|
||||
import input.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Scanner;
|
||||
|
@ -45,7 +43,6 @@ public class NoteBook {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addInput(Input in) {
|
||||
Input[] tmp = new Input[inputs.length+1];
|
||||
|
@ -81,4 +78,22 @@ public class NoteBook {
|
|||
System.arraycopy(tmp, 0, out, 0, out.length);
|
||||
return out;
|
||||
}
|
||||
|
||||
public void display(input.Order inputOrder, Presentation presentation, noteBook.Order noteBookOrder) {
|
||||
if (noteBookOrder == noteBook.Order.CROISSANT)
|
||||
for (Input i: inputs)
|
||||
System.out.println(i.toString(presentation, inputOrder));
|
||||
else
|
||||
for (int i = inputs.length-1; i>=0; i--)
|
||||
System.out.println(inputs[i].toString(presentation, inputOrder));
|
||||
}
|
||||
|
||||
public void displaySelected(input.Order inputOrder, Presentation presentation, noteBook.Order noteBookOrder) {
|
||||
if (noteBookOrder == noteBook.Order.CROISSANT)
|
||||
for (Input i: selected)
|
||||
System.out.println(i.toString(presentation, inputOrder));
|
||||
else
|
||||
for (int i = selected.length-1; i>=0; i--)
|
||||
System.out.println(inputs[i].toString(presentation, inputOrder));
|
||||
}
|
||||
}
|
||||
|
|
22
src/test/TestAll.java
Normal file
22
src/test/TestAll.java
Normal file
|
@ -0,0 +1,22 @@
|
|||
package test;
|
||||
|
||||
import input.Order;
|
||||
import noteBook.NoteBook;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class TestAll {
|
||||
public static void main(String[] args) throws IOException {
|
||||
NoteBook book = new NoteBook();
|
||||
book.fileReading("TestAll");
|
||||
for (input.Order iO: input.Order.values())
|
||||
for (input.Presentation p: input.Presentation.values())
|
||||
for (noteBook.Order nO: noteBook.Order.values())
|
||||
book.display(iO, p, nO);
|
||||
book.select("Florian");
|
||||
for (input.Order iO: input.Order.values())
|
||||
for (input.Presentation p: input.Presentation.values())
|
||||
for (noteBook.Order nO: noteBook.Order.values())
|
||||
book.displaySelected(iO, p, nO);
|
||||
}
|
||||
}
|
Reference in a new issue