package xapi.collect.impl;

import xapi.annotation.inject.InstanceDefault;
import xapi.collect.api.StringTo;
import xapi.fu.itr.MappedIterable;
import xapi.fu.Out2;
import xapi.fu.itr.SizedIterable;
import xapi.fu.itr.SizedIterator;
import xapi.platform.GwtDevPlatform;
import xapi.platform.JrePlatform;
import xapi.util.X_Runtime;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;

@JrePlatform
@GwtDevPlatform
@InstanceDefault(implFor = StringTo.class)
public class StringToAbstract<V> implements StringTo<V> {

    private static final long serialVersionUID = 7743120861632536635L;

    private final java.util.Map<String, V> map;

    private final Class<V> valueType;

    public StringToAbstract(Class<V> valueType) {
        this.valueType = valueType;
        if (isMultithreaded()) {
            map = new ConcurrentHashMap<>();
        } else {
            map = new HashMap<>();
        }
    }

    public <Generic extends V> StringToAbstract(Class<Generic> valueType, final Map<String, V> map) {
        this.valueType = Class.class.cast(valueType);
        this.map = map;
    }

    protected boolean isMultithreaded() {
        return X_Runtime.isMultithreaded();
    }

    @Override
    public SizedIterator<Out2<String, V>> iterator() {
        final MappedIterable<Entry<String, V>> entries = MappedIterable.mapped(entries());
        return SizedIterator.of(this::size, entries.map(Out2::fromEntry).iterator());
    }

    @Override
    public boolean isEmpty() {
        return map.isEmpty();
    }

    @Override
    public void clear() {
        map.clear();
    }

    @Override
    public final boolean containsKey(final Object key) {
        return has((String) key);
    }

    public boolean has(String key) {
        return map.containsKey(key);
    }

    @Override
    public boolean containsValue(final Object key) {
        return map.containsValue(key);
    }

    @Override
    @SuppressWarnings({ "unchecked", "rawtypes" })
    public void putEntries(final Iterable<java.util.Map.Entry<String, V>> items) {
        if (items instanceof java.util.Map) {
            map.putAll((java.util.Map) items);
        } else {
            for (final java.util.Map.Entry<String, V> item : items) {
                map.put(item.getKey(), item.getValue());
            }
        }
    }

    @Override
    public void addAll(Iterable<Out2<String, V>> items) {
        for (final Out2<String, V> item : items) {
            map.put(item.out1(), item.out2());
        }
    }

    @Override
    public void removeAll(final Iterable<String> items) {
        for (final String item : items) {
            map.remove(item);
        }
    }

    @Override
    public SizedIterable<String> keys() {
        return SizedIterable.of(this::size, map.keySet());
    }

    @Override
    public String[] keyArray() {
        return map.keySet().toArray(new String[0]);
    }

    @Override
    public Iterable<V> values() {
        return map.values();
    }

    @Override
    public Class<String> keyType() {
        return String.class;
    }

    @Override
    public Class<V> valueType() {
        retu

    }

    @Override
    public Iterable<java.util.Map.Entry<String, V>> entries() {
        return map.entrySet();
    }

    @Override
    public V get(final String key) {
        return map.get(key);
    }

    @Override
    public V put(final String key, final V value) {
        if (value == null) {
            return map.remove(key);
        } else {
            return map.put(key, value);
        }
    }

    @Override
    public V remove(final String key) {
        return map.remove(key);
    }

    @Override
    public int size() {
        return map.size();
    }

    @Override
    public String toString() {
        return forEachItem().join(o -> o.join(" = "), "\n");
    }

    protected Collection<V> valueSet() {
        return map.values();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;
        final StringToAbstract<?> that = (StringToAbstract<?>) o;
        if (!map.equals(that.map))
            return false;
        return valueType != null ? valueType.equals(that.valueType) : that.valueType == null;
    }

    @Override
    public int hashCode() {
        int result = map.hashCode();
        result = 31 * result + (valueType != null ? valueType.hashCode() : 0);
        return result;
    }
}


if (items instanceof java.util.Map) {
            map.putAll((java.util.Map) items);
        } else {
            for (final java.util.Map.Entry<String, V> item : items) {
                map.put(item.getKey(), item.getValue());
            }
        }

package xapi.collect.impl;

import xapi.annotation.inject.InstanceDefault;
import xapi.collect.api.StringTo;
import xapi.fu.itr.MappedIterable;
import xapi.fu.Out2;
import xapi.fu.itr.SizedIterable;
import xapi.fu.itr.SizedIterator;
import xapi.platform.GwtDevPlatform;
import xapi.platform.JrePlatform;
import xapi.util.X_Runtime;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;

@JrePlatform
@GwtDevPlatform
@InstanceDefault(implFor = StringTo.class)
public class StringToAbstract<V> implements StringTo<V> {

    private static final long serialVersionUID = 7743120861632536635L;

    private final java.util.Map<String, V> map;

    private final Class<V> valueType;

    public StringToAbstract(Class<V> valueType) {
        this.valueType = valueType;
        if (isMultithreaded()) {
            map = new ConcurrentHashMap<>();
        } else {
            map = new HashMap<>();
        }
    }

    public <Generic extends V> StringToAbstract(Class<Generic> valueType, final Map<String, V> map) {
        this.valueType = Class.class.cast(valueType);
        this.map = map;
    }

    protected boolean isMultithreaded() {
        return X_Runtime.isMultithreaded();
    }

    @Override
    public SizedIterator<Out2<String, V>> iterator() {
        final MappedIterable<Entry<String, V>> entries = MappedIterable.mapped(entries());
        return SizedIterator.of(this::size, entries.map(Out2::fromEntry).iterator());
    }

    @Override
    public boolean isEmpty() {
        return map.isEmpty();
    }

    @Override
    public void clear() {
        map.clear();
    }

    @Override
    public final boolean containsKey(final Object key) {
        return has((String) key);
    }

    public boolean has(String key) {
        return map.containsKey(key);
    }

    @Override
    public boolean containsValue(final Object key) {
        return map.containsValue(key);
    }

    @Override
    @SuppressWarnings({ "unchecked", "rawtypes" })
    public void putEntries(final Iterable<java.util.Map.Entry<String, V>> items) {

    }

    @Override
    public void addAll(Iterable<Out2<String, V>> items) {
        for (final Out2<String, V> item : items) {
            map.put(item.out1(), item.out2());
        }
    }

    @Override
    public void removeAll(final Iterable<String> items) {
        for (final String item : items) {
            map.remove(item);
        }
    }

    @Override
    public SizedIterable<String> keys() {
        return SizedIterable.of(this::size, map.keySet());
    }

    @Override
    public String[] keyArray() {
        return map.keySet().toArray(new String[0]);
    }

    @Override
    public Iterable<V> values() {
        return map.values();
    }

    @Override
    public Class<String> keyType() {
        return String.class;
    }

    @Override
    public Class<V> valueType() {
        return valueType;
    }

    @Override
    public Iterable<java.util.Map.Entry<String, V>> entries() {
        return map.entrySet();
    }

    @Override
    public V get(final String key) {
        return map.get(key);
    }

    @Override
    public V put(final String key, final V value) {
        if (value == null) {
            return map.remove(key);
        } else {
            return map.put(key, value);
        }
    }

    @Override
    public V remove(final String key) {
        return map.remove(key);
    }

    @Override
    public int size() {
        return map.size();
    }

    @Override
    public String toString() {
        return forEachItem().join(o -> o.join(" = "), "\n");
    }

    protected Collection<V> valueSet() {
        return map.values();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;
        final StringToAbstract<?> that = (StringToAbstract<?>) o;
        if (!map.equals(that.map))
            return false;
        return valueType != null ? valueType.equals(that.valueType) : that.valueType == null;
    }

    @Override
    public int hashCode() {
        int result = map.hashCode();
        result = 31 * result + (valueType != null ? valueType.hashCode() : 0);
        return result;
    }
}


private static INfcVzw getServiceInterface()

package com.vzw.nfc;

import android.nfc.INfcAdapter.Stub;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.Log;
import com.nxp.nfc.INfcVzw;
import com.nxp.nfc.INxpNfcAdapter;
import com.vzw.nfc.dos.AidMaskDo;
import com.vzw.nfc.dos.AidRangeDo;
import com.vzw.nfc.dos.ClfFilterDo;
import com.vzw.nfc.dos.ClfFilterDoList;
import com.vzw.nfc.dos.DoParserException;
import com.vzw.nfc.dos.FilterConditionTagDo;
import com.vzw.nfc.dos.FilterEntryDo;
import java.util.ArrayList;
import java.util.Iterator;

public final class AidFilter {

    private static INfcVzw sVzwNfcAdapter;

    public final int DEFAULT_ROUTE_LOCATION = 2;

    public boolean setFilterList(byte[] filterList) {
        boolean status = true;
        ClfFilterDoList allClfFilterDo = new ClfFilterDoList(filterList, 0, filterList.length);
        try {
            allClfFilterDo.translate();
            ArrayList<RouteEntry> entries = new ArrayList();
            prepareRouteInfo(allClfFilterDo, entries);
            if (getServiceInterface() != null) {
                try {
                    status = getServiceInterface().setVzwAidList((RouteEntry[]) entries.toArray(new RouteEntry[entries.size()]));
                } catch (RemoteException e) {
                    status = false;
                }
            }
            return status;
        } catch (DoParserException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean enableFilterCondition(byte filterConditionTag) {
        if (getServiceInterface() == null || FilterConditionTagDo.SCREEN_OFF_TAG != filterConditionTag) {
            return true;
        }
        try {
            getServiceInterface().setScreenOffCondition(true);
            return true;
        } catch (RemoteException e) {
            return false;
        }
    }

    public boolean disableFilterCondition(byte filterConditionTag) {
        if (getServiceInterface() == null || FilterConditionTagDo.SCREEN_OFF_TAG != filterConditionTag) {
            return true;
        }
        try {
            getServiceInterface().setScreenOffCondition(false);
            return true;
        } catch (RemoteException e) {
            return false;
        }
    }

    private void prepareRouteInfo(ClfFilterDoList allClfFilterDo, ArrayList<RouteEntry> entries) {
        Iterator it = allClfFilterDo.getClfFilterDos().iterator();
        while (it.hasNext()) {
            ClfFilterDo clfDoFilter = (ClfFilterDo) it.next();
            byte[] aid = getAid(clfDoFilter.getFilterEntryDo().getAidRangeDo(), clfDoFilter.getFilterEntryDo().getAidMaskDo());
            int powerState = getPowerState(clfDoFilter.getFilterEntryDo());
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append("prepareRouteInfo powerState");
            stringBuilder.append(powerState);
            Log.d("AidFilter", stringBuilder.toString());
            entries.add(new RouteEntry(aid, powerState, 2, clfDoFilter.getFilterEntryDo().getVzwArDo().isVzwAllowed()));
        }
    }

    private byte[] getAid(AidRangeDo aid_range, AidMaskDo aid_mask) {
        byte[] barr_aid_mask = aid_mask.getAidMask();
        int count = 0;
        while (count < barr_aid_mask.length && barr_aid_mask[count] == (byte) -1) {
            count++;
        }
        if (count == 0) {
            return null;
        }
        byte[] aid = new byte[count];
        System.arraycopy(aid_range.getAidRange(), 0, aid, 0, count);
        return aid;
    }

    private int getPowerState(FilterEntryDo filter_entry_do) {
        int powerState = 0;
        int routeInfo = filter_entry_do.getRoutingModeDo().getRoutingInfo();
        FilterConditionTagDo conditionTagDo = filter_entry_do.getFilterConditionTagDo();
        if (conditionTagDo != null && conditionTagDo.getFilterConditionTag() == FilterConditionTagDo.SCREEN_OFF_TAG) {
            powerState = 1;
        } else if (routeInfo != 0) {
            powerState = ((((routeInfo & 1) << 2) | (routeInfo & 2)) | ((routeInfo & 4) >> 2)) | 128;
        }
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("getPowerState");
        stringBuilder.append(powerState);
        Log.d("AidFilter", stringBuilder.toString());
        return powerState;
    }

{
        if (sVzwNfcAdapter != null) {
            return sVzwNfcAdapter;
        }
        IBinder b = ServiceManager.getService("nfc");
        if (b == null) {
            return null;
        }
        try {
            IBinder b2 = Stub.asInterface(b).getNfcAdapterVendorInterface("nxp");
            if (b2 == null) {
                return null;
            }
            sVzwNfcAdapter = INxpNfcAdapter.Stub.asInterface(b2).getNfcVzwInterface();
            return sVzwNfcAdapter;
        } catch (Exception e) {
            throw new UnsupportedOperationException();
        }
    }
}


{
        byte[] barr_aid_mask = aid_mask.getAidMask();
        int count = 0;
        while (count < barr_aid_mask.length && barr_aid_mask[count] == (byte) -1) {
            count++;
        }
        if (count == 0) {
            return null;
        }
        byte[] aid = new byte[count];
        System.arraycopy(aid_range.getAidRange(), 0, aid, 0, count);
        return aid;
    }

package com.vzw.nfc;

import android.nfc.INfcAdapter.Stub;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.Log;
import com.nxp.nfc.INfcVzw;
import com.nxp.nfc.INxpNfcAdapter;
import com.vzw.nfc.dos.AidMaskDo;
import com.vzw.nfc.dos.AidRangeDo;
import com.vzw.nfc.dos.ClfFilterDo;
import com.vzw.nfc.dos.ClfFilterDoList;
import com.vzw.nfc.dos.DoParserException;
import com.vzw.nfc.dos.FilterConditionTagDo;
import com.vzw.nfc.dos.FilterEntryDo;
import java.util.ArrayList;
import java.util.Iterator;

public final class AidFilter {

    private static INfcVzw sVzwNfcAdapter;

    public final int DEFAULT_ROUTE_LOCATION = 2;

    public boolean setFilterList(byte[] filterList) {
        boolean status = true;
        ClfFilterDoList allClfFilterDo = new ClfFilterDoList(filterList, 0, filterList.length);
        try {
            allClfFilterDo.translate();
            ArrayList<RouteEntry> entries = new ArrayList();
            prepareRouteInfo(allClfFilterDo, entries);
            if (getServiceInterface() != null) {
                try {
                    status = getServiceInterface().setVzwAidList((RouteEntry[]) entries.toArray(new RouteEntry[entries.size()]));
                } catch (RemoteException e) {
                    status = false;
                }
            }
            return status;
        } catch (DoParserException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean enableFilterCondition(byte filterConditionTag) {
        if (getServiceInterface() == null || FilterConditionTagDo.SCREEN_OFF_TAG != filterConditionTag) {
            return true;
        }
        try {
            getServiceInterface().setScreenOffCondition(true);
            return true;
        } catch (RemoteException e) {
            return false;
        }
    }

    public boolean disableFilterCondition(byte filterConditionTag) {
        if (getServiceInterface() == null || FilterConditionTagDo.SCREEN_OFF_TAG != filterConditionTag) {
            return true;
        }
        try {
            getServiceInterface().setScreenOffCondition(false);
            return true;
        } catch (RemoteException e) {
            return false;
        }
    }

    private void prepareRouteInfo(ClfFilterDoList allClfFilterDo, ArrayList<RouteEntry> entries) {
        Iterator it = allClfFilterDo.getClfFilterDos().iterator();
        while (it.hasNext()) {
            ClfFilterDo clfDoFilter = (ClfFilterDo) it.next();
            byte[] aid = getAid(clfDoFilter.getFilterEntryDo().getAidRangeDo(), clfDoFilter.getFilterEntryDo().getAidMaskDo());
            int powerState = getPowerState(clfDoFilter.getFilterEntryDo());
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append("prepareRouteInfo powerState");
            stringBuilder.append(powerState);
            Log.d("AidFilter", stringBuilder.toString());
            entries.add(new RouteEntry(aid, powerState, 2, clfDoFilter.getFilterEntryDo().getVzwArDo().isVzwAllowed()));
        }
    }

    private byte[] getAid(AidRangeDo aid_range, AidMaskDo aid_mask)

    private int getPowerState(FilterEntryDo filter_entry_do) {
        int powerState = 0;
        int routeInfo = filter_entry_do.getRoutingModeDo().getRoutingInfo();
        FilterConditionTagDo conditionTagDo = filter_entry_do.getFilterConditionTagDo();
        if (conditionTagDo != null && conditionTagDo.getFilterConditionTag() == FilterConditionTagDo.SCREEN_OFF_TAG) {
            powerState = 1;
        } else if (routeInfo != 0) {
            powerState = ((((routeInfo & 1) << 2) | (routeInfo & 2)) | ((routeInfo & 4) >> 2)) | 128;
        }
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("getPowerState");
        stringBuilder.append(powerState);
        Log.d("AidFilter", stringBuilder.toString());
        return powerState;
    }

    private static INfcVzw getServiceInterface() {
        if (sVzwNfcAdapter != null) {
            return sVzwNfcAdapter;
        }
        IBinder b = ServiceManager.getService("nfc");
        if (b == null) {
            return null;
        }
        try {
            IBinder b2 = Stub.asInterface(b).getNfcAdapterVendorInterface("nxp");
            if (b2 == null) {
                return null;
            }
            sVzwNfcAdapter = INxpNfcAdapter.Stub.asInterface(b2).getNfcVzwInterface();
            return sVzwNfcAdapter;
        } catch (Exception e) {
            throw new UnsupportedOperationException();
        }
    }
}


Iterator it = allClfFilterDo.getClfFilterDos().iterator();

package com.vzw.nfc;

import android.nfc.INfcAdapter.Stub;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.Log;
import com.nxp.nfc.INfcVzw;
import com.nxp.nfc.INxpNfcAdapter;
import com.vzw.nfc.dos.AidMaskDo;
import com.vzw.nfc.dos.AidRangeDo;
import com.vzw.nfc.dos.ClfFilterDo;
import com.vzw.nfc.dos.ClfFilterDoList;
import com.vzw.nfc.dos.DoParserException;
import com.vzw.nfc.dos.FilterConditionTagDo;
import com.vzw.nfc.dos.FilterEntryDo;
import java.util.ArrayList;
import java.util.Iterator;

public final class AidFilter {

    private static INfcVzw sVzwNfcAdapter;

    public final int DEFAULT_ROUTE_LOCATION = 2;

    public boolean setFilterList(byte[] filterList) {
        boolean status = true;
        ClfFilterDoList allClfFilterDo = new ClfFilterDoList(filterList, 0, filterList.length);
        try {
            allClfFilterDo.translate();
            ArrayList<RouteEntry> entries = new ArrayList();
            prepareRouteInfo(allClfFilterDo, entries);
            if (getServiceInterface() != null) {
                try {
                    status = getServiceInterface().setVzwAidList((RouteEntry[]) entries.toArray(new RouteEntry[entries.size()]));
                } catch (RemoteException e) {
                    status = false;
                }
            }
            return status;
        } catch (DoParserException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean enableFilterCondition(byte filterConditionTag) {
        if (getServiceInterface() == null || FilterConditionTagDo.SCREEN_OFF_TAG != filterConditionTag) {
            return true;
        }
        try {
            getServiceInterface().setScreenOffCondition(true);
            return true;
        } catch (RemoteException e) {
            return false;
        }
    }

    public boolean disableFilterCondition(byte filterConditionTag) {
        if (getServiceInterface() == null || FilterConditionTagDo.SCREEN_OFF_TAG != filterConditionTag) {
            return true;
        }
        try {
            getServiceInterface().setScreenOffCondition(false);
            return true;
        } catch (RemoteException e) {
            return false;
        }
    }

    private void prepareRouteInfo(ClfFilterDoList allClfFilterDo, ArrayList<RouteEntry> entries) {

        while (it.hasNext()) {
            ClfFilterDo clfDoFilter = (ClfFilterDo) it.next();
            byte[] aid = getAid(clfDoFilter.getFilterEntryDo().getAidRangeDo(), clfDoFilter.getFilterEntryDo().getAidMaskDo());
            int powerState = getPowerState(clfDoFilter.getFilterEntryDo());
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append("prepareRouteInfo powerState");
            stringBuilder.append(powerState);
            Log.d("AidFilter", stringBuilder.toString());
            entries.add(new RouteEntry(aid, powerState, 2, clfDoFilter.getFilterEntryDo().getVzwArDo().isVzwAllowed()));
        }
    }

    private byte[] getAid(AidRangeDo aid_range, AidMaskDo aid_mask) {
        byte[] barr_aid_mask = aid_mask.getAidMask();
        int count = 0;
        while (count < barr_aid_mask.length && barr_aid_mask[count] == (byte) -1) {
            count++;
        }
        if (count == 0) {
            return null;
        }
        byte[] aid = new byte[count];
        System.arraycopy(aid_range.getAidRange(), 0, aid, 0, count);
        return aid;
    }

    private int getPowerState(FilterEntryDo filter_entry_do) {
        int powerState = 0;
        int routeInfo = filter_entry_do.getRoutingModeDo().getRoutingInfo();
        FilterConditionTagDo conditionTagDo = filter_entry_do.getFilterConditionTagDo();
        if (conditionTagDo != null && conditionTagDo.getFilterConditionTag() == FilterConditionTagDo.SCREEN_OFF_TAG) {
            powerState = 1;
        } else if (routeInfo != 0) {
            powerState = ((((routeInfo & 1) << 2) | (routeInfo & 2)) | ((routeInfo & 4) >> 2)) | 128;
        }
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("getPowerState");
        stringBuilder.append(powerState);
        Log.d("AidFilter", stringBuilder.toString());
        return powerState;
    }

    private static INfcVzw getServiceInterface() {
        if (sVzwNfcAdapter != null) {
            return sVzwNfcAdapter;
        }
        IBinder b = ServiceManager.getService("nfc");
        if (b == null) {
            return null;
        }
        try {
            IBinder b2 = Stub.asInterface(b).getNfcAdapterVendorInterface("nxp");
            if (b2 == null) {
                return null;
            }
            sVzwNfcAdapter = INxpNfcAdapter.Stub.asInterface(b2).getNfcVzwInterface();
            return sVzwNfcAdapter;
        } catch (Exception e) {
            throw new UnsupportedOperationException();
        }
    }
}


while (it.hasNext()) {
            ClfFilterDo clfDoFilter = (ClfFilterDo) it.next();
            byte[] aid = getAid(clfDoFilter.getFilterEntryDo().getAidRangeDo(), clfDoFilter.getFilterEntryDo().getAidMaskDo());
            int powerState = getPowerState(clfDoFilter.getFilterEntryDo());
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append("prepareRouteInfo powerState");
            stringBuilder.append(powerState);
            Log.d("AidFilter", stringBuilder.toString());
            entries.add(new RouteEntry(aid, powerState, 2, clfDoFilter.getFilterEntryDo().getVzwArDo().isVzwAllowed()));
        }

package com.vzw.nfc;

import android.nfc.INfcAdapter.Stub;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.Log;
import com.nxp.nfc.INfcVzw;
import com.nxp.nfc.INxpNfcAdapter;
import com.vzw.nfc.dos.AidMaskDo;
import com.vzw.nfc.dos.AidRangeDo;
import com.vzw.nfc.dos.ClfFilterDo;
import com.vzw.nfc.dos.ClfFilterDoList;
import com.vzw.nfc.dos.DoParserException;
import com.vzw.nfc.dos.FilterConditionTagDo;
import com.vzw.nfc.dos.FilterEntryDo;
import java.util.ArrayList;
import java.util.Iterator;

public final class AidFilter {

    private static INfcVzw sVzwNfcAdapter;

    public final int DEFAULT_ROUTE_LOCATION = 2;

    public boolean setFilterList(byte[] filterList) {
        boolean status = true;
        ClfFilterDoList allClfFilterDo = new ClfFilterDoList(filterList, 0, filterList.length);
        try {
            allClfFilterDo.translate();
            ArrayList<RouteEntry> entries = new ArrayList();
            prepareRouteInfo(allClfFilterDo, entries);
            if (getServiceInterface() != null) {
                try {
                    status = getServiceInterface().setVzwAidList((RouteEntry[]) entries.toArray(new RouteEntry[entries.size()]));
                } catch (RemoteException e) {
                    status = false;
                }
            }
            return status;
        } catch (DoParserException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean enableFilterCondition(byte filterConditionTag) {
        if (getServiceInterface() == null || FilterConditionTagDo.SCREEN_OFF_TAG != filterConditionTag) {
            return true;
        }
        try {
            getServiceInterface().setScreenOffCondition(true);
            return true;
        } catch (RemoteException e) {
            return false;
        }
    }

    public boolean disableFilterCondition(byte filterConditionTag) {
        if (getServiceInterface() == null || FilterConditionTagDo.SCREEN_OFF_TAG != filterConditionTag) {
            return true;
        }
        try {
            getServiceInterface().setScreenOffCondition(false);
            return true;
        } catch (RemoteException e) {
            return false;
        }
    }

    private void prepareRouteInfo(ClfFilterDoList allClfFilterDo, ArrayList<RouteEntry> entries) {
        Iterator it = allClfFilterDo.getClfFilterDos().iterator();

    }

    private byte[] getAid(AidRangeDo aid_range, AidMaskDo aid_mask) {
        byte[] barr_aid_mask = aid_mask.getAidMask();
        int count = 0;
        while (count < barr_aid_mask.length && barr_aid_mask[count] == (byte) -1) {
            count++;
        }
        if (count == 0) {
            return null;
        }
        byte[] aid = new byte[count];
        System.arraycopy(aid_range.getAidRange(), 0, aid, 0, count);
        return aid;
    }

    private int getPowerState(FilterEntryDo filter_entry_do) {
        int powerState = 0;
        int routeInfo = filter_entry_do.getRoutingModeDo().getRoutingInfo();
        FilterConditionTagDo conditionTagDo = filter_entry_do.getFilterConditionTagDo();
        if (conditionTagDo != null && conditionTagDo.getFilterConditionTag() == FilterConditionTagDo.SCREEN_OFF_TAG) {
            powerState = 1;
        } else if (routeInfo != 0) {
            powerState = ((((routeInfo & 1) << 2) | (routeInfo & 2)) | ((routeInfo & 4) >> 2)) | 128;
        }
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("getPowerState");
        stringBuilder.append(powerState);
        Log.d("AidFilter", stringBuilder.toString());
        return powerState;
    }

    private static INfcVzw getServiceInterface() {
        if (sVzwNfcAdapter != null) {
            return sVzwNfcAdapter;
        }
        IBinder b = ServiceManager.getService("nfc");
        if (b == null) {
            return null;
        }
        try {
            IBinder b2 = Stub.asInterface(b).getNfcAdapterVendorInterface("nxp");
            if (b2 == null) {
                return null;
            }
            sVzwNfcAdapter = INxpNfcAdapter.Stub.asInterface(b2).getNfcVzwInterface();
            return sVzwNfcAdapter;
        } catch (Exception e) {
            throw new UnsupportedOperationException();
        }
    }
}


package com.vzw.nfc;

import android.nfc.INfcAdapter.Stub;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.Log;
import com.nxp.nfc.INfcVzw;
import com.nxp.nfc.INxpNfcAdapter;
import com.vzw.nfc.dos.AidMaskDo;
import com.vzw.nfc.dos.AidRangeDo;
import com.vzw.nfc.dos.ClfFilterDo;
import com.vzw.nfc.dos.ClfFilterDoList;
import com.vzw.nfc.dos.DoParserException;
import com.vzw.nfc.dos.FilterConditionTagDo;
import com.vzw.nfc.dos.FilterEntryDo;
import java.util.ArrayList;
import java.util.Iterator;

public final class AidFilter {

    private static INfcVzw sVzwNfcAdapter;

    public final int DEFAULT_ROUTE_LOCATION = 2;

    public boolean setFilterList(byte[] filterList) {
        boolean status = true;
        ClfFilterDoList allClfFilterDo = new ClfFilterDoList(filterList, 0, filterList.length);
        try {
            allClfFilterDo.translate();
            ArrayList<RouteEntry> entries = new ArrayList();
            prepareRouteInfo(allClfFilterDo, entries);
            if (getServiceInterface() != null) {
                try {
                    status = getServiceInterface().setVzwAidList((RouteEntry[]) entries.toArray(new RouteEntry[entries.size()]));
                } catch (RemoteException e) {
                    status = false;
                }
            }
            return status;
        } catch (DoParserException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean enableFilterCondition(byte filterConditionTag) {
        if (getServiceInterface() == null || FilterConditionTagDo.SCREEN_OFF_TAG != filterConditionTag) {
            return true;
        }
        try {
            getServiceInterface().setScreenOffCondition(true);
            return true;
        } catch (RemoteException e) {
            return false;
        }
    }

    public boolean disableFilterCondition(byte filterConditionTag) {
        if (getServiceInterface() == null || FilterConditionTagDo.SCREEN_OFF_TAG != filterConditionTag) {
            return true;
        }
        try {
            getServiceInterface().setScreenOffCondition(false);
            return true;
        } catch (RemoteException e) {
            return false;
        }
    }

    private void prepareRouteInfo(ClfFilterDoList allClfFilterDo, ArrayList<RouteEntry> entries) {
        Iterator it = allClfFilterDo.getClfFilterDos().iterator();
        while (it.hasNext()) {
            ClfFilterDo clfDoFilter = (ClfFilterDo) it.next();
            byte[] aid = getAid(clfDoFilter.getFilterEntryDo().getAidRangeDo(), clfDoFilter.getFilterEntryDo().getAidMaskDo());
            int powerState = getPowerState(clfDoFilter.getFilterEntryDo());
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append("prepareRouteInfo powerState");
            stringBuilder.append(powerState);
            Log.d("AidFilter", stringBuilder.toString());
            entries.add(new RouteEntry(aid, powerState, 2, clfDoFilter.getFilterEntryDo().getVzwArDo().isVzwAllowed()));
        }

    private byte[] getAid(AidRangeDo aid_range, AidMaskDo aid_mask) {
        byte[] barr_aid_mask = aid_mask.getAidMask();
        int count = 0;
        while (count < barr_aid_mask.length && barr_aid_mask[count] == (byte) -1) {
            count++;
        }
        if (count == 0) {
            return null;
        }
        byte[] aid = new byte[count];
        System.arraycopy(aid_range.getAidRange(), 0, aid, 0, count);
        return aid;
    }

    private int getPowerState(FilterEntryDo filter_entry_do) {
        int powerState = 0;
        int routeInfo = filter_entry_do.getRoutingModeDo().getRoutingInfo();
        FilterConditionTagDo conditionTagDo = filter_entry_do.getFilterConditionTagDo();
        if (conditionTagDo != null && conditionTagDo.getFilterConditionTag() == FilterConditionTagDo.SCREEN_OFF_TAG) {
            powerState = 1;
        } else if (routeInfo != 0) {
            powerState = ((((routeInfo & 1) << 2) | (routeInfo & 2)) | ((routeInfo & 4) >> 2)) | 128;
        }
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("getPowerState");
        stringBuilder.append(powerState);
        Log.d("AidFilter", stringBuilder.toString());
        return powerState;
    }

    private static INfcVzw getServiceInterface() {
        if (sVzwNfcAdapter != null) {
            return sVzwNfcAdapter;
        }
        IBinder b = ServiceManager.getService("nfc");
        if (b == null) {
            return null;
        }
        try {
            IBinder b2 = Stub.asInterface(b).getNfcAdapterVendorInterface("nxp");
            if (b2 == null) {
                return null;
            }
            sVzwNfcAdapter = INxpNfcAdapter.Stub.asInterface(b2).getNfcVzwInterface();
            return sVzwNfcAdapter;
        } catch (Exception e) {
            throw new UnsupportedOperationException();
        }
    }
}


package com.vzw.nfc;

import android.nfc.INfcAdapter.Stub;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.Log;
import com.nxp.nfc.INfcVzw;
import com.nxp.nfc.INxpNfcAdapter;
import com.vzw.nfc.dos.AidMaskDo;
import com.vzw.nfc.dos.AidRangeDo;
import com.vzw.nfc.dos.ClfFilterDo;
import com.vzw.nfc.dos.ClfFilterDoList;
import com.vzw.nfc.dos.DoParserException;
import com.vzw.nfc.dos.FilterConditionTagDo;
import com.vzw.nfc.dos.FilterEntryDo;
import java.util.ArrayList;
import java.util.Iterator;

public final class AidFilter {

    private static INfcVzw sVzwNfcAdapter;

    public final int DEFAULT_ROUTE_LOCATION = 2;

    public boolean setFilterList(byte[] filterList) {
        boolean status = true;
        ClfFilterDoList allClfFilterDo = new ClfFilterDoList(filterList, 0, filterList.length);
        try {
            allClfFilterDo.translate();
            ArrayList<RouteEntry> entries = new ArrayList();
            prepareRouteInfo(allClfFilterDo, entries);
            if (getServiceInterface() != null) {
                try {
                    status = getServiceInterface().setVzwAidList((RouteEntry[]) entries.toArray(new RouteEntry[entries.size()]));
                } catch (RemoteException e) {
                    status = false;
                }
            }
            return status;
        } catch (DoParserException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean enableFilterCondition(byte filterConditionTag) {
        if (getServiceInterface() == null || FilterConditionTagDo.SCREEN_OFF_TAG != filterConditionTag) {
            return true;
        }
        try {
            getServiceInterface().setScreenOffCondition(true);
            return true;
        } catch (RemoteException e) {
            return false;
        }
    }

    public boolean disableFilterCondition(byte filterConditionTag) {
        if (getServiceInterface() == null || FilterConditionTagDo.SCREEN_OFF_TAG != filterConditionTag) {
            return true;
        }
        try {
            getServiceInterface().setScreenOffCondition(false);
            return true;
        } catch (RemoteException e) {
            return false;
        }
    }

    private void prepareRouteInfo(ClfFilterDoList allClfFilterDo, ArrayList<RouteEntry> entries) {
        Iterator it = allClfFilterDo.getClfFilterDos().iterator();
        while (it.hasNext()) {
            ClfFilterDo clfDoFilter = (ClfFilterDo) it.next();
            byte[] aid = getAid(clfDoFilter.getFilterEntryDo().getAidRangeDo(), clfDoFilter.getFilterEntryDo().getAidMaskDo());
            int powerState = getPowerState(clfDoFilter.getFilterEntryDo());
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append("prepareRouteInfo powerState");
            stringBuilder.append(powerState);
            Log.d("AidFilter", stringBuilder.toString());
            entries.add(new RouteEntry(aid, powerState, 2, clfDoFilter.getFilterEntryDo().getVzwArDo().isVzwAllowed()));
        }
    }

    private byte[] getAid(AidRangeDo aid_range, AidMaskDo aid_mask) {
        byte[] barr_aid_mask = aid_mask.getAidMask();
        int count = 0;
        while (count < barr_aid_mask.length && barr_aid_mask[count] == (byte) -1) {
            count++;
        }
        if (count == 0) {
            return null;
        }
        byte[] aid = new byte[count];
        System.arraycopy(aid_range.getAidRange(), 0, aid, 0, count);
        return aid;
    }

    private int getPowerState(FilterEntryDo filter_entry_do) {
        int powerState = 0;
        int routeInfo = filter_entry_do.getRoutingModeDo().getRoutingInfo();
        FilterConditionTagDo conditionTagDo = filter_entry_do.getFilterConditionTagDo();
        if (conditionTagDo != null && conditionTagDo.getFilterConditionTag() == FilterConditionTagDo.SCREEN_OFF_TAG) {
            powerState = 1;
        } else if (routeInfo != 0) {
            powerState = ((((routeInfo & 1) << 2) | (routeInfo & 2)) | ((routeInfo & 4) >> 2)) | 128;
        }
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("getPowerState");
        stringBuilder.append(powerState);
        Log.d("AidFilte

        return powerState;
    }

    private static INfcVzw getServiceInterface() {
        if (sVzwNfcAdapter != null) {
            return sVzwNfcAdapter;
        }
        IBinder b = ServiceManager.getService("nfc");
        if (b == null) {
            return null;
        }
        try {
            IBinder b2 = Stub.asInterface(b).getNfcAdapterVendorInterface("nxp");
            if (b2 == null) {
                return null;
            }
            sVzwNfcAdapter = INxpNfcAdapter.Stub.asInterface(b2).getNfcVzwInterface();
            return sVzwNfcAdapter;
        } catch (Exception e) {
            throw new UnsupportedOperationException();
        }
    }
}


if (routeInfo != 0) {
            powerState = ((((routeInfo & 1) << 2) | (routeInfo & 2)) | ((routeInfo & 4) >> 2)) | 128;
        }

package com.vzw.nfc;

import android.nfc.INfcAdapter.Stub;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.Log;
import com.nxp.nfc.INfcVzw;
import com.nxp.nfc.INxpNfcAdapter;
import com.vzw.nfc.dos.AidMaskDo;
import com.vzw.nfc.dos.AidRangeDo;
import com.vzw.nfc.dos.ClfFilterDo;
import com.vzw.nfc.dos.ClfFilterDoList;
import com.vzw.nfc.dos.DoParserException;
import com.vzw.nfc.dos.FilterConditionTagDo;
import com.vzw.nfc.dos.FilterEntryDo;
import java.util.ArrayList;
import java.util.Iterator;

public final class AidFilter {

    private static INfcVzw sVzwNfcAdapter;

    public final int DEFAULT_ROUTE_LOCATION = 2;

    public boolean setFilterList(byte[] filterList) {
        boolean status = true;
        ClfFilterDoList allClfFilterDo = new ClfFilterDoList(filterList, 0, filterList.length);
        try {
            allClfFilterDo.translate();
            ArrayList<RouteEntry> entries = new ArrayList();
            prepareRouteInfo(allClfFilterDo, entries);
            if (getServiceInterface() != null) {
                try {
                    status = getServiceInterface().setVzwAidList((RouteEntry[]) entries.toArray(new RouteEntry[entries.size()]));
                } catch (RemoteException e) {
                    status = false;
                }
            }
            return status;
        } catch (DoParserException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean enableFilterCondition(byte filterConditionTag) {
        if (getServiceInterface() == null || FilterConditionTagDo.SCREEN_OFF_TAG != filterConditionTag) {
            return true;
        }
        try {
            getServiceInterface().setScreenOffCondition(true);
            return true;
        } catch (RemoteException e) {
            return false;
        }
    }

    public boolean disableFilterCondition(byte filterConditionTag) {
        if (getServiceInterface() == null || FilterConditionTagDo.SCREEN_OFF_TAG != filterConditionTag) {
            return true;
        }
        try {
            getServiceInterface().setScreenOffCondition(false);
            return true;
        } catch (RemoteException e) {
            return false;
        }
    }

    private void prepareRouteInfo(ClfFilterDoList allClfFilterDo, ArrayList<RouteEntry> entries) {
        Iterator it = allClfFilterDo.getClfFilterDos().iterator();
        while (it.hasNext()) {
            ClfFilterDo clfDoFilter = (ClfFilterDo) it.next();
            byte[] aid = getAid(clfDoFilter.getFilterEntryDo().getAidRangeDo(), clfDoFilter.getFilterEntryDo().getAidMaskDo());
            int powerState = getPowerState(clfDoFilter.getFilterEntryDo());
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append("prepareRouteInfo powerState");
            stringBuilder.append(powerState);
            Log.d("AidFilter", stringBuilder.toString());
            entries.add(new RouteEntry(aid, powerState, 2, clfDoFilter.getFilterEntryDo().getVzwArDo().isVzwAllowed()));
        }
    }

    private byte[] getAid(AidRangeDo aid_range, AidMaskDo aid_mask) {
        byte[] barr_aid_mask = aid_mask.getAidMask();
        int count = 0;
        while (count < barr_aid_mask.length && barr_aid_mask[count] == (byte) -1) {
            count++;
        }
        if (count == 0) {
            return null;
        }
        byte[] aid = new byte[count];
        System.arraycopy(aid_range.getAidRange(), 0, aid, 0, count);
        return aid;
    }

    private int getPowerState(FilterEntryDo filter_entry_do) {
        int powerState = 0;
        int routeInfo = filter_entry_do.getRoutingModeDo().getRoutingInfo();
        FilterConditionTagDo conditionTagDo = filter_entry_do.getFilterConditionTagDo();
        if (conditionTagDo != null && conditionTagDo.getFilterConditionTag() == FilterConditionTagDo.SCREEN_OFF_TAG) {
            powerState = 1;
        } else

        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("getPowerState");
        stringBuilder.append(powerState);
        Log.d("AidFilter", stringBuilder.toString());
        return powerState;
    }

    private static INfcVzw getServiceInterface() {
        if (sVzwNfcAdapter != null) {
            return sVzwNfcAdapter;
        }
        IBinder b = ServiceManager.getService("nfc");
        if (b == null) {
            return null;
        }
        try {
            IBinder b2 = Stub.asInterface(b).getNfcAdapterVendorInterface("nxp");
            if (b2 == null) {
                return null;
            }
            sVzwNfcAdapter = INxpNfcAdapter.Stub.asInterface(b2).getNfcVzwInterface();
            return sVzwNfcAdapter;
        } catch (Exception e) {
            throw new UnsupportedOperationException();
        }
    }
}


while (count < barr_aid_mask.length && barr_aid_mask[count] == (byte) -1) {
            count++;
        }

package com.vzw.nfc;

import android.nfc.INfcAdapter.Stub;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.Log;
import com.nxp.nfc.INfcVzw;
import com.nxp.nfc.INxpNfcAdapter;
import com.vzw.nfc.dos.AidMaskDo;
import com.vzw.nfc.dos.AidRangeDo;
import com.vzw.nfc.dos.ClfFilterDo;
import com.vzw.nfc.dos.ClfFilterDoList;
import com.vzw.nfc.dos.DoParserException;
import com.vzw.nfc.dos.FilterConditionTagDo;
import com.vzw.nfc.dos.FilterEntryDo;
import java.util.ArrayList;
import java.util.Iterator;

public final class AidFilter {

    private static INfcVzw sVzwNfcAdapter;

    public final int DEFAULT_ROUTE_LOCATION = 2;

    public boolean setFilterList(byte[] filterList) {
        boolean status = true;
        ClfFilterDoList allClfFilterDo = new ClfFilterDoList(filterList, 0, filterList.length);
        try {
            allClfFilterDo.translate();
            ArrayList<RouteEntry> entries = new ArrayList();
            prepareRouteInfo(allClfFilterDo, entries);
            if (getServiceInterface() != null) {
                try {
                    status = getServiceInterface().setVzwAidList((RouteEntry[]) entries.toArray(new RouteEntry[entries.size()]));
                } catch (RemoteException e) {
                    status = false;
                }
            }
            return status;
        } catch (DoParserException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean enableFilterCondition(byte filterConditionTag) {
        if (getServiceInterface() == null || FilterConditionTagDo.SCREEN_OFF_TAG != filterConditionTag) {
            return true;
        }
        try {
            getServiceInterface().setScreenOffCondition(true);
            return true;
        } catch (RemoteException e) {
            return false;
        }
    }

    public boolean disableFilterCondition(byte filterConditionTag) {
        if (getServiceInterface() == null || FilterConditionTagDo.SCREEN_OFF_TAG != filterConditionTag) {
            return true;
        }
        try {
            getServiceInterface().setScreenOffCondition(false);
            return true;
        } catch (RemoteException e) {
            return false;
        }
    }

    private void prepareRouteInfo(ClfFilterDoList allClfFilterDo, ArrayList<RouteEntry> entries) {
        Iterator it = allClfFilterDo.getClfFilterDos().iterator();
        while (it.hasNext()) {
            ClfFilterDo clfDoFilter = (ClfFilterDo) it.next();
            byte[] aid = getAid(clfDoFilter.getFilterEntryDo().getAidRangeDo(), clfDoFilter.getFilterEntryDo().getAidMaskDo());
            int powerState = getPowerState(clfDoFilter.getFilterEntryDo());
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append("prepareRouteInfo powerState");
            stringBuilder.append(powerState);
            Log.d("AidFilter", stringBuilder.toString());
            entries.add(new RouteEntry(aid, powerState, 2, clfDoFilter.getFilterEntryDo().getVzwArDo().isVzwAllowed()));
        }
    }

    private byte[] getAid(AidRangeDo aid_range, AidMaskDo aid_mask) {
        byte[] barr_aid_mask = aid_mask.getAidMask();
        int count = 0;

        if (count == 0) {
            return null;
        }
        byte[] aid = new byte[count];
        System.arraycopy(aid_range.getAidRange(), 0, aid, 0, count);
        return aid;
    }

    private int getPowerState(FilterEntryDo filter_entry_do) {
        int powerState = 0;
        int routeInfo = filter_entry_do.getRoutingModeDo().getRoutingInfo();
        FilterConditionTagDo conditionTagDo = filter_entry_do.getFilterConditionTagDo();
        if (conditionTagDo != null && conditionTagDo.getFilterConditionTag() == FilterConditionTagDo.SCREEN_OFF_TAG) {
            powerState = 1;
        } else if (routeInfo != 0) {
            powerState = ((((routeInfo & 1) << 2) | (routeInfo & 2)) | ((routeInfo & 4) >> 2)) | 128;
        }
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("getPowerState");
        stringBuilder.append(powerState);
        Log.d("AidFilter", stringBuilder.toString());
        return powerState;
    }

    private static INfcVzw getServiceInterface() {
        if (sVzwNfcAdapter != null) {
            return sVzwNfcAdapter;
        }
        IBinder b = ServiceManager.getService("nfc");
        if (b == null) {
            return null;
        }
        try {
            IBinder b2 = Stub.asInterface(b).getNfcAdapterVendorInterface("nxp");
            if (b2 == null) {
                return null;
            }
            sVzwNfcAdapter = INxpNfcAdapter.Stub.asInterface(b2).getNfcVzwInterface();
            return sVzwNfcAdapter;
        } catch (Exception e) {
            throw new UnsupportedOperationException();
        }
    }
}


try {
            getServiceInterface().setScreenOffCondition(false);
            return true;
        } catch (RemoteException e) {
            return false;
        }

package com.vzw.nfc;

import android.nfc.INfcAdapter.Stub;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.Log;
import com.nxp.nfc.INfcVzw;
import com.nxp.nfc.INxpNfcAdapter;
import com.vzw.nfc.dos.AidMaskDo;
import com.vzw.nfc.dos.AidRangeDo;
import com.vzw.nfc.dos.ClfFilterDo;
import com.vzw.nfc.dos.ClfFilterDoList;
import com.vzw.nfc.dos.DoParserException;
import com.vzw.nfc.dos.FilterConditionTagDo;
import com.vzw.nfc.dos.FilterEntryDo;
import java.util.ArrayList;
import java.util.Iterator;

public final class AidFilter {

    private static INfcVzw sVzwNfcAdapter;

    public final int DEFAULT_ROUTE_LOCATION = 2;

    public boolean setFilterList(byte[] filterList) {
        boolean status = true;
        ClfFilterDoList allClfFilterDo = new ClfFilterDoList(filterList, 0, filterList.length);
        try {
            allClfFilterDo.translate();
            ArrayList<RouteEntry> entries = new ArrayList();
            prepareRouteInfo(allClfFilterDo, entries);
            if (getServiceInterface() != null) {
                try {
                    status = getServiceInterface().setVzwAidList((RouteEntry[]) entries.toArray(new RouteEntry[entries.size()]));
                } catch (RemoteException e) {
                    status = false;
                }
            }
            return status;
        } catch (DoParserException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean enableFilterCondition(byte filterConditionTag) {
        if (getServiceInterface() == null || FilterConditionTagDo.SCREEN_OFF_TAG != filterConditionTag) {
            return true;
        }
        try {
            getServiceInterface().setScreenOffCondition(true);
            return true;
        } catch (RemoteException e) {
            return false;
        }
    }

    public boolean disableFilterCondition(byte filterConditionTag) {
        if (getServiceInterface() == null || FilterConditionTagDo.SCREEN_OFF_TAG != filterConditionTag) {
            return true;
        }

    }

    private void prepareRouteInfo(ClfFilterDoList allClfFilterDo, ArrayList<RouteEntry> entries) {
        Iterator it = allClfFilterDo.getClfFilterDos().iterator();
        while (it.hasNext()) {
            ClfFilterDo clfDoFilter = (ClfFilterDo) it.next();
            byte[] aid = getAid(clfDoFilter.getFilterEntryDo().getAidRangeDo(), clfDoFilter.getFilterEntryDo().getAidMaskDo());
            int powerState = getPowerState(clfDoFilter.getFilterEntryDo());
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append("prepareRouteInfo powerState");
            stringBuilder.append(powerState);
            Log.d("AidFilter", stringBuilder.toString());
            entries.add(new RouteEntry(aid, powerState, 2, clfDoFilter.getFilterEntryDo().getVzwArDo().isVzwAllowed()));
        }
    }

    private byte[] getAid(AidRangeDo aid_range, AidMaskDo aid_mask) {
        byte[] barr_aid_mask = aid_mask.getAidMask();
        int count = 0;
        while (count < barr_aid_mask.length && barr_aid_mask[count] == (byte) -1) {
            count++;
        }
        if (count == 0) {
            return null;
        }
        byte[] aid = new byte[count];
        System.arraycopy(aid_range.getAidRange(), 0, aid, 0, count);
        return aid;
    }

    private int getPowerState(FilterEntryDo filter_entry_do) {
        int powerState = 0;
        int routeInfo = filter_entry_do.getRoutingModeDo().getRoutingInfo();
        FilterConditionTagDo conditionTagDo = filter_entry_do.getFilterConditionTagDo();
        if (conditionTagDo != null && conditionTagDo.getFilterConditionTag() == FilterConditionTagDo.SCREEN_OFF_TAG) {
            powerState = 1;
        } else if (routeInfo != 0) {
            powerState = ((((routeInfo & 1) << 2) | (routeInfo & 2)) | ((routeInfo & 4) >> 2)) | 128;
        }
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("getPowerState");
        stringBuilder.append(powerState);
        Log.d("AidFilter", stringBuilder.toString());
        return powerState;
    }

    private static INfcVzw getServiceInterface() {
        if (sVzwNfcAdapter != null) {
            return sVzwNfcAdapter;
        }
        IBinder b = ServiceManager.getService("nfc");
        if (b == null) {
            return null;
        }
        try {
            IBinder b2 = Stub.asInterface(b).getNfcAdapterVendorInterface("nxp");
            if (b2 == null) {
                return null;
            }
            sVzwNfcAdapter = INxpNfcAdapter.Stub.asInterface(b2).getNfcVzwInterface();
            return sVzwNfcAdapter;
        } catch (Exception e) {
            throw new UnsupportedOperationException();
        }
    }
}


/**
 * @test
 * @summary Test behavior of isJavaIdentifierXX, testIsJavaLetter, and
 *  testIsJavaLetterOrDigit methods for all code points.
 * @bug 8218915
 */
import java.util.List;
import java.util.ArrayList;

public class TestIsJavaIdentifierMethods {

    // List of new code points are not present in Unicode 6.2.
    private static final List<Integer> UNASSIGNED_CODEPOINTS_IN_6_2 = new ArrayList<Integer>() {

        {
            // NORDIC MARK SIGN
            add(0x20BB);
            // MANAT SIGN
            add(0x20BC);
            // RUBLE SIGN
            add(0x20BD);
            // LARI SIGN
            add(0x20BE);
            // BITCOIN SIGN
            add(0x20BF);
            // SQUARE ERA NAME NEWERA
            add(0x32FF);
        }
    };

{
        testIsJavaIdentifierPart_int();
        testIsJavaIdentifierPart_char();
        testIsJavaIdentifierStart_int();
        testIsJavaIdentifierStart_char();
        testIsJavaLetter();
        testIsJavaLetterOrDigit();
    }

    /**
     * Assertion testing for public static boolean isJavaIdentifierPart(int
     * codePoint), A character may be part of a Java identifier if any of the
     * following are true:
     *

     *
it is a letter

     *
it is a currency symbol (such as '$')

     *
it is a connecting punctuation character (such as '_')
     *

     *
it is a digit

     *
it is a numeric letter (such as a Roman numeral character)

     *
it is a combining mark

     *
it is a non-spacing mark

     *
isIdentifierIgnorable returns true for the
     * character

     *

     * All code points from (0x0000..0x10FFFF) are tested.
     */
    public static void testIsJavaIdentifierPart_int() {
        for (int cp = 0; cp <= Character.MAX_CODE_POINT; cp++) {
            boolean expected = false;
            // Since Character.isJavaIdentifierPart(int) strictly conforms to
            // character information from version 6.2 of the Unicode Standard,
            // check if code point is in "UNASSIGNED_CODEPOINTS_IN_6_2"
            // list. If the code point is found in list
            // "UNASSIGNED_CODEPOINTS_IN_6_2", value of variable
            if (!UNASSIGNED_CODEPOINTS_IN_6_2.contains(cp)) {
                byte type = (byte) Character.getType(cp);
                expected = Character.isLetter(cp) || type == Character.CURRENCY_SYMBOL || type == Character.CONNECTOR_PUNCTUATION || Character.isDigit(cp) || type == Character.LETTER_NUMBER || type == Character.COMBINING_SPACING_MARK || type == Character.NON_SPACING_MARK || Character.isIdentifierIgnorable(cp);
            }
            if (Character.isJavaIdentifierPart(cp) != expected) {
                throw new RuntimeException("Character.isJavaIdentifierPart(int) failed for codepoint " + Integer.toHexString(cp));
            }
        }
    }

    /**
     * Assertion testing for public static boolean isJavaIdentifierPart(char
     * ch), A character may be part of a Java identifier if any of the
     * following are true:
     *

     *
it is a letter;
     *
it is a currency symbol (such as "$");
     *
it is a connecting punctuation character (such as "_");
     *
it is a digit;
     *
it is a numeric letter (such as a Roman numeral character);
     *
it is a combining mark;
     *
it is a non-spacing mark;
     *
isIdentifierIgnorable returns true for the character.
     *

     * All Unicode code points in the BMP (0x0000..0xFFFF) are tested.
     */
    public static void testIsJavaIdentifierPart_char() {
        for (int i = 0; i <= Character.MAX_VALUE; ++i) {
            char ch = (char) i;
            boolean expected = false;
            // Since Character.isJavaIdentifierPart(char) strictly conforms to
            // character information from version 6.2 of the Unicode Standard,
            // check if code point is in "UNASSIGNED_CODEPOINTS_IN_6_2"
            // list. If the code point is found in list
            // "UNASSIGNED_CODEPOINTS_IN_6_2", value of variable
            if (!UNASSIGNED_CODEPOINTS_IN_6_2.contains(i)) {
                byte type = (byte) Character.getType(ch);
                expected = Character.isLetter(ch) || type == Character.CURRENCY_SYMBOL || type == Character.CONNECTOR_PUNCTUATION || Character.isDigit(ch) || type == Character.LETTER_NUMBER || type == Character.COMBINING_SPACING_MARK || type == Character.NON_SPACING_MARK || Character.isIdentifierIgnorable(ch);
            }
            if (Character.isJavaIdentifierPart((char) i) != expected) {
                throw new RuntimeException("Character.isJavaIdentifierPart(char) failed for codepoint " + Integer.toHexString(i));
            }
        }
    }

    /**
     * Assertion testing for public static boolean isJavaIdentifierStart(int
     * codePoint), A character may start a Java identifier if and only if it is
     * one of the following:
     *

     *
it is a letter;

     *
getType(ch) returns LETTER_NUMBER;

     *
it is a currency symbol (such as "$");

     *
it is a connecting punctuation character (such as "_");

     *

     * All Code points from (0x0000..0x10FFFF) are tested.
     */
    public static void testIsJavaIdentifierStart_int() {
        for (int cp = 0; cp <= Character.MAX_CODE_POINT; cp++) {
            boolean expected = false;
            // Since Character.isJavaIdentifierStart(int) strictly conforms to
            // character information from version 6.2 of the Unicode Standard,
            // check if code point is in "UNASSIGNED_CODEPOINTS_IN_6_2"
            // list. If the code point is found in list
            // "UNASSIGNED_CODEPOINTS_IN_6_2", value of variable
            if (!UNASSIGNED_CODEPOINTS_IN_6_2.contains(cp)) {
                byte type = (byte) Character.getType(cp);
                expected = Character.isLetter(cp) || type == Character.LETTER_NUMBER || type == Character.CURRENCY_SYMBOL || type == Character.CONNECTOR_PUNCTUATION;
            }
            if (Character.isJavaIdentifierStart(cp) != expected) {
                throw new RuntimeException("Character.isJavaIdentifierStart(int) failed for codepoint " + Integer.toHexString(cp));
            }
        }
    }

    /**
     * Assertion testing for public static boolean isJavaIdentifierStart(char),
     * A character may start a Java identifier if and only if it is
     * one of the following:
     *

     *
it is a letter;

     *
getType(ch) returns LETTER_NUMBER;

     *
it is a currency symbol (such as "$");

     *
it is a connecting punctuation character (such as "_");

     *

     * All Unicode code points in the BMP (0x0000..0xFFFF) are tested.
     */
    public static void testIsJavaIdentifierStart_char() {
        for (int i = 0; i <= Character.MAX_VALUE; i++) {
            char ch = (char) i;
            boolean expected = false;
            // Since Character.isJavaIdentifierStart(char) strictly conforms to
            // character information from version 6.2 of the Unicode Standard,
            // check if code point is in "UNASSIGNED_CODEPOINTS_IN_6_2"
            // list. If the code point is found in list
            // "UNASSIGNED_CODEPOINTS_IN_6_2", value of variable
            if (!UNASSIGNED_CODEPOINTS_IN_6_2.contains(i)) {
                byte type = (byte) Character.getType(ch);
                expected = Character.isLetter(ch) || type == Character.LETTER_NUMBER || type == Character.CURRENCY_SYMBOL || type == Character.CONNECTOR_PUNCTUATION;
            }
            if (Character.isJavaIdentifierStart(ch) != expected) {
                throw new RuntimeException("Character.isJavaIdentifierStart(char) failed for codepoint " + Integer.toHexString(i));
            }
        }
    }

    /**
     * Assertion testing for public static boolean isJavaLetter(char ch), A
     * character may start a Java identifier if and only if one of the
     * following is true:
     *

     *
isLetter(ch) returns true
     *
getType(ch) returns LETTER_NUMBER
     *
ch is a currency symbol (such as "$")
     *
ch is a connecting punctuation character (such as "_").
     *

     * All Unicode code points in the BMP (0x0000..0xFFFF) are tested.
     */
    public static void testIsJavaLetter() {
        for (int i = 0; i <= Character.MAX_VALUE; ++i) {
            char ch = (char) i;
            boolean expected = false;
            // Since Character.isJavaLetter(char) strictly conforms to
            // character information from version 6.2 of the Unicode Standard,
            // check if code point is in "UNASSIGNED_CODEPOINTS_IN_6_2"
            // list. If the code point is found in list
            // "UNASSIGNED_CODEPOINTS_IN_6_2", value of variable
            if (!UNASSIGNED_CODEPOINTS_IN_6_2.contains(i)) {
                byte type = (byte) Character.getType(ch);
                expected = Character.isLetter(ch) || type == Character.LETTER_NUMBER || type == Character.CURRENCY_SYMBOL || type == Character.CONNECTOR_PUNCTUATION;
            }
            if (Character.isJavaLetter(ch) != expected) {
                throw new RuntimeException("Character.isJavaLetter(ch) failed for codepoint " + Integer.toHexString(i));
            }
        }
    }

    /**
     * Assertion testing for public static boolean isJavaLetterOrDigit(char
     * ch), A character may be part of a Java identifier if and only if any
     *  of the following are true:
     *

     *
it is a letter
     *
it is a currency symbol (such as '$')
     *
it is a connecting punctuation character (such as '_')
     *
it is a digit
     *
it is a numeric letter (such as a Roman numeral character)
     *
it is a combining mark
     *
it is a non-spacing mark
     *
isIdentifierIgnorable returns true for the character.
     *

     * All Unicode code points in the BMP (0x0000..0xFFFF) are tested.
     */
    public static void testIsJavaLetterOrDigit() {
        for (int i = 0; i <= Character.MAX_VALUE; ++i) {
            char ch = (char) i;
            boolean expected = false;
            // Since Character.isJavaLetterOrDigit(char) strictly conforms to
            // character information from version 6.2 of the Unicode Standard,
            // check if code point is in "UNASSIGNED_CODEPOINTS_IN_6_2"
            // list. If the code point is found in list
            // "UNASSIGNED_CODEPOINTS_IN_6_2", value of variable
            if (!UNASSIGNED_CODEPOINTS_IN_6_2.contains(i)) {
                byte type = (byte) Character.getType(ch);
                expected = Character.isLetter(ch) || type == Character.CURRENCY_SYMBOL || type == Character.CONNECTOR_PUNCTUATION || Character.isDigit(ch) || type == Character.LETTER_NUMBER || type == Character.COMBINING_SPACING_MARK || type == Character.NON_SPACING_MARK || Character.isIdentifierIgnorable(ch);
            }
            if (Character.isJavaLetterOrDigit(ch) != expected) {
                throw new RuntimeException("Character.isJavaLetterOrDigit(ch) failed for codepoint " + Integer.toHexString(i));
            }
        }
    }
}


{
        testIsJavaIdentifierPart_int();
        testIsJavaIdentifierPart_char();
        testIsJavaIdentifierStart_int();
        testIsJavaIdentifierStart_char();
        testIsJavaLetter();
        testIsJavaLetterOrDigit();
    }

/**
 * @test
 * @summary Test behavior of isJavaIdentifierXX, testIsJavaLetter, and
 *  testIsJavaLetterOrDigit methods for all code points.
 * @bug 8218915
 */
import java.util.List;
import java.util.ArrayList;

public class TestIsJavaIdentifierMethods {

    // List of new code points are not present in Unicode 6.2.
    private static final List<Integer> UNASSIGNED_CODEPOINTS_IN_6_2 = new ArrayList<Integer>() {

        {
            // NORDIC MARK SIGN
            add(0x20BB);
            // MANAT SIGN
            add(0x20BC);
            // RUBLE SIGN
            add(0x20BD);
            // LARI SIGN
            add(0x20BE);
            // BITCOIN SIGN
            add(0x20BF);
            // SQUARE ERA NAME NEWERA
            add(0x32FF);
        }
    };

    public static void main(String[] args)

/**
     * Assertion testing for public static boolean isJavaIdentifierPart(int
     * codePoint), A character may be part of a Java identifier if any of the
     * following are true:
     *

     *
it is a letter

     *
it is a currency symbol (such as '$')

     *
it is a connecting punctuation character (such as '_')
     *

     *
it is a digit

     *
it is a numeric letter (such as a Roman numeral character)

     *
it is a combining mark

     *
it is a non-spacing mark

     *
isIdentifierIgnorable returns true for the
     * character

     *

     * All code points from (0x0000..0x10FFFF) are tested.
     */
    public static void testIsJavaIdentifierPart_int() {
        for (int cp = 0; cp <= Character.MAX_CODE_POINT; cp++) {
            boolean expected = false;
            // Since Character.isJavaIdentifierPart(int) strictly conforms to
            // character information from version 6.2 of the Unicode Standard,
            // check if code point is in "UNASSIGNED_CODEPOINTS_IN_6_2"
            // list. If the code point is found in list
            // "UNASSIGNED_CODEPOINTS_IN_6_2", value of variable
            if (!UNASSIGNED_CODEPOINTS_IN_6_2.contains(cp)) {
                byte type = (byte) Character.getType(cp);
                expected = Character.isLetter(cp) || type == Character.CURRENCY_SYMBOL || type == Character.CONNECTOR_PUNCTUATION || Character.isDigit(cp) || type == Character.LETTER_NUMBER || type == Character.COMBINING_SPACING_MARK || type == Character.NON_SPACING_MARK || Character.isIdentifierIgnorable(cp);
            }
            if (Character.isJavaIdentifierPart(cp) != expected) {
                throw new RuntimeException("Character.isJavaIdentifierPart(int) failed for codepoint " + Integer.toHexString(cp));
            }
        }
    }

    /**
     * Assertion testing for public static boolean isJavaIdentifierPart(char
     * ch), A character may be part of a Java identifier if any of the
     * following are true:
     *

     *
it is a letter;
     *
it is a currency symbol (such as "$");
     *
it is a connecting punctuation character (such as "_");
     *
it is a digit;
     *
it is a numeric letter (such as a Roman numeral character);
     *
it is a combining mark;
     *
it is a non-spacing mark;
     *
isIdentifierIgnorable returns true for the character.
     *

     * All Unicode code points in the BMP (0x0000..0xFFFF) are tested.
     */
    public static void testIsJavaIdentifierPart_char() {
        for (int i = 0; i <= Character.MAX_VALUE; ++i) {
            char ch = (char) i;
            boolean expected = false;
            // Since Character.isJavaIdentifierPart(char) strictly conforms to
            // character information from version 6.2 of the Unicode Standard,
            // check if code point is in "UNASSIGNED_CODEPOINTS_IN_6_2"
            // list. If the code point is found in list
            // "UNASSIGNED_CODEPOINTS_IN_6_2", value of variable
            if (!UNASSIGNED_CODEPOINTS_IN_6_2.contains(i)) {
                byte type = (byte) Character.getType(ch);
                expected = Character.isLetter(ch) || type == Character.CURRENCY_SYMBOL || type == Character.CONNECTOR_PUNCTUATION || Character.isDigit(ch) || type == Character.LETTER_NUMBER || type == Character.COMBINING_SPACING_MARK || type == Character.NON_SPACING_MARK || Character.isIdentifierIgnorable(ch);
            }
            if (Character.isJavaIdentifierPart((char) i) != expected) {
                throw new RuntimeException("Character.isJavaIdentifierPart(char) failed for codepoint " + Integer.toHexString(i));
            }
        }
    }

    /**
     * Assertion testing for public static boolean isJavaIdentifierStart(int
     * codePoint), A character may start a Java identifier if and only if it is
     * one of the following:
     *

     *
it is a letter;

     *
getType(ch) returns LETTER_NUMBER;

     *
it is a currency symbol (such as "$");

     *
it is a connecting punctuation character (such as "_");

     *

     * All Code points from (0x0000..0x10FFFF) are tested.
     */
    public static void testIsJavaIdentifierStart_int() {
        for (int cp = 0; cp <= Character.MAX_CODE_POINT; cp++) {
            boolean expected = false;
            // Since Character.isJavaIdentifierStart(int) strictly conforms to
            // character information from version 6.2 of the Unicode Standard,
            // check if code point is in "UNASSIGNED_CODEPOINTS_IN_6_2"
            // list. If the code point is found in list
            // "UNASSIGNED_CODEPOINTS_IN_6_2", value of variable
            if (!UNASSIGNED_CODEPOINTS_IN_6_2.contains(cp)) {
                byte type = (byte) Character.getType(cp);
                expected = Character.isLetter(cp) || type == Character.LETTER_NUMBER || type == Character.CURRENCY_SYMBOL || type == Character.CONNECTOR_PUNCTUATION;
            }
            if (Character.isJavaIdentifierStart(cp) != expected) {
                throw new RuntimeException("Character.isJavaIdentifierStart(int) failed for codepoint " + Integer.toHexString(cp));
            }
        }
    }

    /**
     * Assertion testing for public static boolean isJavaIdentifierStart(char),
     * A character may start a Java identifier if and only if it is
     * one of the following:
     *

     *
it is a letter;

     *
getType(ch) returns LETTER_NUMBER;

     *
it is a currency symbol (such as "$");

     *
it is a connecting punctuation character (such as "_");

     *

     * All Unicode code points in the BMP (0x0000..0xFFFF) are tested.
     */
    public static void testIsJavaIdentifierStart_char() {
        for (int i = 0; i <= Character.MAX_VALUE; i++) {
            char ch = (char) i;
            boolean expected = false;
            // Since Character.isJavaIdentifierStart(char) strictly conforms to
            // character information from version 6.2 of the Unicode Standard,
            // check if code point is in "UNASSIGNED_CODEPOINTS_IN_6_2"
            // list. If the code point is found in list
            // "UNASSIGNED_CODEPOINTS_IN_6_2", value of variable
            if (!UNASSIGNED_CODEPOINTS_IN_6_2.contains(i)) {
                byte type = (byte) Character.getType(ch);
                expected = Character.isLetter(ch) || type == Character.LETTER_NUMBER || type == Character.CURRENCY_SYMBOL || type == Character.CONNECTOR_PUNCTUATION;
            }
            if (Character.isJavaIdentifierStart(ch) != expected) {
                throw new RuntimeException("Character.isJavaIdentifierStart(char) failed for codepoint " + Integer.toHexString(i));
            }
        }
    }

    /**
     * Assertion testing for public static boolean isJavaLetter(char ch), A
     * character may start a Java identifier if and only if one of the
     * following is true:
     *

     *
isLetter(ch) returns true
     *
getType(ch) returns LETTER_NUMBER
     *
ch is a currency symbol (such as "$")
     *
ch is a connecting punctuation character (such as "_").
     *

     * All Unicode code points in the BMP (0x0000..0xFFFF) are tested.
     */
    public static void testIsJavaLetter() {
        for (int i = 0; i <= Character.MAX_VALUE; ++i) {
            char ch = (char) i;
            boolean expected = false;
            // Since Character.isJavaLetter(char) strictly conforms to
            // character information from version 6.2 of the Unicode Standard,
            // check if code point is in "UNASSIGNED_CODEPOINTS_IN_6_2"
            // list. If the code point is found in list
            // "UNASSIGNED_CODEPOINTS_IN_6_2", value of variable
            if (!UNASSIGNED_CODEPOINTS_IN_6_2.contains(i)) {
                byte type = (byte) Character.getType(ch);
                expected = Character.isLetter(ch) || type == Character.LETTER_NUMBER || type == Character.CURRENCY_SYMBOL || type == Character.CONNECTOR_PUNCTUATION;
            }
            if (Character.isJavaLetter(ch) != expected) {
                throw new RuntimeException("Character.isJavaLetter(ch) failed for codepoint " + Integer.toHexString(i));
            }
        }
    }

    /**
     * Assertion testing for public static boolean isJavaLetterOrDigit(char
     * ch), A character may be part of a Java identifier if and only if any
     *  of the following are true:
     *

     *
it is a letter
     *
it is a currency symbol (such as '$')
     *
it is a connecting punctuation character (such as '_')
     *
it is a digit
     *
it is a numeric letter (such as a Roman numeral character)
     *
it is a combining mark
     *
it is a non-spacing mark
     *
isIdentifierIgnorable returns true for the character.
     *

     * All Unicode code points in the BMP (0x0000..0xFFFF) are tested.
     */
    public static void testIsJavaLetterOrDigit() {
        for (int i = 0; i <= Character.MAX_VALUE; ++i) {
            char ch = (char) i;
            boolean expected = false;
            // Since Character.isJavaLetterOrDigit(char) strictly conforms to
            // character information from version 6.2 of the Unicode Standard,
            // check if code point is in "UNASSIGNED_CODEPOINTS_IN_6_2"
            // list. If the code point is found in list
            // "UNASSIGNED_CODEPOINTS_IN_6_2", value of variable
            if (!UNASSIGNED_CODEPOINTS_IN_6_2.contains(i)) {
                byte type = (byte) Character.getType(ch);
                expected = Character.isLetter(ch) || type == Character.CURRENCY_SYMBOL || type == Character.CONNECTOR_PUNCTUATION || Character.isDigit(ch) || type == Character.LETTER_NUMBER || type == Character.COMBINING_SPACING_MARK || type == Character.NON_SPACING_MARK || Character.isIdentifierIgnorable(ch);
            }
            if (Character.isJavaLetterOrDigit(ch) != expected) {
                throw new RuntimeException("Character.isJavaLetterOrDigit(ch) failed for codepoint " + Integer.toHexString(i));
            }
        }
    }
}


/**
 * @test
 * @summary Test behavior of isJavaIdentifierXX, testIsJavaLetter, and
 *  testIsJavaLetterOrDigit methods for all code points.
 * @bug 8218915
 */
import java.util.List;
import java.util.ArrayList;

public class TestIsJavaIdentifierMethods {

    // List of new code points are not present in Unicode 6.2.
    private static final List<Integer> UNASSIGNED_CODEPOINTS_IN_6_2 = new ArrayList<Integer>() {

        {
            // NORDIC MARK SIGN
            add(0x20BB);
            // MANAT SIGN
            add(0x20BC);
            // RUBLE SIGN
            add(0x20BD);
            // LARI SIGN
            add(0x20BE);
            // BITCOIN SIGN
            add(0x20BF);
            // SQUARE ERA NAME NEWERA
            add(0x32FF);
        }
    };

    public static void main(String[] args) {
        testIsJavaIdentifierPart_int();
        testIsJavaIdentifierPart_char();
        testIsJavaIdentifierStart_int();
        testIsJavaIdentifierStart_char();
        testIsJavaLetter();
        testIsJavaLetterOrDigit();
    }

    /**
     * Assertion testing for public static boolean isJavaIdentifierPart(int
     * codePoint), A character may be part of a Java identifier if any of the
     * following are true:
     *

     *
it is a letter

     *
it is a currency symbol (such as '$')

     *
it is a connecting punctuation character (such as '_')
     *

     *
it is a digit

     *
it is a numeric letter (such as a Roman numeral character)

     *
it is a combining mark

     *
it is a non-spacing mark

     *
isIdentifierIgnorable returns true for the
     * character

     *

     * All code points from (0x0000..0x10FFFF) are tested.
     */
    public static void testIsJavaIdentifierPart_int() {

for (int cp = 0; cp <= Character.MAX_CODE_POINT; cp++) {
            boolean expected = false;
            // Since Character.isJavaIdentifierPart(int) strictly conforms to
            // character information from version 6.2 of the Unicode Standard,
            // check if code point is in "UNASSIGNED_CODEPOINTS_IN_6_2"
            // list. If the code point is found in list
            // "UNASSIGNED_CODEPOINTS_IN_6_2", value of variable
            if (!UNASSIGNED_CODEPOINTS_IN_6_2.contains(cp)) {
                byte type = (byte) Character.getType(cp);
                expected = Character.isLetter(cp) || type == Character.CURRENCY_SYMBOL || type == Character.CONNECTOR_PUNCTUATION || Character.isDigit(cp) || type == Character.LETTER_NUMBER || type == Character.COMBINING_SPACING_MARK || type == Character.NON_SPACING_MARK || Character.isIdentifierIgnorable(cp);
            }
            if (Character.isJavaIdentifierPart(cp) != expected) {
                throw new RuntimeException("Character.isJavaIdentifierPart(int) failed for codepoint " + Integer.toHexString(cp));
            }
        }
    }

    /**
     * Assertion testing for public static boolean isJavaIdentifierPart(char
     * ch), A character may be part of a Java identifier if any of the
     * following are true:
     *

     *
it is a letter;
     *
it is a currency symbol (such as "$");
     *
it is a connecting punctuation character (such as "_");
     *
it is a digit;
     *
it is a numeric letter (such as a Roman numeral character);
     *
it is a combining mark;
     *
it is a non-spacing mark;
     *
isIdentifierIgnorable returns true for the character.
     *

     * All Unicode code points in the BMP (0x0000..0xFFFF) are tested.
     */
    public static void testIsJavaIdentifierPart_char() {
        for (int i = 0; i <= Character.MAX_VALUE; ++i) {
            char ch = (char) i;
            boolean expected = false;
            // Since Character.isJavaIdentifierPart(char) strictly conforms to
            // character information from version 6.2 of the Unicode Standard,
            // check if code point is in "UNASSIGNED_CODEPOINTS_IN_6_2"
            // list. If the code point is found in list
            // "UNASSIGNED_CODEPOINTS_IN_6_2", value of variable
            if (!UNASSIGNED_CODEPOINTS_IN_6_2.contains(i)) {
                byte type = (byte) Character.getType(ch);
                expected = Character.isLetter(ch) || type == Character.CURRENCY_SYMBOL || type == Character.CONNECTOR_PUNCTUATION || Character.isDigit(ch) || type == Character.LETTER_NUMBER || type == Character.COMBINING_SPACING_MARK || type == Character.NON_SPACING_MARK || Character.isIdentifierIgnorable(ch);
            }
            if (Character.isJavaIdentifierPart((char) i) != expected) {
                throw new RuntimeException("Character.isJavaIdentifierPart(char) failed for codepoint " + Integer.toHexString(i));
            }
        }
    }

    /**
     * Assertion testing for public static boolean isJavaIdentifierStart(int
     * codePoint), A character may start a Java identifier if and only if it is
     * one of the following:
     *

     *
it is a letter;

     *
getType(ch) returns LETTER_NUMBER;

     *
it is a currency symbol (such as "$");

     *
it is a connecting punctuation character (such as "_");

     *

     * All Code points from (0x0000..0x10FFFF) are tested.
     */
    public static void testIsJavaIdentifierStart_int() {
        for (int cp = 0; cp <= Character.MAX_CODE_POINT; cp++) {
            boolean expected = false;
            // Since Character.isJavaIdentifierStart(int) strictly conforms to
            // character information from version 6.2 of the Unicode Standard,
            // check if code point is in "UNASSIGNED_CODEPOINTS_IN_6_2"
            // list. If the code point is found in list
            // "UNASSIGNED_CODEPOINTS_IN_6_2", value of variable
            if (!UNASSIGNED_CODEPOINTS_IN_6_2.contains(cp)) {
                byte type = (byte) Character.getType(cp);
                expected = Character.isLetter(cp) || type == Character.LETTER_NUMBER || type == Character.CURRENCY_SYMBOL || type == Character.CONNECTOR_PUNCTUATION;
            }
            if (Character.isJavaIdentifierStart(cp) != expected) {
                throw new RuntimeException("Character.isJavaIdentifierStart(int) failed for codepoint " + Integer.toHexString(cp));
            }
        }
    }

    /**
     * Assertion testing for public static boolean isJavaIdentifierStart(char),
     * A character may start a Java identifier if and only if it is
     * one of the following:
     *

     *
it is a letter;

     *
getType(ch) returns LETTER_NUMBER;

     *
it is a currency symbol (such as "$");

     *
it is a connecting punctuation character (such as "_");

     *

     * All Unicode code points in the BMP (0x0000..0xFFFF) are tested.
     */
    public static void testIsJavaIdentifierStart_char() {
        for (int i = 0; i <= Character.MAX_VALUE; i++) {
            char ch = (char) i;
            boolean expected = false;
            // Since Character.isJavaIdentifierStart(char) strictly conforms to
            // character information from version 6.2 of the Unicode Standard,
            // check if code point is in "UNASSIGNED_CODEPOINTS_IN_6_2"
            // list. If the code point is found in list
            // "UNASSIGNED_CODEPOINTS_IN_6_2", value of variable
            if (!UNASSIGNED_CODEPOINTS_IN_6_2.contains(i)) {
                byte type = (byte) Character.getType(ch);
                expected = Character.isLetter(ch) || type == Character.LETTER_NUMBER || type == Character.CURRENCY_SYMBOL || type == Character.CONNECTOR_PUNCTUATION;
            }
            if (Character.isJavaIdentifierStart(ch) != expected) {
                throw new RuntimeException("Character.isJavaIdentifierStart(char) failed for codepoint " + Integer.toHexString(i));
            }
        }
    }

    /**
     * Assertion testing for public static boolean isJavaLetter(char ch), A
     * character may start a Java identifier if and only if one of the
     * following is true:
     *

     *
isLetter(ch) returns true
     *
getType(ch) returns LETTER_NUMBER
     *
ch is a currency symbol (such as "$")
     *
ch is a connecting punctuation character (such as "_").
     *

     * All Unicode code points in the BMP (0x0000..0xFFFF) are tested.
     */
    public static void testIsJavaLetter() {
        for (int i = 0; i <= Character.MAX_VALUE; ++i) {
            char ch = (char) i;
            boolean expected = false;
            // Since Character.isJavaLetter(char) strictly conforms to
            // character information from version 6.2 of the Unicode Standard,
            // check if code point is in "UNASSIGNED_CODEPOINTS_IN_6_2"
            // list. If the code point is found in list
            // "UNASSIGNED_CODEPOINTS_IN_6_2", value of variable
            if (!UNASSIGNED_CODEPOINTS_IN_6_2.contains(i)) {
                byte type = (byte) Character.getType(ch);
                expected = Character.isLetter(ch) || type == Character.LETTER_NUMBER || type == Character.CURRENCY_SYMBOL || type == Character.CONNECTOR_PUNCTUATION;
            }
            if (Character.isJavaLetter(ch) != expected) {
                throw new RuntimeException("Character.isJavaLetter(ch) failed for codepoint " + Integer.toHexString(i));
            }
        }
    }

    /**
     * Assertion testing for public static boolean isJavaLetterOrDigit(char
     * ch), A character may be part of a Java identifier if and only if any
     *  of the following are true:
     *

     *
it is a letter
     *
it is a currency symbol (such as '$')
     *
it is a connecting punctuation character (such as '_')
     *
it is a digit
     *
it is a numeric letter (such as a Roman numeral character)
     *
it is a combining mark
     *
it is a non-spacing mark
     *
isIdentifierIgnorable returns true for the character.
     *

     * All Unicode code points in the BMP (0x0000..0xFFFF) are tested.
     */
    public static void testIsJavaLetterOrDigit() {
        for (int i = 0; i <= Character.MAX_VALUE; ++i) {
            char ch = (char) i;
            boolean expected = false;
            // Since Character.isJavaLetterOrDigit(char) strictly conforms to
            // character information from version 6.2 of the Unicode Standard,
            // check if code point is in "UNASSIGNED_CODEPOINTS_IN_6_2"
            // list. If the code point is found in list
            // "UNASSIGNED_CODEPOINTS_IN_6_2", value of variable
            if (!UNASSIGNED_CODEPOINTS_IN_6_2.contains(i)) {
                byte type = (byte) Character.getType(ch);
                expected = Character.isLetter(ch) || type == Character.CURRENCY_SYMBOL || type == Character.CONNECTOR_PUNCTUATION || Character.isDigit(ch) || type == Character.LETTER_NUMBER || type == Character.COMBINING_SPACING_MARK || type == Character.NON_SPACING_MARK || Character.isIdentifierIgnorable(ch);
            }
            if (Character.isJavaLetterOrDigit(ch) != expected) {
                throw new RuntimeException("Character.isJavaLetterOrDigit(ch) failed for codepoint " + Integer.toHexString(i));
            }
        }
    }
}


for (int cp = 0; cp <= Character.MAX_CODE_POINT; cp++) {
            boolean expected = false;
            // Since Character.isJavaIdentifierPart(int) strictly conforms to
            // character information from version 6.2 of the Unicode Standard,
            // check if code point is in "UNASSIGNED_CODEPOINTS_IN_6_2"
            // list. If the code point is found in list
            // "UNASSIGNED_CODEPOINTS_IN_6_2", value of variable
            if (!UNASSIGNED_CODEPOINTS_IN_6_2.contains(cp)) {
                byte type = (byte) Character.getType(cp);
                expected = Character.isLetter(cp) || type == Character.CURRENCY_SYMBOL || type == Character.CONNECTOR_PUNCTUATION || Character.isDigit(cp) || type == Character.LETTER_NUMBER || type == Character.COMBINING_SPACING_MARK || type == Character.NON_SPACING_MARK || Character.isIdentifierIgnorable(cp);
            }
            if (Character.isJavaIdentifierPart(cp) != expected) {
                throw new RuntimeException("Character.isJavaIdentifierPart(int) failed for codepoint " + Integer.toHexString(cp));
            }
        }

}

    /**
     * Assertion testing for public static boolean isJavaIdentifierPart(char
     * ch), A character may be part of a Java identifier if any of the
     * following are true:
     *

     *
it is a letter;
     *
it is a currency symbol (such as "$");
     *
it is a connecting punctuation character (such as "_");
     *
it is a digit;
     *
it is a numeric letter (such as a Roman numeral character);
     *
it is a combining mark;
     *
it is a non-spacing mark;
     *
isIdentifierIgnorable returns true for the character.
     *

     * All Unicode code points in the BMP (0x0000..0xFFFF) are tested.
     */
    public static void testIsJavaIdentifierPart_char() {
        for (int i = 0; i <= Character.MAX_VALUE; ++i) {
            char ch = (char) i;
            boolean expected = false;
            // Since Character.isJavaIdentifierPart(char) strictly conforms to
            // character information from version 6.2 of the Unicode Standard,
            // check if code point is in "UNASSIGNED_CODEPOINTS_IN_6_2"
            // list. If the code point is found in list
            // "UNASSIGNED_CODEPOINTS_IN_6_2", value of variable
            if (!UNASSIGNED_CODEPOINTS_IN_6_2.contains(i)) {
                byte type = (byte) Character.getType(ch);
                expected = Character.isLetter(ch) || type == Character.CURRENCY_SYMBOL || type == Character.CONNECTOR_PUNCTUATION || Character.isDigit(ch) || type == Character.LETTER_NUMBER || type == Character.COMBINING_SPACING_MARK || type == Character.NON_SPACING_MARK || Character.isIdentifierIgnorable(ch);
            }
            if (Character.isJavaIdentifierPart((char) i) != expected) {
                throw new RuntimeException("Character.isJavaIdentifierPart(char) failed for codepoint " + Integer.toHexString(i));
            }
        }
    }

    /**
     * Assertion testing for public static boolean isJavaIdentifierStart(int
     * codePoint), A character may start a Java identifier if and only if it is
     * one of the following:
     *

     *
it is a letter;

     *
getType(ch) returns LETTER_NUMBER;

     *
it is a currency symbol (such as "$");

     *
it is a connecting punctuation character (such as "_");

     *

     * All Code points from (0x0000..0x10FFFF) are tested.
     */
    public static void testIsJavaIdentifierStart_int() {
        for (int cp = 0; cp <= Character.MAX_CODE_POINT; cp++) {
            boolean expected = false;
            // Since Character.isJavaIdentifierStart(int) strictly conforms to
            // character information from version 6.2 of the Unicode Standard,
            // check if code point is in "UNASSIGNED_CODEPOINTS_IN_6_2"
            // list. If the code point is found in list
            // "UNASSIGNED_CODEPOINTS_IN_6_2", value of variable
            if (!UNASSIGNED_CODEPOINTS_IN_6_2.contains(cp)) {
                byte type = (byte) Character.getType(cp);
                expected = Character.isLetter(cp) || type == Character.LETTER_NUMBER || type == Character.CURRENCY_SYMBOL || type == Character.CONNECTOR_PUNCTUATION;
            }
            if (Character.isJavaIdentifierStart(cp) != expected) {
                throw new RuntimeException("Character.isJavaIdentifierStart(int) failed for codepoint " + Integer.toHexString(cp));
            }
        }
    }

    /**
     * Assertion testing for public static boolean isJavaIdentifierStart(char),
     * A character may start a Java identifier if and only if it is
     * one of the following:
     *

     *
it is a letter;

     *
getType(ch) returns LETTER_NUMBER;

     *
it is a currency symbol (such as "$");

     *
it is a connecting punctuation character (such as "_");

     *

     * All Unicode code points in the BMP (0x0000..0xFFFF) are tested.
     */
    public static void testIsJavaIdentifierStart_char() {
        for (int i = 0; i <= Character.MAX_VALUE; i++) {
            char ch = (char) i;
            boolean expected = false;
            // Since Character.isJavaIdentifierStart(char) strictly conforms to
            // character information from version 6.2 of the Unicode Standard,
            // check if code point is in "UNASSIGNED_CODEPOINTS_IN_6_2"
            // list. If the code point is found in list
            // "UNASSIGNED_CODEPOINTS_IN_6_2", value of variable
            if (!UNASSIGNED_CODEPOINTS_IN_6_2.contains(i)) {
                byte type = (byte) Character.getType(ch);
                expected = Character.isLetter(ch) || type == Character.LETTER_NUMBER || type == Character.CURRENCY_SYMBOL || type == Character.CONNECTOR_PUNCTUATION;
            }
            if (Character.isJavaIdentifierStart(ch) != expected) {
                throw new RuntimeException("Character.isJavaIdentifierStart(char) failed for codepoint " + Integer.toHexString(i));
            }
        }
    }

    /**
     * Assertion testing for public static boolean isJavaLetter(char ch), A
     * character may start a Java identifier if and only if one of the
     * following is true:
     *

     *
isLetter(ch) returns true
     *
getType(ch) returns LETTER_NUMBER
     *
ch is a currency symbol (such as "$")
     *
ch is a connecting punctuation character (such as "_").
     *

     * All Unicode code points in the BMP (0x0000..0xFFFF) are tested.
     */
    public static void testIsJavaLetter() {
        for (int i = 0; i <= Character.MAX_VALUE; ++i) {
            char ch = (char) i;
            boolean expected = false;
            // Since Character.isJavaLetter(char) strictly conforms to
            // character information from version 6.2 of the Unicode Standard,
            // check if code point is in "UNASSIGNED_CODEPOINTS_IN_6_2"
            // list. If the code point is found in list
            // "UNASSIGNED_CODEPOINTS_IN_6_2", value of variable
            if (!UNASSIGNED_CODEPOINTS_IN_6_2.contains(i)) {
                byte type = (byte) Character.getType(ch);
                expected = Character.isLetter(ch) || type == Character.LETTER_NUMBER || type == Character.CURRENCY_SYMBOL || type == Character.CONNECTOR_PUNCTUATION;
            }
            if (Character.isJavaLetter(ch) != expected) {
                throw new RuntimeException("Character.isJavaLetter(ch) failed for codepoint " + Integer.toHexString(i));
            }
        }
    }

    /**
     * Assertion testing for public static boolean isJavaLetterOrDigit(char
     * ch), A character may be part of a Java identifier if and only if any
     *  of the following are true:
     *

     *
it is a letter
     *
it is a currency symbol (such as '$')
     *
it is a connecting punctuation character (such as '_')
     *
it is a digit
     *
it is a numeric letter (such as a Roman numeral character)
     *
it is a combining mark
     *
it is a non-spacing mark
     *
isIdentifierIgnorable returns true for the character.
     *

     * All Unicode code points in the BMP (0x0000..0xFFFF) are tested.
     */
    public static void testIsJavaLetterOrDigit() {
        for (int i = 0; i <= Character.MAX_VALUE; ++i) {
            char ch = (char) i;
            boolean expected = false;
            // Since Character.isJavaLetterOrDigit(char) strictly conforms to
            // character information from version 6.2 of the Unicode Standard,
            // check if code point is in "UNASSIGNED_CODEPOINTS_IN_6_2"
            // list. If the code point is found in list
            // "UNASSIGNED_CODEPOINTS_IN_6_2", value of variable
            if (!UNASSIGNED_CODEPOINTS_IN_6_2.contains(i)) {
                byte type = (byte) Character.getType(ch);
                expected = Character.isLetter(ch) || type == Character.CURRENCY_SYMBOL || type == Character.CONNECTOR_PUNCTUATION || Character.isDigit(ch) || type == Character.LETTER_NUMBER || type == Character.COMBINING_SPACING_MARK || type == Character.NON_SPACING_MARK || Character.isIdentifierIgnorable(ch);
            }
            if (Character.isJavaLetterOrDigit(ch) != expected) {
                throw new RuntimeException("Character.isJavaLetterOrDigit(ch) failed for codepoint " + Integer.toHexString(i));
            }
        }
    }
}