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,
void setStringInTriple(CoinModelTriple &triple, bool string)
void validateHash() const
Validates.
int numberElements_
Number of elements.
int * previous_
Previous - maximumElements long.
double value() const
Get value.
int numberMajor() const
Number of major items i.e. rows if just row links.
int maximumElements_
Maximum number of elements.
This is for various structures/classes needed by CoinModel.
int maximumItems_
Maximum number of items.
int hash(int row, int column, const CoinModelTriple *triples) const
Returns index or -1.
void addHash(int index, const char *name)
Adds to hash.
int numberItems() const
Number of items i.e. rows if just row names.
CoinModelLinkedList()
Default constructor.
char * getName(int which) const
Returns non const name at position (or NULL)
const int * next() const
Next array.
void updateDeleted(int which, CoinModelTriple *triples, CoinModelLinkedList &otherList)
Deletes from list - other case i.e.
int lastSlot_
Last slot looked at.
void resize(int maxItems, const CoinModelTriple *triples, bool forceReHash=false)
Resize hash (also re-hashs)
int * next_
Next - maximumElements long.
CoinModelLinkedList & operator=(const CoinModelLinkedList &)
=
~CoinModelLink()
Destructor.
int numberElements() const
Number of elements.
int maximumElements() const
Maximum number of elements.
void setElement(double value)
Set value.
void deleteRowOne(int position, CoinModelTriple *triples, CoinModelHash2 &hash)
Deletes one element from Row list.
CoinModelHashLink * hash_
hash
int position_
Position in data.
double element() const
Get value.
bool stringInTriple(const CoinModelTriple &triple)
double value_
Value as double.
int maximumItems() const
Maximum number of items.
int maximumMajor_
Maximum number of major items i.e. rows if just row links.
void resize(int maxItems, bool forceReHash=false)
Resize hash (also re-hashs)
void setRowAndStringInTriple(CoinModelTriple &triple, int iRow, bool string)
CoinModelHash & operator=(const CoinModelHash &)
=
bool onRow_
If on row chain.
int firstFree() const
First on free chain.
void deleteSame(int which, CoinModelTriple *triples, CoinModelHash2 &hash, bool zapTriples)
Deletes from list - same case i.e.
int type_
0 row list, 1 column list
void setOnRow(bool onRow)
Set onRow.
const char * name(int which) const
Returns name at position (or NULL)
int hash(const char *name) const
Returns index or -1.
~CoinModelHash2()
Destructor.
~CoinModelHash()
Destructor.
void resize(int maxMajor, int maxElements)
Resize list - for row list maxMajor is maximum rows.
void validateLinks(const CoinModelTriple *triples) const
Checks that links are consistent.
int addEasy(int majorIndex, int numberOfElements, const int *indices, const double *elements, CoinModelTriple *triples, CoinModelHash2 &hash)
Adds to list - easy case i.e.
void deleteHash(int index, int row, int column)
Deletes from hash.
int * last_
Last - maximumMajor+1 long (last free element chain)
void setNumberItems(int number)
Set number of items.
int * first_
First - maximumMajor+1 long (last free element chain)
~CoinModelLinkedList()
Destructor.
CoinModelLink()
Default constructor.
int first(int which) const
First on chain.
void synchronize(CoinModelLinkedList &other)
Puts in free list from other list.
int numberItems() const
Number of items.
void setRowInTriple(CoinModelTriple &triple, int iRow)
int hashValue(const char *name) const
Returns a hash value.
void setColumn(int column)
Set column.
void deleteHash(int index)
Deletes from hash.
int numberItems_
Number of items.
CoinYacc & operator=(const CoinYacc &rhs)
int maximumItems() const
Maximum number of items.
int numberMajor_
Number of major items i.e. rows if just row links.
void updateDeletedOne(int position, const CoinModelTriple *triples)
Update column list for one element when one element deleted from row copy.
CoinModelHash()
Default constructor.
int numberItems_
Number of items.
CoinModelHashLink * hash_
hash
void addHash(int index, int row, int column, const CoinModelTriple *triples)
Adds to hash.
CoinModelHash2()
Default constructor.
const int * previous() const
Previous array.
int lastSlot_
Last slot looked at.
void setValue(double value)
Set value.
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 maximumMajor() const
Maximum number of major items i.e. rows if just row links.
int column() const
Get column.
CoinModelHash2 & operator=(const CoinModelHash2 &)
=
int hashValue(int row, int column) const
Returns a hash value.
int last(int which) const
Last on chain.
void fill(int first, int last)
Fills first,last with -1.
void setNumberItems(int number)
Set number of items.
const char *const * names() const
Names.
int lastFree() const
Last on free chain.
void addHard(int minorIndex, int numberOfElements, const int *indices, const double *elements, CoinModelTriple *triples, CoinModelHash2 &hash)
Adds to list - hard case i.e.
int position() const
Get position.
CoinModelLink & operator=(const CoinModelLink &)
=
void setRow(int row)
Set row.
void setPosition(int position)
Set position.
int rowInTriple(const CoinModelTriple &triple)
void setName(int which, char *name)
Sets name at position (does not create)
int maximumItems_
Maximum number of items.
bool onRow() const
Get onRow.