public ObjectGraphRelationship(IdRef parent, IdRef child, string propertyName, int? index) { this.Parent = parent; this.Child = child; this.PropertyName = propertyName; this.Index = index; }
public void AssertThat_IdRef_FindsSingleMatch_SearchingDownFromFloorWithSameIdAsSearchId() { IdRef i = new IdRef("u1", SearchDirection.Down, RefFilter.All, false, false); var matches = i.Match(_floors, -1); Assert.AreEqual(1, matches.Count()); }
public void AssertThat_IdRef_FindsNothing_SearchingDownFromFloorBelow() { IdRef i = new IdRef("d", SearchDirection.Down, RefFilter.All, false, false); var matches = i.Match(_floors, 5); Assert.AreEqual(0, matches.Count()); }
public SpirvTypeBase ResolveType(IdRef idRef) { if (idRef == IdRef.Empty) { return(null); } return((SpirvTypeBase)_nodeMap[idRef.Id]); }
public void AssertThat_IdRef_DoesNotFindFloorWithGivenId_SearchingUpFromFloorAbove() { IdRef i = new IdRef("d", SearchDirection.Up, RefFilter.All, false, false); var matches = i.Match(_floors, 7); Assert.AreEqual(0, matches.Count()); }
public Node GetNode(IdRef id) { if (id == IdRef.Empty) { return(null); } return(_nodeMap[id.Id]); }
public void AssertThat_IdRef_FindsFloorWithGivenId_SearchingUpFromFloorBelow() { IdRef i = new IdRef("d", SearchDirection.Up, RefFilter.All, false, false); var matches = i.Match(_floors, 5); Assert.AreEqual(1, matches.Count()); Assert.AreEqual(_floors[6], matches.Single()); }
/// <summary> /// Create resource refernece for local /// </summary> public static Reference CreateLocalResourceReference(DomainResourceBase instance) { IdRef idRef = instance.MakeIdRef(); return(new Reference() { ReferenceUrl = idRef.Value, Display = instance.ToString() }); }
/// <summary> /// Create a reasource reference to the specified resource /// </summary> public static Reference <TResource> CreateLocalResourceReference <TResource>(TResource instance) where TResource : DomainResourceBase { IdRef idRef = instance.MakeIdRef(); return(new Reference <TResource>() { Display = instance.ToString(), ReferenceUrl = idRef.Value }); }
public void AssertThat_IdRef_FindsLowestFloorFirst_SearchingUp() { IdRef i = new IdRef("a", SearchDirection.Up, RefFilter.All, false, false); var matches = i.Match(_floors, 0).ToArray(); Assert.AreEqual(3, matches.Count()); Assert.AreEqual(9, matches[0].Index); Assert.AreEqual(10, matches[1].Index); Assert.AreEqual(11, matches[2].Index); }
public void AssertThat_IdRef_FindsHightestFloorFirst_SearchingDown() { IdRef i = new IdRef("g", SearchDirection.Down, RefFilter.All, false, false); var matches = i.Match(_floors, 12).ToArray(); Assert.AreEqual(3, matches.Count()); Assert.AreEqual(3, matches[0].Index); Assert.AreEqual(2, matches[1].Index); Assert.AreEqual(1, matches[2].Index); }
public void AssertThat_BaseRef_SelectsFirstSections_WhenFilterFirstIsSpecified() { IdRef bot = new IdRef("skylobby", SearchDirection.Up, RefFilter.All, false, false); IdRef top = new IdRef("skylobby", SearchDirection.Up, RefFilter.First, false, false); var b = bot.Match(_floors, null).ToArray(); var matched = top.MatchFrom(_floors, bot, b).ToArray(); Assert.AreEqual(2, matched.Count()); Assert.IsTrue(matched.Any(a => a.Key.Index == 4 && a.Value.Index == 8)); Assert.IsTrue(matched.Any(a => a.Key.Index == 8 && a.Value.Index == 12)); }
public void AssertThat_BaseRef_MatchFrom_SelectsNonOverlappingSections_WhenNonOverlappingModeIsSpecified() { IdRef residential = new IdRef("residential", SearchDirection.Up, RefFilter.All, false, false); IdRef skylobby = new IdRef("skylobby", SearchDirection.Up, RefFilter.First, true, false); var res = residential.Match(_floors, null).ToArray(); var matched = skylobby.MatchFrom(_floors, residential, res).ToArray(); //We should have matched all the residential floors, paired with the next skylobby up //Then filtered these floors into groups which overlap, and take the first (i.e. lowest floor to next skylobby) Assert.AreEqual(3, matched.Count()); Assert.IsTrue(matched.Any(a => a.Key.Index == 1 && a.Value.Index == 4)); Assert.IsTrue(matched.Any(a => a.Key.Index == 5 && a.Value.Index == 8)); Assert.IsTrue(matched.Any(a => a.Key.Index == 9 && a.Value.Index == 12)); }
/// <summary> /// Parse idref /// </summary> public static Hl7.Fhir.Model.IdRef ParseIdRef(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.IdRef existingInstance = null) { Hl7.Fhir.Model.IdRef result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.IdRef(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if (atName == "extension") { result.Extension = new List <Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element _id else if (atName == "_id") { result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); } // Parse element value else if (atName == "value") { result.Value = IdRef.Parse(reader.ReadPrimitiveContents(typeof(IdRef))).Value; } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
public void Deserialize(T instruction, ScriptNode node, Deserializer context) { if (!_hasExecutionPins && _type != null) { IdRef <TypeInstruction> value = (IdRef <TypeInstruction>)_type.GetValue(instruction); FunctionSerializer.CreateOutputPin(node, value.Instruction); } if (_hasExecutionPins) { node.EnterPins.Add(new Pin("", null)); node.ExitPins.Add(new PinWithConnection("", null)); } foreach (var idRef in _idRefs) { var sourceRef = (IdRef)idRef.GetValue(instruction); if (sourceRef != null) { var source = context.Deserialize(sourceRef.Instruction); if (source.OutputPins.Count > 0) { node.InputPins.Add(new PinWithConnection(idRef.Name, source.OutputPins[0].Type) { Connection = new Connection(source, source.OutputPins[0]) }); } else { node.InputPins.Add(new PinWithConnection(idRef.Name, null)); } } else { node.InputPins.Add(new PinWithConnection(idRef.Name, null)); } } }
public ReferenceProperty(string name, IdRef reference) { Name = name; Reference = reference; }
protected virtual TypeDesc ResolveType(IdRef type) { return(ResolveType((TypeInstruction)type.Instruction)); }
public ScriptNode Deserialize(IdRef instruction) { return(Deserialize(instruction.Instruction)); }