<commit_before>package wind07.gpacalculator;

import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import android.widget.TextView;

import java.util.Locale;

import static wind07.gpacalculator.MainActivity.modList;

public class GPA extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_gpa);
        Intent intent = getIntent();

        TextView lblGPA = (TextView) findViewById(R.id.lblGPA);

        double gradepoint = 0.0;
        double sumcredxgradepoint = 0.0;
        double sumcreditpoint = 0.0;
        double gpa = 0.0;

        for (int i = 0 ; i < modList.size() ; i++){
            if (modList.get(i).grade.equals("AD/A+/A"))
                gradepoint = 4;
            else if (modList.get(i).grade.equals("B+"))
                gradepoint = 3.5;
            else if (modList.get(i).grade.equals("B"))
                gradepoint = 3;
            else if (modList.get(i).grade.equals("C+"))
                gradepoint = 2.5;
            else if (modList.get(i).grade.equals("C"))
                gradepoint = 2;
            else if (modList.get(i).grade.equals("D+"))
                gradepoint = 1.5;
            else if (modList.get(i).grade.equals("D"))
                gradepoint = 1;
            else if (modList.get(i).grade.equals("F"))
                gradepoint = 0;
            sumcredxgradepoint += modList.get(i).credUnits * gradepoint;
            sumcreditpoint += modList.get(i).credUnits;
        }
        gpa = sumcredxgradepoint/sumcreditpoint;
        String gpaRounded = String.format(Locale.ENGLISH,"%.2f", gpa);
        lblGPA.setText(gpaRounded);

    }
}<commit_msg>GPA: Use switch case to determine credit grade point<commit_after>package wind07.gpacalculator;

import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import android.widget.TextView;

import java.util.Locale;

import static wind07.gpacalculator.MainActivity.modList;

public class GPA extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_gpa);
        Intent intent = getIntent();

        TextView lblGPA = (TextView) findViewById(R.id.lblGPA);

        double gradepoint = 0.0;
        double sumcredxgradepoint = 0.0;
        double sumcreditpoint = 0.0;
        double gpa = 0.0;

        for (int i = 0 ; i < modList.size() ; i++){

            switch (modList.get(i).grade){
                case "AD/A+/A":
                    gradepoint = 4;
                    break;
                case "B+":
                    gradepoint = 3.5;
                    break;
                case "B":
                    gradepoint = 3;
                    break;
                case "C+":
                    gradepoint = 2.5;
                    break;
                case "C":
                    gradepoint = 2;
                    break;
                case "D+":
                    gradepoint = 1.5;
                    break;
                case "F":
                    gradepoint = 0;
                    break;
            }
            sumcredxgradepoint += modList.get(i).credUnits * gradepoint;
            sumcreditpoint += modList.get(i).credUnits;
        }
        gpa = sumcredxgradepoint/sumcreditpoint;
        String gpaRounded = String.format(Locale.ENGLISH,"%.2f", gpa);
        lblGPA.setText(gpaRounded);

    }
}
{'fraction_non_alphanumeric': 0.10972636141966946, 'fraction_numerical': 0.013275535085342726, 'mean_word_length': 1.7927382753403933, 'pattern_counts': {'":': 7, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2971904', 'n_tokens_mistral': 1157, 'n_tokens_neox': 1072, 'n_words': 218}