<commit_before>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package analogsection;

import java.util.ArrayList;
import java.util.Arrays;
import javax.swing.JOptionPane;

/**
 *
 * @author Hassan
 */
public class WoodQuiz extends Quiz {
        //public String [] question;
        //protected String[] correctAnswer;
        protected String[][] QandA;
        private int[] binarysort;
        private String quest;
        private String Ans;
        private int arrcount;
        private Integer a;
        QuizScreen quizgui = new QuizScreen();
        public WoodQuiz(){
         arrcount = 0;
         a = null;
         binarysort = new int[10];
         //this is a 2d array to set up questions correctanswers and two incorrect answers
        
         //to input your own answer put them in the first array row/container
         //the correct answer must be put in the second row/container and must be in the same index as the question in referes to (in its own row.container)
         //the next two rows or containers are your chosen incorrect answers these work the same as the previous rows/containers
         //the last row/container is what radio button you want your correct answer to be in this must be either a,b or c other wise you will get an error
         //all containers must contain 20 values
         QandA = new String[][]{{" What type of wood comes from evergreen trees?","_______ grow very quickly?","Scots pine is an example of what type of wood?","Which type of wood is generally used in making ladders?","________ is generally used for all inside work?","Which type of softwood is know for being able to resist infestation?","Which type of softwood is know for its ability to resist splitting?","Which type of wood is generally used for saunas/ steam rooms?","Which type of Hardwood is generally used for furniture?","Which hardwood is known for having a cross grain structure?","Which hardwood is known for being both strong and tough?","Which hardwood is mainly used in laminating?","Which manufactured wood is made from wood fibres glued togehter?","How is plywood made?","hardboard is mainly used in making what?","How is Chipboard made?","Ash is an example of what type of wood?","Plywood is an example of waht type of wood?","What type of wood comes from decidioud trees?","Which type of wood is the cheapest?"},{"Softwood","Softwoods","Softwood","Doughlas Fir","Scots pine","Ceder","Spruce","Ceder","Oak","Elm","Beech","Ash","Medium density fibreboard","By gluing togehter pieces of softwood","Wardrobes","Gluing together wood particles under heat and pressure","Hardwood","Manufactured","Hardwood","Manufactures"},{"wrong 1","wrong 2","wrong 3","wrong 4","wrong 5","wrong 6","wrong 7",},{"wrong 1","wrong 2","wrong 3","wrong 4","wrong 5","wrong 6","wrong 7","wrong 8","wrong 9","wrong 1"},{"b","a","a","c","a","c","b","a","c","c","b","c","b","a","a","b","b","c","a","c"}};
         //question = new String[]{"b","a","a","c","a","c","b","a","c","c","b","c","b","a","a","b","b","c","a","c"};
        // correctAnswer = new String[]{"b","a","a","c","a","c","b","a","c","c","b","c","b","a","a","b","b","c","a","c"};
        }
    
    
        public void choseRandomQuestion(){
             
       
          for(int counter = 0; counter < 10; counter++){
               obj = new QuestionObj();
            //saves the values of the question going to be asked
            //values being declared inside loop as they are not needed outside loop there for they will not be there outside of the loop
              int i = 0;
              //temp claims its not being used because it cannot see inside the do while loop
              int temp = 0;
              int tempbin = 0;
              temp = rand.nextInt(20);
              String work = new String();
            do{
                //using if statement because i doesnt seem to reset out side of if statement there for same questions are being asked
                if(i != 0){
                i= 0;
                }
               
                tempbin = 1;
                
               
                
                //tempbin not needed outside array. for if statement to see if question alrady exsists more explained next time its used
                
                //this will run only once during the entirety of both loops as this is to only put first value in the array 
                if(counter == 0 && a == null){
                i=1;
                a = 1;
                temp = rand.nextInt(20);
                binarysort[counter] = temp;
                chosenquestions[counter] = temp;
                //randomizedQuestion[counter] = question[chosenquestions[counter]];
                
                //obj.setquestion(question[chosenquestions[counter]]);
                //obj.setanswer(correctAnswer[chosenquestions[counter]]);
                obj.setquestion(QandA[0][chosenquestions[counter]]);
                obj.setanswer(QandA[1][chosenquestions[counter]]);
                obj.setincorrect1(QandA[2][chosenquestions[counter]]);
                obj.setincorrect2(QandA[3][chosenquestions[counter]]);
                obj.setrad(QandA[4][chosenquestions[counter]]);
                objArr.add(obj);
                }
                else{
                //getting binarysort ready for checking 
                Arrays.sort(binarysort);
                //cheking binarysort to see if value of temp alrady exsits if it exsists the value in tempbin will be a positive number
                //if value does not exsist then value in tempbin will be negitive
                tempbin = Arrays.binarySearch(binarysort,temp);
                
               
                //if value of tempbin is negitive the question will be put into the question list to ask user. if value is positive question will be chosen again
                // this is a test JOptionPane.showMessageDialog(null,"test" + tempbin + " " +  Arrays.toString(chosenquestions) + Arrays.toString(binarysort) + " " + temp);
                if(tempbin < 0){
                    //this adds the first values
                   
                    binarysort[counter] = temp;
                    //JOptionPane.showMessageDialog(null,"test" + tempbin + " " +  chosenquestions + " " + temp);
                    //number stored in temp will be stored in chosenquestion array for checking if user input matches later on
                    chosenquestions[counter] = temp;
                    //number in chosenquestions[index number is in] will tell question where the question wanted is stored then the question is stored in randomizedQuestion
                    //randomizedQuestion[counter] = question[chosenquestions[counter]];
                    //randomizedQuestion[counter] = question[chosenquestions[counter]];
             
                    //obj.setquestion(work);
                    //obj.setanswer(correctAnswer[chosenquestions[counter]]);
                    obj.setquestion(QandA[0][chosenquestions[counter]]);
                    obj.setanswer(QandA[1][chosenquestions[counter]]);
                    obj.setincorrect1(QandA[2][chosenquestions[counter]]);
                    obj.setincorrect2(QandA[3][chosenquestions[counter]]);
                    obj.setrad(QandA[4][chosenquestions[counter]]);
                    objArr.add(obj);
                    //sets i to 1 to end loop
                    i = 1;
                }
                else if(tempbin >= 0){
                    //picks new question and stores question in temp
                    temp = rand.nextInt(20);
                    //sets i to 0 to re-run loop and check if chosen question is already in array
                    i = 0;
                }
                else{
                    //error checking
                JOptionPane.showMessageDialog(null,"something went wrong");
                }
                }
                //JOptionPane.showMessageDialog(null, i);
            }while(i != 1);
            } // end of loop  
            //returns value to ask user questions
        //return randomizedQuestion;
        //this is a test JOptionPane.showMessageDialog(null,objArr.get(0).getquestion() + " "+ objArr.get(1).getquestion() + " " + objArr.get(2).getquestion() + " array=" + randomizedQuestion[0] + " " + randomizedQuestion[1] + " " + randomizedQuestion[9]);
       //quizgui.setarr(objArr);
         //quizgui.setarr(randomizedQuestion);
         quizgui.setobjarr(objArr);
         
         
    }
 
    
    
}
<commit_msg>shit pusher 2015<commit_after>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package analogsection;

import java.util.ArrayList;
import java.util.Arrays;
import javax.swing.JOptionPane;

/**
 *
 * @author Hassan
 */
public class WoodQuiz extends Quiz {
        //public String [] question;
        //protected String[] correctAnswer;
        protected String[][] QandA;
        private int[] binarysort;
        private String quest;
        private String Ans;
        private int arrcount;
        private Integer a;
        QuizScreen quizgui = new QuizScreen();
        public WoodQuiz(){
         arrcount = 0;
         a = null;
         binarysort = new int[10];
         //this is a 2d array to set up questions correctanswers and two incorrect answers
        
         //to input your own answer put them in the first array row/container
         //the correct answer must be put in the second row/container and must be in the same index as the question in referes to (in its own row.container)
         //the next two rows or containers are your chosen incorrect answers these work the same as the previous rows/containers
         //the last row/container is what radio button you want your correct answer to be in this must be either a,b or c other wise you will get an error
         //all containers must contain 20 values
         QandA = new String[][]{{" What type of wood comes from evergreen trees?","_______ grow very quickly?","Scots pine is an example of what type of wood?","Which type of wood is generally used in making ladders?","________ is generally used for all inside work?","Which type of softwood is know for being able to resist infestation?","Which type of softwood is know for its ability to resist splitting?","Which type of wood is generally used for saunas/ steam rooms?","Which type of Hardwood is generally used for furniture?","Which hardwood is known for having a cross grain structure?","Which hardwood is known for being both strong and tough?","Which hardwood is mainly used in laminating?","Which manufactured wood is made from wood fibres glued togehter?","How is plywood made?","hardboard is mainly used in making what?","How is Chipboard made?","Ash is an example of what type of wood?","Plywood is an example of waht type of wood?","What type of wood comes from decidioud trees?","Which type of wood is the cheapest?"},
             {"Softwood","Softwoods","Softwood","Doughlas Fir","Scots pine","Ceder","Spruce","Ceder","Oak","Elm","Beech","Ash","Medium density fibreboard","By gluing togehter pieces of softwood","Wardrobes","Gluing together wood particles under heat and pressure","Hardwood","Manufactured","Hardwood","Manufactures"},
             {"1","2","3","4","wrong 5","wrong 6","wrong 7","wrong 8","wrong 9","wrong 10","wrong 11","wrong 12","wrong 13","wrong 14","wrong 15","wrong 16","wrong 17","wrong 18","wrong 19","wrong 20"},
             {"1","2","3","4","wrong 5","wrong 6","wrong 7","wrong 8","wrong 9","wrong 10","wrong 11","wrong 12","wrong 13","wrong 14","wrong 15","wrong 16","wrong 17","wrong 18","wrong 19","wrong 20"},
             {"b","a","a","c","a","c","b","a","c","c","b","c","b","a","a","b","b","c","a","c"}};
         //question = new String[]{"b","a","a","c","a","c","b","a","c","c","b","c","b","a","a","b","b","c","a","c"};
        // correctAnswer = new String[]{"b","a","a","c","a","c","b","a","c","c","b","c","b","a","a","b","b","c","a","c"};
        }
    
    
        public void choseRandomQuestion(){
             
       
          for(int counter = 0; counter < 10; counter++){
               obj = new QuestionObj();
            //saves the values of the question going to be asked
            //values being declared inside loop as they are not needed outside loop there for they will not be there outside of the loop
              int i = 0;
              //temp claims its not being used because it cannot see inside the do while loop
              int temp = 0;
              int tempbin = 0;
              temp = rand.nextInt(20);
              String work = new String();
            do{
                //using if statement because i doesnt seem to reset out side of if statement there for same questions are being asked
                if(i != 0){
                i= 0;
                }
               
                tempbin = 1;
                
               
                
                //tempbin not needed outside array. for if statement to see if question alrady exsists more explained next time its used
                
                //this will run only once during the entirety of both loops as this is to only put first value in the array 
                if(counter == 0 && a == null){
                i=1;
                a = 1;
                temp = rand.nextInt(20);
                binarysort[counter] = temp;
                chosenquestions[counter] = temp;
                //randomizedQuestion[counter] = question[chosenquestions[counter]];
                
                //obj.setquestion(question[chosenquestions[counter]]);
                //obj.setanswer(correctAnswer[chosenquestions[counter]]);
                obj.setquestion(QandA[0][chosenquestions[counter]]);
                obj.setanswer(QandA[1][chosenquestions[counter]]);
                obj.setincorrect1(QandA[2][chosenquestions[counter]]);
                obj.setincorrect2(QandA[3][chosenquestions[counter]]);
                obj.setrad(QandA[4][chosenquestions[counter]]);
                objArr.add(obj);
                }
                else{
                //getting binarysort ready for checking 
                Arrays.sort(binarysort);
                //cheking binarysort to see if value of temp alrady exsits if it exsists the value in tempbin will be a positive number
                //if value does not exsist then value in tempbin will be negitive
                tempbin = Arrays.binarySearch(binarysort,temp);
                
               
                //if value of tempbin is negitive the question will be put into the question list to ask user. if value is positive question will be chosen again
                // this is a test JOptionPane.showMessageDialog(null,"test" + tempbin + " " +  Arrays.toString(chosenquestions) + Arrays.toString(binarysort) + " " + temp);
                if(tempbin < 0){
                    //this adds the first values
                   
                    binarysort[counter] = temp;
                    //JOptionPane.showMessageDialog(null,"test" + tempbin + " " +  chosenquestions + " " + temp);
                    //number stored in temp will be stored in chosenquestion array for checking if user input matches later on
                    chosenquestions[counter] = temp;
                    //number in chosenquestions[index number is in] will tell question where the question wanted is stored then the question is stored in randomizedQuestion
                    //randomizedQuestion[counter] = question[chosenquestions[counter]];
                    //randomizedQuestion[counter] = question[chosenquestions[counter]];
             
                    //obj.setquestion(work);
                    //obj.setanswer(correctAnswer[chosenquestions[counter]]);
                    obj.setquestion(QandA[0][chosenquestions[counter]]);
                    obj.setanswer(QandA[1][chosenquestions[counter]]);
                    obj.setincorrect1(QandA[2][chosenquestions[counter]]);
                    obj.setincorrect2(QandA[3][chosenquestions[counter]]);
                    obj.setrad(QandA[4][chosenquestions[counter]]);
                    objArr.add(obj);
                    //sets i to 1 to end loop
                    i = 1;
                }
                else if(tempbin >= 0){
                    //picks new question and stores question in temp
                    temp = rand.nextInt(20);
                    //sets i to 0 to re-run loop and check if chosen question is already in array
                    i = 0;
                }
                else{
                    //error checking
                JOptionPane.showMessageDialog(null,"something went wrong");
                }
                }
                //JOptionPane.showMessageDialog(null, i);
            }while(i != 1);
            } // end of loop  
            //returns value to ask user questions
        //return randomizedQuestion;
        //this is a test JOptionPane.showMessageDialog(null,objArr.get(0).getquestion() + " "+ objArr.get(1).getquestion() + " " + objArr.get(2).getquestion() + " array=" + randomizedQuestion[0] + " " + randomizedQuestion[1] + " " + randomizedQuestion[9]);
       //quizgui.setarr(objArr);
         //quizgui.setarr(randomizedQuestion);
         quizgui.setobjarr(objArr);
         
         
    }
 
    
    
}

{'fraction_non_alphanumeric': 0.1129270230393826, 'fraction_numerical': 0.010498240835319486, 'mean_word_length': 2.114704842700601, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, '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': '3860973', 'n_tokens_mistral': 4802, 'n_tokens_neox': 4379, 'n_words': 1557}