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

<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
Uses of Package org.optaplanner.core.impl.heuristic.selector.value (OptaPlanner distribution 6.2.0.Final API)
</TITLE>

<META NAME="date" CONTENT="2015-03-04">

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

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

OptaPlanner distribution 6.2.0.Final

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Uses of Package
org.optaplanner.core.impl.heuristic.selector.value

Packages that use org.optaplanner.core.impl.heuristic.selector.value

org.optaplanner.core.config.heuristic.selector.common.nearby

org.optaplanner.core.config.heuristic.selector.value

org.optaplanner.core.impl.heuristic.selector.common.iterator

org.optaplanner.core.impl.heuristic.selector.move.generic

org.optaplanner.core.impl.heuristic.selector.move.generic.chained

org.optaplanner.core.impl.heuristic.selector.value

org.optaplanner.core.impl.heuristic.selector.value.chained

org.optaplanner.core.impl.heuristic.selector.value.decorator

org.optaplanner.core.impl.heuristic.selector.value.nearby

Classes in org.optaplanner.core.impl.heuristic.selector.value used by org.optaplanner.core.config.heuristic.selector.common.nearby

ValueSelector

          Selects values from the ValueRangeProvider) for a {@link PlanningVariable} annotated property.

Classes in org.optaplanner.core.impl.heuristic.selector.value used by org.optaplanner.core.config.heuristic.selector.value

ValueSelector

          Selects values from the ValueRangeProvider) for a {@link PlanningVariable} annotated property.

Classes in org.optaplanner.core.impl.heuristic.selector.value used by org.optaplanner.core.impl.heuristic.selector.common.iterator

ValueSelector

          Selects values from the ValueRangeProvider) for a {@link PlanningVariable} annotated property.

Classes in org.optaplanner.core.impl.heuristic.selector.value used by org.optaplanner.core.impl.heuristic.selector.move.generic

ValueSelector

          Selects values from the ValueRangeProvider) for a {@link PlanningVariable} annotated property.

Classes in org.optaplanner.core.impl.heuristic.selector.value used by org.optaplanner.core.impl.heuristic.selector.move.generic.chained

EntityIndependentValueSelector

ValueSelector

          Selects values from the ValueRangeProvider) for a {@link PlanningVariable} annotated property.

Classes in org.optaplanner.core.impl.heuristic.selector.value used by org.optaplanner.core.impl.heuristic.selector.value

AbstractValueSelector

          Abstract superclass for ValueSelector.

EntityIndependentValueSelector

ValueSelector

          Selects values from the ValueRangeProvider) for a {@link PlanningVariable} annotated property.

Classes in org.optaplanner.core.impl.heuristic.selector.value used by org.optaplanner.core.impl.heuristic.selector.value.chained

EntityIndependentValueSelector

Classes in org.optaplanner.core.impl.heuristic.selector.value used by org.optaplanner.core.impl.heuristic.selector.value.decorator

AbstractValueSelector

          Abstract superclass for ValueSelector.

EntityIndependentValueSelector

ValueSelector

          Selects values from the ValueRangeProvider) for a {@link PlanningVariable} annotated property.

Classes in org.optaplanner.core.impl.heuristic.selector.value used by org.optaplanner.core.impl.heuristic.selector.value.nearby

AbstractValueSelector

          Abstract superclass for ValueSelector.

ValueSelector

          Selects values from the ValueRangeProvider) for a {@link PlanningVariable} annotated property.

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

OptaPlanner distribution 6.2.0.Final

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Copyright © 2006-2015 JBoss by Red Hat. All Rights Reserved.


text:
function Set-HostsEntry
{
    <#
    .SYNOPSIS
    Sets a hosts entry in a hosts file.

    .DESCRIPTION
    Sets the IP address for a given hostname.  If the hostname doesn't exist in the hosts file, appends a new entry to the end.  If the hostname does exist, its IP address gets updated.  If you supply a description, it is appended to the line as a comment.

    If any duplicate hosts entries are found, they are commented out; Windows uses the first duplicate entry.

    This function scans the entire hosts file.  If you have a large hosts file, and are updating multiple entries, this function will be slow.

    You can operate on a custom hosts file, too.  Pass its path with the `Path` parameter.

    Sometimes the system's hosts file is in use and locked when you try to update it. The `Set-HostsEntry` function tries 10 times to set a hosts entry before giving up and writing an error. It waits a random amount of time (from 0 to 1000 milliseconds) between each attempt.

    .EXAMPLE
    Set-HostsEntry -IPAddress 10.2.3.4 -HostName 'myserver' -Description "myserver's IP address"

    If your hosts file contains the following:

        127.0.0.1  localhost

    After running this command, it will contain the following:

        127.0.0.1        localhost
        10.2.3.4         myserver	# myserver's IP address

    .EXAMPLE
    Set-HostsEntry -IPAddress 10.5.6.7 -HostName 'myserver'

    If your hosts file contains the following:

        127.0.0.1        localhost
        10.2.3.4         myserver	# myserver's IP address

    After running this command, it will contain the following:

        127.0.0.1        localhost
        10.5.6.7         myserver

    #>
    [CmdletBinding(SupportsShouldProcess=$true)]
    param(
        [Parameter(Mandatory=$true)]
        [Net.IPAddress]
        # The IP address for the hosts entry.
        $IPAddress,

        [Parameter(Mandatory=$true)]
        [string]
        # The hostname for the hosts entry.
        $HostName,

        [string]
        # An optional description of the hosts entry.
        $Description,

        [string]
        # The path to the hosts file where the entry should be set. Defaults to the local computer's hosts file.
        $Path = (Get-PathToHostsFile)
    )

    Set-StrictMode -Version 'Latest'

    Use-CallerPreference -Cmdlet $PSCmdlet -Session $ExecutionContext.SessionState

    $matchPattern = '^(?<IP>[0-9a-f.:]+)\s+(?<HostName>[^\s#]+)(?<Tail>.*)$'
    $lineFormat = "{0,-16}{1}{2}"

    if(-not (Test-Path $Path))
    {
        Write-Warning "Creating hosts file at: $Path"
        New-Item $Path -ItemType File
    }

    [string[]]$lines = Read-File -Path $Path -ErrorVariable 'cmdErrors'
    if( $cmdErrors )
    {
        return
    }

    $outLines = New-Object 'Collections.ArrayList'
    $found = $false
    $lineNum = 0
    $updateHostsFile = $false

    foreach($line in $lines)
    {
        $lineNum += 1

        if($line.Trim().StartsWith("#") -or ($line.Trim() -eq '') )
        {
            [void] $outlines.Add($line)
        }
        elseif($line -match $matchPattern)
        {
            $ip = $matches["IP"]
            $hn = $matches["HostName"]
            $tail = $matches["Tail"].Trim()
            if( $HostName -eq $hn )
            {
                if($found)
                {
                    #this is a duplicate so, let's comment it out
                    [void] $outlines.Add("#$line")
                    $updateHostsFile = $true
                    continue
                }
                $ip = $IPAddress
                $tail = if( $Description ) { "`t# $Description" } else { '' }
                $found = $true
            }
            else
            {
                $tail = "`t{0}" -f $tail
            }

            if( $tail.Trim() -eq "#" )
            {
                $tail = ""
            }

            $outline = $lineformat -f $ip, $hn, $tail
            $outline = $outline.Trim()
            if( $outline -ne $line )
            {
                $updateHostsFile = $true
            }

            [void] $outlines.Add($outline)

        }
        else
        {
            Write-Warning ("Hosts file {0}: line {1}: invalid entry: {2}" -f $Path,$lineNum,$line)
            $outlines.Add( ('# {0}' -f $line) )
        }

    }

    if(-not $found)
    {
       #add a new entry
       $tail = "`t# $Description"
       if($tail.Trim() -eq "#")
       {
           $tail = ""
       }

       $outline = $lineformat -f $IPAddress, $HostName, $tail
       $outline = $outline.Trim()
       [void] $outlines.Add($outline)
       $updateHostsFile = $true
    }

    if( -not $updateHostsFile )
    {
        return
    }

    Write-Verbose -Message ('[HOSTS]  [{0}]  {1,-15}  {2}' -f $Path,$IPAddress,$HostName)
    $outLines | Write-File -Path $Path
}

redpajama_set_name: RedPajamaGithub


text:
"""SmartTub integration."""
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant

from .const import DOMAIN, SMARTTUB_CONTROLLER
from .controller import SmartTubController

PLATFORMS = [
    Platform.BINARY_SENSOR,
    Platform.CLIMATE,
    Platform.LIGHT,
    Platform.SENSOR,
    Platform.SWITCH,
]

async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
    """Set up a smarttub config entry."""

    controller = SmartTubController(hass)
    hass.data.setdefault(DOMAIN, {})
    hass.data[DOMAIN][entry.entry_id] = {
        SMARTTUB_CONTROLLER: controller,
    }

    if not await controller.async_setup_entry(entry):
        return False

    await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)

    return True

async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
    """Remove a smarttub config entry."""
    unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
    if unload_ok:
        hass.data[DOMAIN].pop(entry.entry_id)
    return unload_ok


text:
import sys
import unittest
import httplib

try:
    import simplejson as json
except ImportError:
    import json

from libcloud.common.types import InvalidCredsError
from libcloud.compute.drivers.dreamhost import DreamhostNodeDriver
from libcloud.compute.types import NodeState

from test import MockHttp
from test.compute import TestCaseMixin
from test.secrets import DREAMHOST_PARAMS

class DreamhostTest(unittest.TestCase, TestCaseMixin):

    def setUp(self):
        DreamhostNodeDriver.connectionCls.conn_classes = (
            None,
            DreamhostMockHttp
        )
        DreamhostMockHttp.type = None
        DreamhostMockHttp.use_param = 'cmd'
        self.driver = DreamhostNodeDriver(*DREAMHOST_PARAMS)

    def test_invalid_creds(self):
        """
        Tests the error-handling for passing a bad API Key to the DreamHost API
        """
        DreamhostMockHttp.type = 'BAD_AUTH'
        try:
            self.driver.list_nodes()
            self.assertTrue(False) # Above command should have thrown an InvalidCredsException
        except InvalidCredsError:
            self.assertTrue(True)

    def test_list_nodes(self):
        """
        Test list_nodes for DreamHost PS driver.  Should return a list of two nodes:
            -   account_id: 000000
                ip: 75.119.203.51
                memory_mb: 500
                ps: ps22174
                start_date: 2010-02-25
                type: web
            -   account_id: 000000
                ip: 75.119.203.52
                memory_mb: 1500
                ps: ps22175
                start_date: 2010-02-25
                type: mysql
        """

        nodes = self.driver.list_nodes()
        self.assertEqual(len(nodes), 2)
        web_node = nodes[0]
        mysql_node = nodes[1]

        # Web node tests
        self.assertEqual(web_node.id, 'ps22174')
        self.assertEqual(web_node.state, NodeState.UNKNOWN)
        self.assertTrue('75.119.203.51' in web_node.public_ips)
        self.assertTrue(
            web_node.extra.has_key('current_size') and
            web_node.extra['current_size'] == 500
        )
        self.assertTrue(
            web_node.extra.has_key('account_id') and
            web_node.extra['account_id'] == 000000
        )
        self.assertTrue(
            web_node.extra.has_key('type') and
            web_node.extra['type'] == 'web'
        )
        # MySql node tests
        self.assertEqual(mysql_node.id, 'ps22175')
        self.assertEqual(mysql_node.state, NodeState.UNKNOWN)
        self.assertTrue('75.119.203.52' in mysql_node.public_ips)
        self.assertTrue(
            mysql_node.extra.has_key('current_size') and
            mysql_node.extra['current_size'] == 1500
        )
        self.assertTrue(
            mysql_node.extra.has_key('account_id') and
            mysql_node.extra['account_id'] == 000000
        )
        self.assertTrue(
            mysql_node.extra.has_key('type') and
            mysql_node.extra['type'] == 'mysql'
        )

    def test_create_node(self):
        """
        Test create_node for DreamHost PS driver.
        This is not remarkably compatible with libcloud.  The DH API allows
        users to specify what image they want to create and whether to move
        all their data to the (web) PS. It does NOT accept a name, size, or
        location.  The only information it returns is the PS's context id
        Once the PS is ready it will appear in the list generated by list_ps.
        """
        new_node = self.driver.create_node(
            image=self.driver.list_images()[0],
            size=self.driver.list_sizes()[0],
            movedata='no',
        )
        self.assertEqual(new_node.id, 'ps12345')
        self.assertEqual(new_node.state, NodeState.PENDING)
        self.assertTrue(
            new_node.extra.has_key('type') and
            new_node.extra['type'] == 'web'
        )

    def test_destroy_node(self):
        """
        Test destroy_node for DreamHost PS driver
        """
        node = self.driver.list_nodes()[0]
        self.assertTrue(self.driver.destroy_node(node))

    def test_destroy_node_failure(self):
        """
        Test destroy_node failure for DreamHost PS driver
        """
        node = self.driver.list_nodes()[0]

        DreamhostMockHttp.type = 'API_FAILURE'
        self.assertFalse(self.driver.destroy_node(node))

    def test_reboot_node(self):
        """
        Test reboot_node for DreamHost PS driver.
        """
        node = self.driver.list_nodes()[0]
        self.assertTrue(self.driver.reboot_node(node))

    def test_reboot_node_failure(self):
        """
        Test reboot_node failure for DreamHost PS driver
        """
        node = self.driver.list_nodes()[0]

        DreamhostMockHttp.type = 'API_FAILURE'
        self.assertFalse(self.driver.reboot_node(node))

    def test_resize_node(self):
        """
        Test resize_node for DreamHost PS driver
        """
        node = self.driver.list_nodes()[0]
        self.assertTrue(self.driver._resize_node(node, 400))

    def test_resize_node_failure(self):
        """
        Test reboot_node faliure for DreamHost PS driver
        """
        node = self.driver.list_nodes()[0]

        DreamhostMockHttp.type = 'API_FAILURE'
        self.assertFalse(self.driver._resize_node(node, 400))

    def test_list_images(self):
        """
        Test list_images for DreamHost PS driver.
        """
        images = self.driver.list_images()
        self.assertEqual(len(images), 2)
        self.assertEqual(images[0].id, 'web')
        self.assertEqual(images[0].name, 'web')
        self.assertEqual(images[1].id, 'mysql')
        self.assertEqual(images[1].name, 'mysql')

    def test_list_sizes(self):
        sizes = self.driver.list_sizes()
        self.assertEqual(len(sizes), 5)

        self.assertEqual(sizes[0].id, 'default')
        self.assertEqual(sizes[0].bandwidth, None)
        self.assertEqual(sizes[0].disk, None)
        self.assertEqual(sizes[0].ram, 2300)
        self.assertEqual(sizes[0].price, 115)

    def test_list_locations(self):
        try:
            self.driver.list_locations()
        except NotImplementedError:
            pass

    def test_list_locations_response(self):
        self.assertRaises(NotImplementedError, self.driver.list_locations)

class DreamhostMockHttp(MockHttp):

    def _BAD_AUTH_dreamhost_ps_list_ps(self, method, url, body, headers):
        body = json.dumps({'data' : 'invalid_api_key', 'result' : 'error'})
        return (httplib.OK, body, {}, httplib.responses[httplib.OK])

    def _dreamhost_ps_add_ps(self, method, url, body, headers):
        body = json.dumps({'data' : {'added_web' : 'ps12345'}, 'result' : 'success'})
        return (httplib.OK, body, {}, httplib.responses[httplib.OK])

    def _dreamhost_ps_list_ps(self, method, url, body, headers):
        data = [{
            'account_id' : 000000,
            'ip': '75.119.203.51',
            'memory_mb' : 500,
            'ps' : 'ps22174',
            'start_date' : '2010-02-25',
            'type' : 'web'
        },
        {
            'account_id' : 000000,
            'ip' : '75.119.203.52',
            'memory_mb' : 1500,
            'ps' : 'ps22175',
            'start_date' : '2010-02-25',
            'type' : 'mysql'
        }]
        result = 'success'
        body = json.dumps({'data' : data, 'result' : result})
        return (httplib.OK, body, {}, httplib.responses[httplib.OK])

    def _dreamhost_ps_list_images(self, method, url, body, headers):
        data = [{
            'description' : 'Private web server',
            'image' : 'web'
        },
        {
            'description' : 'Private MySQL server',
            'image' : 'mysql'
        }]
        result = 'success'
        body = json.dumps({'data' : data, 'result' : result})
        return (httplib.OK, body, {}, httplib.responses[httplib.OK])

    def _dreamhost_ps_reboot(self, method, url, body, headers):
        body = json.dumps({'data' : 'reboot_scheduled', 'result' : 'success'})
        return (httplib.OK, body, {}, httplib.responses[httplib.OK])

    def _API_FAILURE_dreamhost_ps_reboot(self, method, url, body, headers):
        body = json.dumps({'data' : 'no_such_ps', 'result' : 'error'})
        return (httplib.OK, body, {}, httplib.responses[httplib.OK])

    def _dreamhost_ps_set_size(self, method, url, body, headers):
        body = json.dumps({'data' : {'memory-mb' : '500'}, 'result' : 'success'})
        return (httplib.OK, body, {}, httplib.responses[httplib.OK])

    def _API_FAILURE_dreamhost_ps_set_size(self, method, url, body, headers):
        body = json.dumps({'data' : 'internal_error_setting_size', 'result' : 'error'})
        return (httplib.OK, body, {}, httplib.responses[httplib.OK])

    def _dreamhost_ps_remove_ps(self, method, url, body, headers):
        body = json.dumps({'data' : 'removed_web', 'result' : 'success'})
        return (httplib.OK, body, {}, httplib.responses[httplib.OK])

    def _API_FAILURE_dreamhost_ps_remove_ps(self, method, url, body, headers):
        body = json.dumps({'data' : 'no_such_ps', 'result' : 'error'})
        return (httplib.OK, body, {}, httplib.responses[httplib.OK])

if __name__ == '__main__':
    sys.exit(unittest.main())


text:
VALUE rb_cSprite = Qnil;

/// @group Spritesheets

/// @method .load(file_name)
/// Loads all sprites from the content of +file_name+, which should be
/// the name of a property list spritesheet file in the application's resource
/// directory. Once a spritesheet file is loaded, individual sprites can be
/// created using {Sprite#initialize} by providing the name of the frame.
/// Sprite frames files can be created with a visual editor such as
/// TexturePacker.
/// @param file_name [String] the name of the sprite frames property list file.
/// @return [nil]

static VALUE
sprite_load(VALUE rcv, SEL sel, VALUE plist_path)
{
    cocos2d::SpriteFrameCache::getInstance()->addSpriteFramesWithFile(
	    RSTRING_PTR(StringValue(plist_path)));
    return Qnil;
}

/// @group Constructors

/// @method #initialize(sprite_name)
/// Creates a new sprite object from +sprite_name+, which must be either the
/// name of a standalone image file in the application's resource directory
/// or the name of a sprite frame which was loaded from a spritesheet using
/// {load}.
/// @param sprite_name [String] the name of the sprite to create.

static VALUE
sprite_new(VALUE rcv, SEL sel, VALUE name)
{
    std::string name_str = RSTRING_PTR(StringValue(name));
    cocos2d::Sprite *sprite = NULL;

    // Are we trying to retrieve a sprite frame?
    cocos2d::SpriteFrame *sprite_frame =
	cocos2d::SpriteFrameCache::getInstance()->getSpriteFrameByName(
		name_str);
    if (sprite_frame != NULL) {
	sprite = cocos2d::Sprite::createWithSpriteFrame(sprite_frame);
    }
    else {
	// A regular sprite file.
	sprite = cocos2d::Sprite::create(name_str);
    }
    if (sprite == NULL) {
	rb_raise(rb_eRuntimeError, "Can't create Sprite with `%s'. " \
		"Need a proper sprite name or calling Sprite.load() for sprite frame.", name_str.c_str());
    }
    return rb_cocos2d_object_new(sprite, rcv);
}

/// @group Actions

static VALUE
run_action(VALUE rcv, cocos2d::FiniteTimeAction *action)
{
    VALUE block = rb_current_block();
    if (block != Qnil) {
	block = rb_retain(block); // FIXME need release...
	auto call_funcn =
	    cocos2d::CallFuncN::create([block](cocos2d::Node *node) {
		rb_block_call(block, 0, NULL);
	    });
	action = cocos2d::Sequence::create(action, call_funcn, (void *)0);
    }
    SPRITE(rcv)->runAction(action);
    return rcv;
}

/// @method #move_by(delta_location, interval)
/// Moves the position of the receiver to a new location determined by the
/// sum of the current location and the given +delta_location+ object.
/// @param delta_location [Point] a point that will be added to the receiver's
///   current location.
/// @param interval [Float] the animation interval.
/// @return [self] the receiver.
/// @yield if passed a block, the block will be called for the action.

static VALUE
sprite_move_by(VALUE rcv, SEL sel, VALUE delta_location, VALUE interval)
{
    return run_action(rcv, cocos2d::MoveBy::create(NUM2DBL(interval),
		    rb_any_to_ccvec2(delta_location)));
}

/// @method #move_to(location, interval)
/// Moves the position of the receiver to a new given location.
/// @param location [Point] where the receiver should be moved to.
/// @param interval [Float] the animation interval.
/// @return [self] the receiver.
/// @yield if passed a block, the block will be called for the action.

static VALUE
sprite_move_to(VALUE rcv, SEL sel, VALUE location, VALUE interval)
{
    return run_action(rcv, cocos2d::MoveTo::create(NUM2DBL(interval),
		    rb_any_to_ccvec2(location)));
}

/// @method #rotate_by(delta_angle, interval)
/// Rotates the position of the receiver to a new angle determined by the
/// sum of the current rotation and the given +delta_angle+ object.
/// @param delta_angle [Float] the angle to add to the current rotation
/// @param interval [Float] the animation interval.
/// @return [self] the receiver.
/// @yield if passed a block, the block will be called for the action.

static VALUE
sprite_rotate_by(VALUE rcv, SEL sel, VALUE delta_angle, VALUE interval)
{
    return run_action(rcv, cocos2d::RotateBy::create(NUM2DBL(interval),
		    NUM2DBL(delta_angle)));
}

/// @method #rotate_to(angle, interval)
/// Rotates the angle of the receiver to a new angle certain angle
/// by modifying it's rotation attribute.
/// @param angle [Float] the receiver should be rotated to.
/// @param interval [Float] the animation interval.
/// @return [self] the receiver.
/// @yield if passed a block, the block will be called for the action.

static VALUE
sprite_rotate_to(VALUE rcv, SEL sel, VALUE angle, VALUE interval)
{
    return run_action(rcv, cocos2d::RotateTo::create(NUM2DBL(interval),
		    NUM2DBL(angle)));
}

/// @method #blink(number_of_blinks, interval)
/// Blinks the receiver.
/// @param number_of_blinks [Integer] the number of times the receiver should
///   blink.
/// @param interval [Float] the animation interval.
/// @return [self] the receiver.
/// @yield if passed a block, the block will be called for the action.

static VALUE
sprite_blink(VALUE rcv, SEL sel, VALUE blinks, VALUE interval)
{
    return run_action(rcv, cocos2d::Blink::create(NUM2DBL(interval),
		    NUM2INT(blinks)));
}

/// @method #animate(frame_names, delay, loops=1)
/// Starts an animation where the sprite display frame will be changed to
/// the given frames in +sprite_frames_names+ based on the given +delay+ and
/// repeated +loops+ times.
/// @param frame_names [Array<String>] an array of sprite frames to load and
///   use for the animation, which can be either the names of standalone image
///   files in the application's resource directory or the names of sprite
///   frames loaded from a spritesheet using {load}.
/// @param delay [Float] the delay in seconds between each frame animation.
/// @param loops [Integer] the number of times the animation should loop.
///   If {Repeat::FOREVER} (or negative value directly) was given, the animation will loop forever.
/// @return [self] the receiver.
/// @yield if passed a block, the block will be called for the action.

static VALUE
sprite_animate(VALUE rcv, SEL sel, int argc, VALUE *argv)
{
    VALUE frame_names = Qnil, delay = Qnil, loops = Qnil;

    rb_scan_args(argc, argv, "21", &frame_names, &delay, &loops);

    cocos2d::Vector<cocos2d::SpriteFrame *> frames;
    auto texture_cache = cocos2d::Director::getInstance()->getTextureCache();
    for (int i = 0, count = RARRAY_LEN(frame_names); i < count; i++) {
	VALUE name = RARRAY_AT(frame_names, i);
	std::string frame_name = RSTRING_PTR(StringValue(name));
	auto texture = texture_cache->addImage(frame_name);
	cocos2d::SpriteFrame *frame = NULL;
	if (texture != NULL) {
	    cocos2d::Rect rect = cocos2d::Rect::ZERO;
	    rect.size = texture->getContentSize();
	    frame = cocos2d::SpriteFrame::createWithTexture(texture, rect);
	}
	else {
	    frame = cocos2d::SpriteFrameCache::getInstance()->getSpriteFrameByName(frame_name);
	}
	if (frame == NULL) {
	    rb_raise(rb_eRuntimeError, "Failed to create sprite frame.");
	}
	frames.pushBack(frame);
    }

    int loops_i = 1;
    if (loops != Qnil) {
	loops_i = NUM2LONG(loops);
    }

    auto animation = cocos2d::Animation::createWithSpriteFrames(frames,
	    NUM2DBL(delay), loops_i);
    cocos2d::ActionInterval *action = cocos2d::Animate::create(animation);
    if (loops_i < 0) {
	action = cocos2d::RepeatForever::create(action);
    }
    return run_action(rcv, action);
}

/// @method #flipped_horizontally=(value)
/// Sets whether the sprite should be flipped horizontally or not. It only flips
/// the texture of the sprite, and not the texture of the sprite's children.
/// Also, flipping the texture doesn't alter the anchorPoint.
/// @param value [Boolean] true if the sprite should be flipped horizontally, false otherwise.

/// @method #flipped_x=(value)
/// This is alias method of {#flipped_horizontally=}.

static VALUE
sprite_flipped_horizontally_set(VALUE rcv, SEL sel, VALUE arg)
{
    SPRITE(rcv)->setFlippedX(RTEST(arg));
    return arg;
}

/// @method #flipped_vertically=(value)
/// Sets whether the sprite should be flipped vertically or not. It only flips
/// the texture of the sprite, and not the texture of the sprite's children.
/// Also, flipping the texture doesn't alter the anchorPoint.
/// @param value [Boolean] true if the sprite should be flipped vertically, false otherwise.

/// @method #flipped_y=(value)
/// This is alias method of {#flipped_vertically=}.

static VALUE
sprite_flipped_vertically_set(VALUE rcv, SEL sel, VALUE arg)
{
    SPRITE(rcv)->setFlippedY(RTEST(arg));
    return arg;
}

/// @group Physics

static cocos2d::PhysicsBody *
need_physics(VALUE rcv)
{
    auto physics = SPRITE(rcv)->getPhysicsBody();
    if (physics == NULL) {
	rb_raise(rb_eRuntimeError, "receiver does not have a physics body");
    }
    return physics;
}

/// @method #attach_physics_box(size=nil)
/// Attaches a physics body with a box shape to the sprite.
/// @param size [Size] the size of the box. If +nil+ is given, the size of the
///   sprite, retrieved with {#size}, will be used instead.
/// @return [self] the receiver.

static VALUE
sprite_attach_physics_box(VALUE rcv, SEL sel, int argc, VALUE *argv)
{
    VALUE size = Qnil;
    rb_scan_args(argc, argv, "01", &size);

    auto sprite = SPRITE(rcv);
    auto ccsize = sprite->getContentSize();
    if (size != Qnil) {
	ccsize = rb_any_to_ccsize(size);
    }
    auto physics = cocos2d::PhysicsBody::createBox(ccsize);
    SPRITE(rcv)->setPhysicsBody(physics);
    return rcv;
}

/// @method #apply_impulse(force)
/// Applies a continuous force to the sprite body.
/// @param force [Point] the force to apply.
/// @return [self] the receiver.

static VALUE
sprite_apply_impulse(VALUE rcv, SEL sel, VALUE force)
{
    need_physics(rcv)->applyImpulse(rb_any_to_ccvec2(force));
    return rcv;
}

/// @method #apply_force(force)
/// Applies an immediate force to the sprite body.
/// @param force [Point] the force to apply.
/// @return [self] the receiver.

static VALUE
sprite_apply_force(VALUE rcv, SEL sel, VALUE force)
{
    need_physics(rcv)->applyForce(rb_any_to_ccvec2(force));
    return rcv;
}

/// @endgroup

/// @property #mass
/// @return [Float] the body mass of the sprite.

static VALUE
sprite_mass(VALUE rcv, SEL sel)
{
    return DBL2NUM(need_physics(rcv)->getMass());
}

static VALUE
sprite_mass_set(VALUE rcv, SEL sel, VALUE arg)
{
    need_physics(rcv)->setMass(NUM2DBL(arg));
    return arg;
}

/// @method #gravitates?
/// @return [Boolean] whether the sprite should be affected by the scene's
///   gravitational force. The default is +true+.

static VALUE
sprite_gravitates(VALUE rcv, SEL sel)
{
    return need_physics(rcv)->isGravityEnabled() ? Qtrue : Qfalse;
}

/// @method #gravitates=(value)
/// Set the body is affected by the physics world's gravitational force or not.
/// @param value[Boolean] true if enable gravitational force.

static VALUE
sprite_gravitates_set(VALUE rcv, SEL sel, VALUE arg)
{
    need_physics(rcv)->setGravityEnable(RTEST(arg));
    return arg;
}

/// @method #dynamic?
/// @return [Boolean] whether the sprite body should be dynamic or not in the
///   physics world. The default is +true+, and a dynamic body will affect
///   with gravity.

static VALUE
sprite_dynamic(VALUE rcv, SEL sel)
{
    return need_physics(rcv)->isDynamic() ? Qtrue : Qfalse;
}

/// @method #dynamic=(value)
/// Set dynamic to body.
/// @param value [Boolean] true if the sprite body should be dynamic.

static VALUE
sprite_dynamic_set(VALUE rcv, SEL sel, VALUE arg)
{
    need_physics(rcv)->setDynamic(RTEST(arg));
    return arg;
}

/// @property #friction
/// @return [Float] the linear damping / air friction force on the sprite body.

static VALUE
sprite_friction(VALUE rcv, SEL sel)
{
    return DBL2NUM(need_physics(rcv)->getLinearDamping());
}

static VALUE
sprite_friction_set(VALUE rcv, SEL sel, VALUE arg)
{
    need_physics(rcv)->setLinearDamping(NUM2DBL(arg));
    return arg;
}

/// @property #velocity
/// @return [Point] the velocity force on the sprite body.

static VALUE
sprite_velocity(VALUE rcv, SEL sel)
{
    return rb_ccvec2_to_obj(need_physics(rcv)->getVelocity());
}

static VALUE
sprite_velocity_set(VALUE rcv, SEL sel, VALUE arg)
{
    need_physics(rcv)->setVelocity(rb_any_to_ccvec2(arg));
    return arg;
}

/// @method #resting?
/// @return [Boolean] whether the body is at rest.

static VALUE
sprite_resting(VALUE rcv, SEL sel)
{
    return need_physics(rcv)->isResting() ? Qtrue : Qfalse;
}

/// @method #resting=(value)
/// Set body to rest
/// @param value [Boolean] true if rest the body.

static VALUE
sprite_resting_set(VALUE rcv, SEL sel, VALUE arg)
{
    need_physics(rcv)->setResting(RTEST(arg));
    return arg;
}

/// @property #inertia_moment
/// @return [Float] the moment of inertia of the body.

static VALUE
sprite_inertia_moment(VALUE rcv, SEL sel)
{
    return DBL2NUM(need_physics(rcv)->getMoment());
}

static VALUE
sprite_inertia_moment_set(VALUE rcv, SEL sel, VALUE arg)
{
    need_physics(rcv)->setMoment(NUM2DBL(arg));
    return arg;
}

/// @property #category_mask
/// @return [Integer] physics category mask.

static VALUE
sprite_category_mask(VALUE rcv, SEL sel)
{
    return LONG2NUM(need_physics(rcv)->getCategoryBitmask());
}

static VALUE
sprite_category_mask_set(VALUE rcv, SEL sel, VALUE arg)
{
    need_physics(rcv)->setCategoryBitmask(NUM2LONG(arg));
    return arg;
}

/// @property #contact_mask
/// @return [Integer] physics contact test mask.

static VALUE
sprite_contact_mask(VALUE rcv, SEL sel)
{
    return LONG2NUM(need_physics(rcv)->getContactTestBitmask());
}

static VALUE
sprite_contact_mask_set(VALUE rcv, SEL sel, VALUE arg)
{
    need_physics(rcv)->setContactTestBitmask(NUM2LONG(arg));
    return arg;
}

/// @property #collision_mask
/// @return [Integer] physics collision mask.

static VALUE
sprite_collision_mask(VALUE rcv, SEL sel)
{
    return LONG2NUM(need_physics(rcv)->getCollisionBitmask());
}

static VALUE
sprite_collision_mask_set(VALUE rcv, SEL sel, VALUE arg)
{
    need_physics(rcv)->setCollisionBitmask(NUM2LONG(arg));
    return arg;
}

extern "C"
void
Init_Sprite(void)
{
    rb_cSprite = rb_define_class_under(rb_mMC, "Sprite", rb_cNode);
    // rb_register_cocos2d_object_finalizer(rb_cSprite); removed because rb_cSprite inherits rb_cNode and it already has finalizer.

    rb_define_singleton_method(rb_cSprite, "load", sprite_load, 1);
    rb_define_constructor(rb_cSprite, sprite_new, 1);
    rb_define_method(rb_cSprite, "move_by", sprite_move_by, 2);
    rb_define_method(rb_cSprite, "move_to", sprite_move_to, 2);
    rb_define_method(rb_cSprite, "rotate_by", sprite_rotate_by, 2);
    rb_define_method(rb_cSprite, "rotate_to", sprite_rotate_to, 2);
    rb_define_method(rb_cSprite, "blink", sprite_blink, 2);
    rb_define_method(rb_cSprite, "animate", sprite_animate, -1);
    rb_define_method(rb_cSprite, "flipped_horizontally=", sprite_flipped_horizontally_set, 1);
    rb_define_method(rb_cSprite, "flipped_x=", sprite_flipped_horizontally_set, 1);
    rb_define_method(rb_cSprite, "flipped_vertically=", sprite_flipped_vertically_set, 1);
    rb_define_method(rb_cSprite, "flipped_y=", sprite_flipped_vertically_set, 1);
    rb_define_method(rb_cSprite, "attach_physics_box", sprite_attach_physics_box, -1);
    rb_define_method(rb_cSprite, "apply_impulse", sprite_apply_impulse, 1);
    rb_define_method(rb_cSprite, "apply_force", sprite_apply_force, 1);
    rb_define_method(rb_cSprite, "mass", sprite_mass, 0);
    rb_define_method(rb_cSprite, "mass=", sprite_mass_set, 1);
    rb_define_method(rb_cSprite, "gravitates?", sprite_gravitates, 0);
    rb_define_method(rb_cSprite, "gravitates=", sprite_gravitates_set, 1);
    rb_define_method(rb_cSprite, "dynamic?", sprite_dynamic, 0);
    rb_define_method(rb_cSprite, "dynamic=", sprite_dynamic_set, 1);
    rb_define_method(rb_cSprite, "friction", sprite_friction, 0);
    rb_define_method(rb_cSprite, "friction=", sprite_friction_set, 1);
    rb_define_method(rb_cSprite, "velocity", sprite_velocity, 0);
    rb_define_method(rb_cSprite, "velocity=", sprite_velocity_set, 1);
    rb_define_method(rb_cSprite, "resting?", sprite_resting, 0);
    rb_define_method(rb_cSprite, "resting=", sprite_resting_set, 1);
    rb_define_method(rb_cSprite, "inertia_moment", sprite_inertia_moment, 0);
    rb_define_method(rb_cSprite, "inertia_moment=", sprite_inertia_moment_set, 1);
    rb_define_method(rb_cSprite, "category_mask", sprite_category_mask, 0);
    rb_define_method(rb_cSprite, "category_mask=", sprite_category_mask_set, 1);
    rb_define_method(rb_cSprite, "collision_mask", sprite_collision_mask, 0);
    rb_define_method(rb_cSprite, "collision_mask=", sprite_collision_mask_set, 1);
    rb_define_method(rb_cSprite, "contact_mask", sprite_contact_mask, 0);
    rb_define_method(rb_cSprite, "contact_mask=", sprite_contact_mask_set, 1);
}


text:
package rest;

import entity.Flight;

import java.util.List;
import javax.inject.Inject;
import javax.inject.Singleton;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriInfo;

import service.FlightService;

// Jersey automatically serves webresource/application.wadl RestEasy does not
// https://issues.jboss.org/browse/RESTEASY-166
// http://localhost:8080/flight_3_rest-1.0-SNAPSHOT/webresources/flights

@Path("flights")
@Singleton
public class FlightResource {

    @Inject
    private FlightService service;

    @Context
    private UriInfo context;

    @GET
    @Produces("application/json")
    public List<Flight> getFlights() {
        return service.getFlights();
    }

    @GET
    @Produces("application/json")
    @Path("{id}")
    public Flight getFlight(@PathParam("id") long id) {
        if (!service.exists(id))
            throw new NotFoundException("flight with id:" + id + " does not exist.");
        return service.get(id);
    }

    @DELETE
    @Path("{id}")
    public void deleteFlight(@PathParam("id") long id) {
        if (!service.exists(id))
            throw new NotFoundException("flight with id:" + id + " does not exist.");
        service.remove(id);
    }

    @POST
    @Consumes("application/json")
    @Produces("application/json")
    public Flight createFlight(Flight flight) {
        return service.add(flight);
    }
}


text:
const initialState = {
  buttons: [
    { name: 'Alert', selected: false },
    { name: 'Attentive', selected: false },
    { name: 'Appreciative', selected: false },
    { name: 'Clear', selected: false },
    { name: 'Compassionate', selected: false },
    { name: 'Courageous', selected: false },
    { name: 'Creative', selected: false },
    { name: 'Empowering', selected: false },
    { name: 'Enthusiastic', selected: false },
    { name: 'Flexible', selected: false },
    { name: 'Focused', selected: false },
    { name: 'Generous', selected: false },
    { name: 'Gentle', selected: false },
    { name: 'Grateful', selected: false },
    { name: 'Joyous', selected: false },
    { name: 'Kind', selected: false },
    { name: 'Loving', selected: false },
    { name: 'Open', selected: false },
    { name: 'Present', selected: false },
    { name: 'Receptive', selected: false },
    { name: 'Supportive', selected: false },
    { name: 'Truthful', selected: false },
    { name: 'Vulnerable', selected: false },
  ],
};

// Actions
const TOGGLE_BUTTON = 'ArenaState/TOGGLE_BUTTON';
const RESET_ARENA = 'ArenaState/RESET';

// Action creators
export function toggleButton(index) {
  return {
    type: TOGGLE_BUTTON,
    payload: index,
  };
}

export function resetArena() {
  return { type: RESET_ARENA };
}

// Reducer
export default function ArenaStateReducer(state = initialState, action = {}) {
  switch (action.type) {
    case RESET_ARENA: {
      return initialState;
    }
    case TOGGLE_BUTTON: {
      const newButtons = state.buttons.map(
        (bttn, index) =>
          index === action.payload ? Object.assign({}, bttn, { selected: !bttn.selected }) : bttn,
      );

      // If the change would result in >= 5 buttons, return state unmodified
      if (!state.buttons[action.payload].selected) {
        if (state.buttons.filter(b => b.selected).length >= 5) {
          return state;
        }
      }

      return Object.assign({}, state, {
        buttons: newButtons,
      });
    }
    default: {
      return state;
    }
  }
}

// Selectors
export const getQualitiesList = state => state.buttons.filter(b => b.selected).map(b => b.name);


text:
/* tslint:disable */
import {
  ContentEvent,
  ContentPage,
  ContentProduct,
  ContentPost,
  SystemDomain
} from '../index';

declare var Object: any;
export interface StorageFileInterface {
  "id"?: string;
  "name"?: string;
  "type"?: string;
  "created"?: Date;
  "modified"?: Date;
  "container"?: string;
  contentEvents?: ContentEvent[];
  contentPages?: ContentPage[];
  contentProducts?: ContentProduct[];
  contentPosts?: ContentPost[];
  systemDomain?: SystemDomain;
}

export class StorageFile implements StorageFileInterface {
  "id": string;
  "name": string;
  "type": string;
  "created": Date;
  "modified": Date;
  "container": string;
  contentEvents: ContentEvent[];
  contentPages: ContentPage[];
  contentProducts: ContentProduct[];
  contentPosts: ContentPost[];
  systemDomain: SystemDomain;
  constructor(data?: StorageFileInterface) {
    Object.assign(this, data);
  }
  /**
   * The name of the model represented by this $resource,
   * i.e. `StorageFile`.
   */
  public static getModelName() {
    return "StorageFile";
  }
  /**
  * @method factory
  * @author Jonathan Casarrubias
  * @license MIT
  * This method creates an instance of StorageFile for dynamic purposes.
  **/
  public static factory(data: StorageFileInterface): StorageFile{
    return new StorageFile(data);
  }
  /**
  * @method getModelDefinition
  * @author Julien Ledun
  * @license MIT
  * This method returns an object that represents some of the model
  * definitions.
  **/
  public static getModelDefinition() {
    return {
      name: 'StorageFile',
      plural: 'StorageFiles',
      path: 'StorageFiles',
      properties: {
        "id": {
          name: 'id',
          type: 'string'
        },
        "name": {
          name: 'name',
          type: 'string'
        },
        "type": {
          name: 'type',
          type: 'string'
        },
        "created": {
          name: 'created',
          type: 'Date'
        },
        "modified": {
          name: 'modified',
          type: 'Date'
        },
        "container": {
          name: 'container',
          type: 'string'
        },
      },
      relations: {
        contentEvents: {
          name: 'contentEvents',
          type: 'ContentEvent[]',
          model: 'ContentEvent'
        },
        contentPages: {
          name: 'contentPages',
          type: 'ContentPage[]',
          model: 'ContentPage'
        },
        contentProducts: {
          name: 'contentProducts',
          type: 'ContentProduct[]',
          model: 'ContentProduct'
        },
        contentPosts: {
          name: 'contentPosts',
          type: 'ContentPost[]',
          model: 'ContentPost'
        },
        systemDomain: {
          name: 'systemDomain',
          type: 'SystemDomain',
          model: 'SystemDomain'
        },
      }
    }
  }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<title>FarListPos</title>
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../../../styles/styles.css">

FarListPos

main |
Dialog API

The <dfn>FarListPos</dfn> structure contains information about the cursor position in a
DI_LISTBOX or
DI_COMBOBOX list.

struct FarListPos
{
  int SelectPos;
  int TopPos;
};

Members

SelectPos

Index of the current item.

TopPos

Index of the first visible item, or -1 if the first visible item
    should be determined automatically according to <var>SelectPos</var>.

Remarks

See also:

DM_LISTGETCURPOS,
DM_LISTSETCURPOS,
TFarListPos,
Structures


text:
class Timer
{
public:
	typedef uint64_t timer_id;
	static const timer_id EmptyTimer;
	typedef std::function<void()> handler_type;

private:
	std::mutex sync;
	typedef std::unique_lock<std::mutex> ScopedLock;

	std::condition_variable wakeUp;

private:
	typedef std::chrono::system_clock Clock;
	typedef std::chrono::time_point<Clock> Timestamp;
	typedef std::chrono::milliseconds Duration;

	struct Instance
	{
		Instance(timer_id id = 0)
			: id(id)
			, running(false)
		{
		}

		template<typename Tfunction>
		Instance(timer_id id, Timestamp next, Duration period, Tfunction&& handler)
			: id(id)
			, next(next)
			, period(period)
			, handler(std::forward<Tfunction>(handler))
			, running(false)
		{
		}

		Instance(Instance const& r) = delete;

		Instance(Instance&& r)
			: id(r.id)
			, next(r.next)
			, period(r.period)
			, handler(std::move(r.handler))
			, running(r.running)
		{
		}

		Instance& operator=(Instance const& r) = delete;

		Instance& operator=(Instance&& r)
		{
			if (this != &r)
			{
				id = r.id;
				next = r.next;
				period = r.period;
				handler = std::move(r.handler);
				running = r.running;
			}
			return *this;
		}

		timer_id id;
		Timestamp next;
		Duration period;
		handler_type handler;
		bool running;
	};

	typedef std::unordered_map<timer_id, Instance> InstanceMap;
	timer_id nextId;
	InstanceMap active;

	// Comparison functor to sort the timer "queue" by Instance::next
	struct NextActiveComparator
	{
		bool operator()(const Instance &a, const Instance &b) const
		{
			return a.next < b.next;
		}
	};
	NextActiveComparator comparator;

	// Queue is a set of references to Instance objects, sorted by next
	typedef std::reference_wrapper<Instance> QueueValue;
	typedef std::multiset<QueueValue, NextActiveComparator> Queue;
	Queue queue;

	// Thread and exit flag
	std::thread worker;
	bool done;
	void threadStart()
	{
		ScopedLock lock(sync);

		while (!done)
		{
			if (queue.empty())
			{
				// Wait (forever) for work
				wakeUp.wait(lock);
			}
			else
			{
				auto firstInstance = queue.begin();
				Instance& instance = *firstInstance;
				auto now = Clock::now();
				if (now >= instance.next)
				{
					queue.erase(firstInstance);

					// Mark it as running to handle racing destroy
					instance.running = true;

					// Call the handler
					lock.unlock();
					instance.handler();
					lock.lock();

					if (done)
					{
						break;
					}
					else if (!instance.running)
					{
						// Running was set to false, destroy was called
						// for this Instance while the callback was in progress
						// (this thread was not holding the lock during the callback)
						active.erase(instance.id);
					}
					else
					{
						instance.running = false;

						// If it is periodic, schedule a new one
						if (instance.period.count() > 0)
						{
							instance.next = instance.next + instance.period;
							queue.insert(instance);
						}
						else {
							active.erase(instance.id);
						}
					}
				}
				else {
					// Wait until the timer is ready or a timer creation notifies
					wakeUp.wait_until(lock, instance.next);
				}
			}
		}
	}

public:
	Timer()
		: nextId(1)
		, queue(comparator)
		, done(false)
	{
		ScopedLock lock(sync);
		worker = std::thread(std::bind(&Timer::threadStart, this));
	}

	~Timer()
	{
		ScopedLock lock(sync);
		done = true;
		wakeUp.notify_all();
		lock.unlock();
		worker.join();
	}

	timer_id create(uint64_t msFromNow, uint64_t msPeriod,
		const std::function<void()> &handler)
	{
		return createImpl(Instance(0,
			Clock::now() + Duration(msFromNow), Duration(msPeriod),
			handler));
	}

	timer_id create(uint64_t msFromNow, uint64_t msPeriod,
		std::function<void()>&& handler)
	{
		return createImpl(Instance(0,
			Clock::now() + Duration(msFromNow), Duration(msPeriod),
			std::move(handler)));
	}

private:
	timer_id createImpl(Instance&& item)
	{
		ScopedLock lock(sync);
		item.id = nextId++;
		auto iter = active.emplace(item.id, std::move(item));
		queue.insert(iter.first->second);
		wakeUp.notify_all();
		return item.id;
	}

public:
	bool destroy(timer_id id)
	{
		ScopedLock lock(sync);
		auto i = active.find(id);
		if (i == active.end())
			return false;
		else if (i->second.running)
		{
			// A callback is in progress for this Instance,
			// so flag it for deletion in the worker
			i->second.running = false;
		}
		else
		{
			queue.erase(std::ref(i->second));
			active.erase(i);
		}

		wakeUp.notify_all();
		return true;
	}

	bool exists(timer_id id)
	{
		ScopedLock lock(sync);
		return active.find(id) != active.end();
	}
};

const Timer::timer_id Timer::EmptyTimer = std::numeric_limits<timer_id>::max();

#endif // TIMER_H


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    android:id="@+id/rl_root_view"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/white"
    android:orientation="vertical">

    <ImageView
        android:id="@+id/iv_placeholder_image"
        android:layout_width="100dp"
        android:layout_height="wrap_content"
        android:src="@mipmap/ic_no_data"
        android:layout_centerInParent="true"/>

    <TextView
        android:id="@+id/tv_placeholder_tip"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_below="@+id/iv_placeholder_image"
        android:text="呃,暂无数据"
        android:textColor="@color/font_black_5"/>

</RelativeLayout>


text:
package se.dolkow.tangiblexml;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log;
import android.util.Pair;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

import java.io.IOException;
import java.lang.reflect.Field;
import java.util.Collection;

import static org.xmlpull.v1.XmlPullParser.END_DOCUMENT;
import static org.xmlpull.v1.XmlPullParser.FEATURE_PROCESS_NAMESPACES;
import static org.xmlpull.v1.XmlPullParser.START_DOCUMENT;
import static org.xmlpull.v1.XmlPullParser.START_TAG;
import static se.dolkow.tangiblexml.Util.TAG;

/**
 * Parse XML into objects.
 *
 * The parser object is reusable and reentrant.
 *
 * @param <E> the type of the result
 */
public class Parser<E> {
    private final @NonNull FieldPutter<Holder<E>,E> putter;
    private final @NonNull ParserNode<Holder<E>> root;
    private final @NonNull String rootName;
    private final @NonNull TangibleFieldCache cache = TangibleFieldCache.getInstance();
    static boolean debug = false;

    public Parser(@NonNull Class<E> resultClass) throws SetupException {
        Trace.beginSection("parser init " + resultClass.getSimpleName());

        TangibleRoot annot = resultClass.getAnnotation(TangibleRoot.class);
        if (annot == null) {
            String cname = resultClass.getSimpleName();
            String aname = TangibleRoot.class.getSimpleName();
            throw new SetupException(cname + " doesn't have annotation " + aname);
        }

        String path = annot.value();
        if (!path.startsWith("/")) {
            String msg = "BUG: path for " + resultClass.getSimpleName() + " is not absolute";
            throw new SetupException(msg);
        }
        String[] parts = path.substring(1).split("/");

        try {
            putter = new FieldPutter<>(Holder.class.getField("value"));
        } catch (NoSuchFieldException e) {
            throw new SetupException("BUG: can't find Holder.value field", e);
        }
        rootName = parts[0];

        InnerNode<Holder<E>> builder = new InnerNode<>();
        builder.extend(parts, putter, resultClass);
        if (builder.children.size() != 1) {
            throw new SetupException("Need exactly one root, found " + builder.children.size());
        }

        final ParserNode<Holder<E>> root = builder.children.get(rootName);
        if (root == null) {
            Object act = builder.children.keySet().toArray()[0];
            throw new SetupException("Unexpected root name " + act + ", wanted " + rootName);
        }
        this.root = root;

        if (debug) {
            StringBuilder sb = new StringBuilder();
            root.dump(sb, 0, rootName);
            Log.d(TAG, sb.toString());
        }

        Trace.endSection();
    }

    public static void setDebug(boolean on) {
        debug = on;
    }

    public @NonNull E parse(@NonNull XmlPullParser xml)
            throws ConversionException, InputException, ValueCountException,
            NotSupportedException, InvalidFieldException, ReflectionException {
        Trace.beginSection(getClass().getSimpleName() + " parse");

        Holder<E> holder = new Holder<>();
        try {
            xml.setFeature(FEATURE_PROCESS_NAMESPACES, false);
            xml.require(START_DOCUMENT, null, null);

            while (xml.getEventType() != END_DOCUMENT) {
                if (xml.getEventType() != START_TAG) {
                    xml.next();
                    continue;
                }
                String name = xml.getName();
                if (name.equals(rootName)) {
                    root.parse(xml, holder);
                } else {
                    Util.skip(xml);
                }
            }
            E result = putter.get(holder);
            if (result == null) {
                throw new ValueCountException("Failed to find result node");
            }
            validate(result);
            return result;
        } catch (IOException e) {
            throw new InputException(e);
        } catch (XmlPullParserException e) {
            throw new InputException(e);
        } finally {
            Trace.endSection();
        }
    }

    private void validate(@NonNull Object obj)
            throws ValueCountException, ReflectionException, InvalidFieldException {
        if (obj instanceof Iterable) {
            for (Object child : (Iterable)obj) {
                validate(child);
            }
        }
        try {
            for (Pair<Field,TangibleField> pair : cache.get(obj.getClass())) {
                final Field f = pair.first;
                final TangibleField tang = pair.second;

                Object child = f.get(obj);
                if (tang.required()) {
                    if (child == null) {
                        String msg = obj + "is missing required field " + f;
                        msg += ", expected at " + tang.value();
                        throw new ValueCountException(msg);
                    } else if (child instanceof Collection && ((Collection)child).isEmpty()) {
                        String msg = f + " in " + obj + " is empty";
                        msg += ", expected to find elements at " + tang.value();
                        throw new ValueCountException(msg);
                    }
                }

                if (child != null) {
                    validate(child);
                }
            }
        } catch (IllegalAccessException e) {
            throw new ReflectionException(e);
        }
    }

    private static class Holder<E> {
        @SuppressWarnings("unused")
        public @Nullable E value;
    }
}


text:
{% extends "common/base.html" %}
{% load staticfiles %}
{% load i18n %}

{% block title %}CloudPebble – {{ project.name }}{% endblock %}

{% block head %}
<link rel="stylesheet" href="{% static 'CodeMirror/addon/hint/show-hint.css' %}">
<link rel="stylesheet" href="{% static 'CodeMirror/addon/dialog/dialog.css' %}">
<link rel="stylesheet" href="{% static 'CodeMirror/lib/codemirror.css' %}">
<link rel="stylesheet" href="{% static 'CodeMirror/theme/monokai.css' %}">
<link rel="stylesheet" href="{% static 'CodeMirror/theme/eclipse.css' %}">
<link rel="stylesheet" href="{% static 'CodeMirror/theme/blackboard.css' %}">
<link rel="stylesheet" href="{% static 'CodeMirror/theme/solarized.css' %}">
<link rel="stylesheet" href="{% static 'CodeMirror/addon/fold/foldgutter.css' %}">
{% if font_css %}
<link rel="stylesheet" href="{{ font_css }}" />
{% endif %}
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Droid+Serif:700|Roboto+Condensed|Roboto:700">
<link rel="stylesheet" href="//static.cloudpebble.net/fonts/raster-gothic/stylesheet.css">

<link rel="stylesheet" href="{%  static 'jquery-textext/src/css/textext.core.css' %}" type="text/css" />
<link rel="stylesheet" href="{%  static 'jquery-textext/src/css/textext.plugin.tags.css' %}" type="text/css" />
<link rel="stylesheet" href="{%  static 'jquery-textext/src/css/textext.plugin.autocomplete.css' %}" type="text/css" />
<link rel="stylesheet" href="{%  static 'jquery-textext/src/css/textext.plugin.focus.css' %}" type="text/css" />
<link rel="stylesheet" href="{%  static 'jquery-textext/src/css/textext.plugin.prompt.css' %}" type="text/css" />
<link rel="stylesheet" href="{%  static 'jquery-textext/src/css/textext.plugin.arrow.css' %}" type="text/css" />

<link rel="stylesheet" href="{% static 'ide/css/ide.css' %}">
<link rel="stylesheet" href="{% static 'ide/css/ib.css' %}">
<link rel="stylesheet" href="{% static 'ide/css/codemirror-default.css' %}">

{% endblock %}

{% block content %}

{#
#}

            CloudPebble

{% trans 'Documentation' %}

{% trans 'Projects' %}

{% trans 'Settings' %}

{% trans 'Sign out' %}

{#
#}

                    <canvas width="144" height="168"></canvas>

{{ project.name }}

{% trans 'Settings' %}

Timeline (Preview)

{% trans 'Compilation' %}

                    {% if project.project_type == 'package' or project.project_type == 'native' %}

{% trans 'Dependencies' %}

                    {% endif %}

GitHub

                    {% if project.project_type != 'simplyjs' and project.project_type != 'rocky' %}

                        {% trans 'Resources' %}
                        <button class="btn btn-small" id="sidebar-pane-new-resource">{% trans 'Add new' %}</button>

                    {% endif %}

            {% get_current_language as lang %}
            {% if lang == 'en' %}
            Questions? Email us at cloudpebble@getpebble.com.
            {% endif %}
            {% blocktrans with cookie="https://getpebble.com/legal/cookies/" privacy="https://getpebble.com/legal/privacy/" %}See our cookie and privacy policies.{% endblocktrans %}

                Katharine @

{% trans 'Preparing autocomplete…' %}

        <form action="/i18n/setlang/" method="post" id="lang-select-form" class="lang-select project-page">
            {% csrf_token %}
            <select name="language" onchange="$('#lang-select-form').submit();">
                {% get_language_info_list for LANGUAGES as languages %}
                {% for language in languages %}
                <option value="{{ language.code }}"{% if language.code == LANGUAGE_CODE %} selected{% endif %}>
                    {{ language.name_local }}
                </option>
                {% endfor %}
            </select>
        </form>

{% include "ide/project/resource.html" %}
{% include "ide/project/compile.html" %}
{% include "ide/project/settings.html" %}
{% include "ide/project/github.html" %}
{% include "ide/project/ui-editor.html" %}
{% include "ide/project/timeline.html" %}
{% include "ide/project/dependencies.html" %}
{% endblock %}

{% block modals %}

{% trans 'Create new file' %}

    <form class="form-horizontal">

                {% trans 'File type' %}

                    <select id="new-file-type">
                        <option value="c" selected>{% trans 'C file' %}</option>
                        <option value="js">{% trans 'JavaScript file' %}</option>
                        <option value="json">{% trans 'JSON file' %}</option>
                        <option value="layout">{% trans 'Window Layout' %}</option>
                    </select>

                    {% trans 'Include Name' %}

                        <input type="text" id="new-include-file-name" pattern="[a-zA-Z0-9_-]+\.h$">

                    {% trans 'Filename' %}

                        <input type="text" id="new-c-file-name" pattern="[a-zA-Z0-9_-]+\.(c|h)$">

                    {% trans 'Target' context "compilation target" %}

                        <select id="new-c-target">
                            <option value="app" selected>
                                {% if project.project_type == 'package' %}
                                    {% trans 'Private source' %}
                                {% else %}
                                    {% trans 'App / Watchface' %}
                                {% endif %}
                            </option>
                            <option value="worker" class="native-only">{% trans 'Background worker' %}</option>
                            <option value="public" class="package-only">{% trans 'Public header file' %}</option>
                        </select>

                    {% trans 'Create header' %}

                        <input type="checkbox" id="new-c-generate-h">

                    {% trans 'Filename' %}

                        <input type="text" id="new-json-file-name" pattern="[a-zA-Z0-9_-]+\.json$">

                        {% trans 'Target' context "compilation target" %}

                            <select id="new-json-target">
                                <option value="app" selected>{% trans 'RockyJS' %}</option>
                                <option value="pkjs">{% trans 'PebbleKit JS' %}</option>
                                <option value="common">{% trans 'Shared JSON' %}</option>
                            </select>

                        {% trans 'Filename' %}

                            <input type="text" id="new-js-file-name" pattern="[a-zA-Z0-9_-]+\.js$">

                        {% trans 'Target' context "compilation target" %}

                            <select id="new-js-target">
                                <option value="app" selected>{% trans 'RockyJS' %}</option>
                                <option value="pkjs">{% trans 'PebbleKit JS' %}</option>
                                <option value="common">{% trans 'Shared JS' %}</option>
                            </select>

                    {% trans 'Window name' %}

                        <input type="text" id="new-window-name" pattern="^[a-z]([a-z0-9_]*[a-z0-9])?$">

    </form>

        <button class="btn" data-dismiss="modal">{% trans 'Cancel' %}</button>
        <button class="btn btn-primary" id="editor-create-file-button">{% trans 'Create' %}</button>

Create New Repo

    <form class="form-horizontal" style="margin-bottom: 0px; padding-bottom: 0px;">

{% trans 'That repo does not exist. Would you like to create it?' %}

            {% trans 'Repo Name' %}

                    {{ project.owner.github.username }}/
                    <input type="text" id="github-new-repo">

            {% trans 'Description (optional)' %}

                <input type="text" id="github-repo-description" class="span4">

        <button class="btn" data-dismiss="modal">{% trans 'Cancel' %}</button>
        <input type="submit" class="btn btn-primary" value="{% trans 'Create' %}">

    </form>

{% trans 'Push New Commit' %}

    <form class="form">

                {% trans 'Commit Summary' %}

                    <input type="text" id="github-commit-summary" maxlength="50" placeholder="{% trans 'Fix something useful.' context "sample commit summary" %}">

                {% trans 'Extended description (optional)' %}

                    <textarea id="github-commit-description" rows="7"></textarea>

            <button type="button" class="btn" data-dismiss="modal">{% trans 'Cancel' %}</button>
            <input type="submit" class="btn btn-primary" value="{% trans 'Commit' %}">

    </form>

{% trans 'Pull Latest Commit' %}

            {% blocktrans %}
Are you sure you want to pull the latest commit? Doing so will overwrite everything currently in your project.

There will be no further warnings and no opportunity to merge. This cannot be undone.
{% endblocktrans %}

{% trans 'Pulling latest commit from GitHub…' %}

        <button class="btn" data-dismiss="modal">{% trans 'Cancel' %}</button>
        <button class="btn btn-danger" id="github-pull-prompt-confirm">{% trans 'Pull' context "button label" %}</button>

Waiting for phone

Please check your phone for notices from the Pebble app.

{#
Retry
#}

{% trans 'Install App' %}

{% trans 'Installing app on your watch…' %}

        <button data-dismiss="modal" class="btn hide dismiss-btn">{% trans 'Dismiss' %}</button>
        <button class="btn hide logs-btn btn-primary">{% trans 'View logs' context "button to look at logs" %}</button>

{% trans 'Taking Screenshot' %}

{% trans 'Taking screenshot…' %}

        <button data-dismiss="modal" class="btn hide dismiss-btn">{% trans 'Dismiss' %}</button>

        <input type="text" id="fuzzy-prompt-input-value" autocomplete="off" placeholder="{% trans 'Search' %}">

Modal header

        <form class="form-horizontal">

                Modal text input prompt:

                    <input type="text" id="modal-text-input-value">

        </form>

        <button class="btn" data-dismiss="modal">{% trans 'Cancel' %}</button>
        <button class="btn btn-primary" id="modal-text-confirm-button">{% trans 'Okay' %}</button>

Modal header

Modal warning

        <button class="btn" data-dismiss="modal">{% trans 'Cancel' %}</button>
        <button class="btn btn-danger" id="modal-warning-prompt-button">{% trans 'Continue' %}</button>

Modal header

Modal warning

        <button class="btn" data-dismiss="modal">{% trans 'Cancel' %}</button>
        {% trans 'Continue' %}

Exporting…

        Download
        <button class="btn" data-dismiss="modal">Cancel</button>

Doing a thing…

Android App v2.1.0-beta9

This version of the Pebble Android app has been rewritten from the ground up to be more reliable
                and give a better user experience.

Notifications are now available from all apps. You should now disable Pebble Notifier or similar apps

The new Notifications menu includes an All apps option, where you can choose
                        to receive notifications from any app on your device.

Some popular apps are selected by default.

Some apps in this list will be disabled if you have enabled built-in notifications (e.g. Gmail
                        or calendar) to avoid generating duplicate notifications.

In-progress phone calls can now be ended from your watch.

        Please note:

This release is only supported on Android 4.3 and above.

Developers: datalogging compatibility is broken in this release. You will need to use the updated
                PebbleKit 2.6 in order to use datalogging with this release.

You will be asked to log in to your Pebble account again after installing this release.

        <button class="btn" data-dismiss="modal">{% trans 'Dismiss' %}</button>
        {% trans 'Download' %}

{% trans 'Compass and Accelerometer' %}

            {% blocktrans with url=phone_shorturl %}
You can use your mobile phone to send sensor data to the emulator.

            In your mobile browser, go to
{{ url }}
and enter this code:
{% endblocktrans %}

…

        <button class="btn" data-dismiss="modal">{% trans 'Okay' %}</button>

{% endblock %}

{% block scripts %}

{% endblock %}


text:
// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

goog.provide('cvox.ChromeVoxKbHandler');

goog.require('cvox.ChromeVox');
goog.require('cvox.KeyMap');
goog.require('cvox.KeySequence');
goog.require('cvox.KeyUtil');

/**
 * @fileoverview Handles user keyboard input events.
 *
 */
cvox.ChromeVoxKbHandler = {};

/**
 * The key map
 *
 * @type {cvox.KeyMap}
 */
cvox.ChromeVoxKbHandler.handlerKeyMap;

/**
 * Handler for ChromeVox commands. Returns undefined if the command does not
 * exist. Otherwise, returns the result of executing the command.
 * @type {function(string): boolean|undefined}
 */
cvox.ChromeVoxKbHandler.commandHandler;

/**
 * Loads the key bindings into the keyToFunctionsTable.
 *
 * @param {string} keyToFunctionsTable The key bindings table in JSON form.
 */
cvox.ChromeVoxKbHandler.loadKeyToFunctionsTable = function(
    keyToFunctionsTable) {
  if (!window.JSON) {
    return;
  }

  cvox.ChromeVoxKbHandler.handlerKeyMap =
      cvox.KeyMap.fromJSON(keyToFunctionsTable);
};

/**
 * Converts the key bindings table into an array that is sorted by the lengths
 * of the key bindings. After the sort, the key bindings that describe single
 * keys will come before the key bindings that describe multiple keys.
 * @param {Object<string>} keyToFunctionsTable Contains each key binding and its
 * associated function name.
 * @return {Array<Array<string>>} The sorted key bindings table in
 * array form. Each entry in the array is itself an array containing the
 * key binding and its associated function name.
 * @private
 */
cvox.ChromeVoxKbHandler.sortKeyToFunctionsTable_ = function(
    keyToFunctionsTable) {
  var sortingArray = [];

  for (var keySeqStr in keyToFunctionsTable) {
    sortingArray.push([keySeqStr, keyToFunctionsTable[keySeqStr]]);
  }

  function compareKeyStr(a, b) {
    // Compare the lengths of the key bindings.
    if (a[0].length < b[0].length) {
      return -1;
    } else if (b[0].length < a[0].length) {
      return 1;
    } else {
      // The keys are the same length. Sort lexicographically.
      return a[0].localeCompare(b[0]);
    }
  };

  sortingArray.sort(compareKeyStr);
  return sortingArray;
};

/**
 * Handles key down events.
 *
 * @param {Event} evt The key down event to process.
 * @return {boolean} True if the default action should be performed.
 */
cvox.ChromeVoxKbHandler.basicKeyDownActionsListener = function(evt) {
  var keySequence = cvox.KeyUtil.keyEventToKeySequence(evt);
  var functionName;
  if (cvox.ChromeVoxKbHandler.handlerKeyMap != undefined) {
    functionName =
        cvox.ChromeVoxKbHandler.handlerKeyMap.commandForKey(keySequence);
  } else {
    functionName = null;
  }

  // TODO (clchen): Disambiguate why functions are null. If the user pressed
  // something that is not a valid combination, make an error noise so there
  // is some feedback.

  if (!functionName) {
    return !cvox.KeyUtil.sequencing;
  }

  // If ChromeVox isn't active, ignore every command except the one
  // to toggle ChromeVox active again.
  if (!cvox.ChromeVox.isActive && functionName != 'toggleChromeVox') {
    return true;
  }

  // This is the key event handler return value - true if the event should
  // propagate and the default action should be performed, false if we eat
  // the key.
  var returnValue = true;
  var commandResult = cvox.ChromeVoxKbHandler.commandHandler(functionName);
  if (commandResult !== undefined) {
    returnValue = commandResult;
  } else if (keySequence.cvoxModifier) {
    // Modifier/prefix is active -- prevent default action
    returnValue = false;
  }

  // If the whole document is hidden from screen readers, let the app
  // catch keys as well.
  if (cvox.ChromeVox.entireDocumentIsHidden) {
    returnValue = true;
  }
  return returnValue;
};


text:
package com.tibco.as.sql;

import java.sql.SQLException;
import java.sql.SQLNonTransientException;
import java.sql.SQLRecoverableException;

import org.antlr.runtime.ANTLRStringStream;
import org.antlr.runtime.CharStream;
import org.antlr.runtime.CommonTokenStream;
import org.antlr.runtime.RecognitionException;

import com.tibco.as.jdbc.ASConnection;
import com.tibco.as.jdbc.ASStatement;
import com.tibco.as.space.Metaspace;
import com.tibco.as.sql.grammar.ASSQLLexer;
import com.tibco.as.sql.grammar.ASSQLParser;

public class ASSQLProcessor
{

    public static ASSQLResult executeQuery (ASStatement jdbcStatement, Metaspace metaspace, String queryString) throws SQLException
    {
        ASSQLResult result = null;
        ((ASConnection)jdbcStatement.getConnection()).getLogger().logTrace("Perform ANTLR parsing of query string.");
        ASSQLStatement statement = getStatement(queryString);
        // Check to make sure the given SQL statement is supposed to return a ResultSet.
        // If not, throw an exception.
        // Queries return data in a ResultSet, whereas updates return the number of rows affected.
        if (statement instanceof ASSQLQueryStatement)
        {
            ((ASConnection)jdbcStatement.getConnection()).getLogger().logTrace("Invoking processQuery on query string.");
            result = ((ASSQLQueryStatement) statement).processQuery(jdbcStatement, metaspace);
        }
        else
        {
            throw new SQLNonTransientException("executeQuery invoked for wrong statement type.");
        }
        return result;
    }

    public static int executeUpdate (Metaspace metaspace, String queryString) throws SQLException
    {
        int result = -1;
        ASSQLStatement statement = getStatement(queryString);
        // Check to make sure the given SQL statement is not supposed to return
        // a ResultSet. If so, throw an exception. Updates return the number of
        // rows affected. Queries return data in a ResultSet.
        if (statement instanceof ASSQLUpdateStatement)
        {
            result = ((ASSQLUpdateStatement) statement).processUpdate(metaspace);
        }
        else
        {
            throw new SQLNonTransientException("executeUpdate invoked for wrong statement type.");
        }
        return result;
    }

    private static ASSQLStatement getStatement (String queryString) throws SQLException
    {
        CharStream charstream = new ANTLRStringStream(queryString);
        ASSQLLexer lexer = new ASSQLLexer(charstream);
        CommonTokenStream tokens = new CommonTokenStream(lexer);
        ASSQLParser parser = new ASSQLParser(tokens);

        ASSQLStatement statement = null;
        try
        {
            statement = parser.query();
        }
        catch (RecognitionException ex)
        {
            throw new SQLRecoverableException(ex);
        }

        // The lexer and parser queue up any errors they may have encountered
        // along the way, if necessary, we turn them into exceptions here.
        lexer.throwFirstRecognitionError();
        parser.throwFirstRecognitionError();

        return statement;
    }

}


text:
package com.amazonaws.services.appmesh.model;

import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;

/**
 *

 * An object representing a virtual router returned by a list operation.
 *

 *
 * @see AWS API
 *      Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class VirtualRouterRef implements Serializable, Cloneable, StructuredPojo {

    /**
     *

     * The full Amazon Resource Name (ARN) for the virtual router.
     *

     */
    private String arn;
    /**
     *

     * The name of the service mesh that the virtual router resides in.
     *

     */
    private String meshName;
    /**
     *

     * The name of the virtual router.
     *

     */
    private String virtualRouterName;

    /**
     *

     * The full Amazon Resource Name (ARN) for the virtual router.
     *

     *
     * @param arn
     *        The full Amazon Resource Name (ARN) for the virtual router.
     */

    public void setArn(String arn) {
        this.arn = arn;
    }

    /**
     *

     * The full Amazon Resource Name (ARN) for the virtual router.
     *

     *
     * @return The full Amazon Resource Name (ARN) for the virtual router.
     */

    public String getArn() {
        return this.arn;
    }

    /**
     *

     * The full Amazon Resource Name (ARN) for the virtual router.
     *

     *
     * @param arn
     *        The full Amazon Resource Name (ARN) for the virtual router.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public VirtualRouterRef withArn(String arn) {
        setArn(arn);
        return this;
    }

    /**
     *

     * The name of the service mesh that the virtual router resides in.
     *

     *
     * @param meshName
     *        The name of the service mesh that the virtual router resides in.
     */

    public void setMeshName(String meshName) {
        this.meshName = meshName;
    }

    /**
     *

     * The name of the service mesh that the virtual router resides in.
     *

     *
     * @return The name of the service mesh that the virtual router resides in.
     */

    public String getMeshName() {
        return this.meshName;
    }

    /**
     *

     * The name of the service mesh that the virtual router resides in.
     *

     *
     * @param meshName
     *        The name of the service mesh that the virtual router resides in.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public VirtualRouterRef withMeshName(String meshName) {
        setMeshName(meshName);
        return this;
    }

    /**
     *

     * The name of the virtual router.
     *

     *
     * @param virtualRouterName
     *        The name of the virtual router.
     */

    public void setVirtualRouterName(String virtualRouterName) {
        this.virtualRouterName = virtualRouterName;
    }

    /**
     *

     * The name of the virtual router.
     *

     *
     * @return The name of the virtual router.
     */

    public String getVirtualRouterName() {
        return this.virtualRouterName;
    }

    /**
     *

     * The name of the virtual router.
     *

     *
     * @param virtualRouterName
     *        The name of the virtual router.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public VirtualRouterRef withVirtualRouterName(String virtualRouterName) {
        setVirtualRouterName(virtualRouterName);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getArn() != null)
            sb.append("Arn: ").append(getArn()).append(",");
        if (getMeshName() != null)
            sb.append("MeshName: ").append(getMeshName()).append(",");
        if (getVirtualRouterName() != null)
            sb.append("VirtualRouterName: ").append(getVirtualRouterName());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof VirtualRouterRef == false)
            return false;
        VirtualRouterRef other = (VirtualRouterRef) obj;
        if (other.getArn() == null ^ this.getArn() == null)
            return false;
        if (other.getArn() != null && other.getArn().equals(this.getArn()) == false)
            return false;
        if (other.getMeshName() == null ^ this.getMeshName() == null)
            return false;
        if (other.getMeshName() != null && other.getMeshName().equals(this.getMeshName()) == false)
            return false;
        if (other.getVirtualRouterName() == null ^ this.getVirtualRouterName() == null)
            return false;
        if (other.getVirtualRouterName() != null && other.getVirtualRouterName().equals(this.getVirtualRouterName()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getArn() == null) ? 0 : getArn().hashCode());
        hashCode = prime * hashCode + ((getMeshName() == null) ? 0 : getMeshName().hashCode());
        hashCode = prime * hashCode + ((getVirtualRouterName() == null) ? 0 : getVirtualRouterName().hashCode());
        return hashCode;
    }

    @Override
    public VirtualRouterRef clone() {
        try {
            return (VirtualRouterRef) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

    @com.amazonaws.annotation.SdkInternalApi
    @Override
    public void marshall(ProtocolMarshaller protocolMarshaller) {
        com.amazonaws.services.appmesh.model.transform.VirtualRouterRefMarshaller.getInstance().marshall(this, protocolMarshaller);
    }
}


text:
package com.opengamma.analytics.math.function.special;

import static org.testng.AssertJUnit.assertEquals;

import org.testng.annotations.Test;

import cern.jet.random.engine.MersenneTwister;
import cern.jet.random.engine.MersenneTwister64;
import cern.jet.random.engine.RandomEngine;

import com.opengamma.analytics.math.function.Function1D;
import com.opengamma.util.test.TestGroup;

/**
 * Test.
 */
@Test(groups = TestGroup.UNIT)
public class IncompleteBetaFunctionTest {
  private static final RandomEngine RANDOM = new MersenneTwister64(MersenneTwister.DEFAULT_SEED);
  private static final double EPS = 1e-9;
  private static final double A = 0.4;
  private static final double B = 0.2;
  private static final int MAX_ITER = 10000;
  private static final Function1D<Double, Double> BETA = new IncompleteBetaFunction(A, B);

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testNegativeA1() {
    new IncompleteBetaFunction(-A, B);
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testNegativeA2() {
    new IncompleteBetaFunction(-A, B, EPS, MAX_ITER);
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testNegativeB1() {
    new IncompleteBetaFunction(A, -B);
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testNegativeB2() {
    new IncompleteBetaFunction(A, -B, EPS, MAX_ITER);
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testNegativeEps() {
    new IncompleteBetaFunction(A, B, -EPS, MAX_ITER);
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testNegativeIter() {
    new IncompleteBetaFunction(A, B, EPS, -MAX_ITER);
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testLow() {
    BETA.evaluate(-0.3);
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testHigh() {
    BETA.evaluate(1.5);
  }

  @Test
  public void test() {
    final double a = RANDOM.nextDouble();
    final double b = RANDOM.nextDouble();
    final double x = RANDOM.nextDouble();
    final Function1D<Double, Double> f1 = new IncompleteBetaFunction(a, b);
    final Function1D<Double, Double> f2 = new IncompleteBetaFunction(b, a);
    assertEquals(f1.evaluate(0.), 0, EPS);
    assertEquals(f1.evaluate(1.), 1, EPS);
    assertEquals(f1.evaluate(x), 1 - f2.evaluate(1 - x), EPS);
  }
}


text:
class t05_Tag:

    def equal(self, lhs, rhs):
        return False

    def name(self):
        return "undefined"


text:
**About**: SHORE is a mapping and analysis pipeline for short DNA sequences that provides various prediction algorithms for genomic polymorphisms.

**Version**: 0.9.3

**Added**: 2017-04-07

**Updated**: 2017-04-07

**Installation directory**: /bioinfo/bin

**Source directory**: /bioinfo/installs/shore-0.9.3

**Link**: [SHORE](http://1001genomes.org/software/shore.html)


text:
package org.aieonf.model.xml;

public interface IModelNodeFactory {

}


text:
cask :v1 => 'antetype' do
  version :latest
  sha256 :no_check

  url 'https://s3.amazonaws.com/AntetypeDownload/Antetype.zip'
  homepage 'http://antetype.com'
  license :unknown    # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder

  app 'Antetype.app'
end


text:
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _locale = require('./locale');

var _locale2 = _interopRequireDefault(_locale);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var PersonalId = function () {
  function PersonalId(pin) {
    var _this = this;

    var userOpts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

    _classCallCheck(this, PersonalId);

    this.pin = null;
    this.validation = {
      valid: false,
      locales: {},
      data: null
    };

    console.log(_locale2.default);
    if (typeof pin === 'undefined' || pin === null) {
      throw Error('Personal ID: param \'pin\' has to be defined.'); // @TODO: add link to docs, how to add locale
    }

    this.opts = Object.assign({
      locales: [PersonalId.DEFAULT_LOCALE],
      min: PersonalId.DEFAULT_MIN,
      max: PersonalId.DEFAULT_MAX
    }, userOpts);
    this.pin = pin.toString();

    if (typeof pin !== 'string') {
      // eslint-disable-next-line no-console
      console.warn('Personal ID: param \'pin\' should be a string, other types have side effects. Pin value after convert to a string: \'' + this.pin + '\'.'); // @TODO: add link to docs
    }

    // Add locales
    this.opts.locales.forEach(function (code) {
      _this.addLocale(code, _locale2.default[code]);
    });
  }

  _createClass(PersonalId, [{
    key: 'addLocale',
    value: function addLocale(code, provider) {
      if (typeof code !== 'string') {
        throw Error('Personal ID: param \'code\' has to be defined.');
      }

      if (typeof provider !== 'function') {
        throw Error('Personal ID: param \'provider\' has to be a function.');
      }

      this.validation.locales[code] = new provider(); // eslint-disable-line new-cap
    }
  }, {
    key: 'validate',
    value: function validate() {
      var codes = Object.keys(this.validation.locales);
      this.validation.valid = false;

      for (var i = 0; i < codes.length; i += 1) {
        var locale = this.validation.locales[codes[i]];
        locale.validate(this.pin, this.opts.min, this.opts.max);

        if (locale.valid || this.validation.data === null || this.validation.data.pin !== this.pin) {
          this.validation.valid = locale.valid;
          this.validation.data = locale.getData();
        }
      }
    }
  }, {
    key: 'isValid',
    value: function isValid(code) {
      this.validate();

      if (typeof code === 'undefined') {
        return this.validation.valid;
      }

      if (typeof this.validation.locales[code] === 'undefined') {
        // @TODO: add link to docs, how to add locale
        console.warn('Personal ID: locale isn\'t added.'); // eslint-disable-line no-console
        return false;
      }

      return this.validation.locales[code].valid;
    }
  }, {
    key: 'prepare',
    value: function prepare() {
      if (this.validation.data === null || this.validation.data.pin !== this.pin) {
        this.validate();
      }
    }
  }, {
    key: 'getBirthDate',
    value: function getBirthDate() {
      this.prepare();

      return this.validation.data.birthDate;
    }
  }, {
    key: 'getCode',
    value: function getCode() {
      this.prepare();

      return this.validation.data.code;
    }
  }, {
    key: 'isMale',
    value: function isMale() {
      this.prepare();

      if (this.validation.data.gender === null) {
        return null;
      }

      return this.validation.data.gender === PersonalId.MALE;
    }
  }, {
    key: 'isFemale',
    value: function isFemale() {
      this.prepare();

      if (this.validation.data.gender === null) {
        return null;
      }

      return this.validation.data.gender === PersonalId.FEMALE;
    }
  }]);

  return PersonalId;
}();

PersonalId.DEFAULT_MIN = new Date('1900-01-01');
PersonalId.DEFAULT_MAX = new Date();
PersonalId.DEFAULT_LOCALE = 'cs';
PersonalId.MALE = 'male';
PersonalId.FEMALE = 'female';
exports.default = PersonalId;


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Antonie van Leeuwenhoek 41(2): 195 (1975)

#### Original name
Sterigmatomyces penicillatus Rodr. Mir.

### Remarks
null


text:
namespace launcher
{
	class Commandline;
}

namespace runtime
{
	class IPlatform;
	class Image;

	/// runtime environment - image + platform
	class LAUNCHER_API Environment
	{
	public:
		Environment(const native::Systems& nativeSystems);
		~Environment();

		/// initialize environment
		bool Initialize(const launcher::Commandline& commandline);

		/// run until done, returns application exit code
		int Run();

	private:
		IPlatform*	m_platform;
		Image*		m_image;

		Symbols*	m_symbols;

		native::Systems	m_systems;
	};

} // runtime


text:
                Select a Product Category

                        <button class="btn btn-primary pull-right" ng-click="vm.showFormNew = !vm.showFormNew">Create New</button>

                                    Name

                                    {{productCategory.name}}

                        <button class="btn btn-primary pull-right" ng-click="vm.showFormNew = !vm.showFormNew">Cancel</button>

                        <mc-messages></mc-messages>
                        <form name="newProductCategoryFrom">

                                    Name
                                    <input type="text" class="form-control" ng-model="vm.productCategory.name" required>

                                    <button type="button" class="btn btn-success pull-right" ng-click="vm.saveAndSelect()"
                                            ng-disabled="newProductCategoryFrom.$invalid">Create And Select</button>

                        </form>

            <button type="button" class="btn btn-default" ng-click="vm.cancel()">Close</button>