Skip to content

Instantly share code, notes, and snippets.

@szabadkai szabadkai/haxeEnumValueMap Secret
Created Jun 5, 2015

Embed
What would you like to do?
using haxe.root;
namespace haxe.ds {
public class EnumValueMap<K, V> : global::haxe.ds.BalancedTree<K, V>, global::haxe.ds.EnumValueMap, global::haxe.IMap<K, V> {
public EnumValueMap(global::haxe.lang.EmptyObject empty) : base(global::haxe.lang.EmptyObject.EMPTY) {
}
public EnumValueMap() : base(global::haxe.lang.EmptyObject.EMPTY) {
global::haxe.ds.EnumValueMap<object, object>.__hx_ctor_haxe_ds_EnumValueMap<K, V>(this);
}
public static void __hx_ctor_haxe_ds_EnumValueMap<K_c, V_c>(global::haxe.ds.EnumValueMap<K_c, V_c> __temp_me145) {
global::haxe.ds.BalancedTree<object, object>.__hx_ctor_haxe_ds_BalancedTree<K_c, V_c>(__temp_me145);
}
public static new object __hx_cast<K_c_c, V_c_c>(global::haxe.ds.EnumValueMap me) {
return ( (( me != null )) ? (me.haxe_ds_EnumValueMap_cast<K_c_c, V_c_c>()) : (null) );
}
public static new object __hx_createEmpty() {
return new global::haxe.ds.EnumValueMap<object, object>(global::haxe.lang.EmptyObject.EMPTY);
}
public static new object __hx_create(global::haxe.root.Array arr) {
return new global::haxe.ds.EnumValueMap<object, object>();
}
public virtual object haxe_ds_EnumValueMap_cast<K_c, V_c>() {
if (( global::haxe.lang.Runtime.eq(typeof(K), typeof(K_c)) && global::haxe.lang.Runtime.eq(typeof(V), typeof(V_c)) )) {
return this;
}
global::haxe.ds.EnumValueMap<K_c, V_c> new_me = new global::haxe.ds.EnumValueMap<K_c, V_c>(global::haxe.lang.EmptyObject.EMPTY);
global::haxe.root.Array<object> fields = global::haxe.root.Reflect.fields(this);
int i = 0;
while (( i < fields.length )) {
string field = global::haxe.lang.Runtime.toString(fields[i++]);
global::haxe.root.Reflect.setField(new_me, field, global::haxe.root.Reflect.field(this, field));
}
return new_me;
}
public virtual object haxe_IMap_cast<K_c, V_c>() {
return this.haxe_ds_EnumValueMap_cast<K_c, V_c>();
}
public virtual object haxe_ds_BalancedTree_cast<K_c, V_c>() {
return this.haxe_ds_EnumValueMap_cast<K_c, V_c>();
}
public override int compare(K __temp_k1146, K __temp_k2147) {
object k2 = ((object) (__temp_k2147) );
object k1 = ((object) (__temp_k1146) );
int d = ( global::haxe.root.Type.enumIndex(k1) - global::haxe.root.Type.enumIndex(k2) );
if (( d != 0 )) {
return d;
}
global::haxe.root.Array p1 = global::haxe.root.Type.enumParameters(k1);
global::haxe.root.Array p2 = global::haxe.root.Type.enumParameters(k2);
if (( ( ((int) (global::haxe.lang.Runtime.getField_f(p1, "length", 520590566, true)) ) == 0 ) && ( ((int) (global::haxe.lang.Runtime.getField_f(p2, "length", 520590566, true)) ) == 0 ) )) {
return 0;
}
return this.compareArgs(p1, p2);
}
public virtual int compareArgs(global::haxe.root.Array a1, global::haxe.root.Array a2) {
int ld = ( ((int) (global::haxe.lang.Runtime.getField_f(a1, "length", 520590566, true)) ) - ((int) (global::haxe.lang.Runtime.getField_f(a2, "length", 520590566, true)) ) );
if (( ld != 0 )) {
return ld;
}
{
int _g1 = 0;
int _g = ((int) (global::haxe.lang.Runtime.getField_f(a1, "length", 520590566, true)) );
while (( _g1 < _g )) {
int i = _g1++;
int d = this.compareArg(a1[i], a2[i]);
if (( d != 0 )) {
return d;
}
}
}
return 0;
}
public virtual int compareArg(object v1, object v2) {
if (( global::haxe.root.Reflect.isEnumValue(v1) && global::haxe.root.Reflect.isEnumValue(v2) )) {
return this.compare(global::haxe.lang.Runtime.genericCast<K>(v1), global::haxe.lang.Runtime.genericCast<K>(v2));
}
else if (( ( v1 is global::haxe.root.Array ) && ( v2 is global::haxe.root.Array ) )) {
return this.compareArgs(((global::haxe.root.Array) (v1) ), ((global::haxe.root.Array) (v2) ));
}
else {
return global::haxe.root.Reflect.compare<object>(v1, v2);
}
}
public override object __hx_getField(string field, int hash, bool throwErrors, bool isCheck, bool handleProperties) {
unchecked {
switch (hash) {
case 244830897:
{
return ((global::haxe.lang.Function) (new global::haxe.lang.Closure(this, "compareArg", 244830897)) );
}
case 910198946:
{
return ((global::haxe.lang.Function) (new global::haxe.lang.Closure(this, "compareArgs", 910198946)) );
}
case 57219237:
{
return ((global::haxe.lang.Function) (new global::haxe.lang.Closure(this, "compare", 57219237)) );
}
default:
{
return base.__hx_getField(field, hash, throwErrors, isCheck, handleProperties);
}
}
}
}
public override object __hx_invokeField(string field, int hash, global::haxe.root.Array dynargs) {
unchecked {
switch (hash) {
case 57219237:
{
return global::haxe.lang.Runtime.slowCallField(this, field, dynargs);
}
case 244830897:
{
return this.compareArg(dynargs[0], dynargs[1]);
}
case 910198946:
{
return this.compareArgs(((global::haxe.root.Array) (dynargs[0]) ), ((global::haxe.root.Array) (dynargs[1]) ));
}
default:
{
return base.__hx_invokeField(field, hash, dynargs);
}
}
}
}
}
}
namespace haxe.ds {
[haxe.lang.GenericInterface(typeof(haxe.ds.EnumValueMap<object, object>))]
public interface EnumValueMap : global::haxe.lang.IHxObject, global::haxe.ds.BalancedTree, global::haxe.lang.IGenericObject {
object haxe_ds_EnumValueMap_cast<K_c, V_c>();
object haxe_IMap_cast<K_c, V_c>();
object haxe_ds_BalancedTree_cast<K_c, V_c>();
int compareArgs(global::haxe.root.Array a1, global::haxe.root.Array a2);
int compareArg(object v1, object v2);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.