Initializing help system before first use

XPRBindexSet

Description
Methods for accessing index sets and operators for adding and retrieving set elements.
Constructors
Methods
Add an index to an index set.
Get the C modeling object.
Get the index number of an index.
Get the name of an index.
Get the name of an index set.
Get the size of an index set.
Test the validity of the index set object.
Print out an index set
Reset the index set object.
Operators
Adding an element to an index set:
iset += text
Accessing index set elements by their name or index number:
int iset[text]
const char *iset[val]

Constructor detail

XPRBindexSet
Synopsis
XPRBindexSet();
XPRBindexSet(xbidxset *iset);
Argument
iset 
An index set in BCL C.
Description
Create a new index set object.

Method detail

addElement
Synopsis
int addElement(const char *text);
Argument
text 
Name of the index to be added to the set.
Return value
Sequence number of the index within the set, -1 in case of an error.
Description
This method adds an index entry to an index set. The new element is only added to the set if no identical index already exists. Both in the case of a new index entry and an existing one, the method returns the sequence number of the index in the index set. Note that the numbering of index elements starts with 0.
Example
The following example shows how to add an element to an index set and then retrieve its index and its name, (a) using the corresponding functions and (b) using the overloaded operators of this class.
XPRBprob prob("myprob");
XPRBindexSet ISet;
int ind;

ISet = prob.newIndexSet("IS");
ind = ISet.addElement("a");
cout << "First element: " << ISet.getIndexName(ind);
cout << ", index of 'a': " << ISet.getIndex("a") << endl;

ISet += "b";           // Add a second element
cout << "Element 1: " << ISet[1];
cout << ", index of 'b': " << ISet["b"] << endl; 
Related topics
Calls XPRBaddidxel

getCRef
Synopsis
xbidxset *getCRef();
Return value
The underlying modeling object in BCL C.
Description
This method returns the index set object in BCL C that belongs to the C++ index set object.

getIndex
Synopsis
int getIndex(const char *text);
Argument
text 
Name of an index in the set.
Return value
Sequence number of the index in the set, or -1 if not contained.
Description
An index element can be accessed either by its name or by its sequence number. This method returns the sequence number of an index given its name.
Example
Related topics
Calls XPRBgetidxel

getIndexName
Synopsis
const char *getIndexName(int i);
Argument
Index number.
Return value
Name of the i th element in the set if function executed successfully, NULL otherwise.
Description
An index element can be accessed either by its name or by its sequence number. This method returns the name of an index set element given its sequence number.
Example
Related topics

getName
Synopsis
const char *getName();
Return value
Name of the index set if function executed successfully, NULL otherwise.
Description
This function returns the name of an index set.
Example
Related topics

getSize
Synopsis
int getSize();
Return value
Size (= number of elements) of the set, -1 in case of an error.
Description
This function returns the current number of elements in an index set. This value does not necessarily correspond to the size specified at the creation of the set. The returned value may be smaller if fewer elements than the originally reserved number have been added, or larger if more elements have been added. (In the latter case, the size of the set is automatically increased.)
Example
This example displays the name, size, and complete contents of an index set.
XPRBprob prob("myprob");
XPRBindexSet ISet;

ISet = prob.newIndexSet("IS");
cout << ISet.getName() << " size: " << ISet.getSize() << endl;
ISet.print(); 
Related topics

isValid
Synopsis
bool isValid();
Return value
true if object is valid, false otherwise.
Description
This method checks whether the index set object is correctly defined. It should always be used to test the result returned by XPRBprob.getIndexSetByName.
Example

print
Synopsis
int print();
Return value
0 if function executed successfully, 1 otherwise.
Description
This method prints out an index set.
Example
Related topics

reset
Synopsis
void reset();
Description
Clear the definition of the index set object.


© 2001-2024 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.