Skip to content

Commit

Permalink
- add missing function to last commit
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@13000 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Jens Frenkel committed Sep 20, 2012
1 parent 08dd9a4 commit 5dc3093
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions Compiler/Util/Util.mo
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,40 @@ algorithm
end match;
end arrayCopy2;

public function arraySet "function: arraySet
Sets from position start to position end_ the value v."
input Integer start;
input Integer end_;
input array<Type_a> arr;
input Type_a v;
output array<Type_a> oarr;
replaceable type Type_a subtypeof Any;
algorithm
oarr := matchcontinue(start,end_,arr,v)
local
array<Type_a> newarr;
case (_,_,_,_)
equation
// do nothing if start is grather than end_
true = intGt(start,end_);
then
arr;
case (_,_,_,_)
equation
false = intGt(start,end_);
newarr = arrayUpdate(arr, start, v);
then
arraySet(start+1,end_,newarr,v);
else
equation
print("Util.arraySet failed!\n");
print("Size: " +& intString(arrayLength(arr)) +& " start: " +& intString(start) +& " end: " +& intString(end_) +& "\n");
then
fail();
end matchcontinue;
end arraySet;


public function compareTuple2IntGt
" function: comparePosTupleList
Function could used with List.sort to sort a
Expand Down

0 comments on commit 5dc3093

Please sign in to comment.