text:
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using XBindLecture.ViewModels;

#if WINDOWS_APP || WINDOWS_UWP
using Windows.System;
using Windows.UI.Core;
#endif

namespace XBindLecture.Views
{
	public sealed class NavigationHelper
	{
		private Page Page { get; }
		private Frame Frame { get { return this.Page.Frame; } }

		public NavigationHelper(Page page)
		{
			this.Page = page;
			this.Page.Loaded += this.OnLoaded;
			this.Page.Unloaded += this.OnUnloaded;
		}

		private void OnLoaded(object sender, RoutedEventArgs e)
		{
#if WINDOWS_PHONE_APP
			Windows.Phone.UI.Input.HardwareButtons.BackPressed += OnHardwareButtonsBackPressed;
#else
			Window.Current.CoreWindow.Dispatcher.AcceleratorKeyActivated += this.OnCoreDispatcherAcceleratorKeyActivated;
			Window.Current.CoreWindow.PointerPressed += this.OnCoreWindowPointerPressed;
#endif

#if WINDOWS_UWP
			SystemNavigationManager.GetForCurrentView().BackRequested += this.OnBackRequested;
#endif
		}

#if WINDOWS_UWP
		public void OnNavigatedTo(Windows.UI.Xaml.Navigation.NavigationEventArgs e)
		{
			SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = this.CanGoBack
				? AppViewBackButtonVisibility.Visible
				: AppViewBackButtonVisibility.Collapsed;
		}
#endif

		private void OnUnloaded(object sender, RoutedEventArgs e)
		{
#if WINDOWS_PHONE_APP
			Windows.Phone.UI.Input.HardwareButtons.BackPressed -= OnHardwareButtonsBackPressed;
#else
			Window.Current.CoreWindow.Dispatcher.AcceleratorKeyActivated -= this.OnCoreDispatcherAcceleratorKeyActivated;
			Window.Current.CoreWindow.PointerPressed -= this.OnCoreWindowPointerPressed;
#endif
#if WINDOWS_UWP
			SystemNavigationManager.GetForCurrentView().BackRequested -= this.OnBackRequested;
#endif
		}

		#region ナビゲーション サポート

		public RelayCommand GoHomeCommand
		{
			get { return this._GoHomeCommand ?? (this._GoHomeCommand = new RelayCommand(() => this.GoHome(), () => this.CanGoHome)); }
		}
		private RelayCommand _GoHomeCommand = null;

		public RelayCommand GoBackCommand
		{
			get { return this._GoBackCommand ?? (this._GoBackCommand = new RelayCommand(() => this.GoBack(), () => this.CanGoBack)); }
		}
		private RelayCommand _GoBackCommand = null;

		public RelayCommand GoForwardCommand
		{
			get { return this._GoForwardCommand ?? (this._GoForwardCommand = new RelayCommand(() => this.GoForward(), () => this.CanGoForward)); }
		}
		private RelayCommand _GoForwardCommand = null;

		public bool CanGoHome => this.Frame?.CanGoBack ?? false;
		public bool CanGoBack => this.Frame?.CanGoBack ?? false;
		public bool CanGoForward => this.Frame?.CanGoForward ?? false;

		public bool GoHome()
		{
			var depth = this.Frame.BackStackDepth;
			if (depth-- != 0)
			{
				do
				{
					this.Frame.GoBack();
				} while (depth-- != 0);
			}
			return false;
		}

		public bool GoBack()
		{
			if (!this.CanGoBack) return false;

			this.Frame.GoBack();
			return true;
		}

		public bool GoForward()
		{
			if (this.CanGoForward) return false;

			this.Frame.GoForward();
			return true;
		}

#if WINDOWS_PHONE_APP
		private void OnHardwareButtonsBackPressed(object sender, Windows.Phone.UI.Input.BackPressedEventArgs e)
		{
			if (this.GoBackCommand.CanExecute(null))
			{
				e.Handled = true;
				this.GoBackCommand.Execute(null);
			}
		}
#else
		private void OnCoreDispatcherAcceleratorKeyActivated(CoreDispatcher sender, AcceleratorKeyEventArgs e)
		{
			var virtualKey = e.VirtualKey;
			if ((e.EventType == CoreAcceleratorKeyEventType.SystemKeyDown || e.EventType == CoreAcceleratorKeyEventType.KeyDown)
				&& (virtualKey == VirtualKey.Left || virtualKey == VirtualKey.Right
				|| virtualKey == VirtualKey.GoForward || virtualKey == VirtualKey.GoForward || virtualKey == VirtualKey.GoHome))
			{
				var coreWindow = Window.Current.CoreWindow;
				var downState = CoreVirtualKeyStates.Down;
				bool menuKey = (coreWindow.GetKeyState(VirtualKey.Menu) & downState) == downState;
				bool controlKey = (coreWindow.GetKeyState(VirtualKey.Control) & downState) == downState;
				bool shiftKey = (coreWindow.GetKeyState(VirtualKey.Shift) & downState) == downState;
				bool noModifiers = !menuKey && !controlKey && !shiftKey;
				bool onlyAlt = menuKey && !controlKey && !shiftKey;

				if (virtualKey == VirtualKey.GoBack && noModifiers || virtualKey == VirtualKey.Left && onlyAlt)
				{
					e.Handled = this.GoBack();
				}
				else if (virtualKey == VirtualKey.GoForward && noModifiers || virtualKey == VirtualKey.Right && onlyAlt)
				{
					e.Handled = this.GoForward();
				}
				else if (virtualKey == VirtualKey.GoHome && noModifiers)
				{
					e.Handled = this.GoForward();
				}
			}
		}

		private void OnCoreWindowPointerPressed(CoreWindow sender, PointerEventArgs e)
		{
			var properties = e.CurrentPoint.Properties;
			bool backPressed = properties.IsXButton1Pressed;
			bool forwardPressed = properties.IsXButton2Pressed;
			if (backPressed ^ forwardPressed)
			{
				if (backPressed) e.Handled = this.GoBack();
				else e.Handled = this.GoForward();
			}
		}
#endif
#if WINDOWS_UWP

		private void OnBackRequested(object sender, BackRequestedEventArgs e)
		{
			e.Handled = this.GoBack();
		}

#endif
		#endregion
	}
}


text:
require "irb/cmd/nop.rb"
require "irb/ext/change-ws.rb"

module IRB
  module ExtendCommand

    class CurrentWorkingWorkspace<Nop
      def execute(*obj)
	irb_context.main
      end
    end

    class ChangeWorkspace<Nop
      def execute(*obj)
	irb_context.change_workspace(*obj)
	irb_context.main
      end
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
package com.gmail.chibitopoochan.soqlexec.soap.partner.wrapper;

import javax.xml.namespace.QName;

import com.gmail.chibitopoochan.soqlexec.soap.wrapper.QNameWrapper;

public class PartnerQNameWrapper implements QNameWrapper {
	private QName name;

	public PartnerQNameWrapper(){}

	public PartnerQNameWrapper(QName name) {
		setQNameWrapper(name);
	}

	public void setQNameWrapper(QName name) {
		this.name = name;
	}

	public String getLocalPart() {
		return name.getLocalPart();
	}

}


text:
console.log('加载了 square 模块')

import {multiply} from './multiply.js';

var square = function(num) {
    return multiply(num, num);
};

export {square}


text:
use strict;
use warnings;

use Bio::EnsEMBL::Registry;
use Bio::AlignIO;

#
# This script gets all the LASTZ alignments covering the orthologues
# between human and mouse (via GenomicAlignBlocks)
#

my $reg = 'Bio::EnsEMBL::Registry';

$reg->load_registry_from_db(
  -host=>'ensembldb.ensembl.org',
  -user=>'anonymous',
);

# get compara DBAdaptor
my $comparaDBA = Bio::EnsEMBL::Registry->get_DBAdaptor('Multi', 'compara');

my $sp1 = "human";
my $sp2 = "mouse";

# get MethodLinkSpeciesSet for LASTZ_NET alignments between human and mouse
my $blastz_mlss = $comparaDBA->get_MethodLinkSpeciesSetAdaptor->fetch_by_method_link_type_registry_aliases("LASTZ_NET", [$sp1, $sp2]);
# get MethodLinkSpeciesSet for orthologies alignments between human and mouse
my $homology_mlss = $comparaDBA->get_MethodLinkSpeciesSetAdaptor->fetch_by_method_link_type_registry_aliases("ENSEMBL_ORTHOLOGUES", [$sp1, $sp2]);

my $homology_list = $comparaDBA->get_HomologyAdaptor->fetch_all_by_MethodLinkSpeciesSet($homology_mlss);
printf("fetched %d homologies\n", scalar(@$homology_list));

# set up an AlignIO to format SimpleAlign output
my $alignIO = Bio::AlignIO->newFh(-interleaved=>1, -fh=>\*STDOUT, -format=>'psi', -idlength=>20);

my $count=0;
foreach my $homology (@{$homology_list}) {
    $count++;
    print $homology->toString;

    foreach my $member (sort {$a->genome_db_id <=> $b->genome_db_id} @{$homology->get_all_Members}) {
        print $member->toString(), "\n";
    }

    my $one_member = $homology->get_all_Members->[0];
    my $other_member = $homology->get_all_Members->[1];

    # get the alignments on a piece of the DnaFrag
    my $genomic_align_blocks = $comparaDBA->get_GenomicAlignBlockAdaptor->fetch_all_by_MethodLinkSpeciesSet_DnaFrag( $blastz_mlss, $one_member->dnafrag, $one_member->dnafrag_start, $one_member->dnafrag_end);

    foreach my $gab (@{$genomic_align_blocks}) {
        my $all_genomic_aligns = $gab->get_all_GenomicAligns();
        my $valid = 1;
        foreach my $ga (@$all_genomic_aligns) {
            foreach my $member (@{$homology->get_all_Members}) {
                $valid = 0 if (($ga->dnafrag->genome_db->dbID == $member->genome_db_id) and ($ga->dnafrag->name ne $member->dnafrag->name));
            }
        }
        next unless ($valid);

        print "Bio::EnsEMBL::Compara::GenomicAlignBlock #", $gab->dbID, "\n";
        print "=====================================================\n";
        print " length: ", $gab->length, "; score: ", $gab->score, "\n";
        foreach my $ga (@$all_genomic_aligns) {
            print "  - ", join(" : ", $ga->dnafrag->genome_db->name, $ga->dnafrag->coord_system_name,
                $ga->dnafrag->name, $ga->dnafrag_start, $ga->dnafrag_end, $ga->dnafrag_strand), "\n";
        }
        print $alignIO $gab->get_SimpleAlign;
    }
    last if($count > 10);
}


text:
r"""Pipeline to convert variant data from BigQuery to TensorFlow Example protos.

For any samples without corresponding metadata, values indicating
NA will be used instead for the metadata.

USAGE:
  python -m trainer.preprocess_data \
    --setup_file ./setup.py \
    --project ${PROJECT_ID} \
    --metadata preprocess/1000_genomes_metadata.jinja \
    --input preprocess/1000_genomes_phase3_b37_limit10.jinja \
    --output ${BUCKET}/1000-genomes
"""

import datetime
import logging
import os

import apache_beam as beam
from apache_beam.io import tfrecordio
from apache_beam.io.filesystem import CompressionTypes
from apache_beam.options.pipeline_options import GoogleCloudOptions
from apache_beam.options.pipeline_options import PipelineOptions
from apache_beam.options.pipeline_options import SetupOptions
from apache_beam.options.pipeline_options import WorkerOptions
from jinja2 import Template

import trainer.ancestry_metadata_encoder as metadata_encoder
import trainer.feature_encoder as encoder
import trainer.util as util
import trainer.variant_encoder as variant_encoder

# Jinja template replacements to decouple column names from the source
# tables from the dictionart keys used in this pipeline.

METADATA_QUERY_REPLACEMENTS = {
    'KEY_COLUMN': encoder.KEY_COLUMN,
    'POPULATION_COLUMN': metadata_encoder.POPULATION_COLUMN,
    'SUPER_POPULATION_COLUMN': metadata_encoder.SUPER_POPULATION_COLUMN,
    'GENDER_COLUMN': metadata_encoder.GENDER_COLUMN,
}

DATA_QUERY_REPLACEMENTS = {
    'KEY_COLUMN': encoder.KEY_COLUMN,
    'CONTIG_COLUMN': encoder.CONTIG_COLUMN,
    'START_COLUMN': encoder.START_COLUMN,
    'END_COLUMN': encoder.END_COLUMN,
    'REF_COLUMN': encoder.REF_COLUMN,
    'ALT_COLUMN': encoder.ALT_COLUMN,
    'ALT_NUM_COLUMN': encoder.ALT_NUM_COLUMN,
    'FIRST_ALLELE_COLUMN': encoder.FIRST_ALLELE_COLUMN,
    'SECOND_ALLELE_COLUMN': encoder.SECOND_ALLELE_COLUMN
}

def variants_to_examples(input_data, samples_metadata, sample_to_example_fn):
  """Converts variants to TensorFlow Example protos.

  Args:
    input_data: variant call dictionary objects with keys from
      DATA_QUERY_REPLACEMENTS
    samples_metadata: metadata dictionary objects with keys from
      METADATA_QUERY_REPLACEMENTS
    sample_to_example_fn: the feature encoder strategy to use to
      convert the source data into TensorFlow Example protos.

  Returns:
    TensorFlow Example protos.
  """
  variant_kvs = input_data | 'BucketVariants' >> beam.Map(
      lambda row: (row[encoder.KEY_COLUMN], row))

  sample_variant_kvs = variant_kvs | 'GroupBySample' >> beam.GroupByKey()

  examples = (
      sample_variant_kvs
      | 'SamplesToExamples' >> beam.Map(
          lambda (key, vals), samples_metadata: sample_to_example_fn(
              key, vals, samples_metadata),
          beam.pvalue.AsSingleton(samples_metadata)))

  return examples

class PreprocessOptions(PipelineOptions):

  @classmethod
  def _add_argparse_args(cls, parser):
    parser.add_argument(
        '--output',
        required=True,
        help='Output directory to which to write results.')
    parser.add_argument(
        '--input',
        required=True,
        help='Jinja file holding the query for the sample data.')
    parser.add_argument(
        '--metadata',
        required=True,
        help='Jinja file holding the query for the sample metadata.')
    parser.add_argument(
        '--hethom_words',
        dest='add_hethom',
        action='store_true',
        help='Add variant heterozygous/homozygous "word".')
    parser.add_argument(
        '--no_hethom_words',
        dest='add_hethom',
        action='store_false',
        help='Do not add variant heterozygous/homozygous "word".')
    parser.set_defaults(add_hethom=True)
    parser.add_argument(
        '--bin_size',
        type=int,
        help='The number of contiguous base pairs to use for each "bin". '
        'This parameter enables the placement of variant "words" into '
        'smaller genomic region features (as opposed to the default '
        'feature-per-chromosome) ')

def run(argv=None):
  """Runs the variant preprocess pipeline.

  Args:
    argv: Pipeline options as a list of arguments.
  """
  pipeline_options = PipelineOptions(flags=argv)
  preprocess_options = pipeline_options.view_as(PreprocessOptions)
  cloud_options = pipeline_options.view_as(GoogleCloudOptions)
  output_dir = os.path.join(preprocess_options.output,
                            datetime.datetime.now().strftime('%Y%m%d-%H%M%S'))
  pipeline_options.view_as(SetupOptions).save_main_session = True
  pipeline_options.view_as(
      WorkerOptions).autoscaling_algorithm = 'THROUGHPUT_BASED'
  cloud_options.staging_location = os.path.join(output_dir, 'tmp', 'staging')
  cloud_options.temp_location = os.path.join(output_dir, 'tmp')
  cloud_options.job_name = 'preprocess-varianteatures-%s' % (
      datetime.datetime.now().strftime('%y%m%d-%H%M%S'))

  metadata_query = str(
      Template(open(preprocess_options.metadata, 'r').read()).render(
          METADATA_QUERY_REPLACEMENTS))
  logging.info('metadata query : %s', metadata_query)

  data_query = str(
      Template(open(preprocess_options.input, 'r').read()).render(
          DATA_QUERY_REPLACEMENTS))
  logging.info('data query : %s', data_query)

  # Assemble the strategies to be used to convert the raw data to features.
  variant_to_feature_name_fn = variant_encoder.variant_to_contig_feature_name
  if preprocess_options.bin_size is not None:
    variant_to_feature_name_fn = variant_encoder.build_variant_to_binned_feature_name(
        bin_size=preprocess_options.bin_size)

  variants_to_features_fn = variant_encoder.build_variants_to_features(
      variant_to_feature_name_fn=variant_to_feature_name_fn,
      variant_to_words_fn=variant_encoder.build_variant_to_words(
          add_hethom=preprocess_options.add_hethom))

  sample_to_example_fn = encoder.build_sample_to_example(
      metadata_to_features_fn=metadata_encoder.metadata_to_ancestry_features,
      variants_to_features_fn=variants_to_features_fn)

  with beam.Pipeline(options=pipeline_options) as p:
    # Gather our sample metadata into a python dictionary.
    samples_metadata = (
        p
        | 'ReadSampleMetadata' >> beam.io.Read(
            beam.io.BigQuerySource(query=metadata_query, use_standard_sql=True))
        | 'TableToDictionary' >> beam.CombineGlobally(
            util.TableToDictCombineFn(key_column=encoder.KEY_COLUMN)))

    # Read the table rows into a PCollection.
    rows = p | 'ReadVariants' >> beam.io.Read(
        beam.io.BigQuerySource(query=data_query, use_standard_sql=True))

    # Convert the data into TensorFlow Example Protocol Buffers.
    examples = variants_to_examples(
        rows, samples_metadata, sample_to_example_fn=sample_to_example_fn)

    # Write the serialized compressed protocol buffers to Cloud Storage.
    _ = (examples
         | 'EncodeExamples' >> beam.Map(
             lambda example: example.SerializeToString())
         | 'WriteExamples' >> tfrecordio.WriteToTFRecord(
             file_path_prefix=os.path.join(output_dir, 'examples'),
             compression_type=CompressionTypes.GZIP,
             file_name_suffix='.tfrecord.gz'))

if __name__ == '__main__':
  run()


text:
import os
BASE_DIR = ''
from django.conf import settings
settings.configure(
    DATABASES={
        'default': {
            'ENGINE': 'django.db.backends.sqlite3',
            'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
            'TEST_NAME': os.path.join(BASE_DIR, 'test_db.sqlite3')
        }
    },
    STDNET_BACKENDS={
        'default': {
            'BACKEND': None
        }
    },
    MEDIA_ROOT='/tmp'
)

redis_server = None
redis_server_info = None

def setUpModule():
    import redis
    import testing.redis

    global redis_server
    global redis_server_info

    try:
        r = redis.Redis(host='redis')
        r.keys('*')
        redis_server_info = r.connection_pool.connection_kwargs
    except redis.connection.ConnectionError:
        redis_server = testing.redis.RedisServer()
        redis_server.start()
        redis_server_info = redis_server.dsn()

def tearDownModule():
    global redis_server

    if redis_server is not None:
        redis_server.stop()

from .models import *  # noqa
from .session import *  # noqa
from .fields import *  # noqa
from .ttl import *  # noqa


text:
<?xml version='1.0' encoding='UTF-8'?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2" xmlns:android="http://schemas.android.com/apk/res/android">
  <string name="loading_conversations" msgid="5510430408235967094">"S\'estan carregant les converses."</string>
  <string name="low_memory" product="tablet" msgid="6494019234102154896">"L\'emmagatzematge de la tauleta és ple. Suprimeix uns quants fitxers per alliberar espai."</string>
  <string name="low_memory" product="default" msgid="3475999286680000541">"L\'emmagatzematge del telèfon és ple. Suprimeix uns quants fitxers per alliberar espai."</string>
  <string name="message_count_format" msgid="4434763220590778012">" <xliff:g id="NUMBER">%1$s</xliff:g>"</string>
  <string name="messagelist_sender_self" msgid="3579016854116401602">"Mi"</string>
  <string name="no_conversations" msgid="6773767655149258445">"No hi ha cap conversa."</string>
  <string name="no_subject_view" msgid="7795086723069563537">"(Sense assumpte)"</string>
  <plurals name="recipient_count">
    <item quantity="other" msgid="7338580381574463136">"<xliff:g id="NUMBER">%1$s</xliff:g> persones"</item>
  </plurals>
</resources>


text:
package net.leejjon.bluffpoker.state;

import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Group;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.utils.SnapshotArray;

import net.leejjon.bluffpoker.actors.CupActor;
import net.leejjon.bluffpoker.actors.DiceActor;
import net.leejjon.bluffpoker.logic.NumberCombination;
import net.leejjon.bluffpoker.logic.Player;
import net.leejjon.bluffpoker.ui.ClickableLabel;

import java.util.ArrayList;

import static net.leejjon.bluffpoker.state.GameState.state;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

public enum GameStateEnum implements GameStateAssertor, UserInterfaceAssertor {
    NEW_GAME {
        @Override
        public void assertCallBoardInGameState(String expectedCall) {
            assertEquals(expectedCall, state().getCallInput());
            assertEquals(false, state().isAllowedToCall());
        }

        @Override
        public void assertCupInGameState() {
            assertFalse(state().getCup().isBelieving());
            assertFalse(state().getCup().isLocked());
            assertFalse(state().getCup().isWatching());
        }

        @Override
        public void assertStatusses(NumberCombination expectedCall) {
            assertTrue(state().isAllowedToThrow());
            assertFalse(state().isAllowedToBelieveOrNotBelieve());
            assertFalse(state().isAllowedToViewOwnThrow());
            assertFalse(state().isBlindPass());
            assertFalse(state().isBelieved666());
            assertEquals(expectedCall, state().getLatestCall());
        }
    },
    AFTER_FIRST_SHAKE {
        @Override
        public void assertCallBoardInGameState(String expectedCall) {
            assertEquals(expectedCall, state().getCallInput());
            assertTrue(state().isAllowedToCall());
        }

        @Override
        public void assertCupInGameState() {
            assertFalse(state().getCup().isBelieving());
            assertFalse(state().getCup().isLocked());
            assertFalse(state().getCup().isWatching());
        }

        @Override
        public void assertStatusses(NumberCombination expectedCall) {
            assertFalse(state().isAllowedToThrow());
            assertFalse(state().isAllowedToBelieveOrNotBelieve());
            assertTrue(state().isAllowedToViewOwnThrow());
            assertTrue(state().isBlindPass());
            assertFalse(state().isBelieved666());

            // Both are null in this case.
            assertEquals(expectedCall, state().getLatestCall());
        }

        @Override
        public void assertCallBoardInUI(String expectedCall, Label callInputLabel, ClickableLabel autoButton, ClickableLabel callButton) {
            assertEquals(expectedCall, callInputLabel.getText().toString());
            assertFalse(autoButton.isDisabled());
            assertFalse(callButton.isDisabled());
        }
    },
    VIEW_AFTER_FIRST_SHAKE {
        @Override
        public void assertCallBoardInUI(String expectedCall, Label callInputLabel, ClickableLabel autoButton, ClickableLabel callButton) {
            assertEquals(expectedCall, callInputLabel.getText().toString());
            assertFalse(autoButton.isDisabled());
            assertFalse(callButton.isDisabled());
        }

        @Override
        public void assertCupInUI(CupActor cupActor) {
            assertEquals(cupActor.getOpenCupDrawable(), cupActor.getCupImage().getDrawable());
            assertFalse(cupActor.getLockImage().isVisible());
        }

        @Override
        public void assertCallBoardInGameState(String expectedCall) {
            assertEquals(expectedCall, state().getCallInput());
            assertTrue(state().isAllowedToCall());
        }

        @Override
        public void assertCupInGameState() {
            assertFalse(state().getCup().isBelieving());
            assertFalse(state().getCup().isLocked());
            assertTrue(state().getCup().isWatching());
        }

        @Override
        public void assertStatusses(NumberCombination expectedCall) {
            assertFalse(state().isAllowedToThrow());
            assertFalse(state().isAllowedToBelieveOrNotBelieve());
            assertTrue(state().isAllowedToViewOwnThrow());
            assertFalse(state().isBlindPass());
            assertFalse(state().isBelieved666());
            assertEquals(expectedCall, state().getLatestCall());
        }
    },
    CALL {
        @Override
        public void assertCallBoardInUI(String expectedCall, Label callInputLabel, ClickableLabel autoButton, ClickableLabel callButton) {
            assertEquals(expectedCall, callInputLabel.getText().toString());
            assertTrue(autoButton.isDisabled());
            assertTrue(callButton.isDisabled());
        }

        @Override
        public void assertCallBoardInGameState(String expectedCall) {
            assertEquals(expectedCall, state().getCallInput());
            assertFalse(state().isAllowedToCall());
        }

        @Override
        public void assertCupInGameState() {
            assertFalse(state().getCup().isBelieving());
            assertFalse(state().getCup().isLocked());
            assertFalse(state().getCup().isWatching());
        }

        @Override
        public void assertStatusses(NumberCombination expectedCall) {
            assertFalse(state().isAllowedToThrow());
            assertTrue(state().isAllowedToBelieveOrNotBelieve());
            assertFalse(state().isAllowedToViewOwnThrow());
            assertFalse(state().isBlindPass());
            assertFalse(state().isBelieved666());
            assertEquals(expectedCall, state().getLatestCall().getNumberCombination());
        }
    },
    CALL_BLIND {
        @Override
        public void assertCallBoardInUI(String expectedCall, Label callInputLabel, ClickableLabel autoButton, ClickableLabel callButton) {
            assertEquals(expectedCall, callInputLabel.getText().toString());
            assertTrue(autoButton.isDisabled());
            assertTrue(callButton.isDisabled());
        }

        @Override
        public void assertCallBoardInGameState(String expectedCall) {
            assertEquals(expectedCall, state().getCallInput());
            assertFalse(state().isAllowedToCall());
        }

        @Override
        public void assertCupInGameState() {
            assertFalse(state().getCup().isBelieving());
            assertFalse(state().getCup().isLocked());
            assertFalse(state().getCup().isWatching());
        }

        @Override
        public void assertStatusses(NumberCombination expectedCall) {
            assertFalse(state().isAllowedToThrow());
            assertTrue(state().isAllowedToBelieveOrNotBelieve());
            assertFalse(state().isAllowedToViewOwnThrow());
            assertFalse(state().isBlindPass());
            assertFalse(state().isBelieved666());
            assertEquals(expectedCall, state().getLatestCall().getNumberCombination());
        }
    },
    CALL_BLIND_FORFEIT_TWO_PLAYERS {
        @Override
        public void assertCallBoardInGameState(String expectedCall) {
            assertEquals(expectedCall, state().getCallInput());
            assertFalse(state().isAllowedToCall());
        }

        @Override
        public void assertCupInGameState() {
            assertFalse(state().getCup().isBelieving());
            assertFalse(state().getCup().isLocked());
            assertFalse(state().getCup().isWatching());
        }

        @Override
        public void assertStatusses(NumberCombination expectedCall) {
            // The states don't get updated from the state before because the game ends with one player left.
            // If there was a third player, they would be updated.

            // So I'm asserting the same values as the CALL_BLIND test case.
            assertFalse(state().isAllowedToThrow());
            assertTrue(state().isAllowedToBelieveOrNotBelieve());
            assertFalse(state().isAllowedToViewOwnThrow());
            assertFalse(state().isBlindPass());
            assertFalse(state().isBelieved666());
            assertEquals(expectedCall, state().getLatestCall().getNumberCombination());
        }

        @Override
        public void assertPlayersInGameState(Player expectedCurrentPlayer) {
            ArrayList<Player> players = GameState.state().getPlayers();
            assertEquals(1, players.size());

            Player leon = players.get(0);
            assertEquals("Leon", leon.getName());
            assertEquals(3, leon.getLives());

            Player currentPlayer = GameState.state().getCurrentPlayer();
            assertEquals(expectedCurrentPlayer, currentPlayer);
        }
    },
    CALL_BLIND_FORFEIT_THREE_PLAYERS {
        @Override
        public void assertCallBoardInGameState(String expectedCall) {
            assertEquals(expectedCall, state().getCallInput());
            assertFalse(state().isAllowedToCall());
        }

        @Override
        public void assertCupInGameState() {
            assertFalse(state().getCup().isBelieving());
            assertFalse(state().getCup().isLocked());
            assertFalse(state().getCup().isWatching());
        }

        @Override
        public void assertStatusses(NumberCombination expectedCall) {
            assertTrue(state().isAllowedToThrow());
            assertFalse(state().isAllowedToBelieveOrNotBelieve());
            assertFalse(state().isAllowedToViewOwnThrow());
            assertFalse(state().isBlindPass());

            if (expectedCall == null) {
                assertNull(state().getLatestCall());
            } else {
                assertEquals(expectedCall, state().getLatestCall().getNumberCombination());
            }
        }

        @Override
        public void assertPlayersInGameState(Player expectedCurrentPlayer) {
            ArrayList<Player> players = GameState.state().getPlayers();
            assertEquals(2, players.size());

            Player leon = players.get(0);
            assertEquals("Leon", leon.getName());
            assertEquals(3, leon.getLives());

            Player richard = players.get(1);
            assertEquals("Richard", richard.getName());
            assertEquals(3, leon.getLives());

            Player currentPlayer = GameState.state().getCurrentPlayer();
            assertEquals(expectedCurrentPlayer, currentPlayer);
        }
    },
    TAKE_6_OUT {
        @Override
        public void assertCallBoardInUI(String expectedCall, Label callInputLabel, ClickableLabel autoButton, ClickableLabel callButton) {
            assertEquals(expectedCall, callInputLabel.getText().toString());
            assertFalse(autoButton.isDisabled());
            assertFalse(callButton.isDisabled());
        }

        @Override
        public void assertCupInUI(CupActor cupActor) {
            assertEquals(cupActor.getOpenCupDrawable(), cupActor.getCupImage().getDrawable());
            assertFalse(cupActor.getLockImage().isVisible());
        }

        @Override
        public void assertCallBoardInGameState(String expectedCall) {
            assertEquals(expectedCall, state().getCallInput());
            assertTrue(state().isAllowedToCall());
        }

        @Override
        public void assertCupInGameState() {
            assertFalse(state().getCup().isBelieving());
            assertFalse(state().getCup().isLocked());
            assertTrue(state().getCup().isWatching());
        }

        @Override
        public void assertStatusses(NumberCombination expectedCall) {
            assertFalse(state().isAllowedToThrow());
            assertFalse(state().isAllowedToBelieveOrNotBelieve());
            assertTrue(state().isAllowedToViewOwnThrow());
            assertFalse(state().isBlindPass());
            assertFalse(state().isBelieved666());
            assertEquals(expectedCall, state().getLatestCall());
        }

        @Override
        public void assertDiceLocations(DiceActor left, DiceActor middle, DiceActor right, Group dicesUnderCupActors, Group dicesBeforeCupActors) {
            SnapshotArray<Actor> dicesBeforeCup = dicesBeforeCupActors.getChildren();
            dicesBeforeCup.contains(left, true);

            SnapshotArray<Actor> dicesUnderCup = dicesUnderCupActors.getChildren();
            dicesUnderCup.contains(middle, true);
            dicesUnderCup.contains(right, true);
        }

        @Override
        public void assertDices(NumberCombination expectedNumberCombination) {
            assertExpectedNumberCombinationWithGameState(expectedNumberCombination);
            assertFalse(state().getLeftDice().isUnderCup());
            assertTrue(state().getMiddleDice().isUnderCup());
            assertTrue(state().getRightDice().isUnderCup());

            assertFalse(state().getLeftDice().isLocked());
            assertFalse(state().getMiddleDice().isLocked());
            assertFalse(state().getRightDice().isLocked());
        }
    },
    CALL_LEFT_SIX_OUT {
        @Override
        public void assertCallBoardInUI(String expectedCall, Label callInputLabel, ClickableLabel autoButton, ClickableLabel callButton) {
            assertEquals(expectedCall, callInputLabel.getText().toString());
            assertTrue(autoButton.isDisabled());
            assertTrue(callButton.isDisabled());
        }

        @Override
        public void assertCallBoardInGameState(String expectedCall) {
            assertEquals(expectedCall, state().getCallInput());
            assertFalse(state().isAllowedToCall());
        }

        @Override
        public void assertCupInGameState() {
            assertFalse(state().getCup().isBelieving());
            assertFalse(state().getCup().isLocked());
            assertFalse(state().getCup().isWatching());
        }

        @Override
        public void assertStatusses(NumberCombination expectedCall) {
            assertFalse(state().isAllowedToThrow());
            assertTrue(state().isAllowedToBelieveOrNotBelieve());
            assertFalse(state().isAllowedToViewOwnThrow());
            assertFalse(state().isBlindPass());
            assertFalse(state().isBelieved666());
            assertEquals(expectedCall, state().getLatestCall().getNumberCombination());
        }

        @Override
        public void assertDiceLocations(DiceActor left, DiceActor middle, DiceActor right, Group dicesUnderCupActors, Group dicesBeforeCupActors) {
            SnapshotArray<Actor> dicesBeforeCup = dicesBeforeCupActors.getChildren();
            dicesBeforeCup.contains(left, true);

            SnapshotArray<Actor> dicesUnderCup = dicesUnderCupActors.getChildren();
            dicesUnderCup.contains(middle, true);
            dicesUnderCup.contains(right, true);
        }

        @Override
        public void assertDices(NumberCombination expectedNumberCombination) {
            assertExpectedNumberCombinationWithGameState(expectedNumberCombination);
            assertFalse(state().getLeftDice().isUnderCup());
            assertTrue(state().getMiddleDice().isUnderCup());
            assertTrue(state().getRightDice().isUnderCup());

            assertFalse(state().getLeftDice().isLocked());
            assertFalse(state().getMiddleDice().isLocked());
            assertFalse(state().getRightDice().isLocked());
        }
    },
    BELIEVED_ALL_DICES_UNDER_CUP {
        @Override
        public void assertCallBoardInGameState(String expectedCall) {
            assertEquals(expectedCall, state().getCallInput());
            assertFalse(state().isAllowedToCall());
        }

        @Override
        public void assertCupInGameState() {
            assertTrue(state().getCup().isBelieving());
            assertFalse(state().getCup().isLocked());
            assertFalse(state().getCup().isWatching());
        }

        @Override
        public void assertStatusses(NumberCombination expectedCall) {
            assertFalse(state().isAllowedToThrow()); // First has to close the cup.
            assertTrue(state().isAllowedToBelieveOrNotBelieve());
            assertFalse(state().isAllowedToViewOwnThrow());
            assertFalse(state().isBlindPass());
            assertFalse(state().isBelieved666());
            assertEquals(expectedCall, state().getLatestCall().getNumberCombination());
        }

        @Override
        public void assertCupInUI(CupActor cupActor) {
            assertEquals(cupActor.getOpenCupDrawable(), cupActor.getCupImage().getDrawable());
            assertFalse(cupActor.getLockImage().isVisible());
        }
    },
    BELIEVED_LEFT_SIX_OUT {
        @Override
        public void assertCupInUI(CupActor cupActor) {
            assertEquals(cupActor.getOpenCupDrawable(), cupActor.getCupImage().getDrawable());
            assertFalse(cupActor.getLockImage().isVisible());
        }

        @Override
        public void assertCallBoardInGameState(String expectedCall) {
            assertEquals(expectedCall, state().getCallInput());
            assertFalse(state().isAllowedToCall());
        }

        @Override
        public void assertCupInGameState() {
            assertTrue(state().getCup().isBelieving());
            assertFalse(state().getCup().isLocked());
            assertFalse(state().getCup().isWatching());
        }

        @Override
        public void assertStatusses(NumberCombination expectedCall) {
            assertFalse(state().isAllowedToThrow()); // First has to close the cup.
            assertTrue(state().isAllowedToBelieveOrNotBelieve());
            assertFalse(state().isAllowedToViewOwnThrow());
            assertFalse(state().isBlindPass());
            assertFalse(state().isBelieved666());
            assertEquals(expectedCall, state().getLatestCall().getNumberCombination());
        }

        @Override
        public void assertDiceLocksInUI(DiceActor left, DiceActor middle, DiceActor right) {
            assertTrue(left.getLockImage().isVisible());
            assertFalse(middle.getLockImage().isVisible());
            assertFalse(right.getLockImage().isVisible());
        }

        @Override
        public void assertDiceLocations(DiceActor left, DiceActor middle, DiceActor right, Group dicesUnderCupActors, Group dicesBeforeCupActors) {
            // Assert if the dices have been added to the correct group.
            SnapshotArray<Actor> dicesBeforeCup = dicesBeforeCupActors.getChildren();
            dicesBeforeCup.contains(left, true);

            SnapshotArray<Actor> dicesUnderCup = dicesUnderCupActors.getChildren();
            dicesUnderCup.contains(middle, true);
            dicesUnderCup.contains(right, true);
        }

        @Override
        public void assertDices(NumberCombination expectedNumberCombination) {
            assertExpectedNumberCombinationWithGameState(expectedNumberCombination);
            assertFalse(state().getLeftDice().isUnderCup());
            assertTrue(state().getMiddleDice().isUnderCup());
            assertTrue(state().getRightDice().isUnderCup());

            assertTrue(state().getLeftDice().isLocked());
            assertFalse(state().getMiddleDice().isLocked());
            assertFalse(state().getRightDice().isLocked());
        }
    },
    BELIEVED_ALL_DICES_UNDER_CUP_BLIND {
        @Override
        public void assertCallBoardInGameState(String expectedCall) {
            assertEquals(expectedCall, state().getCallInput());
            assertTrue(state().isAllowedToCall());
        }

        @Override
        public void assertCupInGameState() {
            assertFalse(state().getCup().isBelieving());
            assertTrue(state().getCup().isLocked());
            assertFalse(state().getCup().isWatching());
        }

        @Override
        public void assertStatusses(NumberCombination expectedCall) {
            assertFalse(state().isAllowedToThrow());
            assertFalse(state().isAllowedToBelieveOrNotBelieve());
            assertFalse(state().isAllowedToViewOwnThrow());
            assertTrue(state().isBlindPass());
            assertFalse(state().isBelieved666());
            assertEquals(expectedCall, state().getLatestCall().getNumberCombination());
        }

        @Override
        public void assertCupInUI(CupActor cupActor) {
            assertEquals(cupActor.getClosedCupDrawable(), cupActor.getCupImage().getDrawable());
            assertTrue(cupActor.getLockImage().isVisible());
        }

        @Override
        public void assertCallBoardInUI(String expectedCall, Label callInputLabel, ClickableLabel autoButton, ClickableLabel callButton) {
            assertEquals(expectedCall, callInputLabel.getText().toString());
            assertFalse(autoButton.isDisabled());
            assertFalse(callButton.isDisabled());
        }
    },
    BELIEVED_666_ALL_DICES_UNDER_CUP {
        @Override
        public void assertCallBoardInGameState(String expectedCall) {
            assertEquals(expectedCall, state().getCallInput());
            assertFalse(state().isAllowedToCall());
        }

        @Override
        public void assertCupInGameState() {
            assertTrue(state().getCup().isBelieving());
            assertFalse(state().getCup().isLocked());
            assertFalse(state().getCup().isWatching());
        }

        @Override
        public void assertStatusses(NumberCombination expectedCall) {
            assertFalse(state().isAllowedToThrow()); // First has to close the cup.
            assertTrue(state().isAllowedToBelieveOrNotBelieve());
            assertFalse(state().isAllowedToViewOwnThrow());
            assertFalse(state().isBlindPass());
            assertTrue(state().isBelieved666());
            assertEquals(expectedCall, state().getLatestCall().getNumberCombination());
        }

        @Override
        public void assertCupInUI(CupActor cupActor) {
            assertEquals(cupActor.getOpenCupDrawable(), cupActor.getCupImage().getDrawable());
            assertFalse(cupActor.getLockImage().isVisible());
        }
    },
    BELIEVED_666_ALL_DICES_UNDER_CUP_CLOSED {
        @Override
        public void assertCallBoardInGameState(String expectedCall) {
            assertEquals(expectedCall, state().getCallInput());
            assertFalse(state().isAllowedToCall());
        }

        @Override
        public void assertCupInGameState() {
            assertFalse(state().getCup().isBelieving());
            assertFalse(state().getCup().isLocked());
            assertFalse(state().getCup().isWatching());
        }

        @Override
        public void assertStatusses(NumberCombination expectedCall) {
            assertTrue(state().isAllowedToThrow()); // First has to close the cup.
            assertFalse(state().isAllowedToBelieveOrNotBelieve());
            assertTrue(state().isAllowedToViewOwnThrow());
            assertFalse(state().isBlindPass());
            assertTrue(state().isBelieved666());
            assertEquals(expectedCall, state().getLatestCall().getNumberCombination());
        }
    },
    BELIEVED_666_ALL_DICES_UNDER_CUP_CLOSED_THROWN {
        @Override
        public void assertCallBoardInGameState(String expectedCall) {
            assertEquals(expectedCall, state().getCallInput());
            assertTrue(state().isAllowedToCall());
        }

        @Override
        public void assertCupInGameState() {
            assertFalse(state().getCup().isBelieving());
            assertFalse(state().getCup().isLocked());
            assertFalse(state().getCup().isWatching());
        }

        @Override
        public void assertStatusses(NumberCombination expectedCall) {
            assertFalse(state().isAllowedToThrow());
            assertFalse(state().isAllowedToBelieveOrNotBelieve());
            assertTrue(state().isAllowedToViewOwnThrow());
            assertTrue(state().isBlindPass());
            assertTrue(state().isBelieved666());
            assertEquals(expectedCall, state().getLatestCall().getNumberCombination());
        }

        @Override
        public void assertCallBoardInUI(String expectedCall, Label callInputLabel, ClickableLabel autoButton, ClickableLabel callButton) {
            assertEquals(expectedCall, callInputLabel.getText().toString());
            assertFalse(autoButton.isDisabled());
            assertFalse(callButton.isDisabled());
        }
    },
    NOT_BELIEVE_CORRECT_All_DICES_UNDER_CUP {

        @Override
        public void assertCallBoardInGameState(String expectedCall) {
            assertEquals(expectedCall, state().getCallInput());
            assertFalse(state().isAllowedToCall());
        }

        @Override
        public void assertCupInGameState() {
            assertFalse(state().getCup().isBelieving());
            assertFalse(state().getCup().isLocked());
            assertFalse(state().getCup().isWatching());
        }

        @Override
        public void assertStatusses(NumberCombination expectedCall) {
            assertTrue(state().isAllowedToThrow());
            assertFalse(state().isAllowedToBelieveOrNotBelieve());
            assertFalse(state().isAllowedToViewOwnThrow());
            assertFalse(state().isBlindPass());

            if (expectedCall == null) {
                assertNull(state().getLatestCall());
            } else {
                assertEquals(expectedCall, state().getLatestCall().getNumberCombination());
            }
        }

        @Override
        public void assertPlayersInGameState(Player expectedCurrentPlayer) {
            ArrayList<Player> players = state().getPlayers();
            Player leon = players.get(0);
            assertEquals("Leon", leon.getName());
            assertEquals(2, leon.getLives());

            Player dirk = players.get(1);
            assertEquals("Dirk", dirk.getName());
            assertEquals(3, dirk.getLives());

            Player currentPlayer = state().getCurrentPlayer();
            assertEquals(expectedCurrentPlayer, currentPlayer);
        }
    },
    NOT_BELIEVE_INCORRECT_ALL_DICES_UNDER_CUP {

        @Override
        public void assertCallBoardInGameState(String expectedCall) {
            assertEquals(expectedCall, state().getCallInput());
            assertFalse(state().isAllowedToCall());
        }

        @Override
        public void assertCupInGameState() {
            assertFalse(state().getCup().isBelieving());
            assertFalse(state().getCup().isLocked());
            assertFalse(state().getCup().isWatching());
        }

        @Override
        public void assertStatusses(NumberCombination expectedCall) {
            assertTrue(state().isAllowedToThrow());
            assertFalse(state().isAllowedToBelieveOrNotBelieve());
            assertFalse(state().isAllowedToViewOwnThrow());
            assertFalse(state().isBlindPass());

            if (expectedCall == null) {
                assertNull(state().getLatestCall());
            } else {
                assertEquals(expectedCall, state().getLatestCall().getNumberCombination());
            }
        }

        @Override
        public void assertPlayersInGameState(Player expectedCurrentPlayer) {
            ArrayList<Player> players = state().getPlayers();
            Player leon = players.get(0);
            assertEquals("Leon", leon.getName());
            assertEquals(3, leon.getLives());

            Player dirk = players.get(1);
            assertEquals("Dirk", dirk.getName());
            assertEquals(2, dirk.getLives());

            Player currentPlayer = state().getCurrentPlayer();
            assertEquals(expectedCurrentPlayer, currentPlayer);
        }
    },
    NOT_BELIEVE_CORRECT_LEFT_DICE_OUT {

        @Override
        public void assertCallBoardInGameState(String expectedCall) {
            assertEquals(expectedCall, state().getCallInput());
            assertFalse(state().isAllowedToCall());
        }

        @Override
        public void assertCupInGameState() {
            assertFalse(state().getCup().isBelieving());
            assertFalse(state().getCup().isLocked());
            assertFalse(state().getCup().isWatching());
        }

        @Override
        public void assertStatusses(NumberCombination expectedCall) {
            assertTrue(state().isAllowedToThrow());
            assertFalse(state().isAllowedToBelieveOrNotBelieve());
            assertFalse(state().isAllowedToViewOwnThrow());
            assertFalse(state().isBlindPass());

            if (expectedCall == null) {
                assertNull(state().getLatestCall());
            } else {
                assertEquals(expectedCall, state().getLatestCall().getNumberCombination());
            }
        }

        @Override
        public void assertPlayersInGameState(Player expectedCurrentPlayer) {
            ArrayList<Player> players = state().getPlayers();
            Player leon = players.get(0);
            assertEquals("Leon", leon.getName());
            assertEquals(2, leon.getLives());

            Player dirk = players.get(1);
            assertEquals("Dirk", dirk.getName());
            assertEquals(3, dirk.getLives());

            Player currentPlayer = state().getCurrentPlayer();
            assertEquals(expectedCurrentPlayer, currentPlayer);
        }

        @Override
        public void assertDiceLocations(DiceActor left, DiceActor middle, DiceActor right, Group dicesUnderCupActors, Group dicesBeforeCupActors) {
            SnapshotArray<Actor> dicesBeforeCup = dicesBeforeCupActors.getChildren();
            dicesBeforeCup.contains(left, true);

            SnapshotArray<Actor> dicesUnderCup = dicesUnderCupActors.getChildren();
            dicesUnderCup.contains(middle, true);
            dicesUnderCup.contains(right, true);
        }

        @Override
        public void assertDices(NumberCombination expectedNumberCombination) {
            assertExpectedNumberCombinationWithGameState(expectedNumberCombination);
            assertFalse(state().getLeftDice().isUnderCup());
            assertTrue(state().getMiddleDice().isUnderCup());
            assertTrue(state().getRightDice().isUnderCup());

            assertFalse(state().getLeftDice().isLocked());
            assertFalse(state().getMiddleDice().isLocked());
            assertFalse(state().getRightDice().isLocked());
        }
    },
    NOT_BELIEVE_INCORRECT_LEFT_DICE_OUT {
        @Override
        public void assertCallBoardInGameState(String expectedCall) {
            assertEquals(expectedCall, state().getCallInput());
            assertFalse(state().isAllowedToCall());
        }

        @Override
        public void assertCupInGameState() {
            assertFalse(state().getCup().isBelieving());
            assertFalse(state().getCup().isLocked());
            assertFalse(state().getCup().isWatching());
        }

        @Override
        public void assertStatusses(NumberCombination expectedCall) {
            assertTrue(state().isAllowedToThrow());
            assertFalse(state().isAllowedToBelieveOrNotBelieve());
            assertFalse(state().isAllowedToViewOwnThrow());
            assertFalse(state().isBlindPass());

            if (expectedCall == null) {
                assertNull(state().getLatestCall());
            } else {
                assertEquals(expectedCall, state().getLatestCall().getNumberCombination());
            }
        }

        @Override
        public void assertPlayersInGameState(Player expectedCurrentPlayer) {
            ArrayList<Player> players = state().getPlayers();
            Player leon = players.get(0);
            assertEquals("Leon", leon.getName());
            assertEquals(3, leon.getLives());

            Player dirk = players.get(1);
            assertEquals("Dirk", dirk.getName());
            assertEquals(2, dirk.getLives());

            Player currentPlayer = state().getCurrentPlayer();
            assertEquals(expectedCurrentPlayer, currentPlayer);
        }

        @Override
        public void assertDiceLocations(DiceActor left, DiceActor middle, DiceActor right, Group dicesUnderCupActors, Group dicesBeforeCupActors) {
            SnapshotArray<Actor> dicesBeforeCup = dicesBeforeCupActors.getChildren();
            dicesBeforeCup.contains(left, true);

            SnapshotArray<Actor> dicesUnderCup = dicesUnderCupActors.getChildren();
            dicesUnderCup.contains(middle, true);
            dicesUnderCup.contains(right, true);
        }

        @Override
        public void assertDices(NumberCombination expectedNumberCombination) {
            assertExpectedNumberCombinationWithGameState(expectedNumberCombination);
            assertFalse(state().getLeftDice().isUnderCup());
            assertTrue(state().getMiddleDice().isUnderCup());
            assertTrue(state().getRightDice().isUnderCup());

            assertFalse(state().getLeftDice().isLocked());
            assertFalse(state().getMiddleDice().isLocked());
            assertFalse(state().getRightDice().isLocked());
        }
    },
    AFTER_BELIEVE_ALL_DICES_UNDER_CUP_CLOSE_CUP {
        @Override
        public void assertCallBoardInGameState(String expectedCall) {
            assertEquals(expectedCall, state().getCallInput());
            assertFalse(state().isAllowedToCall());
        }

        @Override
        public void assertCupInGameState() {
            assertFalse(state().getCup().isWatching());
            assertFalse(state().getCup().isBelieving());
            assertFalse(state().getCup().isLocked());
        }

        @Override
        public void assertStatusses(NumberCombination expectedCall) {
            assertTrue(state().isAllowedToThrow()); // First has to close the cup.
            assertFalse(state().isAllowedToBelieveOrNotBelieve());
            assertTrue(state().isAllowedToViewOwnThrow());
            assertFalse(state().isBlindPass());
            assertEquals(expectedCall, state().getLatestCall().getNumberCombination());
        }
    },
    AFTER_BELIEVE_ALL_DICES_UNDER_CUP_BLIND_PEEK {
        @Override
        public void assertCallBoardInGameState(String expectedCall) {
            assertEquals(expectedCall, state().getCallInput());
            assertFalse(state().isAllowedToCall());
        }

        @Override
        public void assertCupInGameState() {
            assertFalse(state().getCup().isBelieving());
            assertFalse(state().getCup().isLocked());
            assertTrue(state().getCup().isWatching());
        }

        @Override
        public void assertCupInUI(CupActor cupActor) {
            assertEquals(cupActor.getOpenCupDrawable(), cupActor.getCupImage().getDrawable());
            assertFalse(cupActor.getLockImage().isVisible());
        }

        @Override
        public void assertStatusses(NumberCombination expectedCall) {
            assertFalse(state().isAllowedToThrow()); // First has to close the cup.
            assertFalse(state().isAllowedToBelieveOrNotBelieve());
            assertTrue(state().isAllowedToViewOwnThrow());
            assertFalse(state().isBlindPass());
            assertEquals(expectedCall, state().getLatestCall().getNumberCombination());
        }

        @Override
        public void assertCallBoardInUI(String expectedCall, Label callInputLabel, ClickableLabel autoButton, ClickableLabel callButton) {
            assertEquals(expectedCall, callInputLabel.getText().toString());
            assertTrue(autoButton.isDisabled());
            assertTrue(callButton.isDisabled());
        }
    },
    AFTER_BELIEVE_ALL_DICES_UNDER_CUP_BLIND_PEEK_CLOSE {
        @Override
        public void assertCallBoardInGameState(String expectedCall) {
            assertEquals(expectedCall, state().getCallInput());
            assertFalse(state().isAllowedToCall());
        }

        @Override
        public void assertCupInGameState() {
            assertFalse(state().getCup().isBelieving());
            assertFalse(state().getCup().isLocked());
            assertFalse(state().getCup().isWatching());
        }

        @Override
        public void assertCupInUI(CupActor cupActor) {
            assertEquals(cupActor.getClosedCupDrawable(), cupActor.getCupImage().getDrawable());
            assertFalse(cupActor.getLockImage().isVisible());
        }

        @Override
        public void assertStatusses(NumberCombination expectedCall) {
            assertTrue(state().isAllowedToThrow());
            assertFalse(state().isAllowedToBelieveOrNotBelieve());
            assertTrue(state().isAllowedToViewOwnThrow());
            assertFalse(state().isBlindPass());
            assertEquals(expectedCall, state().getLatestCall().getNumberCombination());
        }

        @Override
        public void assertCallBoardInUI(String expectedCall, Label callInputLabel, ClickableLabel autoButton, ClickableLabel callButton) {
            assertEquals(expectedCall, callInputLabel.getText().toString());
            assertTrue(autoButton.isDisabled());
            assertTrue(callButton.isDisabled());
        }
    },
    AFTER_BELIEVE_LEFT_SIX_OUT_PULL_BACK_LEFT_SIX {
        @Override
        public void assertCupInUI(CupActor cupActor) {
            assertEquals(cupActor.getOpenCupDrawable(), cupActor.getCupImage().getDrawable());
            assertFalse(cupActor.getLockImage().isVisible());
        }

        @Override
        public void assertCallBoardInGameState(String expectedCall) {
            assertEquals(expectedCall, state().getCallInput());
            assertFalse(state().isAllowedToCall());
        }

        @Override
        public void assertCupInGameState() {
            assertTrue(state().getCup().isBelieving());
            assertFalse(state().getCup().isLocked());
            assertFalse(state().getCup().isWatching());
        }

        @Override
        public void assertStatusses(NumberCombination expectedCall) {
            assertFalse(state().isAllowedToThrow()); // First has to close the cup.
            assertTrue(state().isAllowedToBelieveOrNotBelieve());
            assertFalse(state().isAllowedToViewOwnThrow());
            assertFalse(state().isBlindPass());
            assertFalse(state().isBelieved666());
            assertEquals(expectedCall, state().getLatestCall().getNumberCombination());
        }

        @Override
        public void assertDiceLocksInUI(DiceActor left, DiceActor middle, DiceActor right) {
            assertFalse(left.getLockImage().isVisible());
            assertFalse(middle.getLockImage().isVisible());
            assertFalse(right.getLockImage().isVisible());
        }

        @Override
        public void assertDiceLocations(DiceActor left, DiceActor middle, DiceActor right, Group dicesUnderCupActors, Group dicesBeforeCupActors) {
            // Assert if the dices have been added to the correct group.
            SnapshotArray<Actor> dicesBeforeCup = dicesBeforeCupActors.getChildren();
            dicesBeforeCup.contains(left, true);

            SnapshotArray<Actor> dicesUnderCup = dicesUnderCupActors.getChildren();
            dicesUnderCup.contains(middle, true);
            dicesUnderCup.contains(right, true);
        }

        @Override
        public void assertDices(NumberCombination expectedNumberCombination) {
            assertExpectedNumberCombinationWithGameState(expectedNumberCombination);
            assertTrue(state().getLeftDice().isUnderCup());
            assertTrue(state().getMiddleDice().isUnderCup());
            assertTrue(state().getRightDice().isUnderCup());

            assertFalse(state().getLeftDice().isLocked());
            assertFalse(state().getMiddleDice().isLocked());
            assertFalse(state().getRightDice().isLocked());
        }
    }
}


text:
var nav = document.querySelector('.nav');
var scrolled = false;

// Cross browser compatible, non-overriding window.onload function
if (window.addEventListener) {
  window.addEventListener("load", init, false);
} else {
  window.attachEvent && window.attachEvent("onload", init);
}

var rbStarsElem = document.querySelector('#react-boilerplate-stars');
var scStarsElem = document.querySelector('#styled-components-stars');
function getGitHubUrl(owner, repo) {
    return 'https://api.github.com/search/repositories?q=repo%3A' + owner + '%2F' + repo;
}
var repos = [{
    owner: 'styled-components',
    name: 'styled-components'
}, {
    owner: 'react-boilerplate',
    name: 'react-boilerplate'
}]

// Initialize the page
function init() {
  // Fade in the body
  document.body.classList.add("js-has-loaded");
  // Otherwise check if page is already scrolled
  setScrolledClass();
  // Show/Hide the navbar on scroll
  window.onscroll = setScrolledClass;

    repos.forEach(function (repo) {
        var elem = document.querySelector('#' + repo.name + '-stars');
        var yesterday = new Date();
        yesterday.setDate(yesterday.getDate() - 1);
        if (localStorage.getItem(repo.name + '-stars') && localStorage.getItem(repo.name + '-stars-time') && localStorage.getItem(repo.name + '-stars-time') < yesterday) {
            elem.innerHTML = localStorage.getItem(repo.name + '-stars') + ' stars';
        } else {
            var url = getGitHubUrl(repo.owner, repo.name);
            var request = new XMLHttpRequest();
            request.onload = function(response) {
                if (elem) {
                    var stars = JSON.parse(this.responseText).items[0].stargazers_count
                    elem.innerHTML = stars + ' stars';
                    localStorage.setItem(repo.name + '-stars', stars)
                    localStorage.setItem(repo.name + '-stars-time', new Date())
                }
            }
            request.open('GET', url);
            request.send();
        }
    })

  // Add analytics asynchronously on load
  window.owa_baseUrl = 'http://analytics.mxstbr.com/';
  window.owa_cmds = window.owa_cmds || [];
  window.owa_cmds.push(['setSiteId', 'dc378514da5080f1d78d90cfa76a9023']);
  window.owa_cmds.push(['trackPageView']);
  window.owa_cmds.push(['trackClicks']);
  (function() {
    var _owa = document.createElement('script'); _owa.type = 'text/javascript'; _owa.async = true;
    owa_baseUrl = ('https:' == document.location.protocol ? window.owa_baseSecUrl || owa_baseUrl.replace(/http:/, 'https:') : owa_baseUrl );
    _owa.src = owa_baseUrl + 'modules/base/js/owa.tracker-combined-min.js';
    var _owa_s = document.getElementsByTagName('script')[0]; _owa_s.parentNode.insertBefore(_owa, _owa_s);
  }());
}

// Set the js-has-scrolled class on the body depending on scroll position
function setScrolledClass() {
  if (isScrolled() == true) {
    document.body.classList.add("js-has-scrolled");
  } else {
    document.body.classList.remove("js-has-scrolled");
  }
}

// Check if the user has scrolled
function isScrolled() {
  // IE...
  var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
  if (scrollTop > 0) {
    return true;
  } else {
    return false;
  }
}

// Cross browser solution to get document height
function getDocumentHeight() {
    var doc = document;
    // It's gotta be one of those
    return Math.max(
        doc.body.scrollHeight, doc.documentElement.scrollHeight,
        doc.body.offsetHeight, doc.documentElement.offsetHeight,
        doc.body.clientHeight, doc.documentElement.clientHeight
    );
}


text:
using System;

namespace Plethora.Finance.Bond
{
    public interface IBondInterestCalculator
    {
        Rational CalculateDayCountFraction(
            DateTime accrualStartDate,
            DateTime accrualEndDate,
            bool isPaysEndOfMonth);
    }
}


text:
<?php defined('SYSPATH') OR die('No direct script access.');

class View_User_Register extends Views {

	/**
	 * @var array Contains the form's values
	 */
	public $values = array();
}


text:
describe "Double" do
  let(:test_double) { double }

  specify "when one example has an expectation inside the block passed to should_receive" do
    test_double.should_receive(:msg) do |arg|
      arg.should be_true #this call exposes the problem
    end
    begin
      test_double.msg(false)
    rescue Exception
    end
  end

  specify "then the next example should behave as expected instead of saying" do
    test_double.should_receive(:foobar)
    test_double.foobar
    test_double.rspec_verify
    begin
      test_double.foobar
    rescue Exception => e
      e.message.should eq "Double received unexpected message :foobar with (no args)"
    end
  end
end


text:
var test_url = 'https://example.com/foo';
var test_body = 'Hello world!';
const { REMOTE_HOST } = get_host_info();

promise_test(async function(test) {
  var inboxBucket = await navigator.storageBuckets.open('inbox');
  var draftsBucket = await navigator.storageBuckets.open('drafts');

  test.add_cleanup(async function() {
    await navigator.storageBuckets.delete('inbox');
    await navigator.storageBuckets.delete('drafts');
  });

  const cacheName = 'attachments';
  const cacheKey = 'receipt1.txt';

  var inboxCache = await inboxBucket.caches.open(cacheName);
  var draftsCache = await draftsBucket.caches.open(cacheName);

  await inboxCache.put(cacheKey, new Response('bread x 2'))
  await draftsCache.put(cacheKey, new Response('eggs x 1'));

  return inboxCache.match(cacheKey)
      .then(function(result) {
        return result.text();
      })
      .then(function(body) {
        assert_equals(body, 'bread x 2', 'Wrong cache contents');
        return draftsCache.match(cacheKey);
      })
      .then(function(result) {
        return result.text();
      })
      .then(function(body) {
        assert_equals(body, 'eggs x 1', 'Wrong cache contents');
      });
}, 'caches from different buckets have different contents');

promise_test(async function(test) {
  var inboxBucket = await navigator.storageBuckets.open('inbox');

  test.add_cleanup(async function() {
    await navigator.storageBuckets.delete('inbox');
  });

  var caches = inboxBucket.caches;
  var attachments = await caches.open('attachments');
  await attachments.put('receipt1.txt', new Response('bread x 2'));
  var result = await attachments.match('receipt1.txt');
  assert_equals(await result.text(), 'bread x 2');

  await navigator.storageBuckets.delete('inbox');

  return promise_rejects_dom(
      test, 'UnknownError', caches.open('attachments'));
}, 'cache.open promise is rejected when bucket is gone');

done();


text:
title: Behavior Table
page_title: Tri-State-Behavior Table - RadTreeView
description: Check our Web Forms article about Tri-State-Behavior Table.
slug: treeview/checkboxes/tri-state/tri-state-behavior-table
tags: tri-state-behavior,table
published: True
position: 2
---

# Behavior Table

##

Due to the specifics behind the Tri-State functionality the behavior of **RadTreeView** can be different in some cases. Below is a table describing these differences:

>caption

|  **Use Case\Properties**  |  **Behavior**  |
| ------ | ------ |
|Clicking on a Node's CheckBox|Clicking on a Node's CheckBox updates the states of its child Nodes' CheckBoxes (if they exist) to match its own: **Checked** or **Unchecked** .|
|Load-On-Demand|Added child Nodes update the state of their Parent according to their CheckBox states to one of the Tri-States: **Checked** , **Indeterminate or Unchecked** .|
|Adding Nodes at the server|Added child Nodes update the state of their Parent according to their CheckBox states to one of the Tri-States: **Checked** , **Indeterminate or Unchecked** .|
|Adding Nodes in Design-Time|Updating the state of a Node's CheckBox updates the states of its child Nodes' CheckBoxes (if they exist) to match its own: **Checked** or **Unchecked** .|
|Checking/Unchecking Nodes in HTML|The state of a parent Node's CheckBox is always determined by the states of its child Nodes' CheckBoxes (regardless of the value of its **Checked** property).|

>tip  To override this behavior, that is to determine the state of the child Node's CheckBoxes based on the state of their parent Node's CheckBox, please see the [Inherit the the Checked state of the parent Node when loading Nodes on demand]({%slug treeview/application-scenarios/checkboxes/inherit-the-the-checked-state-of-the-parent-node-in-load-on-demand%})topic.
>


text:
package io.fabric8.kubernetes.client.dsl;

public interface ContainerResource<S,W, I, PI, O, PO, X, T>
        extends TtyExecInputOutputErrorable<X, O, PO, I, PI, T>,
  TimestampBytesLimitTerminateTimeTailPrettyLoggable<S, W> {
}


text:
package brooklyn.util.jmx.jmxrmi;

import java.io.IOException;
import java.net.MalformedURLException;
import java.util.Map;

import javax.management.MBeanServerConnection;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;

@SuppressWarnings({"rawtypes","unchecked"})
public class JmxRmiClient {

    public void connect(String urlString, Map env) throws MalformedURLException, IOException {
        JMXServiceURL url = new JMXServiceURL(urlString);
        System.out.println("JmxmpClient connecting to "+url);
        JMXConnector jmxc = JMXConnectorFactory.connect(url, env);

        MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();
        String domains[] = mbsc.getDomains();
        for (int i = 0; i < domains.length; i++) {
            System.out.println("Domain[" + i + "] = " + domains[i]);
        }

        jmxc.close();
    }

}


text:
class TabContentsWrapper;

// Objects implement this interface to get notified about changes in the
// BookmarksTabHelper and to provide necessary functionality.
class BookmarksTabHelperDelegate {
 public:
  // Notification that the starredness of the current URL changed.
  virtual void URLStarredChanged(TabContentsWrapper* source, bool starred) = 0;

 protected:
  virtual ~BookmarksTabHelperDelegate();
};

#endif  // CHROME_BROWSER_UI_BOOKMARKS_BOOKMARKS_TAB_HELPER_DELEGATE_H_


text:
from __future__ import print_function

import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil

class ExprXValuePrintingTestCase(TestBase):

    mydir = TestBase.compute_mydir(__file__)

    def setUp(self):
        # Call super's setUp().
        TestBase.setUp(self)

        self.main_source = "main.cpp"
        self.main_source_spec = lldb.SBFileSpec(self.main_source)

    def do_test(self, dictionary=None):
        """Printing an xvalue should work."""
        self.build(dictionary=dictionary)

        (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self,
                                          '// Break here', self.main_source_spec)
        frame = thread.GetFrameAtIndex(0)

        value = frame.EvaluateExpression("foo().data")
        self.assertTrue(value.IsValid())
        self.assertTrue(value.GetError().Success())
        self.assertEqual(value.GetValueAsSigned(), 1234)

    @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
    def test(self):
        self.do_test()


text:
//
//  BSSquareButton.m
//  BaiSiBuDeJie
//
//  Created by 侯宝伟 on 15/11/7.
//  Copyright © 2015年 ZHUNJIEE. All rights reserved.
//

#import "BSSquareButton.h"
#import "BSSquare.h"
#import <UIButton+WebCache.h>

@implementation BSSquareButton

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [self setBackgroundImage:[UIImage imageNamed:@"mainCellBackground"] forState:UIControlStateNormal];

        self.titleLabel.font = [UIFont systemFontOfSize:15];
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
//        self.imageView.backgroundColor = [UIColor redColor];
    }
    return self;
}

- (void)layoutSubviews{
    [super layoutSubviews];

    // 图片位置
    self.imageView.width = self.width - 4 * BSMargin;
    self.imageView.height = self.imageView.width;
    self.imageView.centerX =self.width * 0.5;
    self.imageView.y = self.height * 0.1;

    // 文字位置
    self.titleLabel.x = 0;
    self.titleLabel.y = CGRectGetMaxY(self.imageView.frame);
    self.titleLabel.width = self.width;
    self.titleLabel.height = self.height - self.titleLabel.y;
}

/**
 *  重写setter方法设置数据
 */
- (void)setSquare:(BSSquare *)square{
    _square = square;
    // 设置标题
    [self setTitle:square.name forState:UIControlStateNormal];

    // 下载图片
    [self sd_setImageWithURL:[NSURL URLWithString:square.icon] forState:UIControlStateNormal placeholderImage:[UIImage imageNamed:@"defaultUserIcon"]];
}
@end


text:
import * as angular from 'angular';

const moduleName = require('feed-mgr/feeds/edit-feed/module-name');

const directive = function () {
    return {
        restrict: "EA",
        bindToController: {
            processingdttm: '=',
            rowsPerPage: '='
        },
        controllerAs: 'vm',
        scope: {},
        templateUrl: 'js/feed-mgr/feeds/edit-feed/profile-history/profile-valid-results.html',
        controller: "FeedProfileValidResultsController",
        link: function ($scope: any, element: any, attrs: any, controller: any) {

        }
    };
};

export class FeedProfileValidResultsController implements ng.IComponentController {

    model: any = this.FeedService.editFeedModel;
    loading: boolean = false;
    limitOptions: Array<Number> = [10, 50, 100, 500, 1000];
    limit: Number = this.limitOptions[2];
    headers: any;
    rows: any;
    processingdttm: any;
    queryResults: any = null;

    constructor(private $http: any, private FeedService: any, private RestUrlService: any, private HiveService: any,
                private BroadcastService: any, private FattableService: any) {
    }

    //noinspection JSUnusedGlobalSymbols
    private onLimitChange() {
        this.init();
    }

    private getProfileValidation() {
        this.loading = true;

        const successFn = (response: any) => {
            const result = this.queryResults = this.HiveService.transformResultsToUiGridModel(response);
            this.headers = result.columns;
            this.rows = result.rows;
            this.loading = false;

            this.BroadcastService.notify('PROFILE_TAB_DATA_LOADED', 'valid');
        };
        const errorFn = (err: any) => {
            this.loading = false;
        };
        const promise = this.$http.get(this.RestUrlService.FEED_PROFILE_VALID_RESULTS_URL(this.model.id),
            {
                params:
                    {
                        'processingdttm': this.processingdttm,
                        'limit': this.limit
                    }
            });
        promise.then(successFn, errorFn);
        return promise;
    }

    private setupTable() {
        this.FattableService.setupTable({
            tableContainerId: "validProfile",
            headers: this.headers,
            rows: this.rows
        });
    }

    $onInit() {
        this.init();
    }

    private init() {
        this.getProfileValidation().then(this.setupTable.bind(this));
    }
}

angular.module(moduleName).controller('FeedProfileValidResultsController',
    ["$http", "FeedService", "RestUrlService", "HiveService", "BroadcastService", "FattableService", FeedProfileValidResultsController]);
angular.module(moduleName).directive('thinkbigFeedProfileValid', directive);


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
        <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
                <layout class="org.apache.log4j.PatternLayout">
                     <param name="ConversionPattern"
                                value="[%d{dd/MM/yy hh:mm:ss:sss}] %5p %c{2}: %m%n" />
                </layout>
        </appender>

        <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
                <appender-ref ref="CONSOLE"/>
        <appender-ref ref="FILE"/>
        </appender>

        <appender name="FILE" class="org.apache.log4j.RollingFileAppender">
                <param name="File" value="files/output.log"/>
                <param name="MaxFileSize" value="1MB"/>
                <param name="MaxBackupIndex" value="100"/>
                <layout class="org.apache.log4j.PatternLayout">
                     <param name="ConversionPattern"
                                value="[%d{dd/MM/yy hh:mm:ss:sss z}] %5p %c{2}: %m%n" />
                </layout>
        </appender>

        <root>
                <priority value="info"/>
                <appender-ref ref="CONSOLE"/>
        </root>
</log4j:configuration>


text:
<!doctype html>

	<meta charset="UTF-8">
	<base href="/">

	<title>Signup</title>

	<link rel="stylesheet" href="libs/bootstrap/dist/css/bootstrap.min.css">
        <link rel="stylesheet" href="css/style.css">

			Pinch


text:
//
// $Id: PrivateVisit.java 8169 2007-10-10 14:09:26Z swalker $
//

package edu.gemini.spModel.obsrecord;

import edu.gemini.pot.sp.SPObservationID;
import edu.gemini.skycalc.Night;
import edu.gemini.skycalc.ObservingNight;
import edu.gemini.skycalc.TwilightBoundType;
import edu.gemini.skycalc.TwilightBoundedNight;
import edu.gemini.spModel.config2.Config;
import edu.gemini.spModel.core.Site;
import edu.gemini.spModel.dataset.DatasetLabel;
import edu.gemini.spModel.dataset.DatasetQaState;
import edu.gemini.spModel.event.*;
import edu.gemini.spModel.obsclass.ObsClass;
import edu.gemini.spModel.time.ChargeClass;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * An implementation class that holds the events for a single visit, plus
 * a few methods for working with them.
 */
final class PrivateVisit implements Serializable {
    List<ObsExecEvent> _events = new ArrayList<ObsExecEvent>();

    PrivateVisit() {
    }

    PrivateVisit(PrivateVisit that) {
        // each event is immutable, no need to copy them
        _events = new ArrayList<ObsExecEvent>(that._events);
    }

    void add(ObsExecEvent evt) {
        _events.add(evt);
    }

    ObsExecEvent getFirstEvent() {
        int sz = _events.size();
        if (sz == 0) return null;
        return _events.get(0);
    }

    ObsExecEvent getLastEvent() {
        int sz = _events.size();
        if (sz == 0) return null;
        return _events.get(sz-1);
    }

    boolean endsBefore(ObsExecEvent evt) {
        ObsExecEvent lastEvt = getLastEvent();
        if (lastEvt == null) return true;
        return lastEvt.getTimestamp() < evt.getTimestamp();
    }

    long getTotalTime() {
        ObsExecEvent firstEvent = getFirstEvent();
        ObsExecEvent lastEvent  = getLastEvent();
        if ((firstEvent == null) || (lastEvent == null)) return 0;
        return lastEvent.getTimestamp() - firstEvent.getTimestamp();
    }

    ObsExecEvent[] getEvents() {
        return _events.toArray(ObsExecEvent.EMPTY_ARRAY);
    }

    // Tries to compute the SiteDesc for this visit based upon the events (if
    // any).  Uses the prefix of the observation id (GN or GS) to guess at the
    // site.  May return null if there are no events or if the
    // events do not have valid observation ids.
    Site divineSite() {
        ObsExecEvent e = getFirstEvent();
        if (e == null) return null;

        SPObservationID obsId = e.getObsId();
        String obsIdStr = obsId.stringValue().toLowerCase();
        if (obsIdStr.startsWith("gs-")) {
            return Site.GS;
        } else if (obsIdStr.startsWith("gn-")) {
            return Site.GN;
        }

        return null;
    }

    //

    private class EventData {
        ObsExecEvent evt;         // event itself
        Site site;
        ObservingNight obsNight;  // observing night of the event
        Night darkNight;          // subset of the ObservingNight that was dark

        EventData(Site site) {
            this.site = site;
        }

        void setEvent(ObsExecEvent evt) {
            this.evt = evt;
            if ((site == null) ||
                ((obsNight != null) && obsNight.includes(evt.getTimestamp()))) {
                // no need to reset the obsNight or dark night
                return;
            }

            obsNight  = new ObservingNight(site, evt.getTimestamp());
            darkNight = TwilightBoundedNight.forObservingNight(TwilightBoundType.NAUTICAL, obsNight);
        }

        void updateToMatch(EventData that) {
            this.evt       = that.evt;
            this.site      = that.site;
            this.obsNight  = that.obsNight;
            this.darkNight = that.darkNight;
        }
    }

    private static class EventInterval {
        long totalTime;
        long nightTime;

        long getDaytime() {
            return totalTime - nightTime;
        }
    }

    static void computeEventInterval(EventData e1, EventData e2, EventInterval inv) {
        long t1 = e1.evt.getTimestamp();
        long t2 = e2.evt.getTimestamp();

        // assertion
        if (t1 > t2) {
            throw new IllegalArgumentException("out of order events");
        }

        inv.totalTime = t2 - t1;
        inv.nightTime = 0;

        if (e1.obsNight == null) {
            // no site information, so just assume it is all night time
            // this shouldn't happen in practice
            inv.nightTime = inv.totalTime;
            return;
        }

        long n1start = e1.darkNight.getStartTime();
        long n1end   = e1.darkNight.getEndTime();

        long start = t1;  // assume t1 is in the dark part of the obs night 1
        if (t1 < n1start) {
            // was before the dark time begins on obs night 1
            start = n1start;
        } else if (t1 >= n1end) {
            // was after the dark time is over on obs night 1
            start = -1;
        }

        long n2start = e2.darkNight.getStartTime();
        long n2end   = e2.darkNight.getEndTime();

        long end = t2; // assume t2 is in the dark park of the obs night 2
        if (t2 < n2start) {
            // was before the dark time begins on obs night 2
            end = -1;
        } else if (t2 >= n2end) {
            end = n2end;
        }

        // First handle the common case, both events are in the same observing
        // night.
        if (e1.obsNight.includes(t2)) {
            if ((start != -1) && (end != -1)) {
                inv.nightTime = end - start;
            } // else no nighttime for this event
            return;
        }

        // Now handle the unusual case, events on different observing nights.
        long nighttime = 0;

        // First get the amount of nighttime on the first night.
        if (start != -1) {
            nighttime = n1end - start;
        }

        // Add in the amount of nighttime on the last night
        if (end != -1) {
            nighttime += end - n2start;
        }

        // Now, if there are observing nights between the two events, add in
        // all the night time for those nights.
        Site site = e1.obsNight.getSite();
        ObservingNight curNight = new ObservingNight(site, e1.obsNight.getEndTime());
        while (curNight.getStartTime() < e2.obsNight.getStartTime()) {
            Night darkNight = TwilightBoundedNight.forObservingNight(TwilightBoundType.NAUTICAL, curNight);
            nighttime += darkNight.getTotalTime();
            curNight   = new ObservingNight(site, curNight.getEndTime());
        }
        inv.nightTime = nighttime;
    }

    VisitTimes getTimeCharges(ObsQaRecord qa,
                              ConfigStore store) {

        VisitTimes res = new VisitTimes();
        if (_events.size() <= 1) return res;

        // First get the site.  If we can't figure out the site, then this is
        // a non-standard observation and we'll ignore daytime.
        Site site = divineSite();
        EventData ed1 = new EventData(site);
        ed1.setEvent(getFirstEvent());
        EventData ed2 = new EventData(site);
        ed2.updateToMatch(ed1);

        StartDatasetEvent start = null;
        EventInterval inv = new EventInterval();

        int sz = _events.size();
        for (int i=1; i<sz && !(ed1.evt instanceof OverlapEvent); ++i) {
            ObsExecEvent curEvt = _events.get(i);

            // compute the total, dark, and day times between the two events
            ed2.setEvent(curEvt);
            computeEventInterval(ed1, ed2, inv);
            ed1.updateToMatch(ed2);

            // Add in the daytime to the non-charged column.
            res.addClassifiedTime(ChargeClass.NONCHARGED, inv.getDaytime());

            // Now add in the nighttime for the event
            if ((curEvt instanceof EndDatasetEvent) && (start != null)) {
                EndDatasetEvent end = (EndDatasetEvent) curEvt;
                DatasetLabel label = end.getDatasetLabel();
                if (!label.equals(start.getDataset().getLabel())) {
                    continue;
                }

                final ObsClass obsClass = store.getObsClass(label);
                final DatasetQaState qaState = qa.qaState(label);

                // Charge for datasets that were in the PASS or
                // some non-final state.  Don't charge for anything else.
                if (DatasetQaState.PASS.equals(qaState) || !qaState.isFinal()) {
                    res.addClassifiedTime(obsClass.getDefaultChargeClass(), inv.nightTime);
                } else {
                    res.addClassifiedTime(ChargeClass.NONCHARGED, inv.nightTime);
                }
            } else {
                // Add the amount of time that passed during the night to the
                // main charge class.
                res.addUnclassifiedTime(inv.nightTime);
                if (curEvt instanceof StartDatasetEvent) {
                    start = (StartDatasetEvent) curEvt;
                }
            }
        }

        // Add any overlapped time to NONCHARGED.  All the time between the
        // overlap event (if there is one) and the last event is counted as
        // non-charged.
        if (ed1.evt instanceof OverlapEvent) {
            ObsExecEvent curEvt = _events.get(sz-1);
            long time = curEvt.getTimestamp() - ed1.evt.getTimestamp();
            res.addClassifiedTime(ChargeClass.NONCHARGED, time);
        }

        return res;
    }

    ObsVisit toObsVisit(ObsQaRecord qa, ConfigStore store) {
        List<UniqueConfig> uniqueConfigs = new ArrayList<UniqueConfig>();

        Config lastConfig = null;
        long starttime = -1;
        long curtime   = -1;
        List<DatasetLabel> uniqueConfigLabels = new ArrayList<DatasetLabel>();

        for (ObsExecEvent event : _events) {

            if (event instanceof StartDatasetEvent) {
                curtime = event.getTimestamp();
                continue;
            }

            // Only end datasets matter, when it comes to forming unique
            // configs.  If there is no end dataset, then the dataset was
            // never completed.

            if (!(event instanceof EndDatasetEvent)) continue;

            EndDatasetEvent ede = (EndDatasetEvent) event;
            DatasetLabel label = ede.getDatasetLabel();

            Config config = store.getConfigForDataset(label);
            if (config == null) {
                // was removed or never existed
                continue;
            }

            if ((lastConfig != null) && !lastConfig.equals(config)) {
                // add the last unique config to the list
                DatasetLabel[] labels;
                labels = uniqueConfigLabels.toArray(DatasetLabel.EMPTY_ARRAY);
                uniqueConfigs.add(new UniqueConfig(lastConfig, starttime, labels));
                uniqueConfigLabels.clear();
                starttime = -1;
            }

            lastConfig = config;
            uniqueConfigLabels.add(label);
            if (starttime == -1) {
                if (curtime == -1) {
                    // there was no start dataset event for some reason,
                    // so just use the end dataset time
                    curtime = event.getTimestamp();
                }
                starttime = curtime;
            }
        }

        if (lastConfig != null) {
            DatasetLabel[] labels;
            labels = uniqueConfigLabels.toArray(DatasetLabel.EMPTY_ARRAY);
            uniqueConfigs.add(new UniqueConfig(lastConfig, starttime, labels));
        }

        UniqueConfig[] uconfigs;
        uconfigs = uniqueConfigs.toArray(UniqueConfig.EMPTY_ARRAY);

        return new ObsVisit(getEvents(), uconfigs, getTimeCharges(qa, store));
    }

    // Implement as done in 2013B June release.  StartSequence is the only
    // event that triggers ONGOING and EndSequence triggers OBSERVED.
    ObsExecStatus getExecStatus() {
        ObsExecStatus result = ObsExecStatus.PENDING;
        for (int i=_events.size()-1; i>=0; --i) {
            final ObsExecEvent evt = _events.get(i);
            if (evt instanceof EndSequenceEvent) {
                result = ObsExecStatus.OBSERVED;
                break;
            } else if (evt instanceof StartSequenceEvent) {
                result = ObsExecStatus.ONGOING;
                break;
            }
        }
        return result;
    }
}


text:
package io.github.astrapi69.swing.check.model;

import java.awt.*;

import io.github.astrapi69.model.BaseModel;
import io.github.astrapi69.model.api.Model;
import io.github.astrapi69.swing.list.JListExtensions;
import io.github.astrapi69.window.adapter.CloseWindow;

public class CheckListPanelTest
{
	public static void main(String[] args)
	{
		final Frame frame = new Frame("CheckListPanel");
		String[] strs = { "root", "home", "kde", "mint", "ubuntu" };
		CheckableItem<CheckableValue>[] checkableItems = JListExtensions.newCheckableItems(strs);
		Model<CheckableListModelBean> model = BaseModel.of(CheckableListModelBean.builder()
			.values(JListExtensions.newCheckableItems(strs)).build());
		frame.add(new CheckListPanel(model));
		frame.addWindowListener(new CloseWindow());
		frame.setSize(300, 200);
		frame.setVisible(true);
	}
}


text:
{% extends "style/partials/bulk_upload.html" %}
{% load i18n %}

{% block extra_option %}
    {% if manage_consumption %}
    <div class="controls">
        <label for="include_consumption" class="checkbox">
            <input class="checkboxinput"
                   id="include_consumption"
                   type="checkbox"
                   data-bind="checked: include_consumption">
            {% trans "Include consumption data (this can cause the download to take several minutes)." %}
        </label>
    </div>
    {% endif %}
{% endblock %}


text:
package testing.decoratorPanel;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.Timer;
import java.util.TimerTask;

import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;

import thobe.widgets.buttons.SmallButton;
import thobe.widgets.decoratorPanel.Decorator;
import thobe.widgets.decoratorPanel.DecoratorPanel;
import thobe.widgets.decoratorPanel.DecoratorPanelException;
import thobe.widgets.decoratorPanel.WaitingDecorator;
import thobe.widgets.icons_internal.IconLib_Internal;

/**
 * @author Thomas Obenaus
 * @source AnimatedDecoratorDemo.java
 * @date 31.01.2012
 */
@SuppressWarnings ( "serial")
public class WaitingDecoratorDemo extends JFrame
{
	private final Random	rnd	= new Random( );

	public WaitingDecoratorDemo( )
	{
		this.buildGUI( );
		this.setSize( 300, 250 );
		this.addWindowListener( new WindowAdapter( )
		{
			@Override
			public void windowClosing( WindowEvent e )
			{
				System.exit( 0 );
			}
		} );
	}

	private void buildGUI( )
	{
		this.setLayout( new BorderLayout( ) );

		JPanel pa_toOverlay = new JPanel( );
		pa_toOverlay.setLayout( new BorderLayout( ) );
		pa_toOverlay.add( new JLabel( "ein Label" ), BorderLayout.NORTH );
		pa_toOverlay.add( new JTextArea( "Etwas Text .....\n....\nnoch mehr Text...." ), BorderLayout.CENTER );

		MyMenuPane myMP = new MyMenuPane( 3 );
		final WaitingDecorator ad = new WaitingDecorator( 2, pa_toOverlay, true );

		List<Decorator> decorators = new ArrayList<Decorator>( );
		decorators.add( myMP );
		decorators.add( ad );

		try
		{
			DecoratorPanel p = new DecoratorPanel( pa_toOverlay, decorators );
			this.add( p, BorderLayout.CENTER );
			myMP.setComponentsToControl( p, ad );
		}
		catch ( DecoratorPanelException e )
		{
			System.err.println( "Error: " + e.getLocalizedMessage( ) );
		}

		//		p.setEnabled( true );

		JButton bu_out = new JButton( "out" );
		bu_out.addActionListener( new ActionListener( )
		{
			@Override
			public void actionPerformed( ActionEvent e )
			{
				System.out.println( "OverlayPanelDemo.buildGUI().new ActionListener() {...}.actionPerformed()" );
			}
		} );
		pa_toOverlay.add( bu_out, BorderLayout.SOUTH );

		Timer t = new Timer( );
		t.schedule( new ProgressUpdate( ad ), 200, 200 );
	}

	public static void main( String[] args )
	{
		WaitingDecoratorDemo olpd = new WaitingDecoratorDemo( );
		olpd.setVisible( true );
	}

	private class ProgressUpdate extends TimerTask
	{
		private WaitingDecorator	wd;

		public ProgressUpdate( WaitingDecorator wd )
		{
			this.wd = wd;
		}

		@Override
		public void run( )
		{

			int nextProgress = wd.getProgress( );
			if ( nextProgress == 100 )
				nextProgress = 0;
			nextProgress += rnd.nextInt( 8 ) + 1;

			wd.setProgress( nextProgress );

		}
	}

	private class MyMenuPane extends Decorator
	{
		private final Dimension	dim	= new Dimension( 150, 40 );
		private JComponent		componentToControl1;
		private JComponent		componentToControl2;

		public MyMenuPane( int layer )
		{
			super( layer );
			this.componentToControl1 = null;
			this.componentToControl2 = null;
			this.buildGUI( );
		}

		public void setComponentsToControl( JComponent componentToControl1, JComponent componentToControl2 )
		{
			this.componentToControl1 = componentToControl1;
			this.componentToControl2 = componentToControl2;
		}

		private void buildGUI( )
		{
			this.setLayout( new FlowLayout( FlowLayout.RIGHT ) );

			SmallButton bu_enable = new SmallButton( IconLib_Internal.get( ).getMinimizeE( ) );
			bu_enable.setDisabledIcon( IconLib_Internal.get( ).getMinimizeE( ) );
			bu_enable.setToolTipText( "Dis-/ enable the panel" );
			this.add( bu_enable );
			bu_enable.addActionListener( new ActionListener( )
			{
				@Override
				public void actionPerformed( ActionEvent e )
				{
					if ( componentToControl2 instanceof WaitingDecorator )
					{
						WaitingDecorator wd = ( WaitingDecorator ) componentToControl2;
						wd.setWaiting( !wd.isWaiting( ) );
					}
				}
			} );

			SmallButton bu_close = new SmallButton( IconLib_Internal.get( ).getHelpE( ) );
			bu_close.setToolTipText( "Close" );
			this.add( bu_close );
			bu_close.addActionListener( new ActionListener( )
			{
				@Override
				public void actionPerformed( ActionEvent e )
				{
					if ( componentToControl2 instanceof WaitingDecorator )
					{
						WaitingDecorator wd = ( WaitingDecorator ) componentToControl2;
						wd.setDialRadius( rnd.nextInt( 80 ) + 20 );
						Color c = new Color( rnd.nextInt( 255 ), rnd.nextInt( 255 ), rnd.nextInt( 255 ) );
						wd.setDialColor( c );
					}
				}
			} );
		}

		@Override
		public void boundsUpdate_( int width, int height )
		{
			this.setBounds( width - ( int ) dim.getWidth( ), 0, ( int ) dim.getWidth( ), ( int ) dim.getHeight( ) );

		}

		@Override
		public String getName( )
		{
			return "MenuPane";
		}

	}
}


text:
"use strict";

var Q = require('q');
var child_process = require('child_process');
var fs = require('fs');
var glob = require('glob');
var path = require("path");
var util = require('util');

function execFile(command, args) {
  var deferred = Q.defer();
  child_process.execFile(command, args, function(error, stdout, stderr) {
    if (error == null) {
      deferred.resolve(stdout.toString());
    } else {
      deferred.reject(util.format("ERROR: %s\n%s\n", error, stdout, stderr));
    }
  });
  return deferred.promise;
}

function readTextFile(fname) {
  return fs.readFileSync(fname, 'utf8');
}

// Copied from https://github.com/angular/protractor/blob/6bc5e2945a13867ac3106bde2b787d3546ec2f5c/lib/runner.js#L227
function resolveFilePatterns (baseDir, patterns, opt_omitWarnings) {
  var resolvedFiles = [];

  if (patterns) {
    for (var i = 0; i < patterns.length; ++i) {
      var matches = glob.sync(patterns[i], {cwd: baseDir});
      if (!matches.length && !opt_omitWarnings) {
        util.puts('Warning: pattern ' + patterns[i] + ' did not match any files.');
      }
      for (var j = 0; j < matches.length; ++j) {
        resolvedFiles.push(path.resolve(baseDir, matches[j]));
      }
    }
  }
  return resolvedFiles;
};

exports.execFile = execFile;
exports.readTextFile = readTextFile;
exports.resolveFilePatterns = resolveFilePatterns;


text:
const path = require('path')
// Global fetch
require('isomorphic-fetch')
// Babel polyfill
require('babel-polyfill')
// Init Babel register
require('babel-register')({
  presets: ['es2015', 'stage-0', 'react'],
  plugins: [
    'transform-runtime',
    'transform-decorators-legacy',
    'transform-react-constant-elements',
    'transform-react-inline-elements',
    'remove-webpack',
    ['module-alias', [{
      expose: 'app',
      src: path.resolve(__dirname, '../../modules/app')
    }, {
      expose: 'server',
      src: path.resolve(__dirname, '../../modules/server')
    }]],
    ['webpack-loaders', {
      config: path.resolve(__dirname, '../../webpack/config.node'),
      verbose: false
    }]]
})
// Start server
require('./server')


text:
package com.weare42dp.vimeoclient.model;

import com.google.api.client.util.Key;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class VimeoPortraits
{
    @Key("portrait")
    private java.util.List<VimeoPortrait> portrait = new ArrayList<VimeoPortrait>();
    private Map<String, Object> additionalProperties = new HashMap<String, Object>();

    public final List<VimeoPortrait> getPortrait() {
        return portrait;
    }

}


text:
@interface MaxFriendTrendsViewController ()

@end

@implementation MaxFriendTrendsViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    self.view.backgroundColor = GlobalBg;

    //设置导航栏内容
    //initWithImage会使imageView的尺寸和image一样
    self.navigationItem.title = @"我的关注";

    //左边的按钮
    UIBarButtonItem *item = [UIBarButtonItem itemWithImage:@"friendsRecommentIcon" highImage:@"friendsRecommentIcon-click" target:self action:@selector(friendsClick)];
    self.navigationItem.leftBarButtonItem = item;
}
- (void)friendsClick{
    MaxRecommendViewController *recommend = [MaxRecommendViewController new];

    [self.navigationController pushViewController:recommend animated:YES];
}
- (IBAction)loginRegister:(UIButton *)sender {
    MaxLoginRegisterController *loginRegister = [MaxLoginRegisterController new];
    [self presentViewController:loginRegister animated:YES completion:nil];
}

@end