Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f170480
commit bfd4680
Showing
8 changed files
with
2,687 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
/* | ||
* This file is part of OpenModelica. | ||
* | ||
* Copyright (c) 1998-2014, Open Source Modelica Consortium (OSMC), | ||
* c/o Linköpings universitet, Department of Computer and Information Science, | ||
* SE-58183 Linköping, Sweden. | ||
* | ||
* All rights reserved. | ||
* | ||
* THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3 LICENSE OR | ||
* THIS OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.2. | ||
* ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES | ||
* RECIPIENT'S ACCEPTANCE OF THE OSMC PUBLIC LICENSE OR THE GPL VERSION 3, | ||
* ACCORDING TO RECIPIENTS CHOICE. | ||
* | ||
* The OpenModelica software and the Open Source Modelica | ||
* Consortium (OSMC) Public License (OSMC-PL) are obtained | ||
* from OSMC, either from the above address, | ||
* from the URLs: http://www.ida.liu.se/projects/OpenModelica or | ||
* http://www.openmodelica.org, and in the OpenModelica distribution. | ||
* GNU version 3 is obtained from: http://www.gnu.org/copyleft/gpl.html. | ||
* | ||
* This program is distributed WITHOUT ANY WARRANTY; without | ||
* even the implied warranty of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH | ||
* IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF OSMC-PL. | ||
* | ||
* See the full OSMC Public License conditions for more details. | ||
* | ||
*/ | ||
|
||
encapsulated package NFHashTableCrToUnit " | ||
This file is an extension to OpenModelica. | ||
|
||
Copyright (c) 2013 TU Dresden | ||
|
||
All rights reserved. | ||
|
||
file: HashTableCrToUnit.mo | ||
package: HashTableCrToUnit | ||
description: ComponentRef to Unit.Unit | ||
|
||
|
||
" | ||
|
||
/* Below is the instance specific code. For each hashtable the user must define: | ||
Key - The key used to uniquely define elements in a hashtable | ||
Value - The data to associate with each key | ||
hashFunc - A function that maps a key to a positive integer. | ||
keyEqual - A comparison function between two keys, returns true if equal. | ||
*/ | ||
|
||
/* HashTable instance specific code */ | ||
|
||
public import BaseHashTable; | ||
public import DAE; | ||
public import ComponentReference; | ||
public import NFUnit; | ||
|
||
|
||
public type Key = DAE.ComponentRef; | ||
public type Value = NFUnit.Unit; | ||
|
||
public type HashTableCrefFunctionsType = tuple<FuncHashKey,FuncKeyEqual,FuncKeyStr,FuncValueStr>; | ||
public type HashTable = tuple< | ||
array<list<tuple<Key,Integer>>>, | ||
tuple<Integer,Integer,array<Option<tuple<Key,Value>>>>, | ||
Integer, | ||
HashTableCrefFunctionsType | ||
>; | ||
|
||
partial function FuncHashKey | ||
input Key cr; | ||
input Integer mod; | ||
output Integer res; | ||
end FuncHashKey; | ||
|
||
partial function FuncKeyEqual | ||
input Key cr1; | ||
input Key cr2; | ||
output Boolean res; | ||
end FuncKeyEqual; | ||
|
||
partial function FuncKeyStr | ||
input Key cr; | ||
output String res; | ||
end FuncKeyStr; | ||
|
||
partial function FuncValueStr | ||
input Value exp; | ||
output String res; | ||
end FuncValueStr; | ||
|
||
public function emptyHashTable | ||
" | ||
Returns an empty HashTable. | ||
Using the default bucketsize.. | ||
" | ||
output HashTable hashTable; | ||
algorithm | ||
hashTable := emptyHashTableSized(BaseHashTable.defaultBucketSize); | ||
end emptyHashTable; | ||
|
||
public function emptyHashTableSized | ||
" | ||
Returns an empty HashTable. | ||
Using the bucketsize size. | ||
" | ||
input Integer size; | ||
output HashTable hashTable; | ||
algorithm | ||
hashTable := BaseHashTable.emptyHashTableWork(size, (ComponentReference.hashComponentRefMod, ComponentReference.crefEqual, ComponentReference.printComponentRefStr, NFUnit.unit2string)); | ||
end emptyHashTableSized; | ||
|
||
annotation(__OpenModelica_Interface="frontend"); | ||
end NFHashTableCrToUnit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
/* | ||
* This file is part of OpenModelica. | ||
* | ||
* Copyright (c) 1998-2014, Open Source Modelica Consortium (OSMC), | ||
* c/o Linköpings universitet, Department of Computer and Information Science, | ||
* SE-58183 Linköping, Sweden. | ||
* | ||
* All rights reserved. | ||
* | ||
* THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3 LICENSE OR | ||
* THIS OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.2. | ||
* ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES | ||
* RECIPIENT'S ACCEPTANCE OF THE OSMC PUBLIC LICENSE OR THE GPL VERSION 3, | ||
* ACCORDING TO RECIPIENTS CHOICE. | ||
* | ||
* The OpenModelica software and the Open Source Modelica | ||
* Consortium (OSMC) Public License (OSMC-PL) are obtained | ||
* from OSMC, either from the above address, | ||
* from the URLs: http://www.ida.liu.se/projects/OpenModelica or | ||
* http://www.openmodelica.org, and in the OpenModelica distribution. | ||
* GNU version 3 is obtained from: http://www.gnu.org/copyleft/gpl.html. | ||
* | ||
* This program is distributed WITHOUT ANY WARRANTY; without | ||
* even the implied warranty of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH | ||
* IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF OSMC-PL. | ||
* | ||
* See the full OSMC Public License conditions for more details. | ||
* | ||
*/ | ||
|
||
encapsulated package NFHashTableStringToUnit " | ||
This file is an extension to OpenModelica. | ||
|
||
Copyright (c) 2013 TU Dresden | ||
|
||
All rights reserved. | ||
|
||
file: HashTableStringToUnit.mo | ||
package: HashTableStringToUnit | ||
description: String to Unit.Unit | ||
|
||
|
||
" | ||
|
||
/* Below is the instance specific code. For each hashtable the user must define: | ||
Key - The key used to uniquely define elements in a hashtable | ||
Value - The data to associate with each key | ||
hashFunc - A function that maps a key to a positive integer. | ||
keyEqual - A comparison function between two keys, returns true if equal. | ||
*/ | ||
|
||
/* HashTable instance specific code */ | ||
|
||
public import BaseHashTable; | ||
public import System; | ||
public import NFUnit; | ||
public import Util; | ||
|
||
public type Key = String; | ||
public type Value = NFUnit.Unit; | ||
|
||
public type HashTableCrefFunctionsType = tuple<FuncHashKey,FuncKeyEqual,FuncKeyStr,FuncValueStr>; | ||
public type HashTable = tuple< | ||
array<list<tuple<Key,Integer>>>, | ||
tuple<Integer,Integer,array<Option<tuple<Key,Value>>>>, | ||
Integer, | ||
HashTableCrefFunctionsType | ||
>; | ||
|
||
partial function FuncHashKey | ||
input Key cr; | ||
input Integer mod; | ||
output Integer res; | ||
end FuncHashKey; | ||
|
||
partial function FuncKeyEqual | ||
input Key cr1; | ||
input Key cr2; | ||
output Boolean res; | ||
end FuncKeyEqual; | ||
|
||
partial function FuncKeyStr | ||
input Key cr; | ||
output String res; | ||
end FuncKeyStr; | ||
|
||
partial function FuncValueStr | ||
input Value exp; | ||
output String res; | ||
end FuncValueStr; | ||
|
||
public function emptyHashTable | ||
" | ||
Returns an empty HashTable. | ||
Using the default bucketsize.. | ||
" | ||
output HashTable hashTable; | ||
algorithm | ||
hashTable := emptyHashTableSized(BaseHashTable.defaultBucketSize); | ||
end emptyHashTable; | ||
|
||
public function emptyHashTableSized | ||
" | ||
Returns an empty HashTable. | ||
Using the bucketsize size. | ||
" | ||
input Integer size; | ||
output HashTable hashTable; | ||
algorithm | ||
hashTable := BaseHashTable.emptyHashTableWork(size, (System.stringHashDjb2Mod, stringEq, Util.id, NFUnit.unit2string)); | ||
end emptyHashTableSized; | ||
|
||
annotation(__OpenModelica_Interface="frontend"); | ||
end NFHashTableStringToUnit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
/* | ||
* This file is part of OpenModelica. | ||
* | ||
* Copyright (c) 1998-2014, Open Source Modelica Consortium (OSMC), | ||
* c/o Linköpings universitet, Department of Computer and Information Science, | ||
* SE-58183 Linköping, Sweden. | ||
* | ||
* All rights reserved. | ||
* | ||
* THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3 LICENSE OR | ||
* THIS OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.2. | ||
* ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES | ||
* RECIPIENT'S ACCEPTANCE OF THE OSMC PUBLIC LICENSE OR THE GPL VERSION 3, | ||
* ACCORDING TO RECIPIENTS CHOICE. | ||
* | ||
* The OpenModelica software and the Open Source Modelica | ||
* Consortium (OSMC) Public License (OSMC-PL) are obtained | ||
* from OSMC, either from the above address, | ||
* from the URLs: http://www.ida.liu.se/projects/OpenModelica or | ||
* http://www.openmodelica.org, and in the OpenModelica distribution. | ||
* GNU version 3 is obtained from: http://www.gnu.org/copyleft/gpl.html. | ||
* | ||
* This program is distributed WITHOUT ANY WARRANTY; without | ||
* even the implied warranty of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH | ||
* IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF OSMC-PL. | ||
* | ||
* See the full OSMC Public License conditions for more details. | ||
* | ||
*/ | ||
|
||
encapsulated package NFHashTableUnitToString " | ||
This file is an extension to OpenModelica. | ||
|
||
Copyright (c) 2013 TU Dresden | ||
|
||
All rights reserved. | ||
|
||
file: HashTableUnitToString.mo | ||
package: HashTableUnitToString | ||
description: Unit.Unit to String | ||
|
||
|
||
" | ||
|
||
/* Below is the instance specific code. For each hashtable the user must define: | ||
Key - The key used to uniquely define elements in a hashtable | ||
Value - The data to associate with each key | ||
hashFunc - A function that maps a key to a positive integer. | ||
keyEqual - A comparison function between two keys, returns true if equal. | ||
*/ | ||
|
||
/* HashTable instance specific code */ | ||
|
||
public import BaseHashTable; | ||
public import NFUnit; | ||
|
||
public type Key = NFUnit.Unit; | ||
public type Value = String; | ||
|
||
public type HashTableCrefFunctionsType = tuple<FuncHashKey,FuncKeyEqual,FuncKeyStr,FuncValueStr>; | ||
public type HashTable = tuple< | ||
array<list<tuple<Key,Integer>>>, | ||
tuple<Integer,Integer,array<Option<tuple<Key,Value>>>>, | ||
Integer, | ||
HashTableCrefFunctionsType | ||
>; | ||
|
||
partial function FuncHashKey | ||
input Key cr; | ||
input Integer mod; | ||
output Integer res; | ||
end FuncHashKey; | ||
|
||
partial function FuncKeyEqual | ||
input Key cr1; | ||
input Key cr2; | ||
output Boolean res; | ||
end FuncKeyEqual; | ||
|
||
partial function FuncKeyStr | ||
input Key cr; | ||
output String res; | ||
end FuncKeyStr; | ||
|
||
partial function FuncValueStr | ||
input Value exp; | ||
output String res; | ||
end FuncValueStr; | ||
|
||
public function emptyHashTable | ||
" | ||
Returns an empty HashTable. | ||
Using the default bucketsize.. | ||
" | ||
output HashTable hashTable; | ||
algorithm | ||
hashTable := emptyHashTableSized(BaseHashTable.defaultBucketSize); | ||
end emptyHashTable; | ||
|
||
protected function id | ||
input String inStr; | ||
output String outStr; | ||
algorithm | ||
outStr := inStr; | ||
end id; | ||
|
||
public function emptyHashTableSized | ||
" | ||
Returns an empty HashTable. | ||
Using the bucketsize size. | ||
" | ||
input Integer size; | ||
output HashTable hashTable; | ||
algorithm | ||
hashTable := BaseHashTable.emptyHashTableWork(size,(NFUnit.hashUnitMod,NFUnit.unitEqual,NFUnit.unit2string,id)); | ||
end emptyHashTableSized; | ||
|
||
annotation(__OpenModelica_Interface="frontend"); | ||
end NFHashTableUnitToString; |
Oops, something went wrong.