Methods Summary |
---|
public boolean | add(ClassDescriptor cls, boolean overwrite)
if ($assert.ENABLED) $assert.ASSERT (cls != null, "cls is null");
final String classVMName = cls.getClassVMName ();
if (overwrite || ! m_classMap.containsKey (classVMName))
{
m_classMap.put (classVMName, cls);
boolean incompleteDebugInfo = false;
if (! cls.hasSrcFileInfo ())
{
m_hasSrcFileInfo = false;
incompleteDebugInfo = true;
}
if (! cls.hasCompleteLineNumberInfo ())
{
m_hasLineNumberInfo = false;
incompleteDebugInfo = true;
}
// SF FR 971176: provide user with sample classes that may later
// caused warnings about line coverage not available
if (incompleteDebugInfo)
{
final Logger log = Logger.getLogger ();
if (log.atINFO ())
{
final String packageVMName = cls.getPackageVMName ();
if (m_packagesWarned.add (packageVMName))
{
log.info ("package [" + packageVMName + "] contains classes [" + cls.getName () + "] without full debug info");
}
}
}
return true;
}
return false;
|
public CoverageOptions | getOptions()
return m_options;
|
public boolean | hasDescriptor(java.lang.String classVMName)
if ($assert.ENABLED) $assert.ASSERT (classVMName != null, "className is null");
return m_classMap.containsKey (classVMName);
|
public boolean | hasLineNumberData()
return m_hasLineNumberInfo;
|
public boolean | hasSrcFileData()
return m_hasSrcFileInfo;
|
public boolean | isEmpty()
return m_classMap.isEmpty ();
|
public java.util.Iterator | iterator()
return m_classMap.values ().iterator ();
|
public java.lang.Object | lock()
return m_classMap;
|
public IMergeable | merge(IMergeable rhs)
if ((rhs == null) || rhs.isEmpty () || (rhs == this))
return this;
else
{
final MetaData rhsmdata = (MetaData) rhs; // TODO: redesign to avoid this cast?
final Map rhsclasses = rhsmdata.m_classMap;
// rhs entries always override existing content:
for (Iterator entries = rhsclasses.entrySet ().iterator (); entries.hasNext (); )
{
final Map.Entry entry = (Map.Entry) entries.next ();
final String classVMName = (String) entry.getKey ();
final Object rhsdescriptor = entry.getValue ();
m_classMap.put (classVMName, rhsdescriptor);
}
// update debug info flags if necessary:
if (! rhsmdata.hasSrcFileData ()) m_hasSrcFileInfo = false;
if (! rhsmdata.hasLineNumberData ()) m_hasLineNumberInfo = false;
return this;
}
|
static com.vladium.emma.data.MetaData | readExternal(java.io.DataInput in)
final CoverageOptions options = CoverageOptions.readExternal (in);
final boolean hasSrcFileInfo = in.readBoolean ();
final boolean hasLineNumberInfo = in.readBoolean ();
final int size = in.readInt ();
final HashMap classMap = new HashMap (size);
for (int i = 0; i < size; ++ i)
{
final String classVMName = in.readUTF ();
final ClassDescriptor cls = ClassDescriptor.readExternal (in);
classMap.put (classVMName, cls);
}
// [m_packagesWarned is not part of persisted state]
return new MetaData (options, classMap, hasSrcFileInfo, hasLineNumberInfo);
|
public IMetaData | shallowCopy()
final MetaData _clone;
try
{
_clone = (MetaData) super.clone ();
}
catch (CloneNotSupportedException cnse)
{
throw new Error (cnse.toString ());
}
final HashMap _classMap;
synchronized (lock ())
{
_classMap = (HashMap) m_classMap.clone ();
}
// [m_packagesWarned is not cloned by design]
_clone.m_classMap = _classMap;
return _clone;
|
public int | size()
return m_classMap.size ();
|
static void | writeExternal(com.vladium.emma.data.MetaData mdata, java.io.DataOutput out)
CoverageOptions.writeExternal (mdata.m_options, out);
out.writeBoolean (mdata.m_hasSrcFileInfo);
out.writeBoolean (mdata.m_hasLineNumberInfo);
final Map classMap = mdata.m_classMap;
final int size = classMap.size ();
out.writeInt (size); // too bad the capacity is not visible
final Iterator entries = classMap.entrySet ().iterator ();
for (int i = 0; i < size; ++ i)
{
final Map.Entry entry = (Map.Entry) entries.next ();
final String classVMName = (String) entry.getKey ();
final ClassDescriptor cls = (ClassDescriptor) entry.getValue ();
out.writeUTF (classVMName);
ClassDescriptor.writeExternal (cls, out);
}
// [m_packagesWarned is not part of persisted state]
|