C# Client Library
A C# Client Library for the AnalyzeRe REST API
|
The loss perspective determines what factors to include when computing a distribution. More...
Public Types | |
enum | Base { LossGross , NetLoss , ReinstatementPremium , ReinstatementBrokerage , Premium , FixedExpense , ProportionalExpense , ProfitCommission , NoClaimsBonus , SlidingScaleCommission , LossNetOfAggregateTerms } |
The set of available values and RecordTypes that can be used to construct a distribution or metrics result. These can be used on their own, or combined together (with some restrictions enforced by the API). More... | |
enum | Option { Premium , ReinstatementPremium , ReinstatementBrokerage } |
The options to include in the base perspective distribution. More... | |
Public Member Functions | |
Perspective (Base perspective_base, IEnumerable< Option > options=null) | |
Constructs a legacy perspective string. | |
Perspective (string perspective) | |
Construct a new perspective from a serialized perspective string. | |
override bool | Equals (object other) |
Tests object equality. | |
bool | Equals (Perspective other) |
Determine whether the two perspectives are equivalent. | |
override int | GetHashCode () |
Serves as a hash function for a particular type. | |
virtual T | ShallowCopy< T > () |
Create a shallow copy of this object.
for a serializer-based copy method. | |
override string | ToString () |
Perspective string is just the class name. | |
Static Public Member Functions | |
static Perspective | FromEnum (Base perspective) |
Returns the appropriate singleton for the Base perspective given. | |
static Perspective | FromEnums (IEnumerable< Base > perspectives) |
Construct a new Perspective that should include the specified Base perspective values. | |
static Perspective | FromEnums (params Base[] perspectives) |
Construct a new Perspective that should include the specified Base perspective value or values. | |
static Perspective | FromString (string perspectiveString) |
Implicit converter that allows automatically converting a string into a perspective, returning a static singleton instance if appropriate. | |
static string | GetStringRepresentation (Perspective persp) |
Generate a string representation of the specified perspective. | |
static Perspective | LossNetOf (params Base[] perspectives) |
A convenience static method, similar to the other static singletons, which constructs a complex perspective instance that includes Base.NetLoss as well as one or more additional perspectives. | |
static Perspective | LossNetOfAggregateTermsAnd (bool premium=false, bool reinstatement_premium=false, bool reinstatement_brokerage=false) |
Constructs a legacy LossNetOfAggregateTerms[X,Y,Z] perspective, where you can specify which values to include in the loss calculation. Be warned that the legacy perspective Base.LossNetOfAggregateTerms implicitly includes all fee record types. | |
static | operator Perspective (Base perspective) |
Implicit converter that converts a Base enum value into a Perspective instance. | |
static implicit | operator Perspective (string perspectiveString) |
Implicit converter that allows automatically converting a string into a Perspective instance. | |
Static Public Attributes | |
static readonly Perspective | FixedExpense = new Perspective(Base.FixedExpense) |
Report on the structure's Fees.FixedExpense fees. | |
static readonly Perspective | LossGross = new Perspective(Base.LossGross) |
Construct a distribution from the structure's gross losses. | |
static readonly Perspective | LossNetOfAggregateTerms = new Perspective(Base.LossNetOfAggregateTerms) |
The legacy perspective value indicating "net loss" - but this includes fee record types as well. | |
static readonly Perspective | NetLoss = new Perspective(Base.NetLoss) |
Construct a distribution from the structure's net losses. | |
static readonly Perspective | NoClaimsBonus = new Perspective(Base.NoClaimsBonus) |
Report on the structure's Fees.FixedExpense fees. | |
static readonly Perspective | Premium = new Perspective(Base.Premium) |
Report on the structure's premium only. | |
static readonly Perspective | ProfitCommission = new Perspective(Base.ProfitCommission) |
Report on the structure's Fees.FixedExpense fees. | |
static readonly Perspective | ProportionalExpense = new Perspective(Base.ProportionalExpense) |
Report on the structure's Fees.ProportionalExpense fees. | |
static readonly Perspective | ReinstatementBrokerage = new Perspective(Base.ReinstatementBrokerage) |
Construct a distribution from the structure's net reinstatement brokerages. | |
static readonly Perspective | ReinstatementPremium = new Perspective(Base.ReinstatementPremium) |
Construct a distribution from the structure's net reinstatement premiums. | |
static readonly Perspective | SlidingScaleCommission = new Perspective(Base.SlidingScaleCommission) |
Report on the structure's Fees.FixedExpense fees. | |
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. | |
The loss perspective determines what factors to include when computing a distribution.
Definition at line 12 of file Perspective.cs.
The set of available values and RecordTypes that can be used to construct a distribution or metrics result. These can be used on their own, or combined together (with some restrictions enforced by the API).
TODO: This enumeration has been defined as Flags, which means we could create a much more performant (for IEquatable implementation) and memory-efficient internal representation than the current string[] array. BUT, to do so would require additional testing and complexity to be able to continue forwards-compatibility support for unrecognized new perspective strings.
Definition at line 23 of file Perspective.cs.
The options to include in the base perspective distribution.
Enumerator | |
---|---|
Premium | Subtract fixed premium from the losses. |
ReinstatementPremium | Subtract reinstatement premiums from the losses. |
ReinstatementBrokerage | Add reinstatement brokerages to the losses. |
Definition at line 342 of file Perspective.cs.
|
inline |
Construct a new perspective from a serialized perspective string.
perspective | The string representation of this perspective. The server expects this to be a comma separated list of Base values. |
This string will be relayed to the server exactly as-is; it will not be parsed or validated client-side in any way.
Definition at line 162 of file Perspective.cs.
|
inline |
Constructs a legacy perspective string.
perspective_base | The base perspective to use. |
options | (Optional) Options to add to the base perspective. |
Note that the server supports use of legacy perspectives (LossNetOfAggregateTerms) in a new perspective string format (all comma-separated, no square brackets), so there is no need for us to continue generating the legacy perspective string format. The logic in SplitPerspectiveString guarantees that Perspectives built using the legacy string format will be treated as equivalent to legacy Perspectives build via Base enum values.
Definition at line 173 of file Perspective.cs.
|
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.
override bool AnalyzeRe.Perspective.Equals | ( | object | other | ) |
Tests object equality.
other | The object to compare with the current object. |
|
inline |
Determine whether the two perspectives are equivalent.
other | The perspective to compare to the current one. |
Definition at line 314 of file Perspective.cs.
|
inlinestatic |
Returns the appropriate singleton for the Base perspective given.
perspective | The perspective value requested. |
Definition at line 207 of file Perspective.cs.
|
static |
Construct a new Perspective that should include the specified Base perspective values.
perspectives | One or more perspectives to include. |
Returns the a static immutable singleton where possible.
|
static |
Construct a new Perspective that should include the specified Base perspective value or values.
perspectives | One or more perspectives to include. |
Returns the a static immutable singleton where possible.
|
inlinestatic |
Implicit converter that allows automatically converting a string into a perspective, returning a static singleton instance if appropriate.
perspectiveString | The string representation of the perspective. |
Definition at line 246 of file Perspective.cs.
override int AnalyzeRe.Perspective.GetHashCode | ( | ) |
Serves as a hash function for a particular type.
|
static |
Generate a string representation of the specified perspective.
|
static |
A convenience static method, similar to the other static singletons, which constructs a complex perspective instance that includes Base.NetLoss as well as one or more additional perspectives.
perspectives | One or more additional perspectives to add/subtract from the NetLoss. |
If you need a single perspective value, consider using the static FromEnum factory or one of the static singletons (e.g. Perspective.NetLoss) to acquire a more performant and memory-efficient perspective reference.
|
inlinestatic |
Constructs a legacy LossNetOfAggregateTerms[X,Y,Z] perspective, where you can specify which values to include in the loss calculation. Be warned that the legacy perspective Base.LossNetOfAggregateTerms implicitly includes all fee record types.
premium | Set to true to include Premium Income. |
reinstatement_premium | Set to true to include Reinstatement Premium Income. |
reinstatement_brokerage | Set to true to include Reinstatement Brokerage Fees. |
Definition at line 363 of file Perspective.cs.
|
explicitstatic |
Implicit converter that converts a Base enum value into a Perspective instance.
perspective | The perspective value requested. |
|
static |
Implicit converter that allows automatically converting a string into a Perspective instance.
perspectiveString | The string representation of the perspective. |
|
inlinevirtualinherited |
Create a shallow copy of this object.
for a serializer-based copy method.
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.
T | : | IAPIType |
Definition at line 14 of file APIType.cs.
override string AnalyzeRe.Perspective.ToString | ( | ) |
Perspective string is just the class name.
|
static |
Report on the structure's Fees.FixedExpense fees.
Definition at line 73 of file Perspective.cs.
|
static |
Construct a distribution from the structure's gross losses.
Definition at line 58 of file Perspective.cs.
|
static |
The legacy perspective value indicating "net loss" - but this includes fee record types as well.
Equivalent to requesting the following combined perspectives: NetLoss,FixedExpense,PropoertionalExpense,ProfitCommission,NoClaimsBonus,SlidingScaleCommission
Definition at line 90 of file Perspective.cs.
|
static |
Construct a distribution from the structure's net losses.
Definition at line 61 of file Perspective.cs.
|
static |
Report on the structure's Fees.FixedExpense fees.
Definition at line 82 of file Perspective.cs.
|
static |
Report on the structure's premium only.
Definition at line 64 of file Perspective.cs.
|
static |
Report on the structure's Fees.FixedExpense fees.
Definition at line 79 of file Perspective.cs.
|
static |
Report on the structure's Fees.ProportionalExpense fees.
Definition at line 76 of file Perspective.cs.
|
static |
Construct a distribution from the structure's net reinstatement brokerages.
Definition at line 70 of file Perspective.cs.
|
static |
Construct a distribution from the structure's net reinstatement premiums.
Definition at line 67 of file Perspective.cs.
|
static |
Report on the structure's Fees.FixedExpense fees.
Definition at line 85 of file Perspective.cs.