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);
212 inline const char *
const *
names()
const
225 const char *
name(
int which)
const;
227 char *
getName(
int which)
const;
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,
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,
CoinModelLink & operator=(const CoinModelLink &)
=
double value() const
Get value.
void setValue(double value)
Set value.
void setNumberItems(int number)
Set number of items.
int position_
Position in data.
int numberMajor_
Number of major items i.e. rows if just row links.
double value_
Value as double.
CoinModelHash & operator=(const CoinModelHash &)
=
int rowInTriple(const CoinModelTriple &triple)
int maximumMajor_
Maximum number of major items i.e. rows if just row links.
~CoinModelLink()
Destructor.
void setOnRow(bool onRow)
Set onRow.
void resize(int maxItems, bool forceReHash=false)
Resize hash (also re-hashs)
int lastSlot_
Last slot looked at.
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 hashValue(const char *name) const
Returns a hash value.
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 * next_
Next - maximumElements long.
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.
int type_
0 row list, 1 column list
void addHash(int index, int row, int column, const CoinModelTriple *triples)
Adds to hash.
int numberElements_
Number of elements.
~CoinModelLinkedList()
Destructor.
CoinModelHashLink * hash_
hash
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.
int maximumElements_
Maximum number of elements.
bool onRow_
If on row chain.
void setPosition(int position)
Set position.
void validateLinks(const CoinModelTriple *triples) const
Checks that links are consistent.
int numberItems_
Number of items.
int hashValue(int row, int column) const
Returns a hash value.
CoinModelHashLink * hash_
hash
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 maximumItems_
Maximum number of items.
int lastSlot_
Last slot looked at.
int * last_
Last - maximumMajor+1 long (last free element chain)
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 maximumItems_
Maximum number of items.
int numberItems() const
Number of items i.e. rows if just row names.
int * first_
First - maximumMajor+1 long (last free element chain)
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)
CoinYacc & operator=(const CoinYacc &rhs)
int * previous_
Previous - maximumElements long.
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 &)
=
int numberItems_
Number of items.
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.