text:
<?php

namespace Symfony\Component\Form\Tests\Extension\Core\Type;

use Symfony\Component\Form\FormError;

class WeekTypeTest extends BaseTypeTest
{
    public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\WeekType';

    public function testSubmitArray()
    {
        $form = $this->factory->create(static::TESTED_TYPE, null, [
            'widget' => 'choice',
            'input' => 'array',
        ]);

        $form->submit([
            'year' => '2019',
            'week' => '1',
        ]);

        $this->assertSame(['year' => 2019, 'week' => 1], $form->getData());
    }

    public function testSubmitString()
    {
        $form = $this->factory->create(static::TESTED_TYPE, null, [
            'years' => [2019],
            'input' => 'string',
            'widget' => 'choice',
        ]);

        $form->submit([
            'year' => '2019',
            'week' => '1',
        ]);

        $this->assertEquals('2019-W01', $form->getData());
    }

    public function testSubmitStringSingleText()
    {
        $form = $this->factory->create(static::TESTED_TYPE, null, [
            'years' => [2019],
            'input' => 'string',
            'widget' => 'single_text',
        ]);

        $form->submit('2019-W01');

        $this->assertEquals('2019-W01', $form->getData());
    }

    public function testPassDefaultPlaceholderToViewIfNotRequired()
    {
        $view = $this->factory->create(static::TESTED_TYPE, null, [
            'required' => false,
            'widget' => 'choice',
        ])
            ->createView();

        $this->assertSame('', $view['year']->vars['placeholder']);
        $this->assertSame('', $view['week']->vars['placeholder']);
    }

    public function testPassNoPlaceholderToViewIfRequired()
    {
        $view = $this->factory->create(static::TESTED_TYPE, null, [
            'required' => true,
            'widget' => 'choice',
        ])
            ->createView();

        $this->assertNull($view['year']->vars['placeholder']);
        $this->assertNull($view['week']->vars['placeholder']);
    }

    public function testPassPlaceholderAsString()
    {
        $view = $this->factory->create(static::TESTED_TYPE, null, [
            'placeholder' => 'Empty',
            'widget' => 'choice',
        ])
            ->createView();

        $this->assertSame('Empty', $view['year']->vars['placeholder']);
        $this->assertSame('Empty', $view['week']->vars['placeholder']);
    }

    public function testPassPlaceholderAsArray()
    {
        $view = $this->factory->create(static::TESTED_TYPE, null, [
            'placeholder' => [
                'year' => 'Empty year',
                'week' => 'Empty week',
            ],
            'widget' => 'choice',
        ])
            ->createView();

        $this->assertSame('Empty year', $view['year']->vars['placeholder']);
        $this->assertSame('Empty week', $view['week']->vars['placeholder']);
    }

    public function testPassPlaceholderAsPartialArrayAddEmptyIfNotRequired()
    {
        $view = $this->factory->create(static::TESTED_TYPE, null, [
            'required' => false,
            'placeholder' => [
                'year' => 'Empty year',
            ],
            'widget' => 'choice',
        ])
            ->createView();

        $this->assertSame('Empty year', $view['year']->vars['placeholder']);
        $this->assertSame('', $view['week']->vars['placeholder']);
    }

    public function testPassPlaceholderAsPartialArrayAddNullIfRequired()
    {
        $view = $this->factory->create(static::TESTED_TYPE, null, [
            'required' => true,
            'placeholder' => [
                'year' => 'Empty year',
            ],
            'widget' => 'choice',
        ])
            ->createView();

        $this->assertSame('Empty year', $view['year']->vars['placeholder']);
        $this->assertNull($view['week']->vars['placeholder']);
    }

    public function testPassHtml5TypeIfSingleTextAndHtml5Format()
    {
        $view = $this->factory->create(static::TESTED_TYPE, null, [
            'widget' => 'single_text',
        ])
            ->createView();

        $this->assertSame('week', $view->vars['type']);
    }

    public function testDontPassHtml5TypeIfHtml5NotAllowed()
    {
        $view = $this->factory->create(static::TESTED_TYPE, null, [
            'widget' => 'single_text',
            'html5' => false,
        ])
            ->createView();

        $this->assertArrayNotHasKey('type', $view->vars);
    }

    public function testDontPassHtml5TypeIfNotSingleText()
    {
        $view = $this->factory->create(static::TESTED_TYPE, null, [
            'widget' => 'text',
        ])
            ->createView();

        $this->assertArrayNotHasKey('type', $view->vars);
    }

    public function testYearTypeChoiceErrorsBubbleUp()
    {
        $error = new FormError('Invalid!');
        $form = $this->factory->create(static::TESTED_TYPE, null, [
            'widget' => 'choice',
        ]);

        $form['year']->addError($error);

        $this->assertSame([], iterator_to_array($form['year']->getErrors()));
        $this->assertSame([$error], iterator_to_array($form->getErrors()));
    }

    public function testWeekTypeChoiceErrorsBubbleUp()
    {
        $error = new FormError('Invalid!');
        $form = $this->factory->create(static::TESTED_TYPE, null, [
            'widget' => 'choice',
        ]);

        $form['week']->addError($error);

        $this->assertSame([], iterator_to_array($form['week']->getErrors()));
        $this->assertSame([$error], iterator_to_array($form->getErrors()));
    }

    public function testPassDefaultChoiceTranslationDomain()
    {
        $form = $this->factory->create(static::TESTED_TYPE, null, [
            'widget' => 'choice',
        ]);

        $view = $form->createView();

        $this->assertFalse($view['year']->vars['choice_translation_domain']);
        $this->assertFalse($view['week']->vars['choice_translation_domain']);
    }

    public function testPassChoiceTranslationDomainAsString()
    {
        $form = $this->factory->create(static::TESTED_TYPE, null, [
            'choice_translation_domain' => 'messages',
            'widget' => 'choice',
        ]);

        $view = $form->createView();
        $this->assertSame('messages', $view['year']->vars['choice_translation_domain']);
        $this->assertSame('messages', $view['week']->vars['choice_translation_domain']);
    }

    public function testPassChoiceTranslationDomainAsArray()
    {
        $form = $this->factory->create(static::TESTED_TYPE, null, [
            'choice_translation_domain' => [
                'year' => 'foo',
                'week' => 'test',
            ],
            'widget' => 'choice',
        ]);

        $view = $form->createView();
        $this->assertSame('foo', $view['year']->vars['choice_translation_domain']);
        $this->assertSame('test', $view['week']->vars['choice_translation_domain']);
    }

    public function testSubmitNull($expected = null, $norm = null, $view = null)
    {
        $form = $this->factory->create($this->getTestedType(), null, [
            'widget' => 'choice',
        ]);
        $form->submit(null);

        $this->assertSame(['year' => null, 'week' => null], $form->getData());
        $this->assertSame(['year' => null, 'week' => null], $form->getNormData());
        $this->assertSame(['year' => null, 'week' => null], $form->getViewData());
    }

    public function testSubmitFromChoiceEmpty()
    {
        $form = $this->factory->create(static::TESTED_TYPE, null, [
            'widget' => 'choice',
            'required' => false,
        ]);

        $form->submit([
            'year' => '',
            'week' => '',
        ]);

        $this->assertSame(['year' => null, 'week' => null], $form->getData());
    }

    public function testSubmitNullWithText()
    {
        $form = $this->factory->create(static::TESTED_TYPE, null, [
            'widget' => 'text',
        ]);
        $form->submit(null);

        $this->assertSame(['year' => null, 'week' => null], $form->getViewData());
    }

    public function testSubmitNullWithSingleText()
    {
        $form = $this->factory->create(static::TESTED_TYPE, null, [
            'widget' => 'single_text',
            'input' => 'string',
        ]);
        $form->submit(null);

        $this->assertNull($form->getData());
        $this->assertNull($form->getNormData());
        $this->assertSame('', $form->getViewData());
    }

    public function testSubmitNullUsesDefaultEmptyData($emptyData = [], $expectedData = null)
    {
        $form = $this->factory->create(static::TESTED_TYPE, null, [
            'empty_data' => $emptyData,
            'widget' => 'choice',
        ]);
        $form->submit(null);

        $this->assertSame(['year' => null, 'week' => null], $form->getData());
    }

    /**
     * @dataProvider provideEmptyData
     */
    public function testSubmitNullUsesDateEmptyDataString($widget, $emptyData, $expectedData)
    {
        $form = $this->factory->create(static::TESTED_TYPE, null, [
            'widget' => $widget,
            'empty_data' => $emptyData,
        ]);
        $form->submit(null);

        $this->assertSame($expectedData, $form->getData());
    }

    public function provideEmptyData()
    {
        return [
            'Compound text field' => ['text', ['year' => '2019', 'week' => '1'], ['year' => 2019, 'week' => 1]],
            'Compound choice field' => ['choice', ['year' => '2019', 'week' => '1'], ['year' => 2019, 'week' => 1]],
        ];
    }
}


text:
#include <boost/phoenix/core/argument.hpp>
int main() {}

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Security.AccessControl;
using System.Runtime.InteropServices;
using System.Diagnostics;

using Asprosys.Win32;

namespace Asprosys.Security.AccessControl
{
    public sealed class ThreadSecurity : BaseSecurity
    {

        #region Constructors

        public ThreadSecurity()
            : base(ResourceType.KernelObject, false)
        {
        }

        public ThreadSecurity(int threadID, AccessControlSections sectionsRequested)
            : base(GetReadHandle(threadID), ResourceType.KernelObject, sectionsRequested, false)
        {
        }

        public ThreadSecurity(ProcessThread thread, AccessControlSections sectionsRequired)
            : this(thread.Id, sectionsRequired)
        {
        }

        public ThreadSecurity(IntPtr threadHandle, AccessControlSections sectionsRequired)
            : base(BaseSecurity.GetReadHandle(threadHandle), ResourceType.KernelObject, sectionsRequired, false)
        {
        }

        #endregion

        private static GenericSafeHandle GetReadHandle(int threadId)
        {
            IntPtr readHandle = NativeMethods.OpenThread((int)ThreadRights.ReadPermissions, false, threadId);
            if (readHandle == IntPtr.Zero)
            {
                int err = Marshal.GetLastWin32Error();
                switch (err)
                {
                    case NativeConstants.ERROR_ACCESS_DENIED:
                        throw new UnauthorizedAccessException();
                    default:
                        throw new System.ComponentModel.Win32Exception(err);
                }
            }
            return new GenericSafeHandle(readHandle);
        }

        #region NativeObjectSecurity Abstract Method Overrides

        public override Type AccessRightType
        {
            get { return typeof(ThreadRights); }
        }

        public override AccessRule AccessRuleFactory(System.Security.Principal.IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type)
        {
            return new ThreadAccessRule(identityReference, (ThreadRights)accessMask, type);
        }

        public override Type AccessRuleType
        {
            get { return typeof(ThreadAccessRule); }
        }

        public override AuditRule AuditRuleFactory(System.Security.Principal.IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags flags)
        {
            return new ThreadAuditRule(identityReference, (ThreadRights)accessMask, flags);
        }

        public override Type AuditRuleType
        {
            get { return typeof(ThreadAuditRule); }
        }

        #endregion

        #region AccessControl Overloads for Thread specific types.

        public void AddAccessRule(ThreadAccessRule accessRule)
        {
            base.AddAccessRule(accessRule);
        }

        public void AddAuditRule(ThreadAuditRule auditRule)
        {
            base.AddAuditRule(auditRule);
        }

        public bool RemoveAccessRule(ThreadAccessRule accessRule)
        {
            return base.RemoveAccessRule(accessRule);
        }

        public void RemoveAccessRuleAll(ThreadAccessRule accessRule)
        {
            base.RemoveAccessRuleAll(accessRule);
        }

        public void RemoveAccessRuleSpecific(ThreadAccessRule accessRule)
        {
            base.RemoveAccessRuleSpecific(accessRule);
        }

        public bool RemoveAuditRule(ThreadAuditRule auditRule)
        {
            return base.RemoveAuditRule(auditRule);
        }

        public void RemoveAuditRuleAll(ThreadAuditRule auditRule)
        {
            base.RemoveAuditRuleAll(auditRule);
        }

        public void RemoveAuditRuleSpecific(ThreadAuditRule auditRule)
        {
            base.RemoveAuditRuleSpecific(auditRule);
        }

        public void ResetAccessRule(ThreadAccessRule accessRule)
        {
            base.ResetAccessRule(accessRule);
        }

        public void SetAccessRule(ThreadAccessRule accessRule)
        {
            base.SetAccessRule(accessRule);
        }

        public void SetAuditRule(ThreadAuditRule auditRule)
        {
            base.SetAuditRule(auditRule);
        }

        #endregion

        #region AccessCheck Methods

        private static GenericMapping m_GenericAccessMapping
            = new GenericMapping((int)ThreadRights.Read, (int)ThreadRights.Write,
                                 (int)ThreadRights.Execute, (int)ThreadRights.AllAccess);

        protected override GenericMapping GetGenericMapping()
        {
            return m_GenericAccessMapping;
        }

        #endregion

    }
}


text:
package uk.co.real_logic.sbe.xml;

import java.io.File;
import java.net.URL;

import org.junit.Assert;
import org.junit.Test;

import org.xml.sax.InputSource;

import static uk.co.real_logic.sbe.xml.XmlSchemaParser.parse;

public class RelativeXIncludeTest
{
    @Test
    public void shouldParseFileInSubDir()
        throws Exception
    {
        final URL testResource = getClass().getClassLoader().getResource("sub/basic-schema.xml");
        Assert.assertNotNull(testResource);

        final InputSource is = new InputSource(testResource.openStream());
        final File file = new File(testResource.getFile());
        is.setSystemId(file.toPath().toAbsolutePath().getParent().toUri().toString());
        final MessageSchema messageSchema = parse(is, ParserOptions.DEFAULT);

        Assert.assertNotNull(messageSchema.getType("Symbol"));
    }
}


text:
<ion-view view-title="Account-People" >

  <ion-content>
      <ion-item class="item-remove-animate item-avatar item-icon-right" type="item-text-wrap">

{{username}}

      </ion-item>

      <ion-list>

Who Do You Want to Live With?

        <ion-item>

Gender

            <select ng-model="people.gender">
              <option>
Either/Both
</option>
              <option>
Male
</option>
              <option>
Female
</option>
            </select>

Age Range

              <input type="number" ng-model="people.ageMin" min="18" max="100" placeholder="Minimum Age">

              <input type="number" ng-model="people.ageMax" min="18" max="100" placeholder="Maximum Age">

        </ion-item>

      <ion-item>
        <button class="button button-block button-positive col col-50 col-offset-25 col-center" ng-click="savePeople()">
          Save People Preferences
        </button>
      </ion-item>

  </ion-content>
</ion-view>


text:
require "config"

local function createAlienConstructionRobotRecipe()
  data:extend(
  {
    {
      type = "recipe",
      name = "fusion-construction-robot",
      subgroup = "fusion-robots",
      enabled = false,
      energy_required = 5,
      icon="__fupower__/graphics/icons/fusion-construction-robot.png",
      ingredients ={{"construction-robot", 10}, {"steel-plate", 10}, {"processing-unit", 1}},
      result = "fusion-construction-robot"
    },
    {
      type = "recipe",
      name = "fusion-repair-pack",
      subgroup = "fusion-robots",
      enabled = false,
      energy_required = 5,
      icon="__fupower__/graphics/icons/fusion-repair-pack.png",
      ingredients ={{"repair-pack", 10}, {"steel-plate", 1}, {"advanced-circuit", 1}},
      result = "fusion-repair-pack"
    },
  })
end

local function createAlienLogisticRobotRecipe()
  data:extend(
  {
    {
      type = "recipe",
      name = "fusion-logistic-robot",
      subgroup = "fusion-robots",
      enabled = false,
      energy_required = 5,
      icon="__fupower__/graphics/icons/fusion-logistic-robot.png",
      ingredients ={{"logistic-robot", 10}, {"steel-plate", 10}, {"processing-unit", 1}},
      result = "fusion-logistic-robot"
    },
  })
end

if config.fuconstruction.alienConstructionRobot==true then
  createAlienConstructionRobotRecipe()
end

if config.fuconstruction.alienLogisticRobot==true then
  createAlienLogisticRobotRecipe()
end


text:
'use strict';

// MODULES //

var bench = require( '@stdlib/bench' );
var randu = require( '@stdlib/random/iter/randu' );
var iterConstant = require( '@stdlib/iter/constant' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var isIteratorLike = require( '@stdlib/assert/is-iterator-like' );
var pkg = require( './../package.json' ).name;
var iterMod = require( './../lib' );

// MAIN //

bench( pkg, function benchmark( b ) {
	var rand;
	var iter;
	var i;

	rand = randu();

	b.tic();
	for ( i = 0; i < b.iterations; i++ ) {
		iter = iterMod( rand, rand );
		if ( typeof iter !== 'object' ) {
			b.fail( 'should return an object' );
		}
	}
	b.toc();
	if ( !isIteratorLike( iter ) ) {
		b.fail( 'should return an iterator protocol-compliant object' );
	}
	b.pass( 'benchmark finished' );
	b.end();
});

bench( pkg+'::iteration', function benchmark( b ) {
	var scalar;
	var rand;
	var iter;
	var z;
	var i;

	rand = randu({
		'iter': b.iterations
	});
	scalar = iterConstant( 10.0 );

	iter = iterMod( rand, scalar );

	b.tic();
	for ( i = 0; i < b.iterations; i++ ) {
		z = iter.next().value;
		if ( isnan( z ) ) {
			b.fail( 'should not return NaN' );
		}
	}
	b.toc();
	if ( isnan( z ) ) {
		b.fail( 'should not return NaN' );
	}
	b.pass( 'benchmark finished' );
	b.end();
});


text:
namespace MediaPicker.Forms.Plugin.Abstractions
{
    /// <summary>
    ///     Class MediaStorageOptions.
    /// </summary>
    public class MediaStorageOptions
    {
        /// <summary>
        ///     Initializes a new instance of the <see cref="MediaStorageOptions" /> class.
        /// </summary>
        protected MediaStorageOptions()
        {
        }

        /// <summary>
        ///     Gets or sets the directory.
        /// </summary>
        /// <value>The directory.</value>
        public string Directory { get; set; }

        /// <summary>
        ///     Gets or sets the name.
        /// </summary>
        /// <value>The name.</value>
        public string Name { get; set; }

        /// <summary>
        ///     Gets or sets the maximum pixel dimension.
        /// </summary>
        /// <value>The maximum pixel dimension.</value>
        public int? MaxPixelDimension { get; set; }

        /// <summary>
        ///     Gets or sets the percent quality.
        /// </summary>
        /// <value>The percent quality.</value>
        public int? PercentQuality { get; set; }
    }
}


text:
package com.azure.resourcemanager.datalakeanalytics.implementation;

import com.azure.core.util.Context;
import com.azure.resourcemanager.datalakeanalytics.fluent.models.FirewallRuleInner;
import com.azure.resourcemanager.datalakeanalytics.models.CreateOrUpdateFirewallRuleParameters;
import com.azure.resourcemanager.datalakeanalytics.models.FirewallRule;
import com.azure.resourcemanager.datalakeanalytics.models.UpdateFirewallRuleParameters;

public final class FirewallRuleImpl implements FirewallRule, FirewallRule.Definition, FirewallRule.Update {
    private FirewallRuleInner innerObject;

    private final com.azure.resourcemanager.datalakeanalytics.DataLakeAnalyticsManager serviceManager;

    public String id() {
        return this.innerModel().id();
    }

    public String startIpAddress() {
        return this.innerModel().startIpAddress();
    }

    public String endIpAddress() {
        return this.innerModel().endIpAddress();
    }

    public String name() {
        return this.innerModel().name();
    }

    public String type() {
        return this.innerModel().type();
    }

    public FirewallRuleInner innerModel() {
        return this.innerObject;
    }

    private com.azure.resourcemanager.datalakeanalytics.DataLakeAnalyticsManager manager() {
        return this.serviceManager;
    }

    private String resourceGroupName;

    private String accountName;

    private String firewallRuleName;

    private CreateOrUpdateFirewallRuleParameters createParameters;

    private UpdateFirewallRuleParameters updateParameters;

    public FirewallRuleImpl withExistingAccount(String resourceGroupName, String accountName) {
        this.resourceGroupName = resourceGroupName;
        this.accountName = accountName;
        return this;
    }

    public FirewallRule create() {
        this.innerObject =
            serviceManager
                .serviceClient()
                .getFirewallRules()
                .createOrUpdateWithResponse(
                    resourceGroupName, accountName, firewallRuleName, createParameters, Context.NONE)
                .getValue();
        return this;
    }

    public FirewallRule create(Context context) {
        this.innerObject =
            serviceManager
                .serviceClient()
                .getFirewallRules()
                .createOrUpdateWithResponse(resourceGroupName, accountName, firewallRuleName, createParameters, context)
                .getValue();
        return this;
    }

    FirewallRuleImpl(String name, com.azure.resourcemanager.datalakeanalytics.DataLakeAnalyticsManager serviceManager) {
        this.innerObject = new FirewallRuleInner();
        this.serviceManager = serviceManager;
        this.firewallRuleName = name;
        this.createParameters = new CreateOrUpdateFirewallRuleParameters();
    }

    public FirewallRuleImpl update() {
        this.updateParameters = new UpdateFirewallRuleParameters();
        return this;
    }

    public FirewallRule apply() {
        this.innerObject =
            serviceManager
                .serviceClient()
                .getFirewallRules()
                .updateWithResponse(resourceGroupName, accountName, firewallRuleName, updateParameters, Context.NONE)
                .getValue();
        return this;
    }

    public FirewallRule apply(Context context) {
        this.innerObject =
            serviceManager
                .serviceClient()
                .getFirewallRules()
                .updateWithResponse(resourceGroupName, accountName, firewallRuleName, updateParameters, context)
                .getValue();
        return this;
    }

    FirewallRuleImpl(
        FirewallRuleInner innerObject,
        com.azure.resourcemanager.datalakeanalytics.DataLakeAnalyticsManager serviceManager) {
        this.innerObject = innerObject;
        this.serviceManager = serviceManager;
        this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups");
        this.accountName = Utils.getValueFromIdByName(innerObject.id(), "accounts");
        this.firewallRuleName = Utils.getValueFromIdByName(innerObject.id(), "firewallRules");
    }

    public FirewallRule refresh() {
        this.innerObject =
            serviceManager
                .serviceClient()
                .getFirewallRules()
                .getWithResponse(resourceGroupName, accountName, firewallRuleName, Context.NONE)
                .getValue();
        return this;
    }

    public FirewallRule refresh(Context context) {
        this.innerObject =
            serviceManager
                .serviceClient()
                .getFirewallRules()
                .getWithResponse(resourceGroupName, accountName, firewallRuleName, context)
                .getValue();
        return this;
    }

    public FirewallRuleImpl withStartIpAddress(String startIpAddress) {
        if (isInCreateMode()) {
            this.createParameters.withStartIpAddress(startIpAddress);
            return this;
        } else {
            this.updateParameters.withStartIpAddress(startIpAddress);
            return this;
        }
    }

    public FirewallRuleImpl withEndIpAddress(String endIpAddress) {
        if (isInCreateMode()) {
            this.createParameters.withEndIpAddress(endIpAddress);
            return this;
        } else {
            this.updateParameters.withEndIpAddress(endIpAddress);
            return this;
        }
    }

    private boolean isInCreateMode() {
        return this.innerModel().id() == null;
    }
}


text:
package com.baidubce.services.subnet.model;

import com.baidubce.auth.BceCredentials;
import com.baidubce.model.AbstractBceRequest;
import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * request model to modify subnet
 */
public class ModifySubnetAttributesRequest extends AbstractBceRequest {

    /**
     * An ASCII string whose length is less than 64.
     *

     * The request will be idempotent if clientToken is provided.
     * If the clientToken is not specified by the user, a random String generated by default algorithm will be used.
     * See more detail at
     *
     * BCE API doc
     */
    @JsonIgnore
    private String clientToken;

    /**
     * The id of subnet modified.
     */
    private String subnetId;

    /**
     * The new name of subnet
     */
    private String name;

    /**
     * The new value description of subnet.
     */
    private String description;

    /**
     * Configure optional client token for the request. The request will be idempotent if client token is provided.
     * If the clientToken is not specified by the user, a random String generated by default algorithm will be used.
     *
     * @param clientToken An ASCII string whose length is less than 64.
     *                    See more detail at
     *
     *                    BCE API doc
     * @return ModifySubnetAttributesRequest with specific clientToken
     */
    public ModifySubnetAttributesRequest withClientToken(String clientToken) {
        this.setClientToken(clientToken);
        return this;
    }

    /**
     * Configure subnet id for the request.
     *
     * @param subnetId the id of subnet
     * @return ModifySubnetAttributesRequest with subnetId
     */
    public ModifySubnetAttributesRequest withSubnetId(String subnetId) {
        this.subnetId = subnetId;
        return this;
    }

    /**
     * Configure name for the request.
     *
     * @param name The new name of subnet
     * @return ModifySubnetAttributesRequest with specific name
     */
    public ModifySubnetAttributesRequest withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Configure description for the request.
     *
     * @param description the type of subnet
     * @return ModifySubnetAttributesRequest with description
     */
    public ModifySubnetAttributesRequest withDescription(String description) {
        this.description = description;
        return this;
    }

    public String getClientToken() {
        return clientToken;
    }

    public void setClientToken(String clientToken) {
        this.clientToken = clientToken;
    }

    public String getSubnetId() {
        return subnetId;
    }

    public void setSubnetId(String subnetId) {
        this.subnetId = subnetId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    /**
     * Configure request credential for the request.
     *
     * @param credentials a valid instance of BceCredentials.
     * @return ModifyVpcAttributesRequest with credentials.
     */
    @Override
    public ModifySubnetAttributesRequest withRequestCredentials(BceCredentials credentials) {
        this.setRequestCredentials(credentials);
        return this;
    }
}


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

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

/**
 *

 * Object containing source code information that is linked to an application component.
 *

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

    /**
     *

     * The repository name for the source code.
     *

     */
    private String location;
    /**
     *

     * The branch of the source code.
     *

     */
    private String sourceVersion;
    /**
     *

     * The type of repository to use for the source code.
     *

     */
    private String versionControl;

    /**
     *

     * The repository name for the source code.
     *

     *
     * @param location
     *        The repository name for the source code.
     */

    public void setLocation(String location) {
        this.location = location;
    }

    /**
     *

     * The repository name for the source code.
     *

     *
     * @return The repository name for the source code.
     */

    public String getLocation() {
        return this.location;
    }

    /**
     *

     * The repository name for the source code.
     *

     *
     * @param location
     *        The repository name for the source code.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public SourceCode withLocation(String location) {
        setLocation(location);
        return this;
    }

    /**
     *

     * The branch of the source code.
     *

     *
     * @param sourceVersion
     *        The branch of the source code.
     */

    public void setSourceVersion(String sourceVersion) {
        this.sourceVersion = sourceVersion;
    }

    /**
     *

     * The branch of the source code.
     *

     *
     * @return The branch of the source code.
     */

    public String getSourceVersion() {
        return this.sourceVersion;
    }

    /**
     *

     * The branch of the source code.
     *

     *
     * @param sourceVersion
     *        The branch of the source code.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public SourceCode withSourceVersion(String sourceVersion) {
        setSourceVersion(sourceVersion);
        return this;
    }

    /**
     *

     * The type of repository to use for the source code.
     *

     *
     * @param versionControl
     *        The type of repository to use for the source code.
     * @see VersionControl
     */

    public void setVersionControl(String versionControl) {
        this.versionControl = versionControl;
    }

    /**
     *

     * The type of repository to use for the source code.
     *

     *
     * @return The type of repository to use for the source code.
     * @see VersionControl
     */

    public String getVersionControl() {
        return this.versionControl;
    }

    /**
     *

     * The type of repository to use for the source code.
     *

     *
     * @param versionControl
     *        The type of repository to use for the source code.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see VersionControl
     */

    public SourceCode withVersionControl(String versionControl) {
        setVersionControl(versionControl);
        return this;
    }

    /**
     *

     * The type of repository to use for the source code.
     *

     *
     * @param versionControl
     *        The type of repository to use for the source code.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see VersionControl
     */

    public SourceCode withVersionControl(VersionControl versionControl) {
        this.versionControl = versionControl.toString();
        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 (getLocation() != null)
            sb.append("Location: ").append(getLocation()).append(",");
        if (getSourceVersion() != null)
            sb.append("SourceVersion: ").append(getSourceVersion()).append(",");
        if (getVersionControl() != null)
            sb.append("VersionControl: ").append(getVersionControl());
        sb.append("}");
        return sb.toString();
    }

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

        if (obj instanceof SourceCode == false)
            return false;
        SourceCode other = (SourceCode) obj;
        if (other.getLocation() == null ^ this.getLocation() == null)
            return false;
        if (other.getLocation() != null && other.getLocation().equals(this.getLocation()) == false)
            return false;
        if (other.getSourceVersion() == null ^ this.getSourceVersion() == null)
            return false;
        if (other.getSourceVersion() != null && other.getSourceVersion().equals(this.getSourceVersion()) == false)
            return false;
        if (other.getVersionControl() == null ^ this.getVersionControl() == null)
            return false;
        if (other.getVersionControl() != null && other.getVersionControl().equals(this.getVersionControl()) == false)
            return false;
        return true;
    }

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

        hashCode = prime * hashCode + ((getLocation() == null) ? 0 : getLocation().hashCode());
        hashCode = prime * hashCode + ((getSourceVersion() == null) ? 0 : getSourceVersion().hashCode());
        hashCode = prime * hashCode + ((getVersionControl() == null) ? 0 : getVersionControl().hashCode());
        return hashCode;
    }

    @Override
    public SourceCode clone() {
        try {
            return (SourceCode) 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.migrationhubstrategyrecommendations.model.transform.SourceCodeMarshaller.getInstance().marshall(this, protocolMarshaller);
    }
}


text:
require 'spec_helper'
require 'puppet_spec/compiler'

describe Puppet::Parser::Scope do
  before :each do
    @scope = Puppet::Parser::Scope.new(
      Puppet::Parser::Compiler.new(Puppet::Node.new("foo"))
    )
    @scope.source = Puppet::Resource::Type.new(:node, :foo)
    @topscope = @scope.compiler.topscope
    @scope.parent = @topscope
  end

  describe ".new_for_test_harness" do
    let(:node_name) { "node_name_foo" }
    let(:scope) { described_class.new_for_test_harness(node_name) }

    it "should be a kind of Scope" do
      scope.should be_a_kind_of Puppet::Parser::Scope
    end
    it "should set the source to a node resource" do
      scope.source.should be_a_kind_of Puppet::Resource::Type
    end
    it "should have a compiler" do
      scope.compiler.should be_a_kind_of Puppet::Parser::Compiler
    end
    it "should set the parent to the compiler topscope" do
      scope.parent.should be scope.compiler.topscope
    end
  end

  it "should return a scope for use in a test harness" do
    described_class.new_for_test_harness("node_name_foo").should be_a_kind_of Puppet::Parser::Scope
  end

  it "should be able to retrieve class scopes by name" do
    @scope.class_set "myname", "myscope"
    @scope.class_scope("myname").should == "myscope"
  end

  it "should be able to retrieve class scopes by object" do
    klass = mock 'ast_class'
    klass.expects(:name).returns("myname")
    @scope.class_set "myname", "myscope"
    @scope.class_scope(klass).should == "myscope"
  end

  it "should be able to retrieve its parent module name from the source of its parent type" do
    @topscope.source = Puppet::Resource::Type.new(:hostclass, :foo, :module_name => "foo")

    @scope.parent_module_name.should == "foo"
  end

  it "should return a nil parent module name if it has no parent" do
    @topscope.parent_module_name.should be_nil
  end

  it "should return a nil parent module name if its parent has no source" do
    @scope.parent_module_name.should be_nil
  end

  it "should get its environment from its compiler" do
    env = Puppet::Node::Environment.new
    compiler = stub 'compiler', :environment => env, :is_a? => true
    scope = Puppet::Parser::Scope.new(compiler)
    scope.environment.should equal(env)
  end

  it "should fail if no compiler is supplied" do
    expect {
      Puppet::Parser::Scope.new
    }.to raise_error(ArgumentError, /wrong number of arguments/)
  end

  it "should fail if something that isn't a compiler is supplied" do
    expect {
      Puppet::Parser::Scope.new(:compiler => true)
    }.to raise_error(Puppet::DevError, /you must pass a compiler instance/)
  end

  it "should use the resource type collection helper to find its known resource types" do
    Puppet::Parser::Scope.ancestors.should include(Puppet::Resource::TypeCollectionHelper)
  end

  describe "when custom functions are called" do
    let(:env) { Puppet::Node::Environment.new('testing') }
    let(:compiler) { Puppet::Parser::Compiler.new(Puppet::Node.new('foo', :environment => env)) }
    let(:scope) { Puppet::Parser::Scope.new(compiler) }

    it "calls methods prefixed with function_ as custom functions" do
      scope.function_sprintf(["%b", 123]).should == "1111011"
    end

    it "raises an error when arguments are not passed in an Array" do
      expect do
        scope.function_sprintf("%b", 123)
      end.to raise_error ArgumentError, /custom functions must be called with a single array that contains the arguments/
    end

    it "raises an error on subsequent calls when arguments are not passed in an Array" do
      scope.function_sprintf(["first call"])

      expect do
        scope.function_sprintf("%b", 123)
      end.to raise_error ArgumentError, /custom functions must be called with a single array that contains the arguments/
    end

    it "raises NoMethodError when the not prefixed" do
      expect { scope.sprintf(["%b", 123]) }.to raise_error(NoMethodError)
    end

    it "raises NoMethodError when prefixed with function_ but it doesn't exist" do
      expect { scope.function_fake_bs(['cows']) }.to raise_error(NoMethodError)
    end
  end

  describe "when initializing" do
    it "should extend itself with its environment's Functions module as well as the default" do
      env = Puppet::Node::Environment.new("myenv")
      root = Puppet::Node::Environment.root
      compiler = stub 'compiler', :environment => env, :is_a? => true

      scope = Puppet::Parser::Scope.new(compiler)
      scope.singleton_class.ancestors.should be_include(Puppet::Parser::Functions.environment_module(env))
      scope.singleton_class.ancestors.should be_include(Puppet::Parser::Functions.environment_module(root))
    end

    it "should extend itself with the default Functions module if its environment is the default" do
      root     = Puppet::Node::Environment.root
      node     = Puppet::Node.new('localhost')
      compiler = Puppet::Parser::Compiler.new(node)
      scope    = Puppet::Parser::Scope.new(compiler)
      scope.singleton_class.ancestors.should be_include(Puppet::Parser::Functions.environment_module(root))
    end
  end

  describe "when looking up a variable" do
    it "should support :lookupvar and :setvar for backward compatibility" do
      @scope.setvar("var", "yep")
      @scope.lookupvar("var").should == "yep"
    end

    it "should fail if invoked with a non-string name" do
      expect { @scope[:foo] }.to raise_error(Puppet::ParseError, /Scope variable name .* not a string/)
      expect { @scope[:foo] = 12 }.to raise_error(Puppet::ParseError, /Scope variable name .* not a string/)
    end

    it "should return nil for unset variables" do
      @scope["var"].should be_nil
    end

    it "should be able to look up values" do
      @scope["var"] = "yep"
      @scope["var"].should == "yep"
    end

    it "should be able to look up hashes" do
      @scope["var"] = {"a" => "b"}
      @scope["var"].should == {"a" => "b"}
    end

    it "should be able to look up variables in parent scopes" do
      @topscope["var"] = "parentval"
      @scope["var"].should == "parentval"
    end

    it "should prefer its own values to parent values" do
      @topscope["var"] = "parentval"
      @scope["var"] = "childval"
      @scope["var"].should == "childval"
    end

    it "should be able to detect when variables are set" do
      @scope["var"] = "childval"
      @scope.should be_include("var")
    end

    it "does not allow changing a set value" do
      @scope["var"] = "childval"
      expect {
        @scope["var"] = "change"
      }.to raise_error(Puppet::Error, "Cannot reassign variable var")
    end

    it "should be able to detect when variables are not set" do
      @scope.should_not be_include("var")
    end

    it "should support iteration over its variables" do
      @scope["one"] = "two"
      @scope["three"] = "four"
      hash = {}
      @scope.each { |name, value| hash[name] = value }
      hash.should == {"one" => "two", "three" => "four" }
    end

    it "should include Enumerable" do
      @scope.singleton_class.ancestors.should be_include(Enumerable)
    end

    describe "and the variable is qualified" do
      before :each do
        @known_resource_types = @scope.known_resource_types

        node      = Puppet::Node.new('localhost')
        @compiler = Puppet::Parser::Compiler.new(node)
      end

      def newclass(name)
        @known_resource_types.add Puppet::Resource::Type.new(:hostclass, name)
      end

      def create_class_scope(name)
        klass = newclass(name)

        catalog = Puppet::Resource::Catalog.new
        catalog.add_resource(Puppet::Parser::Resource.new("stage", :main, :scope => Puppet::Parser::Scope.new(@compiler)))

        Puppet::Parser::Resource.new("class", name, :scope => @scope, :source => mock('source'), :catalog => catalog).evaluate

        @scope.class_scope(klass)
      end

      it "should be able to look up explicitly fully qualified variables from main" do
        Puppet.expects(:deprecation_warning).never
        other_scope = create_class_scope("")

        other_scope["othervar"] = "otherval"

        @scope["::othervar"].should == "otherval"
      end

      it "should be able to look up explicitly fully qualified variables from other scopes" do
        Puppet.expects(:deprecation_warning).never
        other_scope = create_class_scope("other")

        other_scope["var"] = "otherval"

        @scope["::other::var"].should == "otherval"
      end

      it "should be able to look up deeply qualified variables" do
        Puppet.expects(:deprecation_warning).never
        other_scope = create_class_scope("other::deep::klass")

        other_scope["var"] = "otherval"

        @scope["other::deep::klass::var"].should == "otherval"
      end

      it "should return nil for qualified variables that cannot be found in other classes" do
        other_scope = create_class_scope("other::deep::klass")

        @scope["other::deep::klass::var"].should be_nil
      end

      it "should warn and return nil for qualified variables whose classes have not been evaluated" do
        klass = newclass("other::deep::klass")
        @scope.expects(:warning)
        @scope["other::deep::klass::var"].should be_nil
      end

      it "should warn and return nil for qualified variables whose classes do not exist" do
        @scope.expects(:warning)
        @scope["other::deep::klass::var"].should be_nil
      end

      it "should return nil when asked for a non-string qualified variable from a class that does not exist" do
        @scope.stubs(:warning)
        @scope["other::deep::klass::var"].should be_nil
      end

      it "should return nil when asked for a non-string qualified variable from a class that has not been evaluated" do
        @scope.stubs(:warning)
        klass = newclass("other::deep::klass")
        @scope["other::deep::klass::var"].should be_nil
      end
    end
  end

  describe "when variables are set with append=true" do
    it "should raise error if the variable is already defined in this scope" do
      @scope.setvar("var", "1", :append => false)
      expect {
        @scope.setvar("var", "1", :append => true)
      }.to raise_error(
        Puppet::ParseError,
        "Cannot append, variable var is defined in this scope"
      )
    end

    it "should lookup current variable value" do
      @scope.expects(:[]).with("var").returns("2")
      @scope.setvar("var", "1", :append => true)
    end

    it "should store the concatenated string '42'" do
      @topscope.setvar("var", "4", :append => false)
      @scope.setvar("var", "2", :append => true)
      @scope["var"].should == "42"
    end

    it "should store the concatenated array [4,2]" do
      @topscope.setvar("var", [4], :append => false)
      @scope.setvar("var", [2], :append => true)
      @scope["var"].should == [4,2]
    end

    it "should store the merged hash {a => b, c => d}" do
      @topscope.setvar("var", {"a" => "b"}, :append => false)
      @scope.setvar("var", {"c" => "d"}, :append => true)
      @scope["var"].should == {"a" => "b", "c" => "d"}
    end

    it "should raise an error when appending a hash with something other than another hash" do
      @topscope.setvar("var", {"a" => "b"}, :append => false)

      expect {
        @scope.setvar("var", "not a hash", :append => true)
      }.to raise_error(
        ArgumentError,
        "Trying to append to a hash with something which is not a hash is unsupported"
      )
    end
  end

  describe "when calling number?" do
    it "should return nil if called with anything not a number" do
      Puppet::Parser::Scope.number?([2]).should be_nil
    end

    it "should return a Fixnum for a Fixnum" do
      Puppet::Parser::Scope.number?(2).should be_an_instance_of(Fixnum)
    end

    it "should return a Float for a Float" do
      Puppet::Parser::Scope.number?(2.34).should be_an_instance_of(Float)
    end

    it "should return 234 for '234'" do
      Puppet::Parser::Scope.number?("234").should == 234
    end

    it "should return nil for 'not a number'" do
      Puppet::Parser::Scope.number?("not a number").should be_nil
    end

    it "should return 23.4 for '23.4'" do
      Puppet::Parser::Scope.number?("23.4").should == 23.4
    end

    it "should return 23.4e13 for '23.4e13'" do
      Puppet::Parser::Scope.number?("23.4e13").should == 23.4e13
    end

    it "should understand negative numbers" do
      Puppet::Parser::Scope.number?("-234").should == -234
    end

    it "should know how to convert exponential float numbers ala '23e13'" do
      Puppet::Parser::Scope.number?("23e13").should == 23e13
    end

    it "should understand hexadecimal numbers" do
      Puppet::Parser::Scope.number?("0x234").should == 0x234
    end

    it "should understand octal numbers" do
      Puppet::Parser::Scope.number?("0755").should == 0755
    end

    it "should return nil on malformed integers" do
      Puppet::Parser::Scope.number?("0.24.5").should be_nil
    end

    it "should convert strings with leading 0 to integer if they are not octal" do
      Puppet::Parser::Scope.number?("0788").should == 788
    end

    it "should convert strings of negative integers" do
      Puppet::Parser::Scope.number?("-0788").should == -788
    end

    it "should return nil on malformed hexadecimal numbers" do
      Puppet::Parser::Scope.number?("0x89g").should be_nil
    end
  end

  describe "when using ephemeral variables" do
    it "should store the variable value" do
      @scope.setvar("1", :value, :ephemeral => true)

      @scope["1"].should == :value
    end

    it "should remove the variable value when unset_ephemeral_var is called" do
      @scope.setvar("1", :value, :ephemeral => true)
      @scope.stubs(:parent).returns(nil)

      @scope.unset_ephemeral_var

      @scope["1"].should be_nil
    end

    it "should not remove classic variables when unset_ephemeral_var is called" do
      @scope['myvar'] = :value1
      @scope.setvar("1", :value2, :ephemeral => true)
      @scope.stubs(:parent).returns(nil)

      @scope.unset_ephemeral_var

      @scope["myvar"].should == :value1
    end

    it "should raise an error when setting it again" do
      @scope.setvar("1", :value2, :ephemeral => true)
      expect {
        @scope.setvar("1", :value3, :ephemeral => true)
      }.to raise_error(Puppet::ParseError, /Cannot reassign variable 1/)
    end

    it "should declare ephemeral number only variable names" do
      @scope.ephemeral?("0").should be_true
    end

    it "should not declare ephemeral other variable names" do
      @scope.ephemeral?("abc0").should be_nil
    end

    describe "with more than one level" do
      it "should prefer latest ephemeral scopes" do
        @scope.setvar("0", :earliest, :ephemeral => true)
        @scope.new_ephemeral
        @scope.setvar("0", :latest, :ephemeral => true)
        @scope["0"].should == :latest
      end

      it "should be able to report the current level" do
        @scope.ephemeral_level.should == 1
        @scope.new_ephemeral
        @scope.ephemeral_level.should == 2
      end

      it "should check presence of an ephemeral variable accross multiple levels" do
        @scope.new_ephemeral
        @scope.setvar("1", :value1, :ephemeral => true)
        @scope.new_ephemeral
        @scope.setvar("0", :value2, :ephemeral => true)
        @scope.new_ephemeral
        @scope.ephemeral_include?("1").should be_true
      end

      it "should return false when an ephemeral variable doesn't exist in any ephemeral scope" do
        @scope.new_ephemeral
        @scope.setvar("1", :value1, :ephemeral => true)
        @scope.new_ephemeral
        @scope.setvar("0", :value2, :ephemeral => true)
        @scope.new_ephemeral
        @scope.ephemeral_include?("2").should be_false
      end

      it "should get ephemeral values from earlier scope when not in later" do
        @scope.setvar("1", :value1, :ephemeral => true)
        @scope.new_ephemeral
        @scope.setvar("0", :value2, :ephemeral => true)
        @scope["1"].should == :value1
      end

      describe "when calling unset_ephemeral_var without a level" do
        it "should remove all the variables values"  do
          @scope.setvar("1", :value1, :ephemeral => true)
          @scope.new_ephemeral
          @scope.setvar("1", :value2, :ephemeral => true)

          @scope.unset_ephemeral_var

          @scope["1"].should be_nil
        end
      end

      describe "when calling unset_ephemeral_var with a level" do
        it "should remove ephemeral scopes up to this level" do
          @scope.setvar("1", :value1, :ephemeral => true)
          @scope.new_ephemeral
          @scope.setvar("1", :value2, :ephemeral => true)
          @scope.new_ephemeral
          @scope.setvar("1", :value3, :ephemeral => true)

          @scope.unset_ephemeral_var(2)

          @scope["1"].should == :value2
        end
      end
    end
  end

  context "when using ephemeral as local scope" do
    it "should store all variables in local scope" do
      @scope.new_ephemeral true
      @scope.setvar("apple", :fruit)
      @scope["apple"].should == :fruit
    end

    it "should remove all local scope variables on unset" do
      @scope.new_ephemeral true
      @scope.setvar("apple", :fruit)
      @scope["apple"].should == :fruit
      @scope.unset_ephemeral_var
      @scope["apple"].should == nil
    end
    it "should be created from a hash" do
      @scope.ephemeral_from({ "apple" => :fruit, "strawberry" => :berry})
      @scope["apple"].should == :fruit
      @scope["strawberry"].should == :berry
    end
  end

  describe "when setting ephemeral vars from matches" do
    before :each do
      @match = stub 'match', :is_a? => true
      @match.stubs(:[]).with(0).returns("this is a string")
      @match.stubs(:captures).returns([])
      @scope.stubs(:setvar)
    end

    it "should accept only MatchData" do
      expect {
        @scope.ephemeral_from("match")
      }.to raise_error(ArgumentError, /Invalid regex match data/)
    end

    it "should set $0 with the full match" do
      @scope.expects(:setvar).with { |*arg| arg[0] == "0" and arg[1] == "this is a string" and arg[2][:ephemeral] }

      @scope.ephemeral_from(@match)
    end

    it "should set every capture as ephemeral var" do
      @match.stubs(:captures).returns([:capture1,:capture2])
      @scope.expects(:setvar).with { |*arg| arg[0] == "1" and arg[1] == :capture1 and arg[2][:ephemeral] }
      @scope.expects(:setvar).with { |*arg| arg[0] == "2" and arg[1] == :capture2 and arg[2][:ephemeral] }

      @scope.ephemeral_from(@match)
    end

    it "should create a new ephemeral level" do
      @scope.expects(:new_ephemeral)
      @scope.ephemeral_from(@match)
    end
  end

  it "should use its namespaces to find hostclasses" do
    klass = @scope.known_resource_types.add Puppet::Resource::Type.new(:hostclass, "a::b::c")
    @scope.add_namespace "a::b"
    @scope.find_hostclass("c").should equal(klass)
  end

  it "should use its namespaces to find definitions" do
    define = @scope.known_resource_types.add Puppet::Resource::Type.new(:definition, "a::b::c")
    @scope.add_namespace "a::b"
    @scope.find_definition("c").should equal(define)
  end

  describe "when managing defaults" do
    it "should be able to set and lookup defaults" do
      param = Puppet::Parser::Resource::Param.new(:name => :myparam, :value => "myvalue", :source => stub("source"))
      @scope.define_settings(:mytype, param)
      @scope.lookupdefaults(:mytype).should == {:myparam => param}
    end

    it "should fail if a default is already defined and a new default is being defined" do
      param = Puppet::Parser::Resource::Param.new(:name => :myparam, :value => "myvalue", :source => stub("source"))
      @scope.define_settings(:mytype, param)
      expect {
        @scope.define_settings(:mytype, param)
      }.to raise_error(Puppet::ParseError, /Default already defined .* cannot redefine/)
    end

    it "should return multiple defaults at once" do
      param1 = Puppet::Parser::Resource::Param.new(:name => :myparam, :value => "myvalue", :source => stub("source"))
      @scope.define_settings(:mytype, param1)
      param2 = Puppet::Parser::Resource::Param.new(:name => :other, :value => "myvalue", :source => stub("source"))
      @scope.define_settings(:mytype, param2)

      @scope.lookupdefaults(:mytype).should == {:myparam => param1, :other => param2}
    end

    it "should look up defaults defined in parent scopes" do
      param1 = Puppet::Parser::Resource::Param.new(:name => :myparam, :value => "myvalue", :source => stub("source"))
      @scope.define_settings(:mytype, param1)

      child_scope = @scope.newscope
      param2 = Puppet::Parser::Resource::Param.new(:name => :other, :value => "myvalue", :source => stub("source"))
      child_scope.define_settings(:mytype, param2)

      child_scope.lookupdefaults(:mytype).should == {:myparam => param1, :other => param2}
    end
  end

  context "#true?" do
    { "a string" => true,
      "true"     => true,
      "false"    => true,
      true       => true,
      ""         => false,
      :undef     => false,
      nil        => false
    }.each do |input, output|
      it "should treat #{input.inspect} as #{output}" do
        Puppet::Parser::Scope.true?(input).should == output
      end
    end
  end

  context "when producing a hash of all variables (as used in templates)" do
    it "should contain all defined variables in the scope" do
      @scope.setvar("orange", :tangerine)
      @scope.setvar("pear", :green)
      @scope.to_hash.should == {'orange' => :tangerine, 'pear' => :green }
    end

    it "should contain variables in all local scopes (#21508)" do
      @scope.new_ephemeral true
      @scope.setvar("orange", :tangerine)
      @scope.setvar("pear", :green)
      @scope.new_ephemeral true
      @scope.setvar("apple", :red)
      @scope.to_hash.should == {'orange' => :tangerine, 'pear' => :green, 'apple' => :red }
    end

    it "should contain all defined variables in the scope and all local scopes" do
      @scope.setvar("orange", :tangerine)
      @scope.setvar("pear", :green)
      @scope.new_ephemeral true
      @scope.setvar("apple", :red)
      @scope.to_hash.should == {'orange' => :tangerine, 'pear' => :green, 'apple' => :red }
    end

    it "should not contain varaibles in match scopes (non local emphemeral)" do
      @scope.new_ephemeral true
      @scope.setvar("orange", :tangerine)
      @scope.setvar("pear", :green)
      @scope.ephemeral_from(/(f)(o)(o)/.match('foo'))
      @scope.to_hash.should == {'orange' => :tangerine, 'pear' => :green }
    end

    it "should delete values that are :undef in inner scope" do
      @scope.new_ephemeral true
      @scope.setvar("orange", :tangerine)
      @scope.setvar("pear", :green)
      @scope.new_ephemeral true
      @scope.setvar("apple", :red)
      @scope.setvar("orange", :undef)
      @scope.to_hash.should == {'pear' => :green, 'apple' => :red }
    end
  end
end


text:
Videos

 Printing Cy

 Another example of printing Pikachu


text:
package fr.imie.service;

import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import fr.imie.model.Personne;

/**
 * Session Bean implementation class PersonneService
 */
@Stateless
public class PersonneService implements PersonneServiceLocal {

	@PersistenceContext
	EntityManager entityManager;

	/**
	 * Default constructor.
	 */
	public PersonneService() {
		// TODO Auto-generated constructor stub
	}

	@Override
	public Personne findById(Personne personne) {
		return entityManager.find(Personne.class, personne.getId());
	}

	@Override
	public List<Personne> findAll() {
		return entityManager.createNamedQuery("Personne.findAll")
				.getResultList();
	}

	@Override
	public void delete(Personne personne) {
		personne = entityManager.merge(personne);
		entityManager.remove(personne);
	}

	@Override
	public Personne update(Personne personne) {
		return entityManager.merge(personne);

	}

	@Override
	public Personne create(Personne personne) {
		entityManager.persist(personne);
		return personne;

	}

}


text:
package com.netflix.spinnaker.echo.pipelinetriggers;

import lombok.extern.slf4j.Slf4j;
import rx.functions.Action1;

@Slf4j
public class LogError implements Action1<Throwable> {
  @Override
  public void call(Throwable throwable) {
    log.error("Observable Failed", throwable);
  }
}


text:
#include "diffusion_2D.hpp"

#if defined(USE_HIP)
#include <hip/hip_runtime.h>
#define BLOCK_SIZE   256
#define BLOCK_SIZE_X 16
#define BLOCK_SIZE_Y 16
#elif defined(USE_CUDA)
#include <cuda_runtime.h>
#define BLOCK_SIZE   256
#define BLOCK_SIZE_X 16
#define BLOCK_SIZE_Y 16
#else
#error Define USE_CUDA or USE_HIP
#endif

// Pack exchange buffers kernel
__global__ void pack_buffers_kernel(const sunindextype nx_loc,
                                    const sunindextype ny_loc,
                                    const realtype *u,
                                    realtype *wbuf, realtype *ebuf,
                                    realtype *sbuf, realtype *nbuf)
{
  // Thread ID
  int i = blockIdx.x * blockDim.x + threadIdx.x;

  // West and East faces
  if (i < ny_loc)
  {
    if (wbuf) wbuf[i] = u[i * nx_loc];
    if (ebuf) ebuf[i] = u[(i + 1) * nx_loc - 1];
  }

  // South and North faces
  if (i < nx_loc)
  {
    if (sbuf) sbuf[i] = u[i];
    if (nbuf) nbuf[i] = u[i + (ny_loc - 1) * nx_loc];
  }
}

// Pack exchange buffers
int UserData::pack_buffers(const N_Vector u)
{
  // Access data array
  const realtype *uarray = N_VGetDeviceArrayPointer(N_VGetLocalVector_MPIPlusX(u));
  if (check_flag((void *) uarray, "N_VGetDeviceArrayPointer", 0)) return -1;

  sunindextype maxdim = max(nx_loc, ny_loc);
  dim3 block(BLOCK_SIZE);
  dim3 grid(ICEIL(maxdim, BLOCK_SIZE));

  pack_buffers_kernel<<<grid,block>>>(nx_loc, ny_loc, uarray,
                                      Wsend, Esend, Ssend, Nsend);

  return 0;
}

// Allocate exchange buffers
int UserData::allocate_buffers()
{
  if (HaveNbrW)
  {
#if defined(USE_HIP)
    hipMalloc(&Wrecv, ny_loc * sizeof(realtype));
    hipMalloc(&Wsend, ny_loc * sizeof(realtype));
#elif defined(USE_CUDA)
    cudaMalloc(&Wrecv, ny_loc * sizeof(realtype));
    cudaMalloc(&Wsend, ny_loc * sizeof(realtype));
#else
#error Define USE_CUDA or USE_HIP
#endif
  }

  if (HaveNbrE)
  {
#if defined(USE_HIP)
    hipMalloc(&Erecv, ny_loc * sizeof(realtype));
    hipMalloc(&Esend, ny_loc * sizeof(realtype));
#elif defined(USE_CUDA)
    cudaMalloc(&Erecv, ny_loc * sizeof(realtype));
    cudaMalloc(&Esend, ny_loc * sizeof(realtype));
#else
#error Define USE_CUDA or USE_HIP
#endif
  }

  if (HaveNbrS)
  {
#if defined(USE_HIP)
    hipMalloc(&Srecv, nx_loc * sizeof(realtype));
    hipMalloc(&Ssend, nx_loc * sizeof(realtype));
#elif defined(USE_CUDA)
    cudaMalloc(&Srecv, nx_loc * sizeof(realtype));
    cudaMalloc(&Ssend, nx_loc * sizeof(realtype));
#else
#error Define USE_CUDA or USE_HIP
#endif
  }

  if (HaveNbrN)
  {
#if defined(USE_HIP)
    hipMalloc(&Nrecv, nx_loc * sizeof(realtype));
    hipMalloc(&Nsend, nx_loc * sizeof(realtype));
#elif defined(USE_CUDA)
    cudaMalloc(&Nrecv, nx_loc * sizeof(realtype));
    cudaMalloc(&Nsend, nx_loc * sizeof(realtype));
#else
#error Define USE_CUDA or USE_HIP
#endif
  }

  return 0;
}

// Free exchange buffers
int UserData::free_buffers()
{
#if defined(USE_HIP)
  if (Wrecv != NULL)  hipFree(Wrecv);
  if (Wsend != NULL)  hipFree(Wsend);
  if (Erecv != NULL)  hipFree(Erecv);
  if (Esend != NULL)  hipFree(Esend);
  if (Srecv != NULL)  hipFree(Srecv);
  if (Ssend != NULL)  hipFree(Ssend);
  if (Nrecv != NULL)  hipFree(Nrecv);
  if (Nsend != NULL)  hipFree(Nsend);
#elif defined(USE_CUDA)
  if (Wrecv != NULL)  cudaFree(Wrecv);
  if (Wsend != NULL)  cudaFree(Wsend);
  if (Erecv != NULL)  cudaFree(Erecv);
  if (Esend != NULL)  cudaFree(Esend);
  if (Srecv != NULL)  cudaFree(Srecv);
  if (Ssend != NULL)  cudaFree(Ssend);
  if (Nrecv != NULL)  cudaFree(Nrecv);
  if (Nsend != NULL)  cudaFree(Nsend);
#else
#error Define USE_CUDA or USE_HIP
#endif

  return 0;
}


text:
#ifndef LINUX_MMC_SH_MOBILE_SDHI_H
#define LINUX_MMC_SH_MOBILE_SDHI_H

#include <linux/types.h>

struct platform_device;
struct tmio_mmc_data;

struct sh_mobile_sdhi_info {
	int dma_slave_tx;
	int dma_slave_rx;
	unsigned long tmio_flags;
	unsigned long tmio_caps;
	u32 tmio_ocr_mask;	/* available MMC voltages */
	struct tmio_mmc_data *pdata;
	void (*set_pwr)(struct platform_device *pdev, int state);
	int (*get_cd)(struct platform_device *pdev);
};

#endif /* LINUX_MMC_SH_MOBILE_SDHI_H */


text:
@implementation NSSet (XSet)

@end

@implementation NSMutableSet (XMutableSet)

- (void)x_addObject:(id)object {
#ifdef DEBUG
    [self addObject:object];
#else
    if (object) {
        [self addObject:object];
    }
#endif
}

- (void)x_removeObject:(id)object {
#ifdef DEBUG
    [self removeObject:object];
#else
    if (object) {
        [self removeObject:object];
    }
#endif
}

@end

@implementation NSCountedSet (XCountedSet)

- (void)x_addObject:(id)object {
#ifdef DEBUG
    [self addObject:object];
#else
    if (object) {
        [self addObject:object];
    }
#endif
}

- (void)x_removeObject:(id)object {
#ifdef DEBUG
    [self removeObject:object];
#else
    if (object) {
        [self removeObject:object];
    }
#endif
}

@end


text:
namespace ContosoUniversity.Infrastructure
{
    using System;
    using System.Web.Mvc;
    using System.Web.Routing;

    public class ControllerFactory : DefaultControllerFactory
    {
        protected override Type GetControllerType(RequestContext requestContext, string controllerName)
        {
            return
                typeof (ControllerFactory).Assembly.GetType("ContosoUniversity.Features." + controllerName +
                                                            ".UiController");
        }
    }
}


text:
<Addin namespace   = "MonoDevelop"
       id          = "ThoseMissingFeatures"
       name        = "Those Missing Features"
       author      = "Diego Giacomelli"
       copyright   = "MIT/X11"
       url         = "http://github.com/giacomelli/MonoDevelop.ThoseMissingFeatures"
       description = "Those missing features we would like to see in MonoDevelop."
       category    = "IDE extensions"
       version     = "0.1">

	<Dependencies>
      	<Addin id="::MonoDevelop.Ide" version="4.0"/>
  	</Dependencies>

  	<!--- Transform All Templates config -->
  	<Extension path = "/MonoDevelop/Ide/Commands/Project">
  		<Command
  	  		id = "MonoDevelop.ThoseMissingFeatures.Command.TransformAllTemplates"
     	    _label = "Transform all templates"
         	_description = "Transform all T4 templates"
         	defaultHandler = "MonoDevelop.ThoseMissingFeatures.Commands.TransformAllTemplatesHandler"/>
	</Extension>

	<Extension path = "/MonoDevelop/Ide/MainMenu/Project">
		<CommandItem
			id="MonoDevelop.ThoseMissingFeatures.Command.TransformAllTemplates"
			insertafter = "MonoDevelop.Ide.Commands.ProjectCommands.AddReference"
            insertbefore = "ExportSeparator" />
	</Extension>

	<Extension path = "/MonoDevelop/Ide/ContextMenu/ProjectPad">
        <Condition id="ItemType" value="Project">
                <CommandItem
                        id = "MonoDevelop.ThoseMissingFeatures.Command.TransformAllTemplates"
                        insertafter = "MonoDevelop.Ide.Commands.ProjectCommands.AddReference"
                        insertbefore = "AddSectionEnd" />
        </Condition>
	</Extension>

</Addin>


text:
declare namespace _default {
    const ADD: string;
    const REMOVE: string;
}
export default _default;
//# sourceMappingURL=CollectionEventType.d.ts.map


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.buildship.core.launch.runconfiguration">
	<listAttribute key="arguments"/>
	<stringAttribute key="gradle_distribution" value="GRADLE_DISTRIBUTION(WRAPPER)"/>
	<listAttribute key="jvm_arguments"/>
	<booleanAttribute key="show_console_view" value="true"/>
	<booleanAttribute key="show_execution_view" value="true"/>
	<listAttribute key="tasks">
		<listEntry value="{gradlePrepareTask}"/>
	</listAttribute>
	<stringAttribute key="working_dir" value="${workspace_loc:/{projectName}}"/>
</launchConfiguration>


text:
using Hudl.Mjolnir.External;
using System;

namespace Hudl.Mjolnir.Log
{
    internal class DefaultMjolnirLogFactory : IMjolnirLogFactory
    {
        public IMjolnirLog<T> CreateLog<T>()
        {
            return new DefaultMjolnirLog<T>();
        }
    }
}


text:
<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "lecture".
 *
 * @property integer $id
 * @property string $time
 * @property string $address
 * @property string $subject
 * @property string $content
 * @property string $lecturer
 * @property string $lecturer_info
 * @property string $hint
 * @property string $poster
 * @property string $icon
 */
class Lecture extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'lecture';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['time', 'address', 'subject', 'lecturer'], 'required'],
            [['time'], 'safe'],
            [['content', 'lecturer_info', 'hint', 'poster', 'icon'], 'string'],
            [['address', 'subject', 'lecturer'], 'string', 'max' => 255],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'time' => Yii::t('app', 'Time'),
            'address' => Yii::t('app', 'Address'),
            'subject' => Yii::t('app', 'Subject'),
            'content' => Yii::t('app', 'Content'),
            'lecturer' => Yii::t('app', 'Lecturer'),
            'lecturer_info' => Yii::t('app', 'Lecturer Info'),
            'hint' => Yii::t('app', 'Hint'),
            'poster' => Yii::t('app', 'Poster'),
            'icon' => Yii::t('app', 'Icon'),
        ];
    }
}


text:
Easy way to embed [GeoMixer](http://geomixer.ru/index.php/en) based maps into your applications or create a new ones with extended and configurable set of UI controls and widgets for [Leaflet](http://leafletjs.com/).

### Components
- Online application editor hosted on Kosmosnimki server
- Source code library on Github

![Winnie workflow](http://images.kosmosnimki.ru/demo/winnie/winnie-scheme.png)

### Features
- GeoMixer based data visualization
- Leaflet plugins
- Widgets (so called "Winnie-widgets"):
  - [Base Maps layers](https://github.com/ScanEx/Leaflet.gmxBaseLayersManager)
  - Sidebar
  ..- LayersTree
  ..- Objects and geometry
  - Storytelling
  ..- Bookmarks on the map
  - Balloon image gallery
  - Calendar

### Config reference

https://github.com/Kosmosnimki/winnie/blob/master/docs/config.md (currently in Russian)

### Examples

Some examples of what kind of applications can be created using "Winnie":
check the ["Gallery"](http://winnie.kosmosnimki.ru/gallery.html)

### License

© 2015 Kosmosnimki Ru Ltd. (SCANEX Group), published under Apache Public License 2.0

### Getting started

You have two basic work scenarios:

#### 1
1. Go to the [Editor](http://winnie.kosmosnimki.ru) from your GeoMixer project using option "Share" and choose one of the templates:

	![](http://images.kosmosnimki.ru/demo/winnie/winnie-editor.png)

2. Edit config file to customize base UI settings accordingly to config options (see [config reference](https://github.com/Kosmosnimki/winnie/blob/master/docs/config.md) for more detailed description)

3. Save final map application, get permalink and embed it into your site or blog - that's it! (you can return and edit it anytime, following the saved permalink)

#### 2
You can also download the library and customize the source code if you like

### Future plans
- To make "Winnie" capable of interacting with any OGC-compatible backend
- To finalize Winnie builder
- To fork "mobile-first" approach of Winnie based widgets with more mobile adjustable components

### Support
The project was supported by WWF

### Описание
Простой способ создавать картографические приложения, используя API [GeoMixer](http://geomixer.ru). Поддерживает набор готовых контролов и виджетов для [Leaflet](http://leaflet.js)

### Возможности
- Встроенная визуализация данных с помощью Геомиксер (подробнее о платформе http://geomixer.ru)
- Поддержка плагинов Leaflet
- Виджеты:
  - Базовые карты
  - Дерево слоев
  - Storytelling ("картографические сюжеты")
  - Закладки на карте
  - Фотогаллерея в балунах
  - Строка поиска*

### Справочник конфиг-файла

https://github.com/Kosmosnimki/winnie/blob/master/docs/config.md

### Примеры

["Галерея"](http://winnie.kosmosnimki.ru/gallery.html)

### Лицензия

© 2015 Kosmosnimki Ru (SCANEX Group), открытая лицензия [Apache Public License 2.0](http://www.apache.org/licenses/LICENSE-2.0)

### Начало работы

Базовые сценарии:

1. Создать проект в GeoMixer, используя "Share", перейти в [Winnie](http://winnie.kosmosnimki.ru/), выбрать один из шаблонов UI.
2. Отредактировать конфигурационный файл, если необходимо (см [config reference](https://github.com/Kosmosnimki/winnie/blob/master/docs/config.md) для более детального описания)
3. Сохранить финальную версию конфигурационного файла. Полученный пермалинк вставьте в свой сайт или блог, используя "код для вставки" (вы можете редактировать или возвращаться к предыдущей версии, используя сохраненный пермалинк)

### Дальнейшие планы
- Сделать "Winnie" backend-независимым, чтобы библиотека могла работать с любым ГИС сервером
- Доделать сборщик для локальной сборки
- UI-компоненты для мобильных устройств и адаптивный дизайн

### Поддержка
Проект "Винни" был поддержан WWF


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>extras.standardSegment Module — TigerShark 3.1 documentation</title>

    <link rel="stylesheet" href="../_static/nature.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />

    <link rel="top" title="TigerShark 3.1 documentation" href="../index.html" />
    <link rel="up" title="Implementation" href="index.html" />
    <link rel="next" title="test Package" href="test.html" />
    <link rel="prev" title="claims Module" href="claims.html" />

Navigation

          index

          modules |

          next |

          previous |

TigerShark 3.1 documentation »

Implementation »

<tt class="docutils literal">extras.standardSegment</tt> Module¶

Define <tt class="xref py py-mod docutils literal">X12.parse</tt> structures for some standard X12 Segments.

These are definitions of some standard Segments without a lot
of supporting detail.  This can be used (or extended) to cover
cases where X12 segment metadata is not available.

This module includes a conversion to emit “better-than-nothing”
<tt class="xref py py-class docutils literal">X12.parse.Segment</tt> definitions for a few standard
X12 Segments.

<col class="field-name" />
<col class="field-body" />

var isa:	ISA Segment

var gs:	GS Segment

var st:	ST Segment

var se:	SE Segment

var ge:	GE Segment

var iea:	IEA Segment

<tt class="descclassname">extras.standardSegment.</tt><tt class="descname">buildSegment</tt><big>(</big>name, desc, fieldText<big>)</big>¶

Convert a block of text to a Segment definition.
The block of text has one Element defined on each line.
The Element definition is an Element name, one or more spaces, and the
element description.

<col class="field-name" />
<col class="field-body" />

Parameters:

name – the name of the segment

desc – the description of the segment

fieldText – a block of text, with one Element name and description per line.

Returns:
<tt class="xref py py-class docutils literal">X12.parse.Segment</tt> definition

Previous topic

<tt class="docutils literal docutils literal">claims</tt> Module

Next topic

<tt class="docutils literal">test</tt> Package

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

    Enter search terms or a module, class or function name.

Navigation

          index

          modules |

          next |

          previous |

TigerShark 3.1 documentation »

Implementation »

        © Copyright 2011, S.Lott.
      Created using Sphinx 1.1.2.


text:
package com.ericliudeveloper.sharedbillhelper.presenter;

import android.content.Intent;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.MediumTest;
import android.util.Log;

import com.ericliudeveloper.sharedbillhelper.ui.presenter.CalculationResultPresenter;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

import static org.hamcrest.MatcherAssert.assertThat;

/**
 * Created by ericliu on 3/11/2015.
 */
@RunWith(AndroidJUnit4.class)
@MediumTest
public class CalculationResultPresenterTest implements CalculationResultPresenter.CalculationResultFace {
    private final String TAG = this.getClass().getSimpleName();
    private CalculationResultPresenter presenter;

    @Before
    public void setup() {
        presenter = new CalculationResultPresenter(this);
    }

    @Test
    public void sendSMS() {
        presenter.startActionSend();
    }

    @After
    public void tearDown() {
        presenter = null;

    }

    @Override
    public void showTotalAmount(String amount) {

    }

    @Override
    public void showNumberOfMembersPaying(String numMembers) {

    }

    @Override
    public void showNumberOfBillsPaid(String numBills) {

    }

    @Override
    public void startActivity(Intent intent) {
        String textStr = intent.getStringExtra(Intent.EXTRA_TEXT);
        assertThat("String is the same", textStr.startsWith("Total"));
        Log.d(TAG, textStr);
    }
}


text:
HLP-Candidate is Digital Asset's proposed contribution to the Linux Foundation's [Hyperledger](https://www.hyperledger.org/) project. We have made it available as open source to enable others to explore our architecture and design. Digital Asset's intention is to engage rigorously in the Linux Foundation's [Hyperledger](https://www.hyperledger.org/) project as the community establishes itself, and decides on a code base. Once established, we will transition our development focus to the [Hyperledger](https://www.hyperledger.org/) effort, and this code will be maintained as needed for Digital Asset's use.

While we invite contribution to the HLP-Candidate project, we believe that the broader blockchain community's focus should be the [Hyperledger](https://www.hyperledger.org/) project.

This codebase has been renamed to "HLP-Cadidate" but parts of the code reference "hyperledger" as a result of the legacy usage of that term prior to the mark being transferred to the Linux Foundation. This codebase is one of 4 proposal codebases to the official Hyperledger project, and links to the others can be found in the official [Linux Foundation repository](https://github.com/hyperledger/hyperledger). Hyperledger is a trademark of The Linux Foundation. Linux Foundation is a registered trademark of The Linux Foundation. Linux is a registered trademark of Linus Torvalds.

# HLP-Candidate
HLP-Candidate is an enterprise ready blockchain server with a client [API](docs/api.md). HLP-Candidate has a modular [architecture](docs/architecture.md) and [configurable](docs/configuration.md) network architecture.

HLP-Candidate implements an append-only log of financial transactions designed to be replicated at multiple organizations without centralized control. Technology companies today are well aware of the benefits of having a data backbone, or Enterprise Service Bus, to coordinate data across services within the company. The goal of HLP-Candidate is to allow expansion of the data backbone concept to the multi-organization level.

HLP-Candidate is designed to be the lowest level communication and consensus layer and aims to upgrade components of today's global financial infrastructure, which consists of a complex patchwork of systems, protocols, and adapters. We are open sourcing this project with the belief that as a critical part of the new financial infrastructure, this part of the software stack should be commoditized, collaborated on and serve as the robust backbone on which applications can be developed.

What we are making available today is the most recent stable version of a combination of many man years of work across multiple startups: Digital Asset, Bits of Proof, Blockstack, and Hyperledger. However, it is still a work in progress and we are in the process of replacing several components, adding others, and integrating with other open source projects. This particularly relates to security, scalability, and privacy, and is outlined in the roadmap below.

HLP-Candidate was built with the requirements of enterprise architecture in mind by a team that has worked in financial institutions for decades. It has a highly modular design at both the code and runtime levels to allow for integrations with legacy systems. The networking rules are configurable to allow for distinct interoperable consensus groups, each with its own functional and nonfunctional requirements.

HLP-Candidate utilizes the same UTXO/script based transactional decision of Bitcoin and extends it with features required in financial services. While the public Bitcoin blockchain is not suitable for many uses within regulated financial infrastructure, much of its design and mature cryptography has been withstanding attacks in the wild, protecting tokens with a market cap in the billions of dollars. There has been a large amount of venture investment around Bitcoin and a huge body of development work done around it. By conforming to the UTXO model as a de facto standard there is a larger ecosystem of innovation to draw from.

Digital Asset has also started working on a prototype implementation of the [Practical Byzantine Fault Tolerance](docs/pbft.md) consensus module as a replacement for Proof of Work. We are collaborating with many of the other members of the project on the consensus module to ensure there is a scalable, secure, Byzantine Fault Tolerant consensus protocol that can provide settlement finality for wholesale financial institutions.

Other major additions are:
  * [Signed blocks](docs/blocksignature.md)
  * [Multiple native assets](docs/nativeassets.md)

## Roadmap

After being submitted to the Linux Foundation's Hyperledger project, the roadmap will be determined by the Technical Steering Committee and community of contributions. The code base that we are contributing is the latest stable version but we have many more improvements that we will be contributing shortly:

  * Enhanced privacy features
  * Integration with multiple Byzantine Fault Tolerant consensus implementations
  * JNA bindings to a consensus library derived from the Bitcoin consensus library. This will allow for security audit of the patchset defining the divergence from Bitcoin, which has a well understood set of consensus rules
  * Fixes following a 3rd party security audit and static code analysis
  * Support for some of the [Elements Project](docs/elements.md) feature set

## Building and running

### Prerequisites
Version numbers below indicate the versions used.

 * Git 2.4.6 (http://git-scm.com)
 * Maven 3.3.3 (http://maven.apache.org)
 * Java 1.8.0_51 (http://java.oracle.com)
 * JCE 8 (Java Crptography Extension) (http://java.oracle.com)
 * Protobuf compiler 2.5.0 (http://github.com/google/protobuf)
 * lockfile command 3.22 (from procmail package)

#### Optionally a JMS bus provider
 * e.g. Apache ActiveMQ 5.11.1 (http://activemq.apache.org/)

#### Installing Prerequisites on OSX
 * ```brew update```
 * ```brew tap homebrew/versions```
 * ```brew install git```
 * ```brew install maven```
 * Download and install the latest Java 8 dmg file from Oracle
 * Download _Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files for JDK/JRE 8_ from Oracle, which is a zip file. Extract it and copy the `local_policy.jar` and `US_export_policy.jar` files to your your `<java_runtime_home>/lib/security`
 * ```brew install protobuf250```
 * ```brew install procmail``` if the command ```lockfile``` is not available on your OSX version

#### Installing Prerequisites on Ubuntu Linux
 * ```add-apt-repository ppa:webupd8team/java```
 * ```apt-get update```
 * ```apt-get install git maven oracle-java8-installer oracle-java8-unlimited-jce-policy protobuf-compiler procmail```

### Building Steps

 * ```git clone ???```
 * ```cd hyperledger```
 * ```mvn clean package```

The most important results of the build are
 * _server/main/target/hyperledger-server-main-\<version\>-dist.tar.gz_ - for bitcoin-like network
 * _server/pbft/target/hyperledger-server-pbft-\<version\>-dist.tar.gz_ - for PBFT network

## Running

### Setup

It is recommended to copy the resulted *.tar.gz file outside of the project directory and execute the below commands there. The below commands are illustrating running the bitcoin-like network, but the similar steps apply for the other one too.

 * ```tar zxf hyperledger-server-main-<version>-dist.tar.gz```
 * ```cd hyperledger-server-main-<version>```

#### Setup for server and client in two processes connected with ActiveMQ

 * Besides the above steps copy _examples/jmsclient/target/hyperledger-examples-jmsclient-\<version\>.jar_ next to the extracted _hyperledger-server-main-\<version\>_ directory
 * Copy from the extracted _hyperledger-server-main-\<version\>/conf/activemq.xml_ to the _conf_ directory of your ActiveMQ installation

### Starting and stopping

 * ```./start.sh conf/bitcoin1.conf```
 * ```./stop.sh```

The start script accepts a config file parameter. Example config files are in the _conf_ directory. If no parameter is provided then it defaults to the system property _hyperledger.configurationFile_ if it is set, otherwise it defaults to _conf/application.conf_.

Only one instance can run from a directory. If you want to run multiple instances then you have to repeat the setup steps in another location. This is because working files are saved in this directory.

You can change the config files for your needs, details are described [here](docs/configuration.md). Also you can tune the _conf/logback.xml_ file to adjust what and how to log.

#### Starting and stopping server and client in two processes connected with ActiveMQ

 * ```./bin/activemq start``` from the directory of your ActiveMQ
 * ```./start.sh conf/production_with_jms.conf``` from the extracted _hyperledger-server-main-\<version\>_ directory
 * ```java -cp hyperledger-server-main-<version>/hyperledger-server-main-<version>-shaded.jar:hyperledger-examples-jmsclient-<version>.jar Main```

It will print out that _There are 5000000000 satoshis on the genesis address_.

 * ```./stop.sh``` from the extracted _hyperledger-server-main-\<version\>_ directory
 * ```./bin/activemq stop``` from the directory of your ActiveMQ

### Working files

Database is saved into the _data_ directory if LevelDB is configured for storage. (Memory data store is never persisted.) If you want a clean start then remove the entire data directory.

Logs are stored in the _logs_ directory. The actual log file is rolled and compressed in every hour. Oldest ones are deleted if there are too many of them.

Start and stop scripts use _PID.LOCK_ file. Do not remove it manually because then the stop script will not know which process to stop. If it is removed accidentally then you have to use ```kill``` to terminate the process.

## Documentation
 * [Architecture](docs/architecture.md)
 * [Configuration](docs/configuration.md)
 * [API](docs/api.md) (low level API)
 * [Account](docs/accountmodule.md) (high level API)

## Contributing
[How to contribute?](docs/contributing.md)
[Digital Asset's HLP-Candidate Mailing List](https://groups.google.com/a/digitalasset.com/forum/?hl=en#!forum/HLP-Candidate)


text:
enyo.kind({
    name: "SettingsView.SettingsBaseView",
    kind: "FittableRows",
    classes: "onyx-popup-content",
    components: [

            { kind: "onyx.Groupbox", components: [
            { kind: "FittableColumns", components: [
                    { content: $L("Music"), classes: "label" },
                    { fit: true },
                    { name: "isBgSound", style: "width:100px", onChange: "isBgSoundChanged", kind: "onyx.ToggleButton", onContent: $L("Yes"), offContent: $L("No") }
                 ]
            },

            { kind: "FittableColumns", components: [
                    { content: $L("Sound"), classes: "label" },
                    { fit: true },
                    { name: "isSoundEffect", style: "width:100px", onChange: "isSoundEffectChanged", kind: "onyx.ToggleButton", onContent: $L("Yes"), offContent: $L("No") }
                 ]
            }
            ]
            },

        { kind: "onyx.Groupbox", components: [

            { kind: "FittableColumns", style: "border-bottom:none", components: [
                    { content: $L("Reset to default"), classes: "label" },
                    { fit: true },
                    { name: "submit", ontap: "clearData", style: "width:100px", kind: "onyx.Button", content: $L("Reset") },
                 ]
            }
		]
        }
     ],
    create: function () {
        this.inherited(arguments);
    },
    rendered: function () {
        this.inherited(arguments);
        var self = this;
        this.$.isSoundEffect.setValue(app.settings.get('isSoundEffect') ? app.settings.get('isSoundEffect') : false);
        this.$.isBgSound.setValue(app.settings.get('isBgSound') ? app.settings.get('isBgSound') : false);

    },
    isBgSoundChanged: function () {
        app.playAudio('click');
        var isBgSound = this.$.isBgSound.getValue();
        app.settings.save({
            isBgSound: isBgSound
        });
        if (isBgSound) {
            if (window.cordova || window.PhoneGap) {
                if (app.bgMedia)
                    app.bgMedia.stop();
                app.playAudio('bg');
            }
            else {
                app.playAudio('bg');
            }
        }
        else {
            app.stopAudio('bg');
        }
    },
    isSoundEffectChanged: function () {
        app.playAudio('click');
        var isSoundEffect = this.$.isSoundEffect.getValue();
        app.settings.save({
            isSoundEffect: isSoundEffect
        });
    },
    clearData: function () {
        app.playAudio('click');
        var self = this;
        enyoAlert($L("Are you sure?<br>All data will be reset!"), app.$.menuView, {
            cancelText: $L("Cancel"),
            confirmText: $L("Confirm"),
            onConfirm: function (context) {
                window.localStorage.clear();
                if (window.cordova || window.PhoneGap) {
                    location.reload();
                }
                else {
                    enyo.log('refersh local');
                    location.reload();
                }
            }
        });
    }
});


text:
require 'spec_helper'

describe Libvirt::Ruby do
  let(:libvirt) { Libvirt::Ruby }
  let(:p) { Object }

  context "#initialize" do
    before :each do
      libvirt.stub(:virInitialize).with(:int).and_return(true)
      libvirt.stub(:virInitialize).and_return(true)
    end

    after :each do
      libvirt.initialize
    end

    context "when virInitialize is not attached yet" do
      before :each do
        libvirt.stub(:respond_to?).with(:virInitialize).and_return(false)
      end

      it "should attach it" do
        libvirt.should_receive(:virInitialize).with(:int)
      end
    end

    context "when virInitialize is already attached" do
      before :each do
        libvirt.stub(:respond_to?).with(:virInitialize).and_return(true)
      end

      it "should not try to attach it again" do
        libvirt.should_not_receive(:virInitialize).with(:int)
      end
    end

    it "should call virInitialize" do
      libvirt.should_receive(:virInitialize)
    end
  end

  context "#version" do
    before :each do
      libvirt.stub(:virGetVersion).with(:pointer, :string, :pointer, :int).and_return(true)
      FFI::MemoryPointer.stub(:new).with(:ulong).and_return(p)
      libvirt.stub(:virGetVersion).with(p, nil, nil).and_return(true)
      p.stub(:get_ulong).with(0).and_return(8003)
    end

    context "when virGetVersion is not attached yet" do
      before :each do
        libvirt.stub(:respond_to?).with(:virGetVersion).and_return(false)
      end

      it "should attach it" do
        libvirt.should_receive(:virGetVersion).with(:pointer, :string, :pointer, :int)
        libvirt.version
      end
    end

    context "when virGetVersion is already attached" do
      before :each do
        libvirt.stub(:respond_to?).with(:virGetVersion).and_return(true)
      end

      it "should not try to attach it again" do
        libvirt.should_not_receive(:virGetVersion).with(:pointer, :string, :pointer, :int)
        libvirt.version
      end
    end

    it "should return the version" do
      libvirt.version.should == "0.8.3"
    end
  end
end