合并排序部分不起作用

时间:2015-11-09 14:36:48

标签: java

/home/adam/neo4j-community-2.1.8/bin/neo4j-shell -path /home/adam/neo4j_bak9/ -c "dump" | /home/adam/neo4j-community-2.3.0/bin/neo4j-shell -file -
Transaction started
3 ms

WARNING: Invalid input 'c': expected whitespace, comment, ';' or end of input (line 2, column 1 (offset: 39))
"create index on :`Location`(`latitude`)"
 ^
ERROR (-v for expanded information):
    Transaction was marked as successful, but unable to commit transaction so rolled back.

 -host      Domain name or IP of host to connect to (default: localhost)
 -port      Port of host to connect to (default: 1337)
 -name      RMI name, i.e. rmi://<host>:<port>/<name> (default: shell)
 -pid       Process ID to connect to
 -c         Command line to execute. After executing it the shell exits
 -file      File containing commands to execute, or '-' to read from stdin. After executing it the shell exits
 -readonly  Connect in readonly mode (only for connecting with -path)
 -path      Points to a neo4j db path so that a local server can be started there
 -config    Points to a config file when starting a local server

Example arguments for remote:
    -port 1337
    -host 192.168.1.234 -port 1337 -name shell
    -host localhost -readonly
    ...or no arguments for default values
Example arguments for local:
    -path /path/to/db
    -path /path/to/db -config /path/to/neo4j.config
    -path /path/to/db -readonly

package teststudent;

//this package is for the compare to and other methods 

在这个包中我遇到了问题        包teststudent;

public class Student {
private String name;
private String status;
private int grade1;
private int grade2;
private int grade3;
private double average;
public Student(String name, int grade1, int grade2, int grade3)
{
    this.name = name;
    this.grade1 = grade1;
    this.grade2 = grade2;
    this.grade3 = grade3;
    computeAverage();
    computeStatus();

}

public double compareTo( Student s){

        return average - s.average;


        }

public void computeAverage(){
                  average = (grade1 + grade2 + grade3) / 3;
}


public void computeStatus(){
       if ( average < 70) {
            status = "Failing";
        }
        else {
            status = "Passing";
        }

}

public String getName() {
    return name;
}

public String getStatus() {
    return status;
}

public int getGrade1() {
    return grade1;
}

public int getGrade2() {
    return grade2;
}

public int getGrade3() {
    return grade3;
}

public double getAverage() {
    return average;
}

public void setName(String name) {
    this.name = name;
}

public void setStatus(String status) {
    this.status = status;
}

public void setGrade1(int grade1) {
    this.grade1 = grade1;
}

public void setGrade2(int grade2) {
    this.grade2 = grade2;
}

public void setGrade3(int grade3) {
    this.grade3 = grade3;
}

public void setAverage(double average) {
    this.average = average;
}



   }

这是用于阅读文件             而(input.hasNextLine()){                     String dataLine = input.nextLine();                     String [] data = dataLine.split(&#34; [|]&#34;);                     学生=新学生(data [0],Integer.parseInt(data [1]),Integer.parseInt(data [2]),Integer.parseInt(data [3]));                     students.add(学生);                     }

 import java.io.FileNotFoundException;
  import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.Scanner;
 import javax.swing.JFileChooser;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.Scanner;

  import javax.swing.JFileChooser;
 import javax.xml.crypto.Data;
  class StudentList {





ArrayList<Student> students = new ArrayList<>();
private Scanner input; 
private PrintWriter output;

public StudentList(){

}

public void readStudents(){
    JFileChooser fileChooser = new JFileChooser ();
    if(fileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION){
        java.io.File file = fileChooser.getSelectedFile();

        try {
            input = new Scanner(file);
        } 
        catch (FileNotFoundException e) {
            e.printStackTrace();
        }

这里是我遇到问题的地方当它进入合并排序它给我一个错误并且我不知道方式
    students.get(1).getAverage();

        input.close();
    }
    else {
        System.out.println("No file selected.");
    }
}

public  void sortStudents(){

0 个答案:

没有答案