Java Reference
In-Depth Information
else
outputFile # new FileOutputStream
("trackerPhysical.log");
outputObject # new ObjectOutputStream(outputFile);
tracking # true ;
} catch (IOException ioe) { ioe.printStackTrace(); }
}
// records the signature of a method causing a state change
public static void record(Trackable target,
String methodName, Class[] parameters,
Object[] arguments) {
if ( ! tracking)
return ;
try {
Entry entry # new Entry(target, methodName,
parameters, arguments);
outputObject.writeObject(entry);
} catch (IOException ioe) { ioe.printStackTrace(); }
}
// loads the last saved stable point and the sequence of
// operations
public static void restore() {
try {
...
if (logicalRecording)
inputFile # new FileInputStream
("trackerLogical.log");
else
inputFile # new FileInputStream
("trackerPhysical.log");
inputObject # new ObjectInputStream(inputFile);
entryList.removeAll(entryList);
Entry entry # null ;
while ((entry # (Entry) inputObject.readObject())
! # null )
entryList.add(entry);
} catch (Exception e) {
System.out.println("*** end of file ***");
currentEntry # 0;
}
}
// applies state changes until the execution of operation
// "entryID"
public static void redoUntil( int entryID) {
if (entryID ## currentEntry || entryID > entryList.size())
return ;
Search WWH ::




Custom Search