haxe/src/sys/thread/Deque.cs
// Generated by Haxe 4.3.7
#pragma warning disable 109, 114, 219, 429, 168, 162
namespace sys.thread {
public class Deque<T> : global::haxe.lang.HxObject, global::sys.thread.Deque {
public Deque(global::haxe.lang.EmptyObject empty) {
}
public Deque() {
global::sys.thread.Deque<object>.__hx_ctor_sys_thread_Deque<T>(((global::sys.thread.Deque<T>) (this) ));
}
protected static void __hx_ctor_sys_thread_Deque<T_c>(global::sys.thread.Deque<T_c> __hx_this) {
__hx_this.addEvent = new global::System.Threading.SemaphoreSlim(((int) (0) ), ((int) (2147483647) ));
__hx_this.lockObj = new global::haxe.lang.DynamicObject(new int[]{}, new object[]{}, new int[]{}, new double[]{});
__hx_this.storage = new global::Array<T_c>(new T_c[]{});
{
}
}
public static object __hx_cast<T_c_c>(global::sys.thread.Deque me) {
return ( (( me != null )) ? (me.sys_thread_Deque_cast<T_c_c>()) : default(object) );
}
public virtual object sys_thread_Deque_cast<T_c>() {
if (global::haxe.lang.Runtime.eq(typeof(T), typeof(T_c))) {
return this;
}
global::sys.thread.Deque<T_c> new_me = new global::sys.thread.Deque<T_c>(global::haxe.lang.EmptyObject.EMPTY);
global::Array<string> fields = global::Reflect.fields(this);
int i = 0;
while (( i < fields.length )) {
string field = fields[i++];
global::Reflect.setField(new_me, field, global::Reflect.field(this, field));
}
return new_me;
}
public global::Array<T> storage;
public object lockObj;
public global::System.Threading.SemaphoreSlim addEvent;
public virtual void @add(T i) {
lock(this.lockObj){
this.storage.push(i);
this.addEvent.Release();
}
;
}
public virtual void push(T i) {
lock(this.lockObj){
this.storage.unshift(i);
this.addEvent.Release();
}
;
}
public virtual global::haxe.lang.Null<T> pop(bool block) {
if (block) {
this.addEvent.Wait();
}
else {
if ( ! (this.addEvent.Wait(((int) (0) ))) ) {
return default(global::haxe.lang.Null<T>);
}
}
lock(this.lockObj){
if (( this.storage.length > 0 )) {
return this.storage.shift();
}
}
;
return default(global::haxe.lang.Null<T>);
}
public override double __hx_setField_f(string field, int hash, double @value, bool handleProperties) {
unchecked {
switch (hash) {
case 877441228:
{
this.lockObj = ((object) (@value) );
return @value;
}
default:
{
return base.__hx_setField_f(field, hash, @value, handleProperties);
}
}
}
}
public override object __hx_setField(string field, int hash, object @value, bool handleProperties) {
unchecked {
switch (hash) {
case 1864494649:
{
this.addEvent = ((global::System.Threading.SemaphoreSlim) (@value) );
return @value;
}
case 877441228:
{
this.lockObj = ((object) (@value) );
return @value;
}
case 1151917883:
{
this.storage = ((global::Array<T>) (global::Array<object>.__hx_cast<T>(((global::Array) (@value) ))) );
return @value;
}
default:
{
return base.__hx_setField(field, hash, @value, handleProperties);
}
}
}
}
public override object __hx_getField(string field, int hash, bool throwErrors, bool isCheck, bool handleProperties) {
unchecked {
switch (hash) {
case 5594513:
{
return ((global::haxe.lang.Function) (new global::haxe.lang.Closure(this, "pop", 5594513)) );
}
case 1247875546:
{
return ((global::haxe.lang.Function) (new global::haxe.lang.Closure(this, "push", 1247875546)) );
}
case 4846113:
{
return ((global::haxe.lang.Function) (new global::haxe.lang.Closure(this, "add", 4846113)) );
}
case 1864494649:
{
return this.addEvent;
}
case 877441228:
{
return this.lockObj;
}
case 1151917883:
{
return this.storage;
}
default:
{
return base.__hx_getField(field, hash, throwErrors, isCheck, handleProperties);
}
}
}
}
public override double __hx_getField_f(string field, int hash, bool throwErrors, bool handleProperties) {
unchecked {
switch (hash) {
case 877441228:
{
return ((double) (global::haxe.lang.Runtime.toDouble(this.lockObj)) );
}
default:
{
return base.__hx_getField_f(field, hash, throwErrors, handleProperties);
}
}
}
}
public override object __hx_invokeField(string field, int hash, object[] dynargs) {
unchecked {
switch (hash) {
case 5594513:
{
return (this.pop(global::haxe.lang.Runtime.toBool(dynargs[0]))).toDynamic();
}
case 1247875546:
{
this.push(global::haxe.lang.Runtime.genericCast<T>(dynargs[0]));
break;
}
case 4846113:
{
this.@add(global::haxe.lang.Runtime.genericCast<T>(dynargs[0]));
break;
}
default:
{
return base.__hx_invokeField(field, hash, dynargs);
}
}
return null;
}
}
public override void __hx_getFields(global::Array<string> baseArr) {
baseArr.push("addEvent");
baseArr.push("lockObj");
baseArr.push("storage");
base.__hx_getFields(baseArr);
}
}
}
#pragma warning disable 109, 114, 219, 429, 168, 162
namespace sys.thread {
[global::haxe.lang.GenericInterface(typeof(global::sys.thread.Deque<object>))]
public interface Deque : global::haxe.lang.IHxObject, global::haxe.lang.IGenericObject {
object sys_thread_Deque_cast<T_c>();
}
}