Java Reference
In-Depth Information
public static Signal renverser (Signal s)
{
boolean v = s. initialValue ;
Transition t = s. transitions ;
Transition t2 = null ;
while (t != null )
{
t2 = new Transition( t.time, t2);
v= !v;
t=t.next;
return new Signal(v, t2) ;
}
public static void testValues(Signal s)
{
int [] t = {− 1, 0, 1, 2, 4, 6 } ;
for ( int i=0; i < t . length ; ++i )
System . out . println ( t [ i ] + ":" + recValueAt(s , t [
i]) + ""
+valueAt(s, t[i]));
}
public static void test(Signal s)
{
print(s) ;
testValues(s) ;
System . out . println (isWellFormed ( s ) ) ;
System . out . println () ;
}
public static void testAll (Signal s)
{
test(s);
Signal is = invert (s) ;
test( is );
System . out . println ( "XOR" );
print(xorSignals(s , is )) ;
System . out . println () ;
Signal it = shift(is , 1);
test( it );
System . out . println ( "XOR" );
print(xorSignals(it , is )) ;
System . out . println () ;
Signal ir = renverser( it ) ;
test( ir );
}
public static void main( String [ ]
args )
{
Signal s1 = new Signal( false , null );
Signal s2 = new Signal( false , new Transition (10 , new
Transition (50 , null )));
Signal s3 = new Signal( true , new Transition (10 , new
Transition (15 ,
new Transition (30 , null ))));
Signal signal1 = new Signal( false ,
new Transition (1 , new Transition (3 , new
Search WWH ::




Custom Search