Skip to content

Commit

Permalink
- Replaced the T[:]-types used in HashTables with array<T>
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoelund committed Oct 17, 2010
1 parent af3522c commit 1fee03b
Show file tree
Hide file tree
Showing 24 changed files with 231 additions and 232 deletions.
34 changes: 17 additions & 17 deletions Compiler/Ceval.mo
Expand Up @@ -5688,7 +5688,7 @@ end dumpTuple;
public
uniontype CevalHashTable
record HASHTABLE
list<tuple<Key,Integer>>[:] hashTable " hashtable to translate Key to array indx" ;
array<list<tuple<Key,Integer>>> hashTable " hashtable to translate Key to array indx" ;
ValueArray valueArr "Array of values" ;
Integer bucketSize "bucket size" ;
Integer numberOfEntries "number of entries in hashtable" ;
Expand All @@ -5701,7 +5701,7 @@ uniontype ValueArray
record VALUE_ARRAY
Integer numberOfElements "number of elements in hashtable" ;
Integer arrSize "size of crefArray" ;
Option<tuple<Key,Value>>[:] valueArray "array of values";
array<Option<tuple<Key,Value>>> valueArray "array of values";
end VALUE_ARRAY;
end ValueArray;

Expand All @@ -5712,9 +5712,9 @@ input CevalHashTable inHash;
output CevalHashTable outHash;
algorithm outHash := matchcontinue(inHash)
local
list<tuple<Key,Integer>>[:] arg1,arg1_2;
array<list<tuple<Key,Integer>>> arg1,arg1_2;
Integer arg3,arg4,arg3_2,arg4_2,arg21,arg21_2,arg22,arg22_2;
Option<tuple<Key,Value>>[:] arg23,arg23_2;
array<Option<tuple<Key,Value>>> arg23,arg23_2;
case(HASHTABLE(arg1,VALUE_ARRAY(arg21,arg22,arg23),arg3,arg4))
equation
arg1_2 = arrayCopy(arg1);
Expand All @@ -5733,9 +5733,9 @@ public function emptyCevalHashTable
Returns an empty CevalHashTable.
Using the bucketsize 100 and array size 10."
output CevalHashTable hashTable;
list<tuple<Key,Integer>>[:] arr;
array<list<tuple<Key,Integer>>> arr;
list<Option<tuple<Key,Value>>> lst;
Option<tuple<Key,Value>>[:] emptyarr;
array<Option<tuple<Key,Value>>> emptyarr;
algorithm
arr := fill({}, 1000);
emptyarr := fill(NONE(), 100);
Expand Down Expand Up @@ -5766,7 +5766,7 @@ algorithm
Integer hval,indx,newpos,n,n_1,bsize,indx_1;
ValueArray varr_1,varr;
list<tuple<Key,Integer>> indexes;
list<tuple<Key,Integer>>[:] hashvec_1,hashvec;
array<list<tuple<Key,Integer>>> hashvec_1,hashvec;
String name_str;
tuple<Key,Value> v,newv;
Key key;
Expand Down Expand Up @@ -5813,7 +5813,7 @@ algorithm
Integer hval,indx,newpos,n,n_1,bsize,indx_1;
ValueArray varr_1,varr;
list<tuple<Key,Integer>> indexes;
list<tuple<Key,Integer>>[:] hashvec_1,hashvec;
array<list<tuple<Key,Integer>>> hashvec_1,hashvec;
String name_str;
tuple<Key,Value> v,newv;
Key key;
Expand Down Expand Up @@ -5852,7 +5852,7 @@ algorithm
Integer hval,indx,newpos,n,n_1,bsize,indx_1;
ValueArray varr_1,varr;
list<tuple<Key,Integer>> indexes;
list<tuple<Key,Integer>>[:] hashvec_1,hashvec;
array<list<tuple<Key,Integer>>> hashvec_1,hashvec;
String name_str;
tuple<Key,Value> v,newv;
Key key;
Expand Down Expand Up @@ -5894,7 +5894,7 @@ algorithm
Integer hval,hashindx,indx,indx_1,bsize,n;
list<tuple<Key,Integer>> indexes;
Value v;
list<tuple<Key,Integer>>[:] hashvec;
array<list<tuple<Key,Integer>>> hashvec;
ValueArray varr;
Key key2;
case (key,(hashTable as HASHTABLE(hashvec,varr,bsize,n)))
Expand Down Expand Up @@ -5968,7 +5968,7 @@ public function valueArrayList
algorithm
tplLst := matchcontinue (valueArray)
local
Option<tuple<Key,Value>>[:] arr;
array<Option<tuple<Key,Value>>> arr;
tuple<Key,Value> elt;
Integer lastpos,n,size;
list<tuple<Key,Value>> lst;
Expand All @@ -5988,15 +5988,15 @@ algorithm
end valueArrayList;

public function valueArrayList2 "Helper function to valueArrayList"
input Option<tuple<Key,Value>>[:] inVarOptionArray1;
input array<Option<tuple<Key,Value>>> inVarOptionArray1;
input Integer inInteger2;
input Integer inInteger3;
output list<tuple<Key,Value>> outVarLst;
algorithm
outVarLst := matchcontinue (inVarOptionArray1,inInteger2,inInteger3)
local
tuple<Key,Value> v;
Option<tuple<Key,Value>>[:] arr;
array<Option<tuple<Key,Value>>> arr;
Integer pos,lastpos,pos_1;
list<tuple<Key,Value>> res;
case (arr,pos,lastpos)
Expand Down Expand Up @@ -6045,7 +6045,7 @@ algorithm
outValueArray := matchcontinue (valueArray,entry)
local
Integer n_1,n,size,expandsize,expandsize_1,newsize;
Option<tuple<Key,Value>>[:] arr_1,arr,arr_2;
array<Option<tuple<Key,Value>>> arr_1,arr,arr_2;
Real rsize,rexpandsize;
case (VALUE_ARRAY(numberOfElements = n,arrSize = size,valueArray = arr),entry)
equation
Expand Down Expand Up @@ -6087,7 +6087,7 @@ public function valueArraySetnth
algorithm
outValueArray := matchcontinue (valueArray,pos,entry)
local
Option<tuple<Key,Value>>[:] arr_1,arr;
array<Option<tuple<Key,Value>>> arr_1,arr;
Integer n,size,pos;
case (VALUE_ARRAY(n,size,arr),pos,entry)
equation
Expand All @@ -6112,7 +6112,7 @@ public function valueArrayClearnth
algorithm
outValueArray := matchcontinue (valueArray,pos)
local
Option<tuple<Key,Value>>[:] arr_1,arr;
array<Option<tuple<Key,Value>>> arr_1,arr;
Integer n,size,pos;
case (VALUE_ARRAY(n,size,arr),pos)
equation
Expand Down Expand Up @@ -6140,7 +6140,7 @@ algorithm
local
Value v;
Integer n,pos,len;
Option<tuple<Key,Value>>[:] arr;
array<Option<tuple<Key,Value>>> arr;
String ps,lens,ns;
case (VALUE_ARRAY(numberOfElements = n,valueArray = arr),pos)
equation
Expand Down
2 changes: 1 addition & 1 deletion Compiler/DAELow.mo
Expand Up @@ -3207,7 +3207,7 @@ algorithm
BinTree mvars_1,mvars_2;
VarTransform.VariableReplacements repl_1,repl_2,replc_1,replc_2;
DAE.ComponentRef cr1,cr2;
list<Equation> eqns_1,seqns_1,eqns;
list<Equation> eqns_1,seqns_1;
Equation e;
DAE.ExpType t;
DAE.Exp e1,e2;
Expand Down
2 changes: 1 addition & 1 deletion Compiler/Database.mo
Expand Up @@ -39,4 +39,4 @@ package Database
This package provides functionality for creating and using databases.
It is a wrapper to SQlite."

end Database;
end Database;
38 changes: 19 additions & 19 deletions Compiler/HashTable.mo
Expand Up @@ -111,7 +111,7 @@ end dumpTuple;
public
uniontype HashTable
record HASHTABLE
list<tuple<Key,Integer>>[:] hashTable " hashtable to translate Key to array indx" ;
array<list<tuple<Key,Integer>>> hashTable " hashtable to translate Key to array indx" ;
ValueArray valueArr "Array of values" ;
Integer bucketSize "bucket size" ;
Integer numberOfEntries "number of entries in hashtable" ;
Expand All @@ -123,7 +123,7 @@ efficient manner"
record VALUE_ARRAY
Integer numberOfElements "number of elements in hashtable" ;
Integer arrSize "size of crefArray" ;
Option<tuple<Key,Value>>[:] valueArray "array of values";
array<Option<tuple<Key,Value>>> valueArray "array of values";
end VALUE_ARRAY;
end ValueArray;

Expand All @@ -135,9 +135,9 @@ input HashTable inHash;
output HashTable outHash;
algorithm outHash := matchcontinue(inHash)
local
list<tuple<Key,Integer>>[:] arg1,arg1_2;
array<list<tuple<Key,Integer>>> arg1,arg1_2;
Integer arg3,arg4,arg3_2,arg4_2,arg21,arg21_2,arg22,arg22_2;
Option<tuple<Key,Value>>[:] arg23,arg23_2;
array<Option<tuple<Key,Value>>> arg23,arg23_2;
case(HASHTABLE(arg1,VALUE_ARRAY(arg21,arg22,arg23),arg3,arg4))
equation
arg1_2 = arrayCopy(arg1);
Expand All @@ -158,9 +158,9 @@ public function nullHashTable "
Using the bucketsize 100 and array size 10.
"
output HashTable hashTable;
list<tuple<Key,Integer>>[:] arr;
array<list<tuple<Key,Integer>>> arr;
list<Option<tuple<Key,Value>>> lst;
Option<tuple<Key,Value>>[:] emptyarr;
array<Option<tuple<Key,Value>>> emptyarr;
algorithm
arr := fill({}, 0);
emptyarr := listArray({});
Expand All @@ -174,9 +174,9 @@ public function emptyHashTable "
Using the bucketsize 100 and array size 10.
"
output HashTable hashTable;
list<tuple<Key,Integer>>[:] arr;
array<list<tuple<Key,Integer>>> arr;
list<Option<tuple<Key,Value>>> lst;
Option<tuple<Key,Value>>[:] emptyarr;
array<Option<tuple<Key,Value>>> emptyarr;
algorithm
arr := fill({}, 1000);
// lst := Util.listFill(NONE, 100);
Expand Down Expand Up @@ -211,7 +211,7 @@ algorithm
Integer hval,indx,newpos,n,n_1,bsize,indx_1;
ValueArray varr_1,varr;
list<tuple<Key,Integer>> indexes;
list<tuple<Key,Integer>>[:] hashvec_1,hashvec;
array<list<tuple<Key,Integer>>> hashvec_1,hashvec;
String name_str;
tuple<Key,Value> v,newv;
Key key;
Expand Down Expand Up @@ -292,7 +292,7 @@ algorithm
Integer hval,indx,newpos,n,n_1,bsize,indx_1;
ValueArray varr_1,varr;
list<tuple<Key,Integer>> indexes;
list<tuple<Key,Integer>>[:] hashvec_1,hashvec;
array<list<tuple<Key,Integer>>> hashvec_1,hashvec;
String name_str;
tuple<Key,Value> v,newv;
Key key;
Expand Down Expand Up @@ -337,7 +337,7 @@ algorithm
Integer hval,indx,newpos,n,n_1,bsize,indx_1;
ValueArray varr_1,varr;
list<tuple<Key,Integer>> indexes;
list<tuple<Key,Integer>>[:] hashvec_1,hashvec;
array<list<tuple<Key,Integer>>> hashvec_1,hashvec;
String name_str;
tuple<Key,Value> v,newv;
Key key;
Expand Down Expand Up @@ -383,7 +383,7 @@ algorithm
Integer hval,hashindx,indx,indx_1,bsize,n;
list<tuple<Key,Integer>> indexes;
Value v;
list<tuple<Key,Integer>>[:] hashvec;
array<list<tuple<Key,Integer>>> hashvec;
ValueArray varr;
Key k;
case (key,(hashTable as HASHTABLE(hashvec,varr,bsize,n)))
Expand Down Expand Up @@ -463,7 +463,7 @@ algorithm
tplLst :=
matchcontinue (valueArray)
local
Option<tuple<Key,Value>>[:] arr;
array<Option<tuple<Key,Value>>> arr;
tuple<Key,Value> elt;
Integer lastpos,n,size;
list<tuple<Key,Value>> lst;
Expand All @@ -483,7 +483,7 @@ algorithm
end valueArrayList;

protected function valueArrayList2 "Helper function to valueArrayList"
input Option<tuple<Key,Value>>[:] inVarOptionArray1;
input array<Option<tuple<Key,Value>>> inVarOptionArray1;
input Integer inInteger2;
input Integer inInteger3;
output list<tuple<Key,Value>> outVarLst;
Expand All @@ -492,7 +492,7 @@ algorithm
matchcontinue (inVarOptionArray1,inInteger2,inInteger3)
local
tuple<Key,Value> v;
Option<tuple<Key,Value>>[:] arr;
array<Option<tuple<Key,Value>>> arr;
Integer pos,lastpos,pos_1;
list<tuple<Key,Value>> res;
case (arr,pos,lastpos)
Expand Down Expand Up @@ -544,7 +544,7 @@ algorithm
matchcontinue (valueArray,entry)
local
Integer n_1,n,size,expandsize,expandsize_1,newsize;
Option<tuple<Key,Value>>[:] arr_1,arr,arr_2;
array<Option<tuple<Key,Value>>> arr_1,arr,arr_2;
Real rsize,rexpandsize;
case (VALUE_ARRAY(numberOfElements = n,arrSize = size,valueArray = arr),entry)
equation
Expand Down Expand Up @@ -587,7 +587,7 @@ algorithm
outValueArray:=
matchcontinue (valueArray,pos,entry)
local
Option<tuple<Key,Value>>[:] arr_1,arr;
array<Option<tuple<Key,Value>>> arr_1,arr;
Integer n,size,pos;
case (VALUE_ARRAY(n,size,arr),pos,entry)
equation
Expand All @@ -614,7 +614,7 @@ algorithm
outValueArray:=
matchcontinue (valueArray,pos)
local
Option<tuple<Key,Value>>[:] arr_1,arr;
array<Option<tuple<Key,Value>>> arr_1,arr;
Integer n,size,pos;
case (VALUE_ARRAY(n,size,arr),pos)
equation
Expand Down Expand Up @@ -646,7 +646,7 @@ algorithm
Key k;
Value v;
Integer n,pos,len;
Option<tuple<Key,Value>>[:] arr;
array<Option<tuple<Key,Value>>> arr;
String ps,lens,ns;
case (VALUE_ARRAY(numberOfElements = n,valueArray = arr),pos)
equation
Expand Down

0 comments on commit 1fee03b

Please sign in to comment.