/// <summary> /// insert a new element in the chemical composition /// </summary> /// <param name="newComp">(Comb.compStrt)Element + Number of atoms</param> public void insert(scanStrt newScan) { // if insert won't overflow list if (theSize < scan.Length) { // increment start and set element scan[start = (start + 1) % scan.Length] = newScan; // increment list size (we've added an element) theSize++; } }
/// <summary> /// peek at an element in the list /// </summary> /// <param name="offset">(int)array index to point</param> /// <returns>(Comb.compStrt)Element + Number of atoms</returns> public scanStrt peek(int offset) { scanStrt ret = new scanStrt(); // is someone trying to peek beyond our size? if (offset >= theSize) { return(ret); } // get object we're peeking at (do not remove it) return(scan[(end + offset + 1) % scan.Length]); }