public bool Equals(ISequenceItem other) { if (ReferenceEquals(this, other)) return true; if (other == null) return false; return this.StartNumber == other.StartNumber; }
public EntryDemoPage(ISequenceItem item) { Label header = new Label { Text = item.Boat.PrettyName, Font = Font.SystemFontOfSize(NamedSize.Medium, FontAttributes.Bold), HorizontalOptions = LayoutOptions.Center }; var entry = new Entry { Keyboard = Keyboard.Text, Placeholder = "Notes", Text = item.Notes, VerticalOptions = LayoutOptions.CenterAndExpand }; entry.TextChanged += (object sender, TextChangedEventArgs e) => item.Notes = entry.Text; // Build the page. this.Content = new StackLayout { Children = { header, entry } }; }
public void LogATime(ILocation location, ISequenceItem item) { DBError error; var fields = item.ToDictionary(location); var table = _raceStore.GetTable("sequenceitems"); string key = string.Format("{0}-{1}-{2}", location.Name, location.Token, item.Boat.Number); table.GetOrInsertRecord(key, fields, false, out error); _raceStore.Sync(out error); LastWriteSucceeded = error == null; if(LastWriteSucceeded) LastWriteTime = DateTime.Now; }
public void LogATime(ILocation location, ISequenceItem item) { // fixme: if the boat is null, then it should be logged against the location's unidentified list //var item = DbTimingItem.Create(boat.Race, location, boat, time, notes); //var stamp = item.As(boat, location); //boat.Times.Add(location, stamp); // int wr = item.Save(); // _lastWriteSucceeded = wr == 1; // if(_lastWriteSucceeded) // _lastWriteTime = DateTime.Now; }
/// <summary> /// Indicates if a sequence item is contained in the sequence anywhere. /// </summary> /// <param name="item">Sequence item to be verified.</param> /// <returns>If found returns true else returns false.</returns> public bool Contains(ISequenceItem item) { return(IndexOf(item) >= 0); }
/// <summary> /// Adds the specified sequence item to the end of this sequence. /// </summary> /// <param name="item">Sequence item to be added.</param> public void Add(ISequenceItem item) { Insert(Count, item); }
/// <summary> /// Snp parser generic method called by all the test cases /// to validate the test case based on the parameters passed. /// </summary> /// <param name="nodename">Xml node Name.</param> /// <param name="additionalParam">Additional parameter /// based on which the validation of test case is done.</param> void SnpParserGeneralTestCases(string nodename, AdditionalParameters additionalParam) { // Gets the expected sequence from the Xml string filepath = _utilityObj._xmlUtil.GetTextValue(nodename, Constants.FilePathNode); Assert.IsTrue(File.Exists(filepath)); // Logs information to the log file ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Snp Parser BVT: File Exists in the Path '{0}'.", filepath)); IList <ISequence> seqList = null; SparseSequence sparseSeq = null; SimpleSnpParser parser = new SimpleSnpParser(); string expectedPosition = _utilityObj._xmlUtil.GetTextValue(nodename, Constants.ExpectedPositionNode); string[] expectedPositions = expectedPosition.Split(','); string[] expectedCharacters = null; switch (additionalParam) { case AdditionalParameters.ParseAlleleTwo: parser.ParseAlleleOne = false; string expectedAlleleTwoSequence = _utilityObj._xmlUtil.GetTextValue(nodename, Constants.ExpectedSequenceAllele2Node); expectedCharacters = expectedAlleleTwoSequence.Split(','); break; default: string expectedSequence = _utilityObj._xmlUtil.GetTextValue(nodename, Constants.ExpectedSequenceNode); expectedCharacters = expectedSequence.Split(','); break; } using (StreamReader strReaderObj = new StreamReader(filepath)) { switch (additionalParam) { case AdditionalParameters.ParseTextReader: seqList = parser.Parse(strReaderObj); sparseSeq = (SparseSequence)seqList[0]; break; case AdditionalParameters.ParseOneTextReader: sparseSeq = (SparseSequence)parser.ParseOne(strReaderObj); break; case AdditionalParameters.ParseOneFilePath: sparseSeq = (SparseSequence)parser.ParseOne(filepath); break; default: seqList = parser.Parse(filepath); sparseSeq = (SparseSequence)seqList[0]; break; } } if (null == sparseSeq) { Assert.IsNotNull(seqList); Assert.AreEqual(1, seqList.Count); ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Snp Parser BVT: Number of Sequences found are '{0}'.", seqList.Count.ToString((IFormatProvider)null))); } for (int i = 0; i < expectedPositions.Length; i++) { ISequenceItem item = sparseSeq[int.Parse(expectedPositions[i], (IFormatProvider)null)]; Assert.AreEqual(expectedCharacters[i], item.Symbol.ToString((IFormatProvider)null)); } ApplicationLog.WriteLine( "Snp Parser BVT: The Snp sequence with position is validated successfully with Parse() method."); // Logs to the NUnit GUI (Console.Out) window Console.WriteLine( "Snp Parser BVT: The Snp sequence with position is validated successfully with Parse() method."); Assert.IsNotNull(sparseSeq.Alphabet); Assert.AreEqual(sparseSeq.Alphabet.Name.ToLower(CultureInfo.CurrentCulture), _utilityObj._xmlUtil.GetTextValue(nodename, Constants.AlphabetNameNode).ToLower(CultureInfo.CurrentCulture)); ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Snp Parser BVT: The Sequence Alphabet is '{0}' and is as expected.", sparseSeq.Alphabet.Name)); string expSequenceID = _utilityObj._xmlUtil.GetTextValue(nodename, Constants.SequenceIdNode); Assert.AreEqual(expSequenceID, sparseSeq.ID); ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Snp Parser BVT: The Sequence ID is '{0}' and is as expected.", sparseSeq.ID)); // Logs to the NUnit GUI (Console.Out) window Console.WriteLine(string.Format((IFormatProvider)null, "Snp Parser BVT: The Sequence ID is '{0}' and is as expected.", sparseSeq.ID)); }