|
|
@@ -22,6 +22,8 @@
|
|
|
|
|
|
package haxe.ds;
|
|
|
|
|
|
+#if (hl_ver >= version("1.13.0") && !hl_legacy32)
|
|
|
+
|
|
|
@:coreApi
|
|
|
class Int64Map<T> implements haxe.Constraints.IMap<haxe.Int64, T> {
|
|
|
var h:hl.types.Int64Map;
|
|
|
@@ -82,18 +84,82 @@ class Int64Map<T> implements haxe.Constraints.IMap<haxe.Int64, T> {
|
|
|
}
|
|
|
|
|
|
public function clear():Void {
|
|
|
- #if (hl_ver >= version("1.11.0"))
|
|
|
@:privateAccess h.clear();
|
|
|
- #else
|
|
|
- h = new hl.types.Int64Map();
|
|
|
- #end
|
|
|
}
|
|
|
|
|
|
public function size():Int {
|
|
|
- #if (hl_ver >= version("1.12.0"))
|
|
|
return h.size();
|
|
|
- #else
|
|
|
- return h.keysArray().length;
|
|
|
- #end
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+#else
|
|
|
+
|
|
|
+// Same as haxe.ds.Int64Map
|
|
|
+class Int64Map<T> implements haxe.Constraints.IMap<haxe.Int64, T> {
|
|
|
+ var m : Map<String,T>;
|
|
|
+
|
|
|
+ public function new():Void {
|
|
|
+ m = new Map();
|
|
|
+ }
|
|
|
+
|
|
|
+ public function set(key:Int64, value:T):Void {
|
|
|
+ m.set(key.toString(),value);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function get(key:Int64):Null<T> {
|
|
|
+ return m.get(key.toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ public function exists(key:Int64):Bool {
|
|
|
+ return m.exists(key.toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ public function remove(key:Int64):Bool {
|
|
|
+ return m.remove(key.toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ public function keys():Iterator<Int64> {
|
|
|
+ var it = m.keys();
|
|
|
+ return {
|
|
|
+ hasNext : () -> it.hasNext(),
|
|
|
+ next: () -> {
|
|
|
+ return haxe.Int64.parseString(it.next());
|
|
|
+ }
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ public function iterator():Iterator<T> {
|
|
|
+ return m.iterator();
|
|
|
+ }
|
|
|
+
|
|
|
+ public function keyValueIterator():KeyValueIterator<Int64, T> {
|
|
|
+ var it = m.keyValueIterator();
|
|
|
+ return {
|
|
|
+ hasNext : () -> it.hasNext(),
|
|
|
+ next : () -> {
|
|
|
+ var v = it.next();
|
|
|
+ return { key : haxe.Int64.parseString(v.key), value : v.value };
|
|
|
+ }
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ public function copy():Int64Map<T> {
|
|
|
+ var v = new Int64Map();
|
|
|
+ v.m = m.copy();
|
|
|
+ return v;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function toString():String {
|
|
|
+ return m.toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ public function clear():Void {
|
|
|
+ m.clear();
|
|
|
+ }
|
|
|
+
|
|
|
+ public function size():Int {
|
|
|
+ return m.size();
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+#end
|