InvalidBitNumber class: Difference between revisions
m (add link to exception example) |
|||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<!-- InvalidBitNumber class --> | <!-- InvalidBitNumber class --> | ||
__NOTOC__ | __NOTOC__ | ||
The <var>InvalidBitNumber</var> exception class indicates that a bit number request by a bit manipulation function was incorrect, either negative, greater than the number of bits in the string, or non-integral. | The <var>InvalidBitNumber</var> exception class indicates that a bit number request by a bit manipulation function was incorrect, either negative, greater than the number of bits in the string, or non-integral. <var>InvalidBitNumber</var> was introduced in Model 204 version 7.5. | ||
To produce a <var>InvalidBitNumber</var> exception for yourself, you typically use a <var class="product">User Language</var> <var>[[Exceptions#Throwing exceptions|Throw]]</var> statement with an <var>InvalidBitNumber</var> <var>[[ | To produce a <var>InvalidBitNumber</var> exception for yourself, you typically use a <var class="product">User Language</var> <var>[[Exceptions#Throwing exceptions|Throw]]</var> statement with an <var>InvalidBitNumber</var> <var>[[New (InvalidBitNumber constructor)|New]]</var> constructor. For example, the following statement throws an <var>InvalidBitNumber</var> exception: | ||
<p class="code">throw %(invalidBitNumber):new | <p class="code">throw %(invalidBitNumber):new | ||
</p> | </p> | ||
For an example of how you might use an exception in your own code, see this [[InvalidValue class|InvalidValue exception example]]. | |||
==The InvalidBitNumber methods== | ==The InvalidBitNumber methods== | ||
{{Template:List of | {{Template:List of InvalidBitNumber methods}} | ||
The methods in the class are described in the subsections that follow. In addition: | The methods in the class are described in the subsections that follow. In addition: | ||
<ul> | <ul> | ||
<li>[[Notation conventions for methods | <li>[[Notation conventions for methods]] has information | ||
about the conventions followed. | about the conventions followed. </li> | ||
<li>[[InvalidBitNumber methods syntax | |||
<li>[[InvalidBitNumber methods syntax]] is a single page that contains the syntax diagrams of all the methods in the class. </li> | |||
</ul> | </ul> | ||
==BitNumber property== | |||
{{Template:InvalidBitNumber:BitNumber subtitle}} | |||
This <var>property</var> returns the invalid bit number that was requested and so caused the exception to be thrown. | |||
===Syntax=== | |||
{{Template:InvalidBitNumber:BitNumber syntax}} | |||
====Syntax terms==== | |||
<table> | |||
<tr><th><var class="term">%number</var></th> | |||
<td>The invalid bit number that was requested and so caused the exception to be thrown</td></tr> | |||
<tr><th>%invalidBitNumber</th> | |||
<td>A reference to an instance of a <var>InvalidBitNumber</var> object. | |||
</td></tr> | |||
</table> | |||
==New constructor== | ==New constructor== | ||
{{Template:InvalidBitNumber:New subtitle}} | {{Template:InvalidBitNumber:New subtitle}} | ||
This <var>Constructor</var> generates an instance of an <var>[[ | This <var>Constructor</var> generates an instance of an <var>[[InvalidBitNumber class|InvalidBitNumber]]</var> exception. The <var>New</var> method format is as follows: | ||
===Syntax=== | ===Syntax=== | ||
Line 28: | Line 46: | ||
====Syntax terms==== | ====Syntax terms==== | ||
<table | <table> | ||
<tr><th>%invalidBitNumber</th> | <tr><th>%invalidBitNumber</th> | ||
Line 34: | Line 52: | ||
</td></tr> | </td></tr> | ||
<tr><th nowrap="nowrap"><var>[%(InvalidBitNumber):]</var></th><td>The class name in parentheses denotes a <var>[[Notation conventions for methods#Constructors|Constructor]]</var>. See [[#Usage notes| | <tr><th nowrap="nowrap"><var>[%(InvalidBitNumber):]</var></th> | ||
<tr><th><var class="term">number</var></th><td>The bit number that will be returned by the BitNumber property.</td></tr> | <td>The class name in parentheses denotes a <var>[[Notation conventions for methods#Constructors|Constructor]]</var>. See [[#Usage notes|Usage notes]], below, for more information about invoking a <var>InvalidBitNumber</var> <var>Constructor</var>.</td></tr> | ||
<tr><th><var class="term">number</var></th> | |||
<td>The bit number that will be returned by the BitNumber property.</td></tr> | |||
</table> | </table> | ||
===Usage notes=== | ===Usage notes=== | ||
<ul> | <ul> | ||
<li>As described in [[Object variables#Using New or other Constructors| | <li>As described in [[Object variables#Using New or other Constructors|Using New or other Constructors]], <var>New</var> can be invoked with no object, with an explicit class name, or with an object variable in the class, even if that object is <var>Null</var>: | ||
<p class="code">%invalidBitNumber = new | <p class="code">%invalidBitNumber = new | ||
Line 48: | Line 69: | ||
</p> | </p> | ||
</ul> | </ul> | ||
[[Category:System exception classes]] | [[Category:System exception classes]] |
Latest revision as of 19:39, 15 March 2016
The InvalidBitNumber exception class indicates that a bit number request by a bit manipulation function was incorrect, either negative, greater than the number of bits in the string, or non-integral. InvalidBitNumber was introduced in Model 204 version 7.5.
To produce a InvalidBitNumber exception for yourself, you typically use a User Language Throw statement with an InvalidBitNumber New constructor. For example, the following statement throws an InvalidBitNumber exception:
throw %(invalidBitNumber):new
For an example of how you might use an exception in your own code, see this InvalidValue exception example.
The InvalidBitNumber methods
The following are the available InvalidBitNumber class methods.
The methods in the class are described in the subsections that follow. In addition:
- Notation conventions for methods has information about the conventions followed.
- InvalidBitNumber methods syntax is a single page that contains the syntax diagrams of all the methods in the class.
BitNumber property
Invalid bit number requested (InvalidBitNumber class)
[Introduced in Model 204 7.5]
This property returns the invalid bit number that was requested and so caused the exception to be thrown.
Syntax
%number = invalidBitNumber:BitNumber
Syntax terms
%number | The invalid bit number that was requested and so caused the exception to be thrown |
---|---|
%invalidBitNumber | A reference to an instance of a InvalidBitNumber object. |
New constructor
Create a new InvalidBitNumber object (InvalidBitNumber class)
[Introduced in Model 204 7.5]
This Constructor generates an instance of an InvalidBitNumber exception. The New method format is as follows:
Syntax
%invalidBitNumber = [%(InvalidBitNumber):]New( bitNumber= number)
Syntax terms
%invalidBitNumber | A reference to an instance of a InvalidBitNumber object. |
---|---|
[%(InvalidBitNumber):] | The class name in parentheses denotes a Constructor. See Usage notes, below, for more information about invoking a InvalidBitNumber Constructor. |
number | The bit number that will be returned by the BitNumber property. |
Usage notes
- As described in Using New or other Constructors, New can be invoked with no object, with an explicit class name, or with an object variable in the class, even if that object is Null:
%invalidBitNumber = new %invalidBitNumber = %(InvalidBitNumber):new %invalidBitNumber = %invalidBitNumber:new