text:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
	android:layout_width="match_parent"
	android:layout_height="match_parent"
	android:orientation="vertical"
	android:padding="8dp"
	android:stretchColumns="*">
		<TableRow >
		    <EditText android:id="@+id/bearingSelectionText"
			    android:layout_width="match_parent"
			    android:layout_height="wrap_content"
			    android:layout_span="2"
			    android:numeric="decimal|signed"
			    android:inputType="numberDecimal|numberSigned"/>
		</TableRow>

		<TableRow>
			    <Button android:id="@+id/bearingSetButton"
				    android:layout_width="match_parent"
				    android:layout_height="wrap_content"
				    android:text="@string/bearing_selection_dialog_set_button"/>"
			    <Button android:id="@+id/bearingAutoButton"
			        android:layout_width="match_parent"
				    android:layout_height="wrap_content"
			    	android:text="@string/bearing_selection_dialog_auto_button"/>
		</TableRow>
</TableLayout>


text:
<?php

use Doctrine\Common\Annotations\AnnotationRegistry;
use Symfony\Component\ClassLoader\UniversalClassLoader;
use Symfony\Component\ClassLoader\MapClassLoader;

$loader = new UniversalClassLoader();
$loader->registerNamespaces(array(
    'Symfony'          => array(__DIR__.'/../vendor/symfony/src', __DIR__.'/../vendor/bundles'),
    'Sensio'           => __DIR__.'/../vendor/bundles',
    'JMS'              => __DIR__.'/../vendor/bundles',
    'Doctrine\\Common' => __DIR__.'/../vendor/doctrine-common/lib',
    'Doctrine\\DBAL'   => __DIR__.'/../vendor/doctrine-dbal/lib',
    'Doctrine'         => __DIR__.'/../vendor/doctrine/lib',
    'Monolog'          => __DIR__.'/../vendor/monolog/src',
    'Assetic'          => __DIR__.'/../vendor/assetic/src',
    'Metadata'         => __DIR__.'/../vendor/metadata/src',
    'BeSimple'         => __DIR__.'/../vendor',
    'Knp'              => __DIR__.'/../vendor/bundles',
    'MZ'               => __DIR__.'/../vendor/bundles',
));
$loader->registerPrefixes(array(
    'Twig_Extensions_' => __DIR__.'/../vendor/twig-extensions/lib',
    'Twig_'            => __DIR__.'/../vendor/twig/lib',
));

// intl
if (!function_exists('intl_get_error_code')) {
    require_once __DIR__.'/../vendor/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php';

    $loader->registerPrefixFallbacks(array(__DIR__.'/../vendor/symfony/src/Symfony/Component/Locale/Resources/stubs'));
}

$loader->registerNamespaceFallbacks(array(
    __DIR__.'/../src',
));
$loader->register();

$mapLoader = new MapClassLoader([
    'ProxySettings' => __DIR__.'/../vendor/salesforce/soapclient/ProxySettings.php',
    'SforceBaseClient' => __DIR__.'/../vendor/salesforce/soapclient/SforceBaseClient.php',
    'SforceEmail' => __DIR__.'/../vendor/salesforce/soapclient/SforceEmail.php',
    'SforceEnterpriseClient' => __DIR__.'/../vendor/salesforce/soapclient/SforceEnterpriseClient.php',
    'SforceFieldTypes' => __DIR__.'/../vendor/salesforce/soapclient/SforceFieldTypes.php',
    'SforceHeaderOptions' => __DIR__.'/../vendor/salesforce/soapclient/SforceHeaderOptions.php',
    'SforceMetadataClient' => __DIR__.'/../vendor/salesforce/soapclient/SforceMetadataClient.php',
    'SforceMetaObject' => __DIR__.'/../vendor/salesforce/soapclient/SforceMetaObject.php',
    'SforcePartnerClient' => __DIR__.'/../vendor/salesforce/soapclient/SforcePartnerClient.php',
    'SforceProcessRequest' => __DIR__.'/../vendor/salesforce/soapclient/SforceProcessRequest.php',
]);
$mapLoader->register();

AnnotationRegistry::registerLoader(function($class) use ($loader) {
    $loader->loadClass($class);
    return class_exists($class, false);
});
AnnotationRegistry::registerFile(__DIR__.'/../vendor/doctrine/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php');

// Swiftmailer needs a special autoloader to allow
// the lazy loading of the init file (which is expensive)
require_once __DIR__.'/../vendor/swiftmailer/lib/classes/Swift.php';
Swift::registerAutoload(__DIR__.'/../vendor/swiftmailer/lib/swift_init.php');

redpajama_set_name: RedPajamaGithub


text:
using System.Linq;
using NUnit.Framework;
using StructureMap.Testing.Widget;

namespace StructureMap.Testing
{
    [TestFixture]
    public class ConcreteClassCreationTester
    {
        #region Setup/Teardown

        [SetUp]
        public void SetUp()
        {
            container = new Container(x => { x.For<IWidget>().Use(new ColorWidget("red")); });
        }

        #endregion

        private Container container;

        public class ConcreteClass
        {
            private readonly IWidget _widget;

            public ConcreteClass(IWidget widget)
            {
                _widget = widget;
            }

            public IWidget Widget1
            {
                get { return _widget; }
            }
        }

        [Test]
        public void can_create_a_concrete_class_by_default()
        {
            container.GetInstance<ConcreteClass>().Widget1.ShouldBeOfType<ColorWidget>();
        }

        [Test]
        public void the_instance_count_is_zero()
        {
            container.GetAllInstances<ConcreteClass>().Any().ShouldBeFalse();
        }
    }
}


text:
<mat-button-toggle-group #group="matButtonToggleGroup">
  <mat-button-toggle value="left"
    (click)="setFilterName(item)"
    [ngClass]="{'mat-button-toggle-checked': (filterName$ | async)?.Name == item.Name}"
    *ngFor="let item of names">
      {{item.Name}}
  </mat-button-toggle>
</mat-button-toggle-group>


text:
package com.edwise.completespring.entities;

import com.edwise.completespring.testutil.BookBuilder;
import org.junit.Test;

import java.time.LocalDate;
import java.util.Collections;

import static org.assertj.core.api.Assertions.assertThat;

public class BookTest {

    private static final long BOOK_ID_TEST1 = 31L;
    private static final String BOOK_TITLE_TEST1 = "Lord of the Rings";
    private static final String BOOK_TITLE_TEST2 = "Bautismo de Fuego";
    private static final String AUTHOR_NAME_TEST1 = "J.R.R.";
    private static final String AUTHOR_SURNAME_TEST1 = "Tolkien";
    private static final String BOOK_ISBN_TEST1 = "11-333-12";
    private static final String BOOK_ISBN_TEST2 = "21-929-34";
    private static final String PUBLISHER_NAME_TEST1 = "Editorial Planeta";
    private static final String PUBLISHER_NAME_TEST2 = "Gigamesh";
    private static final String PUBLISHER_COUNTRY_TEST1 = "ES";
    private static final LocalDate DATE_TEST1 = LocalDate.of(2013, 1, 26);

    @Test
    public void testCopyFrom() {
        Book bookFrom = new BookBuilder()
                .id(BOOK_ID_TEST1)
                .title(BOOK_TITLE_TEST1)
                .authors(Collections.singletonList(AuthorTest.createAuthor(AUTHOR_NAME_TEST1, AUTHOR_SURNAME_TEST1)))
                .isbn(BOOK_ISBN_TEST1)
                .releaseDate(DATE_TEST1)
                .publisher(PublisherTest.createPublisher(PUBLISHER_NAME_TEST1, PUBLISHER_COUNTRY_TEST1, true))
                .build();
        Book bookTo = new BookBuilder().build();

        bookTo.copyFrom(bookFrom);

        assertThat(bookTo).isEqualTo(bookFrom);
    }

    @Test
    public void testEquals() {
        Book book1 = new BookBuilder()
                .id(BOOK_ID_TEST1)
                .title(BOOK_TITLE_TEST1)
                .authors(Collections.singletonList(AuthorTest.createAuthor(AUTHOR_NAME_TEST1, AUTHOR_SURNAME_TEST1)))
                .isbn(BOOK_ISBN_TEST1)
                .releaseDate(DATE_TEST1)
                .publisher(PublisherTest.createPublisher(PUBLISHER_NAME_TEST1, PUBLISHER_COUNTRY_TEST1, true))
                .build();
        Book book2 = new BookBuilder()
                .id(BOOK_ID_TEST1)
                .title(BOOK_TITLE_TEST1)
                .authors(Collections.singletonList(AuthorTest.createAuthor(AUTHOR_NAME_TEST1, AUTHOR_SURNAME_TEST1)))
                .isbn(BOOK_ISBN_TEST1)
                .releaseDate(DATE_TEST1)
                .publisher(PublisherTest.createPublisher(PUBLISHER_NAME_TEST1, PUBLISHER_COUNTRY_TEST1, true))
                .build();

        assertThat(book1.equals(book2) && book2.equals(book1)).isTrue();
    }

    @Test
    public void testNotEqualsWithDifferentsFields() {
        Book book1 = new BookBuilder()
                .id(BOOK_ID_TEST1)
                .title(BOOK_TITLE_TEST1)
                .authors(Collections.singletonList(AuthorTest.createAuthor(AUTHOR_NAME_TEST1, AUTHOR_SURNAME_TEST1)))
                .isbn(BOOK_ISBN_TEST1)
                .releaseDate(DATE_TEST1)
                .publisher(PublisherTest.createPublisher(PUBLISHER_NAME_TEST1, PUBLISHER_COUNTRY_TEST1, true))
                .build();
        Book book2 = new BookBuilder()
                .id(BOOK_ID_TEST1)
                .title(BOOK_TITLE_TEST2)
                .authors(Collections.singletonList(AuthorTest.createAuthor(AUTHOR_NAME_TEST1, AUTHOR_SURNAME_TEST1)))
                .isbn(BOOK_ISBN_TEST2)
                .releaseDate(DATE_TEST1)
                .publisher(PublisherTest.createPublisher(PUBLISHER_NAME_TEST2, PUBLISHER_COUNTRY_TEST1, false))
                .build();

        assertThat(book1.equals(book2) || book2.equals(book1)).isFalse();
    }

    @Test
    public void testNotEqualsWithDifferentsObjects() {
        Book book = new BookBuilder().id(BOOK_ID_TEST1).build();

        assertThat(book).isNotEqualTo(new Object());
    }

    @Test
    public void testHashCode() {
        Book book1 = new BookBuilder()
                .id(BOOK_ID_TEST1)
                .title(BOOK_TITLE_TEST1)
                .authors(Collections.singletonList(AuthorTest.createAuthor(AUTHOR_NAME_TEST1, AUTHOR_SURNAME_TEST1)))
                .isbn(BOOK_ISBN_TEST1)
                .releaseDate(DATE_TEST1)
                .publisher(PublisherTest.createPublisher(PUBLISHER_NAME_TEST1, PUBLISHER_COUNTRY_TEST1, true))
                .build();
        Book book2 = new BookBuilder()
                .id(BOOK_ID_TEST1)
                .title(BOOK_TITLE_TEST1)
                .authors(Collections.singletonList(AuthorTest.createAuthor(AUTHOR_NAME_TEST1, AUTHOR_SURNAME_TEST1)))
                .isbn(BOOK_ISBN_TEST1)
                .releaseDate(DATE_TEST1)
                .publisher(PublisherTest.createPublisher(PUBLISHER_NAME_TEST1, PUBLISHER_COUNTRY_TEST1, true))
                .build();

        assertThat(book1.hashCode()).isEqualTo(book2.hashCode());
    }

    @Test
    public void testHasCodeWithDifferentFields() {
        Book book1 = new BookBuilder()
                .id(BOOK_ID_TEST1)
                .title(BOOK_TITLE_TEST1)
                .authors(Collections.singletonList(AuthorTest.createAuthor(AUTHOR_NAME_TEST1, AUTHOR_SURNAME_TEST1)))
                .isbn(BOOK_ISBN_TEST1)
                .releaseDate(DATE_TEST1)
                .publisher(PublisherTest.createPublisher(PUBLISHER_NAME_TEST1, PUBLISHER_COUNTRY_TEST1, true))
                .build();
        Book book2 = new BookBuilder()
                .id(BOOK_ID_TEST1)
                .title(BOOK_TITLE_TEST2)
                .authors(Collections.singletonList(AuthorTest.createAuthor(AUTHOR_NAME_TEST1, AUTHOR_SURNAME_TEST1)))
                .isbn(BOOK_ISBN_TEST2)
                .releaseDate(DATE_TEST1)
                .publisher(PublisherTest.createPublisher(PUBLISHER_NAME_TEST2, PUBLISHER_COUNTRY_TEST1, false))
                .build();

        assertThat(book1.hashCode()).isNotEqualTo(book2.hashCode());
    }

    @Test
    public void testToString() {
        Book book = new BookBuilder().build();

        assertThatBookStringContainsAllFields(book.toString());
    }

    private void assertThatBookStringContainsAllFields(String bookString) {
        assertThat(bookString).contains("id=null");
        assertThat(bookString).contains("title=null");
        assertThat(bookString).contains("authors=null");
        assertThat(bookString).contains("isbn=null");
        assertThat(bookString).contains("releaseDate=null");
        assertThat(bookString).contains("publisher=null");
    }
}


text:
module ActiveScaffold::Actions
  module Subform
    def edit_associated
      do_edit_associated
      render :action => 'edit_associated', :formats => [:js]
    end

    protected

    def do_edit_associated
      @parent_record = params[:id].nil? ? new_model : find_if_allowed(params[:id], :update)
      generate_temporary_id(@parent_record, params[:generated_id]) if @parent_record.new_record? && params[:generated_id]
      @column = active_scaffold_config.columns[params[:child_association]]

      # NOTE: we don't check whether the user is allowed to update this record, because if not, we'll still let them associate the record. we'll just refuse to do more than associate, is all.
      @record = @column.association.klass.find(params[:associated_id]) if params[:associated_id]
      @record ||= build_associated(@column, @parent_record)

      @scope = "#{params[:scope]}[#{@column.name}]"
      @scope += "[#{@record.id || generate_temporary_id(@record)}]" if @column.plural_association?
    end

  end
end


text: File packing library


text:
/*
 * Created on 21 Nov 2006
 */
package org.sakaiproject.rsf.servlet;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;

import org.sakaiproject.rsf.copies.Web;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.web.context.WebApplicationContext;

import uk.org.ponder.rsf.viewstate.BaseURLProvider;
import uk.org.ponder.rsf.viewstate.support.StaticBaseURLProvider;
import uk.org.ponder.servletutil.ServletUtil;

public class SakaiBaseURLProviderFactory implements ApplicationContextAware, FactoryBean {
	private HttpServletRequest request;

	private WebApplicationContext wac;

	public void setApplicationContext(ApplicationContext applicationContext) {
		wac = (WebApplicationContext) applicationContext;
	}

	public void setHttpServletRequest(HttpServletRequest request) {
		this.request = request;
	}

	private String resourceurlbase;

	// Sakai is a very poor URL environment, where the return from
	// req.getRequestURL() may not actually be valid to access this server.
	// This method adjusts the protocol and port from a "correctly" computed
	// URL to be closer to reality, via the hackery from Sakai "Web" utils.
	public static String fixSakaiURL(HttpServletRequest req, String computed) {
		String serverURL = Web.serverUrl(req);
		int endprotpos = computed.indexOf("://");
		int slashpos = computed.indexOf('/', endprotpos + 3);
		return serverURL + computed.substring(slashpos);
	}

	public StaticBaseURLProvider computeBaseURLProvider(HttpServletRequest request) {
		ServletContext servletcontext = wac.getServletContext();
		// yes, these two fields are not request-scope, but not worth creating
		// a whole new class and bean file for them.
		resourceurlbase = servletcontext.getInitParameter("resourceurlbase");
		if (resourceurlbase == null) {
			resourceurlbase = ServletUtil.computeContextName(servletcontext);
		}

		// compute the baseURLprovider.
		StaticBaseURLProvider sbup = new StaticBaseURLProvider();
		String baseurl = fixSakaiURL(request, ServletUtil.getBaseURL2(request));
		sbup.setResourceBaseURL(computeResourceURLBase(baseurl));
		// baseurl += SakaiEarlyRequestParser.FACES_PATH + "/";
		sbup.setBaseURL(baseurl);
		return sbup;
	}

	// The argument to this is what Sakai "claims" is our base URL. The true
	// resource URL will be somewhat unrelated in that it will share (at most)
	// the host name and port of this URL.
	private String computeResourceURLBase(String baseurl) {
		if (resourceurlbase.charAt(0) == '/') {
			int endprotpos = baseurl.indexOf("://");
			int firstslashpos = baseurl.indexOf('/', endprotpos + 3);
			return baseurl.substring(0, firstslashpos) + resourceurlbase;
		} else { // it is an absolute URL
			return resourceurlbase;
		}
	}

	public Object getObject() throws Exception {
		return computeBaseURLProvider(request);
	}

	public Class getObjectType() {
		return BaseURLProvider.class;
	}

	public boolean isSingleton() {
		return true;
	}

}


text:
using UnityEngine;
using System.Collections.Generic;

namespace UMA
{
	/// <summary>
	/// Base class for UMA DNA.
	/// </summary>
	[System.Serializable]
	public abstract class UMADnaBase
	{
		public abstract int Count { get; }
		public abstract float[] Values
		{
			get; set;
		}

		public abstract string[] Names
		{
			get;
		}

		public abstract float GetValue(int idx);
		public abstract void SetValue(int idx, float value);
	}
}


text:
class Base
{
	private eventListeners: Object = {};

	constructor()
	{
		this._bind()
	}

	addEventListener(ev, callback)
	{
		if (typeof callback !== "function") return;

		if (!this.eventListeners[ev]) this.eventListeners[ev] = [];
		const pos = this.eventListeners[ev].indexOf(callback);
		if (pos < 0) {
			this.eventListeners[ev].push(callback);
		}
	}

	removeEventListener(ev, callback)
	{
		if (this.eventListeners[ev]) {
			const pos = this.eventListeners[ev].indexOf(callback);
			if (pos >= 0) {
				this.eventListeners[ev].splice(pos, 1);
			}
		}
	}

	$signal(type, data?)
	{
		if (this.eventListeners[type]) {
			let ev = document.createEvent("Event");
			if (ev) {
				ev.initEvent(type, true, true);
				ev["sender"] = this;
				ev["signalData"] = data;
				for (let i = 0; i < this.eventListeners[type].length; i++) {
					const fn = this.eventListeners[type][i];
					if (fn) fn(ev);
				}
			}
		}
	}

	$exclusions()
	{
		return ["addEventListener", "removeEventListener"];
	}

	private _bind()
	{
		for (let member in this) {
			if ("function" === typeof this[member]) {
				this[member] = (this[member] as any).bind(this);
			}
		}
	}
}

export default Base;


text:
namespace StudentSystem.ConsoleClient
{
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Data.Entity;
    using System.Data.Entity.Validation;
    using System.Linq;
    using Data;
    using Models;

    public class ConsoleClient
    {
        public static void PrintStudents(IEnumerable<Student> students)
        {
            foreach (var student in students)
            {
                Console.WriteLine(student.FirstName);
            }
        }

        public static void Main()
        {
            var data = new StudentsSystemData();

            var courses = data.Courses.All();

            foreach (var course in courses)
            {
                Console.WriteLine(course.Name);
            }

            data.Courses.Add(new Course
            {
                Name = "Repo Pattern",
                Description = "Cool"
            });

            data.SaveChanges();

            var students = data.Students.All();

            Console.WriteLine(students.Count());

            /*var masters = data.Students.Where(st => st.Level > 1);
            //PrintStudents(masters);

            //var ivaylos = data.Students.Where(st => st.FirstName == "Ivaylo");
            //PrintStudents(ivaylos);

            //var firstMaster = data.Students.FirstOrDefault(st => st.Level == -5);
            //if (firstMaster == null)
            //{
            //    Console.WriteLine("NULL");
            //}

            //var levels = data.Students.Select(st => new
            //    {
            //        Level = st.Level,
            //        LastName = st.LastName
            //    });

            //foreach (var level in levels)
            //{
            //    Console.WriteLine(level.LastName);
            //}

            //var orderedStudents = data.Students
            //    .OrderBy(st => st.LastName)
            //    .ThenBy(st => st.Level);

            //PrintStudents(orderedStudents);

            //var someQuery = data.Students
            //    .Where(st => st.Level > 0)
            //    .OrderBy(st => st.LastName)
            //    .Select(st => new
            //    {
            //        FirstName = st.FirstName
            //    });

            //var maxLevel = data.Students.Max(st => st.Level);

            //Console.WriteLine(maxLevel);

            //Console.WriteLine(data.Students.Find(2).LastName);

            //data.Courses.Add(new Course
            //{
            //    Name = "Entity Framework",
            //    Description = "Code First"
            //});

            //data.SaveChanges();

            //var entityFrCourse = data.Courses.FirstOrDefault(c => c.Name == "Entity Framework");

            //foreach (var master in masters)
            //{
            //    // entityFrCourse.Students.Add(master);
            //}

            //data.SaveChanges();

            //var activeCourses = data.Courses.Where(c => c.Students.Count() > 0);

            //foreach (var course in activeCourses)
            //{
            //    course.Description = "Code First Is Cool";
            //    Console.WriteLine(course.Name);
            //}

            //data.SaveChanges();

            //var courses = data.Courses.ToList();

            //foreach (var course in courses)
            //{
            //    if (course.Students.Count() == 0)
            //    {
            //        data.Courses.Remove(course);
            //    }
            //}

            //var coursesWithStudents = data.Courses.Include(x => x.Students);

            //data.SaveChanges();

            //var someQuery = data.Students
            //    .Where(st => st.Level > 0)
            //    .OrderBy(st => st.LastName)
            //    .Select(st => new
            //    {
            //        FirstName = st.FirstName
            //    })
            //    .ToList();

            //var courseFirst = data.Courses.FirstOrDefault();

            //var courseEntry = data.Entry(courseFirst);
            //courseEntry.State = EntityState.Detached;

            //data.Courses.Attach(courseFirst);

            //courseFirst.Name = "Entity Framework";

            //data.SaveChanges();*/
        }
    }
}


text:
@implementation IDLFinitePool {
    NSUInteger _limit;
    BOOL _infinite;
    NSUInteger _poolCount;

    id<IDLPoolableManager> _manager;
    id<IDLPoolable> _root;
}

- (instancetype)initWithPoolableManager:(id<IDLPoolableManager>)manager {
	self = [super init];
	if (self != nil) {
		_manager = manager;
        _limit = 0;
        _infinite = TRUE;
	}
	return self;
}

- (instancetype)initWithPoolableManager:(id<IDLPoolableManager>)manager limit:(NSUInteger)limit {
    self = [super init];
    if (self) {
        _manager = manager;
        _limit = limit;
        _infinite = (limit == 0);
    }
    return self;
}

- (id<IDLPoolable>)acquire {
    id<IDLPoolable> element;
    if (_root != nil) {
        element = _root;
        _root = element.nextPoolable;
        _poolCount--;
    } else {
        element = [_manager newInstance];
    }

    if (element != nil) {
        element.nextPoolable = nil;
        [_manager onAcquiredElement:element];
    }

    return element;
}

- (void)releaseElement:(id<IDLPoolable>)element {
    if (_infinite || _poolCount < _limit) {
        _poolCount++;
        element.nextPoolable = _root;
        _root = element;
    }
    [_manager onReleasedElement:element];
}

@end


text:
@interface GPUImageDarkenBlendFilter : GPUImageFilter
{
}

@end


text:
class UserImageHolder < ActiveRecord::Base

  image_holdable

  belongs_to :user, primary_key: :username, foreign_key: :user_username

end


text:
namespace v8 {
namespace internal {

// Forward declarations.
class CompilationDependencies;
class Factory;
class TypeCache;

namespace compiler {

// Forward declarations.
class CommonOperatorBuilder;
class JSGraph;
class JSOperatorBuilder;
class MachineOperatorBuilder;
class SimplifiedOperatorBuilder;

// Lowers JS-level operators to simplified operators based on types.
class JSTypedLowering final : public AdvancedReducer {
 public:
  // Flags that control the mode of operation.
  enum Flag {
    kNoFlags = 0u,
    kDeoptimizationEnabled = 1u << 0,
    kDisableBinaryOpReduction = 1u << 1,
  };
  typedef base::Flags<Flag> Flags;

  JSTypedLowering(Editor* editor, CompilationDependencies* dependencies,
                  Flags flags, JSGraph* jsgraph, Zone* zone);
  ~JSTypedLowering() final {}

  Reduction Reduce(Node* node) final;

 private:
  friend class JSBinopReduction;

  Reduction ReduceJSAdd(Node* node);
  Reduction ReduceJSModulus(Node* node);
  Reduction ReduceJSBitwiseOr(Node* node);
  Reduction ReduceJSMultiply(Node* node);
  Reduction ReduceJSComparison(Node* node);
  Reduction ReduceJSLoadNamed(Node* node);
  Reduction ReduceJSLoadProperty(Node* node);
  Reduction ReduceJSStoreProperty(Node* node);
  Reduction ReduceJSInstanceOf(Node* node);
  Reduction ReduceJSLoadContext(Node* node);
  Reduction ReduceJSStoreContext(Node* node);
  Reduction ReduceJSEqual(Node* node, bool invert);
  Reduction ReduceJSStrictEqual(Node* node, bool invert);
  Reduction ReduceJSToBoolean(Node* node);
  Reduction ReduceJSToNumberInput(Node* input);
  Reduction ReduceJSToNumber(Node* node);
  Reduction ReduceJSToStringInput(Node* input);
  Reduction ReduceJSToString(Node* node);
  Reduction ReduceJSToObject(Node* node);
  Reduction ReduceJSConvertReceiver(Node* node);
  Reduction ReduceJSCreate(Node* node);
  Reduction ReduceJSCreateArguments(Node* node);
  Reduction ReduceJSCreateArray(Node* node);
  Reduction ReduceJSCreateClosure(Node* node);
  Reduction ReduceJSCreateIterResultObject(Node* node);
  Reduction ReduceJSCreateLiteralArray(Node* node);
  Reduction ReduceJSCreateLiteralObject(Node* node);
  Reduction ReduceJSCreateFunctionContext(Node* node);
  Reduction ReduceJSCreateWithContext(Node* node);
  Reduction ReduceJSCreateCatchContext(Node* node);
  Reduction ReduceJSCreateBlockContext(Node* node);
  Reduction ReduceJSCallConstruct(Node* node);
  Reduction ReduceJSCallFunction(Node* node);
  Reduction ReduceJSForInDone(Node* node);
  Reduction ReduceJSForInNext(Node* node);
  Reduction ReduceJSForInPrepare(Node* node);
  Reduction ReduceJSForInStep(Node* node);
  Reduction ReduceSelect(Node* node);
  Reduction ReduceNumberBinop(Node* node, const Operator* numberOp);
  Reduction ReduceInt32Binop(Node* node, const Operator* intOp);
  Reduction ReduceUI32Shift(Node* node, Signedness left_signedness,
                            const Operator* shift_op);
  Reduction ReduceNewArray(Node* node, Node* length, int capacity,
                           Handle<AllocationSite> site);

  Node* Word32Shl(Node* const lhs, int32_t const rhs);
  Node* AllocateArguments(Node* effect, Node* control, Node* frame_state);
  Node* AllocateRestArguments(Node* effect, Node* control, Node* frame_state,
                              int start_index);
  Node* AllocateAliasedArguments(Node* effect, Node* control, Node* frame_state,
                                 Node* context, Handle<SharedFunctionInfo>,
                                 bool* has_aliased_arguments);
  Node* AllocateElements(Node* effect, Node* control,
                         ElementsKind elements_kind, int capacity,
                         PretenureFlag pretenure);

  Factory* factory() const;
  Graph* graph() const;
  JSGraph* jsgraph() const { return jsgraph_; }
  Isolate* isolate() const;
  JSOperatorBuilder* javascript() const;
  CommonOperatorBuilder* common() const;
  SimplifiedOperatorBuilder* simplified() const;
  MachineOperatorBuilder* machine() const;
  CompilationDependencies* dependencies() const;
  Flags flags() const { return flags_; }

  // Limits up to which context allocations are inlined.
  static const int kFunctionContextAllocationLimit = 16;
  static const int kBlockContextAllocationLimit = 16;

  CompilationDependencies* dependencies_;
  Flags flags_;
  JSGraph* jsgraph_;
  Type* shifted_int32_ranges_[4];
  Type* const true_type_;
  Type* const false_type_;
  Type* const the_hole_type_;
  TypeCache const& type_cache_;
};

DEFINE_OPERATORS_FOR_FLAGS(JSTypedLowering::Flags)

}  // namespace compiler
}  // namespace internal
}  // namespace v8

#endif  // V8_COMPILER_JS_TYPED_LOWERING_H_


text:
/*
 * This file is available under and governed by the GNU General Public
 * License version 2 only, as published by the Free Software Foundation.
 * However, the following notice accompanied the original version of this
 * file:
 *
 * Written by Doug Lea with assistance from members of JCP JSR-166
 * Expert Group and released to the public domain, as explained at
 * http://creativecommons.org/licenses/publicdomain
 */

package java.util.concurrent;
import java.util.*;

/**
 * A {@link ConcurrentMap} supporting {@link NavigableMap} operations,
 * and recursively so for its navigable sub-maps.
 *
 *
This interface is a member of the
 *
 * Java Collections Framework.
 *
 * @author Doug Lea
 * @param <K> the type of keys maintained by this map
 * @param <V> the type of mapped values
 * @since 1.6
 */
public interface ConcurrentNavigableMap<K,V>
    extends ConcurrentMap<K,V>, NavigableMap<K,V>
{
    /**
     * @throws ClassCastException       {@inheritDoc}
     * @throws NullPointerException     {@inheritDoc}
     * @throws IllegalArgumentException {@inheritDoc}
     */
    ConcurrentNavigableMap<K,V> subMap(K fromKey, boolean fromInclusive,
                                       K toKey,   boolean toInclusive);

    /**
     * @throws ClassCastException       {@inheritDoc}
     * @throws NullPointerException     {@inheritDoc}
     * @throws IllegalArgumentException {@inheritDoc}
     */
    ConcurrentNavigableMap<K,V> headMap(K toKey, boolean inclusive);

    /**
     * @throws ClassCastException       {@inheritDoc}
     * @throws NullPointerException     {@inheritDoc}
     * @throws IllegalArgumentException {@inheritDoc}
     */
    ConcurrentNavigableMap<K,V> tailMap(K fromKey, boolean inclusive);

    /**
     * @throws ClassCastException       {@inheritDoc}
     * @throws NullPointerException     {@inheritDoc}
     * @throws IllegalArgumentException {@inheritDoc}
     */
    ConcurrentNavigableMap<K,V> subMap(K fromKey, K toKey);

    /**
     * @throws ClassCastException       {@inheritDoc}
     * @throws NullPointerException     {@inheritDoc}
     * @throws IllegalArgumentException {@inheritDoc}
     */
    ConcurrentNavigableMap<K,V> headMap(K toKey);

    /**
     * @throws ClassCastException       {@inheritDoc}
     * @throws NullPointerException     {@inheritDoc}
     * @throws IllegalArgumentException {@inheritDoc}
     */
    ConcurrentNavigableMap<K,V> tailMap(K fromKey);

    /**
     * Returns a reverse order view of the mappings contained in this map.
     * The descending map is backed by this map, so changes to the map are
     * reflected in the descending map, and vice-versa.
     *
     *
The returned map has an ordering equivalent to
     * <tt>{@link Collections#reverseOrder(Comparator) Collections.reverseOrder}(comparator())</tt>.
     * The expression {@code m.descendingMap().descendingMap()} returns a
     * view of {@code m} essentially equivalent to {@code m}.
     *
     * @return a reverse order view of this map
     */
    ConcurrentNavigableMap<K,V> descendingMap();

    /**
     * Returns a {@link NavigableSet} view of the keys contained in this map.
     * The set's iterator returns the keys in ascending order.
     * The set is backed by the map, so changes to the map are
     * reflected in the set, and vice-versa.  The set supports element
     * removal, which removes the corresponding mapping from the map,
     * via the {@code Iterator.remove}, {@code Set.remove},
     * {@code removeAll}, {@code retainAll}, and {@code clear}
     * operations.  It does not support the {@code add} or {@code addAll}
     * operations.
     *
     *
The view's {@code iterator} is a "weakly consistent" iterator
     * that will never throw {@link ConcurrentModificationException},
     * and guarantees to traverse elements as they existed upon
     * construction of the iterator, and may (but is not guaranteed to)
     * reflect any modifications subsequent to construction.
     *
     * @return a navigable set view of the keys in this map
     */
    public NavigableSet<K> navigableKeySet();

    /**
     * Returns a {@link NavigableSet} view of the keys contained in this map.
     * The set's iterator returns the keys in ascending order.
     * The set is backed by the map, so changes to the map are
     * reflected in the set, and vice-versa.  The set supports element
     * removal, which removes the corresponding mapping from the map,
     * via the {@code Iterator.remove}, {@code Set.remove},
     * {@code removeAll}, {@code retainAll}, and {@code clear}
     * operations.  It does not support the {@code add} or {@code addAll}
     * operations.
     *
     *
The view's {@code iterator} is a "weakly consistent" iterator
     * that will never throw {@link ConcurrentModificationException},
     * and guarantees to traverse elements as they existed upon
     * construction of the iterator, and may (but is not guaranteed to)
     * reflect any modifications subsequent to construction.
     *
     *
This method is equivalent to method {@code navigableKeySet}.
     *
     * @return a navigable set view of the keys in this map
     */
    NavigableSet<K> keySet();

    /**
     * Returns a reverse order {@link NavigableSet} view of the keys contained in this map.
     * The set's iterator returns the keys in descending order.
     * The set is backed by the map, so changes to the map are
     * reflected in the set, and vice-versa.  The set supports element
     * removal, which removes the corresponding mapping from the map,
     * via the {@code Iterator.remove}, {@code Set.remove},
     * {@code removeAll}, {@code retainAll}, and {@code clear}
     * operations.  It does not support the {@code add} or {@code addAll}
     * operations.
     *
     *
The view's {@code iterator} is a "weakly consistent" iterator
     * that will never throw {@link ConcurrentModificationException},
     * and guarantees to traverse elements as they existed upon
     * construction of the iterator, and may (but is not guaranteed to)
     * reflect any modifications subsequent to construction.
     *
     * @return a reverse order navigable set view of the keys in this map
     */
    public NavigableSet<K> descendingKeySet();
}


text:
package net.s5games.mafia.ui.view.objectView;

import net.s5games.mafia.ui.view.objectView.ObjectView;
import net.s5games.mafia.ui.FlagChoice;
import net.s5games.mafia.model.*;
import net.miginfocom.swing.MigLayout;

import javax.swing.*;
import javax.swing.border.TitledBorder;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.io.File;

public class ObjectTypePanel extends JPanel {
    private JComboBox typeBox;
    private JTextField v0, v1, v2, v3, v4;
    private TitledBorder b0, b1, b2, b3, b4;
    private JPanel p0, p1, p2, p3, p4;
    private final static int OFF = 0;
    private final static int ON0 = 1;
    private final static int ON1 = 2;
    private final static int ON2 = 4;
    private final static int ON3 = 8;
    private final static int ON4 = 16;
    private final static int ONALL = ON0 | ON1 | ON2 | ON3 | ON4;
    private Area data;
    private int vnum;
    DamTypeTable theDamTypes;
    WeaponTypeTable theWeaponTypes;
    LiquidTypeTable theLiquidTypes;
    SpellListTable theSpellList;
    net.s5games.mafia.ui.view.objectView.ObjectView myParent;

    public ObjectTypePanel(Area d, DamTypeTable _theDamTypes, ObjectView par) {
        data = d;
        myParent = par;
        vnum = -1;
        theDamTypes = _theDamTypes;
        theWeaponTypes = new WeaponTypeTable();
        theWeaponTypes.loadWeaponTypeTable("wtype.txt");
        theLiquidTypes = new LiquidTypeTable();
        theLiquidTypes.loadLiquidTypeTable("liquid.txt");
        theSpellList = new SpellListTable();
        theSpellList.loadSpellListTable("spell.txt");
        typeBox = new JComboBox(MudConstants.typeNames);
        typeBox.setBorder(new TitledBorder("Item Type"));
        v0 = new JTextField(10);
        v1 = new JTextField(10);
        v2 = new JTextField(10);
        v3 = new JTextField(10);
        v4 = new JTextField(10);
        p0 = new JPanel();
        p1 = new JPanel();
        p2 = new JPanel();
        p3 = new JPanel();
        p4 = new JPanel();
        p0.setLayout(new GridLayout(1, 1));
        p1.setLayout(new GridLayout(1, 1));
        p2.setLayout(new GridLayout(1, 1));
        p3.setLayout(new GridLayout(1, 1));
        p4.setLayout(new GridLayout(1, 1));
        b0 = new TitledBorder("V0");
        b1 = new TitledBorder("V1");
        b2 = new TitledBorder("V2");
        b3 = new TitledBorder("V3");
        b4 = new TitledBorder("V4");
        p0.setBorder(b0);
        p1.setBorder(b1);
        p2.setBorder(b2);
        p3.setBorder(b3);
        p4.setBorder(b4);
        p0.add(v0);
        p1.add(v1);
        p2.add(v2);
        p3.add(v3);
        p4.add(v4);

        setLayout(new MigLayout());
        add(typeBox, "growx, wrap");
        add(p0, "wrap");
        add(p1, "wrap");
        add(p2, "wrap");
        add(p3, "wrap");
        add(p4);

        update();

        typeBox.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                if (vnum != -1) {
                    MudObject me = data.getObject(vnum);
                    me.setType(MudConstants.TypeLookup(typeBox.getSelectedIndex()));
                }
                myParent.update();
            }
        });

        v0.addFocusListener(new v0FocusListener(theWeaponTypes));
        v1.addFocusListener(new v1FocusListener());
        v2.addFocusListener(new v2FocusListener(data));
        v3.addFocusListener(new v3FocusListener(theDamTypes, data));
        v4.addFocusListener(new v4FocusListener());
    }

    public void setEnabled(boolean value) {
        typeBox.setEnabled(value);
        v0.setEnabled(value);
        v1.setEnabled(value);
        v2.setEnabled(value);
        v3.setEnabled(value);
        v4.setEnabled(value);
    }

    public void update(int v) {
        vnum = v;

        if (vnum != -1) {
            MudObject temp = data.getObject(vnum);
            typeBox.setSelectedIndex(MudConstants.typePositionLookup(temp.getType()));
        }

        update();
    }

    public void update() {
        int which = MudConstants.TypeLookup(typeBox.getSelectedIndex());

        MudObject temp = null;

        if (vnum == -1)
            which = MudConstants.ITEM_TRASH;
        else
            temp = data.getObject(vnum);

        switch (which) {
            case MudConstants.ITEM_LIGHT: {
                turnOn(ON2);
                b2.setTitle("Hours");
                if (temp == null)
                    break;

                int h = temp.getiValue(2);
                if (h == 0)
                    h = 1;
                v2.setText(Integer.toString(h));
                break;
            }
            case MudConstants.ITEM_WAND:
            case MudConstants.ITEM_STAFF: {
                turnOn((ON0 | ON1 | ON2 | ON3));
                b0.setTitle("Casting Level");
                b1.setTitle("Charges Total");
                b2.setTitle("Charges Left");
                b3.setTitle("Spell");
                if (temp == null)
                    break;

                v0.setText(Integer.toString(temp.getiValue(0, 1)));
                v1.setText(Integer.toString(temp.getiValue(1, 1)));
                v2.setText(Integer.toString(temp.getiValue(2, 1)));
                // TODO: make sure v3 is valid spell.
                v3.setText(temp.getsValue(3));
                break;
            }
            case MudConstants.ITEM_WEAPON: {
                turnOn(ONALL);
                b0.setTitle("Weapon Class");
                b1.setTitle("Number Of Dice");
                b2.setTitle("Type Of Dice");
                b3.setTitle("Type");
                b4.setTitle("Special Type");
                if (temp == null)
                    break;

                // TODO: make sure v0 is valid weapon class.
                String st = temp.getsValue(0);
                if (!theWeaponTypes.isWeaponType(st))
                    temp.setsValue(0, theWeaponTypes.getDefaultType());
                v0.setText(temp.getsValue(0));
                v1.setText(Integer.toString(temp.getiValue(1, 1)));
                v2.setText(Integer.toString(temp.getiValue(2, 1)));
                st = temp.getsValue(3);
                if (!theDamTypes.isDamType(st))
                    temp.setsValue(3, theDamTypes.getDefaultType());
                v3.setText(temp.getsValue(3));
                v4.setText(MudConstants.flagNameString(temp.getiValue(4)));
                break;
            }
            case MudConstants.ITEM_ARMOR: {
                turnOn(ON0 | ON1 | ON2 | ON3);
                b0.setTitle("AC Pierce");
                b1.setTitle("AC Bash");
                b2.setTitle("AC Slash");
                b3.setTitle("AC Exotic");
                if (temp == null)
                    break;
                v0.setText(Integer.toString(temp.getiValue(0)));
                v1.setText(Integer.toString(temp.getiValue(1)));
                v2.setText(Integer.toString(temp.getiValue(2)));
                v3.setText(Integer.toString(temp.getiValue(3)));
                break;
            }
            case MudConstants.ITEM_FURNITURE: {
                turnOn(ONALL);
                b0.setTitle("Max People");
                b1.setTitle("Channel");
                b2.setTitle("Furniture Flags");
                b3.setTitle("Heal Bonus");
                b4.setTitle("Mana Bonus");
                if (temp == null)
                    break;
                v0.setText(Integer.toString(temp.getiValue(0, 1)));
                v1.setText(Integer.toString(temp.getiValue(1)));
                v2.setText(MudConstants.furnitureFlagName(temp.getiValue(2)));
                v3.setText(Integer.toString(temp.getiValue(3)));
                v4.setText(Integer.toString(temp.getiValue(4)));
                break;
            }
            case MudConstants.ITEM_CONTAINER: {
                turnOn(ON0 | ON1 | ON2 | ON4);
                b0.setTitle("Max # of items");
                b1.setTitle("Flags");
                b2.setTitle("Key");
                b4.setTitle("Weight Multiplier");
                if (temp == null)
                    break;
                v0.setText(Integer.toString(temp.getiValue(0, 1)));
                v1.setText(MudConstants.containerFlagString(temp.getiValue(1)));
                if (temp.getiValue(2) != 0) {
                    MudObject obj = data.getObject(temp.getiValue(2));
                    if (obj == null) {
                        v2.setText("No key");
                        temp.setiValue(2, 0);
                    } else
                        v2.setText(obj.toString());
                } else
                    v2.setText("No Key");
                v4.setText(Integer.toString(temp.getiValue(4, 1)));
                break;
            }
            case MudConstants.ITEM_FOUNTAIN:
            case MudConstants.ITEM_DRINK_CON: {
                turnOn(ON0 | ON1 | ON2 | ON3);
                b0.setTitle("Liquid Total");
                b1.setTitle("Liquid Left");
                b2.setTitle("Liquid");
                b3.setTitle("Poisoned?");
                if (temp == null)
                    break;
                v0.setText(Integer.toString(temp.getiValue(0, 1)));
                v1.setText(Integer.toString(temp.getiValue(1, 1)));
                String st = temp.getsValue(2);
                if (!theLiquidTypes.isLiquidType(st))
                    temp.setsValue(2, theLiquidTypes.getDefaultLiquid());
                v2.setText(temp.getsValue(2));
                if (temp.getiValue(3) == 0)
                    v3.setText("No");
                else
                    v3.setText("Yes");
                break;
            }
            case MudConstants.ITEM_FOOD: {
                turnOn(ON0 | ON1 | ON3);
                b0.setTitle("Food Hours");
                b1.setTitle("Full Hours");
                b3.setTitle("Poisoned?");
                if (temp == null)
                    break;
                v0.setText(Integer.toString(temp.getiValue(0, 1)));
                v1.setText(Integer.toString(temp.getiValue(1, 1)));
                if (temp.getiValue(3) == 0)
                    v3.setText("No");
                else
                    v3.setText("Yes");
                break;
            }
            case MudConstants.ITEM_MONEY: {
                turnOn(ON0);
                b0.setTitle("Amount of Yen/Gold");
                if (temp == null)
                    break;
                v0.setText(Integer.toString(temp.getiValue(0, 1)));
                break;
            }
            case MudConstants.ITEM_SCROLL:
            case MudConstants.ITEM_POTION:
            case MudConstants.ITEM_PILL: {
                turnOn(ONALL);
                b0.setTitle("Cast Level");
                b1.setTitle("Spell: ");
                b2.setTitle("Spell: ");
                b3.setTitle("Spell: ");
                b4.setTitle("Spell: ");
                if (temp == null)
                    break;
                v0.setText(Integer.toString(temp.getiValue(0, 1)));
                // TODO: make sure are valid spells.
                String st = temp.getsValue(1);
                for (int spc = 1; spc < 5; spc++) {
                    st = temp.getsValue(spc);
                    if (!theSpellList.isSpell(st))
                        temp.setsValue(spc, "");
                }

                v1.setText(temp.getsValue(1));
                v2.setText(temp.getsValue(2));
                v3.setText(temp.getsValue(3));
                v4.setText(temp.getsValue(4));
                break;
            }
            case MudConstants.ITEM_PORTAL: {
                turnOn(ON0 | ON1 | ON2 | ON3);
                b0.setTitle("Charges");
                b1.setTitle("Exit Flags");
                b2.setTitle("Portal Flags");
                b3.setTitle("Goes to(vnum)");
                if (temp == null)
                    break;
                v0.setText(Integer.toString(temp.getiValue(0, 1)));
                v1.setText(MudConstants.exitFlagString(temp.getiValue(1)));
                v2.setText(MudConstants.portalFlagString(temp.getiValue(2)));
                v3.setText(Integer.toString(temp.getiValue(3)));
                break;
            }
            case MudConstants.ITEM_TREASURE:
            case MudConstants.ITEM_CLOTHING:
            case MudConstants.ITEM_TRASH:
            case MudConstants.ITEM_KEY:
            case MudConstants.ITEM_BOAT:
            case MudConstants.ITEM_MAP:
            case MudConstants.ITEM_WARP_STONE:
            case MudConstants.ITEM_ROOM_KEY:
            case MudConstants.ITEM_GEM:
            case MudConstants.ITEM_JEWELRY:
            case MudConstants.ITEM_JUKEBOX:
            case MudConstants.ITEM_ORE: {
                turnOn(OFF);
                break;
            }

        } // switch

        p0.setBorder(b0);
        p1.setBorder(b1);
        p2.setBorder(b2);
        p3.setBorder(b3);
        p4.setBorder(b4);
        validate();
        repaint();

    } // function

    public void turnOn(int which) {
        v0.setEnabled(false);
        v1.setEnabled(false);
        v2.setEnabled(false);
        v3.setEnabled(false);
        v4.setEnabled(false);
        b0.setTitle("V0");
        b1.setTitle("V1");
        b2.setTitle("V2");
        b3.setTitle("V3");
        b4.setTitle("V4");
        v0.setText("unused");
        v1.setText("unused");
        v2.setText("unused");
        v3.setText("unused");
        v4.setText("unused");

        if ((which & ON0) == ON0) {
            v0.setEnabled(true);
            v0.setText("");
        }
        if ((which & ON1) == ON1) {
            v1.setEnabled(true);
            v1.setText("");
        }
        if ((which & ON2) == ON2) {
            v2.setEnabled(true);
            v2.setText("");
        }
        if ((which & ON3) == ON3) {
            v3.setEnabled(true);
            v3.setText("");
        }
        if ((which & ON4) == ON4) {
            v4.setEnabled(true);
            v4.setText("");
        }
    }

    class v0FocusListener implements FocusListener {
        protected WeaponTypeTable theWeaponTypes;

        public v0FocusListener(WeaponTypeTable wTable) {
            super();
            theWeaponTypes = wTable;
        }

        public void focusGained(FocusEvent e) {

            int which = MudConstants.TypeLookup(typeBox.getSelectedIndex());

            if (which == MudConstants.ITEM_WEAPON) {
                MudObject temp = (MudObject) data.getObject(vnum);
                JComboBox options = theWeaponTypes.getWeaponTypeComboBox();
                options.setSelectedItem(temp.getsValue(0));

                int dec = JOptionPane.showConfirmDialog(null, options, "Choose weapon type:", JOptionPane.OK_CANCEL_OPTION);

                if (dec == JOptionPane.CANCEL_OPTION)
                    options.setSelectedItem(temp.getsValue(0));

                temp.setsValue(0, (String) options.getSelectedItem());
                vnum = temp.vnum;
                update();
            }
        }

        public void focusLost(FocusEvent e) {
            int type = MudConstants.TypeLookup(typeBox.getSelectedIndex());

            JTextField field = (JTextField) e.getSource();

            try {
                if (vnum == -1)
                    return;

                MudObject temp = data.getObject(vnum);
                switch (type) {
                    case MudConstants.ITEM_WAND:  // all int types
                    case MudConstants.ITEM_STAFF:
                    case MudConstants.ITEM_ARMOR:
                    case MudConstants.ITEM_FURNITURE:
                    case MudConstants.ITEM_FOUNTAIN:
                    case MudConstants.ITEM_DRINK_CON:
                    case MudConstants.ITEM_FOOD:
                    case MudConstants.ITEM_MONEY:
                    case MudConstants.ITEM_SCROLL:
                    case MudConstants.ITEM_POTION:
                    case MudConstants.ITEM_PILL:
                    case MudConstants.ITEM_PORTAL:
                    case MudConstants.ITEM_CONTAINER: {
                        temp.setiValue(0, Integer.parseInt(field.getText()));
                        break;
                    }
                    default:
                        break;
                }
            }
            catch (Exception exp) {
                System.out.println("Error setting value 0.");
            }
            finally {
                update();
            }
        }
    }

    class v1FocusListener implements FocusListener {
        public void focusGained(FocusEvent e) {
            int which = MudConstants.TypeLookup(typeBox.getSelectedIndex());

            if (which == MudConstants.ITEM_CONTAINER) {
                MudObject temp = (MudObject) data.getObject(vnum);
                FlagChoice choice = new FlagChoice("container flags", MudConstants.containerFlagNames,
                        MudConstants.containerFlags, MudConstants.NUM_CONTAINER_FLAGS, null);
                choice.setFlags(temp.getiValue(1));

                int dec = JOptionPane.showConfirmDialog(null, choice, "Set container flags:", JOptionPane.OK_CANCEL_OPTION);

                if (dec == JOptionPane.CANCEL_OPTION)
                    choice.setFlags(temp.getiValue(1));

                temp.setiValue(1, choice.getFlags());
                vnum = temp.vnum;
                update();
            } else if (which == MudConstants.ITEM_SCROLL
                    || which == MudConstants.ITEM_POTION
                    || which == MudConstants.ITEM_PILL) {
                MudObject temp = (MudObject) data.getObject(vnum);
                JComboBox options = theSpellList.getSpellListComboBox();
                options.setSelectedItem(temp.getsValue(1));

                int dec = JOptionPane.showConfirmDialog(null, options, "Choose spell:", JOptionPane.OK_CANCEL_OPTION);

                if (dec == JOptionPane.CANCEL_OPTION)
                    options.setSelectedItem(temp.getsValue(1));

                if (options.getSelectedIndex() != 0)
                    temp.setsValue(1, (String) options.getSelectedItem());
                else
                    temp.setsValue(1, "");

                vnum = temp.vnum;
                update();
            } else if (which == MudConstants.ITEM_PORTAL) {
                MudObject temp = (MudObject) data.getObject(vnum);
                FlagChoice choice = new FlagChoice("exit flags", MudConstants.exitNames,
                        MudConstants.exitFlags, MudConstants.NUM_EXIT_FLAGS, null);
                choice.setFlags(temp.getiValue(1));

                int dec = JOptionPane.showConfirmDialog(null, choice, "Set exit flags:", JOptionPane.OK_CANCEL_OPTION);

                if (dec == JOptionPane.CANCEL_OPTION)
                    choice.setFlags(temp.getiValue(1));

                temp.setiValue(1, choice.getFlags());
                vnum = temp.vnum;
                update();
            }
        }

        public void focusLost(FocusEvent e) {
            int type = MudConstants.TypeLookup(typeBox.getSelectedIndex());

            JTextField field = (JTextField) e.getSource();

            try {
                if (vnum == -1)
                    return;

                MudObject temp = data.getObject(vnum);
                switch (type) {
                    case MudConstants.ITEM_WAND:  // all int types
                    case MudConstants.ITEM_STAFF:
                    case MudConstants.ITEM_WEAPON:
                    case MudConstants.ITEM_ARMOR:
                    case MudConstants.ITEM_FURNITURE:
                    case MudConstants.ITEM_FOUNTAIN:
                    case MudConstants.ITEM_DRINK_CON:
                    case MudConstants.ITEM_FOOD: {
                        temp.setiValue(1, Integer.parseInt(field.getText()));
                        break;
                    }
                    case MudConstants.ITEM_SCROLL:
                    case MudConstants.ITEM_POTION:
                    case MudConstants.ITEM_PILL: // all string types
                    {
                        temp.setsValue(1, field.getText());
                        break;
                    }
                    default:
                        break;
                }
                System.out.println("Set the value..");
            }
            catch (Exception exp) {
                System.out.println("Error setting value 1.");
            }
            finally {
                update();
            }
        }
    }

    class v2FocusListener implements FocusListener {
        Area data;

        public v2FocusListener(Area d) {
            data = d;
        }

        public void focusGained(FocusEvent e) {
            int which = MudConstants.TypeLookup(typeBox.getSelectedIndex());

            if (which == MudConstants.ITEM_CONTAINER) {
                MudObject temp = (MudObject) data.getObject(vnum);
                JComboBox options = data.getVnumCombo("object");
                MudObject t2 = (MudObject) data.getObject(temp.getiValue(2));
                if (t2 != null)
                    options.setSelectedItem(t2);

                int dec = JOptionPane.showConfirmDialog(null, options, "Choose container key:", JOptionPane.OK_CANCEL_OPTION);

                if (dec == JOptionPane.CANCEL_OPTION)
                    options.setSelectedItem(t2);

                t2 = (MudObject) options.getSelectedItem();
                if (t2 == null)
                    temp.setiValue(2, 0);
                else
                    temp.setiValue(2, t2.getVnum());

                vnum = temp.vnum;
                update();
            } else if (which == MudConstants.ITEM_SCROLL
                    || which == MudConstants.ITEM_POTION
                    || which == MudConstants.ITEM_PILL) {
                MudObject temp = (MudObject) data.getObject(vnum);
                JComboBox options = theSpellList.getSpellListComboBox();
                options.setSelectedItem(temp.getsValue(2));

                int dec = JOptionPane.showConfirmDialog(null, options, "Choose spell:", JOptionPane.OK_CANCEL_OPTION);

                if (dec == JOptionPane.CANCEL_OPTION)
                    options.setSelectedItem(temp.getsValue(2));

                if (options.getSelectedIndex() != 0)
                    temp.setsValue(2, (String) options.getSelectedItem());
                else
                    temp.setsValue(2, "");

                vnum = temp.vnum;
                update();
            } else if (which == MudConstants.ITEM_FURNITURE) {
                MudObject temp = (MudObject) data.getObject(vnum);
                FlagChoice choice = new FlagChoice("furniture flags", MudConstants.furnitureFlagNames,
                        MudConstants.furnitureFlags, MudConstants.NUM_FURNITURE_FLAGS, null);
                choice.setFlags(temp.getiValue(2));

                int dec = JOptionPane.showConfirmDialog(null, choice, "Set furniture flags:", JOptionPane.OK_CANCEL_OPTION);

                if (dec == JOptionPane.CANCEL_OPTION)
                    choice.setFlags(temp.getiValue(2));

                temp.setiValue(2, choice.getFlags());
                vnum = temp.vnum;
                update();
            } else if (which == MudConstants.ITEM_PORTAL) {
                MudObject temp = (MudObject) data.getObject(vnum);
                FlagChoice choice = new FlagChoice("portal flags", MudConstants.portalFlagNames,
                        MudConstants.portalFlags, MudConstants.NUM_PORTAL_FLAGS, null);
                choice.setFlags(temp.getiValue(2));

                int dec = JOptionPane.showConfirmDialog(null, choice, "Set portal flags:", JOptionPane.OK_CANCEL_OPTION);

                if (dec == JOptionPane.CANCEL_OPTION)
                    choice.setFlags(temp.getiValue(2));

                temp.setiValue(2, choice.getFlags());
                vnum = temp.vnum;
                update();
            } else if (which == MudConstants.ITEM_DRINK_CON
                    || which == MudConstants.ITEM_FOUNTAIN) {
                MudObject temp = (MudObject) data.getObject(vnum);
                JComboBox options = theLiquidTypes.getLiquidTypeComboBox();
                options.setSelectedItem(temp.getsValue(2));

                int dec = JOptionPane.showConfirmDialog(null, options, "Choose liquid:", JOptionPane.OK_CANCEL_OPTION);

                if (dec == JOptionPane.CANCEL_OPTION)
                    options.setSelectedItem(temp.getsValue(2));

                temp.setsValue(2, (String) options.getSelectedItem());
                vnum = temp.vnum;
                update();
            }
        }

        public void focusLost(FocusEvent e) {
            int type = MudConstants.TypeLookup(typeBox.getSelectedIndex());

            JTextField field = (JTextField) e.getSource();

            try {
                if (vnum == -1)
                    return;

                MudObject temp = data.getObject(vnum);
                switch (type) {
                    case MudConstants.ITEM_LIGHT:
                    case MudConstants.ITEM_WAND:  // all int types
                    case MudConstants.ITEM_STAFF:
                    case MudConstants.ITEM_WEAPON:
                    case MudConstants.ITEM_ARMOR: {
                        temp.setiValue(2, Integer.parseInt(field.getText()));
                        break;
                    }
                    case MudConstants.ITEM_SCROLL:
                    case MudConstants.ITEM_POTION:
                    case MudConstants.ITEM_PILL: // all string types
                    {
                        temp.setsValue(2, field.getText());
                        break;
                    }
                    default:
                        break;
                }
                System.out.println("Set the value..");
            }
            catch (Exception exp) {
                System.out.println("Error setting value 2.");
            }
            finally {
                update();
            }
        }
    }

    class v3FocusListener implements FocusListener {
        protected DamTypeTable theDamTypes;
        protected Area data;

        public v3FocusListener(DamTypeTable dTable, Area a) {
            super();
            theDamTypes = dTable;
            data = a;
        }

        public void focusGained(FocusEvent e) {
            int which = MudConstants.TypeLookup(typeBox.getSelectedIndex());

            if (which == MudConstants.ITEM_WEAPON) {
                MudObject temp = (MudObject) data.getObject(vnum);
                JComboBox options = theDamTypes.getDamTypeComboBox();
                options.setSelectedItem(temp.getsValue(3));

                int dec = JOptionPane.showConfirmDialog(null, options, "Choose damage type:", JOptionPane.OK_CANCEL_OPTION);

                if (dec == JOptionPane.CANCEL_OPTION)
                    options.setSelectedItem(temp.getsValue(3));

                temp.setsValue(3, (String) options.getSelectedItem());
                vnum = temp.vnum;
                update();
            } else if (which == MudConstants.ITEM_SCROLL
                    || which == MudConstants.ITEM_POTION
                    || which == MudConstants.ITEM_PILL
                    || which == MudConstants.ITEM_WAND
                    || which == MudConstants.ITEM_STAFF) {
                MudObject temp = (MudObject) data.getObject(vnum);
                JComboBox options = theSpellList.getSpellListComboBox();
                options.setSelectedItem(temp.getsValue(3));

                int dec = JOptionPane.showConfirmDialog(null, options, "Choose spell:", JOptionPane.OK_CANCEL_OPTION);

                if (dec == JOptionPane.CANCEL_OPTION)
                    options.setSelectedItem(temp.getsValue(3));

                if (options.getSelectedIndex() != 0)
                    temp.setsValue(3, (String) options.getSelectedItem());
                else
                    temp.setsValue(3, "");

                vnum = temp.vnum;
                update();
            } else if (which == MudConstants.ITEM_FOOD
                    || which == MudConstants.ITEM_DRINK_CON
                    || which == MudConstants.ITEM_FOUNTAIN) {
                MudObject temp = (MudObject) data.getObject(vnum);
                String[] yesno = {"No", "Yes"};
                JComboBox options = new JComboBox(yesno);
                options.setSelectedIndex(temp.getiValue(3));

                int dec = JOptionPane.showConfirmDialog(null, options, "Is this liquid poisoned?", JOptionPane.OK_CANCEL_OPTION);

                if (dec == JOptionPane.CANCEL_OPTION)
                    options.setSelectedIndex(temp.getiValue(3));

                temp.setiValue(3, options.getSelectedIndex());
                vnum = temp.vnum;
                update();
            } else if (which == MudConstants.ITEM_PORTAL) {
                MudObject temp = (MudObject) data.getObject(vnum);
                JComboBox options = data.getVnumCombo("rooms");
                Room t2 = (Room) data.getRoom(temp.getiValue(3));
                if (t2 == null)
                    options.setSelectedIndex(0);
                else
                    options.setSelectedItem(t2);

                int dec = JOptionPane.showConfirmDialog(null, options, "Choose room portal leads to:", JOptionPane.OK_CANCEL_OPTION);

                if (dec == JOptionPane.CANCEL_OPTION)
                    options.setSelectedItem(t2);

                t2 = (Room) options.getSelectedItem();
                if (t2 != null)
                    temp.setiValue(3, t2.getVnum());
                else
                    temp.setiValue(3, 0);

                vnum = temp.vnum;
                update();
            }
        }

        public void focusLost(FocusEvent e) {
            int type = MudConstants.TypeLookup(typeBox.getSelectedIndex());

            JTextField field = (JTextField) e.getSource();

            try {
                if (vnum == -1)
                    return;

                MudObject temp = data.getObject(vnum);
                switch (type) {
                    case MudConstants.ITEM_FURNITURE:
                    case MudConstants.ITEM_ARMOR: {
                        temp.setiValue(3, Integer.parseInt(field.getText()));
                        break;
                    }
                    case MudConstants.ITEM_STAFF:
                    case MudConstants.ITEM_WAND:
                    case MudConstants.ITEM_SCROLL:
                    case MudConstants.ITEM_POTION:
                    case MudConstants.ITEM_PILL: // all string types
                    {
                        temp.setsValue(3, field.getText());
                        break;
                    }
                    default:
                        break;
                }
                System.out.println("Set the value..");
            }
            catch (Exception exp) {
                System.out.println("Error setting value 3.");
            }
            finally {
                update();
            }
        }
    }

    class v4FocusListener implements FocusListener {
        public void focusGained(FocusEvent e) {
            int which = MudConstants.TypeLookup(typeBox.getSelectedIndex());

            if (which == MudConstants.ITEM_WEAPON) {
                MudObject temp = (MudObject) data.getObject(vnum);
                FlagChoice choice = new FlagChoice("weapon flags", MudConstants.weaponFlagNames,
                        MudConstants.weaponFlags, MudConstants.NUM_WEAPON_FLAGS, null);
                choice.setFlags(temp.getiValue(4));

                int dec = JOptionPane.showConfirmDialog(null, choice, "Set weapon flags:", JOptionPane.OK_CANCEL_OPTION);

                if (dec == JOptionPane.CANCEL_OPTION)
                    choice.setFlags(temp.getiValue(4));

                temp.setiValue(4, choice.getFlags());
                vnum = temp.vnum;
                update();
            } else if (which == MudConstants.ITEM_SCROLL
                    || which == MudConstants.ITEM_POTION
                    || which == MudConstants.ITEM_PILL) {
                MudObject temp = (MudObject) data.getObject(vnum);
                JComboBox options = theSpellList.getSpellListComboBox();
                options.setSelectedItem(temp.getsValue(4));

                int dec = JOptionPane.showConfirmDialog(null, options, "Choose spell:", JOptionPane.OK_CANCEL_OPTION);

                if (dec == JOptionPane.CANCEL_OPTION)
                    options.setSelectedItem(temp.getsValue(4));

                if (options.getSelectedIndex() != 0)
                    temp.setsValue(4, (String) options.getSelectedItem());
                else
                    temp.setsValue(4, "");

                vnum = temp.vnum;
                update();
            }
        }

        public void focusLost(FocusEvent e) {
            int type = MudConstants.TypeLookup(typeBox.getSelectedIndex());

            JTextField field = (JTextField) e.getSource();

            try {
                if (vnum == -1)
                    return;

                MudObject temp = data.getObject(vnum);
                switch (type) {
                    case MudConstants.ITEM_FURNITURE:
                    case MudConstants.ITEM_CONTAINER: {
                        temp.setiValue(4, Integer.parseInt(field.getText()));
                        break;
                    }
                    case MudConstants.ITEM_SCROLL:
                    case MudConstants.ITEM_POTION:
                    case MudConstants.ITEM_PILL: // all string types
                    {
                        temp.setsValue(4, field.getText());
                        break;
                    }
                    default:
                        break;
                }
                System.out.println("Set the value..");
            }
            catch (Exception exp) {
                System.out.println("Error setting value 4.");
            }
            finally {
                update();
            }
        }
    }

}

/*
      switch( which )
      {
         case MudConstants.ITEM_LIGHT :
         {
            break;
         }
         case MudConstants.ITEM_SCROLL :
         {
            break;
         }
         case MudConstants.ITEM_WAND :
         {
            break;
         }
         case MudConstants.ITEM_STAFF :
         {
            break;
         }
         case MudConstants.ITEM_WEAPON :
         {
            break;
         }
         case MudConstants.ITEM_TREASURE :
         {
            break;
         }
         case MudConstants.ITEM_ARMOR :
         {
            break;
         }
         case MudConstants.ITEM_POTION :
         {
            break;
         }
         case MudConstants.ITEM_CLOTHING :
         {
            break;
         }
         case MudConstants.ITEM_FURNITURE :
         {
            break;
         }
         case MudConstants.ITEM_TRASH :
         {
            break;
         }
         case MudConstants.ITEM_CONTAINER :
         {
            break;
         }
         case MudConstants.ITEM_DRINK_CON :
         {
            break;
         }
         case MudConstants.ITEM_KEY :
         {
            break;
         }
         case MudConstants.ITEM_FOOD :
         {
            break;
         }
         case MudConstants.ITEM_MONEY :
         {
            break;
         }
         case MudConstants.ITEM_BOAT :
         {
            break;
         }
         case MudConstants.ITEM_FOUNTAIN :
         {
            break;
         }
         case MudConstants.ITEM_PILL :
         {
            break;
         }
         case MudConstants.ITEM_MAP :
         {
            break;
         }
         case MudConstants.ITEM_PORTAL :
         {
            break;
         }
         case MudConstants.ITEM_WARP_STONE :
         {
            break;
         }
         case MudConstants.ITEM_ROOM_KEY :
         {
            break;
         }
         case MudConstants.ITEM_GEM :
         {
            break;
         }
         case MudConstants.ITEM_JEWELRY :
         {
            break;
         }
         case MudConstants.ITEM_JUKEBOX :
         {
            break;
         }
         case MudConstants.ITEM_ORE :
         {
            break;
         }

      }
*/


text:
import React, { PropTypes } from 'react'
import classnames from 'classnames'
import Orgs from './Orgs'
import {componentHandler} from 'exports?componentHandler&MaterialRipple!material-design-lite/material.js'

export default class {
  static displayName = 'User'

  static PropTypes = {
    actions: PropTypes.object.isRequired,
    user: PropTypes.object
  }

  runLogin () {
    !this.props.user.details.login ? this.props.actions.login() : this.props.actions.logout()
    !this.props.user.details.login ? this.props.actions.initiateLogin() : null
  }

  componentDidMount () {
    componentHandler.upgradeDom()
  }

  componentDidUpdate () {
    componentHandler.upgradeDom()
  }

  render () {
    const { actions, user } = this.props
    const username = user.details ? user.details.login : ``
    const orgs = user ? user.orgs : []
    const loggedInMsg = username ? `Log Out` : `Login with GitHub`

    return (

              Tigris Bot

                <button onClick={this.runLogin.bind(this)} href="#" className={classnames('mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent')}>
                  {loggedInMsg}
                </button>

              {!username && !user.isFetching &&

                  Homepage content goes here

              }
              {user.isFetching &&

              }
              <Orgs orgs={orgs} actions={actions} />

GitHub

    )
  }

}


text:
using System;
using TrueCraft.API.Networking;

namespace TrueCraft.API
{
    public class MetadataFloat : MetadataEntry
    {
        public override byte Identifier { get { return 3; } }
        public override string FriendlyName { get { return "float"; } }

        public float Value;

        public static implicit operator MetadataFloat(float value)
        {
            return new MetadataFloat(value);
        }

        public MetadataFloat()
        {
        }

        public MetadataFloat(float value)
        {
            Value = value;
        }

        public override void FromStream(IMinecraftStream stream)
        {
            Value = stream.ReadSingle();
        }

        public override void WriteTo(IMinecraftStream stream, byte index)
        {
            stream.WriteUInt8(GetKey(index));
            stream.WriteSingle(Value);
        }
    }
}


text:
""" . """
import sys
sys.path += ["../modules"]
from pygletUtil import *
import pyglet
from util import *

def makeAnim(imgName, x, y, framesCount, delay):
    """ Создание cпрайта анимации. """
    frames = list()
    for i in range(0, framesCount-1):
        img = pyglet.image.load(imgName + str(i) + '.png')
        center_image(img)
        frames += [pyglet.image.AnimationFrame(img, delay)]
    anim = pyglet.image.Animation(frames)
    sprite = Sprite(anim, x=x, y=y)
    return sprite

def makeAnimObj( imgName, x, y, framesCount, delay):
    """ Создание объекта с анимацией. """
    obj = HasSprite()
    obj.sprite = makeAnim(imgName, x, y, framesCount, delay)
    return obj


text:
Rails.application.routes.draw do
  mount Alchemy::Engine => '/'
end


text:
package org.wso2.developerstudio.eclipse.gmf.esb;

/**
 *
 * A representation of the model object 'Bean Mediator Input Connector'.
 *
 *
 *
 * @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getBeanMediatorInputConnector()
 * @model
 * @generated
 */
public interface BeanMediatorInputConnector extends InputConnector {
} // BeanMediatorInputConnector


text:
package org.fcrepo.http.commons.session;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.mockito.MockitoAnnotations.initMocks;

import java.security.Principal;

import javax.jcr.Credentials;
import javax.jcr.Repository;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.servlet.http.HttpServletRequest;

import org.fcrepo.kernel.api.Transaction;
import org.fcrepo.kernel.api.exception.SessionMissingException;
import org.fcrepo.kernel.api.services.TransactionService;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.modeshape.jcr.api.ServletCredentials;

import com.google.common.base.Throwables;

/**
 *
SessionFactoryTest class.

 *
 * @author awoods
 */
public class SessionFactoryTest {

    SessionFactory testObj;

    @Mock
    private Session txSession;

    @Mock
    private Session mockSession;

    @Mock
    private Repository mockRepo;

    @Mock
    private TransactionService mockTxService;

    @Mock
    private Transaction mockTx;

    @Mock
    private HttpServletRequest mockRequest;

    @Mock
    private Principal mockUser;

    @Before
    public void setUp() {
        initMocks(this);
        testObj = new SessionFactory(mockRepo, mockTxService);
        testObj.init();
    }

    @Test
    public void testGetSessionWithNullPath() throws RepositoryException {
        when(mockRequest.getPathInfo()).thenReturn(null);
        when(mockRequest.getContextPath()).thenReturn("");
        when(mockRepo.login(any(Credentials.class))).thenReturn(mockSession);
        testObj.getSession(mockRequest);
        verify(mockRepo).login(any(ServletCredentials.class));
    }

   @Test
    public void testGetSessionUnauthenticated() throws RepositoryException {
        testObj.getInternalSession();
        verify(mockRepo).login();
    }

    @Test
    public void testCreateSession() throws RepositoryException {
        when(mockRequest.getPathInfo()).thenReturn("/some/path");
        testObj.createSession(mockRequest);
        verify(mockRepo).login(any(Credentials.class));
    }

    @Test
    public void testGetSessionFromTransaction() {
        when(mockRequest.getPathInfo()).thenReturn("/tx:123/some/path");
        when(mockTx.getSession()).thenReturn(mock(Session.class));
        when(mockTxService.getTransaction("123", null)).thenReturn(mockTx);
        final Session session = testObj.getSessionFromTransaction(mockRequest, "123");
        assertEquals(mockTx.getSession(), session);
    }

    @Test
    public void testGetSessionThrowException() {
        when(mockRequest.getPathInfo()).thenReturn("/tx:123/some/path");
        when(mockTx.getSession()).thenReturn(mock(Session.class));
        when(mockTxService.getTransaction("123", null)).thenThrow(
                new SessionMissingException(""));
        try {
            testObj.getSession(mockRequest);
        } catch (final RuntimeException e) {
            final Throwable rootCause = Throwables.getRootCause(e);
            assertTrue("TransactionMissionException expected",
                    rootCause instanceof SessionMissingException);
        }
    }

    @Test
    public void testGetEmbeddedIdTx() {
        when(mockRequest.getPathInfo()).thenReturn("/tx:123/some/path");
        final String txId = testObj.getEmbeddedId(mockRequest, SessionFactory.Prefix.TX);
        assertEquals("txId should be 123", "123", txId);
    }

}


text:
USING_NS_CC;
USING_NS_CC_EXT;
using namespace cocosbuilder;

ButtonTestLayer::ButtonTestLayer()
: mControlEventLabel(NULL)
{}

ButtonTestLayer::~ButtonTestLayer()
{
    CC_SAFE_RELEASE(mControlEventLabel);
}

SEL_MenuHandler ButtonTestLayer::onResolveCCBCCMenuItemSelector(Object * pTarget, const char * pSelectorName) {
    return NULL;
}

Control::Handler ButtonTestLayer::onResolveCCBCCControlSelector(Object * pTarget, const char * pSelectorName) {
    CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, "onCCControlButtonClicked", ButtonTestLayer::onControlButtonClicked);

    return NULL;
}

bool ButtonTestLayer::onAssignCCBMemberVariable(Object * pTarget, const char * pMemberVariableName, Node * pNode) {
    CCB_MEMBERVARIABLEASSIGNER_GLUE(this, "mCCControlEventLabel", LabelBMFont *, this->mControlEventLabel);

    return false;
}

void ButtonTestLayer::onControlButtonClicked(cocos2d::Object *pSender, Control::EventType pControlEvent) {
    switch(pControlEvent) {
        case Control::EventType::TOUCH_DOWN:
            this->mControlEventLabel->setString("Touch Down.");
            break;
        case Control::EventType::DRAG_INSIDE:
            this->mControlEventLabel->setString("Touch Drag Inside.");
            break;
        case Control::EventType::DRAG_OUTSIDE:
            this->mControlEventLabel->setString("Touch Drag Outside.");
            break;
        case Control::EventType::DRAG_ENTER:
            this->mControlEventLabel->setString("Touch Drag Enter.");
            break;
        case Control::EventType::DRAG_EXIT:
            this->mControlEventLabel->setString("Touch Drag Exit.");
            break;
        case Control::EventType::TOUCH_UP_INSIDE:
            this->mControlEventLabel->setString("Touch Up Inside.");
            break;
        case Control::EventType::TOUCH_UP_OUTSIDE:
            this->mControlEventLabel->setString("Touch Up Outside.");
            break;
        case Control::EventType::TOUCH_CANCEL:
            this->mControlEventLabel->setString("Touch Cancel.");
            break;
        case Control::EventType::VALUE_CHANGED:
            this->mControlEventLabel->setString("Value Changed.");
            break;
        default:
            assert(false); // OH SHIT!
    }
}