fix: fixing some syntax errors (part 1)
This commit is contained in:
@@ -41,6 +41,11 @@
|
|||||||
<artifactId>junit-jupiter-params</artifactId>
|
<artifactId>junit-jupiter-params</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-csv</artifactId>
|
||||||
|
<version>1.14.1</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -24,9 +24,10 @@ public class FileDataSource implements DataSource{
|
|||||||
MyList<Student> resultList = new MyLinkedList<>();
|
MyList<Student> resultList = new MyLinkedList<>();
|
||||||
try {
|
try {
|
||||||
StudentCsvReader reader = new StudentCsvReader(fileName);
|
StudentCsvReader reader = new StudentCsvReader(fileName);
|
||||||
while reader.hasNext() {
|
while (reader.hasNext()) {
|
||||||
result.append(reader.next());
|
resultList.add(reader.next());
|
||||||
}
|
}
|
||||||
|
return resultList;
|
||||||
}
|
}
|
||||||
catch (IllegalArgumentException e){
|
catch (IllegalArgumentException e){
|
||||||
System.out.println(e.getMessage());
|
System.out.println(e.getMessage());
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import java.nio.file.StandardOpenOption;
|
|||||||
import ru.project.student.Student;
|
import ru.project.student.Student;
|
||||||
import ru.project.collection.MyList;
|
import ru.project.collection.MyList;
|
||||||
import ru.project.collection.MyLinkedList;
|
import ru.project.collection.MyLinkedList;
|
||||||
import ru.project.collection.Iterator;
|
//import ru.project.collection.Iterator;
|
||||||
|
|
||||||
public class FileWriter {
|
public class FileWriter {
|
||||||
private Path path;
|
private Path path;
|
||||||
@@ -24,11 +24,11 @@ public class FileWriter {
|
|||||||
StandardOpenOption.CREATE,
|
StandardOpenOption.CREATE,
|
||||||
StandardOpenOption.APPEND
|
StandardOpenOption.APPEND
|
||||||
)) {
|
)) {
|
||||||
Iterator iterator = list.getIterator();
|
/*Iterator iterator = list.getIterator();
|
||||||
while (iterator.hasNext()){
|
while (iterator.hasNext()){
|
||||||
writer.write(iterator.next().toFileString());
|
writer.write(iterator.next().toFileString());
|
||||||
writer.newLine();
|
writer.newLine();
|
||||||
}
|
}*/
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,9 @@ public class ManualDataSource implements DataSource{
|
|||||||
String groupNumber,
|
String groupNumber,
|
||||||
double averageGrade,
|
double averageGrade,
|
||||||
int recordBookNumber
|
int recordBookNumber
|
||||||
){}
|
){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public MyList<Student> create() {
|
public MyList<Student> create() {
|
||||||
MyList<Student> result = new MyLinkedList<>();
|
MyList<Student> result = new MyLinkedList<>();
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class RandomDataSource implements DataSource{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String getRandomGroupNumber(Random random){
|
private String getRandomGroupNumber(Random random){
|
||||||
char prefix = (char)(random.nextInt(26) + (int)'A')4
|
char prefix = (char)(random.nextInt(26) + (int)'A');
|
||||||
String result = prefix + String.format("%02d", random.nextInt(100));
|
String result = prefix + String.format("%02d", random.nextInt(100));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,7 @@ public class RandomDataSource implements DataSource{
|
|||||||
@Override
|
@Override
|
||||||
public MyList<Student> create() {
|
public MyList<Student> create() {
|
||||||
if (upperBounRecordBookNumber < 0)
|
if (upperBounRecordBookNumber < 0)
|
||||||
throw new IllegalException("The upper bound is negative!!!");
|
throw new IllegalArgumentException("The upper bound is negative!!!");
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
MyList<Student> result = new MyLinkedList<>();
|
MyList<Student> result = new MyLinkedList<>();
|
||||||
for (short i = 0; i<size; i++){
|
for (short i = 0; i<size; i++){
|
||||||
|
|||||||
Reference in New Issue
Block a user