001/*
002 *                    BioJava development code
003 *
004 * This code may be freely distributed and modified under the
005 * terms of the GNU Lesser General Public Licence.  This should
006 * be distributed with the code.  If you do not have a copy,
007 * see:
008 *
009 *      http://www.gnu.org/copyleft/lesser.html
010 *
011 * Copyright for this code is held jointly by the individual
012 * authors.  These should be listed in @author doc comments.
013 *
014 * For more information on the BioJava project and its aims,
015 * or to join the biojava-l mailing list, visit the home page
016 * at:
017 *
018 *      http://www.biojava.org/
019 *
020 */
021package org.biojava.nbio.structure;
022
023import java.util.Iterator;
024
025/**
026 * Created by douglas on 1/23/15.
027 */
028public class AugmentedResidueRange extends ResidueRangeAndLength {
029
030        private final AtomPositionMap map;
031
032        public AugmentedResidueRange(String chain, ResidueNumber start, ResidueNumber end, int length, AtomPositionMap map) {
033                super(chain, start, end, length);
034                this.map = map;
035        }
036
037        public AugmentedResidueRange(String chain, String start, String end, int length, AtomPositionMap map) {
038                super(chain, start, end, length);
039                this.map = map;
040        }
041
042
043        /**
044         * Returns the ResidueNumber that is at position {@code positionInRange} in <em>this</em> ResidueRange.
045         * @return The ResidueNumber, or false if it does not exist or is not within this ResidueRange
046         */
047        public ResidueNumber getResidue(int positionInRange) {
048                return super.getResidue(positionInRange, map);
049        }
050
051        /**
052         * @return True if and only if {@code residueNumber} is within this ResidueRange
053         */
054        public boolean contains(ResidueNumber residueNumber) {
055                return super.contains(residueNumber, map);
056        }
057
058        /**
059         * Returns a new Iterator over every {@link ResidueNumber} in this ResidueRange.
060         * Stores the contents of {@code map} until the iterator is finished, so calling code should set the iterator to {@code null} if it did not finish.
061         */
062        public Iterator<ResidueNumber> iterator() {
063                return super.iterator(map);
064        }
065
066}