Skip to content

Commit 4058d61

Browse files
authored
Corrected C Sharp code generator
1 parent ba85122 commit 4058d61

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

BasicExpression.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8592,7 +8592,7 @@ public String queryFormCSharp(java.util.Map env, boolean local)
85928592
if (data.startsWith("new"))
85938593
{ String createdClass = data.substring(3);
85948594
if ("OclDate".equals(createdClass))
8595-
{ return "DateTime.Now"; }
8595+
{ return "OclDate.newOclDate()"; }
85968596
if (Type.isExceptionType(createdClass))
85978597
{ String csharpClass =
85988598
(String) Type.exceptions2csharp.get(createdClass);
@@ -8630,7 +8630,7 @@ public String queryFormCSharp(java.util.Map env, boolean local)
86308630
" = DateTimeOffset.FromUnixTimeMilliseconds(" + par1qf + ").DateTime;";
86318631
}
86328632
}
8633-
} */
8633+
}
86348634

86358635
if ("dateAfter".equals(data) && objectRef != null)
86368636
{ if (objectRef.type != null &&
@@ -8658,7 +8658,6 @@ public String queryFormCSharp(java.util.Map env, boolean local)
86588658
}
86598659
}
86608660

8661-
/*
86628661
if (data.startsWith("create") && objectRef == null)
86638662
{ String entname = data.substring(6);
86648663
System.out.println(">>> Creation operation for " + entname);
@@ -10394,7 +10393,7 @@ public String updateFormCSharp(java.util.Map env, boolean local)
1039410393
}
1039510394

1039610395
// Update form:
10397-
if ("setTime".equals(data) && objectRef != null)
10396+
/* if ("setTime".equals(data) && objectRef != null)
1039810397
{ if (objectRef.type != null &&
1039910398
objectRef.type.getName().equals("OclDate"))
1040010399
{ if (parameters != null && parameters.size() > 0)
@@ -10406,7 +10405,7 @@ public String updateFormCSharp(java.util.Map env, boolean local)
1040610405
" = DateTimeOffset.FromUnixTimeMilliseconds(" + par1qf + ").DateTime;";
1040710406
}
1040810407
}
10409-
}
10408+
} */
1041010409

1041110410
if (data.startsWith("create") && objectRef == null)
1041210411
{ String entname = data.substring(6);

Type.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3252,7 +3252,7 @@ public String getCSharp()
32523252
{ return alias.getCSharp(); }
32533253

32543254
if (nme.equals("OclDate"))
3255-
{ return "DateTime"; }
3255+
{ return "OclDate"; }
32563256
if (nme.equals("OclAny"))
32573257
{ return "object"; }
32583258
if (nme.equals("OclType"))

UnaryExpression.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4921,12 +4921,14 @@ else if (Type.isMapType(argument.type))
49214921
return "Math." + data1 + "(" + pre + ")";
49224922
} // upper case
49234923

4924-
if (operator.equals("->floor") || operator.equals("->ceil") ||
4924+
if (operator.equals("->floor") ||
49254925
operator.equals("->round"))
49264926
// But exp, floor can be applied to sets/sequences. ceil not sqr?
49274927
{ String data1 = (data.charAt(0) + "").toUpperCase() + data.substring(1,data.length());
49284928
return "((int) Math." + data1 + "(" + pre + "))";
49294929
} // could be long for double arguments
4930+
else if (operator.equals("->ceil"))
4931+
{ return "((int) Math.Ceiling(" + pre + "))"; }
49304932
else if (data.equals("toUpperCase") || data.equals("toUpper"))
49314933
{ return pre + ".ToUpper()"; }
49324934
else if (data.equals("toLowerCase") || data.equals("toLower"))

0 commit comments

Comments
 (0)