/* This file was generated by Contract AspectJ v0.1 on Sat Nov 06 14:12:10 EST 2004 */ /** CONAJ: Original packages **/ package jsim.queue; /** CONAJ: Imports needed by CONAJ **/ import org.aspectj.lang.*; import java.util.*; /** CONAJ: Original imports **/ privileged aspect TQ_Node_Contract { declare parents : TQ_Node implements Cloneable; public Object TQ_Node.clone(){ try { return super.clone(); } catch (Exception e){ System.out.println(" Error in cloning method"); e.printStackTrace(); return new Object(); } } TQ_Node old; pointcut scope(): !within(TQ_Node_Contract) && !cflow(withincode(* TQ_Node_Contract.*(..))); pointcut TQ_Node_compare1(TQ_Node trg_instance, TQ_Node that):call( public * TQ_Node.compare(..)) && !call(public * (TQ_Node+ && !TQ_Node).compare(..)) && args(that) && target(trg_instance) && scope(); pointcut cast_TQ_Node_compare1(TQ_Node trg_instance, TQ_Node that):!(call( public * TQ_Node.compare(..))) && execution(public * TQ_Node.compare(..)) && !execution( public * (TQ_Node+ && !TQ_Node).compare(..)) && args(that) && target(trg_instance) && scope(); pointcut TQ_Node_getTime1(TQ_Node trg_instance):call( public * TQ_Node.getTime(..)) && !call(public * (TQ_Node+ && !TQ_Node).getTime(..)) && target(trg_instance) && scope(); pointcut cast_TQ_Node_getTime1(TQ_Node trg_instance):!(call( public * TQ_Node.getTime(..))) && execution(public * TQ_Node.getTime(..)) && !execution( public * (TQ_Node+ && !TQ_Node).getTime(..)) && target(trg_instance) && scope(); // PCD for Invariant pointcut TQ_Node_invariant(TQ_Node trg_instance):call(public * TQ_Node.*(..)) && !call(public * (TQ_Node+ && !TQ_Node).*(..)) && target(trg_instance) && scope(); before(TQ_Node trg_instance): TQ_Node_invariant(trg_instance){ if (!checkInvariant(trg_instance)){ System.out.println("error in inv before a method call"); System.exit(1); } } before(TQ_Node trg_instance , TQ_Node that ): TQ_Node_compare1( trg_instance , that ){ boolean res = checkPre_compare( trg_instance , that); boolean next = true ; if (!res){ System.out.println(" *** PRE CONDITION ERROR in TQ_Node in Method: compare"); System.exit(1); }if (!next) { System.out.println(" *** PRE HIER ERROR in TQ_Node in Method: compare"); System.exit(1); } } before(TQ_Node trg_instance , TQ_Node that ): cast_TQ_Node_compare1( trg_instance, that ){ String staticType = thisJoinPoint.getSignature().getDeclaringType().getName(); String dynamicType = thisJoinPoint.getTarget().getClass().getName(); boolean hierResult = (true); boolean res = checkPre_compare( trg_instance , that); if (hierResult && ! res){ System.out.println(" **** CAST PRE HIER ERROR TQ_Node in Method: compare"); System.out.println("[conaj-ERROR]: ***** staticType "+staticType+" **** dynamicType "+dynamicType+" SIG ==> "+ thisJoinPoint.getSignature().toLongString());System.exit(1); } } after(TQ_Node trg_instance): TQ_Node_invariant(trg_instance){ if (!checkInvariant(trg_instance)){ System.out.println("error in inv after a method call"); System.exit(1); } } public boolean checkInvariant(TQ_Node trg_instance){ if (trg_instance.time>=0) { return true; } else { return false; } } public boolean checkPre_compare(TQ_Node trg_instance,TQ_Node that){ if(that!=null) return true; else return false; } public boolean checkPreHier_compare(TQ_Node trg_instance,TQ_Node that){ boolean myPre = checkPre_compare( trg_instance , that); boolean hierarchy = (true); if (!hierarchy || myPre) return myPre; else return false; } }