6 #ifndef CoinModelUseful_H
7 #define CoinModelUseful_H
51 inline int row()
const
116 {
return triple.
row&0x7fffffff;}
118 { triple.
row = iRow|(triple.
row&0x80000000);}
120 {
return (triple.
row&0x80000000)!=0;}
122 { triple.
row = (
string ? 0x80000000 : 0)|(triple.
row&0x7fffffff);}
124 int iRow,
bool string)
125 { triple.
row = (
string ? 0x80000000 : 0)|iRow;}
201 void resize(
int maxItems,
bool forceReHash=
false);
205 {
return numberItems_;}
210 {
return maximumItems_;}
212 inline const char *
const *
names()
const
225 const char *
name(
int which)
const;
227 char *
getName(
int which)
const;
234 int hashValue(
const char *
name)
const;
278 {
return numberItems_;}
283 {
return maximumItems_;}
293 void deleteHash(
int index,
int row,
int column);
296 int hashValue(
int row,
int column)
const;
335 void resize(
int maxMajor,
int maxElements);
339 void create(
int maxMajor,
int maxElements,
345 {
return numberMajor_;}
348 {
return maximumMajor_;}
351 {
return numberElements_;}
354 {
return maximumElements_;}
357 {
return first_[maximumMajor_];}
360 {
return last_[maximumMajor_];}
363 {
return first_[which];}
365 inline int last(
int which)
const
366 {
return last_[which];}
368 inline const int *
next()
const
380 int addEasy(
int majorIndex,
int numberOfElements,
const int * indices,
385 void addHard(
int minorIndex,
int numberOfElements,
const int * indices,
435 int maximumElements_;
CoinModelLink & operator=(const CoinModelLink &)
=
double value() const
Get value.
void setValue(double value)
Set value.
void setNumberItems(int number)
Set number of items.
CoinModelHash & operator=(const CoinModelHash &)
=
int rowInTriple(const CoinModelTriple &triple)
~CoinModelLink()
Destructor.
void setOnRow(bool onRow)
Set onRow.
void resize(int maxItems, bool forceReHash=false)
Resize hash (also re-hashs)
void setRowAndStringInTriple(CoinModelTriple &triple, int iRow, bool string)
int numberItems() const
Number of items.
This is for various structures/classes needed by CoinModel.
void resize(int maxItems, const CoinModelTriple *triples, bool forceReHash=false)
Resize hash (also re-hashs)
int maximumItems() const
Maximum number of items.
void deleteHash(int index)
Deletes from hash.
int numberMajor() const
Number of major items i.e. rows if just row links.
void updateDeleted(int which, CoinModelTriple *triples, CoinModelLinkedList &otherList)
Deletes from list - other case i.e.
void fill(int first, int last)
Fills first,last with -1.
void synchronize(CoinModelLinkedList &other)
Puts in free list from other list.
int addEasy(int majorIndex, int numberOfElements, const int *indices, const double *elements, CoinModelTriple *triples, CoinModelHash2 &hash)
Adds to list - easy case i.e.
void deleteRowOne(int position, CoinModelTriple *triples, CoinModelHash2 &hash)
Deletes one element from Row list.
void addHash(int index, int row, int column, const CoinModelTriple *triples)
Adds to hash.
~CoinModelLinkedList()
Destructor.
int hash(int row, int column, const CoinModelTriple *triples) const
Returns index or -1.
CoinModelLink()
Default constructor.
void setStringInTriple(CoinModelTriple &triple, bool string)
int maximumElements() const
Maximum number of elements.
int first(int which) const
First on chain.
const char *const * names() const
Names.
CoinModelLinkedList()
Default constructor.
int last(int which) const
Last on chain.
void updateDeletedOne(int position, const CoinModelTriple *triples)
Update column list for one element when one element deleted from row copy.
void create(int maxMajor, int maxElements, int numberMajor, int numberMinor, int type, int numberElements, const CoinModelTriple *triples)
Create list - for row list maxMajor is maximum rows.
int lastFree() const
Last on free chain.
void setNumberItems(int number)
Set number of items.
CoinModelHash()
Default constructor.
void setPosition(int position)
Set position.
void validateLinks(const CoinModelTriple *triples) const
Checks that links are consistent.
const char * name(int which) const
Returns name at position (or NULL)
const int * next() const
Next array.
~CoinModelHash()
Destructor.
void setColumn(int column)
Set column.
int numberElements() const
Number of elements.
bool stringInTriple(const CoinModelTriple &triple)
void setElement(double value)
Set value.
int maximumMajor() const
Maximum number of major items i.e. rows if just row links.
int position() const
Get position.
int hash(const char *name) const
Returns index or -1.
bool onRow() const
Get onRow.
int numberItems() const
Number of items i.e. rows if just row names.
const int * previous() const
Previous array.
int column() const
Get column.
void setName(int which, char *name)
Sets name at position (does not create)
void setRowInTriple(CoinModelTriple &triple, int iRow)
void validateHash() const
Validates.
void addHard(int minorIndex, int numberOfElements, const int *indices, const double *elements, CoinModelTriple *triples, CoinModelHash2 &hash)
Adds to list - hard case i.e.
void deleteSame(int which, CoinModelTriple *triples, CoinModelHash2 &hash, bool zapTriples)
Deletes from list - same case i.e.
void setRow(int row)
Set row.
char * getName(int which) const
Returns non const name at position (or NULL)
CoinModelHash2 & operator=(const CoinModelHash2 &)
=
CoinModelHash2()
Default constructor.
CoinModelLinkedList & operator=(const CoinModelLinkedList &)
=
double element() const
Get value.
void addHash(int index, const char *name)
Adds to hash.
int maximumItems() const
Maximum number of items.
void deleteHash(int index, int row, int column)
Deletes from hash.
int firstFree() const
First on free chain.
~CoinModelHash2()
Destructor.
void resize(int maxMajor, int maxElements)
Resize list - for row list maxMajor is maximum rows.