text:
import boto
from boto.utils import find_class
import uuid
from boto.sdb.db.key import Key
from boto.sdb.db.model import Model
from datetime import datetime
from boto.exception import SDBPersistenceError

ISO8601 = '%Y-%m-%dT%H:%M:%SZ'

class SDBConverter:
    """
    Responsible for converting base Python types to format compatible with underlying
    database.  For SimpleDB, that means everything needs to be converted to a string
    when stored in SimpleDB and from a string when retrieved.

    To convert a value, pass it to the encode or decode method.  The encode method
    will take a Python native value and convert to DB format.  The decode method will
    take a DB format value and convert it to Python native format.  To find the appropriate
    method to call, the generic encode/decode methods will look for the type-specific
    method by searching for a method called "encode_<type name>" or "decode_<type name>".
    """
    def __init__(self, manager):
        self.manager = manager
        self.type_map = { bool : (self.encode_bool, self.decode_bool),
                          int : (self.encode_int, self.decode_int),
                          long : (self.encode_long, self.decode_long),
                          Model : (self.encode_reference, self.decode_reference),
                          Key : (self.encode_reference, self.decode_reference),
                          datetime : (self.encode_datetime, self.decode_datetime)}

    def encode(self, item_type, value):
        if item_type in self.type_map:
            encode = self.type_map[item_type][0]
            return encode(value)
        return value

    def decode(self, item_type, value):
        if item_type in self.type_map:
            decode = self.type_map[item_type][1]
            return decode(value)
        return value

    def encode_prop(self, prop, value):
        if isinstance(value, list):
            if hasattr(prop, 'item_type'):
                new_value = []
                for v in value:
                    item_type = getattr(prop, "item_type")
                    if Model in item_type.mro():
                        item_type = Model
                    new_value.append(self.encode(item_type, v))
                return new_value
            else:
                return value
        else:
            return self.encode(prop.data_type, value)

    def decode_prop(self, prop, value):
        if prop.data_type == list:
            if not isinstance(value, list):
                value = [value]
            if hasattr(prop, 'item_type'):
                item_type = getattr(prop, "item_type")
                if Model in item_type.mro():
                    if item_type != self.manager.cls:
                        return item_type._manager.decode_value(prop, value)
                    else:
                        item_type = Model
                return [self.decode(item_type, v) for v in value]
            else:
                return value
        elif hasattr(prop, 'reference_class'):
            ref_class = getattr(prop, 'reference_class')
            if ref_class != self.manager.cls:
                return ref_class._manager.decode_value(prop, value)
            else:
                return self.decode(prop.data_type, value)
        else:
            return self.decode(prop.data_type, value)

    def encode_int(self, value):
        value = int(value)
        value += 2147483648
        return '%010d' % value

    def decode_int(self, value):
        value = int(value)
        value -= 2147483648
        return int(value)

    def encode_long(self, value):
        value = long(value)
        value += 9223372036854775808
        return '%020d' % value

    def decode_long(self, value):
        value = long(value)
        value -= 9223372036854775808
        return value

    def encode_bool(self, value):
        if value == True:
            return 'true'
        else:
            return 'false'

    def decode_bool(self, value):
        if value.lower() == 'true':
            return True
        else:
            return False

    def encode_datetime(self, value):
        return value.strftime(ISO8601)

    def decode_datetime(self, value):
        try:
            return datetime.strptime(value, ISO8601)
        except:
            return None

    def encode_reference(self, value):
        if isinstance(value, str) or isinstance(value, unicode):
            return value
        if value == None:
            return ''
        else:
            return value.id

    def decode_reference(self, value):
        if not value:
            return None
        try:
            return self.manager.get_object_from_id(value)
        except:
            return None

class SDBManager(object):

    def __init__(self, cls, db_name, db_user, db_passwd,
                 db_host, db_port, db_table, ddl_dir):
        self.cls = cls
        self.db_name = db_name
        self.db_user = db_user
        self.db_passwd = db_passwd
        self.db_host = db_host
        self.db_port = db_port
        self.db_table = db_table
        self.ddl_dir = ddl_dir
        self.s3 = None
        self.converter = SDBConverter(self)
        self._connect()

    def _connect(self):
        self.sdb = boto.connect_sdb(aws_access_key_id=self.db_user,
                                    aws_secret_access_key=self.db_passwd)
        self.domain = self.sdb.lookup(self.db_name)
        if not self.domain:
            self.domain = self.sdb.create_domain(self.db_name)

    def _object_lister(self, cls, query_lister):
        for item in query_lister:
            yield self.get_object(None, item.name, item)

    def encode_value(self, prop, value):
        return self.converter.encode_prop(prop, value)

    def decode_value(self, prop, value):
        return self.converter.decode_prop(prop, value)

    def get_s3_connection(self):
        if not self.s3:
            self.s3 = boto.connect_s3(self.aws_access_key_id, self.aws_secret_access_key)
        return self.s3

    def get_object(self, cls, id, a=None):
        if not a:
            a = self.domain.get_attributes(id)
        if not a.has_key('__type__'):
            raise SDBPersistenceError('object %s does not exist' % id)
        if not cls:
            cls = find_class(a['__module__'], a['__type__'])
        obj = cls(id)
        obj._auto_update = False
        for prop in obj.properties(hidden=False):
            if prop.data_type != Key:
                if a.has_key(prop.name):
                    value = self.decode_value(prop, a[prop.name])
                    value = prop.make_value_from_datastore(value)
                    setattr(obj, prop.name, value)
        obj._auto_update = True
        return obj

    def get_object_from_id(self, id):
        return self.get_object(None, id)

    def query(self, cls, filters, limit=None, order_by=None):
        import types
        if len(filters) > 4:
            raise SDBPersistenceError('Too many filters, max is 4')
        s = "['__type__'='%s'" % cls.__name__
        for subclass in cls.__sub_classes__:
            s += " OR '__type__'='%s'" % subclass.__name__
        s += "]"
        parts = [s]
        properties = cls.properties(hidden=False)
        for filter, value in filters:
            name, op = filter.strip().split()
            found = False
            for property in properties:
                if property.name == name:
                    found = True
                    if types.TypeType(value) == types.ListType:
                        filter_parts = []
                        for val in value:
                            val = self.encode_value(property, val)
                            filter_parts.append("'%s' %s '%s'" % (name, op, val))
                        parts.append("[%s]" % " OR ".join(filter_parts))
                    else:
                        value = self.encode_value(property, value)
                        parts.append("['%s' %s '%s']" % (name, op, value))
            if not found:
                raise SDBPersistenceError('%s is not a valid field' % name)
        if order_by:
            if order_by.startswith("-"):
                key = order_by[1:]
                type = "desc"
            else:
                key = order_by
                type = "asc"
            parts.append("['%s' starts-with ''] sort '%s' %s" % (key, key, type))
        query = ' intersection '.join(parts)
        rs = self.domain.query(query, max_items=limit)
        return self._object_lister(cls, rs)

    def query_gql(self, query_string, *args, **kwds):
        raise NotImplementedError, "GQL queries not supported in SimpleDB"

    def save_object(self, obj):
        obj._auto_update = False
        if not obj.id:
            obj.id = str(uuid.uuid4())

        attrs = {'__type__' : obj.__class__.__name__,
                 '__module__' : obj.__class__.__module__,
                 '__lineage__' : obj.get_lineage()}
        for property in obj.properties(hidden=False):
            value = property.get_value_for_datastore(obj)
            if value is not None:
                value = self.encode_value(property, value)
                attrs[property.name] = value
            if property.unique:
                try:
                    args = {property.name: value}
                    obj2 = obj.find(**args).next()
                    if obj2.id != obj.id:
                        raise SDBPersistenceError("Error: %s must be unique!" % property.name)
                except(StopIteration):
                    pass
        self.domain.put_attributes(obj.id, attrs, replace=True)
        obj._auto_update = True

    def delete_object(self, obj):
        self.domain.delete_attributes(obj.id)

    def set_property(self, prop, obj, name, value):
        value = prop.get_value_for_datastore(obj)
        value = self.encode_value(prop, value)
        if prop.unique:
            try:
                args = {prop.name: value}
                obj2 = obj.find(**args).next()
                if obj2.id != obj.id:
                    raise SDBPersistenceError("Error: %s must be unique!" % prop.name)
            except(StopIteration):
                pass
        self.domain.put_attributes(obj.id, {name : value}, replace=True)

    def get_property(self, prop, obj, name):
        a = self.domain.get_attributes(obj.id, name)
        # try to get the attribute value from SDB
        if name in a:
            value = self.decode_value(prop, a[name])
            return prop.make_value_from_datastore(value)
        raise AttributeError, '%s not found' % name

    def set_key_value(self, obj, name, value):
        self.domain.put_attributes(obj.id, {name : value}, replace=True)

    def delete_key_value(self, obj, name):
        self.domain.delete_attributes(obj.id, name)

    def get_key_value(self, obj, name):
        a = self.domain.get_attributes(obj.id, name)
        if a.has_key(name):
            return a[name]
        else:
            return None

    def get_raw_item(self, obj):
        return self.domain.get_item(obj.id)


text:
<!DOCTYPE html>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta content="IE=edge" http-equiv="X-UA-Compatible">

<link rel="shortcut icon" type="image/x-icon" href="../../../favicon.ico" />
<title>NetworkCapabilities - Android SDK | Android Developers</title>

<link rel="stylesheet"
href="http://fonts.googleapis.com/css?family=Roboto+Condensed">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:light,regular,medium,thin,italic,mediumitalic,bold"
  title="roboto">

<link href="../../../assets/css/default.css?v=7" rel="stylesheet" type="text/css">

<link href="../../../assets/css/fullscreen.css" rel="stylesheet" class="fullscreen"
type="text/css">

           Developers

NetworkCapabilities - Android SDK

      <form class="dac-header-search-form" onsubmit="return submit_search()">
        <input id="search_autocomplete" type="text" value="" autocomplete="off" name="q"
          onfocus="search_focus_changed(this, true)" onblur="search_focus_changed(this, false)"
          onkeydown="return search_changed(event, true, '../../../')"
          onkeyup="return search_changed(event, false, '../../../')"
          class="dac-header-search-input" placeholder="Search" />
          close
      </form>

          Developer
          Console

Results

Loading...

           Developers

        Home

            Android

            Wear

            TV

            Auto

        Design

        Develop

            Training

            API Guides

            Reference

            Tools

            Google Services

            Preview

        Distribute

            Google Play

            Essentials

            Get Users

            Engage & Retain

            Earn

            Analyze

            Stories

          API level:

            <select id="apiLevelSelector">

            </select>

Android APIs

  android

  android.accessibilityservice

  android.accounts

  android.animation

  android.annotation

  android.app

  android.app.admin

  android.app.assist

  android.app.backup

  android.app.job

  android.app.usage

  android.appwidget

  android.bluetooth

  android.bluetooth.le

  android.content

  android.content.pm

  android.content.res

  android.database

  android.database.sqlite

  android.databinding

  android.drm

  android.gesture

  android.graphics

  android.graphics.drawable

  android.graphics.drawable.shapes

  android.graphics.pdf

  android.hardware

  android.hardware.camera2

  android.hardware.camera2.params

  android.hardware.display

  android.hardware.fingerprint

  android.hardware.input

  android.hardware.usb

  android.inputmethodservice

  android.location

  android.media

  android.media.audiofx

  android.media.browse

  android.media.effect

  android.media.midi

  android.media.projection

  android.media.session

  android.media.tv

  android.mtp

  android.net

  android.net.http

  android.net.nsd

  android.net.rtp

  android.net.sip

  android.net.wifi

  android.net.wifi.p2p

  android.net.wifi.p2p.nsd

  android.nfc

  android.nfc.cardemulation

  android.nfc.tech

  android.opengl

  android.os

  android.os.storage

  android.preference

  android.print

  android.print.pdf

  android.printservice

  android.provider

  android.renderscript

  android.sax

  android.security

  android.security.keystore

  android.service.carrier

  android.service.chooser

  android.service.dreams

  android.service.media

  android.service.notification

  android.service.restrictions

  android.service.textservice

  android.service.voice

  android.service.wallpaper

  android.speech

  android.speech.tts

  android.support.annotation

  android.support.app.recommendation

  android.support.customtabs

  android.support.design

  android.support.design.widget

  android.support.multidex

  android.support.percent

  android.support.v13.app

  android.support.v14.preference

  android.support.v17.leanback

  android.support.v17.leanback.app

  android.support.v17.leanback.database

  android.support.v17.leanback.graphics

  android.support.v17.leanback.system

  android.support.v17.leanback.widget

  android.support.v17.preference

  android.support.v4.accessibilityservice

  android.support.v4.animation

  android.support.v4.app

  android.support.v4.content

  android.support.v4.content.pm

  android.support.v4.content.res

  android.support.v4.database

  android.support.v4.graphics

  android.support.v4.graphics.drawable

  android.support.v4.hardware.display

  android.support.v4.hardware.fingerprint

  android.support.v4.media

  android.support.v4.media.session

  android.support.v4.net

  android.support.v4.os

  android.support.v4.print

  android.support.v4.provider

  android.support.v4.text

  android.support.v4.util

  android.support.v4.view

  android.support.v4.view.accessibility

  android.support.v4.view.animation

  android.support.v4.widget

  android.support.v7.app

  android.support.v7.appcompat

  android.support.v7.cardview

  android.support.v7.graphics

  android.support.v7.graphics.drawable

  android.support.v7.gridlayout

  android.support.v7.media

  android.support.v7.mediarouter

  android.support.v7.preference

  android.support.v7.recyclerview

  android.support.v7.util

  android.support.v7.view

  android.support.v7.widget

  android.support.v7.widget.helper

  android.support.v7.widget.util

  android.support.v8.renderscript

  android.system

  android.telecom

  android.telephony

  android.telephony.cdma

  android.telephony.gsm

  android.test

  android.test.mock

  android.test.suitebuilder

  android.test.suitebuilder.annotation

  android.text

  android.text.format

  android.text.method

  android.text.style

  android.text.util

  android.transition

  android.util

  android.view

  android.view.accessibility

  android.view.animation

  android.view.inputmethod

  android.view.textservice

  android.webkit

  android.widget

  com.android.internal.backup

  com.android.internal.logging

  com.android.internal.os

  com.android.internal.statusbar

  com.android.internal.widget

  com.android.test.runner

  dalvik.annotation

  dalvik.bytecode

  dalvik.system

  java.awt.font

  java.beans

  java.io

  java.lang

  java.lang.annotation

  java.lang.ref

  java.lang.reflect

  java.math

  java.net

  java.nio

  java.nio.channels

  java.nio.channels.spi

  java.nio.charset

  java.nio.charset.spi

  java.security

  java.security.acl

  java.security.cert

  java.security.interfaces

  java.security.spec

  java.sql

  java.text

  java.util

  java.util.concurrent

  java.util.concurrent.atomic

  java.util.concurrent.locks

  java.util.jar

  java.util.logging

  java.util.prefs

  java.util.regex

  java.util.zip

  javax.crypto

  javax.crypto.interfaces

  javax.crypto.spec

  javax.microedition.khronos.egl

  javax.microedition.khronos.opengles

  javax.net

  javax.net.ssl

  javax.security.auth

  javax.security.auth.callback

  javax.security.auth.login

  javax.security.auth.x500

  javax.security.cert

  javax.sql

  javax.xml

  javax.xml.datatype

  javax.xml.namespace

  javax.xml.parsers

  javax.xml.transform

  javax.xml.transform.dom

  javax.xml.transform.sax

  javax.xml.transform.stream

  javax.xml.validation

  javax.xml.xpath

  junit.framework

  junit.runner

  org.apache.http.conn

  org.apache.http.conn.scheme

  org.apache.http.conn.ssl

  org.apache.http.params

  org.json

  org.w3c.dom

  org.w3c.dom.ls

  org.xml.sax

  org.xml.sax.ext

  org.xml.sax.helpers

  org.xmlpull.v1

  org.xmlpull.v1.sax2

Interfaces

ConnectivityManager.OnNetworkActiveListener

UrlQuerySanitizer.ValueSanitizer

Classes

CaptivePortal

ConnectivityManager

ConnectivityManager.NetworkCallback

Credentials

DhcpInfo

IpPrefix

LinkAddress

LinkProperties

LocalServerSocket

LocalSocket

LocalSocketAddress

MailTo

Network

NetworkCapabilities

NetworkInfo

NetworkRequest

NetworkRequest.Builder

Proxy

ProxyInfo

PskKeyManager

RouteInfo

SSLCertificateSocketFactory

SSLSessionCache

TrafficStats

Uri

Uri.Builder

UrlQuerySanitizer

UrlQuerySanitizer.IllegalCharacterValueSanitizer

UrlQuerySanitizer.ParameterValuePair

VpnService

VpnService.Builder

Enums

LocalSocketAddress.Namespace

NetworkInfo.DetailedState

NetworkInfo.State

Exceptions

ParseException

      fullscreen
      Use Tree NavigationUse Panel Navigation

Summary:

  Constants

  | Inherited Constants

  | Fields

  | Ctors

  | Methods

  | Inherited Methods

| [Expand All]

  Added in API level 21

    public

    final

    class

NetworkCapabilities

    extends Object

      implements

        Parcelable

        java.lang.Object

               ↳

        android.net.NetworkCapabilities

Class Overview

This class represents the capabilities of a network.  This is used both to specify
 needs to ConnectivityManager and when inspecting a network.

 Note that this replaces the old TYPE_MOBILE method
 of network selection.  Rather than indicate a need for Wi-Fi because an application
 needs high bandwidth and risk obsolescence when a new, fast network appears (like LTE),
 the application should specify it needs high bandwidth.  Similarly if an application
 needs an unmetered network for a bulk transfer it can specify that rather than assuming
 all cellular based connections are metered and all Wi-Fi based connections are not.

Summary

Constants

        int
        NET_CAPABILITY_CAPTIVE_PORTAL

          Indicates that this network was found to have a captive portal in place last time it was
 probed.

        int
        NET_CAPABILITY_CBS

          Indicates this is a network that has the ability to reach the carrier's
 CBS servers, used for carrier specific services.

        int
        NET_CAPABILITY_DUN

          Indicates this is a network that has the ability to reach the carrier's
 DUN or tethering gateway.

        int
        NET_CAPABILITY_EIMS

          Indicates this is a network that has the ability to reach a carrier's
 Emergency IMS servers or other services, used for network signaling
 during emergency calls.

        int
        NET_CAPABILITY_FOTA

          Indicates this is a network that has the ability to reach the carrier's
 FOTA portal, used for over the air updates.

        int
        NET_CAPABILITY_IA

          Indicates this is a network that has the ability to reach a carrier's
 Initial Attach servers.

        int
        NET_CAPABILITY_IMS

          Indicates this is a network that has the ability to reach the carrier's
 IMS servers, used for network registration and signaling.

        int
        NET_CAPABILITY_INTERNET

          Indicates that this network should be able to reach the internet.

        int
        NET_CAPABILITY_MMS

          Indicates this is a network that has the ability to reach the
 carrier's MMSC for sending and receiving MMS messages.

        int
        NET_CAPABILITY_NOT_METERED

          Indicates that this network is unmetered.

        int
        NET_CAPABILITY_NOT_RESTRICTED

          Indicates that this network is available for general use.

        int
        NET_CAPABILITY_NOT_VPN

          Indicates that this network is not a VPN.

        int
        NET_CAPABILITY_RCS

          Indicates this is a network that has the ability to reach a carrier's
 RCS servers, used for Rich Communication Services.

        int
        NET_CAPABILITY_SUPL

          Indicates this is a network that has the ability to reach the carrier's
 SUPL server, used to retrieve GPS information.

        int
        NET_CAPABILITY_TRUSTED

          Indicates that the user has indicated implicit trust of this network.

        int
        NET_CAPABILITY_VALIDATED

          Indicates that connectivity on this network was successfully validated.

        int
        NET_CAPABILITY_WIFI_P2P

          Indicates this is a network that has the ability to reach a Wi-Fi direct
 peer.

        int
        NET_CAPABILITY_XCAP

          Indicates this is a network that has the ability to reach a carrier's
 XCAP servers, used for configuration and control.

        int
        TRANSPORT_BLUETOOTH

          Indicates this network uses a Bluetooth transport.

        int
        TRANSPORT_CELLULAR

          Indicates this network uses a Cellular transport.

        int
        TRANSPORT_ETHERNET

          Indicates this network uses an Ethernet transport.

        int
        TRANSPORT_VPN

          Indicates this network uses a VPN transport.

        int
        TRANSPORT_WIFI

          Indicates this network uses a Wi-Fi transport.

  [Expand]

Inherited Constants

  From interface
android.os.Parcelable

        int
        CONTENTS_FILE_DESCRIPTOR

          Bit masks for use with describeContents(): each bit represents a
 kind of object considered to have potential special significance when
 marshalled.

        int
        PARCELABLE_WRITE_RETURN_VALUE

          Flag for use with writeToParcel(Parcel, int): the object being written
 is a return value, that is the result of a function such as
 "Parcelable someFunction()",
 "void someFunction(out Parcelable)", or
 "void someFunction(inout Parcelable)".

Fields

          <nobr>
          public
          static
          final
          Creator<NetworkCapabilities></nobr>
          CREATOR

Public Constructors

        <nobr>

            </nobr>

        <nobr>
        NetworkCapabilities(NetworkCapabilities nc)</nobr>

Public Methods

        <nobr>

            int</nobr>

        <nobr>
        describeContents()</nobr>

          Describe the kinds of special objects contained in this Parcelable's
 marshalled representation.

        <nobr>

            boolean</nobr>

        <nobr>
        equals(Object obj)</nobr>

          Compares this instance with the specified object and indicates if they
 are equal.

        <nobr>

            int</nobr>

        <nobr>
        getLinkDownstreamBandwidthKbps()</nobr>

          Retrieves the downstream bandwidth for this network in Kbps.

        <nobr>

            int</nobr>

        <nobr>
        getLinkUpstreamBandwidthKbps()</nobr>

          Retrieves the upstream bandwidth for this network in Kbps.

        <nobr>

            boolean</nobr>

        <nobr>
        hasCapability(int capability)</nobr>

          Tests for the presence of a capabilitity on this instance.

        <nobr>

            boolean</nobr>

        <nobr>
        hasTransport(int transportType)</nobr>

          Tests for the presence of a transport on this instance.

        <nobr>

            int</nobr>

        <nobr>
        hashCode()</nobr>

          Returns an integer hash code for this object.

        <nobr>

            String</nobr>

        <nobr>
        toString()</nobr>

          Returns a string containing a concise, human-readable description of this
 object.

        <nobr>

            void</nobr>

        <nobr>
        writeToParcel(Parcel dest, int flags)</nobr>

          Flatten this object in to a Parcel.

  [Expand]

Inherited Methods

From class

  java.lang.Object

        <nobr>

            Object</nobr>

        <nobr>
        clone()</nobr>

          Creates and returns a copy of this Object.

        <nobr>

            boolean</nobr>

        <nobr>
        equals(Object o)</nobr>

          Compares this instance with the specified object and indicates if they
 are equal.

        <nobr>

            void</nobr>

        <nobr>
        finalize()</nobr>

          Invoked when the garbage collector has detected that this instance is no longer reachable.

        <nobr>

            final

            Class<?></nobr>

        <nobr>
        getClass()</nobr>

          Returns the unique instance of Class that represents this
 object's class.

        <nobr>

            int</nobr>

        <nobr>
        hashCode()</nobr>

          Returns an integer hash code for this object.

        <nobr>

            final

            void</nobr>

        <nobr>
        notify()</nobr>

          Causes a thread which is waiting on this object's monitor (by means of
 calling one of the wait() methods) to be woken up.

        <nobr>

            final

            void</nobr>

        <nobr>
        notifyAll()</nobr>

          Causes all threads which are waiting on this object's monitor (by means
 of calling one of the wait() methods) to be woken up.

        <nobr>

            String</nobr>

        <nobr>
        toString()</nobr>

          Returns a string containing a concise, human-readable description of this
 object.

        <nobr>

            final

            void</nobr>

        <nobr>
        wait()</nobr>

          Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.

        <nobr>

            final

            void</nobr>

        <nobr>
        wait(long millis, int nanos)</nobr>

          Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
 specified timeout expires.

        <nobr>

            final

            void</nobr>

        <nobr>
        wait(long millis)</nobr>

          Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
 specified timeout expires.

From interface

  android.os.Parcelable

        <nobr>
            abstract

            int</nobr>

        <nobr>
        describeContents()</nobr>

          Describe the kinds of special objects contained in this Parcelable's
 marshalled representation.

        <nobr>
            abstract

            void</nobr>

        <nobr>
        writeToParcel(Parcel dest, int flags)</nobr>

          Flatten this object in to a Parcel.

Constants

        public
        static
        final
        int

        NET_CAPABILITY_CAPTIVE_PORTAL

  Added in API level 23

Indicates that this network was found to have a captive portal in place last time it was
 probed.

        Constant Value:

                17
                (0x00000011)

        public
        static
        final
        int

        NET_CAPABILITY_CBS

  Added in API level 21

Indicates this is a network that has the ability to reach the carrier's
 CBS servers, used for carrier specific services.

        Constant Value:

                5
                (0x00000005)

        public
        static
        final
        int

        NET_CAPABILITY_DUN

  Added in API level 21

Indicates this is a network that has the ability to reach the carrier's
 DUN or tethering gateway.

        Constant Value:

                2
                (0x00000002)

        public
        static
        final
        int

        NET_CAPABILITY_EIMS

  Added in API level 21

Indicates this is a network that has the ability to reach a carrier's
 Emergency IMS servers or other services, used for network signaling
 during emergency calls.

        Constant Value:

                10
                (0x0000000a)

        public
        static
        final
        int

        NET_CAPABILITY_FOTA

  Added in API level 21

Indicates this is a network that has the ability to reach the carrier's
 FOTA portal, used for over the air updates.

        Constant Value:

                3
                (0x00000003)

        public
        static
        final
        int

        NET_CAPABILITY_IA

  Added in API level 21

Indicates this is a network that has the ability to reach a carrier's
 Initial Attach servers.

        Constant Value:

                7
                (0x00000007)

        public
        static
        final
        int

        NET_CAPABILITY_IMS

  Added in API level 21

Indicates this is a network that has the ability to reach the carrier's
 IMS servers, used for network registration and signaling.

        Constant Value:

                4
                (0x00000004)

        public
        static
        final
        int

        NET_CAPABILITY_INTERNET

  Added in API level 21

Indicates that this network should be able to reach the internet.

        Constant Value:

                12
                (0x0000000c)

        public
        static
        final
        int

        NET_CAPABILITY_MMS

  Added in API level 21

Indicates this is a network that has the ability to reach the
 carrier's MMSC for sending and receiving MMS messages.

        Constant Value:

                0
                (0x00000000)

        public
        static
        final
        int

        NET_CAPABILITY_NOT_METERED

  Added in API level 21

Indicates that this network is unmetered.

        Constant Value:

                11
                (0x0000000b)

        public
        static
        final
        int

        NET_CAPABILITY_NOT_RESTRICTED

  Added in API level 21

Indicates that this network is available for general use.  If this is not set
 applications should not attempt to communicate on this network.  Note that this
 is simply informative and not enforcement - enforcement is handled via other means.
 Set by default.

        Constant Value:

                13
                (0x0000000d)

        public
        static
        final
        int

        NET_CAPABILITY_NOT_VPN

  Added in API level 21

Indicates that this network is not a VPN.  This capability is set by default and should be
 explicitly cleared for VPN networks.

        Constant Value:

                15
                (0x0000000f)

        public
        static
        final
        int

        NET_CAPABILITY_RCS

  Added in API level 21

Indicates this is a network that has the ability to reach a carrier's
 RCS servers, used for Rich Communication Services.

        Constant Value:

                8
                (0x00000008)

        public
        static
        final
        int

        NET_CAPABILITY_SUPL

  Added in API level 21

Indicates this is a network that has the ability to reach the carrier's
 SUPL server, used to retrieve GPS information.

        Constant Value:

                1
                (0x00000001)

        public
        static
        final
        int

        NET_CAPABILITY_TRUSTED

  Added in API level 21

Indicates that the user has indicated implicit trust of this network.  This
 generally means it's a sim-selected carrier, a plugged in ethernet, a paired
 BT device or a wifi the user asked to connect to.  Untrusted networks
 are probably limited to unknown wifi AP.  Set by default.

        Constant Value:

                14
                (0x0000000e)

        public
        static
        final
        int

        NET_CAPABILITY_VALIDATED

  Added in API level 23

Indicates that connectivity on this network was successfully validated. For example, for a
 network with NET_CAPABILITY_INTERNET, it means that Internet connectivity was successfully
 detected.

        Constant Value:

                16
                (0x00000010)

        public
        static
        final
        int

        NET_CAPABILITY_WIFI_P2P

  Added in API level 21

Indicates this is a network that has the ability to reach a Wi-Fi direct
 peer.

        Constant Value:

                6
                (0x00000006)

        public
        static
        final
        int

        NET_CAPABILITY_XCAP

  Added in API level 21

Indicates this is a network that has the ability to reach a carrier's
 XCAP servers, used for configuration and control.

        Constant Value:

                9
                (0x00000009)

        public
        static
        final
        int

        TRANSPORT_BLUETOOTH

  Added in API level 21

Indicates this network uses a Bluetooth transport.

        Constant Value:

                2
                (0x00000002)

        public
        static
        final
        int

        TRANSPORT_CELLULAR

  Added in API level 21

Indicates this network uses a Cellular transport.

        Constant Value:

                0
                (0x00000000)

        public
        static
        final
        int

        TRANSPORT_ETHERNET

  Added in API level 21

Indicates this network uses an Ethernet transport.

        Constant Value:

                3
                (0x00000003)

        public
        static
        final
        int

        TRANSPORT_VPN

  Added in API level 21

Indicates this network uses a VPN transport.

        Constant Value:

                4
                (0x00000004)

        public
        static
        final
        int

        TRANSPORT_WIFI

  Added in API level 21

Indicates this network uses a Wi-Fi transport.

        Constant Value:

                1
                (0x00000001)

Fields

        public
        static
        final
        Creator<NetworkCapabilities>

        CREATOR

  Added in API level 21

Public Constructors

        public

      NetworkCapabilities
      (NetworkCapabilities nc)

  Added in API level 21

Public Methods

        public

        int

      describeContents
      ()

  Added in API level 21

Describe the kinds of special objects contained in this Parcelable's
 marshalled representation.

Returns

a bitmask indicating the set of special object types marshalled
 by the Parcelable.

        public

        boolean

      equals
      (Object obj)

  Added in API level 21

Compares this instance with the specified object and indicates if they
 are equal. In order to be equal, o must represent the same object
 as this instance using a class-specific comparison. The general contract
 is that this comparison should be reflexive, symmetric, and transitive.
 Also, no object reference other than null is equal to null.

The default implementation returns true only if this ==
 o. See Writing a correct
 equals method
 if you intend implementing your own equals method.

The general contract for the equals and hashCode() methods is that if equals returns true for
 any two objects, then hashCode() must return the same value for
 these objects. This means that subclasses of Object usually
 override either both methods or neither of them.

Parameters

          obj
          the object to compare this instance with.

Returns

true if the specified object is equal to this Object; false otherwise.

        public

        int

      getLinkDownstreamBandwidthKbps
      ()

  Added in API level 21

Retrieves the downstream bandwidth for this network in Kbps.  This always only refers to
 the estimated first hop transport bandwidth.

Returns

The estimated first hop downstream (network to device) bandwidth.

        public

        int

      getLinkUpstreamBandwidthKbps
      ()

  Added in API level 21

Retrieves the upstream bandwidth for this network in Kbps.  This always only refers to
 the estimated first hop transport bandwidth.

Returns

The estimated first hop upstream (device to network) bandwidth.

        public

        boolean

      hasCapability
      (int capability)

  Added in API level 21

Tests for the presence of a capabilitity on this instance.

Parameters

          capability
          the NetworkCapabilities.NET_CAPABILITY_* to be tested for.

Returns

true if set on this instance.

        public

        boolean

      hasTransport
      (int transportType)

  Added in API level 21

Tests for the presence of a transport on this instance.

Parameters

          transportType
          the NetworkCapabilities.TRANSPORT_* to be tested for.

Returns

true if set on this instance.

        public

        int

      hashCode
      ()

  Added in API level 21

Returns an integer hash code for this object. By contract, any two
 objects for which equals(Object) returns true must return
 the same hash code value. This means that subclasses of Object
 usually override both methods or neither method.

Note that hash values must not change over time unless information used in equals
 comparisons also changes.

See Writing a correct
 hashCode method
 if you intend implementing your own hashCode method.

Returns

this object's hash code.

        public

        String

      toString
      ()

  Added in API level 21

Returns a string containing a concise, human-readable description of this
 object. Subclasses are encouraged to override this method and provide an
 implementation that takes into account the object's type and data. The
 default implementation is equivalent to the following expression:

   getClass().getName() + '@' + Integer.toHexString(hashCode())

See Writing a useful
 toString method
 if you intend implementing your own toString method.

Returns

a printable representation of this object.

        public

        void

      writeToParcel
      (Parcel dest, int flags)

  Added in API level 21

Flatten this object in to a Parcel.

Parameters

          dest
          The Parcel in which the object should be written.

          flags
          Additional flags about how the object should be written.
 May be 0 or PARCELABLE_WRITE_RETURN_VALUE.

        Get news & tips

          Blog
          Support

  Except as noted, this content is licensed under Apache 2.0.
  For details and restrictions, see the
  Content License.

    Android 6.0 r1 —

      About Android
      Auto
      TV
      Wear
      Legal

        <select name="language" onchange="changeLangPref(this.value, true)">
          <option value="en" selected="selected">English</option>
          <option value="es">Español</option>
          <option value="ja">日本語</option>
          <option value="ko">한국어</option>
          <option value="pt-br">Português Brasileiro</option>
          <option value="ru">Русский</option>
          <option value="zh-cn">中文(简体)</option>
          <option value="zh-tw">中文(繁體)</option>
        </select>

        <button class="dac-modal-header-close" data-modal-toggle></button>

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

          <form action="https://docs.google.com/forms/d/1QgnkzbEJIDu9lMEea0mxqWrXUJu0oBCLD7ar23V0Yys/formResponse" class="dac-form" method="post" target="dac-newsletter-iframe">

              <fieldset class="dac-form-fieldset">

                      Full name
                      <input type="text" class="dac-form-input" name="entry.1357890476" id="newsletter-full-name" required>
                      *

                      Email address
                      <input type="email" class="dac-form-input" name="entry.472100832" id="newsletter-email" required>
                      *

                      Company / developer name
                      <input type="text" class="dac-form-input" name="entry.1664780309" id="newsletter-company">

                      One of your Play Store app URLs
                      <input type="url" class="dac-form-input" name="entry.47013838" id="newsletter-play-store" required>
                      *

              </fieldset>
              <fieldset class="dac-form-fieldset">

                    <legend class="dac-form-legend">Which best describes your business:*
                    </legend>

                      <input type="radio" value="Apps" class="dac-form-radio" name="entry.1796324055" id="newsletter-business-type-app" required>

                      Apps

                      <input type="radio" value="Games" class="dac-form-radio" name="entry.1796324055" id="newsletter-business-type-games" required>

                      Games

                      <input type="radio" value="Apps and Games" class="dac-form-radio" name="entry.1796324055" id="newsletter-business-type-appsgames" required>

                      Apps & Games

                          <input type="checkbox" class="dac-form-checkbox" name="entry.732309842" id="newsletter-add" required value="Add me to the mailing list for the monthly newsletter and occasional emails about development and Google Play opportunities.">

                          Add me to the mailing list for the monthly newsletter and occasional emails about development and Google Play opportunities.*

                          <input type="checkbox" class="dac-form-checkbox" name="entry.2045036090" id="newsletter-terms" required value="I acknowledge that the information provided in this form will be subject to Google's privacy policy (https://www.google.com/policies/privacy/).">

                          I acknowledge that the information provided in this form will be subject to Google's privacy policy.*

              </fieldset>

              <button type="submit" value="Submit" class="dac-fab dac-primary dac-large dac-modal-action"></button>

          </form>

              You have successfully signed up for the latest Android developer news and tips.

redpajama_set_name: RedPajamaGithub


text:
using UnityEngine;
using System.Collections;

public class WanderScripte : MonoBehaviour {

  //  Transform player;
    NavMeshAgent Agent;
    public enum States
    {
        idle,
        walk,
        rotate,
        pursue,
        retreat,
        possessed,

    };

    public States AIStates = States.idle;
    bool ready = false;
    float waitTime = 3.0f;
    Vector3 origin;
    float distance;

	// Use this for initialization
	void Start () {
      //  player = GameObject.FindGameObjectWithTag("Player").GetComponent<Transform>();
        Agent = GetComponent<NavMeshAgent>();
        origin = gameObject.transform.position;

	}

	// Update is called once per frame
	void Update () {
        distance = Vector3.Distance(gameObject.transform.position, origin); //distance between AI and it's original starting point.
        print(distance);
        FSM();
	}

    void FSM()
    {
        switch (AIStates)
        {
            case States.idle:
                Invoke("WaitTimer", waitTime);
                //idle logic here

                Debug.Log("penis");

                if (ready)
                {
                    AIStates = States.walk;
                    ready = false;
                    CancelInvoke();
                }
                break;

            case States.walk:
                Invoke("WaitTimer", waitTime*(Random.Range(0.5f,2f)));
                gameObject.transform.localPosition += transform.forward / 5;
                if (distance > 50)
                {
                    AIStates = States.retreat;
                    ready = false;
                    CancelInvoke();
                }
                else if (ready)
                {
                    AIStates = States.rotate;
                    ready = false;
                    CancelInvoke();
                }
                break;

            case States.rotate:
                Invoke("WaitTimer", waitTime*(Random.Range(0.1f,1.0f)));
                gameObject.transform.eulerAngles += new Vector3(0,Mathf.Ceil(Random.Range(-2,1)),0);
                if (ready)
                {
                    AIStates = States.walk;
                    ready = false;
                    CancelInvoke();
                }
                break;
            case States.retreat:
                Agent.SetDestination(origin);
                if (distance < 10)
                {
                    Agent.ResetPath();
                    AIStates = States.idle;
                    ready = false;
                    CancelInvoke();
                }
                //if (NavMeshPathStatus.PathComplete)
                //{

                //}
                break;

        }
    }

    void WaitTimer()
    {
        ready = true;
    }

    float RandomAngle()
    {
        float num = Random.Range(-3, 3);
        return num;
    }

}


text:
def this_fails():
    x = 1/0

try:
    this_fails()
except ZeroDivisionError as err:
    print('Handling run-time error: ', err)


text:
from __future__ import (print_function, division, absolute_import)

import unittest

from sphinxcontrib.programoutput import _slice

class TestSlice(unittest.TestCase):

    def test_slice_simple(self):
        self.assertEqual(_slice('2'), (2, None))
        self.assertEqual(_slice('2,2'), (2, 2))

    def test_slice_empty(self):
        with self.assertRaises(ValueError) as exc:
            assert _slice('')
        assert str(exc.exception.args[0]).startswith("invalid literal for int() with base 10:")

    def test_slice_no_int(self):
        with self.assertRaises(ValueError) as exc:
            _slice('foo,2')
        assert str(exc.exception.args[0]).startswith("invalid literal for int() with base 10:")

    def test_slice_too_many(self):
        with self.assertRaises(ValueError) as exc:
            _slice('2,2,2')
        self.assertEqual(str(exc.exception.args[0]), 'too many slice parts')

def test_suite():
    return unittest.defaultTestLoader.loadTestsFromName(__name__)

if __name__ == '__main__':
    unittest.main(defaultTest='test_suite')


text:
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Collections.Generic;

namespace System.Collections.Immutable
{
    /// <summary>
    /// An interface that describes the methods that the ImmutableList and ImmutableList+Builder types have in common.
    /// </summary>
    /// <typeparam name="T">The type of element in the collection.</typeparam>
    internal interface IImmutableListQueries<T> : IReadOnlyList<T>
    {
        /// <summary>
        /// Converts the elements in the current ImmutableList<T> to
        /// another type, and returns a list containing the converted elements.
        /// </summary>
        /// <param name="converter">
        /// A System.Converter<TInput,TOutput> delegate that converts each element from
        /// one type to another type.
        /// </param>
        /// <typeparam name="TOutput">
        /// The type of the elements of the target array.
        /// </typeparam>
        /// <returns>
        /// A ImmutableList<T> of the target type containing the converted
        /// elements from the current ImmutableList<T>.
        /// </returns>
        ImmutableList<TOutput> ConvertAll<TOutput>(Func<T, TOutput> converter);

        /// <summary>
        /// Performs the specified action on each element of the list.
        /// </summary>
        /// <param name="action">The System.Action<T> delegate to perform on each element of the list.</param>
        void ForEach(Action<T> action);

        /// <summary>
        /// Creates a shallow copy of a range of elements in the source ImmutableList<T>.
        /// </summary>
        /// <param name="index">
        /// The zero-based ImmutableList<T> index at which the range
        /// starts.
        /// </param>
        /// <param name="count">
        /// The number of elements in the range.
        /// </param>
        /// <returns>
        /// A shallow copy of a range of elements in the source ImmutableList<T>.
        /// </returns>
        ImmutableList<T> GetRange(int index, int count);

        /// <summary>
        /// Copies the entire ImmutableList<T> to a compatible one-dimensional
        /// array, starting at the beginning of the target array.
        /// </summary>
        /// <param name="array">
        /// The one-dimensional System.Array that is the destination of the elements
        /// copied from ImmutableList<T>. The System.Array must have
        /// zero-based indexing.
        /// </param>
        void CopyTo(T[] array);

        /// <summary>
        /// Copies the entire ImmutableList<T> to a compatible one-dimensional
        /// array, starting at the specified index of the target array.
        /// </summary>
        /// <param name="array">
        /// The one-dimensional System.Array that is the destination of the elements
        /// copied from ImmutableList<T>. The System.Array must have
        /// zero-based indexing.
        /// </param>
        /// <param name="arrayIndex">
        /// The zero-based index in array at which copying begins.
        /// </param>
        void CopyTo(T[] array, int arrayIndex);

        /// <summary>
        /// Copies a range of elements from the ImmutableList<T> to
        /// a compatible one-dimensional array, starting at the specified index of the
        /// target array.
        /// </summary>
        /// <param name="index">
        /// The zero-based index in the source ImmutableList<T> at
        /// which copying begins.
        /// </param>
        /// <param name="array">
        /// The one-dimensional System.Array that is the destination of the elements
        /// copied from ImmutableList<T>. The System.Array must have
        /// zero-based indexing.
        /// </param>
        /// <param name="arrayIndex">The zero-based index in array at which copying begins.</param>
        /// <param name="count">The number of elements to copy.</param>
        void CopyTo(int index, T[] array, int arrayIndex, int count);

        /// <summary>
        /// Determines whether the ImmutableList<T> contains elements
        /// that match the conditions defined by the specified predicate.
        /// </summary>
        /// <param name="match">
        /// The System.Predicate<T> delegate that defines the conditions of the elements
        /// to search for.
        /// </param>
        /// <returns>
        /// true if the ImmutableList<T> contains one or more elements
        /// that match the conditions defined by the specified predicate; otherwise,
        /// false.
        /// </returns>
        bool Exists(Predicate<T> match);

        /// <summary>
        /// Searches for an element that matches the conditions defined by the specified
        /// predicate, and returns the first occurrence within the entire ImmutableList<T>.
        /// </summary>
        /// <param name="match">
        /// The System.Predicate<T> delegate that defines the conditions of the element
        /// to search for.
        /// </param>
        /// <returns>
        /// The first element that matches the conditions defined by the specified predicate,
        /// if found; otherwise, the default value for type T.
        /// </returns>
        T Find(Predicate<T> match);

        /// <summary>
        /// Retrieves all the elements that match the conditions defined by the specified
        /// predicate.
        /// </summary>
        /// <param name="match">
        /// The System.Predicate<T> delegate that defines the conditions of the elements
        /// to search for.
        /// </param>
        /// <returns>
        /// A ImmutableList<T> containing all the elements that match
        /// the conditions defined by the specified predicate, if found; otherwise, an
        /// empty ImmutableList<T>.
        /// </returns>
        ImmutableList<T> FindAll(Predicate<T> match);

        /// <summary>
        /// Searches for an element that matches the conditions defined by the specified
        /// predicate, and returns the zero-based index of the first occurrence within
        /// the entire ImmutableList<T>.
        /// </summary>
        /// <param name="match">
        /// The System.Predicate<T> delegate that defines the conditions of the element
        /// to search for.
        /// </param>
        /// <returns>
        /// The zero-based index of the first occurrence of an element that matches the
        /// conditions defined by match, if found; otherwise, -1.
        /// </returns>
        int FindIndex(Predicate<T> match);

        /// <summary>
        /// Searches for an element that matches the conditions defined by the specified
        /// predicate, and returns the zero-based index of the first occurrence within
        /// the range of elements in the ImmutableList<T> that extends
        /// from the specified index to the last element.
        /// </summary>
        /// <param name="startIndex">The zero-based starting index of the search.</param>
        /// <param name="match">The System.Predicate<T> delegate that defines the conditions of the element to search for.</param>
        /// <returns>
        /// The zero-based index of the first occurrence of an element that matches the
        /// conditions defined by match, if found; otherwise, -1.
        /// </returns>
        int FindIndex(int startIndex, Predicate<T> match);

        /// <summary>
        /// Searches for an element that matches the conditions defined by the specified
        /// predicate, and returns the zero-based index of the first occurrence within
        /// the range of elements in the ImmutableList<T> that starts
        /// at the specified index and contains the specified number of elements.
        /// </summary>
        /// <param name="startIndex">The zero-based starting index of the search.</param>
        /// <param name="count">The number of elements in the section to search.</param>
        /// <param name="match">The System.Predicate<T> delegate that defines the conditions of the element to search for.</param>
        /// <returns>
        /// The zero-based index of the first occurrence of an element that matches the
        /// conditions defined by match, if found; otherwise, -1.
        /// </returns>
        int FindIndex(int startIndex, int count, Predicate<T> match);

        /// <summary>
        /// Searches for an element that matches the conditions defined by the specified
        /// predicate, and returns the last occurrence within the entire ImmutableList<T>.
        /// </summary>
        /// <param name="match">
        /// The System.Predicate<T> delegate that defines the conditions of the element
        /// to search for.
        /// </param>
        /// <returns>
        /// The last element that matches the conditions defined by the specified predicate,
        /// if found; otherwise, the default value for type T.
        /// </returns>
        T FindLast(Predicate<T> match);

        /// <summary>
        /// Searches for an element that matches the conditions defined by the specified
        /// predicate, and returns the zero-based index of the last occurrence within
        /// the entire ImmutableList<T>.
        /// </summary>
        /// <param name="match">
        /// The System.Predicate<T> delegate that defines the conditions of the element
        /// to search for.
        /// </param>
        /// <returns>
        /// The zero-based index of the last occurrence of an element that matches the
        /// conditions defined by match, if found; otherwise, -1.
        /// </returns>
        int FindLastIndex(Predicate<T> match);

        /// <summary>
        /// Searches for an element that matches the conditions defined by the specified
        /// predicate, and returns the zero-based index of the last occurrence within
        /// the range of elements in the ImmutableList<T> that extends
        /// from the first element to the specified index.
        /// </summary>
        /// <param name="startIndex">The zero-based starting index of the backward search.</param>
        /// <param name="match">The System.Predicate<T> delegate that defines the conditions of the element
        /// to search for.</param>
        /// <returns>
        /// The zero-based index of the last occurrence of an element that matches the
        /// conditions defined by match, if found; otherwise, -1.
        /// </returns>
        int FindLastIndex(int startIndex, Predicate<T> match);

        /// <summary>
        /// Searches for an element that matches the conditions defined by the specified
        /// predicate, and returns the zero-based index of the last occurrence within
        /// the range of elements in the ImmutableList<T> that contains
        /// the specified number of elements and ends at the specified index.
        /// </summary>
        /// <param name="startIndex">The zero-based starting index of the backward search.</param>
        /// <param name="count">The number of elements in the section to search.</param>
        /// <param name="match">
        /// The System.Predicate<T> delegate that defines the conditions of the element
        /// to search for.
        /// </param>
        /// <returns>
        /// The zero-based index of the last occurrence of an element that matches the
        /// conditions defined by match, if found; otherwise, -1.
        /// </returns>
        int FindLastIndex(int startIndex, int count, Predicate<T> match);

        /// <summary>
        /// Determines whether every element in the ImmutableList<T>
        /// matches the conditions defined by the specified predicate.
        /// </summary>
        /// <param name="match">
        /// The System.Predicate<T> delegate that defines the conditions to check against
        /// the elements.
        /// </param>
        /// <returns>
        /// true if every element in the ImmutableList<T> matches the
        /// conditions defined by the specified predicate; otherwise, false. If the list
        /// has no elements, the return value is true.
        /// </returns>
        bool TrueForAll(Predicate<T> match);

        /// <summary>
        /// Searches the entire sorted System.Collections.Generic.List<T> for an element
        /// using the default comparer and returns the zero-based index of the element.
        /// </summary>
        /// <param name="item">The object to locate. The value can be null for reference types.</param>
        /// <returns>
        /// The zero-based index of item in the sorted System.Collections.Generic.List<T>,
        /// if item is found; otherwise, a negative number that is the bitwise complement
        /// of the index of the next element that is larger than item or, if there is
        /// no larger element, the bitwise complement of System.Collections.Generic.List<T>.Count.
        /// </returns>
        /// <exception cref="InvalidOperationException">
        /// The default comparer System.Collections.Generic.Comparer<T>.Default cannot
        /// find an implementation of the System.IComparable<T> generic interface or
        /// the System.IComparable interface for type T.
        /// </exception>
        int BinarySearch(T item);

        /// <summary>
        ///  Searches the entire sorted System.Collections.Generic.List<T> for an element
        ///  using the specified comparer and returns the zero-based index of the element.
        /// </summary>
        /// <param name="item">The object to locate. The value can be null for reference types.</param>
        /// <param name="comparer">
        /// The System.Collections.Generic.IComparer<T> implementation to use when comparing
        /// elements.-or-null to use the default comparer System.Collections.Generic.Comparer<T>.Default.
        /// </param>
        /// <returns>
        /// The zero-based index of item in the sorted System.Collections.Generic.List<T>,
        /// if item is found; otherwise, a negative number that is the bitwise complement
        /// of the index of the next element that is larger than item or, if there is
        /// no larger element, the bitwise complement of System.Collections.Generic.List<T>.Count.
        /// </returns>
        /// <exception cref="InvalidOperationException">
        /// comparer is null, and the default comparer System.Collections.Generic.Comparer<T>.Default
        /// cannot find an implementation of the System.IComparable<T> generic interface
        /// or the System.IComparable interface for type T.
        /// </exception>
        int BinarySearch(T item, IComparer<T> comparer);

        /// <summary>
        /// Searches a range of elements in the sorted System.Collections.Generic.List<T>
        /// for an element using the specified comparer and returns the zero-based index
        /// of the element.
        /// </summary>
        /// <param name="index">The zero-based starting index of the range to search.</param>
        /// <param name="count"> The length of the range to search.</param>
        /// <param name="item">The object to locate. The value can be null for reference types.</param>
        /// <param name="comparer">
        /// The System.Collections.Generic.IComparer<T> implementation to use when comparing
        /// elements, or null to use the default comparer System.Collections.Generic.Comparer<T>.Default.
        /// </param>
        /// <returns>
        /// The zero-based index of item in the sorted System.Collections.Generic.List<T>,
        /// if item is found; otherwise, a negative number that is the bitwise complement
        /// of the index of the next element that is larger than item or, if there is
        /// no larger element, the bitwise complement of System.Collections.Generic.List<T>.Count.
        /// </returns>
        /// <exception cref="ArgumentOutOfRangeException">
        /// index is less than 0.-or-count is less than 0.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// index and count do not denote a valid range in the System.Collections.Generic.List<T>.
        /// </exception>
        /// <exception cref="InvalidOperationException">
        /// comparer is null, and the default comparer System.Collections.Generic.Comparer<T>.Default
        /// cannot find an implementation of the System.IComparable<T> generic interface
        /// or the System.IComparable interface for type T.
        /// </exception>
        int BinarySearch(int index, int count, T item, IComparer<T> comparer);
    }
}


text:
package org.wso2.carbon.appmgt.impl.service;

import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.appmgt.impl.AppMConstants;
import org.wso2.carbon.appmgt.impl.config.TenantConfiguration;
import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.registry.api.Registry;
import org.wso2.carbon.registry.core.Resource;
import org.wso2.carbon.registry.core.exceptions.RegistryException;
import org.wso2.carbon.registry.core.service.RegistryService;
import org.wso2.carbon.registry.core.session.UserRegistry;

import javax.xml.stream.XMLStreamException;
import java.io.File;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

/**
 * The registry based implementation of TenantConfigurationService.
 */
public class TenantConfigurationServiceImpl implements TenantConfigurationService{

    private static final Log log = LogFactory.getLog(TenantConfigurationServiceImpl.class);

    private Map<Integer, TenantConfiguration> tenantConfigurations;
    public TenantConfigurationServiceImpl(){
        tenantConfigurations = new HashMap<Integer, TenantConfiguration>();
    }

    public void addTenantConfiguration(TenantConfiguration tenantConfiguration){

        synchronized (this){
            if(tenantConfigurations.get(tenantConfiguration.getTenantID()) == null){
                tenantConfigurations.put(tenantConfiguration.getTenantID(), tenantConfiguration);
            }
        }
    }

    @Override
    public String getFirstProperty(String key) {
        int tenantID = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        return getFirstProperty(key, tenantID);
    }

    @Override
    public String getFirstProperty(String key, int tenantID) {
        return tenantConfigurations.get(tenantID).getFirstProperty(key);
    }

    @Override
    public List<String> getProperties(String key) {
        int tenantID = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        return tenantConfigurations.get(tenantID).getProperties(key);
    }

    @Override
    public List<String> getProperties(String key, int tenantID) {
        return tenantConfigurations.get(tenantID).getProperties(key);
    }
}


text:
    <meta name="viewport" content="width=device-width, initial-scale=1" charset="UTF-8">
    <title>AsXmlDocument</title>
<link href="../../../images/logo-icon.svg" rel="icon" type="image/svg">
<link href="../../../styles/style.css" rel="Stylesheet"><link href="../../../styles/jetbrains-mono.css" rel="Stylesheet"><link href="../../../styles/main.css" rel="Stylesheet"><link href="../../../styles/prism.css" rel="Stylesheet"><link href="../../../styles/logo-styles.css" rel="Stylesheet">

haishinkit

0.5.1

<button id="theme-toggle-button"></button>

haishinkit/com.haishinkit.amf.data/AsXmlDocument

As<wbr></wbr>Xml<wbr></wbr>Document

class AsXmlDocument(document: String)
Content copied to clipboard

<button class="section-tab" data-active="" data-togglable="Functions">Functions</button>

Functions

to<wbr></wbr>String

Link copied to clipboard

open override fun toString(): String
Content copied to clipboard

© 2022 CopyrightGenerated by dokka


text:
#region Copyright Notice

//    Copyright 2011-2013 Eleftherios Aslanoglou
//
//    Licensed under the Apache License, Version 2.0 (the "License");
//    you may not use this file except in compliance with the License.
//    You may obtain a copy of the License at
//
//        http://www.apache.org/licenses/LICENSE-2.0
//
//    Unless required by applicable law or agreed to in writing, software
//    distributed under the License is distributed on an "AS IS" BASIS,
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//    See the License for the specific language governing permissions and
//    limitations under the License.

#endregion

namespace NBA_2K13_Roster_Editor.Data.Staff.Parameters
{
    public enum CPSetting : byte
    {
        OffTempo = 0,
        DefPress = 1,
        HelpD = 2,
        FastBreak = 3,
        CrashBoards = 4,
        BenchDepth = 5,
        RunPlays = 6,
        DoubleTeam = 7,
        ZoneUsg = 8,
        InsSht = 9,
        ClsSht = 10,
        MidSht = 11,
        ThreeSht = 12,
        AttackBskt = 13,
        LookForPost = 14,
        AlleyOop = 15,
        SizeVsSpeed = 16,
        AthlVsSkill = 17,
        OffVsDef = 18,
        GVsF = 19,
        InsVsOut = 20
    }
}


text:
<resources>
    <string name="app_name">SwipeableExample</string>
</resources>


text:
package io.werval.runtime.routes;

import com.acme.app.FakeController;
import io.werval.api.Application;
import io.werval.api.Mode;
import io.werval.api.http.RequestHeader;
import io.werval.api.routes.Route;
import io.werval.runtime.ApplicationInstance;
import io.werval.runtime.http.CookiesInstance;
import io.werval.runtime.http.HeadersInstance;
import io.werval.runtime.http.QueryStringInstance;
import io.werval.runtime.http.RequestHeaderInstance;
import java.util.Map;
import org.junit.Test;

import static io.werval.api.http.Method.GET;
import static io.werval.api.http.ProtocolVersion.HTTP_1_1;
import static io.werval.api.routes.RouteBuilder.p;
import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

/**
 * Assert wildcard in routes behaviour.
 */
public class WildcardRoutesTest
{
    @Test
    public void wildAPI()
    {
        Application application = new ApplicationInstance( Mode.TEST, app -> singletonList(
            new RouteBuilderInstance( app )
            .route( "GET" )
            .on( "/test/*path/as/file" )
            .to( FakeController.class, c -> c.wild( p( "path", String.class ) ) )
            .build()
        ) );
        application.activate();
        try
        {
            Route route = application.routes().iterator().next();
            System.out.println( route );
            assertWild( application, route );
        }
        finally
        {
            application.passivate();
        }
    }

    @Test
    public void wildParsed()
    {
        Application application = new ApplicationInstance( Mode.TEST, new RoutesParserProvider(
            "GET /test/*path/as/file com.acme.app.FakeController.wild( String path )"
        ) );
        application.activate();
        try
        {
            Route route = application.routes().iterator().next();
            System.out.println( route );
            assertWild( application, route );
        }
        finally
        {
            application.passivate();
        }
    }

    private void assertWild( Application application, Route route )
    {
        assertThat(
            route.satisfiedBy( reqHeadForGet( "/test/as/file" ) ),
            is( false )
        );

        assertThat(
            route.satisfiedBy( reqHeadForGet( "/test/foo/as/file" ) ),
            is( true )
        );

        assertThat(
            (String) route.bindParameters(
                application.parameterBinders(),
                "/test/foo/as/file",
                QueryStringInstance.EMPTY
            ).get( "path" ),
            equalTo( "foo" )
        );

        assertThat(
            route.satisfiedBy( reqHeadForGet( "/test/foo/bar/as/file" ) ),
            is( true )
        );

        assertThat(
            (String) route.bindParameters(
                application.parameterBinders(),
                "/test/foo/bar/as/file",
                QueryStringInstance.EMPTY
            ).get( "path" ),
            equalTo( "foo/bar" )
        );

        assertThat(
            route.satisfiedBy( reqHeadForGet( "/test/as/file/test/bar/as/file" ) ),
            is( true )
        );

        assertThat(
            (String) route.bindParameters(
                application.parameterBinders(),
                "/test/as/file/test/bar/as/file",
                QueryStringInstance.EMPTY
            ).get( "path" ),
            equalTo( "as/file/test/bar" )
        );
    }

    private RequestHeader reqHeadForGet( String path )
    {
        return new RequestHeaderInstance(
            null,
            "abc",
            "127.0.0.1",
            false, false, emptyList(),
            HTTP_1_1,
            GET,
            "http://localhost" + path,
            path,
            QueryStringInstance.EMPTY,
            new HeadersInstance(),
            new CookiesInstance()
        );
    }

    @Test
    public void forcedWild()
    {
        Application application = new ApplicationInstance( Mode.TEST, new RoutesParserProvider(
            "GET /tree/*path com.acme.app.FakeController.forcedWild( String root = 'src/test/resources', String path )"
        ) );
        application.activate();
        try
        {
            Route route = application.routes().iterator().next();
            System.out.println( route );
            Map<String, Object> boundParams = route.bindParameters(
                application.parameterBinders(),
                "/tree/staticfiles/",
                QueryStringInstance.EMPTY
            );
            assertThat( (String) boundParams.get( "root" ), equalTo( "src/test/resources" ) );
            assertThat( (String) boundParams.get( "path" ), equalTo( "staticfiles/" ) );
            boundParams = route.bindParameters(
                application.parameterBinders(),
                "/tree/staticfiles",
                QueryStringInstance.EMPTY
            );
            assertThat( (String) boundParams.get( "root" ), equalTo( "src/test/resources" ) );
            assertThat( (String) boundParams.get( "path" ), equalTo( "staticfiles" ) );
        }
        finally
        {
            application.passivate();
        }
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
OtherIntervention
</TITLE>

<META NAME="keywords" CONTENT="gov.nih.nci.cabig.caaers.domain.OtherIntervention class">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

gov.nih.nci.cabig.caaers.domain

Class OtherIntervention

java.lang.Object
  gov.nih.nci.cabig.ctms.domain.AbstractMutableDomainObject
      gov.nih.nci.cabig.caaers.domain.AbstractMutableRetireableDomainObject
          gov.nih.nci.cabig.caaers.domain.StudyIntervention
              gov.nih.nci.cabig.caaers.domain.OtherIntervention

All Implemented Interfaces:
Retireable, StudyChild, gov.nih.nci.cabig.ctms.domain.DomainObject, gov.nih.nci.cabig.ctms.domain.GridIdentifiable, gov.nih.nci.cabig.ctms.domain.MutableDomainObject

public class OtherIntervention
extends StudyIntervention

The Class OtherIntervention.

Field Summary

Fields inherited from class gov.nih.nci.cabig.caaers.domain.AbstractMutableRetireableDomainObject

retiredIndicator

Constructor Summary

OtherIntervention()

Method Summary

 boolean
equals(java.lang.Object o)

 java.lang.String
getDescription()

          Gets the description.

 java.lang.String
getName()

          Gets the name.

 int
hashCode()

 void
setDescription(java.lang.String description)

          Sets the description.

 void
setName(java.lang.String name)

          Sets the name.

Methods inherited from class gov.nih.nci.cabig.caaers.domain.StudyIntervention

getStudy, getStudyTherapyType, setStudy, setStudyTherapyType

Methods inherited from class gov.nih.nci.cabig.caaers.domain.AbstractMutableRetireableDomainObject

getRetiredIndicator, isRetired, retire, retire, retire, setRetiredIndicator

Methods inherited from class gov.nih.nci.cabig.ctms.domain.AbstractMutableDomainObject

getGridId, getId, getVersion, hasGridId, setGridId, setId, setVersion

Methods inherited from class java.lang.Object

clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

Methods inherited from interface gov.nih.nci.cabig.caaers.domain.Retireable

getId

Constructor Detail

OtherIntervention

public OtherIntervention()

Method Detail

getName

public java.lang.String getName()

Gets the name.

Returns:
the name

setName

public void setName(java.lang.String name)

Sets the name.

Parameters:
name - the new name

getDescription

public java.lang.String getDescription()

Gets the description.

Returns:
the description

setDescription

public void setDescription(java.lang.String description)

Sets the description.

Parameters:
description - the new description

equals

public boolean equals(java.lang.Object o)

Overrides:
equals in class StudyIntervention

hashCode

public int hashCode()

Overrides:
hashCode in class StudyIntervention

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD


text:
This module will create a set of startup-script runners that will install and
run [DellHPC Omnia](https://github.com/dellhpc/omnia) version 1.3 onto a set of
VMs representing a slurm controller and compute nodes. For a full example using
omnia-install, see the [omnia-cluster example].

**Warning**: This module will create a user named "omnia" by default which has
sudo permissions. You may want to remove this user and/or it's permissions from
each node.

[omnia-cluster example]: ../../../community/examples/omnia-cluster.yaml

## License

Copyright 2022 Google LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

## Requirements

| Name | Version |
|------|---------|
|  [terraform](#requirement\_terraform) | >= 0.14.0 |

## Providers

No providers.

## Modules

No modules.

## Resources

No resources.

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
|  [compute\_ips](#input\_compute\_ips) | IPs of the Omnia compute nodes | `list(string)` | n/a | yes |
|  [install\_dir](#input\_install\_dir) | Path where omnia will be installed, defaults to omnia user home directory (/home/omnia).
If specifying this path, please make sure it is on a shared file system, accessible by all omnia nodes. | `string` | `""` | no |
|  [manager\_ips](#input\_manager\_ips) | IPs of the Omnia manager nodes | `list(string)` | n/a | yes |
|  [omnia\_username](#input\_omnia\_username) | Name of the user that installs omnia | `string` | `"omnia"` | no |
|  [slurm\_uid](#input\_slurm\_uid) | User ID of the slurm user | `number` | `981` | no |
|  [virtualenv](#input\_virtualenv) | Path to a virtual environment on the Omnia manager and compute VMs that
should be used for installing packages with pip. Defaults to the virtual
environment created by the startup-scripts module, /usr/local/ghpc-venv.
If the virtual environment cannot be found, the system environment will be
used instead. | `string` | `"/usr/local/ghpc-venv"` | no |

## Outputs

| Name | Description |
|------|-------------|
|  [copy\_inventory\_runner](#output\_copy\_inventory\_runner) | Runner to copy the inventory to the omnia manager using the startup-script module |
|  [install\_omnia\_runner](#output\_install\_omnia\_runner) | Runner to install Omnia using an ansible playbook. The startup-script module
will automatically handle installation of ansible.
- id: example-startup-script
  source: modules/scripts/startup-script
  settings:
    runners:
    - $(your-omnia-id.install\_omnia\_runner)
... |
|  [inventory\_file](#output\_inventory\_file) | The inventory file for the omnia cluster |
|  [omnia\_user\_warning](#output\_omnia\_user\_warning) | Warn developers that the omnia user was created with sudo permissions |
|  [setup\_omnia\_node\_runner](#output\_setup\_omnia\_node\_runner) | Runner to create the omnia user using an ansible playbook. The startup-script
module will automatically handle installation of ansible.
- id: example-startup-script
  source: modules/scripts/startup-script
  settings:
    runners:
    - $(your-omnia-id.setup\_omnia\_node\_runner)
... |
|  [setup\_omnia\_node\_script](#output\_setup\_omnia\_node\_script) | An ansible script that adds the user that install omnia |


text:
/*!
 @header     GJAlertAction.h
 @abstract   为Alert添加可点击的item选项
 @discussion 为了配合GJAlertController实现在低版本中也能使用AlertController的功能
 @author     guoxiaoliang850417@163.com
 */

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@class GJAlertAction;

typedef void (^GJAlertBlock) (GJAlertAction *alertAction);

typedef NS_ENUM(NSInteger, GJAlertActionStyle) {
    GJAlertActionStyleDefault = 0,
    GJAlertActionStyleCancel,
    GJAlertActionStyleDestructive
};

@interface GJAlertAction : NSObject

@property (copy, nonatomic) NSString *title;
@property (assign, nonatomic) GJAlertActionStyle style;
@property (copy, nonatomic) GJAlertBlock handler;

+ (instancetype)actionWithTitle:(NSString *)aTitle style:(GJAlertActionStyle)aStyle handler:(GJAlertBlock)aHandler;

@end


text:
#ifndef GrSingleTextureEffect_DEFINED
#define GrSingleTextureEffect_DEFINED

#include "GrEffect.h"
#include "SkMatrix.h"

class GrTexture;

/**
 * A base class for effects that draw a single texture with a texture matrix.
 */
class GrSingleTextureEffect : public GrEffect {
public:
    virtual ~GrSingleTextureEffect();

    const SkMatrix& getMatrix() const { return fMatrix; }

protected:
    GrSingleTextureEffect(GrTexture*, const SkMatrix&); /* unfiltered, clamp mode */
    GrSingleTextureEffect(GrTexture*, const SkMatrix&, bool bilerp); /* clamp mode */
    GrSingleTextureEffect(GrTexture*, const SkMatrix&, const GrTextureParams&);

    /**
     * Helper for subclass onIsEqual() functions.
     */
    bool hasSameTextureParamsAndMatrix(const GrSingleTextureEffect& other) const {
        const GrTextureAccess& otherAccess = other.fTextureAccess;
        // We don't have to check the accesses' swizzles because they are inferred from the texture.
        return fTextureAccess.getTexture() == otherAccess.getTexture() &&
               fTextureAccess.getParams() == otherAccess.getParams() &&
               this->getMatrix().cheapEqualTo(other.getMatrix());
    }

    /**
     * Can be used as a helper to implement subclass getConstantColorComponents(). It assumes that
     * the subclass output color will be a modulation of the input color with a value read from the
     * texture.
     */
    void updateConstantColorComponentsForModulation(GrColor* color, uint32_t* validFlags) const {
        if ((*validFlags & kA_ValidComponentFlag) && 0xFF == GrColorUnpackA(*color) &&
            GrPixelConfigIsOpaque(this->texture(0)->config())) {
            *validFlags = kA_ValidComponentFlag;
        } else {
            *validFlags = 0;
        }
    }

private:
    GrTextureAccess fTextureAccess;
    SkMatrix        fMatrix;

    typedef GrEffect INHERITED;
};

#endif


text:
var IndexedSequence = require('./Sequence').IndexedSequence;
var Vector = require('./Vector');

/**
 * Returns a lazy seq of nums from start (inclusive) to end
 * (exclusive), by step, where start defaults to 0, step to 1, and end to
 * infinity. When start is equal to end, returns empty list.
 */
for(var IndexedSequence____Key in IndexedSequence){if(IndexedSequence.hasOwnProperty(IndexedSequence____Key)){Range[IndexedSequence____Key]=IndexedSequence[IndexedSequence____Key];}}var ____SuperProtoOfIndexedSequence=IndexedSequence===null?null:IndexedSequence.prototype;Range.prototype=Object.create(____SuperProtoOfIndexedSequence);Range.prototype.constructor=Range;Range.__superConstructor__=IndexedSequence;

  function Range(start, end, step) {"use strict";
    if (!(this instanceof Range)) {
      return new Range(start, end, step);
    }
    invariant(step !== 0, 'Cannot step a Range by 0');
    start = start || 0;
    if (end == null) {
      end = Infinity;
    }
    step = step == null ? 1 : Math.abs(step);
    if (end < start) {
      step = -step;
    }
    this.$Range_start = start;
    this.$Range_end = end;
    this.$Range_step = step;
    this.length = Math.max(0, Math.ceil((end - start) / step - 1) + 1);
  }

  Range.prototype.toString=function() {"use strict";
    if (this.length === 0) {
      return 'Range []';
    }
    return 'Range [ ' +
      this.$Range_start + '...' + this.$Range_end +
      (this.$Range_step > 1 ? ' by ' + this.$Range_step : '') +
    ' ]';
  };

  Range.prototype.has=function(index) {"use strict";
    invariant(index >= 0, 'Index out of bounds');
    return index < this.length;
  };

  Range.prototype.get=function(index, undefinedValue) {"use strict";
    invariant(index >= 0, 'Index out of bounds');
    return this.length === Infinity || index < this.length ?
      this.$Range_start + index * this.$Range_step : undefinedValue;
  };

  Range.prototype.contains=function(searchValue) {"use strict";
    var possibleIndex = (searchValue - this.$Range_start) / this.$Range_step;
    return possibleIndex >= 0 &&
      possibleIndex < this.length &&
      possibleIndex === Math.floor(possibleIndex);
  };

  Range.prototype.slice=function(begin, end, maintainIndices) {"use strict";
    if (maintainIndices) {
      return ____SuperProtoOfIndexedSequence.slice.call(this,begin, end, maintainIndices);
    }
    begin = begin < 0 ? Math.max(0, this.length + begin) : Math.min(this.length, begin);
    end = end == null ? this.length : end > 0 ? Math.min(this.length, end) : Math.max(0, this.length + end);
    return new Range(this.get(begin), end === this.length ? this.$Range_end : this.get(end), this.$Range_step);
  };

  Range.prototype.__deepEquals=function(other) {"use strict";
    return this.$Range_start === other.$Range_start && this.$Range_end === other.$Range_end && this.$Range_step === other.$Range_step;
  };

  Range.prototype.indexOf=function(searchValue) {"use strict";
    var offsetValue = searchValue - this.$Range_start;
    if (offsetValue % this.$Range_step === 0) {
      var index = offsetValue / this.$Range_step;
      if (index >= 0 && index < this.length) {
        return index
      }
    }
    return -1;
  };

  Range.prototype.lastIndexOf=function(searchValue) {"use strict";
    return this.indexOf(searchValue);
  };

  Range.prototype.take=function(amount) {"use strict";
    return this.slice(0, amount);
  };

  Range.prototype.skip=function(amount, maintainIndices) {"use strict";
    return maintainIndices ? ____SuperProtoOfIndexedSequence.skip.call(this,amount) : this.slice(amount);
  };

  Range.prototype.__iterate=function(fn, reverse, flipIndices) {"use strict";
    var reversedIndices = reverse ^ flipIndices;
    var maxIndex = this.length - 1;
    var step = this.$Range_step;
    var value = reverse ? this.$Range_start + maxIndex * step : this.$Range_start;
    for (var ii = 0; ii <= maxIndex; ii++) {
      if (fn(value, reversedIndices ? maxIndex - ii : ii, this) === false) {
        break;
      }
      value += reverse ? -step : step;
    }
    return reversedIndices ? this.length : ii;
  };

Range.prototype.__toJS = Range.prototype.toArray;
Range.prototype.first = Vector.prototype.first;
Range.prototype.last = Vector.prototype.last;

function invariant(condition, error) {
  if (!condition) throw new Error(error);
}

module.exports = Range;


text:
//
// Copyright (c) 2011 Francois Valdy
// Copyright (c) 2015 Timotei Dolean
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//       http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

using System;
using System.Collections.Generic;
using Mono.Cecil;
using System.Linq;
using System.Text.RegularExpressions;

namespace ILRepacking.Steps
{
    internal class TypesRepackStep : IRepackStep
    {
        private readonly ILogger _logger;
        private readonly IRepackContext _repackContext;
        private readonly IRepackImporter _repackImporter;
        private readonly RepackOptions _repackOptions;
        private List<TypeDefinition> _allTypes;

        public TypesRepackStep(
            ILogger logger,
            IRepackContext repackContext,
            IRepackImporter repackImporter,
            RepackOptions repackOptions)
        {
            _logger = logger;
            _repackContext = repackContext;
            _repackImporter = repackImporter;
            _repackOptions = repackOptions;

            _allTypes =
                _repackContext.OtherAssemblies.Concat(new[] { _repackContext.PrimaryAssemblyDefinition })
                    .SelectMany(x => x.Modules)
                    .SelectMany(m => m.Types)
                    .ToList();
        }

        public void Perform()
        {
            RepackTypes();
            RepackExportedTypes();
        }

        private void RepackTypes()
        {
            _logger.Info("Processing types");

            // merge types, this differs between 'primary' and 'other' assemblies regarding internalizing

            foreach (var r in _repackContext.PrimaryAssemblyDefinition.Modules.SelectMany(x => x.Types))
            {
                _logger.Verbose($"- Importing {r} from {r.Module}");
                _repackImporter.Import(r, _repackContext.TargetAssemblyMainModule.Types, false);
            }

            foreach (var r in _repackContext.OtherAssemblies.SelectMany(x => x.Modules).SelectMany(m => m.Types))
            {
                _logger.Verbose($"- Importing {r} from {r.Module}");
                _repackImporter.Import(r, _repackContext.TargetAssemblyMainModule.Types, ShouldInternalize(r.FullName));
            }
        }

        private bool SkipExportedType(ExportedType type)
        {
            bool parentIsForwarder = type.DeclaringType != null && type.DeclaringType.IsForwarder;
            bool forwarded = type.IsForwarder || parentIsForwarder;

            return forwarded && _allTypes.Any(t => t.FullName == type.FullName);
        }

        private void RepackExportedTypes()
        {
            var targetAssemblyMainModule = _repackContext.TargetAssemblyMainModule;
            _logger.Info("Processing exported types");
            foreach (var m in _repackContext.MergedAssemblies.SelectMany(x => x.Modules))
            {
                foreach (var r in m.ExportedTypes)
                {
                    if (SkipExportedType(r))
                        continue;

                    _repackContext.MappingHandler.StoreExportedType(m, r.FullName, CreateReference(r));
                }
            }

            foreach (var r in _repackContext.PrimaryAssemblyDefinition.Modules.SelectMany(x => x.ExportedTypes))
            {
                _logger.Verbose($"- Importing Exported Type {r} from {r.Scope}");
                _repackImporter.Import(
                    r, targetAssemblyMainModule.ExportedTypes, targetAssemblyMainModule);
            }

            foreach (var m in _repackContext.OtherAssemblies.SelectMany(x => x.Modules))
            {
                foreach (var r in m.ExportedTypes)
                {
                    if (!ShouldInternalize(r.FullName) &&
                        !SkipExportedType(r))
                    {
                        _logger.Verbose($"- Importing Exported Type {r} from {m}");
                        _repackImporter.Import(r, targetAssemblyMainModule.ExportedTypes, targetAssemblyMainModule);
                    }
                    else
                    {
                        _logger.Verbose($"- Skipping Exported Type {r} from {m}");
                    }
                }
            }
        }

        /// <summary>
        /// Check if a type's FullName matches a Regex to exclude it from internalizing.
        /// </summary>
        private bool ShouldInternalize(string typeFullName)
        {
            if (!_repackOptions.Internalize)
                return false;

            if (_repackOptions.ExcludeInternalizeMatches.Count == 0)
                return true;

            string withSquareBrackets = "[" + typeFullName + "]";
            foreach (Regex r in _repackOptions.ExcludeInternalizeMatches)
                if (r.IsMatch(typeFullName) || r.IsMatch(withSquareBrackets))
                    return false;

            return true;
        }

        private TypeReference CreateReference(ExportedType type)
        {
            return new TypeReference(type.Namespace, type.Name, _repackContext.TargetAssemblyMainModule, _repackContext.MergeScope(type.Scope))
            {
                DeclaringType = type.DeclaringType != null ? CreateReference(type.DeclaringType) : null,
            };
        }
    }
}