cz.vutbr.fit.atomicity
Class AtomicityCollection

java.lang.Object
  extended by cz.vutbr.fit.atomicity.AtomicityCollection

public class AtomicityCollection
extends java.lang.Object

This class contains a collection of atomicity sections indexed by programLocation of the begining access to the atomicity. It implements import from and export to XML files and several basic operation on the colleciton.

Author:
zdenek
See Also:
Atomicity, RaceDetector

Nested Class Summary
(package private)  class AtomicityCollection.XMLHandler
          A class implements the handler for processing an XML file.
 
Field Summary
 boolean correctRun
           
 
Constructor Summary
AtomicityCollection()
          Constructor.
 
Method Summary
 void addAll(AtomicityCollection ac)
          Add a new atomicity to the collection.
 void addAtomicity(java.lang.String progLoc, Atomicity atom)
          Add a new atomicity to the collection.
 Atomicity getAtomicity(java.lang.String programLocation)
          Returns Atomicity object pointed at the given programLocation.
 int getAtomicityCollectionSize()
          Returns the number of atomicities present in this collection.
 java.lang.String getDebugText()
          Returns text representation - used for debuging.
 java.util.HashSet<java.lang.String> getKeySet()
          Returns the key set of the atomsec.
static Atomicity getNewAtomicity(Access begin, java.util.HashSet<Access> ends)
          Returns the right Atomicity object according to the number of ends the atomicity should have.
 void remove(java.lang.String key)
          Removes from this atomicity collection the record that is determined by its key.
 void removeAll(AtomicityCollection remCollection)
          Removes from this atomicity collection all records that are presented in the given atomicity collection.
 void removeAll(java.util.HashSet<java.lang.String> remCollection)
          Removes from this atomicity collection all records that uses as key ConTest locations present in the given Set.
 boolean restoreAtomicityFromFile(java.io.BufferedReader fd)
          Restores atomicity information from the file.
 void storeAtomicityToFile(java.io.BufferedWriter fd, boolean learning)
          Stores atomicity information into the "atomicity" directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

correctRun

public volatile boolean correctRun
Constructor Detail

AtomicityCollection

public AtomicityCollection()
Constructor.

Method Detail

getAtomicity

public Atomicity getAtomicity(java.lang.String programLocation)
Returns Atomicity object pointed at the given programLocation. If there is no Atomicity object matching the given key null is returned.

Parameters:
programLocation -
Returns:
Atomicity object or null

addAtomicity

public void addAtomicity(java.lang.String progLoc,
                         Atomicity atom)
Add a new atomicity to the collection. Atomicity is represented by its start access and one of Atomicity classes encapsulating atomicity ends.


addAll

public void addAll(AtomicityCollection ac)
Add a new atomicity to the collection. Atomicity is represented by its start access and one of Atomicity classes encapsulating atomicity ends.


storeAtomicityToFile

public void storeAtomicityToFile(java.io.BufferedWriter fd,
                                 boolean learning)
Stores atomicity information into the "atomicity" directory.

Parameters:
learning - If true statistics of violation will be stored

restoreAtomicityFromFile

public boolean restoreAtomicityFromFile(java.io.BufferedReader fd)
Restores atomicity information from the file. And fill the structures.


remove

public void remove(java.lang.String key)
Removes from this atomicity collection the record that is determined by its key.

Parameters:
key -

removeAll

public void removeAll(AtomicityCollection remCollection)
Removes from this atomicity collection all records that are presented in the given atomicity collection.

Parameters:
remCollection -

removeAll

public void removeAll(java.util.HashSet<java.lang.String> remCollection)
Removes from this atomicity collection all records that uses as key ConTest locations present in the given Set.

Parameters:
remCollection -

getAtomicityCollectionSize

public int getAtomicityCollectionSize()
Returns the number of atomicities present in this collection.

Returns:
Number of atomicities in the collection.

getDebugText

public java.lang.String getDebugText()
Returns text representation - used for debuging.

Returns:
Information string

getKeySet

public java.util.HashSet<java.lang.String> getKeySet()
Returns the key set of the atomsec.


getNewAtomicity

public static Atomicity getNewAtomicity(Access begin,
                                        java.util.HashSet<Access> ends)
Returns the right Atomicity object according to the number of ends the atomicity should have.

Parameters:
begin -
ends -
Returns:
atomicity instance