hasReference and opIndex methods for SamReader