text:
module.exports = function (gulp, install, conflict, template, rename, _, inflections, inquirer, mkdirp) {
	var fs = require('fs');
	gulp.task('express-test', function (done) {

		if (!this.args[0]) {
			console.log('******    Incorrect usage of the sub-generator!!           ******');
			console.log('******    Try slush meanjs:express-test <model-name>       ******');
			console.log('******    Ex: slush meanjs:express-test article            ******');
			return done();
		}
		var moduleName = this.args[0];
		// Set model names
		var answers = {};
        answers.slugifiedModelName = _.slugify(_.humanize(moduleName));
		answers.classifiedModelName = _.classify(answers.slugifiedModelName);
		answers.humanizedModelName = _.humanize(answers.slugifiedModelName);
		answers.camelizedModelName = _.camelize(answers.slugifiedModelName);
		answers.slugifiedPluralModelName = inflections.pluralize(answers.slugifiedModelName);

		var modelFilePath = process.cwd() + '/app/models/' + answers.slugifiedModelName + '.server.model.js';

      	if (!fs.existsSync(modelFilePath)) {
				gulp.src(__dirname + '/../templates/express-test/_.server.model.js')
			        .pipe(template(answers))
			        .pipe(rename(function(file) {
			        	    if (file.basename.indexOf('_') == 0) {
		                        file.basename = file.basename.replace('_', answers.slugifiedModelName);
		                    }
		             }))
			        .pipe(conflict('app/models/'))
			        .pipe(gulp.dest('app/models/'));
			}

			gulp.src(__dirname + '/../templates/express-test/_.server.model.test.js')
		        .pipe(template(answers))
		        .pipe(rename(function(file) {
		        	    if (file.basename.indexOf('_') == 0) {
	                        file.basename = file.basename.replace('_', answers.slugifiedModelName);
	                    }
	             }))
		        .pipe(conflict('app/tests/'))
		        .pipe(gulp.dest('app/tests/'))
		        .on('end', function () {
	               done();
	            });
	});
	return gulp;
};


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />

    <title>Broken Build</title>
    <meta name="description" content="The drunken ramblings of a software engineer" />

    <meta name="HandheldFriendly" content="True" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <link rel="shortcut icon" href="//reggert.github.io/themes/Casper/favicon.ico">

    <link rel="stylesheet" type="text/css" href="//reggert.github.io/themes/Casper/assets/css/screen.css?v=1.0.0" />
    <link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Merriweather:300,700,700italic,300italic|Open+Sans:700,400" />

    <link rel="canonical" href="https://reggert.github.io" />
    <meta name="generator" content="Ghost ?" />
    <link rel="alternate" type="application/rss+xml" title="Broken Build" href="https://reggert.github.io/rss" />
    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/default.min.css">

        Home

immutability

                    A 1-post collection

        Page 1 of 1

Final Destination

This is the second installment in the How to Make Your Java Code Not Suck series. Fightin' (key)words When debating Java code style, the one »

             on programming,  Java,  final,  immutability
            <time class="post-date" datetime="2016-04-19">19 April 2016</time>

        Page 1 of 1

Broken Build © 2016

Proudly published with HubPress

redpajama_set_name: RedPajamaGithub


text:
[![NPM Version](https://img.shields.io/npm/v/maptalks.svg)](https://github.com/maptalks/maptalks.js) [![Circle CI](https://circleci.com/gh/maptalks/maptalks.js.svg?style=shield)](https://circleci.com/gh/maptalks/maptalks.js) [![Build status](https://ci.appveyor.com/api/projects/status/r9pb0dhqqq3cdppy/branch/master?svg=true)](https://ci.appveyor.com/project/fuzhenn/maptalks-js) [![Build Status](https://travis-ci.org/maptalks/maptalks.js.svg?branch=master)](https://travis-ci.org/maptalks/maptalks.js) [![codecov](https://codecov.io/gh/maptalks/maptalks.js/branch/master/graph/badge.svg)](https://codecov.io/gh/maptalks/maptalks.js) [![devDependency Status](https://david-dm.org/maptalks/maptalks.js/dev-status.svg)](https://david-dm.org/maptalks/maptalks.js#info=devDependencies)

A light JavaScript library to create integrated 2D/3D maps.

* **2D/3D**: Integrated 2D/3D maps.
* **Open and pluggable**: Easy to extend with techs you may love as [plugins](https://maptalks.org/plugins.html).
* **Performant**: Can smoothly render tens of thousands of geometries.
* **Simple**: Extremely easy to learn and use.
* **Feature Packed**: Essential features for most mapping needs.
* **SSR**: [Server-Side Rendering](https://github.com/maptalks/maptalks.js/wiki/Server-Side-Rendering)

## The Story

**maptalks.js** was born for a map-centric project to help [YUM! China](http://www.yumchina.com/en/) (the most successful food chain in China) manage and analyze spatial data all over the country for choosing locations of new KFC and PizzaHut restaurants. After verified in many projects of government depts and enterprises, we are glad to open source it, and hoping it can help you deliver better mapping projects.

<video width="820" src = "https://user-images.githubusercontent.com/25998927/149662311-4cb06c54-49ab-44b2-b019-518c0228508c.mp4" autoplay loop hspace="10"></video>

## Resources

* [Web Site](http://maptalks.org)
* [A Quick Start](http://maptalks.org/getting-started.html)
* [Examples](https://maptalks.github.io/examples/en/map/load/)
* [API Reference](https://maptalks.github.io/maptalks.js/api/0.x/Map.html)
* [Docs](https://github.com/maptalks/maptalks.js/wiki)
* [Style Reference](https://github.com/maptalks/maptalks.js/wiki/Symbol-Reference)
* [Plugins](http://maptalks.org/plugins.html)
   * [markercluster](https://github.com/maptalks/maptalks.markercluster)
   * [heatmap](https://github.com/maptalks/maptalks.heatmap)
   * [mapbox-gl-js](https://github.com/maptalks/maptalks.mapboxgl)
   * [three.js](https://github.com/maptalks/maptalks.three)
   * [echarts](https://github.com/maptalks/maptalks.e3)

## Supported Enviroments

* Modern browsers and IE9+ (only IE11 for 3D features)
* Mobile browsers
* Node >= 4.x (for [Server-Side Rendering](https://github.com/maptalks/maptalks.js/wiki/Server-Side-Rendering))
* Electron

**maptalks** is well tested against IE9, IE10, IE11, Firefox and Chrome by more than 1.6K test cases running on CI services.

## Install

* Standalone file

Download the [lastest release](https://github.com/maptalks/maptalks.js/releases) and load it in your HTML page like:
```html
<link href="path/to/maptalks.css" rel="stylesheet" type="text/css" />
<script src="path/to/maptalks.min.js" type="text/javascript"></script>
```

* CDN
Just include this in your html:
```html
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/maptalks/dist/maptalks.min.css">
<script src="https://cdn.jsdelivr.net/npm/maptalks/dist/maptalks.min.js"></script>
```

* NPM

```shell
npm install maptalks --save
```

## Plugin Development

It's easy and joyful to write plugins for maptalks, please check out [the tutorials](https://github.com/maptalks/maptalks.js/wiki) and begin to develop your own. And you are welcome to [share your work](https://github.com/maptalks/maptalks.github.io/issues/new) with us.

## Contributing

We warmly welcome any kind of contributions including issue reportings, pull requests, documentation corrections, feature requests and any other helps.

### Contributing Guide
Please read our [contributing guide](.github/CONTRIBUTING.md) to learn about our development process, how to propose fixes and improvements, and how to test your changes to maptalks.

## Acknowledgments

Maptalks is built on the shoulders of giants. Please refer to [ACKNOWLEDGEMENT](ACKNOWLEDGEMENT) for details.


text:
.class final Lcom/android/server/wifi/WifiSettingsStore;
.super Ljava/lang/Object;
.source "WifiSettingsStore.java"

# static fields
.field private static final WIFI_DISABLED:I = 0x0

.field private static final WIFI_DISABLED_AIRPLANE_ON:I = 0x3

.field private static final WIFI_ENABLED:I = 0x1

.field private static final WIFI_ENABLED_AIRPLANE_OVERRIDE:I = 0x2

# instance fields
.field private IsWifiStatePersist:Z

.field private mAirplaneModeOn:Z

.field private mCheckSavedStateAtBoot:Z

.field private final mContext:Landroid/content/Context;

.field private mPersistWifiState:I

.field private mScanAlwaysAvailable:Z

# direct methods
.method constructor <init>(Landroid/content/Context;)V
    .locals 2
    .param p1, "context"    # Landroid/content/Context;

    .prologue
    const/4 v1, 0x0

    .line 57
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 33
    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/android/server/wifi/WifiSettingsStore;->IsWifiStatePersist:Z

    .line 44
    iput v1, p0, Lcom/android/server/wifi/WifiSettingsStore;->mPersistWifiState:I

    .line 46
    iput-boolean v1, p0, Lcom/android/server/wifi/WifiSettingsStore;->mAirplaneModeOn:Z

    .line 55
    iput-boolean v1, p0, Lcom/android/server/wifi/WifiSettingsStore;->mCheckSavedStateAtBoot:Z

    .line 58
    iput-object p1, p0, Lcom/android/server/wifi/WifiSettingsStore;->mContext:Landroid/content/Context;

    .line 59
    invoke-direct {p0}, Lcom/android/server/wifi/WifiSettingsStore;->getPersistedAirplaneModeOn()Z

    move-result v0

    iput-boolean v0, p0, Lcom/android/server/wifi/WifiSettingsStore;->mAirplaneModeOn:Z

    .line 60
    invoke-direct {p0}, Lcom/android/server/wifi/WifiSettingsStore;->getPersistedWifiState()I

    move-result v0

    iput v0, p0, Lcom/android/server/wifi/WifiSettingsStore;->mPersistWifiState:I

    .line 61
    invoke-direct {p0}, Lcom/android/server/wifi/WifiSettingsStore;->getPersistedScanAlwaysAvailable()Z

    move-result v0

    iput-boolean v0, p0, Lcom/android/server/wifi/WifiSettingsStore;->mScanAlwaysAvailable:Z

    .line 62
    return-void
.end method

.method private getPersistedAirplaneModeOn()Z
    .locals 4

    .prologue
    const/4 v0, 0x1

    const/4 v1, 0x0

    .line 207
    iget-object v2, p0, Lcom/android/server/wifi/WifiSettingsStore;->mContext:Landroid/content/Context;

    invoke-virtual {v2}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v2

    const-string v3, "airplane_mode_on"

    invoke-static {v2, v3, v1}, Landroid/provider/Settings$Global;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

    move-result v2

    if-ne v2, v0, :cond_0

    :goto_0
    return v0

    :cond_0
    move v0, v1

    goto :goto_0
.end method

.method private getPersistedScanAlwaysAvailable()Z
    .locals 4

    .prologue
    const/4 v0, 0x1

    const/4 v1, 0x0

    .line 215
    const-string v2, "ro.boot.mode"

    const-string v3, "normal"

    invoke-static {v2, v3}, Landroid/os/SystemProperties;->get(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    const-string v3, "factory2"

    invoke-virtual {v2, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_0

    .line 219
    :goto_0
    return v1

    :cond_0
    iget-object v2, p0, Lcom/android/server/wifi/WifiSettingsStore;->mContext:Landroid/content/Context;

    invoke-virtual {v2}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v2

    const-string v3, "wifi_scan_always_enabled"

    invoke-static {v2, v3, v1}, Landroid/provider/Settings$Global;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

    move-result v2

    if-ne v2, v0, :cond_1

    :goto_1
    move v1, v0

    goto :goto_0

    :cond_1
    move v0, v1

    goto :goto_1
.end method

.method private getPersistedWifiState()I
    .locals 4

    .prologue
    const/4 v2, 0x0

    .line 197
    iget-object v3, p0, Lcom/android/server/wifi/WifiSettingsStore;->mContext:Landroid/content/Context;

    invoke-virtual {v3}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    .line 199
    .local v0, "cr":Landroid/content/ContentResolver;
    :try_start_0
    const-string v3, "wifi_on"

    invoke-static {v0, v3}, Landroid/provider/Settings$Global;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;)I
    :try_end_0
    .catch Landroid/provider/Settings$SettingNotFoundException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v2

    .line 202
    :goto_0
    return v2

    .line 200
    :catch_0
    move-exception v1

    .line 201
    .local v1, "e":Landroid/provider/Settings$SettingNotFoundException;
    const-string v3, "wifi_on"

    invoke-static {v0, v3, v2}, Landroid/provider/Settings$Global;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

    goto :goto_0
.end method

.method private isAirplaneSensitive()Z
    .locals 3

    .prologue
    .line 162
    iget-object v1, p0, Lcom/android/server/wifi/WifiSettingsStore;->mContext:Landroid/content/Context;

    invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v1

    const-string v2, "airplane_mode_radios"

    invoke-static {v1, v2}, Landroid/provider/Settings$Global;->getString(Landroid/content/ContentResolver;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 164
    .local v0, "airplaneModeRadios":Ljava/lang/String;
    if-eqz v0, :cond_0

    const-string v1, "wifi"

    invoke-virtual {v0, v1}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v1

    if-eqz v1, :cond_1

    :cond_0
    const/4 v1, 0x1

    :goto_0
    return v1

    :cond_1
    const/4 v1, 0x0

    goto :goto_0
.end method

.method private isAirplaneToggleable()Z
    .locals 3

    .prologue
    .line 170
    iget-object v1, p0, Lcom/android/server/wifi/WifiSettingsStore;->mContext:Landroid/content/Context;

    invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v1

    const-string v2, "airplane_mode_toggleable_radios"

    invoke-static {v1, v2}, Landroid/provider/Settings$Global;->getString(Landroid/content/ContentResolver;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 172
    .local v0, "toggleableRadios":Ljava/lang/String;
    if-eqz v0, :cond_0

    const-string v1, "wifi"

    invoke-virtual {v0, v1}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v1

    if-eqz v1, :cond_0

    const/4 v1, 0x1

    :goto_0
    return v1

    :cond_0
    const/4 v1, 0x0

    goto :goto_0
.end method

.method private persistWifiState(I)V
    .locals 2
    .param p1, "state"    # I

    .prologue
    .line 149
    iget-object v1, p0, Lcom/android/server/wifi/WifiSettingsStore;->mContext:Landroid/content/Context;

    invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    .line 150
    .local v0, "cr":Landroid/content/ContentResolver;
    iput p1, p0, Lcom/android/server/wifi/WifiSettingsStore;->mPersistWifiState:I

    .line 152
    iget-boolean v1, p0, Lcom/android/server/wifi/WifiSettingsStore;->IsWifiStatePersist:Z

    if-eqz v1, :cond_0

    .line 154
    const-string v1, "wifi_on"

    invoke-static {v0, v1, p1}, Landroid/provider/Settings$Global;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

    .line 158
    :cond_0
    return-void
.end method

.method private testAndClearWifiSavedState()Z
    .locals 6

    .prologue
    const/4 v3, 0x0

    const/4 v2, 0x1

    .line 184
    iget-object v4, p0, Lcom/android/server/wifi/WifiSettingsStore;->mContext:Landroid/content/Context;

    invoke-virtual {v4}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    .line 185
    .local v0, "cr":Landroid/content/ContentResolver;
    const/4 v1, 0x0

    .line 187
    .local v1, "wifiSavedState":I
    :try_start_0
    const-string v4, "wifi_saved_state"

    invoke-static {v0, v4}, Landroid/provider/Settings$Global;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;)I

    move-result v1

    .line 188
    if-ne v1, v2, :cond_0

    .line 189
    const-string v4, "wifi_saved_state"

    const/4 v5, 0x0

    invoke-static {v0, v4, v5}, Landroid/provider/Settings$Global;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
    :try_end_0
    .catch Landroid/provider/Settings$SettingNotFoundException; {:try_start_0 .. :try_end_0} :catch_0

    .line 193
    :cond_0
    :goto_0
    if-ne v1, v2, :cond_1

    :goto_1
    return v2

    :cond_1
    move v2, v3

    goto :goto_1

    .line 190
    :catch_0
    move-exception v4

    goto :goto_0
.end method

# virtual methods
.method declared-synchronized SetWifiStatePersist(Z)V
    .locals 1
    .param p1, "persist"    # Z

    .prologue
    .line 66
    monitor-enter p0

    :try_start_0
    iput-boolean p1, p0, Lcom/android/server/wifi/WifiSettingsStore;->IsWifiStatePersist:Z
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 67
    monitor-exit p0

    return-void

    .line 66
    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method dump(Ljava/io/FileDescriptor;Ljava/io/PrintWriter;[Ljava/lang/String;)V
    .locals 2
    .param p1, "fd"    # Ljava/io/FileDescriptor;
    .param p2, "pw"    # Ljava/io/PrintWriter;
    .param p3, "args"    # [Ljava/lang/String;

    .prologue
    .line 144
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "mPersistWifiState "

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    iget v1, p0, Lcom/android/server/wifi/WifiSettingsStore;->mPersistWifiState:I

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p2, v0}, Ljava/io/PrintWriter;->println(Ljava/lang/String;)V

    .line 145
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "mAirplaneModeOn "

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    iget-boolean v1, p0, Lcom/android/server/wifi/WifiSettingsStore;->mAirplaneModeOn:Z

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p2, v0}, Ljava/io/PrintWriter;->println(Ljava/lang/String;)V

    .line 146
    return-void
.end method

.method declared-synchronized handleAirplaneModeToggled()Z
    .locals 3

    .prologue
    const/4 v0, 0x1

    .line 119
    monitor-enter p0

    :try_start_0
    invoke-direct {p0}, Lcom/android/server/wifi/WifiSettingsStore;->isAirplaneSensitive()Z
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    move-result v1

    if-nez v1, :cond_1

    .line 120
    const/4 v0, 0x0

    .line 136
    :cond_0
    :goto_0
    monitor-exit p0

    return v0

    .line 123
    :cond_1
    :try_start_1
    invoke-direct {p0}, Lcom/android/server/wifi/WifiSettingsStore;->getPersistedAirplaneModeOn()Z

    move-result v1

    iput-boolean v1, p0, Lcom/android/server/wifi/WifiSettingsStore;->mAirplaneModeOn:Z

    .line 124
    iget-boolean v1, p0, Lcom/android/server/wifi/WifiSettingsStore;->mAirplaneModeOn:Z

    if-eqz v1, :cond_2

    .line 126
    iget v1, p0, Lcom/android/server/wifi/WifiSettingsStore;->mPersistWifiState:I

    if-ne v1, v0, :cond_0

    .line 127
    const/4 v1, 0x3

    invoke-direct {p0, v1}, Lcom/android/server/wifi/WifiSettingsStore;->persistWifiState(I)V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto :goto_0

    .line 119
    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0

    .line 131
    :cond_2
    :try_start_2
    invoke-direct {p0}, Lcom/android/server/wifi/WifiSettingsStore;->testAndClearWifiSavedState()Z

    move-result v1

    if-nez v1, :cond_3

    iget v1, p0, Lcom/android/server/wifi/WifiSettingsStore;->mPersistWifiState:I

    const/4 v2, 0x2

    if-ne v1, v2, :cond_0

    .line 133
    :cond_3
    const/4 v1, 0x1

    invoke-direct {p0, v1}, Lcom/android/server/wifi/WifiSettingsStore;->persistWifiState(I)V
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    goto :goto_0
.end method

.method declared-synchronized handleWifiScanAlwaysAvailableToggled()V
    .locals 1

    .prologue
    .line 140
    monitor-enter p0

    :try_start_0
    invoke-direct {p0}, Lcom/android/server/wifi/WifiSettingsStore;->getPersistedScanAlwaysAvailable()Z

    move-result v0

    iput-boolean v0, p0, Lcom/android/server/wifi/WifiSettingsStore;->mScanAlwaysAvailable:Z
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 141
    monitor-exit p0

    return-void

    .line 140
    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method declared-synchronized handleWifiToggled(Z)Z
    .locals 3
    .param p1, "wifiEnabled"    # Z

    .prologue
    const/4 v1, 0x1

    const/4 v0, 0x0

    .line 97
    monitor-enter p0

    :try_start_0
    iget-boolean v2, p0, Lcom/android/server/wifi/WifiSettingsStore;->mAirplaneModeOn:Z

    if-eqz v2, :cond_0

    invoke-direct {p0}, Lcom/android/server/wifi/WifiSettingsStore;->isAirplaneToggleable()Z
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    move-result v2

    if-nez v2, :cond_0

    .line 114
    :goto_0
    monitor-exit p0

    return v0

    .line 101
    :cond_0
    if-eqz p1, :cond_2

    .line 102
    :try_start_1
    iget-boolean v0, p0, Lcom/android/server/wifi/WifiSettingsStore;->mAirplaneModeOn:Z

    if-eqz v0, :cond_1

    .line 103
    const/4 v0, 0x2

    invoke-direct {p0, v0}, Lcom/android/server/wifi/WifiSettingsStore;->persistWifiState(I)V

    :goto_1
    move v0, v1

    .line 114
    goto :goto_0

    .line 105
    :cond_1
    const/4 v0, 0x1

    invoke-direct {p0, v0}, Lcom/android/server/wifi/WifiSettingsStore;->persistWifiState(I)V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto :goto_1

    .line 97
    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0

    .line 112
    :cond_2
    const/4 v0, 0x0

    :try_start_2
    invoke-direct {p0, v0}, Lcom/android/server/wifi/WifiSettingsStore;->persistWifiState(I)V
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    goto :goto_1
.end method

.method declared-synchronized isAirplaneModeOn()Z
    .locals 1

    .prologue
    .line 88
    monitor-enter p0

    :try_start_0
    iget-boolean v0, p0, Lcom/android/server/wifi/WifiSettingsStore;->mAirplaneModeOn:Z
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    monitor-exit p0

    return v0

    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method declared-synchronized isScanAlwaysAvailable()Z
    .locals 1

    .prologue
    .line 92
    monitor-enter p0

    :try_start_0
    iget-boolean v0, p0, Lcom/android/server/wifi/WifiSettingsStore;->mAirplaneModeOn:Z

    if-nez v0, :cond_0

    iget-boolean v0, p0, Lcom/android/server/wifi/WifiSettingsStore;->mScanAlwaysAvailable:Z
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    if-eqz v0, :cond_0

    const/4 v0, 0x1

    :goto_0
    monitor-exit p0

    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0

    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method declared-synchronized isWifiToggleEnabled()Z
    .locals 4

    .prologue
    const/4 v1, 0x0

    const/4 v0, 0x1

    .line 71
    monitor-enter p0

    :try_start_0
    iget-boolean v2, p0, Lcom/android/server/wifi/WifiSettingsStore;->mCheckSavedStateAtBoot:Z

    if-nez v2, :cond_1

    .line 72
    const/4 v2, 0x1

    iput-boolean v2, p0, Lcom/android/server/wifi/WifiSettingsStore;->mCheckSavedStateAtBoot:Z

    .line 73
    invoke-direct {p0}, Lcom/android/server/wifi/WifiSettingsStore;->testAndClearWifiSavedState()Z
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    move-result v2

    if-eqz v2, :cond_1

    .line 79
    :cond_0
    :goto_0
    monitor-exit p0

    return v0

    .line 76
    :cond_1
    :try_start_1
    iget-boolean v2, p0, Lcom/android/server/wifi/WifiSettingsStore;->mAirplaneModeOn:Z

    if-eqz v2, :cond_2

    .line 77
    iget v2, p0, Lcom/android/server/wifi/WifiSettingsStore;->mPersistWifiState:I

    const/4 v3, 0x2

    if-eq v2, v3, :cond_0

    move v0, v1

    goto :goto_0

    .line 79
    :cond_2
    iget v2, p0, Lcom/android/server/wifi/WifiSettingsStore;->mPersistWifiState:I
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    if-nez v2, :cond_0

    move v0, v1

    goto :goto_0

    .line 71
    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method


text:
<?php

namespace KoolKode\Async\Http\Http1;

use KoolKode\Async\Context;
use KoolKode\Async\Deferred;
use KoolKode\Async\Stream\ReadableMemoryStream;
use KoolKode\Async\Test\AsyncTestCase;

/**
 * @covers \KoolKode\Async\Http\Http1\EntityStream
 */
class EntityStreamTest extends AsyncTestCase
{
    public function testDeferResolvesWithTrueOnEof(Context $context)
    {
        $defer = new Deferred($context);
        $stream = new EntityStream(new ReadableMemoryStream($message = 'Hello World :)'), $defer);

        $this->assertEquals($message, yield $stream->readBuffer($context, 100, false));
        $this->assertTrue(yield $defer->promise());
    }

    public function testDeferResolvesWithFalseOnClose(Context $context)
    {
        $defer = new Deferred($context);
        $stream = new EntityStream(new ReadableMemoryStream(''), $defer);
        $stream->close();

        $this->assertFalse(yield $defer->promise());
    }

    public function testDeferResolvesWithFalseOnDestruct(Context $context)
    {
        $defer = new Deferred($context);
        $stream = new EntityStream(new ReadableMemoryStream(''), $defer);
        unset($stream);

        $this->assertFalse(yield $defer->promise());
    }
}


text:
package com.facebook.buck.intellij.plugin.ws.buckevents.consumers;

import com.intellij.util.messages.Topic;

import java.math.BigInteger;

public interface BuildRuleFailureConsumer {
    Topic<BuildRuleFailureConsumer> BUCK_BUILD_RULE_FAILURE = Topic.create(
            "buck.build-rule.failure",
            BuildRuleFailureConsumer.class
    );
    void consumeBuildRuleFailure(String build,
                                 String ruleKeySafe,
                                 String target,
                                 BigInteger timestamp,
                                 String message);
}


text:
class AlertList
  def initialize(zipcode)
    @response = HTTParty.get("http://api.wunderground.com/api/#{ENV["WUNDERGROUND_KEY"]}/alerts/q/#{zipcode}.json")
  end

  def all_alerts
    @response["alerts"].map {|a| Alert.new(a)}
  end

end

class Alert
  def initialize(json)
    @alert = json
  end

  def alert_type
    @alert["type"]
  end

  def alert_description
    @alert["description"]
  end

  def alert_date
    @alert["date"]
  end

  def alert_expires
    @alert["expires"]
  end

  def alert_message
    @alert["message"]
  end
end

# def test_alerts
#   list = AlertList.new(50301)
#   a = list.all_alerts.first
#   assert_equal "FLO", a.alert_type
#   assert_equal "Flood Warning", a.alert_description
#   assert_equal "3:32 PM CST on February 22, 2016", a.alert_date
#   assert_equal "6:00 AM CST on February 26, 2016", a.alert_expires
#   assert_equal "\n...Flood Warning now in effect until Thursday morning...\n\nThe Flood Warning continues for\n the Des Moines River at Des Moines se 6th St...or from below the \n center street dam...to Runnells.\n* Until Thursday morning.\n* At 3:00 PM Monday the stage was 23.3 feet...or 0.7 feet below \n flood stage.\n* Flood stage is 24.0 feet.\n* No flooding is occurring and minor flooding is forecast.\n* Forecast...rise to flood stage late this evening. Continue rising \n to 24.3 feet...or 0.3 feet above flood stage...midday Tuesday. \n Then begin falling and go below flood stage Thursday morning.\n* Impact...at 24.0 feet...the bike trail is closed east of Water \n Street. Portions of other bike trails are also affected.\n\n\nLat...Lon 4159 9356 4152 9333 4145 9333 4154 9356\n 4159 9366 4159 9356 \n\n\n\n\n", a.alert_message
# end


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

<title>thefourmarauders.requestschema</title>
<meta name="date" content="2015-12-03">
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">

thefourmarauders.requestschema

Classes

GroupSchema

LocationSchema

UserCreationRequest

UserSchema


text:
package org.jbpm.console.ng.pr.backend.server.listener;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.jbpm.kie.services.impl.IdentityProviderAwareProcessListener;
import org.jbpm.runtime.manager.api.qualifiers.Process;
import org.kie.api.event.process.ProcessEventListener;
import org.kie.api.runtime.KieSession;
import org.kie.internal.runtime.manager.EventListenerProducer;
@Process
public class IdentityProviderAwareProcessListenerProducer implements EventListenerProducer<ProcessEventListener> {

    @Override
    public List<ProcessEventListener> getEventListeners(String identifier,
                                                                        Map<String, Object> params) {

        List<ProcessEventListener> identityProviderAwareProcessListenerList =  new ArrayList<ProcessEventListener>();
        InitiatorProviderProcessListener initiatorProviderProcessListener = new InitiatorProviderProcessListener( (KieSession)params.get( "ksession" ) );
        identityProviderAwareProcessListenerList.add( initiatorProviderProcessListener );
        return identityProviderAwareProcessListenerList;
    }

}


text:
const { rollup } = require('rollup')
const babel = require('rollup-plugin-babel')

const files = [
  'pullToRefresh',
  ['styles/material/animates', 'ptrAnimatesMaterial'],
  ['styles/material2/animates', 'ptrAnimatesMaterial2'],
  ['styles/ios/animates', 'ptrAnimatesIos']
]

files.forEach(item => {
  let entry, name
  if (item.constructor === String) entry = name = item
  else [entry, name] = item

  rollup({
    input: `src/${entry}.js`,
    plugins: [babel()]
  }).then(bundle => [
    bundle.write({
      file: `dist/${entry}.js`,
      format: 'umd',
      name
    })
  ])
})


text:
.animate-show {
  opacity: 1;
  -webkit-transform: scaleY(1);
  -moz-transform: scaleY(1);
  -ms-transform: scaleY(1);
  -o-transform: scaleY(1);
  transform: scaleY(1);
}

.animate-show.ng-hide-add.ng-hide-add-active,
.animate-show.ng-hide-remove.ng-hide-remove-active {
  -webkit-transition: all linear 0.5s;
  -moz-transform: all linear 0.5s;
  -ms-transform: all linear 0.5s;
  -o-transform: all linear 0.5s;
  transition: all linear 0.5s;
}

.animate-show.ng-hide {
  opacity: 0;
  -webkit-transform: scaleY(0);
  -moz-transform: scaleY(0);
  -ms-transform: scaleY(0);
  -o-transform: scaleY(0);
  transform: scaleY(0);
}


text:
/*** </Vimeo> initialize***/
var huge_video_playing = {};
var autoplayMatch = {};
$('.thumb_wrapper').on('click', function (ev) {
    var hugeid = $(this).data('rowid');
    var myid = hugeid;
    myid = parseInt(myid);
    eval('player_' + myid + '.playVideo()')
    ev.preventDefault();

});

if (typeof sliderID_array == "undefined") {
    var sliderID_array = [];
}

var data_1 = [];
var event_stack_1 = [];
//huge_video_playing['video_is_playing_'+1]=false;
data_1["0"] = [];
data_1["0"]["id"] = "0";
data_1["0"]["image_url"] = "http://ototaihyundai.net/assets/includes/upload/images/2016/06/ototaihyundai.net-xetai.png";
data_1["0"]["description"] = "";
data_1["0"]["alt"] = "";
data_1["1"] = [];
data_1["1"]["id"] = "1";
data_1["1"]["image_url"] = "http://ototaihyundai.net/assets/includes/upload/images/2016/07/ototaihyundai.net-slide10.png";
data_1["1"]["description"] = "";
data_1["1"]["alt"] = "";
data_1["2"] = [];
data_1["2"]["id"] = "2";
data_1["2"]["image_url"] = "http://ototaihyundai.net/assets/includes/upload/images/2016/06/ototaihyundai.net-dongfeng.png";
data_1["2"]["description"] = "";
data_1["2"]["alt"] = "";
data_1["3"] = [];
data_1["3"]["id"] = "3";
data_1["3"]["image_url"] = "http://ototaihyundai.net/assets/includes/upload/images/2016/06/ototaihyundai.net-fuso.png";
data_1["3"]["description"] = "";
data_1["3"]["alt"] = "";
data_1["4"] = [];
data_1["4"]["id"] = "4";
data_1["4"]["image_url"] = "http://ototaihyundai.net/assets/includes/upload/images/2016/06/ototaihyundai.net-hyundai.png";
data_1["4"]["description"] = "";
data_1["4"]["alt"] = "";

var huge_it_trans_in_progress_1 = false;
var huge_it_transition_duration_1 = 1000;
var huge_interval = {};
var id_array_index = sliderID_array.length

var ifhasthumb = "dotstop";
sliderID_array[id_array_index] = // Stop autoplay.
    window.clearInterval(huge_interval['huge_it_playInterval_' + 1]);

var huge_it_current_key_1 = '';

function huge_it_move_dots_1() {
    var image_left = jQuery(".huge_it_slideshow_dots_active_1").position().left;
    var image_right = jQuery(".huge_it_slideshow_dots_active_1").position().left + jQuery(".huge_it_slideshow_dots_active_1").outerWidth(true);

}

function huge_it_testBrowser_cssTransitions_1() {
    return huge_it_testDom_1('Transition');
}

function huge_it_testBrowser_cssTransforms3d_1() {
    return huge_it_testDom_1('Perspective');
}

function huge_it_testDom_1(prop) {
    // Browser vendor CSS prefixes.
    var browserVendors = ['', '-webkit-', '-moz-', '-ms-', '-o-', '-khtml-'];
    // Browser vendor DOM prefixes.
    var domPrefixes = ['', 'Webkit', 'Moz', 'ms', 'O', 'Khtml'];
    var i = domPrefixes.length;
    while (i--) {
        if (typeof document.body.style[domPrefixes[i] + prop] !== 'undefined') {
            return true;
        }
    }
    return false;
}

function huge_it_cube_1(tz, ntx, nty, nrx, nry, wrx, wry, current_image_class, next_image_class, direction) {

    /* If browser does not support 3d transforms/CSS transitions.*/
    if (!huge_it_testBrowser_cssTransitions_1()) {
        jQuery(".huge_it_slideshow_dots_1").removeClass("huge_it_slideshow_dots_active_1").addClass("huge_it_slideshow_dots_deactive_1");
        jQuery("#huge_it_dots_" + huge_it_current_key_1 + "_1").removeClass("huge_it_slideshow_dots_deactive_1").addClass("huge_it_slideshow_dots_active_1");
        return huge_it_fallback_1(current_image_class, next_image_class, direction);
    }
    if (!huge_it_testBrowser_cssTransforms3d_1()) {
        return huge_it_fallback3d_1(current_image_class, next_image_class, direction);
    }
    //alert(current_image_class+' '+next_image_class);
    jQuery(current_image_class).css({
        'z-index': 'none'
    });
    jQuery(next_image_class).css({
        'z-index': 2
    });
    huge_it_trans_in_progress_1 = true;
    /* Set active thumbnail.*/
    jQuery(".huge_it_slideshow_dots_1").removeClass("huge_it_slideshow_dots_active_1").addClass("huge_it_slideshow_dots_deactive_1");
    jQuery("#huge_it_dots_" + huge_it_current_key_1 + "_1").removeClass("huge_it_slideshow_dots_deactive_1").addClass("huge_it_slideshow_dots_active_1");
    jQuery(".huge_it_slide_bg_1").css('perspective', 1000);
    jQuery(current_image_class).css({
        transform: 'translateZ(' + tz + 'px)',
        backfaceVisibility: 'hidden'
    });

    jQuery(".huge_it_slideshow_image_wrap_1,.huge_it_slide_bg_1,.huge_it_slideshow_image_item_1,.huge_it_slideshow_image_second_item_1 ").css('overflow', 'visible');

    jQuery(next_image_class).css({
        opacity: 1,
        filter: 'Alpha(opacity=100)',
        backfaceVisibility: 'hidden',
        transform: 'translateY(' + nty + 'px) translateX(' + ntx + 'px) rotateY(' + nry + 'deg) rotateX(' + nrx + 'deg)'
    });
    jQuery(".huge_it_slider_1").css({
        transform: 'translateZ(-' + tz + 'px)',
        transformStyle: 'preserve-3d'
    });
    /* Execution steps.*/
    setTimeout(function () {
        jQuery(".huge_it_slider_1").css({
            transition: 'all ' + huge_it_transition_duration_1 + 'ms ease-in-out',
            transform: 'translateZ(-' + tz + 'px) rotateX(' + wrx + 'deg) rotateY(' + wry + 'deg)'
        });
    }, 20);
    /* After transition.*/
    jQuery(".huge_it_slider_1").one('webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend', jQuery.proxy(huge_it_after_trans));

    function huge_it_after_trans() {
        /*if (huge_it_from_focus_1) {
          huge_it_from_focus_1 = false;
          return;
        }*/
        jQuery(".huge_it_slide_bg_1,.huge_it_slideshow_image_item_1,.huge_it_slideshow_image_second_item_1 ").css('overflow', 'hidden');
        jQuery(".huge_it_slide_bg_1").removeAttr('style');
        jQuery(current_image_class).removeAttr('style');
        jQuery(next_image_class).removeAttr('style');
        jQuery(".huge_it_slider_1").removeAttr('style');
        // alert(current_image_class+' '+next_image_class);
        jQuery(current_image_class).css({
            'opacity': 0,
            filter: 'Alpha(opacity=0)',
            'z-index': 1
        });
        jQuery(next_image_class).css({
            'opacity': 1,
            filter: 'Alpha(opacity=100)',
            'z-index': 2
        });
        // huge_it_change_watermark_container_1();
        huge_it_trans_in_progress_1 = false;
        if (typeof event_stack_1 !== 'undefined' && event_stack_1.length > 0) {
            key = event_stack_1[0].split("-");
            event_stack_1.shift();
            huge_it_change_image_1(key[0], key[1], data_1, true, false);
        }
    }
}

function huge_it_cubeH_1(current_image_class, next_image_class, direction) {
    /* Set to half of image width.*/
    var dimension = jQuery(current_image_class).width() / 2;
    if (direction == 'right') {
        huge_it_cube_1(dimension, dimension, 0, 0, 90, 0, -90, current_image_class, next_image_class, direction);
    } else if (direction == 'left') {
        huge_it_cube_1(dimension, -dimension, 0, 0, -90, 0, 90, current_image_class, next_image_class, direction);
    }
}

function huge_it_cubeV_1(current_image_class, next_image_class, direction) {
    /* Set to half of image height.*/
    var dimension = jQuery(current_image_class).height() / 2;
    /* If next slide.*/
    if (direction == 'right') {
        huge_it_cube_1(dimension, 0, -dimension, 90, 0, -90, 0, current_image_class, next_image_class, direction);
    } else if (direction == 'left') {
        huge_it_cube_1(dimension, 0, dimension, -90, 0, 90, 0, current_image_class, next_image_class, direction);
    }
}
/* For browsers that does not support transitions.*/
function huge_it_fallback_1(current_image_class, next_image_class, direction) {
    huge_it_fade_1(current_image_class, next_image_class, direction);
}
/* For browsers that support transitions, but not 3d transforms (only used if primary transition makes use of 3d-transforms).*/
function huge_it_fallback3d_1(current_image_class, next_image_class, direction) {
    huge_it_sliceV_1(current_image_class, next_image_class, direction);
}

function huge_it_none_1(current_image_class, next_image_class, direction) {
    jQuery(current_image_class).css({
        'opacity': 0,
        'z-index': 1
    });
    jQuery(next_image_class).css({
        'opacity': 1,
        'z-index': 2
    });

    /* Set active thumbnail.*/
    jQuery(".huge_it_slideshow_dots_1").removeClass("huge_it_slideshow_dots_active_1").addClass("huge_it_slideshow_dots_deactive_1");
    jQuery("#huge_it_dots_" + huge_it_current_key_1 + "_1").removeClass("huge_it_slideshow_dots_deactive_1").addClass("huge_it_slideshow_dots_active_1");
}

function huge_it_fade_1(current_image_class, next_image_class, direction) {
    if (huge_it_testBrowser_cssTransitions_1()) {

        jQuery(next_image_class).css('transition', 'opacity ' + huge_it_transition_duration_1 + 'ms linear');
        jQuery(current_image_class).css('transition', 'opacity ' + huge_it_transition_duration_1 + 'ms linear');
        jQuery(current_image_class).css({
            'opacity': 0,
            'z-index': 1
        });
        jQuery(next_image_class).css({
            'opacity': 1,
            'z-index': 2
        });
    } else {

        jQuery(current_image_class).animate({
            'opacity': 0,
            'z-index': 1
        }, huge_it_transition_duration_1);
        jQuery(next_image_class).animate({
            'opacity': 1,
            'z-index': 2
        }, {
            duration: huge_it_transition_duration_1,
            complete: function () {
                return false;
            }
        });
        // For IE.
        jQuery(current_image_class).fadeTo(huge_it_transition_duration_1, 0);
        jQuery(next_image_class).fadeTo(huge_it_transition_duration_1, 1);
    }
    jQuery(".huge_it_slideshow_dots_1").removeClass("huge_it_slideshow_dots_active_1").addClass("huge_it_slideshow_dots_deactive_1");
    jQuery("#huge_it_dots_" + huge_it_current_key_1 + "_1").removeClass("huge_it_slideshow_dots_deactive_1").addClass("huge_it_slideshow_dots_active_1");
}

function huge_it_grid_1(cols, rows, ro, tx, ty, sc, op, current_image_class, next_image_class, direction) {
    /* If browser does not support CSS transitions.*/
    if (!huge_it_testBrowser_cssTransitions_1()) {
        jQuery(".huge_it_slideshow_dots_1").removeClass("huge_it_slideshow_dots_active_1").addClass("huge_it_slideshow_dots_deactive_1");
        jQuery("#huge_it_dots_" + huge_it_current_key_1 + "_1").removeClass("huge_it_slideshow_dots_deactive_1").addClass("huge_it_slideshow_dots_active_1");
        return huge_it_fallback_1(current_image_class, next_image_class, direction);

    }
    huge_it_trans_in_progress_1 = true;
    /* Set active thumbnail.*/
    jQuery(".huge_it_slideshow_dots_1").removeClass("huge_it_slideshow_dots_active_1").addClass("huge_it_slideshow_dots_deactive_1");
    jQuery("#huge_it_dots_" + huge_it_current_key_1 + "_1").removeClass("huge_it_slideshow_dots_deactive_1").addClass("huge_it_slideshow_dots_active_1");
    /* The time (in ms) added to/subtracted from the delay total for each new gridlet.*/
    var count = (huge_it_transition_duration_1) / (cols + rows);
    /* Gridlet creator (divisions of the image grid, positioned with background-images to replicate the look of an entire slide image when assembled)*/
    function huge_it_gridlet(width, height, top, img_top, left, img_left, src, imgWidth, imgHeight, c, r) {
        var delay = (c + r) * count;
        /* Return a gridlet elem with styles for specific transition.*/
        return jQuery('<div class="huge_it_gridlet_1" />').css({
            width: width,
            height: height,
            top: top,
            left: left,
            backgroundImage: 'url("' + src + '")',
            backgroundColor: jQuery(".huge_it_slideshow_image_wrap_1").css("background-color"),
            /*backgroundColor: rgba(0, 0, 0, 0),*/
            backgroundRepeat: 'no-repeat',
            backgroundPosition: img_left + 'px ' + img_top + 'px',
            backgroundSize: imgWidth + 'px ' + imgHeight + 'px',
            transition: 'all ' + huge_it_transition_duration_1 + 'ms ease-in-out ' + delay + 'ms',
            transform: 'none'
        });
    }
    /* Get the current slide's image.*/
    var cur_img = jQuery(current_image_class).find('img');
    /* Create a grid to hold the gridlets.*/
    var grid = jQuery('<div />').addClass('huge_it_grid_1');
    /* Prepend the grid to the next slide (i.e. so it's above the slide image).*/
    jQuery(current_image_class).prepend(grid);
    /* vars to calculate positioning/size of gridlets*/
    var cont = jQuery(".huge_it_slide_bg_1");
    var imgWidth = cur_img.width();
    var imgHeight = cur_img.height();
    var contWidth = cont.width(),
        contHeight = cont.height(),
        imgSrc = cur_img.attr('src'),
        /*.replace('/thumb', ''),*/
        colWidth = Math.floor(contWidth / cols),
        rowHeight = Math.floor(contHeight / rows),
        colRemainder = contWidth - (cols * colWidth),
        colAdd = Math.ceil(colRemainder / cols),
        rowRemainder = contHeight - (rows * rowHeight),
        rowAdd = Math.ceil(rowRemainder / rows),
        leftDist = 0,
        img_leftDist = (jQuery(".huge_it_slide_bg_1").width() - cur_img.width()) / 2;
    tx = tx === 'auto' ? contWidth : tx;
    tx = tx === 'min-auto' ? -contWidth : tx;
    ty = ty === 'auto' ? contHeight : ty;
    ty = ty === 'min-auto' ? -contHeight : ty;
    /* Loop through cols*/
    for (var i = 0; i < cols; i++) {
        var topDist = 0,
            img_topDst = (jQuery(".huge_it_slide_bg_1").height() - cur_img.height()) / 2,
            newColWidth = colWidth;
        if (colRemainder > 0) {
            var add = colRemainder >= colAdd ? colAdd : colRemainder;
            newColWidth += add;
            colRemainder -= add;
        }
        for (var j = 0; j < rows; j++) {
            var newRowHeight = rowHeight,
                newRowRemainder = rowRemainder;
            if (newRowRemainder > 0) {
                add = newRowRemainder >= rowAdd ? rowAdd : rowRemainder;
                newRowHeight += add;
                newRowRemainder -= add;
            }
            grid.append(huge_it_gridlet(newColWidth, newRowHeight, topDist, img_topDst, leftDist, img_leftDist, imgSrc, imgWidth, imgHeight, i, j));
            topDist += newRowHeight;
            img_topDst -= newRowHeight;
        }
        img_leftDist -= newColWidth;
        leftDist += newColWidth;
    }
    var last_gridlet = grid.children().last();
    grid.show();
    cur_img.css('opacity', 0);
    grid.children().first().addClass('rs-top-left');
    grid.children().last().addClass('rs-bottom-right');
    grid.children().eq(rows - 1).addClass('rs-bottom-left');
    grid.children().eq(-rows).addClass('rs-top-right');
    setTimeout(function () {
        grid.children().css({
            opacity: op,
            transform: 'rotate(' + ro + 'deg) translateX(' + tx + 'px) translateY(' + ty + 'px) scale(' + sc + ')'
        });
    }, 1);
    jQuery(next_image_class).css('opacity', 1);
    /* After transition.*/
    jQuery(last_gridlet).one('webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend', jQuery.proxy(huge_it_after_trans));

    function huge_it_after_trans() {
        jQuery(current_image_class).css({
            'opacity': 0,
            'z-index': 1
        });
        jQuery(next_image_class).css({
            'opacity': 1,
            'z-index': 2
        });
        cur_img.css('opacity', 1);
        grid.remove();
        huge_it_trans_in_progress_1 = false;
        if (typeof event_stack_1 !== 'undefined' && event_stack_1.length > 0) {
            key = event_stack_1[0].split("-");
            event_stack_1.shift();
            huge_it_change_image_1(key[0], key[1], data_1, true, false);
        }
    }
}

function huge_it_sliceH_1(current_image_class, next_image_class, direction) {
    if (direction == 'right') {
        var translateX = 'min-auto';
    } else if (direction == 'left') {
        var translateX = 'auto';
    }
    huge_it_grid_1(1, 8, 0, translateX, 0, 1, 0, current_image_class, next_image_class, direction);
}

function huge_it_sliceV_1(current_image_class, next_image_class, direction) {
    if (direction == 'right') {
        var translateY = 'min-auto';
    } else if (direction == 'left') {
        var translateY = 'auto';
    }
    huge_it_grid_1(10, 1, 0, 0, translateY, 1, 0, current_image_class, next_image_class, direction);
}

function huge_it_slideV_1(current_image_class, next_image_class, direction) {
    if (direction == 'right') {
        var translateY = 'auto';
    } else if (direction == 'left') {
        var translateY = 'min-auto';
    }
    huge_it_grid_1(1, 1, 0, 0, translateY, 1, 1, current_image_class, next_image_class, direction);
}

function huge_it_slideH_1(current_image_class, next_image_class, direction) {
    if (direction == 'right') {
        var translateX = 'min-auto';
    } else if (direction == 'left') {
        var translateX = 'auto';
    }
    huge_it_grid_1(1, 1, 0, translateX, 0, 1, 1, current_image_class, next_image_class, direction);
}

function huge_it_scaleOut_1(current_image_class, next_image_class, direction) {
    huge_it_grid_1(1, 1, 0, 0, 0, 1.5, 0, current_image_class, next_image_class, direction);
}

function huge_it_scaleIn_1(current_image_class, next_image_class, direction) {
    huge_it_grid_1(1, 1, 0, 0, 0, 0.5, 0, current_image_class, next_image_class, direction);
}

function huge_it_blockScale_1(current_image_class, next_image_class, direction) {
    huge_it_grid_1(8, 6, 0, 0, 0, .6, 0, current_image_class, next_image_class, direction);
}

function huge_it_kaleidoscope_1(current_image_class, next_image_class, direction) {
    huge_it_grid_1(10, 8, 0, 0, 0, 1, 0, current_image_class, next_image_class, direction);
}

function huge_it_fan_1(current_image_class, next_image_class, direction) {
    if (direction == 'right') {
        var rotate = 45;
        var translateX = 100;
    } else if (direction == 'left') {
        var rotate = -45;
        var translateX = -100;
    }
    huge_it_grid_1(1, 10, rotate, translateX, 0, 1, 0, current_image_class, next_image_class, direction);
}

function huge_it_blindV_1(current_image_class, next_image_class, direction) {
    huge_it_grid_1(1, 8, 0, 0, 0, .7, 0, current_image_class, next_image_class);
}

function huge_it_blindH_1(current_image_class, next_image_class, direction) {
    huge_it_grid_1(10, 1, 0, 0, 0, .7, 0, current_image_class, next_image_class);
}

function huge_it_random_1(current_image_class, next_image_class, direction) {
    var anims = ['sliceH', 'sliceV', 'slideH', 'slideV', 'scaleOut', 'scaleIn', 'blockScale', 'kaleidoscope', 'fan', 'blindH', 'blindV'];
    /* Pick a random transition from the anims array.*/
    this["huge_it_" + anims[Math.floor(Math.random() * anims.length)] + "_1"](current_image_class, next_image_class, direction);
}

function iterator_1() {
    var iterator = 1;

    return iterator;
}

function huge_it_change_image_1(current_key, key, data_1, from_effect, clicked) {

    if (data_1[key]) {
        if (!from_effect) {
            jQuery("#huge_it_current_image_key_1").val(key);
            current_key = jQuery(".huge_it_slideshow_dots_active_1").attr("data-image_key");
        }

        if (huge_it_trans_in_progress_1) {
            event_stack_1.push(current_key + '-' + key);
            return;
        }
        var direction = 'right';
        if (huge_it_current_key_1 > key) {
            var direction = 'left';
        } else if (huge_it_current_key_1 == key) {
            return false;
        }
        huge_it_current_key_1 = key;
        jQuery("#huge_it_slideshow_image_1").attr('data-image_id', data_1[key]["id"]);

        jQuery(".huge_it_slideshow_title_text_1").html(data_1[key]["alt"]);
        jQuery(".huge_it_slideshow_description_text_1").html(data_1[key]["description"]);

        var current_image_class = "#image_id_1_" + data_1[current_key]["id"];
        var next_image_class = "#image_id_1_" + data_1[key]["id"];
        if (jQuery(current_image_class).find('.huge_it_video_frame_1').length > 0) {
            var streffect = 'random';
            if (streffect == "cubeV" || streffect == "cubeH" || streffect == "none" || streffect == "fade") {
                huge_it_random_1(current_image_class, next_image_class, direction);
            } else {
                huge_it_fade_1(current_image_class, next_image_class, direction);
            }
        } else {
            huge_it_random_1(current_image_class, next_image_class, direction);
        }
        jQuery('.huge_it_slideshow_title_text_1').removeClass('none');
        if (jQuery('.huge_it_slideshow_title_text_1').html() == "") {
            jQuery('.huge_it_slideshow_title_text_1').addClass('none');
        }

        jQuery('.huge_it_slideshow_description_text_1').removeClass('none');
        if (jQuery('.huge_it_slideshow_description_text_1').html() == "") {
            jQuery('.huge_it_slideshow_description_text_1').addClass('none');
        }
        jQuery(current_image_class).find('.huge_it_slideshow_title_text_1').addClass('none');
        jQuery(current_image_class).find('.huge_it_slideshow_description_text_1').addClass('none');
        huge_it_move_dots_1();
        /*** <vy api>  for vimeo and youtube stop pause play etc... ***/
        var nextVideo = jQuery('#video_id_1_' + key).attr('data-element-id');
        var currentVideo = jQuery('#video_id_1_' + current_key).attr('data-element-id'); /*** add ***/
        (currentVideo || nextVideo) && stopYoutubeVideo(currentVideo, nextVideo);
        if ((jQuery('#player_1_' + current_key)).hasClass('huge-it-iframe-vimeo')) {
            jQuery('#player_1_' + current_key).vimeo('pause');

        }
        if ((jQuery('#player_1_' + key)).hasClass('huge-it-iframe-vimeo') && ('off' == 'on')) {
            jQuery('#player_1_' + key).vimeo('play');
        }
        window.clearInterval(huge_interval['huge_it_playInterval_' + 1]);
        play_1();
    }
}
var staticthumbWidth;
jQuery(window).load(function () {
    staticthumbWidth = jQuery('#huge_it_thumb_slider>li').width()

})

function huge_it_popup_resize_1() {
    var staticsliderwidth = 1360;
    var sliderwidth = 1360;
    var thumbWidth = jQuery(".huge_it_slideshow_thumbnails_1").width();
    var bodyWidth = jQuery(window).width();
    var parentWidth = jQuery(".huge_it_slideshow_image_wrap_1").parent().width();
    //if responsive js late responsive.js @  take body size and not parent div
    jQuery(".huge_it_slideshow_thumbnails_1").css({
        height: 100
    });
    if (sliderwidth > parentWidth) {
        sliderwidth = parentWidth;
    }
    if (sliderwidth > bodyWidth) {
        sliderwidth = bodyWidth;
    }
    var str = (500 / staticsliderwidth);

    jQuery(".huge_it_slideshow_thumbnails_1").css({
        width: thumbWidth
    });

    var str2 = (100 / staticthumbWidth);

    jQuery(".huge_it_slideshow_thumbnails_1").css({
        height: thumbWidth * str2
    });
    jQuery(".bx-viewport").css({
        height: thumbWidth * str2
    });
    jQuery(".huge_it_slideshow_image_wrap_1").css({
        width: (sliderwidth)
    });
    jQuery(".huge_it_slideshow_image_wrap_1").css({
        height: ((sliderwidth) * str)
    });

    jQuery(".huge_it_slideshow_image_container_1").css({
        width: (sliderwidth)
    });
    jQuery(".huge_it_slideshow_image_container_1").css({
        height: ((sliderwidth) * str)
    });

    if ("top" == "middle") {
        var titlemargintopminus = jQuery(".huge_it_slideshow_title_text_1").outerHeight() / 2;
    }
    if ("right" == "center") {
        var titlemarginleftminus = jQuery(".huge_it_slideshow_title_text_1").outerWidth() / 2;
    }
    jQuery(".huge_it_slideshow_title_text_1").css({
        cssText: "margin-top:-" + titlemargintopminus + "px; margin-left:-" + titlemarginleftminus + "px;"
    });

    if ("bottom" == "middle") {
        var descriptionmargintopminus = jQuery(".huge_it_slideshow_description_text_1").outerHeight() / 2;
    }
    if ("right" == "center") {
        var descriptionmarginleftminus = jQuery(".huge_it_slideshow_description_text_1").outerWidth() / 2;
    }
    jQuery(".huge_it_slideshow_description_text_1").css({
        cssText: "margin-top:-" + descriptionmargintopminus + "px; margin-left:-" + descriptionmarginleftminus + "px;"
    });
    jQuery("#huge_it_loading_image_1").css({
        display: "none"
    });
    jQuery(".huge_it_slideshow_image_wrap1_1").css({
        display: "block"
    });
    jQuery(".huge_it_slideshow_image_wrap_1").removeClass("nocolor");

    if ("resize" == "resize") {
        jQuery(".huge_it_slideshow_image_1,  .huge_it_slideshow_image_container_1 img").css({
            cssText: "width:" + sliderwidth + "px; height:" + ((sliderwidth) * str) + "px;"
        });
    } else {
        jQuery(".huge_it_slideshow_image_1,.huge_it_slideshow_image_item2_1").css({
            cssText: "max-width: " + sliderwidth + "px !important; max-height: " + (sliderwidth * str) + "px !important;"
        });
    }

    jQuery('.huge_it_video_frame_1').each(function (e) {
        jQuery(this).width(sliderwidth);
        jQuery(this).height(sliderwidth * str);
    });
}

jQuery(window).load(function () {
    jQuery(window).resize(function () {
        huge_it_popup_resize_1();
    });

    jQuery('#huge_it_slideshow_left_1').on('click', function () {
        huge_it_change_image_1(parseInt(jQuery('#huge_it_current_image_key_1').val()), (parseInt(jQuery('#huge_it_current_image_key_1').val()) - iterator_1()) >= 0 ? (parseInt(jQuery('#huge_it_current_image_key_1').val()) - iterator_1()) % data_1.length : data_1.length - 1, data_1, false, true);
        return false;
    });

    jQuery('#huge_it_slideshow_right_1').on('click', function () {
        huge_it_change_image_1(parseInt(jQuery('#huge_it_current_image_key_1').val()), (parseInt(jQuery('#huge_it_current_image_key_1').val()) + iterator_1()) % data_1.length, data_1, false, true);
        return false;
    });
    huge_it_popup_resize_1();
    /* Disable right click.*/
    jQuery('div[id^="huge_it_container"]').bind("contextmenu", function () {
        return false;
    });

    /*HOVER SLIDESHOW*/
    jQuery("#huge_it_slideshow_image_container_1, .huge_it_slideshow_image_container_1, .huge_it_slideshow_dots_container_1,#huge_it_slideshow_right_1,#huge_it_slideshow_left_1").hover(function () {
        //errorlogjQuery(".huge_it_slideshow_image_wrap_1").after(" -- hover -- <br /> ");
        jQuery("#huge_it_slideshow_right_1").css({
            'display': 'inline'
        });
        jQuery("#huge_it_slideshow_left_1").css({
            'display': 'inline'
        });
    }, function () {
        jQuery("#huge_it_slideshow_right_1").css({
            'display': 'none'
        });
        jQuery("#huge_it_slideshow_left_1").css({
            'display': 'none'
        });
    });
    var pausehover = "on";
    if (pausehover == "on") {
        jQuery("#huge_it_slideshow_image_container_1, .huge_it_slideshow_image_container_1").hover(function () {
            window.clearInterval(huge_interval['huge_it_playInterval_' + 1]);
        }, function () {
            window.clearInterval(huge_interval['huge_it_playInterval_' + 1]);
            play_1();
        });
    }
    play_1();
});

function play_1() {
    huge_interval['huge_it_playInterval_' + 1] = setInterval(function () {
        var iterator = 1;
        huge_it_change_image_1(parseInt(jQuery('#huge_it_current_image_key_1').val()), (parseInt(jQuery('#huge_it_current_image_key_1').val()) + iterator) % data_1.length, data_1, false, false);
    }, '5000');
}

jQuery(window).focus(function () {
    var i_1 = 0;
    jQuery(".huge_it_slider_1").children("div").each(function () {
        if (jQuery(this).css('opacity') == 1) {
            jQuery("#huge_it_current_image_key_1").val(i_1);
        }
        i_1++;
    });
});
jQuery(window).blur(function () {
    console.log(event_stack_1);
    window.clearInterval(huge_interval['huge_it_playInterval_' + 1]);
});
jQuery(window).focus(function () {
    play_1()
});
var YTdeferred = jQuery.Deferred();
window.onYouTubeIframeAPIReady = function () {
    //resolve when youtube callback is called passing YT as a parameter
    YTdeferred.resolve(window.YT);

};
YTdeferred.done(function (YT) {

    jQuery('.huge-it-iframe').each(function () {

        var el_id = jQuery(this).attr('data-element-id');
        var volume = HUGEIT_YT_IFRAMES['iframe' + el_id]['volume'];

        window['onPlayerReady' + el_id] = function (event) {
            window['player_' + el_id]['setVolume'](volume);
        }
    });

    jQuery('.huge-it-iframe').each(function () {

        var id = jQuery(this).attr('id');
        var el_id = jQuery(this).attr('data-element-id');
        var controls = HUGEIT_YT_IFRAMES['iframe' + el_id]['controls'];
        var showinfo = HUGEIT_YT_IFRAMES['iframe' + el_id]['showinfo'];
        var url = HUGEIT_YT_IFRAMES['iframe' + el_id]['videoId'];
        controls || (controls = 0);
        showinfo || (showinfo = 0);

        window['player_' + el_id] = new YT.Player(id, {
            height: '500',
            width: '1360',
            videoId: url,
            playerVars: {
                'controls': controls, // 0,
                'showinfo': showinfo, //0,
                'rel': 0
            },
            events: {
                'onError': window['onPlayerError' + el_id],
                'onReady': window['onPlayerReady' + el_id],
                'onStateChange': window['onPlayerStateChange' + el_id],
                'loop': 1
            }
        });
    })
});

jQuery(function () {

    jQuery('.huge-it-iframe').each(function () {

        var el_id = jQuery(this).attr('data-element-id');
        var quality = HUGEIT_YT_IFRAMES['iframe' + el_id]['quality'];

        window['onPlayerStateChange' + el_id] = function (event) {

            if (event.data == YT.PlayerState.PLAYING) {
                HUGEIT_YT_IFRAMES['iframe' + el_id]['state'] = 'played';
                event.target.setPlaybackQuality(quality);
            }
        }
    });

});

function stopYoutubeVideo(currentVideo, nextVideo) {

    if (currentVideo) {
        (HUGEIT_YT_IFRAMES['iframe' + currentVideo]['state']) ? currentVideo && (window['player_' + currentVideo]['pauseVideo']()): currentVideo && (window['player_' + currentVideo]['stopVideo']());
    }
    nextVideo && HUGEIT_YT_IFRAMES['iframe' + nextVideo]['autoplay'] && (window['player_' + nextVideo]['playVideo']());
}

function stopVimeoVideo(currentVideo, nextVideo) {
    jQuery(currentVideo).vimeo('pause');
    jQuery(nextVideo).vimeo('play');
}
/*** <Vimeo> initialize And youtube autopay ***/

jQuery(window).load(function () {

    (function VimeoOptionsReady() { //calling funtion once
        jQuery('.huge-it-iframe-vimeo').each(function () {
            var el_id = jQuery(this).attr('data-element-id');
            jQuery(this).vimeo('setColor', HUGEIT_VIMEOS['iframe' + el_id]['color']);
            jQuery(this).vimeo('setVolume', HUGEIT_VIMEOS['iframe' + el_id]['volume']);
        })
    }());

    if ('off' == 'on') {

        if (jQuery('.huge-it-iframe-vimeo.autoplay').length) {

            (function AutoplayVimeo() {
                var setplayVideo = setInterval(hugeitframe, 100);

                function hugeitframe() {
                    var vimeo1 = jQuery('.huge_it_slider_1 li').first().find('.autoplay')
                    if (vimeo1.length) {
                        vimeo1.vimeo('play');
                        clearInterval(setplayVideo);
                    }
                };
            }());
        };

        if (jQuery('.huge-it-iframe.autoplay').length) {

            (function AutoplayYoutube() {
                var setplayVideo = setInterval(hugeitframe, 100);

                function hugeitframe() {
                    jQuery('.huge-it-iframe.autoplay').each(function () {

                        var el_id = jQuery(this).attr('data-element-id');

                        if (window['player_' + el_id]) {
                            window['player_' + el_id]['playVideo']();
                            clearInterval(setplayVideo);
                        }
                    });
                }
            }());
        };

    }
});
jQuery(document).ready(function ($) {
    setInterval(function () {
        jQuery('.huge_it_slider_1').find("li").each(function () {
            if ($(this).css("opacity") == "1") {
                var img_id = $(this).attr('id');
                jQuery('.huge_it_slideshow_thumbs_1').each(function () {
                    //if ($(this).hasClass('bx-clone')){$(this).removeAttr('id')}
                    var allListElements = $('li[id=' + img_id + ']');
                    $(this).find(allListElements).not(".bx-clone").each(function () {
                        jQuery('.huge_it_slideshow_thumbs_1 li').find(".trans_back").css('background', 'rgba(255,255,255,0.3)');
                        $(this).find('.trans_back').css('background', 'none');
                    })
                })
            }
        })
    }, 100)
})


text:
This text describes the Python-based Environment API defined by `dm_env`.

## Overview

The main interaction with an environment is via the `step()` method.

Each call to an environment's `step()` method takes an `action` parameter
and returns a `TimeStep` namedtuple with fields

```none
step_type, reward, discount, observation
```

A **sequence** consists of a series of `TimeStep`s returned by consecutive calls
to `step()`. In many settings we refer to each sequence as an *episode*. Each
sequence starts with a `step_type` of `FIRST`, ends with a `step_type` of
`LAST`, and has a `step_type` of `MID` for all intermediate `TimeStep`s.

As well as `step()`, each environment implements a `reset()` method. This takes
no arguments, forces the start of a new sequence and returns the first
`TimeStep`. See the [run loop samples](#run-loop-samples) below for more
details.

Calling `step()` on a new environment instance, or immediately after a
`TimeStep` with a `step_type` of `LAST` is equivalent to calling `reset()`. In
other words, the `action` argument will be ignored and a new sequence will
begin, starting with a `step_type` of `FIRST`.

NOTE: The `discount` does *not* determine when a sequence ends. The `discount`
may be 0 in the middle of a sequence and ≥0 at the end of a sequence.

### Example sequences

We show two examples of sequences below, along with the first `TimeStep` of the
next sequence.

Each row corresponds to the tuple returned by an environment's `step()` method.
We use `r`, `ɣ` and `obs` to denote the reward, discount and observation
respectively, `x` to denote a `None` or optional value at a timestep, and `✓`
to denote a value that exists at a timestep.

Example: A sequence where the end of the *prediction*—the discounted sum of
future rewards that we wish to predict—coincides with the end of the sequence.
i.e., this sequence ends with a discount of 0. Such a sequence could represent a
single episode of a *finite-horizon* RL task.

```none
(r, ɣ, obs)  | (x, x, ✓) →  (✓, ✓, ✓)  →  (✓, 0, ✓) ⇢ (x, x, ✓)
step_type    |   FIRST         MID           LAST       FIRST
```

Example: Here the prediction does not terminate at the end of the sequence,
which ends with a nonzero discount. This type of termination is sometimes used
in *infinite-horizon* RL settings.

```none
(r, ɣ, obs)  | (x, x, ✓) →  (✓, ✓, ✓)  →  (✓, > 0, ✓) ⇢ (x, x, ✓)
step_type    |   FIRST         MID           LAST         FIRST
```

In general, a discount of `0` does not need to coincide with the end of a
sequence. An environment may return `ɣ = 0` in the middle of a sequence, and
may do this multiple times within a sequence. We do not (typically) call these
sub-sequences episodes.

The `step_type` can potentially be used by an agent. For instance, some agents
may reset their short-term memory when `step_type` is `LAST`, but not when the
`step_type` is `MID`, even if the discount is `0`. This is up to the
creator of the agent, but it does mean that the aforementioned two ways to
model a termination of the prediction do not necessarily correspond to the same
agent behaviour.

## Run loop samples

Here we show some sample run loops for using an environment with an agent class
that implements a `step(timestep)` method.

NOTE: Environments do not make any assumptions about the structure of
algorithmic code or agent classes. These examples are illustrative only.

### Continuing

We may call `step()` repeatedly.

```python
timestep = env.reset()
while True:
  action = agent.step(timestep)
  timestep = env.step(action)

```
NOTE: An environment will ignore `action` after a `LAST` step, and return the
`FIRST` step of a new sequence. An agent or algorithm may use the `step_type`,
for example to decide when to reset short-term memory.

### Set number of sequences

We can choose to run a specific number of sequences. Here we use the syntactic
sugar method `.last()` to check whether we are at the end of a sequence.

```python
for _ in range(num_sequences):

  timestep = env.reset()
  while True:
    action = agent.step(timestep)
    timestep = env.step(action)
    if timestep.last():
      _ = agent.step(timestep)
      break
```

A `TimeStep` also has `.first()` and `.mid()` methods.

### Manual truncation

We can truncate a sequence manually at some `step_limit`.

```python
step_limit = 100
for _ in range(num_sequences):

  timestep = env.reset()

  step_counter = 1
  while True:
    action = agent.step(timestep)
    timestep = env.step(action)
    if step_counter == step_limit:
      timestep = timestep._replace(step_type=environment.StepType.LAST)

    if timestep.last():
      _ = agent.step(timestep)
      break

    step_counter += 1
```

In this example we've accessed the `step_type` element directly.

## The format of observations and actions

Environments should return observations and accept actions in the form of
[NumPy arrays][numpy_array].

An environment may return observations made up of multiple arrays, for example a
list where the first item is an array containing an RGB image and the second
item is an array containing velocities. The arrays may also be values in a
`dict`, or any other structure made up of basic Python containers. Note: A
single array is a perfectly valid format.

Similarly, actions may be specified as multiple arrays, for example control
signals for distinct parts of a simulated robot.

Each environment also implements an `observation_spec()` and an `action_spec()`
method. Each method should return a structure of [`Array` specs][specs],
where the structure should correspond exactly to the
format of the actions/observations.

Each `Array` spec should define the `dtype`, `shape` and, where possible, the
bounds and name of the corresponding action or observation array.

Note: Actions should almost always specify bounds, e.g. they should use the
[`BoundedArray` spec][specs] subclass.

[numpy_array]: https://docs.scipy.org/doc/numpy/reference/generated/numpy.array.html
[specs]: ../dm_env/specs.py


text:
package edu.duke.cabig.c3pr.rules.common;

import java.rmi.RemoteException;

import javax.rules.ConfigurationException;
import javax.rules.RuleServiceProvider;
import javax.rules.RuleServiceProviderManager;
import javax.rules.admin.LocalRuleExecutionSetProvider;
import javax.rules.admin.RuleAdministrator;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import edu.duke.cabig.c3pr.rules.exception.RuleException;
import edu.duke.cabig.c3pr.rules.repository.RepositoryService;
import edu.duke.cabig.c3pr.rules.repository.RepositoryServiceImpl;
import edu.duke.cabig.c3pr.rules.runtime.RuleExecutionServiceImpl;

/**
 *
 *
 * @author Sujith Vellat Thayyilthodi
 */
public class RuleServiceContext {

    private static final String DEFAULT_RULE_SERVICE_PROVIDER = "edu.duke.cabig.c3pr.rules.runtime.RuleServiceProviderImpl";

    public RuleServiceProvider ruleServiceProvider;

    public LocalRuleExecutionSetProvider ruleSetProvider;

    public RuleAdministrator ruleAdministrator;

    public RepositoryService repositoryService;

    public ApplicationContext applicationContext;

    private static RuleServiceContext instance;

    private RuleServiceContext() throws RuleException{
        initializeService();
    }

    private void initializeService() throws RuleException{
        try {
            /*
             * RuleServiceProviderManager.registerRuleServiceProvider(
             * RuleExecutionServiceImpl.RULE_SERVICE_PROVIDER, Class
             * .forName("org.drools.jsr94.rules.RuleServiceProviderImpl"));
             */

//        	if(! applicationContext.containsBean("jcrService")){
        		 this.applicationContext = new ClassPathXmlApplicationContext(
                         new String[] { "classpath*:edu/duke/cabig/c3pr/rules/config/spring/applicationContext-rules-jcr.xml" });
//        	}

            this.repositoryService = (RepositoryServiceImpl) applicationContext
                            .getBean("jcrService");

            RuleServiceProviderManager.registerRuleServiceProvider(
                            RuleExecutionServiceImpl.RULE_SERVICE_PROVIDER, Class
                                            .forName(DEFAULT_RULE_SERVICE_PROVIDER));

            this.ruleServiceProvider = RuleServiceProviderManager
                            .getRuleServiceProvider(RuleExecutionServiceImpl.RULE_SERVICE_PROVIDER);

            this.ruleAdministrator = this.ruleServiceProvider.getRuleAdministrator();

            this.ruleSetProvider = this.ruleAdministrator.getLocalRuleExecutionSetProvider(null);

        } catch (RemoteException e) {
            throw new RuleException(e.getMessage(), e);
        } catch (ConfigurationException e) {
            throw new RuleException(e.getMessage(), e);
        } catch (ClassNotFoundException e) {
            throw new RuleException(e.getMessage(), e);
        }
    }

    /*
     * private static class RuleServiceContextHolder { static RuleServiceContext instance = new
     * RuleServiceContext(); }
     */

    public static RuleServiceContext getInstance() throws RuleException{
        if (instance == null) instance = new RuleServiceContext();
        return instance;
        // return RuleServiceContextHolder.instance;
    }

}


text:
package org.tguduru.guava.supplier;

import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;

import org.tguduru.guava.domain.Color;
import org.tguduru.guava.domain.MobilePhone;
import org.tguduru.guava.domain.OS;

/**
 * Demonstrates the usage of {@link com.google.common.base.Supplier} and explains the differences with
 * {@link java.util.function.Supplier}
 * @author Guduru, Thirupathi Reddy
 */
public class SupplierDemo {
    public static void main(final String[] args) {
        // this will create a new instance every time you call get()
        System.out.println(new IPhoneSupplier().get());
        // lets say you want the same instance (singleton) then user Suppliers.memoize
        final Supplier<MobilePhone> mobilePhoneSupplier = Suppliers.memoize(new IPhoneSupplier());
        MobilePhone mobilePhone1 = mobilePhoneSupplier.get();
        MobilePhone mobilePhone2 = mobilePhoneSupplier.get();
        System.out.println("isSingleton : "+mobilePhone1.equals(mobilePhone2));// should print true as both get()s return the same
                                                              // instance.

        // java 8 way
        System.out.println("*** Java 8 ***");
        java.util.function.Supplier<MobilePhone> javaAndroidPhoneSupplier = () -> new MobilePhone("nexus s",
                Color.BLACK, OS.ANDROID);
        System.out.println(javaAndroidPhoneSupplier.get());
    }
}


text:
namespace cc {
namespace {

gfx::Rect ToRoundedIntRect(gfx::RectF rect_f) {
  return gfx::Rect(gfx::ToRoundedInt(rect_f.x()),
                   gfx::ToRoundedInt(rect_f.y()),
                   gfx::ToRoundedInt(rect_f.width()),
                   gfx::ToRoundedInt(rect_f.height()));
}

TEST(NinePatchLayerImplTest, VerifyDrawQuads) {
  // Input is a 100x100 bitmap with a 40x50 aperture at x=20, y=30.
  // The bounds of the layer are set to 400x400, so the draw quads
  // generated should leave the border width (40) intact.
  MockQuadCuller quad_culler;
  gfx::Size bitmap_size(100, 100);
  gfx::Size layer_size(400, 400);
  gfx::Rect visible_content_rect(layer_size);
  gfx::Rect aperture_rect(20, 30, 40, 50);
  gfx::Rect scaled_aperture_non_uniform(20, 30, 340, 350);

  FakeImplProxy proxy;
  FakeLayerTreeHostImpl host_impl(&proxy);
  scoped_ptr<NinePatchLayerImpl> layer =
      NinePatchLayerImpl::Create(host_impl.active_tree(), 1);
  layer->draw_properties().visible_content_rect = visible_content_rect;
  layer->SetBounds(layer_size);
  layer->SetContentBounds(layer_size);
  layer->CreateRenderSurface();
  layer->draw_properties().render_target = layer.get();
  layer->SetLayout(bitmap_size, aperture_rect);
  layer->SetResourceId(1);

  // This scale should not affect the generated quad geometry, but only
  // the shared draw transform.
  gfx::Transform transform;
  transform.Scale(10, 10);
  layer->draw_properties().target_space_transform = transform;

  AppendQuadsData data;
  layer->AppendQuads(&quad_culler, &data);

  // Verify quad rects
  const QuadList& quads = quad_culler.quad_list();
  EXPECT_EQ(8u, quads.size());
  Region remaining(visible_content_rect);
  for (size_t i = 0; i < quads.size(); ++i) {
    DrawQuad* quad = quads[i];
    gfx::Rect quad_rect = quad->rect;

    EXPECT_TRUE(visible_content_rect.Contains(quad_rect)) << i;
    EXPECT_TRUE(remaining.Contains(quad_rect)) << i;
    EXPECT_EQ(transform, quad->quadTransform());
    remaining.Subtract(Region(quad_rect));
  }
  EXPECT_RECT_EQ(scaled_aperture_non_uniform, remaining.bounds());
  Region scaled_aperture_region(scaled_aperture_non_uniform);
  EXPECT_EQ(scaled_aperture_region, remaining);

  // Verify UV rects
  gfx::Rect bitmap_rect(bitmap_size);
  Region tex_remaining(bitmap_rect);
  for (size_t i = 0; i < quads.size(); ++i) {
    DrawQuad* quad = quads[i];
    const TextureDrawQuad* tex_quad = TextureDrawQuad::MaterialCast(quad);
    gfx::RectF tex_rect =
        gfx::BoundingRect(tex_quad->uv_top_left, tex_quad->uv_bottom_right);
    tex_rect.Scale(bitmap_size.width(), bitmap_size.height());
    tex_remaining.Subtract(Region(ToRoundedIntRect(tex_rect)));
  }
  EXPECT_RECT_EQ(aperture_rect, tex_remaining.bounds());
  Region aperture_region(aperture_rect);
  EXPECT_EQ(aperture_region, tex_remaining);
}

TEST(NinePatchLayerImplTest, VerifyDrawQuadsForSqueezedLayer) {
  // Test with a layer much smaller than the bitmap.
  MockQuadCuller quad_culler;
  gfx::Size bitmap_size(101, 101);
  gfx::Size layer_size(51, 51);
  gfx::Rect visible_content_rect(layer_size);
  gfx::Rect aperture_rect(20, 30, 40, 45);  // rightWidth: 40, botHeight: 25

  FakeImplProxy proxy;
  FakeLayerTreeHostImpl host_impl(&proxy);
  scoped_ptr<NinePatchLayerImpl> layer =
      NinePatchLayerImpl::Create(host_impl.active_tree(), 1);
  layer->draw_properties().visible_content_rect = visible_content_rect;
  layer->SetBounds(layer_size);
  layer->SetContentBounds(layer_size);
  layer->CreateRenderSurface();
  layer->draw_properties().render_target = layer.get();
  layer->SetLayout(bitmap_size, aperture_rect);
  layer->SetResourceId(1);

  AppendQuadsData data;
  layer->AppendQuads(&quad_culler, &data);

  // Verify corner rects fill the layer and don't overlap
  const QuadList& quads = quad_culler.quad_list();
  EXPECT_EQ(4u, quads.size());
  Region filled;
  for (size_t i = 0; i < quads.size(); ++i) {
    DrawQuad* quad = quads[i];
    gfx::Rect quad_rect = quad->rect;

    EXPECT_FALSE(filled.Intersects(quad_rect));
    filled.Union(quad_rect);
  }
  Region expected_full(visible_content_rect);
  EXPECT_EQ(expected_full, filled);

  // Verify UV rects cover the corners of the bitmap and the crop is weighted
  // proportionately to the relative corner sizes (for uneven apertures).
  gfx::Rect bitmap_rect(bitmap_size);
  Region tex_remaining(bitmap_rect);
  for (size_t i = 0; i < quads.size(); ++i) {
    DrawQuad* quad = quads[i];
    const TextureDrawQuad* tex_quad = TextureDrawQuad::MaterialCast(quad);
    gfx::RectF tex_rect =
        gfx::BoundingRect(tex_quad->uv_top_left, tex_quad->uv_bottom_right);
    tex_rect.Scale(bitmap_size.width(), bitmap_size.height());
    tex_remaining.Subtract(Region(ToRoundedIntRect(tex_rect)));
  }
  Region expected_remaining_region = Region(gfx::Rect(bitmap_size));
  expected_remaining_region.Subtract(gfx::Rect(0, 0, 17, 28));
  expected_remaining_region.Subtract(gfx::Rect(67, 0, 34, 28));
  expected_remaining_region.Subtract(gfx::Rect(0, 78, 17, 23));
  expected_remaining_region.Subtract(gfx::Rect(67, 78, 34, 23));
  EXPECT_EQ(expected_remaining_region, tex_remaining);
}

}  // namespace
}  // namespace cc


text:
  Badinières est
       un village
       géographiquement positionné dans le département de l'Isère en Rhône-Alpes. Elle totalisait 538 habitants en 2008.

Si vous envisagez de venir habiter à Badinières, vous pourrez facilement trouver une maison à vendre.

La ville propose quelques  équipements, elle dispose, entre autres, de un terrain de tennis.

À Badinières, le prix moyen à la vente d'un appartement se situe à 1 710 € du m² en vente. Le prix moyen d'une maison à l'achat se situe à 1 781 € du m². À la location le prix moyen se situe à 9,9 € du m² mensuel.

Le nombre d'habitations, à Badinières, était réparti en 2011 en 20 appartements et 223 maisons soit
 un marché plutôt équilibré.

À coté de Badinières sont situées les villes de
Châteauvilain à 2 km, 587 habitants,
Les Éparres située à 3 km, 941 habitants,
Tramolé localisée à 3 km, 515 habitants,
Saint-Didier-de-Bizonnes localisée à 5 km, 240 habitants,
Culin localisée à 4 km, 610 habitants,
Nivolas-Vermelle située à 5 km, 2 181 habitants,
 entre autres. De plus, Badinières est située à seulement neuf km de Bourgoin-Jallieu.


text:
package com.microsoft.kafkaavailability.module;

import com.codahale.metrics.ConsoleReporter;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.ScheduledReporter;
import com.google.inject.AbstractModule;
import com.google.inject.Inject;
import com.google.inject.Provides;
import com.google.inject.Singleton;
import com.google.inject.multibindings.ProvidesIntoMap;
import com.google.inject.multibindings.StringMapKey;
import com.google.inject.name.Names;
import com.microsoft.kafkaavailability.discovery.CommonUtils;
import com.microsoft.kafkaavailability.metrics.MetricNameEncodedFactory;
import com.microsoft.kafkaavailability.properties.AppProperties;
import com.microsoft.kafkaavailability.properties.ReporterProperties;
import com.microsoft.kafkaavailability.reporters.StatsdClient;
import com.microsoft.kafkaavailability.reporters.StatsdReporter;

import java.util.concurrent.TimeUnit;

public class ReportersModule extends AbstractModule {

    public static final String ENVIRONMENT_NAME_CONSTANT_NAME = "environmentName";
    public static final String STATSD_ENDPOINT_CONSTANT_NAME = "statsdEndpoint";
    public static final String STATSD_PORT_CONSTANT_NAME = "statsdPort";
    public static final String METRICS_NAMESPACE_CONSTANT_NAME = "metricsNamespace";

    @Inject
    private AppProperties appProperties;
    @Inject
    private ReporterProperties reporterProperties;
    @Inject
    private MetricRegistry metricRegistry;

    @Override
    protected void configure() {
        bind(String.class).annotatedWith(Names.named(ENVIRONMENT_NAME_CONSTANT_NAME)).toInstance(appProperties.environmentName);
        bind(String.class).annotatedWith(Names.named(STATSD_ENDPOINT_CONSTANT_NAME)).toInstance(reporterProperties.statsdEndpoint);
        bind(Integer.class).annotatedWith(Names.named(STATSD_PORT_CONSTANT_NAME)).toInstance(reporterProperties.statsdPort);
        bind(String.class).annotatedWith(Names.named(METRICS_NAMESPACE_CONSTANT_NAME)).toInstance(reporterProperties.metricsNamespace);
    }

    @ProvidesIntoMap
    @StringMapKey("statsdReporter")
    public ScheduledReporter statsdReporter() {
        String endpoint = reporterProperties.statsdEndpoint == null ? "localhost" : reporterProperties.statsdEndpoint;

        final StatsdClient statsdClient = new StatsdClient(endpoint, reporterProperties.statsdPort);

        return StatsdReporter.forRegistry(metricRegistry)
                .convertRatesTo(TimeUnit.SECONDS)
                .convertDurationsTo(TimeUnit.SECONDS)
                .build(statsdClient);
    }

    @ProvidesIntoMap
    @StringMapKey("consoleReporter")
    public ScheduledReporter consoleReporter() {

        return ConsoleReporter
                .forRegistry(metricRegistry)
                .convertRatesTo(TimeUnit.SECONDS)
                .convertDurationsTo(TimeUnit.SECONDS)
                .build();
    }

    @Provides
    @Singleton
    public MetricNameEncodedFactory metricNameEncodedFactory() {
        String localMachineName = CommonUtils.getComputerName();

        return new MetricNameEncodedFactory(appProperties.environmentName, localMachineName);
    }
}


text:
using System;
using NPoco.Tests.Common;
using NUnit.Framework;

namespace NPoco.Tests.DecoratedTests.CRUDTests
{
    [TestFixture]
    public class InsertTests : BaseDBDecoratedTest
    {
        [Test]
        public void InsertPrimaryKeyAutoIncrement()
        {
            const string dataName = "John Doe";
            const int dataAge = 56;
            const decimal dataSavings = (decimal)345.23;
            var dataDateOfBirth = DateTime.Now;

            var poco = new UserDecorated();
            poco.Name = dataName;
            poco.Age = dataAge;
            poco.Savings = dataSavings;
            poco.DateOfBirth = dataDateOfBirth;
            Database.Insert(poco);

            Assert.IsTrue(poco.UserId > 0, "POCO failed to insert.");

            var verify = Database.SingleOrDefaultById<UserDecorated>(poco.UserId);
            Assert.IsNotNull(verify);

            Assert.AreEqual(poco.UserId, verify.UserId);
            Assert.AreEqual(dataName, verify.Name);
            Assert.AreEqual(dataAge, verify.Age);
            Assert.AreEqual(dataSavings, verify.Savings);
        }

        [Test]
        public void InsertPrimaryKeyAssigned()
        {
            const int dataKey1ID = 100;
            const int dataKey2ID = 200;
            const int dataKey3ID = 300;
            const string dataTextData = "This is some text data.";
            var dataDateCreated = DateTime.Now;

            var poco = new AssignedPkObjectDecorated();
            poco.Key1ID = dataKey1ID;
            poco.Key2ID = dataKey2ID;
            poco.Key3ID = dataKey3ID;
            poco.TextData = dataTextData;
            poco.DateEntered = dataDateCreated;
            Database.Insert(poco);

            Assert.IsTrue(poco.Key1ID > 0, "POCO failed to insert.");

            var verify = Database.SingleOrDefaultById<AssignedPkObjectDecorated>(poco.Key1ID);
            Assert.IsNotNull(verify);

            Assert.AreEqual(dataKey1ID, verify.Key1ID);
            Assert.AreEqual(dataKey2ID, verify.Key2ID);
            Assert.AreEqual(dataKey3ID, verify.Key3ID);
            Assert.AreEqual(dataTextData, verify.TextData);
        }

        [Test]
        public void InsertCompositeKey()
        {
            const int dataKey1ID = 100;
            const int dataKey2ID = 200;
            const int dataKey3ID = 300;
            const string dataTextData = "This is some text data.";
            var dataDateCreated = DateTime.Now;

            var poco = new CompositeObjectDecorated();
            poco.Key1ID = dataKey1ID;
            poco.Key2ID = dataKey2ID;
            poco.Key3ID = dataKey3ID;
            poco.TextData = dataTextData;
            poco.DateEntered = dataDateCreated;
            Database.Insert(poco);

            var verify = Database.SingleOrDefault<CompositeObjectDecorated>(@"
                SELECT *
                FROM CompositeObjects
                WHERE Key1ID = @0 AND Key2ID = @1 AND Key3ID = @2
            ", dataKey1ID, dataKey2ID, dataKey3ID);
            Assert.IsNotNull(verify);

            Assert.AreEqual(dataKey1ID, verify.Key1ID);
            Assert.AreEqual(dataKey2ID, verify.Key2ID);
            Assert.AreEqual(dataKey3ID, verify.Key3ID);
            Assert.AreEqual(dataTextData, verify.TextData);
        }

        [Test]
        public void VerifyNullablesCanBeInserted()
        {
            var user = new UserDecoratedWithNullable();
            user.Name = "TestNull";
            user.Age = null;
            Database.Insert(user);
            var verify = Database.Single<UserDecoratedWithNullable>("select * from users where userid = @0", user.UserId);
            Assert.AreEqual(user.Name, verify.Name);
            Assert.AreEqual(user.Age, verify.Age);
        }
    }
}


text:
//
//  ZBNotesAndTerms.h
//  Books
//
//  Created by Balasankar J on 12/02/14.
//  Copyright (c) 2014 Balasankar J. All rights reserved.
//

/**
 \addtogroup Model
 *@{
 */

#import <Foundation/Foundation.h>

/**
 ZBNotesAndTerms interface has the properties of the notes and terms.\n
 Using accessor methods of the property you can get or set the value.
 */
@interface ZBNotesAndTerms : NSObject

/**
 @short Notes to the customer.
 @accessors \e \c getNotes, \e \c setNotes
 */
@property(nonatomic, retain, getter = getNotes) NSString *notes;

/**
 @short Terms and conditions.
 @accessors \e \c getTerms, \e \c setTerms
 */
@property(nonatomic, retain, getter = getTerms) NSString *terms;

/**
 @short Create a new instance of ZBNotesAndTerms object.
 @returns ZBNotesAndTerms
 */
-init;

/**
 @short Return a JSON representation of this ZBNotesAndTerms object.
 @returns NSMutableDictionary
 */
-(NSMutableDictionary *) toJSON;

@end

/** @}*/