/// <summary>Initializes a new instance of the <see cref="FhirNodeInfo"/> class.</summary> /// <param name="sourceType"> Type of the source.</param> /// <param name="sourceNode"> Source node.</param> /// <param name="destinationType">The type of the edge.</param> /// <param name="destinationNode">Destination for the edge.</param> public FhirNodeInfo( FhirNodeType sourceType, object sourceNode, FhirNodeType destinationType, object destinationNode) { SourceType = sourceType; if (sourceNode != null) { switch (sourceType) { case FhirNodeType.Primitive: _sourcePrimitive = (FhirPrimitive)sourceNode; _sourceComplex = null; break; case FhirNodeType.DataType: case FhirNodeType.Resource: case FhirNodeType.Component: case FhirNodeType.Profile: _sourcePrimitive = null; _sourceComplex = (FhirComplex)sourceNode; break; case FhirNodeType.Unknown: case FhirNodeType.Self: default: throw new ArgumentException($"Invalid source node type: {sourceType}"); } } DestinationType = destinationType; if (destinationNode != null) { switch (destinationType) { case FhirNodeType.Primitive: _destinationPrimitive = (FhirPrimitive)destinationNode; _destinationComplex = null; break; case FhirNodeType.DataType: case FhirNodeType.Resource: case FhirNodeType.Component: case FhirNodeType.Profile: _destinationPrimitive = null; _destinationComplex = (FhirComplex)destinationNode; break; case FhirNodeType.Unknown: case FhirNodeType.Self: default: _destinationPrimitive = null; _destinationComplex = null; break; } } }
/// <summary>Deep copy.</summary> /// <returns>A FhirPrimitive.</returns> public object Clone() { // generate the base object FhirPrimitive primitive = new FhirPrimitive( Id, Path, BaseTypeName, URL, StandardStatus, IsExperimental, ShortDescription, Purpose, Comment, ValidationRegEx); return(primitive); }