Table of Contents

Class Attribute

Namespace
Loehnert.TypeAndResult
Assembly
Loehnert.TypeAndResult.dll

Represents an attribute of type data.

[MessagePackObject(false)]
public class Attribute : TypeDataEntityBase, INotifyPropertyChanged, ITrackable, IHasKey, IEquatable<TypeDataEntityBase>, IEquatable<Attribute>, ICanApplyID<Attribute>
Inheritance
Attribute
Implements
Inherited Members
Extension Methods

Examples

This example defines an attribute for a length. The measured length must be between 19.95 mm and 20.05 mm.

var lengthAttribute = new Attribute()
{
    Key = "Length",
    Unit = "mm",
    Tolerance = new Limit() { Min = 19.95, Max = 20.05 },
    DecimalPlacesCount = 3,
    EvaluationRequired = true,
};

This example defines an attribute for a boolean value.

var partIsAssembledAttribute = new Attribute()
{
    Key = "PartIsAssembled",
    Tolerance = new Limit() { Min = 1, Max = 1 },
    EvaluationRequired = true,
};

Remarks

An attribute is a characteristic that can be measured. It has a unique name, unit and tolerance.

Constructors

Attribute()

Initializes a new instance of the Attribute class.

public Attribute()

Properties

AdditionalLimits

Gets the additional limits.

[Key(8)]
public virtual EntityCollection<AttributeLimit> AdditionalLimits { get; }

Property Value

EntityCollection<AttributeLimit>

DecimalPlacesCount

Gets or sets the number of decimal places for evaluation.

[Key(6)]
public virtual int DecimalPlacesCount { get; set; }

Property Value

int

EvaluationRequired

Gets or sets a value indicating whether the attribute must be evaluated.

[Key(4)]
public virtual bool EvaluationRequired { get; set; }

Property Value

bool

Parameters

Gets the additional parameters.

[Key(9)]
public virtual EntityCollection<AttributeParameter> Parameters { get; }

Property Value

EntityCollection<AttributeParameter>

Tolerance

Gets or sets the tolerance limit.

[Key(7)]
[DependsOn("DecimalPlacesCount")]
public virtual Limit Tolerance { get; set; }

Property Value

Limit

Unit

Gets or sets the unit.

[Key(5)]
public virtual string Unit { get; set; }

Property Value

string

Methods

ApplyID(Attribute)

Copies the ID from source to ID.

public void ApplyID(Attribute source)

Parameters

source Attribute

Source object.

Equals(Attribute)

Indicates whether the current object is equal to another object of the same type.

public virtual bool Equals(Attribute other)

Parameters

other Attribute

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Evaluate(double, string)

Rounds value and evaluates the rounded value.

public Result Evaluate(double value, string text = "")

Parameters

value double

Value for evaluation.

text string

Additional text for evaluation, see Text.

Returns

Result

The evaluation result, with the rounded value as Value.

Remarks

The value is rounded to DecimalPlacesCount before the evaluation.
If evaluation is required, and the rounded value is greater than or equal to the lower limit (Tolerance) and less than or equal to the upper limit, the classifaction is passed. If the rounded value is out of tolerance, the classifaction is failed.
If evaluation isn't required the classifaction is not evaluated.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.