public int getLength(ResidueNumber start, ResidueNumber end) {
		if( ! start.getChainName().equals(end.getChainName())) {
			throw new IllegalArgumentException(String.format(
					"Chains differ between %s and %s. Unable to calculate length.",
					start,end));
		}
		Integer startPos = getPosition(start);
		Integer endPos = getPosition(end);
		if(startPos == null) {
			throw new IllegalArgumentException("Residue "+start+" was not found.");
		}
		if(endPos == null) {
			throw new IllegalArgumentException("Residue "+start+" was not found.");
		}
		return getLength(startPos, endPos, start.getChainName());
	}
public int getLength ( ResidueNumber start , ResidueNumber end ) { if ( ! start . getChainName ( ) . equals ( end . getChainName ( ) ) ) { throw new IllegalArgumentException ( String . format ( "Chains differ between %s and %s. Unable to calculate length." , start , end ) ) ; } Integer startPos = getPosition ( start ) ; Integer endPos = getPosition ( end ) ; if ( startPos == null ) { throw new IllegalArgumentException ( "Residue " + start + " was not found." ) ; } if ( endPos == null ) { throw new IllegalArgumentException ( "Residue " + start + " was not found." ) ; } return getLength ( startPos , endPos , start . getChainName ( ) ) ; }
Calculates the number of atoms between two ResidueNumbers, inclusive. Both residues
must belong to the same chain.
@param start First residue
@param end Last residue
@return The number of atoms from A to B inclusive
@throws IllegalArgumentException if start and end are on different chains,
or if either of the residues doesn't exist