diff --git a/CS2JLibrary/NetFramework/System/Collections/ArrayList.xml b/CS2JLibrary/NetFramework/System/Collections/ArrayList.xml index 9aaeb5c..2759f82 100644 --- a/CS2JLibrary/NetFramework/System/Collections/ArrayList.xml +++ b/CS2JLibrary/NetFramework/System/Collections/ArrayList.xml @@ -118,8 +118,10 @@ System.Void - - ${this:16}.reverse() + + java.util.Collections + + Collections.reverse(${this:16}) Reverse @@ -171,7 +173,7 @@ System.Object ${this:16}.get(${i}) - ${this:16}.add(${i}, ${value}) + ${this:16}.set(${i}, ${value}) diff --git a/CS2JLibrary/NetFramework/System/Collections/Generic/ICollection'1.xml b/CS2JLibrary/NetFramework/System/Collections/Generic/ICollection'1.xml index 7bfdd72..7dec006 100644 --- a/CS2JLibrary/NetFramework/System/Collections/Generic/ICollection'1.xml +++ b/CS2JLibrary/NetFramework/System/Collections/Generic/ICollection'1.xml @@ -23,6 +23,13 @@ ${expr} + + + ${this:16}.size() + System.Int32 + Count + ${this:16}.size() + diff --git a/CS2JLibrary/NetFramework/System/Collections/Generic/IDictionary'2.xml b/CS2JLibrary/NetFramework/System/Collections/Generic/IDictionary'2.xml index f3d3fd8..9cf4351 100644 --- a/CS2JLibrary/NetFramework/System/Collections/Generic/IDictionary'2.xml +++ b/CS2JLibrary/NetFramework/System/Collections/Generic/IDictionary'2.xml @@ -99,5 +99,12 @@ Values ${this:16}.values() + + + ${this:16}.size() + System.Int32 + Count + ${this:16}.size() + BBHaGzWIzkVajkMtIotxcu6p5VY=WOOzmkxA0yBm1tFVetTcQxQc7SztNyQygCPbn5vaHLtHI/MoQMuTuytu5BrGb4UJ7KG68galgfmWUlUD99Txs44X+XdHA7wY0XcAUwXHV+/uti6FicyhHw7mDr9Bj4+Rjq4RIA2I0gS5P25V9nMEIEQCD3/jjc+wc4Lt5AHw/b4= diff --git a/CS2JLibrary/NetFramework/System/Collections/Generic/IList'1.xml b/CS2JLibrary/NetFramework/System/Collections/Generic/IList'1.xml index 726f4e5..2dc669a 100644 --- a/CS2JLibrary/NetFramework/System/Collections/Generic/IList'1.xml +++ b/CS2JLibrary/NetFramework/System/Collections/Generic/IList'1.xml @@ -1,4 +1,4 @@ - + - javax.mail.internet.InternetAddress + CS2JNet.System.Net.Mail.MailAddress - InternetAddress + MailAddress System.Net.Mail.MailAddress @@ -24,9 +24,9 @@ - javax.mail.internet.InternetAddress + CS2JNet.System.Net.Mail.MailAddress - new InternetAddress(${address}) + new MailAddress(${address}) System.String diff --git a/CS2JLibrary/NetFramework/System/Object.xml b/CS2JLibrary/NetFramework/System/Object.xml index 89c270c..d2c680c 100644 --- a/CS2JLibrary/NetFramework/System/Object.xml +++ b/CS2JLibrary/NetFramework/System/Object.xml @@ -26,6 +26,15 @@ Equals System.Boolean + + + + + ${this:16}.clone(${obj}) + + Clone + System.Object @@ -60,6 +69,24 @@ GetHashCode System.Int + + + CS2JNet.System.ObjectSupport + + ObjectSupport.Equals(${obj1}, ${obj2}) + + + System.Object + obj1 + + + System.Object + obj2 + + + Equals + System.Boolean + diff --git a/CS2JLibrary/NetFramework/System/String.xml b/CS2JLibrary/NetFramework/System/String.xml index 8988741..4971104 100644 --- a/CS2JLibrary/NetFramework/System/String.xml +++ b/CS2JLibrary/NetFramework/System/String.xml @@ -40,10 +40,7 @@ System.Int32 - - CS2JNet.System.StringSupport - - StringSupport.Compare(${arg1}, ${this}) + ${this:16}.compareTo(${arg1}) System.String @@ -68,7 +65,7 @@ arg2 - System.Bool + System.Boolean isCaseSensitive diff --git a/CS2JLibrary/NetFramework/System/Type.xml b/CS2JLibrary/NetFramework/System/Type.xml index 2407249..d982aba 100644 --- a/CS2JLibrary/NetFramework/System/Type.xml +++ b/CS2JLibrary/NetFramework/System/Type.xml @@ -115,6 +115,17 @@ GetTypeCode System.TypeCode + + System.Boolean + IsAssignableFrom + + + arg1 + System.Type + + + ${this:16}.isAssignableFrom(${arg1}) + diff --git a/CS2JLibrary/src/CS2JNet/System/DateTimeSupport.java b/CS2JLibrary/src/CS2JNet/System/DateTimeSupport.java index 728a8cb..4ca4daf 100755 --- a/CS2JLibrary/src/CS2JNet/System/DateTimeSupport.java +++ b/CS2JLibrary/src/CS2JNet/System/DateTimeSupport.java @@ -1,5 +1,5 @@ /* - Copyright 2007,2008,2009,2010 Rustici Software, LLC + Copyright 2007,2008,2009,2010 Rustici Software, LLC Copyright 2010,2011 Kevin Glynn (kevin.glynn@twigletsoftware.com) Licensed under the Apache License, Version 2.0 (the "License"); @@ -33,7 +33,7 @@ import CS2JNet.JavaSupport.util.LocaleSupport; public class DateTimeSupport { public static String ToString(Date d, String format, Locale loc) { - + SimpleDateFormat formatter = null; if (format.equals("s")) { //TODO: Is this really a db-friendly sortable format? @@ -43,14 +43,22 @@ public class DateTimeSupport { formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss'Z'", loc); } else if (format.equals("yyyy-MM-ddTHH:mm:ss.ffZ")) { formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SS'Z'", loc); - } else { - formatter = new SimpleDateFormat(format, loc); + } else if (format.equals("yyyy-MM-ddTHH:mm:ss.fffZ")) { + formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", loc); + } else if (format.equals("ddd',' dd MMM yyyy HH':'mm':'ss'.'fff GMT")) { + formatter = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss.SSS 'GMT'"); + } else { + formatter = new SimpleDateFormat(format, loc); + } + + if (formatter.toPattern().contains("'Z'") || formatter.toPattern().contains("'GMT'")){ + formatter.setTimeZone(TimeZone.getTimeZone("UTC")); } - + if (d instanceof DateTZ) { formatter.setTimeZone(((DateTZ)d).getTimeZone()); } - + return formatter.format(d); } @@ -75,10 +83,14 @@ public class DateTimeSupport { private static final String[] DATE_FORMATS = new String[] { "E MMM d HH:mm:ss Z yyyy", "MM/dd/yyyy HH:mm:ss a", - "yyyy-MM-dd HH:mm:ss'Z'", + "yyyy-MM-dd'T'HH:mm:ss.SSSZ", + "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", + "yyyy-MM-dd'T'HH:mm:ssZ", + "yyyy-MM-dd'T'HH:mm:ss'Z'", "yyyy-MM-dd'T'HH:mm:ss'.'SSSZ", "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", "yyyy-MM-dd'T'HH:mm:ss", + "yyyy-MM-dd HH:mm:ss'Z'", "yyyy-MM-dd"}; public static Date parse(String s) throws ParseException @@ -92,21 +104,21 @@ public class DateTimeSupport { return parse(val, DATE_FORMATS, Locale.getDefault(), utc); } - protected static String trimMilliSecondsToThreeDigits(String dateString){ - String val = dateString; - if(val != null){ - int milliStart = val.lastIndexOf("."); - if(milliStart != -1){ - milliStart = milliStart + 1; - int milliEnd = val.lastIndexOf("Z"); - milliEnd = (milliEnd == -1) ? val.length() : milliEnd; - if((milliEnd - milliStart) > 3){ - String newMillis = val.substring(milliStart).substring(0, 3); - val = val.substring(0, milliStart) + newMillis + val.substring(milliEnd, val.length()); - } - } - } - return val; + protected static String trimMilliSecondsToThreeDigits(String dateString){ + String val = dateString; + if(val != null){ + int milliStart = val.lastIndexOf("."); + if(milliStart != -1){ + milliStart = milliStart + 1; + int milliEnd = Math.max(val.lastIndexOf("+"), val.lastIndexOf("Z")); + milliEnd = (milliEnd == -1) ? val.length() : milliEnd; + if((milliEnd - milliStart) > 3){ + String newMillis = val.substring(milliStart).substring(0, 3); + val = val.substring(0, milliStart) + newMillis + val.substring(milliEnd, val.length()); + } + } + } + return val; } public static Date parse(String s, String f) throws ParseException @@ -132,7 +144,7 @@ public class DateTimeSupport { try { SimpleDateFormat sdf = new SimpleDateFormat(f); - if(utc){ + if(utc || f.contains("Z")){ sdf.setTimeZone(TimeZone.getTimeZone("UTC")); } Date d = sdf.parse(s); @@ -167,7 +179,7 @@ public class DateTimeSupport { cal.add(field, amount); return cal.getTime(); } - + public static boolean equals(Date d1, Date d2) { return d1 == d2 || (d1 != null && d2 != null && d1.getTime() == d2.getTime()); } diff --git a/CS2JLibrary/src/CS2JNet/System/ObjectSupport.java b/CS2JLibrary/src/CS2JNet/System/ObjectSupport.java new file mode 100644 index 0000000..e2e99e4 --- /dev/null +++ b/CS2JLibrary/src/CS2JNet/System/ObjectSupport.java @@ -0,0 +1,11 @@ +package CS2JNet.System; + +public class ObjectSupport { + public static boolean Equals(Object obj1, Object obj2) { + if (obj1 == null) { + return obj2 == null; + } else { + return obj1.equals(obj2); + } + } +}