[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] New to Aspectj

Hi,

I've converted the files to .aj files and i've got the AspectJ AJDT
extention as well as made sure the project is AspectJ, im using the eclipse
3.6 editor with the AJDT to edit the code but im still getting the same
problems is the full code for the class in case i havent added something
should have.

import java.util.ArrayList;

public class RaceSim {

	public static void main(String[] args) {
		
		

        //Creating 8 heats
		Heat heat1Round1 = new Heat1();
		Heat heat2Round1 = new Heat2();
		Heat heat3Round1 = new Heat3();
		Heat heat4Round1 = new Heat4();
		Heat heat5Round1 = new Heat5();
		Heat heat6Round1 = new Heat6();
		Heat heat7Round1 = new Heat7();
		Heat heat8Round1 = new Heat8();
		
		
		  Runner[] r = new Runner[65];  
	     
		  
        for(int i = 1; i <= 64; i++) {  
        	
               r[i] = new Runner("firstname "+i, "lastname "+i, 0.00); 
          
		 }  

		
        int count=1;
        
        for(int i=1; i<=64;i++){
        	
        	if(count<=8){
        		heat1Round1.addRunner(r[i]);
        	}
        	else if(count<=16){
        		
        		
        		heat2Round1.addRunner(r[i]);
        		
        	}else if(count<=24){
        		
        		heat3Round1.addRunner(r[i]);
        		
        	}else if(count<=32){
        		
        	
        		heat4Round1.addRunner(r[i]);
        		
        	}else if(count<=40){
        		
        		heat5Round1.addRunner(r[i]);
        		
        	}else if(count<=48){
        		
        		heat6Round1.addRunner(r[i]);
        		
        	}else if(count<=56){
        		
        		heat7Round1.addRunner(r[i]);
        		
        	}else {
        		
        		heat8Round1.addRunner(r[i]);
        		
        	}
        	
        	
        	
        		count+=1;
         }
    	Round round1 = new Round1();
    	
    		
    	round1.addHeat(heat1Round1);
		round1.addHeat(heat2Round1);
		round1.addHeat(heat3Round1);
		round1.addHeat(heat4Round1);
		round1.addHeat(heat5Round1);
		round1.addHeat(heat6Round1);
		round1.addHeat(heat7Round1);
		round1.addHeat(heat8Round1);
    	round1.displayRunners();   
	
		heat1Round1.runRace();
		heat2Round1.runRace();
		heat3Round1.runRace();
		heat4Round1.runRace();
		heat5Round1.runRace();
		heat6Round1.runRace();
		heat7Round1.runRace();
		heat8Round1.runRace();
				
		//Finding winners for heats
		heat1Round1.getWinnersFromHeat();
		heat2Round1.getWinnersFromHeat();
		heat3Round1.getWinnersFromHeat();
		heat4Round1.getWinnersFromHeat();
		heat5Round1.getWinnersFromHeat();
		heat6Round1.getWinnersFromHeat();
		heat7Round1.getWinnersFromHeat();
		heat8Round1.getWinnersFromHeat();
		
		aspect SimpleTracing {
		    pointcut tracedCall():
		        call(void round1.displayHeats());
			

		    before(): traceCall() {
		    	System.out.println("Entering: " + thisJoinPoint);
		    }
    	}	
		

		
		//creating heats for round2
		Heat heat1Round2 =new Heat1();
		Heat heat2Round2 =new Heat2();
		Heat heat3Round2 =new Heat3();
		Heat heat4Round2 =new Heat4();
		//getting previous winners form heats from round 1	
		heat1Round2.getWinnersFromPreviousRound(heat1Round1);
		heat1Round2.getWinnersFromPreviousRound(heat2Round1);
		heat2Round2.getWinnersFromPreviousRound(heat3Round1);
		heat2Round2.getWinnersFromPreviousRound(heat4Round1);
		heat3Round2.getWinnersFromPreviousRound(heat5Round1);
		heat3Round2.getWinnersFromPreviousRound(heat6Round1);
		heat4Round2.getWinnersFromPreviousRound(heat7Round1);
		heat4Round2.getWinnersFromPreviousRound(heat8Round1);
		
		//running race with combined winners of first heats from round 1
		heat1Round2.runRace();
		heat2Round2.runRace();
		heat3Round2.runRace();
		heat4Round2.runRace();
		
		//getting winners
		heat1Round2.getWinnersFromHeat();
		heat2Round2.getWinnersFromHeat();
		heat3Round2.getWinnersFromHeat();
		heat4Round2.getWinnersFromHeat();
		
		//creating round 2
		Round round2 = new Round2();
		//adding heat 1 to round 2
		round2.addHeat(heat1Round2);
		round2.addHeat(heat2Round2);
		round2.addHeat(heat3Round2);
		round2.addHeat(heat4Round2);
		//displaying heat 1 round 2 
		round2.displayHeats();

		Heat semiFinal1 =new Heat1();
		Heat semiFinal2 =new Heat2();
		
		semiFinal1.getWinnersFromPreviousRound(heat1Round2);
		semiFinal1.getWinnersFromPreviousRound(heat2Round2);
		semiFinal2.getWinnersFromPreviousRound(heat3Round2);
		semiFinal2.getWinnersFromPreviousRound(heat4Round2);
	
		semiFinal1.runRace();
		semiFinal2.runRace();
		
		semiFinal1.getWinnersFromHeat();
		semiFinal2.getWinnersFromHeat();
		
		Round semiFinal = new semiFinal();
	
		semiFinal.addHeat(semiFinal1);
		semiFinal.addHeat(semiFinal2);
		
		
		semiFinal.displayHeats();
		
		
		Heat Final =new Heat1();
	
		
		Final.getWinnersFromPreviousRound(semiFinal1);
		Final.getWinnersFromPreviousRound(semiFinal2);
		
		Final.runRace();
		
		
		Final.getWinnersFromFinal();
		
		Round round4 = new Round4();
		
		round4.addHeat(Final);
				
		round4.displayHeats();
		
		}
}
-- 
View this message in context: http://aspectj.2085585.n4.nabble.com/New-to-Aspectj-tp3042137p3042287.html
Sent from the AspectJ - users mailing list archive at Nabble.com.