public void prepareForNewGame() { //ChemGame.loadAssets (); this.mysteryCompound = compounds[random.Next (0, ChemGame.numLegitCompounds - 1)]; this.compoundChoices [0] = this.mysteryCompound; compounds.Remove (mysteryCompound); compoundsRemoved.Add (mysteryCompound); for (int i = 1; i < this.compoundChoices.Length; i++) { this.compoundChoices[i] = compounds[random.Next (0, ChemGame.numLegitCompounds - (i+1))]; compounds.Remove(compoundChoices[i]); compoundsRemoved.Add (compoundChoices[i]); // bool isTaken = false; // // //do { // index = random.Next (0, ChemGame.compounds.Count); // // for(int j = 0; j < i; j++) { // if(this.compoundChoices[j].Equals(ChemGame.compounds[index])) { // isTaken = true; // break; // } // } // //} while (isTaken); // this.compoundChoices[i] = compounds[index]; } this.Shuffle (this.compoundChoices); compounds.AddRange(compoundsRemoved); compoundsRemoved.Clear (); }
static MsSpectrumGraphObject GetMsSpectrumGraphObject(ICompound compound, Color color, string legend) { string spectrumName = compound.FileName; SpectrumData spectrumData = getSpectrumData(compound); var spectrumGraphObject = new MsSpectrumGraphObject(spectrumData); spectrumGraphObject.DisplaySettings.Color = color; //if (legend != null) // spectrumGraphObject.CreateLegendObject(legend); //else spectrumGraphObject.CreateLegendObject(new List <string> { spectrumData.Name }); spectrumGraphObject.MassOfPrecursorIon = GetMassOfMostAbundantIon(spectrumData); spectrumGraphObject.DisplaySettings.ShowPrecursorIonAnnotation = false; spectrumGraphObject.DisplaySettings.PenSizeFocusedIon = 2f; spectrumGraphObject.DisplaySettings.PenSizeDefaultIon = 1f; // spectrumGraphObject.DisplaySettings.DefaultIonAnnotationFont = GraphicToolsRepository.FontArial10; // spectrumGraphObject.DisplaySettings.FocusedIonAnnotationFont = GraphicToolsRepository.FontArial12Bold; spectrumGraphObject.DisplaySettings.IonAnnotationFormatString = "{0:0.0000}"; spectrumGraphObject.DisplaySettings.IonAnnotationLabelingMode = IonAnnotationLabelingMode.Always; spectrumGraphObject.DisplaySettings.IonAnnotationLabelsMayOverlapIons = true; spectrumGraphObject.DisplaySettings.MaximumNumberOfVisibleIonAnnotationLabels = 20; return(spectrumGraphObject); }
/// <summary> /// Imame daden tozi klas, koito ni e daden i priema ICompaund. Ne mojem da promeniame ChemicalDatabank /// daimplementira ICompaund i da pechata s Display. Zatova pravim RichCompaund, koito implementira /// ICompaund i ima metod Display. /// </summary> /// <param name="compound"></param> internal static void ProcessCompound(ICompound compound) { // Process something compound.Display(); // More processing... }
internal LayoutConstraint[] AddConstraint(ICompound from, ICompound to = null, Coefficients[] coefficients = null, NSLayoutRelation relation = default(NSLayoutRelation)) { var results = new List <LayoutConstraint>(); for (var i = 0; i < from.Properties.Length; i++) { var n = coefficients?[i] ?? new Coefficients(); results.Add(AddConstraint(from.Properties[i], to: to?.Properties?[i], coefficients: n, relation: relation)); } return(results.ToArray()); }
private string GetCompoundString(ICompound compound, string delimeter) { string[] props = new string[] { compound.FileName, compound.Mass.ToString(), compound.RT.ToString(), compound.Area.ToString(), compound.Volume.ToString(), compound.Saturated.ToString(), compound.Width.ToString(), compound.Ions.ToString(), compound.ZCount.ToString(), }; return(String.Join(delimeter, props)); }
public bool EqualsIgnoreCase(ICompound compound) { if (compound == null) { return(false); } if (!(compound is AbstractCompound)) { return(false); } AbstractCompound them = (AbstractCompound)compound; return(_base.Equals(them._base, StringComparison.InvariantCultureIgnoreCase)); }
private void AfterSelectChange(object sender, AfterSelectChangeEventArgs e) { BindingList <ICompound> selectedCompounds = new BindingList <ICompound>(); SelectedRowsCollection seletedRows = this.ultraGrid.Selected.Rows; if (seletedRows != null) { RowEnumerator enumerator = seletedRows.GetEnumerator(); if (enumerator != null) { while (enumerator.MoveNext()) { UltraGridRow row = enumerator.Current; ICompound compound = row.ListObject as ICompound; if (compound != null) { selectedCompounds.Add(compound); } } } } this.Model.SelectedCompounds = selectedCompounds; }
static SpectrumData getSpectrumData(ICompound compound) { ICollection <IPeak> peaks = compound.Spectrum.Peaks; int count = peaks.Count; double[] xValues = new double[count]; double[] yValues = new double[count]; IEnumerator <IPeak> pe = peaks.GetEnumerator(); int counter = 0; while (pe.MoveNext()) { IPeak peak = pe.Current; xValues[counter] = peak.X; yValues[counter] = peak.Y; counter++; } SpectrumData spectrumData = new SpectrumData(new Data(xValues, yValues), XUnit.MassToCharge, "Counts", 13.56); spectrumData.Name = compound.Spectrum.Name; return(spectrumData); }
/// <summary> /// The create chromatogram graph object. /// </summary> /// <param name="signalName"> /// The signal name. /// </param> /// <param name="color"> /// The color. /// </param> /// <param name="compound"></param> /// <returns> /// The <see cref="ChromatogramGraphObject"/>. /// </returns> private ChromatogramGraphObject CreateChromatogramGraphObject( string signalName, Color color, ICompound compound) { var chromatogramObject = new FilledChromatogramGraphObject( AcamlSignalConverter.AcamlSignalToCommonSignal( ChromatogramDataProvider.CreateChromatogramData( compound.Chromatogram ))); chromatogramObject.DisplaySettings.Color = color; chromatogramObject.Hint = string.Format("Datapoints: {0}", compound.Chromatogram.Data.Count); chromatogramObject.HintTitle = compound.Chromatogram.Title; //if (signalName != null) // chromatogramObject.CreateLegendObject(signalName); //else chromatogramObject.CreateLegendObject(new List <string> { chromatogramObject.HintTitle }); return(chromatogramObject); }
public PlotItem(string name, string group, ICompound compound) { Name = name; Group = group; Compound = compound; }
private void Shuffle(ICompound[] compounds) { int maxIndex = compounds.Length - 1; for (int i = 0; i < 50; i++) { int a = random.Next(0, maxIndex); int b = random.Next(0, maxIndex); ICompound temp = compounds[a]; compounds[a] = compounds[b]; compounds[b] = temp; } }
internal static void ProcessCompound(ICompound compound) { // Process something compound.Display(); // More processing... }
public bool Equals(ICompound compound) { return this.Name.Equals(compound.Name); }