htsjdk.samtools
Class AbstractSAMHeaderRecord

java.lang.Object
  extended by htsjdk.samtools.AbstractSAMHeaderRecord
Direct Known Subclasses:
SAMFileHeader, SAMProgramRecord, SAMReadGroupRecord, SAMSequenceRecord

public abstract class AbstractSAMHeaderRecord
extends java.lang.Object

Base class for the various concrete records in a SAM header, providing uniform access to the attributes.


Constructor Summary
AbstractSAMHeaderRecord()
           
 
Method Summary
protected  boolean attributesEqual(AbstractSAMHeaderRecord that)
          For use in the equals() method of the concrete class.
protected  int attributesHashCode()
          For use in the hashCode() method of the concrete class.
 java.lang.String getAttribute(java.lang.String key)
           
 java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.String>> getAttributes()
          Returns the Set of attributes.
 java.lang.String getId()
          Returns the ID tag (or equivalent) for this header record.
 void setAttribute(java.lang.String key, java.lang.Object value)
          Deprecated. Use the version that takes a String value instead
 void setAttribute(java.lang.String key, java.lang.String value)
          Set the given value for the attribute named 'key'.
 java.lang.String toString()
          Simple to String that outputs the concrete class name and the set of attributes stored.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractSAMHeaderRecord

public AbstractSAMHeaderRecord()
Method Detail

getAttribute

public java.lang.String getAttribute(java.lang.String key)

setAttribute

public void setAttribute(java.lang.String key,
                         java.lang.Object value)
Deprecated. Use the version that takes a String value instead

Set the given value for the attribute named 'key'. Replaces an existing value, if any. If value is null, the attribute is removed. Otherwise, the value will be converted to a String with toString.

Parameters:
key - attribute name
value - attribute value

setAttribute

public void setAttribute(java.lang.String key,
                         java.lang.String value)
Set the given value for the attribute named 'key'. Replaces an existing value, if any. If value is null, the attribute is removed. Supported types are Character, Integer, Float and String. Byte and Short may also be passed in but they will be converted to Integer.

Parameters:
key - attribute name
value - attribute value

getAttributes

public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.String>> getAttributes()
Returns the Set of attributes.


getId

public java.lang.String getId()
Returns the ID tag (or equivalent) for this header record. The default implementation throws a SAMException to indicate "not implemented".


attributesEqual

protected boolean attributesEqual(AbstractSAMHeaderRecord that)
For use in the equals() method of the concrete class.


attributesHashCode

protected int attributesHashCode()
For use in the hashCode() method of the concrete class.


toString

public java.lang.String toString()
Simple to String that outputs the concrete class name and the set of attributes stored.

Overrides:
toString in class java.lang.Object