Skip to content

Commit

Permalink
- use fill(...) instead of listFill + listArray
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@4620 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Dec 3, 2009
1 parent 781e0e2 commit e456b27
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 39 deletions.
15 changes: 8 additions & 7 deletions Compiler/HashTable.mo
Expand Up @@ -161,8 +161,9 @@ public function emptyHashTable "
Option<tuple<Key,Value>>[:] emptyarr;
algorithm
arr := fill({}, 1000);
lst := Util.listFill(NONE, 100);
emptyarr := listArray(lst);
// lst := Util.listFill(NONE, 100);
// emptyarr := listArray(lst);
emptyarr := fill(NONE(), 100);
hashTable := HASHTABLE(arr,VALUE_ARRAY(0,100,emptyarr),1000,0);
end emptyHashTable;

Expand All @@ -180,7 +181,7 @@ public function add "
author: PA
Add a Key-Value tuple to hashtable.
If the Key-Value tuple allready exists, the function updates the Value.
If the Key-Value tuple already exists, the function updates the Value.
"
input tuple<Key,Value> entry;
input HashTable hashTable;
Expand Down Expand Up @@ -210,7 +211,7 @@ algorithm
n_1 = valueArrayLength(varr_1);
then HASHTABLE(hashvec_1,varr_1,bsize,n_1);

/* adding when allready present => Updating value */
/* adding when already present => Updating value */
case ((newv as (key,value)),(hashTable as HASHTABLE(hashvec,varr,bsize,n)))
equation
(_,indx) = get1(key, hashTable);
Expand All @@ -230,7 +231,7 @@ public function addNoUpdCheck "
author: PA
Add a Key-Value tuple to hashtable.
If the Key-Value tuple allready exists, the function updates the Value.
If the Key-Value tuple already exists, the function updates the Value.
"
input tuple<Key,Value> entry;
input HashTable hashTable;
Expand Down Expand Up @@ -289,7 +290,7 @@ algorithm
tuple<Key,Value> v,newv;
Key key;
Value value;
/* adding when allready present => Updating value */
/* adding when already present => Updating value */
case (key,(hashTable as HASHTABLE(hashvec,varr,bsize,n)))
equation
(_,indx) = get1(key, hashTable);
Expand Down Expand Up @@ -479,7 +480,7 @@ end valueArrayLength;

public function valueArrayAdd "function: valueArrayAdd
author: PA
Adds am emtry last to the ValueArray, increasing array size
Adds an entry last to the ValueArray, increasing array size
if no space left by factor 1.4
"
input ValueArray valueArray;
Expand Down
13 changes: 7 additions & 6 deletions Compiler/HashTable2.mo
Expand Up @@ -89,16 +89,17 @@ public function emptyHashTable "
Option<tuple<Key,Value>>[:] emptyarr;
algorithm
arr := fill({}, 1000);
lst := Util.listFill(NONE, 100);
emptyarr := listArray(lst);
// lst := Util.listFill(NONE, 100);
// emptyarr := listArray(lst);
emptyarr := fill(NONE(), 100);
hashTable := HASHTABLE(arr,VALUE_ARRAY(0,100,emptyarr),1000,0);
end emptyHashTable;

public function add "
author: PA
Add a Key-Value tuple to hashtable.
If the Key-Value tuple allready exists, the function updates the Value.
If the Key-Value tuple already exists, the function updates the Value.
"
input tuple<Key,Value> entry;
input HashTable hashTable;
Expand Down Expand Up @@ -128,7 +129,7 @@ algorithm
n_1 = valueArrayLength(varr_1);
then HASHTABLE(hashvec_1,varr_1,bsize,n_1);

/* adding when allready present => Updating value */
/* adding when already present => Updating value */
case ((newv as (key,value)),(hashTable as HASHTABLE(hashvec,varr,bsize,n)))
equation
(_,indx) = get1(key, hashTable);
Expand All @@ -148,7 +149,7 @@ public function addNoUpdCheck "
author: PA
Add a Key-Value tuple to hashtable.
If the Key-Value tuple allready exists, the function updates the Value.
If the Key-Value tuple already exists, the function updates the Value.
"
input tuple<Key,Value> entry;
input HashTable hashTable;
Expand Down Expand Up @@ -207,7 +208,7 @@ algorithm
tuple<Key,Value> v,newv;
Key key;
Value value;
/* adding when allready present => Updating value */
/* adding when already present => Updating value */
case (key,(hashTable as HASHTABLE(hashvec,varr,bsize,n)))
equation
(_,indx) = get1(key, hashTable);
Expand Down
13 changes: 7 additions & 6 deletions Compiler/HashTable3.mo
Expand Up @@ -88,16 +88,17 @@ public function emptyHashTable "
Option<tuple<Key,Value>>[:] emptyarr;
algorithm
arr := fill({}, 1000);
lst := Util.listFill(NONE, 100);
emptyarr := listArray(lst);
// lst := Util.listFill(NONE, 100);
// emptyarr := listArray(lst);
emptyarr := fill(NONE(), 100);
hashTable := HASHTABLE(arr,VALUE_ARRAY(0,100,emptyarr),1000,0);
end emptyHashTable;

public function add "
author: PA
Add a Key-Value tuple to hashtable.
If the Key-Value tuple allready exists, the function updates the Value.
If the Key-Value tuple already exists, the function updates the Value.
"
input tuple<Key,Value> entry;
input HashTable hashTable;
Expand Down Expand Up @@ -127,7 +128,7 @@ algorithm
n_1 = valueArrayLength(varr_1);
then HASHTABLE(hashvec_1,varr_1,bsize,n_1);

/* adding when allready present => Updating value */
/* adding when already present => Updating value */
case ((newv as (key,value)),(hashTable as HASHTABLE(hashvec,varr,bsize,n)))
equation
(_,indx) = get1(key, hashTable);
Expand Down Expand Up @@ -166,7 +167,7 @@ algorithm
tuple<Key,Value> v,newv;
Key key;
Value value;
/* adding when allready present => Updating value */
/* adding when already present => Updating value */
case (key,(hashTable as HASHTABLE(hashvec,varr,bsize,n)))
equation
(_,indx) = get1(key, hashTable);
Expand Down Expand Up @@ -355,7 +356,7 @@ end valueArrayLength;

public function valueArrayAdd "function: valueArrayAdd
author: PA
Adds am emtry last to the ValueArray, increasing array size
Adds an entry last to the ValueArray, increasing array size
if no space left by factor 1.4
"
input ValueArray valueArray;
Expand Down
15 changes: 8 additions & 7 deletions Compiler/HashTable4.mo
Expand Up @@ -109,8 +109,9 @@ public function emptyHashTable "
Option<tuple<Key,Value>>[:] emptyarr;
algorithm
arr := fill({}, 1000);
lst := Util.listFill(NONE, 100);
emptyarr := listArray(lst);
// lst := Util.listFill(NONE, 100);
// emptyarr := listArray(lst);
emptyarr := fill(NONE(), 100);
hashTable := HASHTABLE(arr,VALUE_ARRAY(0,100,emptyarr),1000,0);
end emptyHashTable;

Expand All @@ -128,7 +129,7 @@ public function add "
author: PA
Add a Key-Value tuple to hashtable.
If the Key-Value tuple allready exists, the function updates the Value.
If the Key-Value tuple already exists, the function updates the Value.
"
input tuple<Key,Value> entry;
input HashTable hashTable;
Expand Down Expand Up @@ -158,7 +159,7 @@ algorithm
n_1 = valueArrayLength(varr_1);
then HASHTABLE(hashvec_1,varr_1,bsize,n_1);

/* adding when allready present => Updating value */
/* adding when already present => Updating value */
case ((newv as (key,value)),(hashTable as HASHTABLE(hashvec,varr,bsize,n)))
equation
(_,indx) = get1(key, hashTable);
Expand All @@ -178,7 +179,7 @@ public function addNoUpdCheck "
author: PA
Add a Key-Value tuple to hashtable.
If the Key-Value tuple allready exists, the function updates the Value.
If the Key-Value tuple already exists, the function updates the Value.
"
input tuple<Key,Value> entry;
input HashTable hashTable;
Expand Down Expand Up @@ -237,7 +238,7 @@ algorithm
tuple<Key,Value> v,newv;
Key key;
Value value;
/* adding when allready present => Updating value */
/* adding when already present => Updating value */
case (key,(hashTable as HASHTABLE(hashvec,varr,bsize,n)))
equation
(_,indx) = get1(key, hashTable);
Expand Down Expand Up @@ -426,7 +427,7 @@ end valueArrayLength;

public function valueArrayAdd "function: valueArrayAdd
author: PA
Adds am emtry last to the ValueArray, increasing array size
Adds an entry last to the ValueArray, increasing array size
if no space left by factor 1.4
"
input ValueArray valueArray;
Expand Down
15 changes: 8 additions & 7 deletions Compiler/HashTable5.mo
Expand Up @@ -110,8 +110,9 @@ public function emptyHashTable "
Option<tuple<Key,Value>>[:] emptyarr;
algorithm
arr := fill({}, 1000);
lst := Util.listFill(NONE, 100);
emptyarr := listArray(lst);
// lst := Util.listFill(NONE, 100);
// emptyarr := listArray(lst);
emptyarr := fill(NONE(), 100);
hashTable := HASHTABLE(arr,VALUE_ARRAY(0,100,emptyarr),1000,0);
end emptyHashTable;

Expand All @@ -129,7 +130,7 @@ public function add "
author: PA
Add a Key-Value tuple to hashtable.
If the Key-Value tuple allready exists, the function updates the Value.
If the Key-Value tuple already exists, the function updates the Value.
"
input tuple<Key,Value> entry;
input HashTable hashTable;
Expand Down Expand Up @@ -159,7 +160,7 @@ algorithm
n_1 = valueArrayLength(varr_1);
then HASHTABLE(hashvec_1,varr_1,bsize,n_1);

/* adding when allready present => Updating value */
/* adding when already present => Updating value */
case ((newv as (key,value)),(hashTable as HASHTABLE(hashvec,varr,bsize,n)))
equation
(_,indx) = get1(key, hashTable);
Expand All @@ -179,7 +180,7 @@ public function addNoUpdCheck "
author: PA
Add a Key-Value tuple to hashtable.
If the Key-Value tuple allready exists, the function updates the Value.
If the Key-Value tuple already exists, the function updates the Value.
"
input tuple<Key,Value> entry;
input HashTable hashTable;
Expand Down Expand Up @@ -238,7 +239,7 @@ algorithm
tuple<Key,Value> v,newv;
Key key;
Value value;
/* adding when allready present => Updating value */
/* adding when already present => Updating value */
case (key,(hashTable as HASHTABLE(hashvec,varr,bsize,n)))
equation
(_,indx) = get1(key, hashTable);
Expand Down Expand Up @@ -427,7 +428,7 @@ end valueArrayLength;

public function valueArrayAdd "function: valueArrayAdd
author: PA
Adds am emtry last to the ValueArray, increasing array size
Adds an entry last to the ValueArray, increasing array size
if no space left by factor 1.4
"
input ValueArray valueArray;
Expand Down
13 changes: 7 additions & 6 deletions Compiler/HashTableCG.mo
Expand Up @@ -110,16 +110,17 @@ public function emptyHashTable "
Option<tuple<Key,Value>>[:] emptyarr;
algorithm
arr := fill({}, 1000);
lst := Util.listFill(NONE, 100);
emptyarr := listArray(lst);
// lst := Util.listFill(NONE, 100);
// emptyarr := listArray(lst);
emptyarr := fill(NONE(), 100);
hashTable := HASHTABLE(arr,VALUE_ARRAY(0,100,emptyarr),1000,0);
end emptyHashTable;

public function add "
author: PA
Add a Key-Value tuple to hashtable.
If the Key-Value tuple allready exists, the function updates the Value.
If the Key-Value tuple already exists, the function updates the Value.
"
input tuple<Key,Value> entry;
input HashTable hashTable;
Expand Down Expand Up @@ -159,7 +160,7 @@ algorithm
printList(debugList);*/
then HASHTABLE(hashvec_1,varr_1,bsize,n_1);

/* adding when allready present => Updating value */
/* adding when already present => Updating value */
case ((newv as (key,value)),(hashTable as HASHTABLE(hashvec,varr,bsize,n)))
equation
(_,indx) = get1(key, hashTable);
Expand All @@ -170,7 +171,7 @@ algorithm
print(Exp.printComponentRefStr(key));
print(",");
print(Exp.printComponentRefStr(value));
print(") (allready present)\n");*/
print(") (already present)\n");*/
then HASHTABLE(hashvec,varr_1,bsize,n);
case (_,_)
equation
Expand Down Expand Up @@ -203,7 +204,7 @@ algorithm
tuple<Key,Value> v,newv;
Key key;
Value value;
/* adding when allready present => Updating value */
/* adding when already present => Updating value */
case (key,(hashTable as HASHTABLE(hashvec,varr,bsize,n)))
equation
(_,indx) = get1(key, hashTable);
Expand Down

0 comments on commit e456b27

Please sign in to comment.