/* This file was generated by Contract AspectJ v0.1 on Sat Nov 06 14:08:33 EST 2004 */ /** CONAJ: Original packages **/ package jsim.event; /** CONAJ: Imports needed by CONAJ **/ import org.aspectj.lang.*; import java.util.*; /** CONAJ: Original imports **/ import jsim.queue.*; privileged aspect Scheduler_Contract { declare parents : Scheduler implements Cloneable; public Object Scheduler.clone(){ try { return super.clone(); } catch (Exception e){ System.out.println(" Error in cloning method"); e.printStackTrace(); return new Object(); } } Scheduler old; pointcut scope(): !within(Scheduler_Contract) && !cflow(withincode(* Scheduler_Contract.*(..))); pointcut Scheduler_schedule1(Scheduler trg_instance, Event event,double timeDelay):call( public * Scheduler.schedule(..)) && !call(public * (Scheduler+ && !Scheduler).schedule(..)) && args(event,timeDelay) && target(trg_instance) && scope(); pointcut cast_Scheduler_schedule1(Scheduler trg_instance, Event event,double timeDelay):!(call( public * Scheduler.schedule(..))) && execution(public * Scheduler.schedule(..)) && !execution( public * (Scheduler+ && !Scheduler).schedule(..)) && args(event,timeDelay) && target(trg_instance) && scope(); pointcut Scheduler_schedule2(Scheduler trg_instance, Event event,double timeDelay,int priority):call( public * Scheduler.schedule(..)) && !call(public * (Scheduler+ && !Scheduler).schedule(..)) && args(event,timeDelay,priority) && target(trg_instance) && scope(); pointcut cast_Scheduler_schedule2(Scheduler trg_instance, Event event,double timeDelay,int priority):!(call( public * Scheduler.schedule(..))) && execution(public * Scheduler.schedule(..)) && !execution( public * (Scheduler+ && !Scheduler).schedule(..)) && args(event,timeDelay,priority) && target(trg_instance) && scope(); pointcut Scheduler_startSim1(Scheduler trg_instance):call( public * Scheduler.startSim(..)) && !call(public * (Scheduler+ && !Scheduler).startSim(..)) && target(trg_instance) && scope(); pointcut cast_Scheduler_startSim1(Scheduler trg_instance):!(call( public * Scheduler.startSim(..))) && execution(public * Scheduler.startSim(..)) && !execution( public * (Scheduler+ && !Scheduler).startSim(..)) && target(trg_instance) && scope(); pointcut Scheduler_currentTime1(Scheduler trg_instance):call( public * Scheduler.currentTime(..)) && !call(public * (Scheduler+ && !Scheduler).currentTime(..)) && target(trg_instance) && scope(); pointcut cast_Scheduler_currentTime1(Scheduler trg_instance):!(call( public * Scheduler.currentTime(..))) && execution(public * Scheduler.currentTime(..)) && !execution( public * (Scheduler+ && !Scheduler).currentTime(..)) && target(trg_instance) && scope(); before(Scheduler trg_instance , Event event,double timeDelay ): Scheduler_schedule1( trg_instance , event,timeDelay ){ boolean res = checkPre_schedule( trg_instance , event,timeDelay); boolean next = true ; // LJH System.out.println("I am here!"); if (!res){ System.out.println(" *** PRE CONDITION ERROR in Scheduler in Method: schedule"); System.exit(1); }if (!next) { System.out.println(" *** PRE HIER ERROR in Scheduler in Method: schedule"); System.exit(1); } } before(Scheduler trg_instance , Event event,double timeDelay ): cast_Scheduler_schedule1( trg_instance, event,timeDelay ){ String staticType = thisJoinPoint.getSignature().getDeclaringType().getName(); String dynamicType = thisJoinPoint.getTarget().getClass().getName(); boolean hierResult = (true); boolean res = checkPre_schedule( trg_instance , event,timeDelay); if (hierResult && ! res){ System.out.println(" **** CAST PRE HIER ERROR Scheduler in Method: schedule"); System.out.println("[conaj-ERROR]: ***** staticType "+staticType+" **** dynamicType "+dynamicType+" SIG ==> "+ thisJoinPoint.getSignature().toLongString());System.exit(1); } } before(Scheduler trg_instance , Event event,double timeDelay,int priority ): Scheduler_schedule2( trg_instance , event,timeDelay,priority ){ boolean res = checkPre_schedule( trg_instance , event,timeDelay,priority); boolean next = true ; if (!res){ System.out.println(" *** PRE CONDITION ERROR in Scheduler in Method: schedule"); System.exit(1); }if (!next) { System.out.println(" *** PRE HIER ERROR in Scheduler in Method: schedule"); System.exit(1); } } before(Scheduler trg_instance , Event event,double timeDelay,int priority ): cast_Scheduler_schedule2( trg_instance, event,timeDelay,priority ){ String staticType = thisJoinPoint.getSignature().getDeclaringType().getName(); String dynamicType = thisJoinPoint.getTarget().getClass().getName(); boolean hierResult = (true); boolean res = checkPre_schedule( trg_instance , event,timeDelay,priority); if (hierResult && ! res){ System.out.println(" **** CAST PRE HIER ERROR Scheduler in Method: schedule"); System.out.println("[conaj-ERROR]: ***** staticType "+staticType+" **** dynamicType "+dynamicType+" SIG ==> "+ thisJoinPoint.getSignature().toLongString());System.exit(1); } } public boolean checkPre_schedule(Scheduler trg_instance,Event event,double timeDelay){ if(event!=null&&timeDelay>0) return true; else return false; } public boolean checkPreHier_schedule(Scheduler trg_instance,Event event,double timeDelay){ boolean myPre = checkPre_schedule( trg_instance , event,timeDelay); boolean hierarchy = (true); if (!hierarchy || myPre) return myPre; else return false; } public boolean checkPre_schedule(Scheduler trg_instance,Event event,double timeDelay,int priority){ if(event!=null&&timeDelay>0&&priority>=0&&priority<=10) return true; else return false; } public boolean checkPreHier_schedule(Scheduler trg_instance,Event event,double timeDelay,int priority){ boolean myPre = checkPre_schedule( trg_instance , event,timeDelay,priority); boolean hierarchy = (true); if (!hierarchy || myPre) return myPre; else return false; } }