Class CountingNCWord
The special case of the Numeric
The most useful application of this kind of register is blocks or lines numbering case.
Inherited Members
Namespace: DotnetPostprocessing .SDK
Assembly: DotnetPostprocessing.SDK.dll
Syntax
public class CountingNCWord : NumericNCWord
Constructors
CountingNCWord(string, double, double, int)
Creates a new instance of the CountingNCWord and initializes it with the specified set of parameters.
It is used the "format"
string parameter to define the all formatting rules
for the NumericNCWord.
For example, the "format"
parameter can be: "X = {-####!0##};".
The formatting rules are below.
- The curly braces divide the expression into three parts.
- Anything to the left of the braces is assigned to the Address property and passed to the output line unchanged (here is "X = ").
- Anything to the right of the braces is assigned to the TailString property and also goes to the output string as it is (here is ";").
- The expression inside the braces defines the formatting rules applied to the current v value (here is "-####!0##"). It can only include these characters "-+.!_#0".
- If the first character in braces is "-", then the sign of the number will output only
for negative numbers. It corresponds to Sign
Mode property value Minus. - If the first character in braces is "+", then the sign of the number will output both
for positive and negative numbers. It corresponds to Sign
Mode property value PlusAnd .Minus - If the first character in braces is not "+" or "-", then the sign of the number will
not output at all. It corresponds to Sign
Mode property value No. - One of the characters ".!_" in curly braces separates the integer part from the fractional part and determines how to output the decimal point.
- The point "." means the optional output, so the decimal point will output for fractional numbers,
and for integers it will be skipped. It corresponds to the property Point
Mode = No. - An exclamation point "!" indicates a required output, so the decimal point will output both
for fractional and integer numbers. It corresponds to the property Point
Mode = Always. - The underscore "_" or the absence of any of the characters ".!_" at all means that
the decimal point will never be output. It corresponds to the property Point
Mode = No. - The number of characters "0" or "#" before the characters ".!_" indicates the number of
characters allowed before the decimal point. It corresponds to the property Digits
Before .Point - If at least one of the characters before the point is zero "0", then non-significant
zeros are required. It corresponds to the property Leading
Zeroes = true. - If all characters before the point are "#", then non-significant zeros will not output.
It corresponds to the property Leading
Zeroes = false. - The number of characters "0" or "#" after the characters ".!_" indicates the number of
characters allowed after the decimal point. It corresponds to the property Digits
After . The number will be rounded to the specified number of digits before output.Point - If all characters after the point are "#", then non-significant zeros will not output.
It corresponds to the property Trailing
Zeroes = No. - If all characters after the point are "0", then non-significant zeros are required.
It corresponds to the property Trailing
Zeroes = Yes. - If the first character after the point is "0" and the rest are "#", then only first non-significant
zero will output and the rest will be skipped. It corresponds to the property
Trailing
Zeroes = OneOnly .
Declaration
public CountingNCWord(string format, double defaultValue, double AutoIncrementStep, int outFrequence)
Parameters
Type | Name | Description |
---|---|---|
string | format | The string that defines the formatting rules for the NumericNCWord. For example: "X = {-####!0##};". See description of the constructor for more details. |
double | defaultValue | The parameter to define a default value for the NumericNCWord. It is used to assing initial values
to the current v and the previous v0 values just after creation of the NumericNCWord or when you call
Restore |
double | AutoIncrementStep | The numerical step that automatically will be added to the v current value of the register after the each call of Out() or Form() methods. |
int | outFrequence | Default value for the Frequence property that means the count of iteration (calls of Out() or Form() methods) after which the register will output the value instead of skipping it. |
CountingNCWord(string, double, double, int, bool)
Creates a new instance of the CountingNCWord and initializes it with the specified set of parameters.
It is used the "format"
string parameter to define the all formatting rules
for the NumericNCWord.
For example, the "format"
parameter can be: "X = {-####!0##};".
The formatting rules are below.
- The curly braces divide the expression into three parts.
- Anything to the left of the braces is assigned to the Address property and passed to the output line unchanged (here is "X = ").
- Anything to the right of the braces is assigned to the TailString property and also goes to the output string as it is (here is ";").
- The expression inside the braces defines the formatting rules applied to the current v value (here is "-####!0##"). It can only include these characters "-+.!_#0".
- If the first character in braces is "-", then the sign of the number will output only
for negative numbers. It corresponds to Sign
Mode property value Minus. - If the first character in braces is "+", then the sign of the number will output both
for positive and negative numbers. It corresponds to Sign
Mode property value PlusAnd .Minus - If the first character in braces is not "+" or "-", then the sign of the number will
not output at all. It corresponds to Sign
Mode property value No. - One of the characters ".!_" in curly braces separates the integer part from the fractional part and determines how to output the decimal point.
- The point "." means the optional output, so the decimal point will output for fractional numbers,
and for integers it will be skipped. It corresponds to the property Point
Mode = No. - An exclamation point "!" indicates a required output, so the decimal point will output both
for fractional and integer numbers. It corresponds to the property Point
Mode = Always. - The underscore "_" or the absence of any of the characters ".!_" at all means that
the decimal point will never be output. It corresponds to the property Point
Mode = No. - The number of characters "0" or "#" before the characters ".!_" indicates the number of
characters allowed before the decimal point. It corresponds to the property Digits
Before .Point - If at least one of the characters before the point is zero "0", then non-significant
zeros are required. It corresponds to the property Leading
Zeroes = true. - If all characters before the point are "#", then non-significant zeros will not output.
It corresponds to the property Leading
Zeroes = false. - The number of characters "0" or "#" after the characters ".!_" indicates the number of
characters allowed after the decimal point. It corresponds to the property Digits
After . The number will be rounded to the specified number of digits before output.Point - If all characters after the point are "#", then non-significant zeros will not output.
It corresponds to the property Trailing
Zeroes = No. - If all characters after the point are "0", then non-significant zeros are required.
It corresponds to the property Trailing
Zeroes = Yes. - If the first character after the point is "0" and the rest are "#", then only first non-significant
zero will output and the rest will be skipped. It corresponds to the property
Trailing
Zeroes = OneOnly .
Declaration
public CountingNCWord(string format, double defaultValue, double AutoIncrementStep, int outFrequence, bool preserveIndent)
Parameters
Type | Name | Description |
---|---|---|
string | format | The string that defines the formatting rules for the NumericNCWord. For example: "X = {-####!0##};". See description of the constructor for more details. |
double | defaultValue | The parameter to define a default value for the NumericNCWord. It is used to assing initial values
to the current v and the previous v0 values just after creation of the NumericNCWord or when you call
Restore |
double | AutoIncrementStep | The numerical step that automatically will be added to the v current value of the register after the each call of Out() or Form() methods. |
int | outFrequence | Default value for the Frequence property that means the count of iteration (calls of Out() or Form() methods) after which the register will output the value instead of skipping it. |
bool | preserveIndent | Default value for the Preserve |
CountingNCWord(string, string, NCWordSign, NCWordDecPoint, int, int, double, double, int, bool)
Creates a new instance of a CountingNCWord register with the given parameters.
Declaration
public CountingNCWord(string address, string tailString, NCWordSign signMode, NCWordDecPoint pointMode, int digitsBefore, int digitsAfter, double defaultValue, double AutoIncrementStep, int outFrequence, bool autoUpdateState)
Parameters
Type | Name | Description |
---|---|---|
string | address | Address - start part of the register's output string. |
string | tailString | Tail |
NCWord |
signMode | Sign |
NCWord |
pointMode | Point |
int | digitsBefore | Digits |
int | digitsAfter | Digits |
double | defaultValue | Default |
double | AutoIncrementStep | The numerical step that automatically will be added to the v current value of the register after the each call of Out() or Form() methods. |
int | outFrequence | Default value for the Frequence property that means the count of iteration (calls of Out() or Form() methods) after which the register will output the value instead of skipping it. |
bool | autoUpdateState | Auto |
Fields
fFrequenceCounter
The counter for the Frequence property.
Declaration
protected int fFrequenceCounter
Field Value
Type | Description |
---|---|
int |
Properties
AutoIncrementStep
Declaration
public double AutoIncrementStep { get; set; }
Property Value
Type | Description |
---|---|
double |
Frequence
The number of Out() or Form() method calls after which the register will be included in the output line of the NCBlock, and will not be skipped. If it is one then it will be presented in each output. If it is two then it will be presented in each second output etc.
Declaration
public int Frequence { get; set; }
Property Value
Type | Description |
---|---|
int |
FrequenceReached
This property is "true" only if the Frequence counter has reached the limit value and the value of this CountingNCWord will be presented in the next call of Out() or Form() methods.
Declaration
public bool FrequenceReached { get; }
Property Value
Type | Description |
---|---|
bool |
PreserveIndent
If this property is "true" then when the Frequence of the CountingNCWord is more than 1 and when the value of this register will be skipped then it will form spaces instead of the actual value of the register to preserve indents in the output line of the NCBlock.
Declaration
public bool PreserveIndent { get; set; }
Property Value
Type | Description |
---|---|
bool |
Methods
Init()
This method initializes an internal state of the CountingNCWord just after creation.
Declaration
protected override void Init()
Overrides
ResetFrequenceCounter()
Resets the internal counter of the Frequence property to the default state to start the counting again.
Declaration
public void ResetFrequenceCounter()