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
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
DecimalPlacesCount
Gets or sets the number of decimal places for evaluation.
[Key(6)]
public virtual int DecimalPlacesCount { get; set; }
Property Value
EvaluationRequired
Gets or sets a value indicating whether the attribute must be evaluated.
[Key(4)]
public virtual bool EvaluationRequired { get; set; }
Property Value
Parameters
Gets the additional parameters.
[Key(9)]
public virtual EntityCollection<AttributeParameter> Parameters { get; }
Property Value
Tolerance
Gets or sets the tolerance limit.
[Key(7)]
[DependsOn("DecimalPlacesCount")]
public virtual Limit Tolerance { get; set; }
Property Value
Unit
Gets or sets the unit.
[Key(5)]
public virtual string Unit { get; set; }
Property Value
Methods
ApplyID(Attribute)
public void ApplyID(Attribute source)
Parameters
source
AttributeSource 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
AttributeAn 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
Returns
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.