public RParentChild( LinksDataSet dsLinks, LinksDataSet.tblRelatedStructureRow drLeft ) { //ImportDataSet dsImport, , LinksDataSet.tblRelatedStructureRow drRight if ( dsLinks == null ) throw new ArgumentNullException("dsLinks"); if ( drLeft == null ) throw new ArgumentNullException("drLeft"); if ( dsLinks.tblSubject.Count == 0 ) throw new InvalidOperationException("tblSubject must NOT be empty before assigning R values from it."); _dsLinks = dsLinks; _drLeft = drLeft; _idRelatedLeft = _drLeft.ID; _drBare1 = _dsLinks.tblSubject.FindBySubjectTag(drLeft.SubjectTag_S1); _drBare2 = _dsLinks.tblSubject.FindBySubjectTag(drLeft.SubjectTag_S2); Trace.Assert(_drBare1.Generation != _drBare2.Generation, "The generation should not be the same for a parent-child relationship."); _multipleBirth = MultipleBirth.No; _isMZ = Tristate.No; //For IAssignPass1 _rImplicitPass1 = RCoefficients.ParentChild; _rImplicit2004 = RCoefficients.ParentChild; _rExplicitOldestSibVersion = null; _rExplicitYoungestSibVersion = null; _rExplicitPass1 = RCoefficients.ParentChild; _rPass1 = RCoefficients.ParentChild; //For IAssignPass2 _rImplicit = RCoefficients.ParentChild; _rImplicitSubject = RCoefficients.ParentChild; _rImplicitMother = RCoefficients.ParentChild; _rExplicit = RCoefficients.ParentChild; _rFull = RCoefficients.ParentChild; _rPeek = RCoefficients.ParentChild; }
public void Update() { if (duplicate != Tristate.False) { if (duplicate == Tristate.True) { return; } if (this != part.Modules.OfType <TweakScale>().First()) { Tools.LogWf("Duplicate TweakScale module on part [{0}] {1}", part.partInfo.name, part.partInfo.title); Fields["tweakScale"].guiActiveEditor = false; Fields["tweakName"].guiActiveEditor = false; duplicate = Tristate.True; return; } duplicate = Tristate.False; } if (scaleFactors.Length == 0) { if (!invalidCfg) { invalidCfg = true; Tools.LogWf("{0}({1}) has no valid scale factors. This is probably caused by an invalid TweakScale configuration for the part.", part.name, part.partInfo.title); } return; } if (HighLogic.LoadedSceneIsEditor && currentScale >= 0f) { bool changed = isFreeScale ? tweakScale != currentScale : currentScale != scaleFactors[tweakName]; if (changed) // user has changed the scale tweakable { if (!isFreeScale) { tweakScale = scaleFactors[tweakName]; } updateByWidth(true); updateWindow(); foreach (var updater in updaters) { updater.OnRescale(scalingFactor); } currentScale = tweakScale; } else if (part.transform.GetChild(0).localScale != savedScale) // editor frequently nukes our OnStart resize some time later { updateByWidth(false); } } foreach (var upd in updaters.OfType <IUpdateable>()) { upd.OnUpdate(); } }
internal unsafe void IcuChangeCase(char *src, int srcLen, char *dstBuffer, int dstBufferCapacity, bool bToUpper) { Debug.Assert(!GlobalizationMode.Invariant); Debug.Assert(!GlobalizationMode.UseNls); if (IsInvariant) { Interop.Globalization.ChangeCaseInvariant(src, srcLen, dstBuffer, dstBufferCapacity, bToUpper); } else { if (_needsTurkishCasing == Tristate.NotInitialized) { _needsTurkishCasing = NeedsTurkishCasing(_textInfoName) ? Tristate.True : Tristate.False; } if (_needsTurkishCasing == Tristate.True) { Interop.Globalization.ChangeCaseTurkish(src, srcLen, dstBuffer, dstBufferCapacity, bToUpper); } else { Interop.Globalization.ChangeCase(src, srcLen, dstBuffer, dstBufferCapacity, bToUpper); } } }
/// <summary> /// Gets <see cref="CoordinateProper" /> array. /// </summary> /// <param name="clone">If set to <see cref="Tristate.UseDefault" /> or <see cref="Tristate.True" />, clones the collection.</param> /// <param name="collectionSize">Size of the collection.</param> /// <returns>CoordinateProper[].</returns> public CoordinateProper[] GetCoordinateProperArray( Tristate clone = Tristate.True, CollectionSize collectionSize = CollectionSize.Full) { return(collectionSize is CollectionSize.Full ? clone is Tristate.True or Tristate.UseDefault ? this._coordinateProperArray.Clone <CoordinateProper[]>() : this._coordinateProperArray : clone is Tristate.True or Tristate.UseDefault ? this._coordinateProperArrayHalf.Clone <CoordinateProper[]>() : this._coordinateProperArrayHalf); }
public static Tristate TakePriority( Tristate priority1, Tristate priority2 ) { if ( priority1 != Tristate.DoNotKnow ) return priority1; else return priority2;//Which still may be 'DoNotKnow' }
public IActionResult Recipe04() { Tristate model = new Tristate { NullableBoolValue = null }; return(View(model)); }
public static IEnumerable <Type> FindDerivedTypes([NotNull] Type baseType, Tristate classOnly) { var path = Path.GetDirectoryName(AppContext.BaseDirectory); classOnly = classOnly.ArgumentDefined(nameof(classOnly)); return(FindDerivedTypes(new DirectoryInfo(path), SearchOption.AllDirectories, baseType, classOnly)); }
public override void Write(byte[] buffer, int offset, int count) { // The current chunk, converted from UTF8 string text = null; // If this is the first chunk of this HTTP response if (this._ignore == Tristate.Undefined) { if (Sitecore.Context.Site == null || (HttpContext.Current.Response.ContentType != "text/html" && HttpContext.Current.Response.ContentType != "text/xml")) { this._ignore = Tristate.True; } } // If we don't know to ignore this chunk if (this._ignore != Tristate.True) { // Convert the UTF8 to text text = Encoding.UTF8.GetString(buffer); // If this is the first chunk for this response if (this._response == null) { if (Regex.IsMatch(text, "<html", RegexOptions.IgnoreCase)) { this._response = new StringBuilder(); this._ignore = Tristate.False; } else { this._ignore = Tristate.True; } } } // If we're ignoring this chunk, just write it to the stream if (this._ignore != Tristate.False) { // It should not be possible for this assert to throw Sitecore.Diagnostics.Assert.IsTrue(this._ignore != Tristate.Undefined, "this._ignore != Tristate.Undefined"); this._output.Write(buffer, offset, count); } else { Sitecore.Diagnostics.Assert.IsNotNull(text, "text"); // Add this chunk to the buffer);); this._response.Append(text); // If it's the last chunk if (Regex.IsMatch(text, "</html>", RegexOptions.IgnoreCase)) { text = this._response.ToString(); text = Regex.Replace(text, "my\\s*company", "myCompany", RegexOptions.IgnoreCase); this._output.Write(Encoding.UTF8.GetBytes(text), 0, Encoding.UTF8.GetByteCount(text)); } } }
public static Tristate SalvageHalfSib( Tristate anchorSharesWithSubject1, Tristate anchorSharesWithSubject2 ) { if ( (anchorSharesWithSubject1 == Tristate.DoNotKnow) || (anchorSharesWithSubject2 == Tristate.DoNotKnow) ) return Tristate.DoNotKnow; else if ( (anchorSharesWithSubject1 == Tristate.Yes && anchorSharesWithSubject2 == Tristate.No) || (anchorSharesWithSubject1 == Tristate.No && anchorSharesWithSubject2 == Tristate.Yes) ) return Tristate.No; else return Tristate.DoNotKnow; }
public static Tristate SalvageFullSib( Tristate anchorSharesWithSubject1, Tristate anchorSharesWithSubject2 ) { if ( (anchorSharesWithSubject1 == Tristate.DoNotKnow) || (anchorSharesWithSubject2 == Tristate.DoNotKnow) ) return Tristate.DoNotKnow; else if ( (anchorSharesWithSubject1 == Tristate.Yes) && (anchorSharesWithSubject2 == Tristate.Yes) ) return Tristate.Yes; else return Tristate.DoNotKnow; }
public PairShare( Int32 subjectTag1, Int32 subjectTag2, Int32 relatedID, Tristate share ) { if ( !(subjectTag1 < subjectTag2) ) throw new ArgumentException("subjectTag1 must be less than SubjectTag2."); _subjectTag1 = subjectTag1; _subjectTag2 = subjectTag2; _relatedID = relatedID; _share = share; _isInterpolated = false; }
public RGen2Cousins( LinksDataSet dsLinks, LinksDataSet.tblRelatedStructureRow drLeft ) { //ImportDataSet dsImport, , LinksDataSet.tblRelatedStructureRow drRight if ( dsLinks == null ) throw new ArgumentNullException("dsLinks"); if ( drLeft == null ) throw new ArgumentNullException("drLeft"); if ( dsLinks.tblSubject.Count == 0 ) throw new InvalidOperationException("tblSubject must NOT be empty before assigning R values from it."); _dsLinks = dsLinks; _idRelatedLeft = drLeft.ID; _drBare1 = _dsLinks.tblSubject.FindBySubjectTag(drLeft.SubjectTag_S1); _drBare2 = _dsLinks.tblSubject.FindBySubjectTag(drLeft.SubjectTag_S2); Trace.Assert(_drBare1.Generation == (byte)Generation.Gen2, "The generation should be Gen2."); Trace.Assert(_drBare2.Generation == (byte)Generation.Gen2, "The generation should be Gen2."); _multipleBirth = MultipleBirth.No; _isMZ = Tristate.No; LinksDataSet.tblRelatedValuesRow drValuesOfGen1Housemates = Gen1HousematesValues(_drBare1.SubjectTag, _drBare2.SubjectTag);//RelatedValues.Retrieve(_dsLinks, _path, //For IAssignPass1 if ( drValuesOfGen1Housemates.IsRImplicitPass1Null() ) _rImplicitPass1 = null; else _rImplicitPass1 = (float)(RCoefficients.ParentChild * RCoefficients.ParentChild * drValuesOfGen1Housemates.RImplicitPass1); if ( drValuesOfGen1Housemates.IsRImplicit2004Null() ) _rImplicit2004 = null; else _rImplicit2004 = (float)(RCoefficients.ParentChild * RCoefficients.ParentChild * drValuesOfGen1Housemates.RImplicit2004); _rExplicitOldestSibVersion = null; _rExplicitYoungestSibVersion = null; if ( drValuesOfGen1Housemates.IsRExplicitPass1Null() ) _rExplicitPass1 = null; else _rExplicitPass1 = (float)(RCoefficients.ParentChild * RCoefficients.ParentChild * drValuesOfGen1Housemates.RExplicitPass1); if ( drValuesOfGen1Housemates.IsRPass1Null() ) _rPass1 = null; else _rPass1 = (float)(RCoefficients.ParentChild * RCoefficients.ParentChild * drValuesOfGen1Housemates.RPass1); ; //For IAssignPass2 if ( drValuesOfGen1Housemates.IsRImplicitNull() ) _rImplicit = null; else _rImplicit = (float)(RCoefficients.ParentChild * RCoefficients.ParentChild * drValuesOfGen1Housemates.RImplicit); if ( drValuesOfGen1Housemates.IsRImplicitSubjectNull() ) _rImplicitSubject = null; else _rImplicitSubject = (float)(RCoefficients.ParentChild * RCoefficients.ParentChild * drValuesOfGen1Housemates.RImplicitSubject); if ( drValuesOfGen1Housemates.IsRImplicitMotherNull() ) _rImplicitMother = null; else _rImplicitMother = (float)(RCoefficients.ParentChild * RCoefficients.ParentChild * drValuesOfGen1Housemates.RImplicitMother); if ( drValuesOfGen1Housemates.IsRExplicitNull() ) _rExplicit = null; else _rExplicit = (float)(RCoefficients.ParentChild * RCoefficients.ParentChild * drValuesOfGen1Housemates.RExplicit); if ( drValuesOfGen1Housemates.IsRNull() ) _r= null; else _r= (float)(RCoefficients.ParentChild * RCoefficients.ParentChild * drValuesOfGen1Housemates.R); if ( drValuesOfGen1Housemates.IsRFullNull() ) _rFull = null; else _rFull = (float)(RCoefficients.ParentChild * RCoefficients.ParentChild * drValuesOfGen1Housemates.RFull); if ( drValuesOfGen1Housemates.IsRPeekNull() ) _rPeek = null; else _rPeek = (float)(RCoefficients.ParentChild * RCoefficients.ParentChild * drValuesOfGen1Housemates.RPeek); }
/// <summary> /// Gets <see cref="Person" /> array. /// </summary> /// <param name="clone">If set to <see cref="Tristate.UseDefault" /> or <see cref="Tristate.True" />, clones the collection.</param> /// <param name="collectionSize">Size of the collection.</param> /// <returns>Tester.Models.ValueTypes.Person[].</returns> public Tester.Models.ValueTypes.Person[] GetPersonValArray(Tristate clone = Tristate.True, CollectionSize collectionSize = CollectionSize.Full) { if (collectionSize is CollectionSize.Full) { return(clone is Tristate.True or Tristate.UseDefault ? this._personValArray.Clone <Tester.Models.ValueTypes.Person[]>() : this._personValArray); } else { return(clone is Tristate.True or Tristate.UseDefault ? this._personValArrayHalf.Clone <Tester.Models.ValueTypes.Person[]>() : this._personValArrayHalf); } }
/// <summary> /// Convert a Tristate value to a string value. /// </summary> /// <param name="triValue">A value that can be either true, false, or unanswered.</param> /// <returns>A string if the value is true or false, or null if it is neither.</returns> protected string TristateToString(Tristate triValue) { switch (triValue) { case Tristate.True: return("true"); case Tristate.False: return("false"); } return(null); }
public void Notify(int index, Tristate before, Tristate after) { if (after.IsYes()) { VisitNearby(index, false); } if (before.IsYes()) { // Must be backtracking. // The main backtrack mechanism will handle undoing bans, and // undos are always in order, so we just need to reverse VisitNearby VisitNearby(index, true); } }
public void Notify(int index, Tristate before, Tristate after) { switch (before) { case Tristate.No: NoCount--; break; case Tristate.Maybe: MaybeCount--; break; case Tristate.Yes: YesCount--; break; } switch (after) { case Tristate.No: NoCount++; break; case Tristate.Maybe: MaybeCount++; break; case Tristate.Yes: YesCount++; break; } }
public static string ConcatToString([NotNull] string delimiter, Tristate addLineFeed, params string[] args) { var sb = new StringBuilder(); if (args.Length > 0) { for (var argCount = 0; argCount < args.Length; argCount++) { var value = args[argCount]; //TODO: ADD EXTENSION METHOD TO TEST FOR ENUM VALUES if (addLineFeed is Tristate.True or Tristate.UseDefault) { //TODO: THIS CONDITION NOT BEING TESTED _ = sb.AppendLine(value); } else { _ = sb.Append(string.Concat(value, delimiter)); } }
private void _createInventoryGroupPermission( CswNbtObjClassRole Role, Tristate Request, Tristate Receive ) { CswNbtMetaDataNodeType InventoryGroupPermissionNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Inventory Group Permission" ); if( InventoryGroupPermissionNT != null && InventoryGroupNode != null ) { CswNbtObjClassInventoryGroupPermission InvGrpPermNode = _CswNbtSchemaModTrnsctn.Nodes.makeNodeFromNodeTypeId( InventoryGroupPermissionNT.NodeTypeId, CswNbtNodeCollection.MakeNodeOperation.WriteNode ); InvGrpPermNode.InventoryGroup.RelatedNodeId = InventoryGroupNode.NodeId; InvGrpPermNode.Role.RelatedNodeId = Role.NodeId; //WorkUnit? InvGrpPermNode.View.Checked = Tristate.True; InvGrpPermNode.Edit.Checked = CswConvert.ToTristate( Role.Name.Text != "CISPro_View_Only" ); InvGrpPermNode.Dispense.Checked = CswConvert.ToTristate( Role.Name.Text != "CISPro_View_Only" ); InvGrpPermNode.Request.Checked = Request; InvGrpPermNode.Dispose.Checked = CswConvert.ToTristate( Role.Name.Text != "CISPro_View_Only" ); InvGrpPermNode.Undispose.Checked = CswConvert.ToTristate( Role.Name.Text == "CISPro_Admin" ); //InvGrpPermNode.Receive.Checked = Receive; InvGrpPermNode.postChanges( false ); } }
/// <summary> /// Checks if there is more than one TweakScale instance on this part. /// </summary> /// <returns>True if duplicates exist, false otherwise.</returns> private bool CheckForDuplicateTweakScale() { if (_duplicate == Tristate.False) { return(false); } if (_duplicate == Tristate.True) { return(true); } if (this != part.GetComponent <TweakScale>()) { Tools.LogWf("Duplicate TweakScale module on part [{0}] {1}", part.partInfo.name, part.partInfo.title); Fields["tweakScale"].guiActiveEditor = false; Fields["tweakName"].guiActiveEditor = false; _duplicate = Tristate.True; return(true); } _duplicate = Tristate.False; return(false); }
public override void Process(HttpRequestArgs args) { Assert.ArgumentNotNull(args, "args"); if (!CDNSettings.Enabled) { return; } bool shouldFilter = (Sitecore.Context.Item != null || CDNManager.ShouldProcessRequest(args.Url.FilePathWithQueryString)) && // if an item is resolved (this is a page request) or file ext is listed in <processRequests> !CDNManager.ShouldExcludeProcessRequest(args.Url.FilePathWithQueryString) && // if the url is not on the excluded list Sitecore.Context.Site != null && // and a site was resolved Sitecore.Context.PageMode.IsNormal && // and the site is not in editing mode !string.IsNullOrEmpty(CDNManager.GetCDNHostName()); // and the current site is not in the excluded sites list // querystring cdn=1 to force replacement // querystring cdn=0 to force no replacement Tristate force = MainUtil.GetTristate(WebUtil.GetQueryString("cdn"), Tristate.Undefined); if (force == Tristate.False) { shouldFilter = false; } else if (force == Tristate.True) { shouldFilter = true; } if (shouldFilter) { var response = HttpContext.Current.Response; if (response != null) { // replace the default response filter stream with our replacer filter response.Filter = new MediaUrlFilter(response.Filter); } } }
public static string ConcatToString(string delimiter, Tristate addLineFeed, [NotNull] params string[] args) { // TODO: ADD UNIT TEST! delimiter = delimiter.ArgumentNotNullOrEmpty(); args = args.ArgumentNotNull(); var sb = new StringBuilder(); if (args.Length > 0) { for (var argumentIndex = 0; argumentIndex < args.Length; argumentIndex++) { var value = args[argumentIndex]; if (addLineFeed is Tristate.True or Tristate.UseDefault) { _ = sb.AppendLine(value); } else { _ = sb.Append(string.Concat(value, delimiter)); } }
/// <summary> /// 将值重置为未设置状态。 /// </summary> public void Reset() { isUnique = Tristate.NotSure; }
public void SetInterpolatedShare( Tristate share ) { if ( _share != Tristate.DoNotKnow) throw new InvalidOperationException(string.Format("The relationship for {0} and {1} already has a share value of {2}.", _subjectTag1, _subjectTag2, _share)); _share = share; _isInterpolated = true; }
public RGen2Pass1( ImportDataSet dsImport, LinksDataSet dsLinks, LinksDataSet.tblRelatedStructureRow drLeft, LinksDataSet.tblRelatedStructureRow drRight ) { if ( dsImport == null ) throw new ArgumentNullException("dsImport"); if ( dsLinks == null ) throw new ArgumentNullException("dsLinks"); if ( drLeft == null ) throw new ArgumentNullException("drLeft"); if ( drRight == null ) throw new ArgumentNullException("drRight"); if ( dsImport.tblLinks2004Gen2.Count == 0 ) throw new InvalidOperationException("tblLinks2004Gen2 must NOT be empty before assigning R values from it."); if ( dsLinks.tblMzManual.Count == 0 ) throw new InvalidOperationException("tblMzManual must NOT be empty before assigning R values from it."); if ( dsLinks.tblSubject.Count == 0 ) throw new InvalidOperationException("tblSubject must NOT be empty before assigning R values from it."); if ( dsLinks.tblSubjectDetails.Count == 0 ) throw new InvalidOperationException("tblSubjectDetails must NOT be empty before assigning R values from it."); if ( dsLinks.tblMarkerGen2.Count == 0 ) throw new InvalidOperationException("tblMarkerGen2 must NOT be empty before assigning R values from it."); _dsImport = dsImport; _dsLinks = dsLinks; _drLeft = drLeft; _drRight = drRight; _idRelatedLeft = _drLeft.ID; _idRelatedRight = _drRight.ID; _drBare1 = _dsLinks.tblSubject.FindBySubjectTag(drLeft.SubjectTag_S1); _drBare2 = _dsLinks.tblSubject.FindBySubjectTag(drLeft.SubjectTag_S2); _drSubjectDetails1 = _dsLinks.tblSubjectDetails.FindBySubjectTag(drLeft.SubjectTag_S1); _drSubjectDetails2 = _dsLinks.tblSubjectDetails.FindBySubjectTag(drLeft.SubjectTag_S2); _extendedID = _drLeft.tblSubjectRowByFK_tblRelatedStructure_tblSubject_Subject1.ExtendedID; if ( _drSubjectDetails1.BirthOrderInNls <= _drSubjectDetails2.BirthOrderInNls ) {//This is the way it usually is. Recall twins were assigned tied birth orders _idRelatedOlderAboutYounger = _idRelatedLeft; _idRelatedYoungerAboutOlder = _idRelatedRight; } else if ( _drSubjectDetails1.BirthOrderInNls > _drSubjectDetails2.BirthOrderInNls ) { _idRelatedOlderAboutYounger = _idRelatedRight; _idRelatedYoungerAboutOlder = _idRelatedLeft; } _dtMarkersGen2 = MarkerGen2.PairRelevantMarkerRows(_idRelatedLeft, _idRelatedRight, _dsLinks, _extendedID); LinksDataSet.tblMzManualRow drMzManual = Retrieve.MzManualRecord(_drBare1, _drBare2, _dsLinks); if ( drMzManual == null ) { _multipleBirth = MultipleBirth.No; _isMZ = Tristate.No; } else { _multipleBirth = (MultipleBirth)drMzManual.MultipleBirthIfSameSex; _isMZ = (Tristate)drMzManual.IsMz; } MarkerEvidence babyDaddyDeathDate = MarkerGen2.RetrieveBiodadMarkerFromGen1(_idRelatedOlderAboutYounger, MarkerType.BabyDaddyDeathDate, _dtMarkersGen2); MarkerEvidence babyDaddyAlive = MarkerGen2.RetrieveBiodadMarkerFromGen1(_idRelatedOlderAboutYounger, MarkerType.BabyDaddyAlive, _dtMarkersGen2); MarkerEvidence babyDaddyInHH = MarkerGen2.RetrieveBiodadMarkerFromGen1(_idRelatedOlderAboutYounger, MarkerType.BabyDaddyInHH, _dtMarkersGen2); MarkerEvidence babyDaddyLeftHHDate = MarkerGen2.RetrieveBiodadMarkerFromGen1(_idRelatedOlderAboutYounger, MarkerType.BabyDaddyLeftHHDate, _dtMarkersGen2); MarkerEvidence babyDaddyDistanceFromHH = MarkerGen2.RetrieveBiodadMarkerFromGen1(_idRelatedOlderAboutYounger, MarkerType.BabyDaddyDistanceFromHH, _dtMarkersGen2); MarkerEvidence babyDaddyAsthma = MarkerGen2.RetrieveBiodadMarkerFromGen1(_idRelatedOlderAboutYounger, MarkerType.BabyDaddyAsthma, _dtMarkersGen2); _rImplicitPass1 = CalculateRImplicitPass1(babyDaddyDeathDate, babyDaddyAlive, babyDaddyInHH, babyDaddyLeftHHDate, babyDaddyDistanceFromHH, babyDaddyAsthma); //_rImplicit not set; _rImplicit2004 = RetrieveRImplicit2004(); _rExplicitOldestSibVersion = CalculateRExplicitOldestSibVersion(); _rExplicitYoungestSibVersion = CalculateRExplicitYoungestSibVersion(); _rExplicitPass1 = CalculateRExplicitPass1(_isMZ, _multipleBirth); //_rExplicit not set; _rPass1 = CalculateRPass1(); //_r not set; //_rPeek not set; }
internal static Tristate ReadConfigurationTristate(string settingName, Tristate defaultValue) { return(ReadConfigurationEnum <Tristate>(settingName, defaultValue)); }
public static bool AddRange <T>([NotNull] this ICollection <T> collection, [NotNull] IEnumerable <T> items, Tristate ensureUnique = Tristate.False) { items = items.ArgumentNotNull(); collection = collection.ArgumentNotNull().ArgumentNotReadOnly(); var returnValue = false; if (items.HasItems()) { items.ToList() .ForEach(item => { if (ensureUnique is Tristate.True or Tristate.UseDefault) { _ = collection.AddIfNotExists(item); returnValue = true; } else { collection.Add(item); returnValue = true; } });
public static void AppendKeyValue([NotNull] this StringBuilder sb, [NotNull] string key, [NotNull] string value, Tristate includeQuotes = Tristate.True, Tristate includeComma = Tristate.True) { sb = sb.ArgumentNotNull(); key = key.ArgumentNotNullOrEmpty(); value = value.ArgumentNotNullOrEmpty(); includeQuotes = includeQuotes.ArgumentDefined(); includeComma = includeComma.ArgumentDefined(); _ = sb.Append(key); _ = sb.Append(ControlChars.Equal); if (includeQuotes is Tristate.True or Tristate.UseDefault) { _ = sb.Append(ControlChars.Quote); var lastSpecialIndex = 0; int specialIndex; while (true) { specialIndex = value.IndexOfAny(_specialCharacters, lastSpecialIndex); if (specialIndex >= 0) { //TODO: THIS CONDITION NOT BEING TESTED FOR APPEND _ = sb.Append(value, lastSpecialIndex, specialIndex - lastSpecialIndex); _ = sb.Append(ControlChars.Backslash); _ = sb.Append(value[specialIndex]); lastSpecialIndex = specialIndex + 1; } else { _ = sb.Append(value, lastSpecialIndex, value.Length - lastSpecialIndex); break; } } _ = sb.Append(ControlChars.Quote); }
private void Verify(string source, Tristate[] expectedStates, string[] preprocessorSymbolsA = null, string[] preprocessorSymbolsB = null) { if (preprocessorSymbolsA == null) { preprocessorSymbolsA = s_defaultPreprocessorSymbolsA; } if (preprocessorSymbolsB == null) { preprocessorSymbolsB = s_defaultPreprocessorSymbolsB; } var projectA = CreateSolution(new[] { source }).Projects.Single(); var engine = AnalysisEngine.FromProjects( new[] { projectA }, symbolConfigurations: new[] { preprocessorSymbolsA, preprocessorSymbolsB }); var regionInfo = engine.GetConditionalRegionInfo().Result.Single(); var regions = regionInfo.Chains.SelectMany(c => c.Regions).ToArray(); Array.Sort(regions); Assert.Equal(expectedStates.Length, regions.Length); // Make sure the state of each region is what we expect for (int i = 0; i < expectedStates.Length; i++) { var expectedState = expectedStates[i]; var region = regions[i]; if (expectedState != region.State) { Assert.False(true, string.Format("The state of the region on line {0} is {1}, expected {2}: {3}", region.Location.GetLineSpan().StartLinePosition.Line, region.State, expectedState, region.StartDirective.ToFullString())); } } }
public TranslateContainer( Tristate state1, Tristate state2, float? r ) { State1 = state1; State2 = state2; R = r; }
private float? _rPass1 = float.NaN; // float.NaN; #endregion Fields #region Constructors public RGen1Pass1( ImportDataSet dsImport, LinksDataSet dsLinks, LinksDataSet.tblRelatedStructureRow drLeft, LinksDataSet.tblRelatedStructureRow drRight ) { if ( dsImport == null ) throw new ArgumentNullException("dsImport"); if ( dsLinks == null ) throw new ArgumentNullException("dsLinks"); if ( drLeft == null ) throw new ArgumentNullException("drLeft"); if ( drRight == null ) throw new ArgumentNullException("drRight"); if ( dsImport.tblLinks2004Gen1.Count == 0 ) throw new InvalidOperationException("tblLinks2004Gen1 must NOT be empty before assigning R values from it."); if ( dsLinks.tblMzManual.Count == 0 ) throw new InvalidOperationException("tblMzManual must NOT be empty before assigning R values from it."); if ( dsLinks.tblSubject.Count == 0 ) throw new InvalidOperationException("tblSubject must NOT be empty before assigning R values from it."); if ( dsLinks.tblRosterGen1.Count == 0 ) throw new InvalidOperationException("tblRosterGen1 must NOT be empty before assigning R values from it."); if ( dsLinks.tblMarkerGen1.Count == 0 ) throw new InvalidOperationException("tblMarkerGen2 must NOT be empty before assigning R values from it."); if ( dsLinks.tblSubjectDetails.Count == 0 ) throw new InvalidOperationException("tblSubjectDetails must NOT be empty before assigning R values from it."); _dsImport = dsImport; _dsLinks = dsLinks; _drLeft = drLeft; _drRight = drRight; _idRelatedLeft = _drLeft.ID; _idRelatedRight = _drRight.ID; _drSubjectDetails1 = _dsLinks.tblSubjectDetails.FindBySubjectTag(drLeft.SubjectTag_S1); _drSubjectDetails2 = _dsLinks.tblSubjectDetails.FindBySubjectTag(drLeft.SubjectTag_S2); _extendedID = _drLeft.tblSubjectRowByFK_tblRelatedStructure_tblSubject_Subject1.ExtendedID; //LinksDataSet.tblRosterGen1Row drRoster = _dsLinks.tblRosterGen1.FindByRelatedID(drLeft.ID); //Tristate rosterShareBiomom = (Tristate)drRoster.ShareBiomom; //Tristate rosterShareBiodad = (Tristate)drRoster.ShareBiodad; //if ( drRoster.IsRNull() ) _rRoster = null; //else _rRoster = (float)drRoster.R; if ( _drSubjectDetails1.BirthOrderInNls <= _drSubjectDetails2.BirthOrderInNls ) {//This is the way it usually is. Remember that twins were assigned tied birth orders _idRelatedOlderAboutYounger = _idRelatedLeft; _idRelatedYoungerAboutOlder = _idRelatedRight; } else if ( _drSubjectDetails1.BirthOrderInNls > _drSubjectDetails2.BirthOrderInNls ) { _idRelatedOlderAboutYounger = _idRelatedRight; _idRelatedYoungerAboutOlder = _idRelatedLeft; } _dtMarkersGen1 = MarkerGen1.PairRelevantMarkerRows(_idRelatedLeft, _idRelatedRight, _dsLinks, _extendedID); LinksDataSet.tblMzManualRow drMz = Retrieve.MzManualRecord(_drLeft.SubjectTag_S1, _drLeft.SubjectTag_S2, _dsLinks); if ( drMz == null ) { _multipleBirth = MultipleBirth.No; _isMZ = Tristate.No; _isRelatedInMzManual = Tristate.DoNotKnow; } else { _multipleBirth = (MultipleBirth)drMz.MultipleBirthIfSameSex; _isMZ = (Tristate)drMz.IsMz; if ( drMz.IsRelatedNull() ) _isRelatedInMzManual = Tristate.DoNotKnow; else if ( drMz.Related ) _isRelatedInMzManual = Tristate.Yes; else _isRelatedInMzManual = Tristate.No; } MarkerEvidence explicitBiomomFromOlder = ReduceShareBioparentToOne(MarkerType.ShareBiomom, ItemYears.Gen1ShareBioparent.Length, _idRelatedOlderAboutYounger); MarkerEvidence explicitBiodadFromOlder = ReduceShareBioparentToOne(MarkerType.ShareBiodad, ItemYears.Gen1ShareBioparent.Length, _idRelatedOlderAboutYounger); MarkerEvidence explicitBiomomFromYounger = ReduceShareBioparentToOne(MarkerType.ShareBiomom, ItemYears.Gen1ShareBioparent.Length, _idRelatedYoungerAboutOlder); MarkerEvidence explicitBiodadFromYounger = ReduceShareBioparentToOne(MarkerType.ShareBiodad, ItemYears.Gen1ShareBioparent.Length, _idRelatedYoungerAboutOlder); MarkerEvidence biomomInHH1979 = MarkerGen1.RetrieveParentMarkerMultiYear(_idRelatedOlderAboutYounger, MarkerType.Gen1BiomomInHH, 1979, Bioparent.Mom, _dtMarkersGen1); MarkerEvidence biodadInHH1979 = MarkerGen1.RetrieveParentMarkerMultiYear(_idRelatedOlderAboutYounger, MarkerType.Gen1BiodadInHH, 1979, Bioparent.Dad, _dtMarkersGen1); MarkerEvidence biomomDeathAge = MarkerGen1.RetrieveParentMarkerSingleYear(_idRelatedOlderAboutYounger, MarkerType.Gen1BiomomDeathAge, Bioparent.Mom, _dtMarkersGen1); MarkerEvidence biodadDeathAge = MarkerGen1.RetrieveParentMarkerSingleYear(_idRelatedOlderAboutYounger, MarkerType.Gen1BiodadDeathAge, Bioparent.Dad, _dtMarkersGen1); _explicitShareBiomomPass1 = CommonFunctions.TranslateEvidenceToTristate(explicitBiomomFromOlder, explicitBiomomFromYounger); _explicitShareBiodadPass1 = CommonFunctions.TranslateEvidenceToTristate(explicitBiodadFromOlder, explicitBiodadFromYounger); _implicitShareBiomomPass1 = ImplicitShareBioparent(inHH1979: biomomInHH1979, deathAge: biomomDeathAge); _implicitShareBiodadPass1 = ImplicitShareBioparent(inHH1979: biodadInHH1979, deathAge: biodadDeathAge); _shareBiomomPass1 = CommonFunctions.TakePriority(_explicitShareBiomomPass1, _implicitShareBiomomPass1); _shareBiodadPass1 = CommonFunctions.TakePriority(_explicitShareBiodadPass1, _implicitShareBiodadPass1); _rExplicitOldestSibVersion = CalculateRExplicitSingleSibVersion(explicitBiomomFromOlder, explicitBiodadFromOlder); _rExplicitYoungestSibVersion = CalculateRExplicitSingleSibVersion(explicitBiomomFromYounger, explicitBiodadFromYounger); _rExplicitPass1 = CommonFunctions.TranslateToR(shareBiomom: _explicitShareBiomomPass1, shareBiodad: _explicitShareBiodadPass1, mustDecide: false); _rImplicitPass1 = CommonFunctions.TranslateToR(shareBiomom: _implicitShareBiomomPass1, shareBiodad: _implicitShareBiodadPass1, mustDecide: false); _rImplicit2004 = RetrieveRImplicit2004(); _rPass1 = CalculateRFull(shareBiomom: _shareBiomomPass1, shareBiodad: _shareBiodadPass1, multiple: _multipleBirth, isMZ: _isMZ, isRelatedInMZManual: _isRelatedInMzManual, idRelated: _idRelatedLeft, dtRoster: _dsLinks.tblRosterGen1); }
public static float? CalculateRFull( Tristate shareBiomom, Tristate shareBiodad, MultipleBirth multiple, Tristate isMZ, Tristate isRelatedInMZManual, Int32 idRelated, LinksDataSet.tblRosterGen1DataTable dtRoster ) { float? rRoster = CalculateRRoster(idRelated, dtRoster); if ( isMZ == BaseAssembly.Tristate.Yes ) { return RCoefficients.MzTrue; } else if ( isRelatedInMZManual == Tristate.No ) { return RCoefficients.NotRelated; //Of the 21 Gen1 subjects in tblMZManual with Related=0, 17 ended up with R=0 (as of 11/9/2012). 1 was assigned R=.5; 3 were assigned R=NULL (which I want to override now here, looking at the DOB differences). } else if ( isMZ == BaseAssembly.Tristate.DoNotKnow && isRelatedInMZManual == Tristate.Yes ) { Trace.Assert(multiple == MultipleBirth.Twin || multiple == MultipleBirth.Trip || multiple == MultipleBirth.TwinOrTrip, "To be assigned full sib, they've got to be assigned to be a twin/trip."); return RCoefficients.MzAmbiguous; } else if ( multiple == MultipleBirth.Twin || multiple == MultipleBirth.Trip || multiple == MultipleBirth.TwinOrTrip ) { return RCoefficients.SiblingFull; } else if ( rRoster.HasValue ) { return rRoster; } else { //The implicits & explicits were already combined to get the values of shareBiomom & shareBiodad. return CommonFunctions.TranslateToR(shareBiomom: shareBiomom, shareBiodad: shareBiodad, mustDecide: false); } }
/// <summary> /// Checks if there is more than one TweakScale instance on this part. /// </summary> /// <returns>True if duplicates exist, false otherwise.</returns> private bool CheckForDuplicateTweakScale() { if (_duplicate == Tristate.False) return false; if (_duplicate == Tristate.True) return true; if (this != part.GetComponent<TweakScale>()) { Tools.LogWf("Duplicate TweakScale module on part [{0}] {1}", part.partInfo.name, part.partInfo.title); Fields["tweakScale"].guiActiveEditor = false; Fields["tweakName"].guiActiveEditor = false; _duplicate = Tristate.True; return true; } _duplicate = Tristate.False; return false; }
public Tristate And(Tristate one, Tristate two) { if (Tristate.Eager.Equals(one) || Tristate.Eager.Equals(two)) return Tristate.Eager; if( Tristate.DontKnow.Equals(one)) return two; if( Tristate.DontKnow.Equals(two)) return one; return Tristate.Lazy; }
public bool Next(int index, Tristate selected) { switch (state) { case State.Initial: if (selected.IsYes()) { state = State.InRun; runCount = 1; runStartIndex = index; } return(false); case State.JustAfterRun: if (selected.IsYes()) { state = State.InRun; runCount = 1; runStartIndex = index; goto checkCases; } else { state = State.Initial; prevRunCount = 0; runCount = 0; } return(false); case State.InRun: if (selected.IsYes()) { state = State.InRun; runCount += 1; if (runCount > max) { // Immediate contradiction return(true); } goto checkCases; } else { // Also case 1. if (runCount == max) { if (selected.Possible()) { banAt(index); } } state = State.JustAfterRun; prevRunCount = runCount; runCount = 0; } return(false); } // Unreachable throw new Exception("Unreachable"); checkCases: // Have we entered case 1 or 2? if (prevRunCount + runCount == max) { // Ban on the previous end of the run if (runStartIndex == 0) { if (periodic) { banAt(indexCount - 1); } } else { banAt(runStartIndex - 1); } } return(false); }
private static void Verify(string expression, Tristate expectedValue) { Assert.Equal(expectedValue, EvaluateExpression(expression)); }
/// <summary> /// 使用指定的初始值和比较器初始化 <see cref="UniqueValue{TValue}"/> 类的新实例。 /// </summary> /// <param name="value">初始的设定值。</param> /// <param name="comparer">值相等的比较器。</param> public UniqueValue(TValue value, IEqualityComparer <TValue> comparer) : this(comparer) { uniqueValue = value; isUnique = Tristate.True; }
private ComparisonStatus(Tristate state) { childStatuses = new ComparisonStatuses(); this.state = state; }
/// <summary> /// Gets <see cref="PersonRecord" /> array. /// </summary> /// <param name="clone">If set to <see cref="Tristate.UseDefault" /> or <see cref="Tristate.True" />, clones the collection.</param> /// <param name="collectionSize">Size of the collection.</param> /// <returns>PersonProper[].</returns> public PersonRecord[] GetPersonRecordArray(Tristate clone = Tristate.True, CollectionSize collectionSize = CollectionSize.Full) { return(collectionSize is CollectionSize.Full ? clone is Tristate.True or Tristate.UseDefault ? this._personRecordArray.Clone <PersonRecord[]>() : this._personRecordArray : clone is Tristate.True or Tristate.UseDefault ? this._personRecordArrayHalf.Clone <PersonRecord[]>() : this._personRecordArrayHalf); }
public static MarkerEvidence RosterShareBioParentOrGrandparent( Tristate tristate ) { switch ( tristate ) { case Tristate.No: return MarkerEvidence.Disconfirms; case Tristate.Yes: return MarkerEvidence.Consistent; case Tristate.DoNotKnow: return MarkerEvidence.Ambiguous; default: throw new ArgumentOutOfRangeException("tristate", tristate, "This value is not permitted."); } }
public void CopyFrom(ComparisonStatus comparisonStatus) { state = comparisonStatus.state; if(childStatuses == null) throw new Exception("we are screwed"); childStatuses.AddRange(comparisonStatus.childStatuses); }
public static float? TranslateToR( Tristate shareBiomom, Tristate shareBiodad, bool mustDecide ) { if ( shareBiomom == Tristate.DoNotKnow && shareBiodad == Tristate.DoNotKnow ) return null; else if ( shareBiomom == Tristate.No && shareBiodad == Tristate.No ) return RCoefficients.NotRelated; else if ( shareBiomom == Tristate.Yes && shareBiodad == Tristate.Yes ) return RCoefficients.SiblingFull; else if ( shareBiomom == Tristate.No && shareBiodad == Tristate.Yes ) return RCoefficients.SiblingHalf; else if ( shareBiomom == Tristate.Yes && shareBiodad == Tristate.No ) return RCoefficients.SiblingHalf; else if ( !mustDecide ) return null; else if ( shareBiomom == Tristate.DoNotKnow && shareBiodad == Tristate.No ) return RCoefficients.SiblingHalfOrLess; //What does the team think about this? else if ( shareBiomom == Tristate.No && shareBiodad == Tristate.DoNotKnow ) return RCoefficients.SiblingHalfOrLess; //What does the team think about this? else if ( shareBiomom == Tristate.DoNotKnow && shareBiodad == Tristate.Yes ) return RCoefficients.SiblingAmbiguous; else if ( shareBiomom == Tristate.Yes && shareBiodad == Tristate.DoNotKnow ) return RCoefficients.SiblingAmbiguous; else throw new InvalidOperationException("All conditions should have been caught."); }
internal unsafe void ChangeCase(char* src, int srcLen, char* dstBuffer, int dstBufferCapacity, bool bToUpper) { if (IsInvariant) { Interop.GlobalizationInterop.ChangeCaseInvariant(src, srcLen, dstBuffer, dstBufferCapacity, bToUpper); } else { if (_needsTurkishCasing == Tristate.NotInitialized) { _needsTurkishCasing = NeedsTurkishCasing(_textInfoName) ? Tristate.True : Tristate.False; } if (_needsTurkishCasing == Tristate.True) { Interop.GlobalizationInterop.ChangeCaseTurkish(src, srcLen, dstBuffer, dstBufferCapacity, bToUpper); } else { Interop.GlobalizationInterop.ChangeCase(src, srcLen, dstBuffer, dstBufferCapacity, bToUpper); } } }
public void Update() { if (duplicate != Tristate.False) { if (duplicate == Tristate.True) { return; } if (this != part.Modules.OfType<TweakScale>().First()) { Tools.LogWf("Duplicate TweakScale module on part [{0}] {1}", part.partInfo.name, part.partInfo.title); Fields["tweakScale"].guiActiveEditor = false; Fields["tweakName"].guiActiveEditor = false; duplicate = Tristate.True; return; } duplicate = Tristate.False; } if (scaleFactors.Length == 0) { if (!invalidCfg) { invalidCfg = true; Tools.LogWf("{0}({1}) has no valid scale factors. This is probably caused by an invalid TweakScale configuration for the part.", part.name, part.partInfo.title); } return; } if (HighLogic.LoadedSceneIsEditor && currentScale >= 0f) { bool changed = isFreeScale ? tweakScale != currentScale : currentScale != scaleFactors[tweakName]; if (changed) // user has changed the scale tweakable { if (!isFreeScale) { tweakScale = scaleFactors[tweakName]; } updateByWidth(true); updateWindow(); foreach (var updater in updaters) { updater.OnRescale(scalingFactor); } currentScale = tweakScale; } else if (part.transform.GetChild(0).localScale != savedScale) // editor frequently nukes our OnStart resize some time later { updateByWidth(false); } } foreach (var upd in updaters.OfType<IUpdateable>()) { upd.OnUpdate(); } }
private float? CalculateRExplicitPass1( Tristate isMZ, MultipleBirth multipleBirth ) { float? rExplicitPreTwin = null; if ( !RExplicitOldestSibVersion.HasValue && !RExplicitYoungestSibVersion.HasValue ) rExplicitPreTwin = null; else if ( !RExplicitOldestSibVersion.HasValue ) rExplicitPreTwin = RExplicitYoungestSibVersion.Value; else if ( !RExplicitYoungestSibVersion.HasValue ) rExplicitPreTwin = RExplicitOldestSibVersion.Value; else if ( RExplicitOldestSibVersion.Value == RExplicitYoungestSibVersion.Value ) rExplicitPreTwin = RExplicitOldestSibVersion.Value; else if ( RExplicitOldestSibVersion.Value == RCoefficients.SiblingAmbiguous ) rExplicitPreTwin = RExplicitYoungestSibVersion.Value; else if ( RExplicitYoungestSibVersion.Value == RCoefficients.SiblingAmbiguous ) rExplicitPreTwin = RExplicitOldestSibVersion.Value; else if ( RExplicitOldestSibVersion.Value == RCoefficients.SiblingFull && RExplicitYoungestSibVersion.Value == RCoefficients.SiblingHalf ) rExplicitPreTwin = RCoefficients.SiblingAmbiguous; else if ( RExplicitYoungestSibVersion.Value == RCoefficients.SiblingFull && RExplicitOldestSibVersion.Value == RCoefficients.SiblingHalf ) rExplicitPreTwin = RCoefficients.SiblingAmbiguous; else throw new InvalidOperationException("All condition should have been caught."); return ExplicitAgreementWithTwins(isMZ, multipleBirth, rExplicitPreTwin); //return rExplicitPreTwin; }
public IActionResult Index(Tristate model) { return(View(model)); }
internal static float? ExplicitAgreementWithTwins( Tristate isMz, MultipleBirth multipleBirth, float? newRExplicit ) { if ( !newRExplicit.HasValue ) return null; else if ( isMz == Tristate.Yes ) { Trace.Assert(newRExplicit >= RCoefficients.SiblingFull, "If the pair has been identified as MZ, their RExplicit should be >= .5."); return RCoefficients.MzTrue; } else if ( isMz == Tristate.DoNotKnow ) { Trace.Assert(newRExplicit >= RCoefficients.SiblingAmbiguous, "If the pair has been identified as an ambiguous MZ, their RExplicit should be >= .5."); return RCoefficients.MzAmbiguous; } else if ( multipleBirth == MultipleBirth.Trip || multipleBirth == MultipleBirth.Twin || multipleBirth == MultipleBirth.TwinOrTrip ) { Trace.Assert(newRExplicit >= RCoefficients.SiblingFull, "If the pair has been identified as Twin/Trip, their RExplicit should be >= .5."); return newRExplicit; } else { return newRExplicit; } }
public IActionResult Index() { var model = new Tristate(); return(View(model)); }
/// <summary> /// 使用指定的初始值初始化 <see cref="UniqueValue{TValue}"/> 类的新实例。 /// </summary> /// <param name="value">初始的设定值。</param> public UniqueValue(TValue value) : this() { uniqueValue = value; isUnique = Tristate.True; }
private static float? CalculateR( float? rFull, Tristate sameGeneration ) { if( !rFull.HasValue ) return null; else if( Constants.Gen1RsToExcludeFromR.Contains(rFull.Value) ) return null; else if( sameGeneration == Tristate.No ) return null; else if( sameGeneration == Tristate.DoNotKnow ) return null; else return (float)rFull.Value; }
public Options() { m_parser = new OptionParser(); m_parser.Add( "config", arg => m_symbolConfigurations.Add(ParseSymbolList(arg)), parameterUsage: "<symbol list>", description: "Specify a complete symbol configuration", allowMultiple: true); m_parser.Add( "ignore", arg => m_ignoredSymbols.AddRange(ParseSymbolList(arg)), parameterUsage: "<symbol list>", description: "Ignore a list of symbols (treat as varying)", allowMultiple: true); m_parser.Add( "define", arg => m_definedSymbols.AddRange(ParseSymbolList(arg)), parameterUsage: "<symbol list>", description: "Define a list of symbols (treat as always true)", allowMultiple: true); m_parser.Add( "disable", arg => m_disabledSymbols.AddRange(ParseSymbolList(arg)), parameterUsage: "<symbol list>", description: "Disable a list of symbols (treat as always disabled)", allowMultiple: true); m_parser.Add( "default", arg => UndefinedSymbolValue = Tristate.Parse(arg), parameterUsage: "<false|true|varying>", description: "Set the default value for symbols which do not have a specified value (defaults to varying)"); m_parser.Add( "printdisabled", () => PrintDisabled = true, description: "Print the list of always disabled conditional regions"); m_parser.Add( "printenabled", () => PrintEnabled = true, description: "Print the list of always enabled conditional regions"); m_parser.Add( "printvarying", () => PrintVarying = true, description: "Print the list of varying conditional regions"); m_parser.Add( "printsymbols", () => PrintSymbolInfo = true, description: "Print the lists of uniquely specified preprocessor symbols, symbols visited during analysis, and symbols not encountered during analysis"); m_parser.Add( "print", () => PrintDisabled = PrintEnabled = PrintVarying = PrintSymbolInfo = true, description: "Print the entire list of conditional regions and the lists of preprocessor symbols (combination of printenabled, printdisabled, printvarying, and printsymbols)"); m_parser.Add( "edit", () => Edit = true, "Perform edits to remove always enabled and always disabled conditional regions from source files, and simplify preprocessor expressions which evaluate to 'varying'"); }
private Tristate AddressBiomom( Tristate explicitShare, Tristate implicitShare ) { Tristate biomomPass1 = (Tristate)_drValue.ShareBiomomPass1; if ( biomomPass1 != Tristate.DoNotKnow ) return biomomPass1; DataColumn dcPass1 = _dsLinks.tblRelatedValues.ShareBiomomPass1Column; PairShare[] pairs = PairShare.BuildRelatedPairsOfGen1Housemates(dcPass1, _drLeft.SubjectTag_S1, _drLeft.SubjectTag_S2, _drLeft.ExtendedID, _dsLinks); InterpolateShare interpolate = new InterpolateShare(pairs); Tristate newShare = interpolate.Interpolate(_drLeft.SubjectTag_S1, _drLeft.SubjectTag_S2); if ( newShare != Tristate.DoNotKnow ) return newShare; else return CommonFunctions.TakePriority(explicitShare, implicitShare); }
/// <summary> /// Convert a Tristate value to a string value. /// </summary> /// <param name="triValue">A value that can be either true, false, or unanswered.</param> /// <returns>A string if the value is true or false, or null if it is neither.</returns> protected string TristateToString(Tristate triValue) { switch (triValue) { case Tristate.True: return "true"; case Tristate.False: return "false"; } return null; }
public IActionResult Recipe04(Tristate model) { return(View(model)); }
private void AddRosterRow( Int32 relatedID, byte rosterAssignmentID, Int16 responseLower, Int16 responseUpper, bool resolved, float r, float rBoundLower, float rBoundUpper, Tristate sameGeneration, Tristate shareBiodad, Tristate shareBiomom, Tristate shareBioGrandparent, bool inconsistent ) { LinksDataSet.tblRosterGen1Row drNew = _dsLinks.tblRosterGen1.NewtblRosterGen1Row(); //drNew.ExtendedID = extendedID ; drNew.RelatedID = relatedID; drNew.RosterAssignmentID = rosterAssignmentID; drNew.ResponseLower = responseLower; drNew.ResponseUpper = responseUpper; drNew.Resolved = resolved; if ( float.IsNaN(r) ) drNew.SetRNull(); else drNew.R = r; drNew.RBoundLower = rBoundLower; drNew.RBoundUpper = rBoundUpper; drNew.SameGeneration = (byte)sameGeneration; drNew.ShareBiodad = (byte)shareBiodad; drNew.ShareBiomom = (byte)shareBiomom; drNew.ShareBiograndparent = (byte)shareBioGrandparent; drNew.Inconsistent = inconsistent; _dsLinks.tblRosterGen1.AddtblRosterGen1Row(drNew); }
private void AddRow( Int32 subjectTag, Int16 extendedID, Bioparent parent, Tristate inHH, byte age, Int16 yearInHH ) { //lock ( _ds.tblFatherOfGen2 ) { LinksDataSet.tblParentsOfGen1RetroRow drNew = _ds.tblParentsOfGen1Retro.NewtblParentsOfGen1RetroRow(); drNew.SubjectTag = subjectTag; drNew.ExtendedID = extendedID; drNew.Bioparent = (byte)parent; if ( inHH==Tristate.DoNotKnow ) drNew.SetInHHNull(); else drNew.InHH = (inHH==Tristate.Yes); drNew.Age = age; drNew.Year = yearInHH; _ds.tblParentsOfGen1Retro.AddtblParentsOfGen1RetroRow(drNew); //} }
private void PopulateIsAsciiCasingSameAsInvariant() { bool compareResult = CultureInfo.GetCultureInfo(_textInfoName).CompareInfo.Compare("abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", CompareOptions.IgnoreCase) == 0; _isAsciiCasingSameAsInvariant = (compareResult) ? Tristate.True : Tristate.False; }
private Int32 ProcessForOneParent( Tristate bothParentsAlways, Bioparent parent,Int16 yob, LinksDataSet.tblSubjectRow drSubject, LinksDataSet.tblResponseDataTable dtExtendedResponse ) { const byte loopIndexForNever = 255; byte[] loopIndicesAndAges = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 }; Int32 recordsAdded = 0; Item item; switch ( parent ) { case Bioparent.Dad: item = Item.Gen1LivedWithFatherAtAgeX; break; case Bioparent.Mom: item = Item.Gen1LivedWithMotherAtAgeX; break; default: throw new ArgumentOutOfRangeException("parent"); } Tristate responseEver = DetermineOneParentEverInHH(item, _surveyYear, drSubject.SubjectTag, loopIndexForNever, dtExtendedResponse); foreach ( byte loopIndexAndAge in loopIndicesAndAges ) { Tristate inHH; if ( bothParentsAlways == Tristate.Yes ) inHH = Tristate.Yes; else if ( responseEver == Tristate.DoNotKnow ) inHH = Tristate.DoNotKnow; else if ( responseEver == Tristate.Yes ) inHH = DetermineParentInHH(Item.Gen1LivedWithFatherAtAgeX, _surveyYear, drSubject.SubjectTag, loopIndexAndAge, dtExtendedResponse); else if ( responseEver == Tristate.No ) inHH = Tristate.No; else throw new InvalidOperationException("The execution shouldn't have gotten to here in the 'ProcessForOneParent' function."); Int16 yearInHH = Convert.ToInt16(yob + loopIndexAndAge); AddRow(drSubject.SubjectTag, drSubject.ExtendedID, parent, inHH: inHH, age: loopIndexAndAge, yearInHH: yearInHH); recordsAdded += 1; ; } return recordsAdded; }
/// <summary> /// Gets <see cref="Tester.Models.ValueTypes.Coordinate" /> array. /// </summary> /// <param name="clone">If set to <see cref="Tristate.UseDefault" /> or <see cref="Tristate.True" />, clones the collection.</param> /// <param name="collectionSize">Size of the collection.</param> /// <returns>Tester.Models.ValueTypes.Coordinate[].</returns> public Tester.Models.ValueTypes.Coordinate[] GetCoordinateArray(Tristate clone = Tristate.True, CollectionSize collectionSize = CollectionSize.Full) { return(collectionSize is CollectionSize.Full ? clone is Tristate.True or Tristate.UseDefault ? this._coordinateArray.Clone <Tester.Models.ValueTypes.Coordinate[]>() : this._coordinateArray : clone is Tristate.True or Tristate.UseDefault ? this._coordinateArrayHalf.Clone <Tester.Models.ValueTypes.Coordinate[]>() : this._coordinateArrayHalf); }
//public const float LowestRelatedR = (float)(1 / 64); public static MarkerEvidence RosterSameGeneration( Tristate tristate ) { switch ( tristate ) { case Tristate.No: return MarkerEvidence.Disconfirms; case Tristate.Yes: return MarkerEvidence.StronglySupports; case Tristate.DoNotKnow: return MarkerEvidence.Ambiguous; default: throw new ArgumentOutOfRangeException("tristate", tristate, "This value is not permitted."); } }