/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (https://www.swig.org).
* Version 4.3.1
*
* Do not make changes to this file unless you know what you are doing - modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.inscoper.api;
import com.inscoper.api.logging.*;
public class UShortESubDeviceStatusMap extends java.util.AbstractMap<Integer, ESubDeviceStatus> {
private transient long swigCPtr;
protected transient boolean swigCMemOwn;
protected UShortESubDeviceStatusMap(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = cPtr;
}
protected static long getCPtr(UShortESubDeviceStatusMap obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
protected static long swigRelease(UShortESubDeviceStatusMap obj) {
long ptr = 0;
if (obj != null) {
if (!obj.swigCMemOwn)
throw new RuntimeException("Cannot release ownership as memory is not owned");
ptr = obj.swigCPtr;
obj.swigCMemOwn = false;
obj.delete();
}
return ptr;
}
@SuppressWarnings({"deprecation", "removal"})
protected void finalize() {
delete();
}
public synchronized void delete() {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
InscoperJNI.delete_UShortESubDeviceStatusMap(swigCPtr);
}
swigCPtr = 0;
}
}
@Override
public int size() {
return sizeImpl();
}
@Override
public boolean isEmpty() {
return empty();
}
@Override
public void clear() {
doClear();
}
@Override
public boolean containsKey(java.lang.Object key) {
if (!(key instanceof Integer)) {
return false;
}
return containsImpl((Integer)key);
}
@Override
public ESubDeviceStatus get(java.lang.Object key) {
if (!(key instanceof Integer)) {
return null;
}
Iterator itr = find((Integer) key);
if (itr.isNot(end())) {
return itr.getValue();
}
return null;
}
@Override
public ESubDeviceStatus put(Integer key, ESubDeviceStatus value) {
Iterator itr = find(key);
if (itr.isNot(end())) {
ESubDeviceStatus oldValue = itr.getValue();
itr.setValue(value);
return oldValue;
} else {
putUnchecked(key, value);
return null;
}
}
@Override
public ESubDeviceStatus remove(java.lang.Object key) {
if (!(key instanceof Integer)) {
return null;
}
Iterator itr = find((Integer) key);
if (itr.isNot(end())) {
ESubDeviceStatus oldValue = itr.getValue();
removeUnchecked(itr);
return oldValue;
} else {
return null;
}
}
@Override
public java.util.Set<Entry<Integer, ESubDeviceStatus>> entrySet() {
java.util.Set<Entry<Integer, ESubDeviceStatus>> setToReturn =
new java.util.HashSet<>();
Iterator itr = begin();
final Iterator end = end();
while (itr.isNot(end)) {
setToReturn.add(new Entry<Integer, ESubDeviceStatus>() {
private Iterator iterator;
private Entry<Integer, ESubDeviceStatus> init(Iterator iterator) {
this.iterator = iterator;
return this;
}
@Override
public Integer getKey() {
return iterator.getKey();
}
@Override
public ESubDeviceStatus getValue() {
return iterator.getValue();
}
@Override
public ESubDeviceStatus setValue(ESubDeviceStatus newValue) {
ESubDeviceStatus oldValue = iterator.getValue();
iterator.setValue(newValue);
return oldValue;
}
}.init(itr));
itr = itr.getNextUnchecked();
}
return setToReturn;
}
public UShortESubDeviceStatusMap() {
this(InscoperJNI.new_UShortESubDeviceStatusMap__SWIG_0(), true);
}
public UShortESubDeviceStatusMap(UShortESubDeviceStatusMap other) {
this(InscoperJNI.new_UShortESubDeviceStatusMap__SWIG_1(UShortESubDeviceStatusMap.getCPtr(other), other), true);
}
static protected class Iterator {
private transient long swigCPtr;
protected transient boolean swigCMemOwn;
protected Iterator(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = cPtr;
}
protected static long getCPtr(Iterator obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
protected static long swigRelease(Iterator obj) {
long ptr = 0;
if (obj != null) {
if (!obj.swigCMemOwn)
throw new RuntimeException("Cannot release ownership as memory is not owned");
ptr = obj.swigCPtr;
obj.swigCMemOwn = false;
obj.delete();
}
return ptr;
}
@SuppressWarnings({"deprecation", "removal"})
protected void finalize() {
delete();
}
public synchronized void delete() {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
InscoperJNI.delete_UShortESubDeviceStatusMap_Iterator(swigCPtr);
}
swigCPtr = 0;
}
}
private UShortESubDeviceStatusMap.Iterator getNextUnchecked() {
return new UShortESubDeviceStatusMap.Iterator(InscoperJNI.UShortESubDeviceStatusMap_Iterator_getNextUnchecked(swigCPtr, this), true);
}
private boolean isNot(UShortESubDeviceStatusMap.Iterator other) {
return InscoperJNI.UShortESubDeviceStatusMap_Iterator_isNot(swigCPtr, this, UShortESubDeviceStatusMap.Iterator.getCPtr(other), other);
}
private int getKey() {
return InscoperJNI.UShortESubDeviceStatusMap_Iterator_getKey(swigCPtr, this);
}
private ESubDeviceStatus getValue() {
return ESubDeviceStatus.swigToEnum(InscoperJNI.UShortESubDeviceStatusMap_Iterator_getValue(swigCPtr, this));
}
private void setValue(ESubDeviceStatus newValue) {
InscoperJNI.UShortESubDeviceStatusMap_Iterator_setValue(swigCPtr, this, newValue.swigValue());
}
}
private boolean empty() {
return InscoperJNI.UShortESubDeviceStatusMap_empty(swigCPtr, this);
}
private void doClear() {
InscoperJNI.UShortESubDeviceStatusMap_doClear(swigCPtr, this);
}
private UShortESubDeviceStatusMap.Iterator find(int key) {
return new UShortESubDeviceStatusMap.Iterator(InscoperJNI.UShortESubDeviceStatusMap_find(swigCPtr, this, key), true);
}
private UShortESubDeviceStatusMap.Iterator begin() {
return new UShortESubDeviceStatusMap.Iterator(InscoperJNI.UShortESubDeviceStatusMap_begin(swigCPtr, this), true);
}
private UShortESubDeviceStatusMap.Iterator end() {
return new UShortESubDeviceStatusMap.Iterator(InscoperJNI.UShortESubDeviceStatusMap_end(swigCPtr, this), true);
}
private int sizeImpl() {
return InscoperJNI.UShortESubDeviceStatusMap_sizeImpl(swigCPtr, this);
}
private boolean containsImpl(int key) {
return InscoperJNI.UShortESubDeviceStatusMap_containsImpl(swigCPtr, this, key);
}
private void putUnchecked(int key, ESubDeviceStatus value) {
InscoperJNI.UShortESubDeviceStatusMap_putUnchecked(swigCPtr, this, key, value.swigValue());
}
private void removeUnchecked(UShortESubDeviceStatusMap.Iterator itr) {
InscoperJNI.UShortESubDeviceStatusMap_removeUnchecked(swigCPtr, this, UShortESubDeviceStatusMap.Iterator.getCPtr(itr), itr);
}
}