Java Reference
In-Depth Information
else
return (t.time < t.next.time)
&& isWellFormed ( t . next ) ;
}
static boolean isWellFormed ( Signal s )
{
return isWellFormed ( s . transitions ) ;
}
public static Transition xorTransitions(Transition t1 ,
Transition t2)
{
if (t1 == null )
return t2 ;
else if (t2 == null )
return t1 ;
else {
int tt1 = t1 . time ;
int tt2 = t2 . time ;
if (tt1 < tt2)
return new Transition(tt1 ,
xorTransitions(t1 .next , t2)) ;
else if (tt2 < tt1)
return new Transition(tt2 ,
xorTransitions(t1 , t2 . next)) ;
else
return xorTransitions(t1 .next , t2 . next) ;
}
}
public static Signal xorSignals (Signal s1 , Signal s2)
{
return new Signal(
(s1. initialValue) != (s2. initialValue) ,
xorTransitions(s1 . transitions , s2 . transitions )) ;
}
public static boolean recValueAt( boolean value ,
Transition t ,
int time) {
if (t == null )
return value ;
else if (time < t . time)
return value ;
else
return recValueAt (! value , t . next , time) ;
}
public static boolean recValueAt( Signal s , int instant
) {
return recValueAt(s . initialValue , s . transitions ,
instant) ;
}
Search WWH ::




Custom Search