All pastes #382065 Raw Edit

Stuff

public java v1 · immutable
·published 2007-03-05 08:27 UTC
rendered paste body
    /** Takes an arraylist of integers and returns true if there is a mistake*/    public Boolean check(ArrayList<Integer> s2)    {    	try    	{	    	if(counter<text.length())	    	{		        Boolean mistype = false;		        char[] text1 = text.toCharArray();		        		        for(int i = 0;i<s2.size();i++)		        {		        	try		        	{			        	if(first)			        	{			        		Date today = new Date();			        		start = today.getTime();			        		first = false;			        	}			        	overall++;			        	/**/if (s2.get(i) == 95)			        	{			        		counter = counter + 10;			        	}			        	else/**/ if(text1[(counter)]==s2.get(i))			            {			        		counter++;			            	int place = (s2.get(i));			            	NTypeStatsObject curr = StatsObjects.get(place);			            	curr.setCor(curr.getCor()+1);			            	StatsObjects.set(place, curr);			            }			            else if((counter<(text.length()-2)) && (text1[(counter+1)]==s2.get(i)) && ((counter+1) < (overall)))			            {			            	wrongind.add(counter); // ADDED BY ANNA			                int place = text1[(counter+1)]-32;			            	NTypeStatsObject curr = StatsObjects.get(place);			            	curr = StatsObjects.get(place);			            	curr.setCor(curr.getCor()+1);			            	StatsObjects.set(place, curr);			            	counter = counter + 2;			            	//System.out.println(curr.display());			            }			            else			            {			            	mistype = true;			                errors++;			                int place = text1[(counter)];			            	NTypeStatsObject curr = StatsObjects.get(place);			            	curr.setMis(curr.getMis()+1);			            	StatsObjects.set(place, curr);			                int b = s2.get(i);			                wrong = wrong + (char)b;			                wrongind.add(counter); // ADDED BY ANNA			                wrongcount++;			            }			        	endoftext();		        	}		        	catch(ArrayIndexOutOfBoundsException e)		        	{		        		System.out.println("s2: " + s2 + " i: " + i);		        		System.out.println("text.length: " + text.length() + ", counter: " + counter + ", overall:" + overall);		        	}		        }		        return mistype;	    	}	    	return true;    	}    	catch(ArrayIndexOutOfBoundsException e)    	{    		System.out.println("s2: " + s2);    		System.out.println("text.length: " + text.length() + ", counter: " + counter + ", overall:" + overall);    		return true;    	}    }