text:
"""Support for SimpliSafe alarm control panels."""
from __future__ import annotations

from typing import TYPE_CHECKING

from simplipy.errors import SimplipyError
from simplipy.system import SystemStates
from simplipy.system.v3 import SystemV3
from simplipy.websocket import (
    EVENT_ALARM_CANCELED,
    EVENT_ALARM_TRIGGERED,
    EVENT_ARMED_AWAY,
    EVENT_ARMED_AWAY_BY_KEYPAD,
    EVENT_ARMED_AWAY_BY_REMOTE,
    EVENT_ARMED_HOME,
    EVENT_AWAY_EXIT_DELAY_BY_KEYPAD,
    EVENT_AWAY_EXIT_DELAY_BY_REMOTE,
    EVENT_DISARMED_BY_MASTER_PIN,
    EVENT_DISARMED_BY_REMOTE,
    EVENT_HOME_EXIT_DELAY,
    WebsocketEvent,
)

from homeassistant.components.alarm_control_panel import (
    FORMAT_NUMBER,
    FORMAT_TEXT,
    AlarmControlPanelEntity,
)
from homeassistant.components.alarm_control_panel.const import (
    SUPPORT_ALARM_ARM_AWAY,
    SUPPORT_ALARM_ARM_HOME,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
    CONF_CODE,
    STATE_ALARM_ARMED_AWAY,
    STATE_ALARM_ARMED_HOME,
    STATE_ALARM_ARMING,
    STATE_ALARM_DISARMED,
    STATE_ALARM_PENDING,
    STATE_ALARM_TRIGGERED,
)
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from . import SimpliSafe, SimpliSafeEntity
from .const import (
    ATTR_ALARM_DURATION,
    ATTR_ALARM_VOLUME,
    ATTR_CHIME_VOLUME,
    ATTR_ENTRY_DELAY_AWAY,
    ATTR_ENTRY_DELAY_HOME,
    ATTR_EXIT_DELAY_AWAY,
    ATTR_EXIT_DELAY_HOME,
    ATTR_LIGHT,
    ATTR_VOICE_PROMPT_VOLUME,
    DOMAIN,
    LOGGER,
)
from .typing import SystemType

ATTR_BATTERY_BACKUP_POWER_LEVEL = "battery_backup_power_level"
ATTR_GSM_STRENGTH = "gsm_strength"
ATTR_PIN_NAME = "pin_name"
ATTR_RF_JAMMING = "rf_jamming"
ATTR_WALL_POWER_LEVEL = "wall_power_level"
ATTR_WIFI_STRENGTH = "wifi_strength"

STATE_MAP_FROM_REST_API = {
    SystemStates.ALARM: STATE_ALARM_TRIGGERED,
    SystemStates.ALARM_COUNT: STATE_ALARM_PENDING,
    SystemStates.AWAY: STATE_ALARM_ARMED_AWAY,
    SystemStates.AWAY_COUNT: STATE_ALARM_ARMING,
    SystemStates.EXIT_DELAY: STATE_ALARM_ARMING,
    SystemStates.HOME: STATE_ALARM_ARMED_HOME,
    SystemStates.OFF: STATE_ALARM_DISARMED,
}

STATE_MAP_FROM_WEBSOCKET_EVENT = {
    EVENT_ALARM_CANCELED: STATE_ALARM_DISARMED,
    EVENT_ALARM_TRIGGERED: STATE_ALARM_TRIGGERED,
    EVENT_ARMED_AWAY: STATE_ALARM_ARMED_AWAY,
    EVENT_ARMED_AWAY_BY_KEYPAD: STATE_ALARM_ARMED_AWAY,
    EVENT_ARMED_AWAY_BY_REMOTE: STATE_ALARM_ARMED_AWAY,
    EVENT_ARMED_HOME: STATE_ALARM_ARMED_HOME,
    EVENT_AWAY_EXIT_DELAY_BY_KEYPAD: STATE_ALARM_ARMING,
    EVENT_AWAY_EXIT_DELAY_BY_REMOTE: STATE_ALARM_ARMING,
    EVENT_DISARMED_BY_MASTER_PIN: STATE_ALARM_DISARMED,
    EVENT_DISARMED_BY_REMOTE: STATE_ALARM_DISARMED,
    EVENT_HOME_EXIT_DELAY: STATE_ALARM_ARMING,
}

WEBSOCKET_EVENTS_TO_LISTEN_FOR = (
    EVENT_ALARM_CANCELED,
    EVENT_ALARM_TRIGGERED,
    EVENT_ARMED_AWAY,
    EVENT_ARMED_AWAY_BY_KEYPAD,
    EVENT_ARMED_AWAY_BY_REMOTE,
    EVENT_ARMED_HOME,
    EVENT_AWAY_EXIT_DELAY_BY_KEYPAD,
    EVENT_AWAY_EXIT_DELAY_BY_REMOTE,
    EVENT_DISARMED_BY_MASTER_PIN,
    EVENT_DISARMED_BY_REMOTE,
    EVENT_HOME_EXIT_DELAY,
)

async def async_setup_entry(
    hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
) -> None:
    """Set up a SimpliSafe alarm control panel based on a config entry."""
    simplisafe = hass.data[DOMAIN][entry.entry_id]
    async_add_entities(
        [SimpliSafeAlarm(simplisafe, system) for system in simplisafe.systems.values()],
        True,
    )

class SimpliSafeAlarm(SimpliSafeEntity, AlarmControlPanelEntity):
    """Representation of a SimpliSafe alarm."""

    def __init__(self, simplisafe: SimpliSafe, system: SystemType) -> None:
        """Initialize the SimpliSafe alarm."""
        super().__init__(
            simplisafe,
            system,
            additional_websocket_events=WEBSOCKET_EVENTS_TO_LISTEN_FOR,
        )

        if code := self._simplisafe.entry.options.get(CONF_CODE):
            if code.isdigit():
                self._attr_code_format = FORMAT_NUMBER
            else:
                self._attr_code_format = FORMAT_TEXT
        self._attr_supported_features = SUPPORT_ALARM_ARM_HOME | SUPPORT_ALARM_ARM_AWAY
        self._last_event = None

        self._set_state_from_system_data()

    @callback
    def _is_code_valid(self, code: str | None, state: str) -> bool:
        """Validate that a code matches the required one."""
        if not self._simplisafe.entry.options.get(CONF_CODE):
            return True

        if not code or code != self._simplisafe.entry.options[CONF_CODE]:
            LOGGER.warning(
                "Incorrect alarm code entered (target state: %s): %s", state, code
            )
            return False

        return True

    @callback
    def _set_state_from_system_data(self) -> None:
        """Set the state based on the latest REST API data."""
        if self._system.alarm_going_off:
            self._attr_state = STATE_ALARM_TRIGGERED
        elif self._system.state == SystemStates.ERROR:
            self.async_increment_error_count()
        elif state := STATE_MAP_FROM_REST_API.get(self._system.state):
            self._attr_state = state
            self.async_reset_error_count()
        else:
            LOGGER.error("Unknown system state (REST API): %s", self._system.state)
            self.async_increment_error_count()

    async def async_alarm_disarm(self, code: str | None = None) -> None:
        """Send disarm command."""
        if not self._is_code_valid(code, STATE_ALARM_DISARMED):
            return

        try:
            await self._system.async_set_off()
        except SimplipyError as err:
            LOGGER.error('Error while disarming "%s": %s', self._system.system_id, err)
            return

        self._attr_state = STATE_ALARM_DISARMED
        self.async_write_ha_state()

    async def async_alarm_arm_home(self, code: str | None = None) -> None:
        """Send arm home command."""
        if not self._is_code_valid(code, STATE_ALARM_ARMED_HOME):
            return

        try:
            await self._system.async_set_home()
        except SimplipyError as err:
            LOGGER.error(
                'Error while arming "%s" (home): %s', self._system.system_id, err
            )
            return

        self._attr_state = STATE_ALARM_ARMED_HOME
        self.async_write_ha_state()

    async def async_alarm_arm_away(self, code: str | None = None) -> None:
        """Send arm away command."""
        if not self._is_code_valid(code, STATE_ALARM_ARMED_AWAY):
            return

        try:
            await self._system.async_set_away()
        except SimplipyError as err:
            LOGGER.error(
                'Error while arming "%s" (away): %s', self._system.system_id, err
            )
            return

        self._attr_state = STATE_ALARM_ARMING
        self.async_write_ha_state()

    @callback
    def async_update_from_rest_api(self) -> None:
        """Update the entity with the provided REST API data."""
        if isinstance(self._system, SystemV3):
            self._attr_extra_state_attributes.update(
                {
                    ATTR_ALARM_DURATION: self._system.alarm_duration,
                    ATTR_ALARM_VOLUME: self._system.alarm_volume.name.lower(),
                    ATTR_BATTERY_BACKUP_POWER_LEVEL: self._system.battery_backup_power_level,
                    ATTR_CHIME_VOLUME: self._system.chime_volume.name.lower(),
                    ATTR_ENTRY_DELAY_AWAY: self._system.entry_delay_away,
                    ATTR_ENTRY_DELAY_HOME: self._system.entry_delay_home,
                    ATTR_EXIT_DELAY_AWAY: self._system.exit_delay_away,
                    ATTR_EXIT_DELAY_HOME: self._system.exit_delay_home,
                    ATTR_GSM_STRENGTH: self._system.gsm_strength,
                    ATTR_LIGHT: self._system.light,
                    ATTR_RF_JAMMING: self._system.rf_jamming,
                    ATTR_VOICE_PROMPT_VOLUME: self._system.voice_prompt_volume.name.lower(),
                    ATTR_WALL_POWER_LEVEL: self._system.wall_power_level,
                    ATTR_WIFI_STRENGTH: self._system.wifi_strength,
                }
            )

        self._set_state_from_system_data()

    @callback
    def async_update_from_websocket_event(self, event: WebsocketEvent) -> None:
        """Update the entity when new data comes from the websocket."""
        self._attr_changed_by = event.changed_by
        if TYPE_CHECKING:
            assert event.event_type
        if state := STATE_MAP_FROM_WEBSOCKET_EVENT.get(event.event_type):
            self._attr_state = state
            self.async_reset_error_count()
        else:
            LOGGER.error("Unknown alarm websocket event: %s", event.event_type)
            self.async_increment_error_count()


text:
'use strict';

var LightboxDirective = function ($mdDialog, assetPath, $translate) {
    return {
        scope: true,
        link: function (scope, elem, attrs) {
            elem.addClass('image-click');
            elem.bind('click', function () {
                $mdDialog.show($mdDialog.confirm()
                    .clickOutsideToClose(true)
                    .htmlContent('<img class="spot-image" src="'+ attrs.ngOriginalUrl +'" style="width:100%" />')
                    .hasBackdrop(false)
                    .ariaLabel('.title')
                    .ok($translate.instant('actions.close')));
            });
        }
    };
};

LightboxDirective.$inject = ['$mdDialog', 'assetPath', '$translate'];

module.exports = LightboxDirective;

redpajama_set_name: RedPajamaGithub


text:
package com.simpligility.cookie.input;

import android.content.Context;
import android.view.View;
import android.widget.Toast;

public class BaseDownListener extends AbstractArmClickListener {

  Context context;

  public BaseDownListener(Context context) {
    super();
    this.context = context;
  }

  public void onClick(View v) {
    Toast.makeText(context, "Base Down", 5).show();
  }
}


text:
using System;

class FillsAndPrintsAMatrix
{
    static void Main()
    {
        Console.Write("Please Enter matrix Length N: ");
        int length = int.Parse(Console.ReadLine());

        Console.WriteLine("\nShow matrix a)");
        ShowMatrixA(length);

        Console.WriteLine("\nShow matrix b)");
        ShowMatrixB(length);

        Console.WriteLine("\nShow matrix c)");
        ShowMatrixC(length);

        Console.WriteLine("\nShow matrix d)");
        ShowMatrixD(length);
    }

    private static void ShowMatrixA(int length)
    {
        int[,] matrix = new int[length, length];
        int count = 1;

        for (int column = 0; column < matrix.GetLength(0); column++)
        {
            for (int row = 0; row < matrix.GetLength(1); row++)
            {
                matrix[row, column] = count;
                count++;
            }
        }

        PrintMatrix(matrix);
    }

    private static void ShowMatrixB(int length)
    {
        int[,] matrix = new int[length, length];
        int count = 1;

        for (int column = 0; column < matrix.GetLength(0); column++)
        {
            for (int j = 0; j < matrix.GetLength(1); j++)
            {
                if (column % 2 == 0)
                {
                    matrix[j, column] = count;
                    count++;
                }
                else
                {
                    int row = matrix.GetLength(1) - j - 1;
                    matrix[row, column] = count;
                    count++;
                }
            }
        }

        PrintMatrix(matrix);
    }

    private static void ShowMatrixC(int length)
    {
        int[,] matrix = new int[length, length];
        int count = 1;
        int lastStep = length * 2; // number of backslash
        int row = length - 1;
        int col = 0;

        for (int step = 1; step < lastStep; step++)
        {
            int currentRow = row;
            int currentCol = col;

            while ((currentRow < length) && (currentCol < length))
            {
                matrix[currentRow, currentCol] = count;
                count++;
                currentRow++;
                currentCol++;
            }

            if (row > 0)
            {
                row--;
            }
            else
            {
                col++;
            }

        }

        PrintMatrix(matrix);

    }

    private static void ShowMatrixD(int length)
    {
        int[,] matrix = new int[length, length];
        int count = 1;
        int lastStep = length * 2; // number of backslash
        int row = 0;
        int col = 0;

        string direction = "down";

        while (true)
        {
            if (direction == "down" && (row == length || matrix[row, col] != 0))
            {
                direction = "right";
                row--;
                col++;
            }
            if (direction == "right" && (col == length || matrix[row, col] != 0))
            {
                direction = "up";
                row--;
                col--;
            }
            if (direction == "up" && (row == -1 || matrix[row, col] != 0))
            {
                direction = "left";
                row++;
                col--;
            }
            if (direction == "left" && (col == -1 || matrix[row, col] != 0))
            {
                direction = "down";
                row++;
                col++;
            }

            if (matrix[row, col] != 0)
            {
                break;
            }

            matrix[row, col] = count;
            count++;

            if (direction == "down")
            {
                row++;
            }
            else if (direction == "right")
            {
                col++;
            }
            else if (direction == "up")
            {
                row--;
            }
            else if (direction == "left")
            {
                col--;
            }
        }

        PrintMatrix(matrix);

    }

    private static void PrintMatrix(int[,] matrix)
    {
        for (int row = 0; row < matrix.GetLength(0); row++)
        {
            for (int column = 0; column < matrix.GetLength(1); column++)
            {
                Console.Write("{0,3} ", matrix[row, column]);
            }

            Console.WriteLine();
        }

        Console.WriteLine();
    }
}


text:
namespace power_bookmarks {

EmptyPowerBookmarkDatabase::EmptyPowerBookmarkDatabase() = default;

EmptyPowerBookmarkDatabase::~EmptyPowerBookmarkDatabase() = default;

bool EmptyPowerBookmarkDatabase::Init() {
  return true;
}

bool EmptyPowerBookmarkDatabase::IsOpen() {
  return true;
}

std::vector<std::unique_ptr<Power>> EmptyPowerBookmarkDatabase::GetPowersForURL(
    const GURL& url,
    const PowerType& power_type) {
  return std::vector<std::unique_ptr<Power>>();
}

std::vector<std::unique_ptr<PowerOverview>>
EmptyPowerBookmarkDatabase::GetPowerOverviewsForType(
    const PowerType& power_type) {
  return std::vector<std::unique_ptr<PowerOverview>>();
}

std::vector<std::unique_ptr<Power>>
EmptyPowerBookmarkDatabase::GetPowersForSearchParams(
    const SearchParams& search_params) {
  return std::vector<std::unique_ptr<Power>>();
}

bool EmptyPowerBookmarkDatabase::CreatePower(std::unique_ptr<Power> power) {
  return false;
}

bool EmptyPowerBookmarkDatabase::UpdatePower(std::unique_ptr<Power> power) {
  return false;
}

bool EmptyPowerBookmarkDatabase::DeletePower(const base::GUID& guid) {
  return false;
}

bool EmptyPowerBookmarkDatabase::DeletePowersForURL(
    const GURL& url,
    const PowerType& power_type) {
  return false;
}

}  // namespace power_bookmarks


text:
/*
 * NewJPanel.java
 *
 * Created on 4 juin 2009, 14:26:51
 */

package com.orange.atk.atkUI.guiScript.actions;

/**
 *
 * @author ywil8421
 */
public class NewJPanel extends javax.swing.JPanel {

	private static final long serialVersionUID = 1L;

	/** Creates new form NewJPanel */
    public NewJPanel() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    public void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jList1 = new javax.swing.JList();
        jLabel1 = new javax.swing.JLabel();

        jList1.setModel(new javax.swing.AbstractListModel() {
            /**
			 *
			 */
			private static final long serialVersionUID = 1L;
			String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane1.setViewportView(jList1);

        jLabel1.setText("Random Test");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 215, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addContainerGap(175, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(26, 26, 26)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(109, Short.MAX_VALUE))
        );
    }// </editor-fold>

    // Variables declaration - do not modify
    private javax.swing.JLabel jLabel1;
    private javax.swing.JList jList1;
    private javax.swing.JScrollPane jScrollPane1;
    // End of variables declaration

}

 class NewJPanel2{

	   public static void main(String[] args) {
	        //Schedule a job for the event-dispatching thread:
	        //creating and showing this application's GUI.
	        javax.swing.SwingUtilities.invokeLater(new Runnable() {
	            public void run() {
	            	NewJPanel ls=new NewJPanel();
	            }
	        });
	    }

}


text:
package org.lwjgl.llvm;

import javax.annotation.*;

import org.lwjgl.system.*;

import static org.lwjgl.system.MemoryUtil.*;

/**
 * Instances of this class may be set to the {@code indexEntityReference} field of the {@link IndexerCallbacks} struct.
 *
 *
Type

 *
 *

 * void (*{@link #invoke}) (
 *     CXClientData client_data,
 *     CXIdxEntityRefInfo const *info
 * )

 */
public abstract class IndexerIndexEntityReference extends Callback implements IndexerIndexEntityReferenceI {

    /**
     * Creates a {@code IndexerIndexEntityReference} instance from the specified function pointer.
     *
     * @return the new {@code IndexerIndexEntityReference}
     */
    public static IndexerIndexEntityReference create(long functionPointer) {
        IndexerIndexEntityReferenceI instance = Callback.get(functionPointer);
        return instance instanceof IndexerIndexEntityReference
            ? (IndexerIndexEntityReference)instance
            : new Container(functionPointer, instance);
    }

    /** Like {@link #create(long) create}, but returns {@code null} if {@code functionPointer} is {@code NULL}. */
    @Nullable
    public static IndexerIndexEntityReference createSafe(long functionPointer) {
        return functionPointer == NULL ? null : create(functionPointer);
    }

    /** Creates a {@code IndexerIndexEntityReference} instance that delegates to the specified {@code IndexerIndexEntityReferenceI} instance. */
    public static IndexerIndexEntityReference create(IndexerIndexEntityReferenceI instance) {
        return instance instanceof IndexerIndexEntityReference
            ? (IndexerIndexEntityReference)instance
            : new Container(instance.address(), instance);
    }

    protected IndexerIndexEntityReference() {
        super(CIF);
    }

    IndexerIndexEntityReference(long functionPointer) {
        super(functionPointer);
    }

    private static final class Container extends IndexerIndexEntityReference {

        private final IndexerIndexEntityReferenceI delegate;

        Container(long functionPointer, IndexerIndexEntityReferenceI delegate) {
            super(functionPointer);
            this.delegate = delegate;
        }

        @Override
        public void invoke(long client_data, long info) {
            delegate.invoke(client_data, info);
        }

    }

}


text:
package mouse.runtime;

//HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
//
//  SemanticsBase
//
//HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH

public class SemanticsBase
{
  //=====================================================================
  //
  //  Fields set by the Parser.
  //
  //=====================================================================
  //-------------------------------------------------------------------
  //  Reference to current rule in the Parser.
  //  Set when Parser instantiates Semantics.
  //-------------------------------------------------------------------
  public CurrentRule rule;

  //-------------------------------------------------------------------
  //  String that you can use to trigger trace.
  //  Set by applying method 'setTrace' to the Parser.
  //-------------------------------------------------------------------
  public String trace = "";

  //=====================================================================
  //
  //  Initialization.
  //
  //=====================================================================
  //-------------------------------------------------------------------
  //  Invoked at the beginning of each invocation of the Parser.
  //  You can override it to perform your own initialization.
  //-------------------------------------------------------------------
  public void init()
    {}

  //=====================================================================
  //
  //  Methods to be invoked from semantic actions.
  //  They call back the parser to obtain details of the environment
  //  in which the action was invoked.
  //
  //=====================================================================
  //-------------------------------------------------------------------
  //  Returns the left-hand side Phrase object.
  //-------------------------------------------------------------------
  protected Phrase lhs()
    { return rule.lhs(); }

  //-------------------------------------------------------------------
  //  Returns the number of Phrase objects on the right-hand side.
  //-------------------------------------------------------------------
  protected int rhsSize()
    { return rule.rhsSize(); }

  //-------------------------------------------------------------------
  //  Returns the i-th right-hand side object, 0<=i<rhs<=rhsSize().
  //  (The right-hand side objects are numbered starting with 0.)
  //-------------------------------------------------------------------
  protected Phrase rhs(int i)
    { return rule.rhs(i); }

  //-------------------------------------------------------------------
  //  Returns as one String the text represented
  //  by the right-hand side objects numbered i through j-1,
  //  where 0<=i<j<=rhsSize().
  //  (The right-hand side objects are numbered starting with 0.)
  //-------------------------------------------------------------------
  protected String rhsText(int i,int j)
    { return rule.rhsText(i,j); }

}


text:
The maximum number of containers that this provider is allowed to run in total (value is independent of the template/image).

Note that containers which have not been created by Jenkins are not included in this total.

A negative value, or zero, or 2147483647 all mean "no limit" is imposed on the provider as a whole,
    although per-template instance limits (if any) will still apply.

Defaults to 100.


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

package com.google.security.zynamics.binnavi.API.disassembly;

/**
 * Used to signal problems that occurred when saving data to the database.
 */
public final class CouldntSaveDataException extends Exception {

  /**
   * Creates a new exception object.
   *
   * @param exception Cause of the exception
   */
  public CouldntSaveDataException(final Exception exception) {
    super(exception);
  }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/content_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context="sstinc.skeem.activities.MainActivity"
    tools:showIn="@layout/app_bar_main">
</RelativeLayout>


text:
require 'machinist/active_record'

Patient.blueprint do
  firstnames { 'Joe '}
  lastname   { 'Bloggs' }
  patstamp   { Time.gm(2012, 07, 13, 23, 5) }
  hospno     { "456" }
end

Patient.blueprint(:admitted) do
  admissions {
    admission = Admission.new
    admission.admhospno = object.hospno
    admission.admstatus = 'Admitted'
    admission.admstamp  = DateTime.now
    [admission]
  }
end

Admission.blueprint do
  admstatus { "Admitted" }
  admstamp  { Time.gm(2012, 07, 13, 23, 5) }
end

Grade.blueprint do
  title     { "Consultant #{sn}" }
  rank      { 1 }
end

ToDoItem.blueprint do
  description  { "Task #{sn}"  }
  patient      { Patient.make! :hospno => "999#{sn}"}
  patient_list { PatientList.make! }
  grade        { Grade.make! }
end

User.blueprint do
  email    { "test-#{sn}@example.com" }
  password { "password" }
  grade    { Grade.make! }
end

PatientList.blueprint do
  name { "Test List - #{sn}" }
end

Membership.blueprint do
  risk_level   { "low" }
  patient_list { PatientList.make! }
  patient      { Patient.make! }
end

HandoverItem.blueprint do
  to_do_item        { ToDoItem.make! }
  patient_list_from { PatientList.make! }
  patient_list_to   { PatientList.make! }
end


text:
using System;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Http.Controllers;
using System.Web.Http.Routing;
using FluentAssertions;
using OrderFulfillment.Api.Configuration;
using OrderFulfillment.Api.Security;
using Moq;
using Xunit;

namespace OrderFulfillment.Api.Tests.Security
{
    /// <summary>
    ///   The suite of tests for the <see cref="RequireSslAuthorizationPolicy" />
    ///   class.
    /// </summary>
    ///
    public class RequireSslAuthorizationPolicyTests
    {
        /// <summary>
        ///   Verifies functionality of the constructor.
        /// </summary>
        ///
        [Fact]
        public void ConstructorValidatesConfigurationIsPresent()
        {
            Action actionUnderTest = () => new RequireSslAuthorizationPolicy(null);
            actionUnderTest.ShouldThrow<ArgumentNullException>("because the configuration must be present");
        }

        /// <summary>
        ///   Verifies functionality of the Policy property.
        /// </summary>
        ///
        [Fact]
        public void PolicyReflectsTheExpectedPolicy()
        {
            var policy = new RequireSslAuthorizationPolicy(new RequireSslAuthorizationPolicyConfiguration());
            policy.Policy.Should().Be(AuthorizationPolicy.RequireSsl, "because the policy should match the class name");
        }

        /// <summary>
        ///   Verifies functionality of the Enabled property.
        /// </summary>
        ///
        [Fact]
        public void EnabledPropertyIsConfigured()
        {
            var config = new RequireSslAuthorizationPolicyConfiguration { Enabled = true };
            var policy = new RequireSslAuthorizationPolicy(config);
            policy.Enabled.Should().Be(config.Enabled, "because the Enabled property should be driven by configuration");
        }

        /// <summary>
        ///   Verifies functionality of the Evaluate method.
        /// </summary>
        ///
        [Fact]
        public void EvaluateValidatesContextIsPresent()
        {
            Action actionUnderTest = () => new RequireSslAuthorizationPolicy(new RequireSslAuthorizationPolicyConfiguration()).Evaluate(null);
            actionUnderTest.ShouldThrow<ArgumentNullException>("because the HTTP context must be present");
        }

        /// <summary>
        ///   Verifies functionality of the EvaluteMethod.
        /// </summary>
        ///
        [Fact]
        public void EvaluateSucceedsWhenNotEnabled()
        {
            var mockActionDescriptor = new Mock<HttpActionDescriptor>();
            var httpConfiguration    = new HttpConfiguration();
            var routeData            = new HttpRouteData(new HttpRoute());
            var request              = new HttpRequestMessage();
            var controllerDescriptor = new HttpControllerDescriptor { Configuration = httpConfiguration, ControllerName = "generic" };
            var controllerContext    = new HttpControllerContext(httpConfiguration, routeData, request) { ControllerDescriptor = controllerDescriptor };
            var actionContext        = new HttpActionContext(controllerContext, mockActionDescriptor.Object);
            var config               = new RequireSslAuthorizationPolicyConfiguration { Enabled = false };
            var policy               = new RequireSslAuthorizationPolicy(config);

            mockActionDescriptor.SetupGet(descriptor => descriptor.ActionName).Returns("someAction");

            request.RequestUri = new Uri("http://www.someServer.com");
            request.SetConfiguration(httpConfiguration);
            request.SetRouteData(routeData);

            policy.Evaluate(actionContext).Should().BeNull("because the policy should always be satisfied if not enabled");
        }

        /// <summary>
        ///   Verifies functionality of the EvaluteMethod.
        /// </summary>
        ///
        [Fact]
        public void EvaluateSucceedsForUnsecuredLocalRequestWhenTheExceptionIsAllowed()
        {
            var mockActionDescriptor = new Mock<HttpActionDescriptor>();
            var httpConfiguration    = new HttpConfiguration();
            var routeData            = new HttpRouteData(new HttpRoute());
            var request              = new HttpRequestMessage();
            var controllerDescriptor = new HttpControllerDescriptor { Configuration = httpConfiguration, ControllerName = "generic" };
            var controllerContext    = new HttpControllerContext(httpConfiguration, routeData, request) { ControllerDescriptor = controllerDescriptor };
            var actionContext        = new HttpActionContext(controllerContext, mockActionDescriptor.Object);
            var config               = new RequireSslAuthorizationPolicyConfiguration { Enabled = true, AllowLoopbackException = true };
            var policy               = new RequireSslAuthorizationPolicy(config);

            mockActionDescriptor.SetupGet(descriptor => descriptor.ActionName).Returns("someAction");

            request.RequestUri = new Uri("http://localhost/some-endpoint");
            request.SetConfiguration(httpConfiguration);
            request.SetRouteData(routeData);

            policy.Evaluate(actionContext).Should().BeNull("because the policy should always be satisfied for a local request when the exception is enabled");
        }

        /// <summary>
        ///   Verifies functionality of the EvaluteMethod.
        /// </summary>
        ///
        [Fact]
        public void EvaluateFailsForUnsecuredLocalRequestWhenTheExceptionIsDisallowed()
        {
            var mockActionDescriptor = new Mock<HttpActionDescriptor>();
            var httpConfiguration    = new HttpConfiguration();
            var routeData            = new HttpRouteData(new HttpRoute());
            var request              = new HttpRequestMessage();
            var controllerDescriptor = new HttpControllerDescriptor { Configuration = httpConfiguration, ControllerName = "generic" };
            var controllerContext    = new HttpControllerContext(httpConfiguration, routeData, request) { ControllerDescriptor = controllerDescriptor };
            var actionContext        = new HttpActionContext(controllerContext, mockActionDescriptor.Object);
            var config               = new RequireSslAuthorizationPolicyConfiguration { Enabled = true, AllowLoopbackException = false };
            var policy               = new RequireSslAuthorizationPolicy(config);

            mockActionDescriptor.SetupGet(descriptor => descriptor.ActionName).Returns("someAction");

            request.RequestUri = new Uri("http://localhost/some-endpoint");
            request.SetConfiguration(httpConfiguration);
            request.SetRouteData(routeData);

            policy.Evaluate(actionContext).Should().Be(HttpStatusCode.Forbidden, "because the policy should not be satisfied for an unsecured local request when the exception is disabled");
        }

        /// <summary>
        ///   Verifies functionality of the EvaluteMethod.
        /// </summary>
        ///
        [Fact]
        public void EvaluateSucceedsForSecureLocalRequestWhenTheExceptionIsAllowed()
        {
            var mockActionDescriptor = new Mock<HttpActionDescriptor>();
            var httpConfiguration    = new HttpConfiguration();
            var routeData            = new HttpRouteData(new HttpRoute());
            var request              = new HttpRequestMessage();
            var controllerDescriptor = new HttpControllerDescriptor { Configuration = httpConfiguration, ControllerName = "generic" };
            var controllerContext    = new HttpControllerContext(httpConfiguration, routeData, request) { ControllerDescriptor = controllerDescriptor };
            var actionContext        = new HttpActionContext(controllerContext, mockActionDescriptor.Object);
            var config               = new RequireSslAuthorizationPolicyConfiguration { Enabled = true, AllowLoopbackException = true };
            var policy               = new RequireSslAuthorizationPolicy(config);

            mockActionDescriptor.SetupGet(descriptor => descriptor.ActionName).Returns("someAction");

            request.RequestUri = new Uri("https://localhost/some-endpoint");
            request.SetConfiguration(httpConfiguration);
            request.SetRouteData(routeData);

            policy.Evaluate(actionContext).Should().BeNull("because the policy should always be satisfied for a local request when the exception is enabled");
        }

        /// <summary>
        ///   Verifies functionality of the EvaluteMethod.
        /// </summary>
        ///
        [Fact]
        public void EvaluateSucceedsForSecureLocalRequestWhenTheExceptionIsDisallowed()
        {
            var mockActionDescriptor = new Mock<HttpActionDescriptor>();
            var httpConfiguration    = new HttpConfiguration();
            var routeData            = new HttpRouteData(new HttpRoute());
            var request              = new HttpRequestMessage();
            var controllerDescriptor = new HttpControllerDescriptor { Configuration = httpConfiguration, ControllerName = "generic" };
            var controllerContext    = new HttpControllerContext(httpConfiguration, routeData, request) { ControllerDescriptor = controllerDescriptor };
            var actionContext        = new HttpActionContext(controllerContext, mockActionDescriptor.Object);
            var config               = new RequireSslAuthorizationPolicyConfiguration { Enabled = true, AllowLoopbackException = false };
            var policy               = new RequireSslAuthorizationPolicy(config);

            mockActionDescriptor.SetupGet(descriptor => descriptor.ActionName).Returns("someAction");

            request.RequestUri = new Uri("https://localhost/some-endpoint");
            request.SetConfiguration(httpConfiguration);
            request.SetRouteData(routeData);

            policy.Evaluate(actionContext).Should().BeNull("because the policy should be satisfied for a secure local request when the exception is disallowed");
        }

        /// <summary>
        ///   Verifies functionality of the EvaluteMethod.
        /// </summary>
        ///
        [Fact]
        public void EvaluateSucceedsForSecureRequest()
        {
            var mockActionDescriptor = new Mock<HttpActionDescriptor>();
            var httpConfiguration    = new HttpConfiguration();
            var routeData            = new HttpRouteData(new HttpRoute());
            var request              = new HttpRequestMessage();
            var controllerDescriptor = new HttpControllerDescriptor { Configuration = httpConfiguration, ControllerName = "generic" };
            var controllerContext    = new HttpControllerContext(httpConfiguration, routeData, request) { ControllerDescriptor = controllerDescriptor };
            var actionContext        = new HttpActionContext(controllerContext, mockActionDescriptor.Object);
            var config               = new RequireSslAuthorizationPolicyConfiguration { Enabled = true };
            var policy               = new RequireSslAuthorizationPolicy(config);

            mockActionDescriptor.SetupGet(descriptor => descriptor.ActionName).Returns("someAction");

            request.RequestUri = new Uri("https://api.someserver.com/some-endpoint");
            request.SetConfiguration(httpConfiguration);
            request.SetRouteData(routeData);

            policy.Evaluate(actionContext).Should().BeNull("because the policy should always be satisfied for a request over SSL");
        }

        /// <summary>
        ///   Verifies functionality of the EvaluteMethod.
        /// </summary>
        ///
        [Fact]
        public void EvaluateFailsForUnsecuredRequest()
        {
            var mockActionDescriptor = new Mock<HttpActionDescriptor>();
            var httpConfiguration    = new HttpConfiguration();
            var routeData            = new HttpRouteData(new HttpRoute());
            var request              = new HttpRequestMessage();
            var controllerDescriptor = new HttpControllerDescriptor { Configuration = httpConfiguration, ControllerName = "generic" };
            var controllerContext    = new HttpControllerContext(httpConfiguration, routeData, request) { ControllerDescriptor = controllerDescriptor };
            var actionContext        = new HttpActionContext(controllerContext, mockActionDescriptor.Object);
            var config               = new RequireSslAuthorizationPolicyConfiguration { Enabled = true, AllowLoopbackException = true };
            var policy               = new RequireSslAuthorizationPolicy(config);

            mockActionDescriptor.SetupGet(descriptor => descriptor.ActionName).Returns("someAction");

            request.RequestUri = new Uri("http://api.someserver.com/some-endpoint");
            request.SetConfiguration(httpConfiguration);
            request.SetRouteData(routeData);

            policy.Evaluate(actionContext).Should().Be(HttpStatusCode.Forbidden, "because the policy should fail for a request that is not local or over SSL.");
        }
    }
}


text:
package components

import (
	"os"
	"strings"
)

const (
	// CiliumAgentName is the name of cilium-agent (daemon) process name.
	CiliumAgentName = "cilium-agent"
	// CiliumDaemonTestName is the name of test binary for daemon package.
	CiliumDaemonTestName = "daemon.test"
)

// IsCiliumAgent checks whether the current process is cilium-agent (daemon).
func IsCiliumAgent() bool {
	binaryName := os.Args[0]
	return binaryName == CiliumAgentName || strings.Contains(binaryName, CiliumDaemonTestName)
}


text:
from setuptools import setup, find_packages

version = '0.1.1'
try:
    import os
    doc_dir = os.path.join(os.path.dirname(__file__), 'docs')
    readme = open(os.path.join(doc_dir, 'README.rst'))
    long_description = readme.read()
except IOError:
    try:
        import bidict
        long_description = bidict.__doc__
    except:
        long_description = """\
bidict
======

``bidict`` provides a bidirectional mapping data structure and related
utilities (``namedbidict``, ``inverted``) to naturally model one-to-one
relations in Python. To keep the learning curve low, it introduces no new
functions to the ``dict`` API you're already familiar with. It owes its
simplicity to Python's slice syntax, which provides a handy and natural way
of expressing the inverse mapping in a ``bidict``::

    >>> husbands2wives = bidict({'john': 'jackie'})
    >>> husbands2wives['john'] # the forward mapping is just like with dict
    'jackie'
    >>> husbands2wives[:'jackie'] # use slice for the inverse mapping
    'john'

You can also use the unary inverse operator ``~`` on a bidict to get the
inverse mapping::

    >>> ~husbands2wives
    bidict({'jackie': 'john'})

More examples are available in the module documentation.
"""

long_description += """
----------
Background
----------

This module evolved from a November 2009 thread on comp.lang.python
(`link <http://groups.google.com/group/comp.lang.python/browse_frm/thread/785d100681f7d101/34703a66338abbd6>`_).
Thanks to Terry Reedy, Raymond Hettinger, and Francis Carr for their ideas.

Please find `bidict on bitbucket <http://bitbucket.org/jab/bidict>`_ if you
would like to collaborate.
"""

setup(
    name='bidict',
    version=version,
    author='Josh Bronson',
    author_email='jabronson@gmail.com',
    description="bidirectional (one-to-one) mapping data structure",
    long_description=long_description,
    keywords='mapping, bidirectional, bijection, injective, dict, dictionary',
    url='http://bitbucket.org/jab/bidict',
    license='MIT',
    py_modules=['bidict'],
    zip_safe=True,
    classifiers=[
        "Development Status :: 3 - Alpha",
        "License :: OSI Approved :: MIT License",
        ],
    )


text:
package br.com.uol.pagseguro.api.exception;

public class PagSeguroClientException {

}


text:
import Ember from 'ember';
import computedPolyfill from 'ember-new-computed';
import getOwner from 'ember-getowner-polyfill';

const {
  Component,
  computed,
  observer,
  run,
  get,
  isArray,
  isEmpty,
  isNone,
  typeOf,
  String: { camelize },
  assert
} = Ember;
const assign = Ember.assign || Ember.merge;

/**
 * Ember.Selectize is an Ember View that encapsulates a Selectize component.
 * The goal is to use this as a near dropin replacement for Ember.Select.
 */
export default Component.extend({
  attributeBindings: ['name', 'multiple', 'autocomplete', 'required', 'tabindex'],
  classNames: ['ember-selectize'],

  autocomplete: 'off',
  multiple: false,
  tabindex: 0,
  maxItems: computed('multiple', function() {
    return this.get('multiple') ? null : 1;
  }),

  // Allows to use prompt (like in Ember.Select) or placeholder property
  placeholder: computed.alias('prompt'),
  sortField: null,
  sortDirection: 'asc',
  tagName: 'select',

  /**
  * overrideable object paths for value and label paths
  */
  optionValuePath: 'content',
  optionLabelPath: 'content',
  optionGroupPath: 'content.group',

  selection: null,
  value: computedPolyfill('selection', {
    get() {
      var valuePath = this.get('_valuePath');
      var selection = this.get('selection');
      return valuePath && selection ? Ember.get(selection, valuePath) : selection;
    },
    set(key, value) {
      return value;
    }
  }),

  /*
   * Contains optgroups.
   */
  optgroups: computed('content.[]', 'groupedContent.[]', function() {
    var groupedContent = this.get('groupedContent');
    if (groupedContent) {
      return groupedContent.mapBy('label');
    } else {
      //compute option groups from content
      var content = this.get('content');
      if (!isArray(content)) { return; }

      return content.reduce((previousValue, item) => {
        return previousValue.addObject(get(item, this.get('_groupPath')));
      }, Ember.A());
    }
  }),
  /**
   * Computes content from grouped content.
   * If `content` is set, this computed property is overriden and never executed.
   */
  content: computed('groupedContent.[]', function() {
    var groupedContent = this.get('groupedContent');

    if (!groupedContent) { return; }

    //concatenate all content properties in each group
    return groupedContent.reduce((previousValue, group) => {
      var content = get(group, 'content') || Ember.A();
      var groupLabel = get(group, 'label');

      //create proxies for each object. Selectize requires the group value to be
      //set in the object. Use ObjectProxy to keep original object intact.
      var proxiedContent = content.map(item => {
        var proxy = { content: item };
        proxy[this.get('_groupPath')] = groupLabel;
        return Ember.ObjectProxy.create(proxy);
      });

      return previousValue.pushObjects(proxiedContent);
    }, Ember.A());
  }),

  _optgroupsDidChange: observer('optgroups.[]', function() {
    if (!this._selectize) {
      return;
    }
    //TODO right now we reset option groups.
    //Ideally we would set up an array observer and use selectize's [add|remove]OptionGroup
    this._selectize.clearOptionGroups();
    var optgroups = this.get('optgroups');
    if (!optgroups) { return; }

    optgroups.forEach(group => {
      this._selectize.addOptionGroup(group, { label: group, value: group});
    });
  }),

  /**
  * The array of the default plugins to load into selectize
  */
  plugins: ['remove_button'],

  /**
  * Computed properties that hold the processed paths ('content.' replacement),
  * as it is done on Ember.Select
  */
  _valuePath: computed('optionValuePath', function() {
    return this.get('optionValuePath').replace(/^content\.?/, '');
  }),

  _labelPath: computed('optionLabelPath', function() {
    return this.get('optionLabelPath').replace(/^content\.?/, '');
  }),
  _groupPath: computed('optionGroupPath', function() {
    return this.get('optionGroupPath').replace(/^content\.?/, '');
  }),

  getValueFor(item) {
    let valuePath = this.get('_valuePath');
    return isEmpty(valuePath) || isEmpty(item) ? item : get(item, valuePath);
  },

  getLabelFor(item) {
    let labelPath = this.get('_labelPath');
    return isEmpty(labelPath) || isEmpty(item) ? item : get(item, labelPath);
  },

  /**
  * Loading feature default values.
  * If you want to override the css class that is applied, change the `loadingClass` property.
  */
  loading: false,
  loadingClass: 'loading',

  /**
  * The render function names selectize expects.
  * We will use these to automatically infer the properties with the template and view names.
  */
  functionNames: ['option', 'item', 'option_create', 'optgroup_header', 'optgroup'],
  templateSuffix: 'Template',
  componentSuffix: 'Component',
  functionSuffix: 'Function',
  renderOptions: computed(function() {
    var functionNames = this.get('functionNames');
    //this hash will contain the render functions
    var renderFunctions = {};

    functionNames.forEach(item => {
      // infer the function name by camelizing selectize's function and appending the function suffix (overridable)
      var functionSuffix = this.get('functionSuffix');
      var functionPropertyName = camelize(item) + functionSuffix;
      var renderFunction = this.get(functionPropertyName);
      // functions take precedence
      if (renderFunction) {
        renderFunctions[item] = (data, escape) => {
          return renderFunction.call(this.get('targetObject') || this, data.data || data, escape);
        };
      } else {
        // infer the view name by camelizing selectize's function and appending a view suffix (overridable)
        var componentSuffix = this.get('componentSuffix');
        var componentPropertyName = camelize(item) + componentSuffix;
        var componentToRender = this.get(componentPropertyName);

        if (componentToRender) {
          // we have a view to render. set the function.
          renderFunctions[item] = data => {
            return this._componentToDOM(componentToRender, data.data || data);
          };
        }
      }
    });

    return renderFunctions;
  }),

  selectizeOptions: computed(function() {
    var allowCreate = this.get('create-item');
    var multiple = this.get('multiple');

    //Split the passed in plugin config into an array.
    if (typeof this.plugins === 'string') {
      this.plugins = this.plugins.trim().split(/[\s,]+/);
    }

    var plugins = this.plugins.slice(0);

    if (!multiple) {
      var index = plugins.indexOf('remove_button');
      plugins.splice(index, 1);
    }

    //Rebuild into object for plugin option support
    this.plugins.forEach(plugin => plugins[plugin] = {});

    if (plugins['clear_selection'] && this.get('clear-selection')) {
      plugins['clear_selection'].title = this.get('clear-selection');
    }

    var options = {
      plugins: plugins,
      labelField: 'label',
      valueField: 'value',
      searchField: 'label',
      optgroupField: 'optgroup',
      create: allowCreate ? run.bind(this, '_create') : false,
      onItemAdd: run.bind(this, '_onItemAdd'),
      onItemRemove: run.bind(this, '_onItemRemove'),
      onType: run.bind(this, '_onType'),
      render: this.get('renderOptions'),
      placeholder: this.get('placeholder'),
      score: this.get('score'),
      onBlur: this._registerAction('on-blur'),
      onFocus: this._registerAction('on-focus'),
      onInitialize: this._registerAction('on-init'),
      onClear: Ember.run.bind(this, '_onClear')
    };

    var generalOptions = ['delimiter', 'diacritics', 'createOnBlur',
                          'createFilter', 'highlight', 'persist', 'openOnFocus',
                          'maxOptions', 'maxItems', 'hideSelected',
                          'closeAfterSelect', 'allowEmptyOption',
                          'scrollDuration', 'loadThrottle', 'preload',
                          'dropdownParent', 'addPrecedence', 'selectOnTab',
                          'searchField'];

    generalOptions.forEach((option) => {
      options[option] = this.getWithDefault(option, options[option]);
    });

    options = this._mergeSortField(options);

    return options;
  }),

  didInsertElement() {
    // ensure selectize is loaded
    assert('selectize has to be loaded', typeof this.$().selectize === 'function');

    //Create Selectize's instance
    this.$().selectize(this.get('selectizeOptions'));

    //Save the created selectize instance
    this._selectize = this.$()[0].selectize;

    //Some changes to content, selection and disabled could have happened before the Component was inserted into the DOM.
    //We trigger all the observers manually to account for those changes.
    this._disabledDidChange();
    this._optgroupsDidChange();
    if(this.get('groupedContent')) {
      this._groupedContentDidChange();
    }
    this._contentDidChange();

    var selection = this.get('selection');
    var value = this.get('value');
    if (!isNone(selection)) { this._selectionDidChange(); }
    if (!isNone(value)) { this._valueDidChange(); }

    this._loadingDidChange();
  },

  willDestroyElement() {
    //Unbind observers
    this._contentWillChange(this.get('content'));
    this._selectionWillChange(this.get('selection'));
    this._groupedContentWillChange(this.get('groupedContent'));

    //Invoke Selectize's destroy
    this._selectize.destroy();

    //We are no longer in DOM
    this._selectize = null;
  },

  /**
  * Event callback that is triggered when user creates a tag
  */
  _create(input, callback) {
    // Delete user entered text
    this._selectize.setTextboxValue('');
    // Send create action

    // allow the observers and computed properties to run first
    run.schedule('actions', this, function() {
      this.sendAction('create-item', input);
    });
    // We cancel the creation here, so it's up to you to include the created element
    // in the content and selection property
    callback(null);
  },

  /**
  * Event callback for DOM events
  */
  _registerAction(action){
    return run.bind(this, function() {
      var args = Array.prototype.slice.call(arguments);
      args.unshift(action);
      this.sendAction.apply(this, args);
    });
  },

  /**
  * Event callback that is triggered when user types in the input element
  */
  _onType(str) {
    this.set('filter', str);
    run.schedule('actions', this, function() {
      this.sendAction('update-filter', str);
    });
  },

  /**
   +  * Event callback that is triggered when user clears selection
   +  */
  _onClear() {
    this.set('selection', null);

    Ember.run.schedule('actions', this, function() {
      this.sendAction('clear');
    });
  },

  /**
  * Event callback triggered when an item is added (when something is selected)
  * Here we need to update our selection property (if single selection) or array (if multiple selection)
  * We also send an action
  */
  _onItemAdd(value) {
    var content = this.get('content');
    var selection = this.get('selection');
    var multiple = this.get('multiple');
    if (content) {
      var obj = content.find(function(item) {
        return (this.getValueFor(item) + '') === value;
      }, this);
      if (multiple && isArray(selection) && obj) {
        let selected = selection.find((item) => {
          return isEmpty(this.get('_valuePath')) ? item === obj : this.getValueFor(obj) === this.getValueFor(item);
        });
        if (!selected) {
          this._addSelection(obj);
        }

      } else if (obj) {
        if (!selection || (this.getValueFor(obj) !== this.getValueFor(selection))) {
          this._updateSelection(obj);
        }
      }
    }
  },

  /**
  * Event callback triggered when an item is removed (when something is deselected)
  * Here we need to update our selection property (if single selection, here set to null) or remove item from array (if multiple selection)
  */
  _onItemRemove(value) {
    //in order to know if this event was triggered by observers or if it came from user interaction
    if (this._removing) { return; }

    var content = this.get('content');
    var selection = this.get('selection');
    var multiple = this.get('multiple');
    if (content) {
      var obj = content.find(function(item) {
        return this.getValueFor(item) + '' === value;
      }, this);
      if (multiple && isArray(selection) && obj) {
        this._removeSelection(obj);
      } else if (!multiple) {
        this._updateSelection(null);
      }
    }
  },

 /**
  * Update the selection value and send main actions
  * In addition to emitting the selection object, a selection value is sent via `select-value` based on `optionValuePath`
  */
  _updateSelection(selection) {
    this.set('selection', selection);

    // allow the observers and computed properties to run first
    run.schedule('actions', this, function() {
      var value = this.get('value');
      this.sendAction('select-item', selection, value);
      this.sendAction('select-value', value);
    });
  },

  _addSelection(obj) {
    let val = this.getValueFor(obj);

    this.get('selection').addObject(obj);

    run.schedule('actions', this, function() {
      this.sendAction('add-item', obj);
      this.sendAction('add-value', val);
    });
  },

  _removeSelection(obj) {
    let val = this.getValueFor(obj);

    this.get('selection').removeObject(obj);

    run.schedule('actions', this, function() {
      this.sendAction('remove-item', obj);
      this.sendAction('remove-value', val);
    });
  },

  /**
  * Ember observer triggered before the selection property is changed
  * We need to unbind any array observers if we're in multiple selection
  */
  _selectionWillChange(selection) {
    var multiple = this.get('multiple');
    if (selection && isArray(selection) && multiple) {
      selection.removeArrayObserver(this,  {
        willChange: 'selectionArrayWillChange',
        didChange: 'selectionArrayDidChange'
      });
      var len = selection ? get(selection, 'length') : 0;
      this.selectionArrayWillChange(selection, 0, len);
    }
  },
  /**
  * Ember observer triggered when the selection property is changed
  * We need to bind an array observer when selection is multiple
  */
  _selectionDidChange: observer('selection', function() {

    var selection = this.get('selection');
    if (this._oldSelection !== selection) {
      this._selectionWillChange(this._oldSelection);
      this._oldSelection = selection;
    }

    if (!this._selectize) { return; }

    var multiple = this.get('multiple');

    if (selection) {
      if (multiple) {
        assert('When ember-selectize is in multiple mode, the provided selection must be an array.', isArray(selection));
        //bind array observers to listen for selection changes
        selection.addArrayObserver(this, {
          willChange: 'selectionArrayWillChange',
          didChange: 'selectionArrayDidChange'
        });
        //Trigger a selection change that will update selectize with the new selection
        var len = selection ? get(selection, 'length') : 0;
        this.selectionArrayDidChange(selection, 0, null, len);
      } else {
        if (selection.then) {
          selection.then(resolved => {
            if (resolved) {
              // Ensure that we don't overwrite new value
              if (get(this, 'selection') === selection) {
                this._selectize.addItem(this.getValueFor(resolved));
              }
            } else {
              //selection was changed to a falsy value. Clear selectize.
              this._selectize.clear();
              this._selectize.showInput();
            }
          });
        } else {
          this._selectize.addItem(this.getValueFor(selection));
        }

      }

    } else {
      //selection was changed to a falsy value. Clear selectize.
      this._selectize.clear();
      this._selectize.showInput();
    }
  }),

  /**
   * It is possible to control the selected item through its value.
   */
  _valueDidChange: observer('value', function() {
    var content = this.get('content');
    var value = this.get('value');
    var selectedValue = this.getValueFor(this.get('selection'));
    var selection;

    if (value !== selectedValue) {
      selection = content ? content.find((obj) => {
        return value === this.getValueFor(obj);
      }) : null;

      this.set('selection', selection);
    }
  }),

  /*
  * Triggered before the selection array changes
  * Here we process the removed elements
  */
  selectionArrayWillChange(array, idx, removedCount) {
    this._removing = true;
    for (var i = idx; i < idx + removedCount; i++) {
      this.selectionObjectWasRemoved(array.objectAt(i));
    }
    this._removing = false;
  },

  /*
  * Triggered after the selection array changes
  * Here we process the inserted elements
  */
  selectionArrayDidChange(array, idx, removedCount, addedCount) {
    for (var i = idx; i < idx + addedCount; i++) {
      this.selectionObjectWasAdded(array.objectAt(i), i);
    }
  },

  /*
  * Function that is responsible for Selectize's item inserting logic
  */
  selectionObjectWasAdded(obj) {
    if (this._selectize) {
      this._selectize.addItem(this.getValueFor(obj));
    }
  },

  /*
  * Function that is responsible for Selectize's item removing logic
  */
  selectionObjectWasRemoved(obj) {
    if (this._selectize) {
      this._selectize.removeItem(this.getValueFor(obj));
    }
  },

  /**
  * Ember observer triggered before the content property is changed
  * We need to unbind any array observers
  */
  _contentWillChange(content) {
    if (!this._selectize) { return; }
    if (isArray(content)) {
      content.removeArrayObserver(this, {
        willChange: 'contentArrayWillChange',
        didChange: 'contentArrayDidChange'
      });
    }
    //Trigger remove logic
    var len = content ? get(content, 'length') : 0;
    this._removing = true;
    this.contentArrayWillChange(content, 0, len);
    this._removing = false;
  },

  /**
  * Ember observer triggered when the content property is changed
  * We need to bind an array observer to become notified of its changes
  */
  _contentDidChange: observer('content', function() {
    var content = this.get('content');
    if (this._oldContent !== content) {
      this._contentWillChange(this._oldContent);
      this._oldContent = content;
    }

    if (!this._selectize) { return; }

    if (isArray(content)) {
      content.addArrayObserver(this, {
        willChange: 'contentArrayWillChange',
        didChange: 'contentArrayDidChange'
      });
    } else if(content && content.then) {
      content.then(resolved => {
        // Ensure that we don't overwrite new value
        if (get(this, 'content') === content) {
          this.set('content', resolved);
        }
      });
    }
    var len = content ? get(content, 'length') : 0;
    this.contentArrayDidChange(content, 0, null, len);
  }),

  /*
  * Triggered before the content array changes
  * Here we process the removed elements
  */
  contentArrayWillChange(array, idx, removedCount) {
    for (var i = idx; i < idx + removedCount; i++) {
      this.objectWasRemoved(array.objectAt(i));
    }

    if (this._selectize) {
      this._selectize.refreshOptions(this._selectize.isFocused && !this._selectize.isInputHidden);
    }
  },

  /*
  * Triggered after the content array changes
  * Here we process the inserted elements
  */
  contentArrayDidChange(array, idx, removedCount, addedCount) {
    for (var i = idx; i < idx + addedCount; i++) {
      this.objectWasAdded(array.objectAt(i));
      this.addLabelObserver(array.objectAt(i));
    }

    if (this._selectize) {
      this._selectize.refreshOptions(this._selectize.isFocused && !this._selectize.isInputHidden);
    }

    this._selectionDidChange();
  },

  _groupedContentWillChange(groupedContent) {
    if (!this._selectize) { return; }
    if (isEmpty(groupedContent)) { return; }

    groupedContent.forEach(group => {
      group.get('content').removeArrayObserver(this, {
        willChange: '_groupedContentArrayWillChange',
        didChange: '_groupedContentArrayDidChange',
      });
    });
  },

  /**
  * Ember observer triggered when the groupedContent property is changed
  * We need to bind an array observer to become notified of each group's array changes,
  * then notify that the parent array has changed. This is because computed properties
  * have trouble with nested array changes.
  */
  _groupedContentDidChange: observer('groupedContent', function() {
    var groupedContent = this.get('groupedContent');
    if (this._oldGroupedContent !== groupedContent) {
      this._groupedContentWillChange(this._oldGroupedContent);
      this._oldGroupedContent = groupedContent;
    }

    if (!this._selectize) {
      return;
    }
    if (isEmpty(groupedContent)) { return; }

    //var willChangeWrapper = run.bind(this, function() { this.groupedContentArrayWillChange.apply(this, arguments); });
    //var didChangeWrapper = run.bind(this, function() { this.groupedContentArrayDidChange.apply(this, arguments); });

    groupedContent.forEach(group => {
      group.get('content').addArrayObserver(this, {
        willChange: '_groupedContentArrayWillChange',
        didChange: '_groupedContentArrayDidChange',
      });
    });
    var len = groupedContent ? get(groupedContent, 'length') : 0;
    this._groupedContentArrayDidChange(groupedContent, 0, null, len);
  }),

  /*
  * Triggered before the grouped content array changes
  * Here we process the removed elements
  */
  _groupedContentArrayWillChange: Ember.K,

  /*
  * Triggered after the grouped content array changes
  * Here we process the inserted elements
  */
  _groupedContentArrayDidChange() {
    this.notifyPropertyChange('groupedContent.[]');
  },

  /*
  * Function that is responsible for Selectize's option inserting logic
  * If the option is an object or Ember instance, we set an observer on the label value of it.
  * This way, we can later update the label of it.
  * Useful for dealing with objects that 'lazy load' some properties/relationships.
  */
  objectWasAdded(obj) {
    var data = {};
    var sortField = this.get('sortField');

    if (typeOf(obj) === 'object' || typeOf(obj) === 'instance') {
      data = {
        label: this.getLabelFor(obj),
        value: this.getValueFor(obj),
        data: obj
      };

      if (sortField) {
        if (isArray(sortField)) {
          sortField.forEach(function(field) {
            data[field.field] = get(obj, field.field);
          });
        } else {
          data[sortField] = get(obj, sortField);
        }
      }

      if (get(obj, this.get('_groupPath'))) {
        data.optgroup = get(obj, this.get('_groupPath'));
      }

    } else {
      data = {
        label: obj,
        value: obj,
        data: obj
      };

      if (sortField && !isArray(sortField)) {
        data[sortField] = obj;
      }
    }

    if (this._selectize && data.label) {
      this._selectize.addOption(data);
    }
  },

  addLabelObserver(obj) {
    //Only attach observer if the label is a property of an object
    if (typeOf(obj) === 'object' || typeOf(obj) === 'instance') {
      Ember.addObserver(obj, this.get('_labelPath'), this, '_labelDidChange');
    }
  },

  /*
  * Function that is responsible for Selectize's option removing logic
  */
  objectWasRemoved(obj) {
    if (typeOf(obj) === 'object' || typeOf(obj) === 'instance') {
      Ember.removeObserver(obj, this.get('_labelPath'), this, '_labelDidChange');
    }
    if (this._selectize) {
      this._selectize.removeOption(this.getValueFor(obj));
    }
  },

  /*
  * Ember Observer that triggers when an option's label changes.
  * Here we need to update its corresponding option with the new data
  */
  _labelDidChange(sender) {
    if (!this._selectize) { return; }
    var data = {
      label: this.getLabelFor(sender),
      value: this.getValueFor(sender),
      data: sender
    };

    if(this._selectize.getOption(data.value).length !== 0) {
      this._selectize.updateOption(data.value, data);
    } else {
      this.objectWasAdded(sender);
    }
  },

  /*
  * Observer on the disabled property that enables or disables selectize.
  */
  _disabledDidChange: observer('disabled', function() {
    if (!this._selectize) { return; }
    var disable = this.get('disabled');
    if (disable) {
      this._selectize.disable();
    } else {
      this._selectize.enable();
    }
  }),

  /*
  * Observer on the placeholder property that updates selectize's placeholder.
  */
  _placeholderDidChange: observer('placeholder', function() {
    if (!this._selectize) { return; }
    var placeholder = this.get('placeholder');
    this._selectize.settings.placeholder = placeholder;
    this._selectize.updatePlaceholder();
  }),

  /*
  * Observer on the loading property.
  * Here we add/remove a css class, similarly to how selectize does.
  */
  _loadingDidChange: observer('loading', function() {
    var loading = this.get('loading');
    var loadingClass = this.get('loadingClass');
    if (loading) {
      this._selectize.$wrapper.addClass(loadingClass);
    } else {
      this._selectize.$wrapper.removeClass(loadingClass);
    }
  }),

  _lookupComponent(name) {
    let owner = getOwner(this);
    let componentLookupKey = `component:${name}`;
    let layoutLookupKey = `template:components/${name}`;
    let layout = owner._lookupFactory(layoutLookupKey);
    let component = owner._lookupFactory(componentLookupKey);

    if (layout && !component) {
      owner.register(componentLookupKey, Component);
      component = owner._lookupFactory(componentLookupKey);
    }

    return { component, layout };
  },

  _componentToDOM(componentName, data) {
    let { component, layout } = this._lookupComponent(componentName);

    assert(`ember-selectize could not find a component named "${componentName}" in your Ember application.`, component);

    let attrs = { data };

    if (layout) {
      attrs.layout = layout;
    }

    let componentInstance = component.create(attrs);

    let container = document.createElement('div');
    componentInstance.appendTo(container);

    return container;
  },

  _mergeSortField(options) {
    var sortField = this.get('sortField');
    if (sortField) {
      var sortArray = this._getSortArray(sortField);
      assign(options, { sortField: sortArray });
    }
    return options;
  },

  _getSortArray(sortField) {
    if (isArray(sortField)) {
      return sortField;
    } else {
      return [{
        field: sortField,
        direction: this.get('sortDirection')
      }];
    }
  }
});


text:
namespace scm {
namespace gl {

class __scm_export(gl_core) occlusion_query : public query
{
public:
    virtual ~occlusion_query();

    scm::uint64     result() const;

protected:
    occlusion_query(render_device& in_device, const occlusion_query_mode in_oq_mode);

    void            collect(const render_context& in_context);

protected:
    scm::uint64     _result;

private:
    friend class render_device;
    friend class render_context;
}; // class query

} // namespace gl
} // namespace scm

#include <scm/core/utilities/platform_warning_enable.h>

#endif // SCM_GL_CORE_OCCLUSION_QUERY_H_INCLUDED