C# Client Library
A C# Client Library for the AnalyzeRe REST API
Loading...
Searching...
No Matches
AnalyzeRe.Layers.Nested.Sources Class Referencesealed

A wrapper for a List<T> of IReference<ILayerSource> references that simplifies the construction and use of a set of nested sources references. More...

Public Member Functions

 Sources ()
 Construct a new empty sources list.
 
 Sources (IEnumerable< IReference > sources, bool automaticTyping=true)
 Construct a new sources list from any enumerable of references.
 
 Sources (IEnumerable< IReference< ILayerSource > > sources)
 Construct a new sources list by copying the enumerable of references with the expected compile-time type into this sources list.
 
 Sources (List< IReference< ILayerSource > > sources)
 Construct a new sources list and bind its internal list of references to the supplied source list.
 
 Sources (params IReference[] sources)
 Construct a new sources list from any number of references arguments.
 
void Add (ILayer layer)
 Add an inlined IReference<Layer> to this nested layer's sources.
 
void Add (IReference reference, bool automaticTyping=true)
 Allows a weakly-typed reference to be added to this collection, with the possibility of runtime checking.
 
void Add (IReference< ILayer > layerReference)
 Add a IReference<ILayer> (saved Layer reference) to this nested layer's sources.
 
void Add (IReference< ILayerView > layerViewReference)
 Add a IReference<ILayerView> (LayerView reference) to this nested layer's sources.
 
void Clear ()
 
bool Contains (IReference< ILayerSource > item)
 
void CopyTo (IReference< ILayerSource >[] array, int arrayIndex)
 
IEnumerator< IReference< ILayerSource > > GetEnumerator ()
 
int IndexOf (IReference< ILayerSource > item)
 
void Insert (int index, IReference< ILayerSource > item)
 
bool Remove (IReference< ILayerSource > item)
 
void RemoveAt (int index)
 
virtual T ShallowCopy< T > ()
 Create a shallow copy of this object.

See also
ExtensionMethods.DeepCopy<T>

for a serializer-based copy method.

 

Static Public Member Functions

static implicit operator List< IReference< ILayerSource > > (Sources sourcesInstance)
 Automatically casts a Sources instance to a List by returning its internal list.
 
static implicit operator Sources (List< IReference< ILayer > > layerSources)
 Automatically copies a list of ILayer references into a newly constructed SourcesList instance.
 
static implicit operator Sources (List< IReference< ILayerSource > > sourceReferenceList)
 Automatically casts a list of ILayerSource references to a SourcesList instance that wraps and is bound to the original list.
 

Protected Member Functions

virtual void AfterMembersCloned (APIType originalResource)
 Invoked following construction if the current instance has been created using a member-wise clone of some other instance. Override if your derived APIType class contains some members that should not be cloned.
 

Properties

int Count [get]
 
bool IsReadOnly [get]
 
List< IReference< ILayerSource > > References [get, set]
 The underlying list of IReference<ILayerSource> references.
 
IReference< ILayerSourcethis[int index] [get, set]
 

Detailed Description

A wrapper for a List<T> of IReference<ILayerSource> references that simplifies the construction and use of a set of nested sources references.

Definition at line 65 of file Nested.cs.

Inheritance diagram for AnalyzeRe.Layers.Nested.Sources:
AnalyzeRe.APIType AnalyzeRe.IAPIType

Constructor & Destructor Documentation

◆ Sources() [1/5]

AnalyzeRe.Layers.Nested.Sources.Sources ( )
inline

Construct a new empty sources list.

Definition at line 73 of file Nested.cs.

◆ Sources() [2/5]

AnalyzeRe.Layers.Nested.Sources.Sources ( List< IReference< ILayerSource > >  sources)
inline

Construct a new sources list and bind its internal list of references to the supplied source list.

Parameters
sourcesThe list of IReference<ILayerSource> to use as the new sources internal list.

This constructor will use the supplied list (by assigning it to the References property) rather than copy its elements, therefore any changes to the supplied sources list will be reflected in this sources list and vice-versa.

Definition at line 86 of file Nested.cs.

◆ Sources() [3/5]

AnalyzeRe.Layers.Nested.Sources.Sources ( IEnumerable< IReference< ILayerSource > >  sources)
inline

Construct a new sources list by copying the enumerable of references with the expected compile-time type into this sources list.

Parameters
sourcesThe source reference Layers or LayerViews to be added to the list.

The elements in this enumerable will be copied into this sources list, so any changes to the source enumerable after construction will not be reflected.

Definition at line 97 of file Nested.cs.

◆ Sources() [4/5]

AnalyzeRe.Layers.Nested.Sources.Sources ( params IReference[]  sources)
inline

Construct a new sources list from any number of references arguments.

Parameters
sourcesThe source references to be added to the list.

References that don't have a strong runtime type, such as Reference<IAPIResource>, will automatically get converted to a layer reference (which is the default reference type used by the server when no IReference.reference_type is specified). To control this behaviour, use the Sources(IEnumerable<IReference>,Boolean) constructor.

Definition at line 108 of file Nested.cs.

◆ Sources() [5/5]

AnalyzeRe.Layers.Nested.Sources.Sources ( IEnumerable< IReference sources,
bool  automaticTyping = true 
)
inline

Construct a new sources list from any enumerable of references.

Parameters
sourcesThe source references to be added to the list.
automaticTypingBy default, references that don't have a strong runtime type, such as Reference<IAPIResource>, will automatically get converted to a layer reference (which is the default reference type used by the server when no IReference.reference_type is specified). Set this to false if you would rather raise an InvalidCastException when the reference type is unknown.

References will be validated at runtime,

Definition at line 118 of file Nested.cs.

Member Function Documentation

◆ Add() [1/4]

void AnalyzeRe.Layers.Nested.Sources.Add ( ILayer  layer)

Add an inlined IReference<Layer> to this nested layer's sources.

Parameters
layerA layer instance to include in the source list.

Currently, it is only valid to inline a layer definition if this Nested layer will be included as part of a LayerView definition. Nested layers saved to the "/layers" collection endpoint can only reference other saved layers.

If this layer has an "id" property, the server will treat it as a normal reference rather than an inlined layer definition. You must remove the id of this layer before adding it as a source if you wish to force it to be inlined.

◆ Add() [2/4]

void AnalyzeRe.Layers.Nested.Sources.Add ( IReference  reference,
bool  automaticTyping = true 
)

Allows a weakly-typed reference to be added to this collection, with the possibility of runtime checking.

Parameters
referenceThe reference to add to the list of sources.
automaticTypingBy default, references that don't have a strong runtime type, such as Reference<IAPIResource>, will automatically get converted to a layer reference (which is the default reference type used by the server when no IReference.reference_type is specified). Set this to false if you would rather raise an InvalidCastException when the reference type is unknown.

◆ Add() [3/4]

void AnalyzeRe.Layers.Nested.Sources.Add ( IReference< ILayer layerReference)

Add a IReference<ILayer> (saved Layer reference) to this nested layer's sources.

Parameters
layerReferenceAn existing saved layer referenced by its id.

This can also take an inlined layer reference, but for convenience and clarity, you may wish to use the Add(ILayer) overload instead.

◆ Add() [4/4]

void AnalyzeRe.Layers.Nested.Sources.Add ( IReference< ILayerView layerViewReference)

Add a IReference<ILayerView> (LayerView reference) to this nested layer's sources.

Parameters
layerViewReferenceAn existing layer_view referenced by its id.

Currently, it is only valid to reference a layer_view if this Nested layer will be included as part of a LayerView definition. Nested layers saved to the "/layers" collection endpoint can only reference other saved layers.

The server does not support inlined layer_view references (e.g. a LayerView definition that has not been posted)

The server will require the referenced layer_view's analysis profile to match that of the layer_view containing this nested layer.

◆ AfterMembersCloned()

virtual void AnalyzeRe.APIType.AfterMembersCloned ( APIType  originalResource)
inlineprotectedvirtualinherited

Invoked following construction if the current instance has been created using a member-wise clone of some other instance. Override if your derived APIType class contains some members that should not be cloned.

Overriding implementations should be sure to invoke base.AfterMembersCloned().

A sane question for a code reviewer to ask might be: "Why not avoid copying those members in the first place?" The answer is that there is no framework-supported method of excluding members from a MemberwiseClone. The only officially supported solution is to not use the object.MemberwiseClone method at all and instead have each class implement it's own Copy method. In our case, most objects have no need to specialize their copy implementation (even though they could - the ShallowCopy<T> method is marked virtual). It's simpler to simply "correct" any special-case members after the fact, and requires less error-prone code than if the code were responsible for ensuring no members were missed in a copy. It's also faster than any reflection-based approach, even though such an approach could benefit from custom attributes meant to exclude certain members from copying.

Reimplemented in AnalyzeRe.APITypes.APIResource_WithDataEndpoint, AnalyzeRe.APIResourceView.BaseAPIResourceView, AnalyzeRe.Distributions.CustomDistribution, AnalyzeRe.LossSets.LossSet_WithData, AnalyzeRe.Optimization.Candidate, AnalyzeRe.Optimization.OptimizationView, and AnalyzeRe.StaticSimulation.

Definition at line 37 of file APIType.cs.

◆ Clear()

void AnalyzeRe.Layers.Nested.Sources.Clear ( )

◆ Contains()

bool AnalyzeRe.Layers.Nested.Sources.Contains ( IReference< ILayerSource item)

◆ CopyTo()

void AnalyzeRe.Layers.Nested.Sources.CopyTo ( IReference< ILayerSource >[]  array,
int  arrayIndex 
)

◆ GetEnumerator()

IEnumerator< IReference< ILayerSource > > AnalyzeRe.Layers.Nested.Sources.GetEnumerator ( )

◆ IndexOf()

int AnalyzeRe.Layers.Nested.Sources.IndexOf ( IReference< ILayerSource item)

◆ Insert()

void AnalyzeRe.Layers.Nested.Sources.Insert ( int  index,
IReference< ILayerSource item 
)

◆ operator List< IReference< ILayerSource > >()

static implicit AnalyzeRe.Layers.Nested.Sources.operator List< IReference< ILayerSource > > ( Sources  sourcesInstance)
static

Automatically casts a Sources instance to a List by returning its internal list.

Exists to aid with backwards compatibility, as the sources property used to be this type.

◆ operator Sources() [1/2]

static implicit AnalyzeRe.Layers.Nested.Sources.operator Sources ( List< IReference< ILayer > >  layerSources)
static

Automatically copies a list of ILayer references into a newly constructed SourcesList instance.

Exists to aid with backwards compatibility, as the sources property used to be this type.

◆ operator Sources() [2/2]

static implicit AnalyzeRe.Layers.Nested.Sources.operator Sources ( List< IReference< ILayerSource > >  sourceReferenceList)
static

Automatically casts a list of ILayerSource references to a SourcesList instance that wraps and is bound to the original list.

Exists to aid with backwards compatibility, as the sources property used to be this type.

◆ Remove()

bool AnalyzeRe.Layers.Nested.Sources.Remove ( IReference< ILayerSource item)

◆ RemoveAt()

void AnalyzeRe.Layers.Nested.Sources.RemoveAt ( int  index)

◆ ShallowCopy< T >()

virtual T AnalyzeRe.APIType.ShallowCopy< T > ( )
inlinevirtualinherited

Create a shallow copy of this object.

See also
ExtensionMethods.DeepCopy<T>

for a serializer-based copy method.

Returns
A shallow copy of this object.

If this object contains any members that reference the current object (this), the class should override this method to avoid cloning a reference to the old class.

Implements AnalyzeRe.IAPIType.

Type Constraints
T :IAPIType 

Definition at line 14 of file APIType.cs.

Property Documentation

◆ Count

int AnalyzeRe.Layers.Nested.Sources.Count
get

Definition at line 275 of file Nested.cs.

◆ IsReadOnly

bool AnalyzeRe.Layers.Nested.Sources.IsReadOnly
get

Definition at line 278 of file Nested.cs.

◆ References

List<IReference<ILayerSource> > AnalyzeRe.Layers.Nested.Sources.References
getset

The underlying list of IReference<ILayerSource> references.

Definition at line 69 of file Nested.cs.

◆ this[int index]

IReference<ILayerSource> AnalyzeRe.Layers.Nested.Sources.this[int index]
getset

Definition at line 290 of file Nested.cs.


The documentation for this class was generated from the following file: