*/
private final File path;
- /**
- * The metadata parsing object.
- */
- private final Metadata metadata;
-
/**
* Major CTF version number
*/
private final List<FileInputStream> fileInputStreams = new LinkedList<FileInputStream>();
/** Handlers for the metadata files */
- private final static FileFilter metadataFileFilter = new MetadataFileFilter();
- private final static Comparator<File> metadataComparator = new MetadataComparator(); // $codepro.audit.disable
- // fieldJavadoc
+ private static final FileFilter METADATA_FILE_FILTER = new MetadataFileFilter();
+ private static final Comparator<File> METADATA_COMPARATOR = new MetadataComparator();
/** map of all the event types */
private final Map<Long,HashMap<Long, IEventDeclaration>> eventDecs = new HashMap<Long, HashMap<Long,IEventDeclaration>>();
/** Callsite helpers */
private Map<String, LinkedList<CTFCallsite>> callsitesByName = new HashMap<String, LinkedList<CTFCallsite>>();
+
/** Callsite helpers */
private TreeSet<CTFCallsite> callsitesByIP = new TreeSet<CTFCallsite>();
*/
public CTFTrace(File path) throws CTFReaderException {
this.path = path;
- this.metadata = new Metadata(this);
+ final Metadata metadata = new Metadata(this);
/* Set up the internal containers for this trace */
if (!this.path.exists()) {
}
/* List files not called metadata and not hidden. */
- File[] files = path.listFiles(metadataFileFilter);
- Arrays.sort(files, metadataComparator);
+ File[] files = path.listFiles(METADATA_FILE_FILTER);
+ Arrays.sort(files, METADATA_COMPARATOR);
/* Try to open each file */
for (File streamFile : files) {
openStreamInput(streamFile);
* @param streamId
* The ID of the stream from which to read
* @return The Hash map with the event declarations
+ * @since 2.0
*/
- public HashMap<Long, IEventDeclaration> getEvents(Long streamId) {
+ public Map<Long, IEventDeclaration> getEvents(Long streamId) {
return eventDecs.get(streamId);
}
* @return the hashmap with the event definitions
* @since 2.0
*/
- public HashMap<Long, EventDefinition> getEventDefs(StreamInput id) {
+ public Map<Long, EventDefinition> getEventDefs(StreamInput id) {
if(! eventDefs.containsKey(id)){
eventDefs.put(id, new HashMap<Long, EventDefinition>());
}
* Method UUIDIsSet is the UUID set?
*
* @return boolean is the UUID set?
+ * @since 2.0
*/
- public boolean UUIDIsSet() {
+ public boolean uuidIsSet() {
return uuid != null;
}
*
* @return ByteOrder gets the trace byte order
*/
- public ByteOrder getByteOrder() {
+ public final ByteOrder getByteOrder() {
return byteOrder;
}
byteBuffer = fc.map(MapMode.READ_ONLY, 0, Math.min((int)fc.size(), 4096));
} catch (IOException e) {
/* Shouldn't happen at this stage if every other check passed */
- throw new CTFReaderException();
+ throw new CTFReaderException(e);
}
/* Create a BitBuffer with this mapping and the trace byte order */
*
* @return the time offset of a clock with respect to UTC in nanoseconds
*/
- private final double getTimeScale() {
+ private double getTimeScale() {
if (getClock() == null) {
return 1.0;
}
*
* @return if the trace is in ns or cycles.
*/
- private final boolean clockNeedsScale() {
+ private boolean clockNeedsScale() {
if (getClock() == null) {
return false;
}
*
* @return 1.0 / scale
*/
- private final double getInverseTimeScale() {
+ private double getInverseTimeScale() {
if (getClock() == null) {
return 1.0;
}
* Add an event declaration map to the events map.
* @param id the id of a stream
* @return the hashmap containing events.
+ * @since 2.0
*/
- public HashMap<Long, IEventDeclaration> createEvents(Long id){
+ public Map<Long, IEventDeclaration> createEvents(Long id){
HashMap<Long, IEventDeclaration> value = eventDecs.get(id);
if( value == null ) {
value = new HashMap<Long, IEventDeclaration>();