text:
'use strict';

angular.module('lkhan')
  .directive('perseus', function ($window, PerseusService) {

    return {
      restrict: 'E',
      templateUrl: 'static/views/directives/perseus.html',
      scope: {
        question: '='
      },
      link: function (scope) {

        var itemRendererFactory = React.createFactory($window.Perseus.ItemRenderer);
        var itemMountNode = null, itemRenderer = null;

        scope.$watch('question', function () {
          // Cleanup old container
          if (itemMountNode) {
            React.unmountComponentAtNode(itemMountNode);
          }
          itemMountNode = document.createElement('div');
          scope.answerState = 'Check Answer';
          itemRenderer = React.render(itemRendererFactory({
            item: scope.question,
            problemNum: Math.floor(Math.random() * 50) + 1,
            initialHintsVisible: 0,
            enabledFeatures: {
              useMathQuill: true
            }
          }, null), itemMountNode);

          itemMountNode.focus();
          PerseusService.setItemRenderer(itemRenderer);
        });

        scope.checkAnswer = function () {
          var score = itemRenderer.scoreInput();
          if (score.correct) {
            scope.answerState = 'Correct!';
          } else if (!score.empty) {
            scope.answerState = 'Incorrect, try again.';
          }
        };

        scope.$on('$destroy', function () {
          if (itemMountNode) {
            React.unmountComponentAtNode(itemMountNode);
          }
        });
      }
    };
  });

redpajama_set_name: RedPajamaGithub


text:
use strict;
use Migrate;

Migrate::verifySchemaVersion(25);

addMailboxMetadataTable();
removeConfigColumn();

Migrate::updateSchemaVersion(25, 26);

exit(0);

#####################

sub addMailboxMetadataTable() {
    my $sql = <<CREATE_MAILBOX_METADATA_EOF;
CREATE TABLE zimbra.mailbox_metadata (
   mailbox_id  INTEGER UNSIGNED NOT NULL,
   section     VARCHAR(64) NOT NULL,       # e.g. "imap"
   metadata    MEDIUMTEXT,

   PRIMARY KEY (mailbox_id, section),

   CONSTRAINT fk_metadata_mailbox_id FOREIGN KEY (mailbox_id) REFERENCES mailbox(id) ON DELETE CASCADE
) ENGINE = InnoDB;

CREATE_MAILBOX_METADATA_EOF

    Migrate::log("Adding ZIMBRA.MAILBOX_METADATA table.");
    Migrate::runSql($sql);
}

sub removeConfigColumn() {
    my $sql = <<REMOVE_CONFIG_EOF;
ALTER TABLE zimbra.mailbox
DROP COLUMN config;

REMOVE_CONFIG_EOF

    Migrate::log("Removing CONFIG column from ZIMBRA.MAILBOX.");
    Migrate::runSql($sql);
}


text:
'use strict';

const Promise = require('bluebird');
const path = require('path');
const random = require('lodash/random');
const BufferStreams = require('bufferstreams');
const archiver = require('archiver');
const { newId } = require('../../../lib/utils/id_utils');

function zipDirectory(dir) {
    return new Promise((resolve, reject) => {
        const archive = archiver('zip', { zlib: { level: 9 } });
        archive.append(JSON.stringify({
            name: path.basename(dir),
            version: `${random(0, 100)}.${random(0, 100)}.${random(0, 100)}`,
            someProp: newId()
        }, null, 4), { name: 'asset.json' });
        archive.pipe(new BufferStreams((err, buf) => {
            if (err) {
                reject(err);
                return;
            }
            resolve(buf);
        }));
        archive.directory(dir, 'asset').finalize();
    });
}

module.exports = zipDirectory;


text:
#ifndef B2_DISTANCE_H
#define B2_DISTANCE_H

#include "../Common/b2Math.h"

class b2Shape;

/// A distance proxy is used by the GJK algorithm.
/// It encapsulates any shape.
struct b2DistanceProxy
{
	b2DistanceProxy() : m_vertices(NULL), m_count(0), m_radius(0.0f) {}

	/// Initialize the proxy using the given shape. The shape
	/// must remain in scope while the proxy is in use.
	void Set(const b2Shape* shape, juce::int32 index);

	/// Get the supporting vertex index in the given direction.
	juce::int32 GetSupport(const b2Vec2& d) const;

	/// Get the supporting vertex in the given direction.
	const b2Vec2& GetSupportVertex(const b2Vec2& d) const;

	/// Get the vertex count.
	juce::int32 GetVertexCount() const;

	/// Get a vertex by index. Used by b2Distance.
	const b2Vec2& GetVertex(juce::int32 index) const;

	b2Vec2 m_buffer[2];
	const b2Vec2* m_vertices;
	juce::int32 m_count;
	float32 m_radius;
};

/// Used to warm start b2Distance.
/// Set count to zero on first call.
struct b2SimplexCache
{
	float32 metric;		///< length or area
	juce::uint16 count;
	juce::uint8 indexA[3];	///< vertices on shape A
	juce::uint8 indexB[3];	///< vertices on shape B
};

/// Input for b2Distance.
/// You have to option to use the shape radii
/// in the computation. Even
struct b2DistanceInput
{
	b2DistanceProxy proxyA;
	b2DistanceProxy proxyB;
	b2Transform transformA;
	b2Transform transformB;
	bool useRadii;
};

/// Output for b2Distance.
struct b2DistanceOutput
{
	b2Vec2 pointA;		///< closest point on shapeA
	b2Vec2 pointB;		///< closest point on shapeB
	float32 distance;
	juce::int32 iterations;	///< number of GJK iterations used
};

/// Compute the closest points between two shapes. Supports any combination of:
/// b2CircleShape, b2PolygonShape, b2EdgeShape. The simplex cache is input/output.
/// On the first call set b2SimplexCache.count to zero.
void b2Distance(b2DistanceOutput* output,
				b2SimplexCache* cache,
				const b2DistanceInput* input);

//////////////////////////////////////////////////////////////////////////

inline juce::int32 b2DistanceProxy::GetVertexCount() const
{
	return m_count;
}

inline const b2Vec2& b2DistanceProxy::GetVertex(juce::int32 index) const
{
	b2Assert(0 <= index && index < m_count);
	return m_vertices[index];
}

inline juce::int32 b2DistanceProxy::GetSupport(const b2Vec2& d) const
{
	juce::int32 bestIndex = 0;
	float32 bestValue = b2Dot(m_vertices[0], d);
	for (juce::int32 i = 1; i < m_count; ++i)
	{
		float32 value = b2Dot(m_vertices[i], d);
		if (value > bestValue)
		{
			bestIndex = i;
			bestValue = value;
		}
	}

	return bestIndex;
}

inline const b2Vec2& b2DistanceProxy::GetSupportVertex(const b2Vec2& d) const
{
	juce::int32 bestIndex = 0;
	float32 bestValue = b2Dot(m_vertices[0], d);
	for (juce::int32 i = 1; i < m_count; ++i)
	{
		float32 value = b2Dot(m_vertices[i], d);
		if (value > bestValue)
		{
			bestIndex = i;
			bestValue = value;
		}
	}

	return m_vertices[bestIndex];
}

#endif


text:
this_file = File.dirname(__FILE__)
$:.unshift(this_file) unless $:.include?(this_file) || $:.include?(File.expand_path(this_file))

require 'svn_auth_file/listener'
require 'svn_auth_file/parser'


text:
package com.google.cloud.tasks.v2beta3.samples;

// [START tasks_v2beta3_generated_cloudtasksclient_testiampermissions_resourcenameliststring_sync]
import com.google.api.resourcenames.ResourceName;
import com.google.cloud.tasks.v2beta3.CloudTasksClient;
import com.google.cloud.tasks.v2beta3.QueueName;
import com.google.iam.v1.TestIamPermissionsResponse;
import java.util.ArrayList;
import java.util.List;

public class SyncTestIamPermissionsResourcenameListstring {

  public static void main(String[] args) throws Exception {
    syncTestIamPermissionsResourcenameListstring();
  }

  public static void syncTestIamPermissionsResourcenameListstring() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
      ResourceName resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
      List<String> permissions = new ArrayList<>();
      TestIamPermissionsResponse response =
          cloudTasksClient.testIamPermissions(resource, permissions);
    }
  }
}
// [END tasks_v2beta3_generated_cloudtasksclient_testiampermissions_resourcenameliststring_sync]


text:
define(
	[
	 "jQuery",
	 "Handlebars",
	 "DateFormat",
	 'text!./templates/generic.sql',
	 'text!./templates/oracle.sql',
	 'text!./templates/sqlite.sql',
	 'HandlebarsHelpers/each_with_index'
	 ],
	function ($, Handlebars, dateFormat, generic_template, oracle_template, sqlite_template) {

	ddl_builder = function (args) {
		if (!args) args = {};
		// output settings
		this.fieldPrefix = '';
		this.fieldSuffix = '';
		this.tablePrefix = '';
		this.tableSuffix = '';

		this.dateFormatMask = "yyyy-mm-dd HH:MM:ss";

		this.charType = 'varchar';
		this.intType = 'int';
		this.floatType = 'numeric';
		this.dateType = 'datetime';

		// input settings
		this.valueSeparator = '';

		this.column_count = 0;
		this.definition = {
				tableName: "Table1",
				columns: [/* sample column structure
							{
								name: 'id',
								type: 'int',
								length: '',
								db_type: 'int4'
							},
							{
								name: 'name',
								type: 'char',
								length: 20,
								db_type: 'varchar(20)'
							}
				 			*/],
				data: [/* sample data structure
							 // r for "row", v for "value"
							{r:[{v:1},{v:'Jake'}]},
							{r:[{v:2},{v:'Rachel'}]},
							{r:[{v:3},{v:'Andrew'}]},
							{r:[{v:4},{v:'Ada'}]},
							{r:[{v:5},{v:'Lucy O\'Malley'}]}

				 		*/]
			};

		this.ddlTemplate = generic_template;

		this.compiledTemplate = Handlebars.compile(this.ddlTemplate);
		this.setup(args);
		return this;
	};

	ddl_builder.prototype.setup = function (settings) {
		for (var opt in settings)
		{
			this[opt] = settings[opt];
		}

		if (settings["ddlTemplate"])
			this.compiledTemplate = Handlebars.compile(this.ddlTemplate);

		if (settings["tableName"])
			this.definition.tableName = settings.tableName;

		return this;
	};

	ddl_builder.prototype.setupForDBType = function (type,separator) {

		switch (type)
		{
			case 'SQL Server':
				this.setup({
								statement_separator: separator,
								fieldPrefix: '[',
								fieldSuffix: ']',
								tablePrefix: '[',
								tableSuffix: ']'
							});
			break;

			case 'MySQL':
				this.setup({
								statement_separator: separator,
								fieldPrefix: '`',
								fieldSuffix: '`',
								tablePrefix: '`',
								tableSuffix: '`'
							});
			break;
			case 'PostgreSQL':
				this.setup({
								statement_separator: separator,
								dateType: 'timestamp',
								fieldPrefix: '"',
								fieldSuffix: '"'
							});
			break;

			case 'Oracle':
				var template = oracle_template;

					this.setup({
								dateFormatMask: 'dd-mmm-yyyy hh:MM:ss TT',
								statement_separator: separator,
								ddlTemplate: template,
								dateType: 'timestamp',
								charType: 'varchar2',
								fieldPrefix: '"',
								fieldSuffix: '"'
							});
			break;

			case 'SQLite':
				var template = sqlite_template;

					this.setup({
								fieldPrefix: '"',
								fieldSuffix: '"',
								tablePrefix: '"',
								tableSuffix: '"',
								statement_separator: separator,
								ddlTemplate: template,
								dateType: 'DATE',
								charType: 'TEXT',
								intType: 'INTEGER',
								floatType: 'REAL'
							});
			break;

		}
		return this;
	};

	ddl_builder.prototype.populateDBTypes = function () {
		for (var i=0;i<this.definition.columns.length;i++)
		{
			if (this.definition.columns[i].type == 'charType')
				this.definition.columns[i].db_type = this[this.definition.columns[i].type] + "(" + this.definition.columns[i].length + ")";
			else
				this.definition.columns[i].db_type = this[this.definition.columns[i].type];
		}

		this.definition.dateFormatMask = this.dateFormatMask;

	};

	ddl_builder.prototype.populateWrappers = function () {
		this.definition.fieldPrefix = this.fieldPrefix;
		this.definition.fieldSuffix = this.fieldSuffix;
	};

	ddl_builder.prototype.guessValueSeparator = function (raw) {

		var lines = raw.split("\n");
		var header_found = false, column_count = 0, found_separator = '';

		for (var i = 0; i<lines.length; i++)
		{
			if (lines[i].search(/[A-Z0-9_]/i) != -1 && !header_found) // if this line contains letters/numbers/underscores, then we can assume we've hit the header row
			{
				var chunks = $.trim(lines[i]).match(/([A-Z0-9_]+ ?)+([^A-Z0-9_]*)/gi);
				if (chunks.length == 1)
				{
					chunks = $.trim(lines[i]).match(/([A-Z0-9_]+ ?)+?([^A-Z0-9_]*)/gi);
				}

				header_found = true;

				for (var j = 0; j < chunks.length; j++)
				{
					var this_separator = chunks[j].match(/[A-Z0-9_]+([^A-Z0-9_]*)$/i).pop(); // gets the last returned value from regexp

					if (this_separator.search(/^\s\s+$/) != -1)
						this_separator = new RegExp("\\s\\s+");
					else if (this_separator.search(/^\t+$/) != -1)
						this_separator = new RegExp("\\t+");
					else if (this_separator.search(/^\s+$/) != -1)
						this_separator = new RegExp("\\s+");
					else
						this_separator = $.trim(this_separator);

					if (this_separator instanceof RegExp || this_separator.length)
					{
						if (!(found_separator instanceof RegExp) && !found_separator.length)
							found_separator = this_separator;
						else if (found_separator.toString() != this_separator.toString())
							return {status: false, message: 'Unable to find consistent column separator in header row'}; // different separators founds?
					}
					else if (! (this_separator instanceof RegExp) && !(found_separator instanceof RegExp) && !found_separator.length)
					{
						found_separator = "\n";
					}

				}
				if (found_separator instanceof RegExp || found_separator.length)
					column_count = $.trim(lines[i]).split(found_separator).length;
				else
					column_count = 1;

			}
			else if (lines[i].search(/[A-Z0-9_]/i) != -1)
			{
				if ($.trim(lines[i]).split(found_separator).length != column_count &&
						(
								found_separator.toString() != /\s\s+/.toString() ||
								$.trim(lines[i]).split(/\s+/).length != column_count
						)
					)
					return {status: false, message: 'Line ' + i + ' does not have the same number of columns as the header, based on separator "' + found_separator + '".'};

			}

		}
		return {status: true, separator: found_separator, column_count: column_count};
	};

	ddl_builder.prototype.parse = function (raw) {

		/*
		 * brokenDateChecker is used to eliminate strings that for some reason pass Chrome's standard of a 'valid' date, and
		 * yet are not worth considering as such. Chrome will take garbage like 'ABC 1' as an input to `new Date()`, returning
		 * January 1st 2001 for some reason.  This regex will allow a lot of fuzzy input formats to still pass, but only really
		 * keep meaningful entries. This isn't a problem for Firefox or Safari. I haven't checked IE.
		 */
		var brokenDateChecker = /^(?!Jan)(?!Feb)(?!Mar)(?!Apr)(?!May)(?!Jun)(?!Jul)(?!Aug)(?!Sep)(?!Oct)(?!Nov)(?!Dec)[A-Za-z\ \-\_]+\d+\s*$/,
			result = {}, lines = [], elements = [], tmpRow = [], i = 0, j = 0, value = "";

		if (!this.valueSeparator.length)
		{
			result = this.guessValueSeparator(raw);
			if (!result.status)
				return "ERROR! " + result.message;
			else
			{
				this.column_count = result.column_count;
				this.valueSeparator = result.separator;
			}
		}

		lines = raw.split("\n");

		for (i=0;i<lines.length;i++)
		{
			elements = $.trim(lines[i]).split(this.valueSeparator);

			if ($.trim(lines[i]).length &&
					(
						elements.length == this.column_count ||
						(
								this.valueSeparator.toString() == /\s\s+/.toString() &&
								(elements =  $.trim(lines[i]).split(/\s+/)).length == this.column_count
						)
					)
				)
			{
				if (! this.definition.columns.length)
				{
					for (j = 0; j < elements.length; j++)
					{
							value = $.trim(elements[j]);
							if (value.length)
								this.definition.columns.push({"name": value});
							else
								this.definition.columns.push(false);
					}
				}
				else
				{
					tmpRow = [];
					for (j = 0; j < elements.length; j++)
					{
						if (this.definition.columns[j] !== false)
						{
							value = $.trim(elements[j]).replace(/'/g, "''");

							// if the current field is not a number, or if we have previously decided that this one of the non-numeric field types...
							if (isNaN(value) || this.definition.columns[j].type == 'dateType' || this.definition.columns[j].type == 'charType')
							{

								// if we haven't previously decided that this is a character field, and it can be cast as a date, then declare it a date
                                if (this.definition.columns[j].type != 'charType' && !(isNaN(Date.parse("UTC:" + value)) || value.match(brokenDateChecker)) )
									this.definition.columns[j].type = "dateType";
								else
									this.definition.columns[j].type = "charType";
							}
							else // this must be some kind of number field
							{
								if (this.definition.columns[j].type != 'floatType' && value % 1 != 0)
									this.definition.columns[j].type = 'floatType';
								else
									this.definition.columns[j].type = 'intType';
							}

							if (!this.definition.columns[j].length || value.length > this.definition.columns[j].length)
							{
								this.definition.columns[j].length = value.length;
							}

							tmpRow.push({v:value});
						}

					}
					this.definition.data.push({r: tmpRow});

				}

			}
		}
		this.populateDBTypes();
		this.populateWrappers();
		return this.render();
	};

	/* HandlebarsJS-using code below */

	Handlebars.registerHelper("formatted_field", function(root) {

		var colType = '';
		var index = -1;
		for (var j = 0; j < root.columns.length; j++)
		{
			if (root.columns[j])
				index++;

			if (index == this.index)
			{
				colType = root.columns[j].type;
				break;
			}
		}

		if (!this.v.length || this.v.toUpperCase() == 'NULL')
			return 'NULL';
		if (colType == 'charType')
		    return new Handlebars.SafeString("'" + this.v + "'");

		if (colType == 'dateType')
			return new Handlebars.SafeString("'" + dateFormat("UTC:" + this.v, root.dateFormatMask) + "'");

		return this.v;
	});

	Handlebars.registerHelper("column_name_for_index", function(root) {
		return root.columns[this.index].name;
	});

	ddl_builder.prototype.render = function () {
		return this.compiledTemplate($.extend(this.definition, {"separator": this.statement_separator}));
	};

	return ddl_builder;

});


text:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

require_once APPPATH . "libraries/pusher-http-php/lib/Pusher.php";

class MyPusher{

	const APP_ID     = '163140';
	const APP_KEY    = 'b3c7fc474d668cd4563e';
	const APP_SECRET = '221d49143b9fcdd747ef';

	private $channel;
	private $event;
	private $data;
	private $pusher;

	public function __construct()
	{
	   $this->pusher = new Pusher(self::APP_KEY, self::APP_SECRET, self::APP_ID);
	}

	/**
	 * @param {String} $channel channel to be triggered
	 * @param {String} $event event to be triggered
	 * @param {Array} $data information to be sent
	 * @return{Boolean}
	 */
	public function Message($channel, $event, $data)
	{
		$this->channel = $channel;
		$this->event   = $event;
		$this->data    = $data;
		$this->pusher->trigger($this->channel, $this->event, $this->data);

		return TRUE;
	}

}


text:
<?php
defined('C5_EXECUTE') or die("Access Denied.");
extract($vars); ?>

            <?= $form->label('baseRate',t("Base Price")); ?>
            <?= $form->text('baseRate',$smtm->getBaseRate()); ?>

                    <?= $form->label('rateType',t("Rate Based On")); ?>
                    <?= $form->select('rateType',array('quantity'=>t("Quantity"),'weight'=>t("Weight")),$smtm->getRateType()); ?>

                    <?= $form->label('perItemRate',t("Price per Item")); ?>
                    <?= $form->text('perItemRate',$smtm->getPerItemRate()); ?>

                    <?= $form->label('perWeightRate',t("Price per ").Config::get('community_store.weightUnit')); ?>
                    <?= $form->text('perWeightRate',$smtm->getPerWeightRate()); ?>

            <?= $form->label('countries',t("Which Countries does this Apply to?")); ?>
            <?= $form->select('countries',array('all'=>t("All Countries"),'selected'=>t("Certain Countries")),$smtm->getCountries()); ?>

            <?= $form->label('countriesSelected',t("If Certain Countries, which?")); ?>
            <select class="form-control" multiple name="countriesSelected[]">
                <?php $selectedCountries = explode(',',$smtm->getCountriesSelected()); ?>
                <?php foreach($countryList as $code=>$country){?>
                    <option value="<?= $code?>"<?php if(in_array($code,$selectedCountries)){echo " selected";}?>><?= $country?></option>
                <?php } ?>
            </select>

            <?= $form->label('minimumAmount',t("Minimum Purchase Amount for this rate to apply")); ?>
            <?= $form->text('minimumAmount',$smtm->getMinimumAmount()?$smtm->getMinimumAmount():'0'); ?>

            <?= $form->label('maximumAmount',t("Maximum Purchase Amount for this rate to apply")); ?>
            <?= $form->text('maximumAmount',$smtm->getMaximumAmount()?$smtm->getMaximumAmount():'0'); ?>

<?= t("Leave at 0 for no maximum")?>

            <?= $form->label('minimumWeight',t("Minimum Weight Amount for this rate to apply")); ?>

                <?= $form->text('minimumWeight',$smtm->getMinimumWeight()?$smtm->getMinimumWeight():'0'); ?>

<?=Config::get('community_store.weightUnit')?>

            <?= $form->label('maximumWeight',t("Maximum Weight Amount for this rate to apply")); ?>

                <?= $form->text('maximumWeight',$smtm->getMaximumWeight()?$smtm->getMaximumWeight():'0'); ?>

<?=Config::get('community_store.weightUnit')?>

<?= t("Leave at 0 for no maximum")?>


text:
.class public Lcom/htc/shutdown/AnimationView;
.super Landroid/widget/ImageView;
.source "AnimationView.java"

# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/htc/shutdown/AnimationView$OnAnimationListener;
    }
.end annotation

# static fields
.field private static final NEXT_FRAME:I = 0x1

.field private static final TAG:Ljava/lang/String; = "AnimationView"

# instance fields
.field private bJustReady:Z

.field private curname:Ljava/lang/String;

.field private lastBitmap:Landroid/graphics/Bitmap;

.field private mAnimationListener:Lcom/htc/shutdown/AnimationView$OnAnimationListener;

.field private mContext:Landroid/content/Context;

.field private mDisplay:Landroid/view/Display;

.field private mFPS:I

.field private myHandler:Landroid/os/Handler;

.field private nFramesDrawn:I

.field private nowBitmap:Landroid/graphics/Bitmap;

.field private zipFile:Ljava/util/zip/ZipFile;

.field private zipLandFile:Ljava/util/zip/ZipFile;

# direct methods
.method public constructor <init>(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;I)V
    .locals 5
    .parameter "context"
    .parameter "pathname"
    .parameter "landPath"
    .parameter "maxFPS"

    .prologue
    const/4 v3, 0x0

    const/4 v4, 0x0

    .line 57
    invoke-direct {p0, p1}, Landroid/widget/ImageView;-><init>(Landroid/content/Context;)V

    .line 44
    iput-boolean v3, p0, Lcom/htc/shutdown/AnimationView;->bJustReady:Z

    .line 45
    iput v3, p0, Lcom/htc/shutdown/AnimationView;->nFramesDrawn:I

    .line 301
    iput-object v4, p0, Lcom/htc/shutdown/AnimationView;->mAnimationListener:Lcom/htc/shutdown/AnimationView$OnAnimationListener;

    .line 351
    new-instance v3, Lcom/htc/shutdown/AnimationView$1;

    invoke-direct {v3, p0}, Lcom/htc/shutdown/AnimationView$1;-><init>(Lcom/htc/shutdown/AnimationView;)V

    iput-object v3, p0, Lcom/htc/shutdown/AnimationView;->myHandler:Landroid/os/Handler;

    .line 59
    iput-object p1, p0, Lcom/htc/shutdown/AnimationView;->mContext:Landroid/content/Context;

    .line 60
    iput p4, p0, Lcom/htc/shutdown/AnimationView;->mFPS:I

    .line 62
    const-string v3, "window"

    invoke-virtual {p1, v3}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Landroid/view/WindowManager;

    .line 64
    .local v1, manager:Landroid/view/WindowManager;
    invoke-interface {v1}, Landroid/view/WindowManager;->getDefaultDisplay()Landroid/view/Display;

    move-result-object v3

    iput-object v3, p0, Lcom/htc/shutdown/AnimationView;->mDisplay:Landroid/view/Display;

    .line 72
    iput-object v4, p0, Lcom/htc/shutdown/AnimationView;->curname:Ljava/lang/String;

    .line 73
    iput-object v4, p0, Lcom/htc/shutdown/AnimationView;->zipLandFile:Ljava/util/zip/ZipFile;

    .line 75
    :try_start_0
    new-instance v3, Ljava/util/zip/ZipFile;

    invoke-direct {v3, p2}, Ljava/util/zip/ZipFile;-><init>(Ljava/lang/String;)V

    iput-object v3, p0, Lcom/htc/shutdown/AnimationView;->zipFile:Ljava/util/zip/ZipFile;

    .line 77
    if-eqz p3, :cond_0

    invoke-virtual {p3}, Ljava/lang/String;->length()I

    move-result v3

    if-lez v3, :cond_0

    .line 78
    new-instance v2, Ljava/io/File;

    invoke-direct {v2, p3}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    .line 79
    .local v2, tmp:Ljava/io/File;
    if-eqz v2, :cond_0

    invoke-virtual {v2}, Ljava/io/File;->exists()Z

    move-result v3

    if-eqz v3, :cond_0

    .line 80
    new-instance v3, Ljava/util/zip/ZipFile;

    invoke-direct {v3, p3}, Ljava/util/zip/ZipFile;-><init>(Ljava/lang/String;)V

    iput-object v3, p0, Lcom/htc/shutdown/AnimationView;->zipLandFile:Ljava/util/zip/ZipFile;
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    .line 86
    .end local v2           #tmp:Ljava/io/File;
    :cond_0
    :goto_0
    return-void

    .line 83
    :catch_0
    move-exception v0

    .line 84
    .local v0, e:Ljava/io/IOException;
    invoke-virtual {v0}, Ljava/io/IOException;->printStackTrace()V

    goto :goto_0
.end method

.method static synthetic access$000(Lcom/htc/shutdown/AnimationView;)V
    .locals 0
    .parameter "x0"

    .prologue
    .line 32
    invoke-direct {p0}, Lcom/htc/shutdown/AnimationView;->prepareDraw()V

    return-void
.end method

.method private controlFPS(JJ)V
    .locals 7
    .parameter "mStartTime"
    .parameter "mEndTime"

    .prologue
    const/16 v6, 0x3e8

    .line 257
    sub-long v0, p3, p1

    .line 262
    .local v0, cost:J
    iget v4, p0, Lcom/htc/shutdown/AnimationView;->mFPS:I

    div-int v4, v6, v4

    long-to-int v5, v0

    sub-int v2, v4, v5

    .line 264
    .local v2, delay:I
    if-lez v2, :cond_0

    .line 267
    int-to-long v4, v2

    :try_start_0
    invoke-static {v4, v5}, Ljava/lang/Thread;->sleep(J)V
    :try_end_0
    .catch Ljava/lang/InterruptedException; {:try_start_0 .. :try_end_0} :catch_0

    .line 277
    :goto_0
    invoke-static {}, Landroid/os/SystemClock;->uptimeMillis()J

    move-result-wide p3

    .line 278
    sub-long v0, p3, p1

    .line 280
    long-to-int v4, v0

    div-int v3, v6, v4

    .line 283
    .local v3, fps:I
    return-void

    .line 273
    .end local v3           #fps:I
    :cond_0
    const/4 v2, 0x0

    goto :goto_0

    .line 268
    :catch_0
    move-exception v4

    goto :goto_0
.end method

.method private prepareDraw()V
    .locals 9

    .prologue
    const/4 v8, 0x1

    .line 313
    const-wide/16 v4, 0x0

    .line 314
    .local v4, mStartTime:J
    const/4 v1, 0x0

    .line 319
    .local v1, is:Ljava/io/InputStream;
    iget v6, p0, Lcom/htc/shutdown/AnimationView;->nFramesDrawn:I

    if-ne v6, v8, :cond_0

    iget-object v6, p0, Lcom/htc/shutdown/AnimationView;->nowBitmap:Landroid/graphics/Bitmap;

    if-eqz v6, :cond_0

    .line 320
    iget-object v6, p0, Lcom/htc/shutdown/AnimationView;->mAnimationListener:Lcom/htc/shutdown/AnimationView$OnAnimationListener;

    invoke-interface {v6}, Lcom/htc/shutdown/AnimationView$OnAnimationListener;->onAnimationReady()V

    .line 323
    :cond_0
    invoke-static {}, Landroid/os/SystemClock;->uptimeMillis()J

    move-result-wide v4

    .line 326
    iget-object v6, p0, Lcom/htc/shutdown/AnimationView;->zipLandFile:Ljava/util/zip/ZipFile;

    if-eqz v6, :cond_1

    iget-object v6, p0, Lcom/htc/shutdown/AnimationView;->mContext:Landroid/content/Context;

    invoke-virtual {v6}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v6

    invoke-virtual {v6}, Landroid/content/res/Resources;->getConfiguration()Landroid/content/res/Configuration;

    move-result-object v6

    iget v6, v6, Landroid/content/res/Configuration;->orientation:I

    const/4 v7, 0x2

    if-ne v6, v7, :cond_1

    .line 327
    invoke-direct {p0}, Lcom/htc/shutdown/AnimationView;->readNextTextureLand()Ljava/io/BufferedInputStream;

    move-result-object v1

    .line 331
    :goto_0
    if-eqz v1, :cond_2

    .line 332
    iget-object v6, p0, Lcom/htc/shutdown/AnimationView;->nowBitmap:Landroid/graphics/Bitmap;

    iput-object v6, p0, Lcom/htc/shutdown/AnimationView;->lastBitmap:Landroid/graphics/Bitmap;

    .line 333
    new-instance v0, Landroid/graphics/BitmapFactory$Options;

    invoke-direct {v0}, Landroid/graphics/BitmapFactory$Options;-><init>()V

    .line 334
    .local v0, bitopts:Landroid/graphics/BitmapFactory$Options;
    iput-boolean v8, v0, Landroid/graphics/BitmapFactory$Options;->inNativeAlloc:Z

    .line 335
    const/4 v6, 0x0

    invoke-static {v1, v6, v0}, Landroid/graphics/BitmapFactory;->decodeStream(Ljava/io/InputStream;Landroid/graphics/Rect;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;

    move-result-object v6

    iput-object v6, p0, Lcom/htc/shutdown/AnimationView;->nowBitmap:Landroid/graphics/Bitmap;

    .line 337
    :try_start_0
    invoke-virtual {v1}, Ljava/io/BufferedInputStream;->close()V
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    .line 346
    .end local v0           #bitopts:Landroid/graphics/BitmapFactory$Options;
    :goto_1
    invoke-static {}, Landroid/os/SystemClock;->uptimeMillis()J

    move-result-wide v2

    .line 347
    .local v2, mEndTime:J
    invoke-direct {p0, v4, v5, v2, v3}, Lcom/htc/shutdown/AnimationView;->controlFPS(JJ)V

    .line 348
    invoke-virtual {p0}, Lcom/htc/shutdown/AnimationView;->invalidate()V

    .line 349
    return-void

    .line 329
    .end local v2           #mEndTime:J
    :cond_1
    invoke-direct {p0}, Lcom/htc/shutdown/AnimationView;->readNextTexture()Ljava/io/BufferedInputStream;

    move-result-object v1

    goto :goto_0

    .line 343
    :cond_2
    iget-object v6, p0, Lcom/htc/shutdown/AnimationView;->mAnimationListener:Lcom/htc/shutdown/AnimationView$OnAnimationListener;

    invoke-interface {v6}, Lcom/htc/shutdown/AnimationView$OnAnimationListener;->onAnimationFinished()V

    goto :goto_1

    .line 338
    .restart local v0       #bitopts:Landroid/graphics/BitmapFactory$Options;
    :catch_0
    move-exception v6

    goto :goto_1
.end method

.method private readNextTexture()Ljava/io/BufferedInputStream;
    .locals 7

    .prologue
    const/4 v3, 0x0

    .line 184
    :try_start_0
    iget-object v4, p0, Lcom/htc/shutdown/AnimationView;->zipFile:Ljava/util/zip/ZipFile;

    if-nez v4, :cond_1

    .line 214
    :cond_0
    :goto_0
    return-object v3

    .line 190
    :cond_1
    iget-object v4, p0, Lcom/htc/shutdown/AnimationView;->zipFile:Ljava/util/zip/ZipFile;

    invoke-virtual {v4}, Ljava/util/zip/ZipFile;->entries()Ljava/util/Enumeration;

    move-result-object v1

    .line 192
    .local v1, entry_list:Ljava/util/Enumeration;
    const/4 v2, 0x0

    .line 193
    .local v2, isNext:Z
    :cond_2
    :goto_1
    invoke-interface {v1}, Ljava/util/Enumeration;->hasMoreElements()Z

    move-result v4

    if-eqz v4, :cond_0

    .line 195
    invoke-interface {v1}, Ljava/util/Enumeration;->nextElement()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/util/zip/ZipEntry;

    .line 197
    .local v0, entry:Ljava/util/zip/ZipEntry;
    iget-object v4, p0, Lcom/htc/shutdown/AnimationView;->curname:Ljava/lang/String;

    if-eqz v4, :cond_3

    if-eqz v2, :cond_4

    :cond_3
    invoke-virtual {v0}, Ljava/util/zip/ZipEntry;->isDirectory()Z

    move-result v4

    if-nez v4, :cond_4

    .line 198
    invoke-virtual {v0}, Ljava/util/zip/ZipEntry;->getName()Ljava/lang/String;

    move-result-object v4

    iput-object v4, p0, Lcom/htc/shutdown/AnimationView;->curname:Ljava/lang/String;

    .line 199
    new-instance v4, Ljava/io/BufferedInputStream;

    iget-object v5, p0, Lcom/htc/shutdown/AnimationView;->zipFile:Ljava/util/zip/ZipFile;

    invoke-virtual {v5, v0}, Ljava/util/zip/ZipFile;->getInputStream(Ljava/util/zip/ZipEntry;)Ljava/io/InputStream;

    move-result-object v5

    const/16 v6, 0x2000

    invoke-direct {v4, v5, v6}, Ljava/io/BufferedInputStream;-><init>(Ljava/io/InputStream;I)V

    move-object v3, v4

    goto :goto_0

    .line 203
    :cond_4
    iget-object v4, p0, Lcom/htc/shutdown/AnimationView;->curname:Ljava/lang/String;

    if-eqz v4, :cond_2

    iget-object v4, p0, Lcom/htc/shutdown/AnimationView;->curname:Ljava/lang/String;

    invoke-virtual {v0}, Ljava/util/zip/ZipEntry;->getName()Ljava/lang/String;

    move-result-object v5

    invoke-virtual {v4, v5}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v4

    if-eqz v4, :cond_2

    .line 204
    const/4 v2, 0x1

    goto :goto_1

    .line 209
    .end local v0           #entry:Ljava/util/zip/ZipEntry;
    .end local v1           #entry_list:Ljava/util/Enumeration;
    .end local v2           #isNext:Z
    :catch_0
    move-exception v4

    goto :goto_0
.end method

.method private readNextTextureLand()Ljava/io/BufferedInputStream;
    .locals 7

    .prologue
    const/4 v3, 0x0

    .line 220
    :try_start_0
    iget-object v4, p0, Lcom/htc/shutdown/AnimationView;->zipLandFile:Ljava/util/zip/ZipFile;

    if-nez v4, :cond_1

    .line 250
    :cond_0
    :goto_0
    return-object v3

    .line 226
    :cond_1
    iget-object v4, p0, Lcom/htc/shutdown/AnimationView;->zipLandFile:Ljava/util/zip/ZipFile;

    invoke-virtual {v4}, Ljava/util/zip/ZipFile;->entries()Ljava/util/Enumeration;

    move-result-object v1

    .line 228
    .local v1, entry_list:Ljava/util/Enumeration;
    const/4 v2, 0x0

    .line 229
    .local v2, isNext:Z
    :cond_2
    :goto_1
    invoke-interface {v1}, Ljava/util/Enumeration;->hasMoreElements()Z

    move-result v4

    if-eqz v4, :cond_0

    .line 231
    invoke-interface {v1}, Ljava/util/Enumeration;->nextElement()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/util/zip/ZipEntry;

    .line 233
    .local v0, entry:Ljava/util/zip/ZipEntry;
    iget-object v4, p0, Lcom/htc/shutdown/AnimationView;->curname:Ljava/lang/String;

    if-eqz v4, :cond_3

    if-eqz v2, :cond_4

    :cond_3
    invoke-virtual {v0}, Ljava/util/zip/ZipEntry;->isDirectory()Z

    move-result v4

    if-nez v4, :cond_4

    .line 234
    invoke-virtual {v0}, Ljava/util/zip/ZipEntry;->getName()Ljava/lang/String;

    move-result-object v4

    iput-object v4, p0, Lcom/htc/shutdown/AnimationView;->curname:Ljava/lang/String;

    .line 235
    new-instance v4, Ljava/io/BufferedInputStream;

    iget-object v5, p0, Lcom/htc/shutdown/AnimationView;->zipLandFile:Ljava/util/zip/ZipFile;

    invoke-virtual {v5, v0}, Ljava/util/zip/ZipFile;->getInputStream(Ljava/util/zip/ZipEntry;)Ljava/io/InputStream;

    move-result-object v5

    const/16 v6, 0x2000

    invoke-direct {v4, v5, v6}, Ljava/io/BufferedInputStream;-><init>(Ljava/io/InputStream;I)V

    move-object v3, v4

    goto :goto_0

    .line 239
    :cond_4
    iget-object v4, p0, Lcom/htc/shutdown/AnimationView;->curname:Ljava/lang/String;

    if-eqz v4, :cond_2

    iget-object v4, p0, Lcom/htc/shutdown/AnimationView;->curname:Ljava/lang/String;

    invoke-virtual {v0}, Ljava/util/zip/ZipEntry;->getName()Ljava/lang/String;

    move-result-object v5

    invoke-virtual {v4, v5}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v4

    if-eqz v4, :cond_2

    .line 240
    const/4 v2, 0x1

    goto :goto_1

    .line 245
    .end local v0           #entry:Ljava/util/zip/ZipEntry;
    .end local v1           #entry_list:Ljava/util/Enumeration;
    .end local v2           #isNext:Z
    :catch_0
    move-exception v4

    goto :goto_0
.end method

# virtual methods
.method public onConfigurationChanged(Landroid/content/res/Configuration;)V
    .locals 0
    .parameter "newConfig"

    .prologue
    .line 110
    invoke-super {p0, p1}, Landroid/widget/ImageView;->onConfigurationChanged(Landroid/content/res/Configuration;)V

    .line 111
    return-void
.end method

.method protected onDraw(Landroid/graphics/Canvas;)V
    .locals 11
    .parameter "canvas"

    .prologue
    const/16 v5, -0x5a

    const/16 v1, -0x10e

    const/4 v10, 0x0

    const/4 v6, 0x1

    const/4 v9, 0x0

    .line 124
    iget-object v7, p0, Lcom/htc/shutdown/AnimationView;->nowBitmap:Landroid/graphics/Bitmap;

    if-eqz v7, :cond_5

    .line 134
    :try_start_0
    iget-object v7, p0, Lcom/htc/shutdown/AnimationView;->mContext:Landroid/content/Context;

    invoke-virtual {v7}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v7

    invoke-virtual {v7}, Landroid/content/res/Resources;->getConfiguration()Landroid/content/res/Configuration;

    move-result-object v7

    iget v7, v7, Landroid/content/res/Configuration;->orientation:I

    const/4 v8, 0x2

    if-ne v7, v8, :cond_3

    move v0, v6

    .line 136
    .local v0, bLand:Z
    :goto_0
    sget-short v7, Lcom/htc/htcjavaflag/HtcBuildFlag;->Htc_DEVICE_flag:S

    const/16 v8, 0x10

    if-ne v7, v8, :cond_0

    .line 137
    const/4 v0, 0x0

    .line 140
    :cond_0
    if-eqz v0, :cond_1

    .line 141
    iget-object v7, p0, Lcom/htc/shutdown/AnimationView;->mDisplay:Landroid/view/Display;

    invoke-virtual {v7}, Landroid/view/Display;->getRotation()I

    move-result v3

    .line 142
    .local v3, rotation:I
    const/4 v7, 0x3

    if-ne v3, v7, :cond_4

    .line 143
    .local v1, degree:I
    :goto_1
    iget-object v5, p0, Lcom/htc/shutdown/AnimationView;->mContext:Landroid/content/Context;

    invoke-virtual {v5}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v5

    invoke-virtual {v5}, Landroid/content/res/Resources;->getDisplayMetrics()Landroid/util/DisplayMetrics;

    move-result-object v5

    iget v4, v5, Landroid/util/DisplayMetrics;->widthPixels:I

    .line 144
    .local v4, w:I
    iget-object v5, p0, Lcom/htc/shutdown/AnimationView;->mContext:Landroid/content/Context;

    invoke-virtual {v5}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v5

    invoke-virtual {v5}, Landroid/content/res/Resources;->getDisplayMetrics()Landroid/util/DisplayMetrics;

    move-result-object v5

    iget v2, v5, Landroid/util/DisplayMetrics;->heightPixels:I

    .line 145
    .local v2, h:I
    int-to-float v5, v1

    div-int/lit8 v7, v4, 0x2

    int-to-float v7, v7

    div-int/lit8 v8, v2, 0x2

    int-to-float v8, v8

    invoke-virtual {p1, v5, v7, v8}, Landroid/graphics/Canvas;->rotate(FFF)V

    .line 146
    sub-int v5, v4, v2

    div-int/lit8 v5, v5, 0x2

    int-to-float v5, v5

    sub-int v7, v4, v2

    neg-int v7, v7

    div-int/lit8 v7, v7, 0x2

    int-to-float v7, v7

    invoke-virtual {p1, v5, v7}, Landroid/graphics/Canvas;->translate(FF)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_1

    .line 150
    .end local v0           #bLand:Z
    .end local v1           #degree:I
    .end local v2           #h:I
    .end local v3           #rotation:I
    .end local v4           #w:I
    :cond_1
    :goto_2
    iget-object v5, p0, Lcom/htc/shutdown/AnimationView;->nowBitmap:Landroid/graphics/Bitmap;

    invoke-virtual {p1, v5, v9, v9, v10}, Landroid/graphics/Canvas;->drawBitmap(Landroid/graphics/Bitmap;FFLandroid/graphics/Paint;)V

    .line 151
    iget v5, p0, Lcom/htc/shutdown/AnimationView;->nFramesDrawn:I

    add-int/lit8 v5, v5, 0x1

    iput v5, p0, Lcom/htc/shutdown/AnimationView;->nFramesDrawn:I

    .line 153
    iget-object v5, p0, Lcom/htc/shutdown/AnimationView;->lastBitmap:Landroid/graphics/Bitmap;

    if-eqz v5, :cond_2

    iget-object v5, p0, Lcom/htc/shutdown/AnimationView;->lastBitmap:Landroid/graphics/Bitmap;

    iget-object v7, p0, Lcom/htc/shutdown/AnimationView;->nowBitmap:Landroid/graphics/Bitmap;

    invoke-virtual {v5, v7}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v5

    if-nez v5, :cond_2

    .line 154
    iget-object v5, p0, Lcom/htc/shutdown/AnimationView;->lastBitmap:Landroid/graphics/Bitmap;

    invoke-virtual {v5}, Landroid/graphics/Bitmap;->recycle()V

    .line 155
    iput-object v10, p0, Lcom/htc/shutdown/AnimationView;->lastBitmap:Landroid/graphics/Bitmap;

    .line 178
    :cond_2
    :goto_3
    iget-object v5, p0, Lcom/htc/shutdown/AnimationView;->myHandler:Landroid/os/Handler;

    invoke-virtual {v5, v6}, Landroid/os/Handler;->sendEmptyMessage(I)Z

    .line 179
    return-void

    .line 134
    :cond_3
    const/4 v0, 0x0

    goto :goto_0

    .restart local v0       #bLand:Z
    .restart local v3       #rotation:I
    :cond_4
    move v1, v5

    .line 142
    goto :goto_1

    .line 159
    .end local v0           #bLand:Z
    .end local v3           #rotation:I
    :cond_5
    :try_start_1
    iget-object v7, p0, Lcom/htc/shutdown/AnimationView;->mContext:Landroid/content/Context;

    invoke-virtual {v7}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v7

    invoke-virtual {v7}, Landroid/content/res/Resources;->getConfiguration()Landroid/content/res/Configuration;

    move-result-object v7

    iget v7, v7, Landroid/content/res/Configuration;->orientation:I

    const/4 v8, 0x2

    if-ne v7, v8, :cond_8

    move v0, v6

    .line 161
    .restart local v0       #bLand:Z
    :goto_4
    sget-short v7, Lcom/htc/htcjavaflag/HtcBuildFlag;->Htc_DEVICE_flag:S

    const/16 v8, 0x10

    if-ne v7, v8, :cond_6

    .line 162
    const/4 v0, 0x0

    .line 165
    :cond_6
    if-eqz v0, :cond_7

    .line 166
    iget-object v7, p0, Lcom/htc/shutdown/AnimationView;->mDisplay:Landroid/view/Display;

    invoke-virtual {v7}, Landroid/view/Display;->getRotation()I

    move-result v3

    .line 167
    .restart local v3       #rotation:I
    const/4 v7, 0x3

    if-ne v3, v7, :cond_9

    .line 168
    .restart local v1       #degree:I
    :goto_5
    iget-object v5, p0, Lcom/htc/shutdown/AnimationView;->mContext:Landroid/content/Context;

    invoke-virtual {v5}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v5

    invoke-virtual {v5}, Landroid/content/res/Resources;->getDisplayMetrics()Landroid/util/DisplayMetrics;

    move-result-object v5

    iget v4, v5, Landroid/util/DisplayMetrics;->widthPixels:I

    .line 169
    .restart local v4       #w:I
    iget-object v5, p0, Lcom/htc/shutdown/AnimationView;->mContext:Landroid/content/Context;

    invoke-virtual {v5}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v5

    invoke-virtual {v5}, Landroid/content/res/Resources;->getDisplayMetrics()Landroid/util/DisplayMetrics;

    move-result-object v5

    iget v2, v5, Landroid/util/DisplayMetrics;->heightPixels:I

    .line 170
    .restart local v2       #h:I
    int-to-float v5, v1

    div-int/lit8 v7, v4, 0x2

    int-to-float v7, v7

    div-int/lit8 v8, v2, 0x2

    int-to-float v8, v8

    invoke-virtual {p1, v5, v7, v8}, Landroid/graphics/Canvas;->rotate(FFF)V

    .line 171
    sub-int v5, v4, v2

    div-int/lit8 v5, v5, 0x2

    int-to-float v5, v5

    sub-int v7, v4, v2

    neg-int v7, v7

    div-int/lit8 v7, v7, 0x2

    int-to-float v7, v7

    invoke-virtual {p1, v5, v7}, Landroid/graphics/Canvas;->translate(FF)V
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0

    .line 175
    .end local v0           #bLand:Z
    .end local v1           #degree:I
    .end local v2           #h:I
    .end local v3           #rotation:I
    .end local v4           #w:I
    :cond_7
    :goto_6
    iget-object v5, p0, Lcom/htc/shutdown/AnimationView;->lastBitmap:Landroid/graphics/Bitmap;

    if-eqz v5, :cond_2

    iget-object v5, p0, Lcom/htc/shutdown/AnimationView;->lastBitmap:Landroid/graphics/Bitmap;

    invoke-virtual {p1, v5, v9, v9, v10}, Landroid/graphics/Canvas;->drawBitmap(Landroid/graphics/Bitmap;FFLandroid/graphics/Paint;)V

    goto :goto_3

    .line 159
    :cond_8
    const/4 v0, 0x0

    goto :goto_4

    .restart local v0       #bLand:Z
    .restart local v3       #rotation:I
    :cond_9
    move v1, v5

    .line 167
    goto :goto_5

    .line 173
    .end local v0           #bLand:Z
    .end local v3           #rotation:I
    :catch_0
    move-exception v5

    goto :goto_6

    .line 148
    :catch_1
    move-exception v5

    goto/16 :goto_2
.end method

.method public setOnAnimationListener(Lcom/htc/shutdown/AnimationView$OnAnimationListener;)V
    .locals 0
    .parameter "listener"

    .prologue
    .line 309
    iput-object p1, p0, Lcom/htc/shutdown/AnimationView;->mAnimationListener:Lcom/htc/shutdown/AnimationView$OnAnimationListener;

    .line 310
    return-void
.end method


text:
package com.blazebit.weblink.server.faces.configuration;

import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;

import com.blazebit.weblink.rest.model.config.ConfigurationTypeConfigElementRepresentation;
import com.blazebit.weblink.rest.model.config.ConfigurationTypeConfigEntryRepresentation;

public class ConfigurationHolder {

	protected List<ConfigurationEntry> configurationEntries = new ArrayList<>();

	public Set<ConfigurationTypeConfigEntryRepresentation> getConfiguration() {
		Set<ConfigurationTypeConfigEntryRepresentation> configuration = new LinkedHashSet<>(configurationEntries.size());
		FacesContext context = FacesContext.getCurrentInstance();
		boolean valid = true;

		for (ConfigurationEntry entry : configurationEntries) {
			if (entry.getKey() == null || entry.getKey().isEmpty()) {
				if (entry.getValue() != null && !entry.getValue().isEmpty()) {
					// TODO: I18N messages
					String validatorMessageString = "Entry with empty key found for value: " + entry.getValue();
					FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, validatorMessageString, validatorMessageString);
	                context.addMessage(null, message);
	                valid = false;
				}

				continue;
			}
			if (!configuration.add(new ConfigurationTypeConfigEntryRepresentation(entry.getKey(), entry.getValue()))) {
				// TODO: I18N messages
				String validatorMessageString = "Duplicate configuration key found: " + entry.getKey();
				FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, validatorMessageString, validatorMessageString);
                context.addMessage(null, message);
                valid = false;
			}
		}

		if (!valid) {
			throw new RuntimeException("Invalid configuration!");
		}

		return configuration;
	}

	public void setConfiguration(Collection<? extends ConfigurationTypeConfigEntryRepresentation> configuration) {
		configurationEntries = new ArrayList<>(configuration.size());
		for (ConfigurationTypeConfigEntryRepresentation entry : configuration) {
			if (entry instanceof ConfigurationTypeConfigElementRepresentation) {
				ConfigurationTypeConfigElementRepresentation element = (ConfigurationTypeConfigElementRepresentation) entry;
				configurationEntries.add(new ConfigurationEntry(entry.getKey(), entry.getValue(), element.getType(), element.getName(), element.getDescription()));
			} else {
				configurationEntries.add(new ConfigurationEntry(entry.getKey(), entry.getValue()));
			}
		}
	}

	public List<ConfigurationEntry> getConfigurationEntries() {
		return configurationEntries;
	}

	public void setConfigurationEntries(List<ConfigurationEntry> configurationEntries) {
		this.configurationEntries = configurationEntries;
	}
}


text:
//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you 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 System.Text;
using System.Net;
using System.Threading;
using NetworkCommsDotNet.DPSBase;
using NetworkCommsDotNet.Tools;
using NetworkCommsDotNet.Connections.TCP;
using NetworkCommsDotNet.Connections.UDP;

#if NET35 || NET4
using InTheHand.Net;
using InTheHand.Net.Bluetooth;
using NetworkCommsDotNet.Connections.Bluetooth;
#endif

#if NETFX_CORE
using NetworkCommsDotNet.Tools.XPlatformHelper;
#endif

namespace NetworkCommsDotNet.Connections
{
    public abstract partial class Connection
    {
        /// <summary>
        /// All connection listeners are recorded in the static connection base.
        /// </summary>
        static Dictionary<ConnectionType, Dictionary<EndPoint, ConnectionListenerBase>> listenersDict = new Dictionary<ConnectionType, Dictionary<EndPoint, ConnectionListenerBase>>();

        /// <summary>
        /// Start listening for incoming connections of the provided <see cref="ConnectionType"/>.
        /// If the desired localEndPoint is not available will throw a CommsSetupShutdownException.
        /// </summary>
        /// <param name="connectionType">The <see cref="ConnectionType"/> to start listening for.</param>
        /// <param name="desiredLocalEndPoint">The desired localEndPoint. For IPEndPoints use IPAddress.Any
        /// to listen on all <see cref="HostInfo.IP.FilteredLocalAddresses()"/> and port 0 to randomly select an available port.</param>
        /// <param name="allowDiscoverable">Determines if the listeners created will be discoverable if <see cref="Tools.PeerDiscovery"/> is enabled.</param>
        /// <returns>A list of all listeners used.</returns>
        public static List<ConnectionListenerBase> StartListening<T>(ConnectionType connectionType, T desiredLocalEndPoint, bool allowDiscoverable = false) where T : EndPoint
        {
            if (connectionType == ConnectionType.Undefined) throw new ArgumentException("ConnectionType.Undefined is not a valid parameter value.", "connectionType");
            if (desiredLocalEndPoint == null) throw new ArgumentNullException("desiredLocalEndPoint", "desiredLocalEndPoint cannot be null.");

            List<ConnectionListenerBase> listeners = new List<ConnectionListenerBase>();

            if (connectionType == ConnectionType.TCP || connectionType == ConnectionType.UDP)
            {
                IPEndPoint desiredLocalIPEndPoint = desiredLocalEndPoint as IPEndPoint;
                if (desiredLocalIPEndPoint == null)
                    throw new ArgumentException("The provided desiredLocalEndPoint must be an IPEndPoint for TCP and UDP connection types.", "desiredLocalEndPoint");

                //Collect a list of IPEndPoints we want to listen on
                List<IPEndPoint> localListenIPEndPoints = new List<IPEndPoint>();

                if (desiredLocalIPEndPoint.Address == IPAddress.Any)
                {
                    foreach(IPAddress address in HostInfo.IP.FilteredLocalAddresses())
                        localListenIPEndPoints.Add(new IPEndPoint(address, desiredLocalIPEndPoint.Port));

                    //We could also listen on the IPAddress.Any adaptor here
                    //but it is not supported by all platforms so use the specific start listening override instead
                }
                else
                    localListenIPEndPoints.Add(desiredLocalIPEndPoint);

                //Initialise the listener list
                for (int i = 0; i < localListenIPEndPoints.Count; i++)
                {
                    if (connectionType == ConnectionType.TCP)
                        listeners.Add(new TCPConnectionListener(NetworkComms.DefaultSendReceiveOptions, ApplicationLayerProtocolStatus.Enabled, allowDiscoverable));
                    else if (connectionType == ConnectionType.UDP)
                        listeners.Add(new UDPConnectionListener(NetworkComms.DefaultSendReceiveOptions, ApplicationLayerProtocolStatus.Enabled, UDPConnection.DefaultUDPOptions, allowDiscoverable));
                }

                //Start listening on all selected listeners
                //We do this is a separate step in case there is an exception
                try
                {
                    for (int i = 0; i < localListenIPEndPoints.Count; i++)
                            StartListening(listeners[i], localListenIPEndPoints[i], false);
                }
                catch (Exception)
                {
                    //If there is an exception here we remove any added listeners and then rethrow
                    for (int i = 0; i < listeners.Count; i++)
                    {
                        if (listeners[i].IsListening)
                            StopListening(listeners[i].ConnectionType, listeners[i].LocalListenEndPoint);
                    }

                    throw;
                }
            }
#if NET35 || NET4
            else if (connectionType == ConnectionType.Bluetooth)
            {
                BluetoothEndPoint desiredLocalBTEndPoint = desiredLocalEndPoint as BluetoothEndPoint;
                if (desiredLocalBTEndPoint == null)
                    throw new ArgumentException("The provided desiredLocalEndPoint must be a BluetoothEndPoint for Bluetooth connection types.", "desiredLocalEndPoint");

                //Collect a list of BluetoothEndPoints we want to listen on
                List<BluetoothEndPoint> localListenBTEndPoints = new List<BluetoothEndPoint>();
                if (desiredLocalBTEndPoint.Address == BluetoothAddress.None)
                {
                    foreach (var address in HostInfo.BT.FilteredLocalAddresses())
                        localListenBTEndPoints.Add(new BluetoothEndPoint(address, desiredLocalBTEndPoint.Service));
                }
                else
                    localListenBTEndPoints.Add(desiredLocalBTEndPoint);

                //Initialise the listener list
                for (int i = 0; i < localListenBTEndPoints.Count; i++)
                    listeners.Add(new BluetoothConnectionListener(NetworkComms.DefaultSendReceiveOptions, ApplicationLayerProtocolStatus.Enabled, allowDiscoverable));

                //Start listening on all selected listeners
                //We do this is a separate step in case there is an exception
                try
                {
                    for (int i = 0; i < localListenBTEndPoints.Count; i++)
                        StartListening(listeners[i], localListenBTEndPoints[i], false);
                }
                catch (Exception)
                {
                    //If there is an exception here we remove any added listeners and then rethrow
                    for (int i = 0; i < listeners.Count; i++)
                    {
                        if (listeners[i].IsListening)
                            StopListening(listeners[i].ConnectionType, listeners[i].LocalListenEndPoint);
                    }

                    throw;
                }
            }
#endif
            else
                throw new NotImplementedException("This method has not been implemented for the provided connections of type " + connectionType);

            return listeners;
        }

        /// <summary>
        /// Start listening for new incoming connections on specified <see cref="IPEndPoint"/>. Inspect listener.LocalListenIPEndPoint
        /// when method returns to determine the <see cref="IPEndPoint"/> used.
        /// </summary>
        /// <param name="listener">The listener to use.</param>
        /// <param name="desiredLocalEndPoint">The desired local <see cref="IPEndPoint"/> to use for listening. IPAddress.Any corresponds with listening on
        /// 0.0.0.0. Use a port number of 0 to dynamically select a port.</param>
        /// <param name="useRandomPortFailOver">If true and the requested local port is not available will select one at random.
        /// If false and provided port is unavailable will throw <see cref="CommsSetupShutdownException"/></param>
        public static void StartListening<T>(ConnectionListenerBase listener, T desiredLocalEndPoint, bool useRandomPortFailOver = false) where T : EndPoint
        {
            #region Input Validation
            if (listener == null) throw new ArgumentNullException("listener", "Provided listener cannot be null.");
            if (desiredLocalEndPoint == null) throw new ArgumentNullException("desiredLocalEndPoint", "Provided desiredLocalEndPoint cannot be null.");

            //Commented out as listening on IPAddress.Any does have specific usage cases, such as receiving UDP broadcast on iOS
            //if (desiredLocalEndPoint.GetType() == typeof(IPEndPoint) && ((desiredLocalEndPoint as IPEndPoint).Address == IPAddress.Any || (desiredLocalEndPoint as IPEndPoint).Address == IPAddress.IPv6Any)) throw new ArgumentException("desiredLocalEndPoint must specify a valid local IPAddress.", "desiredLocalEndPoint");

#if NET35 || NET4
            if (desiredLocalEndPoint is BluetoothEndPoint && (desiredLocalEndPoint as BluetoothEndPoint).Address == BluetoothAddress.None) throw new ArgumentException("desiredLocalEndPoint must specify a valid local Bluetooth Address.", "desiredLocalEndPoint");
#endif
            #endregion

            lock (staticConnectionLocker)
            {
                if (!useRandomPortFailOver &&
                    listenersDict.ContainsKey(listener.ConnectionType) &&
                    listenersDict[listener.ConnectionType].ContainsKey(desiredLocalEndPoint))
                    throw new CommsSetupShutdownException("A listener already exists for " + listener.ConnectionType.ToString() +
                        " connections with a local IPEndPoint " + desiredLocalEndPoint.ToString() + ". Please try a different local IPEndPoint" +
                        " or all random port fail over.");

                //Start listening
                listener.StartListening(desiredLocalEndPoint, useRandomPortFailOver);

                //Idiot check
                if (!listener.IsListening) throw new CommsSetupShutdownException("Listener is not listening after calling StartListening.");

                if (NetworkComms.LoggingEnabled) NetworkComms.Logger.Info("Listener started (" + listener.ConnectionType.ToString() + "-" + (listener.ApplicationLayerProtocol == ApplicationLayerProtocolStatus.Enabled ? "E" : "D") + " - " + listener.LocalListenEndPoint.ToString() + ").");

                //Idiot check
                if (listenersDict.ContainsKey(listener.ConnectionType) &&
                    listenersDict[listener.ConnectionType].ContainsKey(listener.LocalListenEndPoint))
                {
                    listener.StopListening();
                    throw new InvalidOperationException("According to the listener dictionary there is already a listener for " + listener.ConnectionType.ToString() +
                        " connections with a local IPEndPoint " + listener.LocalListenEndPoint.ToString() + ". This should not be possible.");
                }

                //Add the listener to the global dict
                if (listenersDict.ContainsKey(listener.ConnectionType))
                {
                    if (listenersDict[listener.ConnectionType].ContainsKey(listener.LocalListenEndPoint))
                        throw new CommsSetupShutdownException("A listener already exists with an IPEndPoint that matches the new listener. This should not be possible.");
                    else
                        listenersDict[listener.ConnectionType].Add(listener.LocalListenEndPoint, listener);
                }
                else
                    listenersDict.Add(listener.ConnectionType, new Dictionary<EndPoint, ConnectionListenerBase>() { { listener.LocalListenEndPoint, listener } });
            }
        }

        /// <summary>
        /// Start listening for new incoming connections on specified <see cref="IPEndPoint"/>s. Listener is matched
        /// with desired localIPEndPoint based on List index. Inspect listener.LocalListenIPEndPoint
        /// when method returns to determine the <see cref="IPEndPoint"/>s used.
        /// </summary>
        /// <param name="listeners">The listeners to use.</param>
        /// <param name="desiredLocalEndPoints">The desired local <see cref="IPEndPoint"/>s to use for listening. IPAddress.Any corresponds with listening on
        /// 0.0.0.0. Use a port number of 0 to dynamically select a port.</param>
        /// <param name="useRandomPortFailOver">If true and the requested local port is not available will select one at random.
        /// If false and provided port is unavailable will throw <see cref="CommsSetupShutdownException"/></param>
        public static void StartListening<T>(List<ConnectionListenerBase> listeners, List<T> desiredLocalEndPoints, bool useRandomPortFailOver) where T : EndPoint
        {
            if (listeners == null) throw new ArgumentNullException("listeners", "Provided listeners cannot be null.");
            if (desiredLocalEndPoints == null) throw new ArgumentNullException("desiredLocalIPEndPoints", "Provided List<IPEndPoint> cannot be null.");
            if (listeners.Count != desiredLocalEndPoints.Count) throw new ArgumentException("The number of elements in listeners and desiredLocalIPEndPoints must be equal.");

            lock (staticConnectionLocker)
            {
                try
                {
                    for (int i = 0; i < listeners.Count; i++)
                        StartListening(listeners[i], desiredLocalEndPoints[i], useRandomPortFailOver);
                }
                catch (Exception)
                {
                    //If there is an exception we ensure all listeners are stopped
                    for (int i = 0; i < listeners.Count; i++)
                    {
                        if (listeners[i].IsListening)
                            StopListening(listeners[i].ConnectionType, listeners[i].LocalListenEndPoint);
                    }

                    throw;
                }
            }
        }

        /// <summary>
        /// Stops all local listeners
        /// </summary>
        public static void StopListening()
        {
            lock (staticConnectionLocker)
            {
                List<ConnectionType> connectionTypes = new List<ConnectionType>(listenersDict.Keys);
                foreach (ConnectionType connectionType in connectionTypes)
                {
                    List<EndPoint> endPoints = new List<EndPoint>(listenersDict[connectionType].Keys);
                    foreach (EndPoint currentEndPoint in endPoints)
                        StopListening(connectionType, currentEndPoint);
                }
            }
        }

        /// <summary>
        /// Stops all local listeners of the provided <see cref="ConnectionType"/>.
        /// </summary>
        /// <param name="connectionType">The <see cref="ConnectionType"/> to close.</param>
        public static void StopListening(ConnectionType connectionType)
        {
            lock (staticConnectionLocker)
            {
                if (listenersDict.ContainsKey(connectionType))
                {
                    Dictionary<EndPoint, ConnectionListenerBase> listenerCopy =
                        new Dictionary<EndPoint, ConnectionListenerBase>(listenersDict[connectionType]);

                    foreach (EndPoint endPoint in listenerCopy.Keys)
                        StopListening(connectionType, endPoint);
                }
            }
        }

        /// <summary>
        /// Stop listening for new incoming connections on specified <see cref="ConnectionListenerBase"/> and remove it from the local listeners dictionary.
        /// </summary>
        /// <param name="listener">The listener which should stop listening.</param>
        public static void StopListening(ConnectionListenerBase listener)
        {
            if (listener == null) throw new ArgumentNullException("listener", "Provided listener cannot be null.");

            StopListening(listener.ConnectionType, listener.LocalListenEndPoint);
        }

        /// <summary>
        /// Stop listening for new incoming connections on specified list of <see cref="ConnectionListenerBase"/> and remove them from the local listeners dictionary.
        /// </summary>
        /// <param name="listeners">The listeners which should stop listening</param>
        public static void StopListening(List<ConnectionListenerBase> listeners)
        {
            if (listeners == null) throw new ArgumentNullException("listeners", "Provided listener cannot be null.");

            foreach(ConnectionListenerBase listener in listeners)
                StopListening(listener);
        }

        /// <summary>
        /// Stop listening for new incoming connections on specified <see cref="EndPoint"/> and remove it from the local listeners dictionary.
        /// </summary>
        /// <param name="connectionType">The connection type to stop listening on.</param>
        /// <param name="localEndPointToClose">The local <see cref="EndPoint"/> to stop listening for connections on.</param>
        public static void StopListening(ConnectionType connectionType, EndPoint localEndPointToClose)
        {
            #region Input Validation
            if (connectionType == ConnectionType.Undefined) throw new ArgumentException("ConnectionType.Undefined is not valid when calling this method.", "connectionType");
            if (localEndPointToClose == null) throw new ArgumentNullException("localEndPointToClose", "Provided localEndPointToClose cannot be null.");
            if (localEndPointToClose.GetType() == typeof(IPEndPoint))
            {
                IPEndPoint localIPEndPointToClose = (IPEndPoint)localEndPointToClose;
                if (localIPEndPointToClose.Address == IPAddress.Any || localIPEndPointToClose.Address == IPAddress.IPv6Any) throw new ArgumentException("localEndPointToClose must specify a valid local IPAddress.", "localEndPointToClose");
                if (localIPEndPointToClose.Port == 0) throw new ArgumentException("The provided localIPEndPointToClose.Port may not be 0", "localEndPointToClose");
            }
            #endregion

            lock (staticConnectionLocker)
            {
                if (listenersDict.ContainsKey(connectionType) &&
                    listenersDict[connectionType].ContainsKey(localEndPointToClose))
                {
                    if (NetworkComms.LoggingEnabled)
                    {
                        if (listenersDict[connectionType][localEndPointToClose].IsListening)
                            NetworkComms.Logger.Info("Listener stopping (" + listenersDict[connectionType][localEndPointToClose].ConnectionType.ToString() + "-" + (listenersDict[connectionType][localEndPointToClose].ApplicationLayerProtocol == ApplicationLayerProtocolStatus.Enabled ? "E" : "D") + " - " + listenersDict[connectionType][localEndPointToClose].LocalListenEndPoint.ToString() + ").");
                        else
                            NetworkComms.Logger.Info("Listener stopping (" + listenersDict[connectionType][localEndPointToClose].ConnectionType.ToString() + "-" + (listenersDict[connectionType][localEndPointToClose].ApplicationLayerProtocol == ApplicationLayerProtocolStatus.Enabled ? "E" : "D") + " - Not listening when stopped).");
                    }

                    listenersDict[connectionType][localEndPointToClose].StopListening();
                    listenersDict[connectionType].Remove(localEndPointToClose);

                    if (listenersDict[connectionType].Count == 0)
                        listenersDict.Remove(connectionType);
                }
            }
        }

        /// <summary>
        /// Returns true if at least one local listener of the provided <see cref="ConnectionType"/> exists.
        /// </summary>
        /// <param name="connectionType">The <see cref="ConnectionType"/> to check.</param>
        /// <returns></returns>
        public static bool Listening(ConnectionType connectionType)
        {
            return ExistingLocalListenEndPoints(connectionType).Count > 0;
        }

        /// <summary>
        /// Returns a dictionary corresponding to all current local listeners. Key is connection type, value is local EndPoint of listener.
        /// </summary>
        /// <returns></returns>
        public static Dictionary<ConnectionType, List<EndPoint>> AllExistingLocalListenEndPoints()
        {
            Dictionary<ConnectionType, List<EndPoint>> result = new Dictionary<ConnectionType, List<EndPoint>>();
            lock (staticConnectionLocker)
            {
                foreach (ConnectionType connType in listenersDict.Keys)
                {
                    if (listenersDict[connType].Count > 0)
                        result.Add(connType, new List<EndPoint>());

                    foreach (EndPoint endPoint in listenersDict[connType].Keys)
                    {
                        if (listenersDict[connType][endPoint].IsListening)
                            result[connType].Add(endPoint);
                    }
                }
            }

            return result;
        }

        /// <summary>
        /// Returns a list of <see cref="EndPoint"/>s corresponding to possible local listeners of the provided
        /// <see cref="ConnectionType"/>. If no listeners exist returns empty list.
        /// </summary>
        /// <param name="connectionType">The connection type to match. Use ConnectionType.Undefined to match all.</param>
        /// <returns></returns>
        public static List<EndPoint> ExistingLocalListenEndPoints(ConnectionType connectionType)
        {
            if (connectionType == ConnectionType.TCP || connectionType == ConnectionType.UDP)
                return ExistingLocalListenEndPoints(connectionType, new IPEndPoint(IPAddress.Any, 0));
#if NET35 || NET4
            else if (connectionType == ConnectionType.Bluetooth)
                return ExistingLocalListenEndPoints(connectionType, new BluetoothEndPoint(BluetoothAddress.None, BluetoothService.Empty));
#endif
            else
                throw new ArgumentException("Method ExistingLocalListenEndPoints is not defined for the connection type: " + connectionType.ToString(), "connectionType");
        }

        /// <summary>
        /// Returns a list of <see cref="EndPoint"/> corresponding to possible local listeners of the provided
        /// <see cref="ConnectionType"/> with a local EndPoint with matching <see cref="IPAddress"/>.
        /// If no matching listeners exist returns empty list.
        /// </summary>
        /// <param name="connectionType">Connection type to match. Use ConnectionType.Undefined to match all.</param>
        /// <param name="localEndPointToMatch">The <see cref="IPEndPoint"/> to match to local listeners. Use IPAddress.Any
        /// to match all addresses. Use port 0 to match all ports.</param>
        /// <returns></returns>
        public static List<EndPoint> ExistingLocalListenEndPoints(ConnectionType connectionType, EndPoint localEndPointToMatch)
        {
            if (connectionType == ConnectionType.Undefined) throw new ArgumentException("ConnectionType.Undefined may not be used with this override. Please see others.", "connectionType");
            if (localEndPointToMatch == null) throw new ArgumentNullException("localEndPointToMatch");

#if NET4 || NET35
            if (connectionType == ConnectionType.Bluetooth)
            {
                InTheHand.Net.BluetoothEndPoint btEndPointToMatch = localEndPointToMatch as InTheHand.Net.BluetoothEndPoint;

                if (btEndPointToMatch == null)
                    throw new ArgumentException("Local endpoint must be a BluetoothEndPoint for Bluetooth connection type", "localEndPointToMatch");

                List<EndPoint> btResult = new List<EndPoint>();
                lock (staticConnectionLocker)
                {
                    if (listenersDict.ContainsKey(connectionType))
                    {
                        foreach (EndPoint endPoint in listenersDict[connectionType].Keys)
                        {
                            var btEndPoint = endPoint as InTheHand.Net.BluetoothEndPoint;
                            if (btEndPointToMatch.Address == BluetoothAddress.None && btEndPointToMatch.Service == BluetoothService.Empty)
                            {
                                btResult.Add(btEndPoint);
                            }
                            else if (btEndPointToMatch.Address != BluetoothAddress.None && btEndPointToMatch.Service == BluetoothService.Empty)
                            {
                                //Match the address
                                if (btEndPoint.Address.Equals(btEndPointToMatch.Address) &&
                                    listenersDict[connectionType][btEndPoint].IsListening)
                                    btResult.Add(btEndPoint);
                            }
                            else if (btEndPointToMatch.Address == BluetoothAddress.None && btEndPointToMatch.Service != BluetoothService.Empty)
                            {
                                //Match the service
                                if (btEndPoint.Service.Equals(btEndPointToMatch.Service) &&
                                    listenersDict[connectionType][btEndPoint].IsListening)
                                    btResult.Add(btEndPoint);
                            }
                            else if (endPoint.Equals(localEndPointToMatch) && listenersDict[connectionType][endPoint].IsListening)
                            {
                                btResult.Add(endPoint);
                                break;
                            }
                        }
                    }
                }

                return btResult;
            }
#endif

            IPEndPoint ipEndPointToMatch = localEndPointToMatch as IPEndPoint;

            List<EndPoint> result = new List<EndPoint>();
            lock (staticConnectionLocker)
            {
                if (listenersDict.ContainsKey(connectionType))
                {
                    foreach (EndPoint endPoint in listenersDict[connectionType].Keys)
                    {
                        IPEndPoint ipEndPoint = endPoint as IPEndPoint;
                        if (ipEndPointToMatch != null && (ipEndPointToMatch.Address == IPAddress.Any || ipEndPointToMatch.Address == IPAddress.IPv6Any) && ipEndPointToMatch.Port == 0)
                        {
                            //Add if listening
                            if (listenersDict[connectionType][ipEndPoint].IsListening)
                                result.Add(ipEndPoint);
                        }
                        else if (ipEndPointToMatch != null && !(ipEndPointToMatch.Address == IPAddress.Any || ipEndPointToMatch.Address == IPAddress.IPv6Any) && ipEndPointToMatch.Port == 0)
                        {
                            //Match the IP Address
                            if (ipEndPoint.Address.Equals(ipEndPointToMatch.Address) &&
                                listenersDict[connectionType][ipEndPoint].IsListening)
                                result.Add(ipEndPoint);
                        }
                        else if (ipEndPointToMatch != null && (ipEndPointToMatch.Address == IPAddress.Any || ipEndPointToMatch.Address == IPAddress.IPv6Any) && ipEndPointToMatch.Port > 0)
                        {
                            //Match the port
                            if (ipEndPoint.Port == ipEndPointToMatch.Port &&
                                listenersDict[connectionType][ipEndPoint].IsListening)
                                result.Add(ipEndPoint);
                        }
                        else if (endPoint.Equals(localEndPointToMatch) && listenersDict[connectionType][endPoint].IsListening)
                        {
                            result.Add(endPoint);
                            break;
                        }
                    }
                }
            }

            return result;
        }

        /// <summary>
        /// Returns a list of requested existing local listeners.
        /// </summary>
        /// <typeparam name="listenerType">Type of listener to return.</typeparam>
        /// <param name="endPointToMatch">The <see cref="EndPoint"/> to match to local listeners. Use IPAddress.Any to match all
        /// addresses. Use port 0 to match all ports.</param>
        /// <returns></returns>
        public static List<listenerType> ExistingLocalListeners<listenerType>(EndPoint endPointToMatch) where listenerType : ConnectionListenerBase
        {
            List<listenerType> result = new List<listenerType>();
            lock (staticConnectionLocker)
            {
                //Get a list of valid endPoints
                if (typeof(listenerType) == typeof(UDPConnectionListener))
                {
                    List<EndPoint> endPointsToUse = ExistingLocalListenEndPoints(ConnectionType.UDP, endPointToMatch);
                    foreach (EndPoint endPoint in endPointsToUse)
                        result.Add((listenerType)listenersDict[ConnectionType.UDP][endPoint]);
                }
                else if (typeof(listenerType) == typeof(TCPConnectionListener))
                {
                    List<EndPoint> endPointsToUse = ExistingLocalListenEndPoints(ConnectionType.TCP, endPointToMatch);
                    foreach (EndPoint endPoint in endPointsToUse)
                        result.Add((listenerType)listenersDict[ConnectionType.TCP][endPoint]);
                }
#if NET35 || NET4
                else if (typeof(listenerType) == typeof(BluetoothConnectionListener))
                {
                    List<EndPoint> endPointsToUse = ExistingLocalListenEndPoints(ConnectionType.Bluetooth, endPointToMatch);
                    foreach (EndPoint endPoint in endPointsToUse)
                        result.Add((listenerType)listenersDict[ConnectionType.Bluetooth][endPoint]);
                }
#endif
                else
                    throw new NotImplementedException("This method has not been implemented for provided type of " + typeof(listenerType));
            }

            return result;
        }

        /// <summary>
        /// Returns a list of all local listeners
        /// </summary>
        /// <returns>A list of all local listeners</returns>
        public static List<ConnectionListenerBase> AllExistingLocalListeners()
        {
            List<ConnectionListenerBase> result = new List<ConnectionListenerBase>();
            lock (staticConnectionLocker)
            {
				//Dictionary<ConnectionType, List<EndPoint>> endPoints = AllExistingLocalListenEndPoints();

                foreach (var byConnectionType in listenersDict)
                    foreach (var byEndPoint in byConnectionType.Value)
                        result.Add(byEndPoint.Value);
            }

            return result;
        }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
	<color name="colorPrimary">#A00054</color>
	<color name="colorPrimaryDark">#810039</color>
	<color name="colorAccent">#CE006D</color>
	<color name="colorSurface">#292929</color>
	<color name="colorBackground">#212121</color>

	<color name="black_overlay">#66000000</color>
</resources>


text:
package net.imagej.axis;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertNull;

import org.junit.Test;

/**
 * Tests {@link LogLinearAxis}.
 *
 * @author Barry DeZonia
 */
public class LogLinearAxisTest extends AbstractAxisTest {

	@Test
	public void testDefaultCtor() {
		final LogLinearAxis axis = new LogLinearAxis();

		assertUnknown(axis);
		assertNull(axis.unit());
		assertEquals(0, axis.a(), 0);
		assertEquals(1, axis.b(), 0);
		assertEquals(1, axis.c(), 0);
		assertEquals(1, axis.d(), 0);
		assertEquals(calValue(4, axis), axis.calibratedValue(4), 0);
	}

	@Test
	public void testOtherCtor() {
		final LogLinearAxis axis = new LogLinearAxis(Axes.Z, "lp", 1, 2, 3, 4);

		assertEquals(Axes.Z, axis.type());
		assertEquals("lp", axis.unit());
		assertEquals(1, axis.a(), 0);
		assertEquals(2, axis.b(), 0);
		assertEquals(3, axis.c(), 0);
		assertEquals(4, axis.d(), 0);
		assertEquals(calValue(4, axis), axis.calibratedValue(4), 0);
	}

	@Test
	public void testOtherStuff() {
		final LogLinearAxis axis = new LogLinearAxis();

		axis.setA(2);
		axis.setB(3);
		axis.setC(5);
		axis.setD(7);
		assertEquals(2, axis.a(), 0);
		assertEquals(3, axis.b(), 0);
		assertEquals(5, axis.c(), 0);
		assertEquals(7, axis.d(), 0);

		for (int i = 0; i < 100; i++) {
			assertEquals(axis.rawValue(axis.calibratedValue(i)), i, 0.000001);
		}
	}

	@Test
	public void testCopy() {
		final LogLinearAxis axis = new LogLinearAxis(Axes.Z, "lp", 1, 2, 3, 4);
		final LogLinearAxis copy = axis.copy();
		assertNotSame(axis, copy);
		assertEquals(axis, copy);
		assertEquals(axis.hashCode(), copy.hashCode());
	}

	private double calValue(final double raw, final LogLinearAxis axis) {
		return axis.a() + axis.b() * (Math.log(axis.c() + (axis.d() * raw)));
	}
}


text:
import { TestBed, inject } from '@angular/core/testing';

import { Service376Service } from './service-376.service';

describe('Service376Service', () => {
  beforeEach(() => {
    TestBed.configureTestingModule({
      providers: [Service376Service]
    });
  });

  it('should ...', inject([Service376Service], (service: Service376Service) => {
    expect(service).toBeTruthy();
  }));
});


text:
Test.assert_equals(encode_rail_fence_cipher('WEAREDISCOVEREDFLEEATONCE', 3), 'WECRLTEERDSOEEFEAOCAIVDEN')
Test.assert_equals(encode_rail_fence_cipher('Hello, World!', 3), 'Hoo!el,Wrdl l')
Test.assert_equals(encode_rail_fence_cipher('Hello, World!', 4), 'H !e,Wdloollr')
Test.assert_equals(encode_rail_fence_cipher('', 3), '')

Test.assert_equals(decode_rail_fence_cipher('H !e,Wdloollr', 4), 'Hello, World!')
Test.assert_equals(decode_rail_fence_cipher('WECRLTEERDSOEEFEAOCAIVDEN', 3), 'WEAREDISCOVEREDFLEEATONCE')
Test.assert_equals(decode_rail_fence_cipher('', 3), '')