text:
<?php

include '../../bootstrap.php';

use App\Exceptions\ExerciseConfigException;
use App\Helpers\ExerciseConfig\Loader;
use App\Helpers\ExerciseConfig\Pipeline\Box\BoxService;
use App\Helpers\ExerciseConfig\Validation\EnvironmentConfigValidator;
use App\Helpers\ExerciseConfig\VariablesTable;
use App\Model\Entity\Exercise;
use App\Model\Entity\Group;
use App\Model\Entity\Instance;
use App\Model\Entity\SupplementaryExerciseFile;
use App\Model\Entity\UploadedFile;
use App\Model\Entity\User;
use Tester\Assert;

/**
 * @testCase
 */
class TestEnvironmentConfigValidator extends Tester\TestCase
{

    private static $table = [
        [
            "name" => "input",
            "type" => "remote-file",
            "value" => "input.name"
        ],
        [
            "name" => "output",
            "type" => "file",
            "value" => "output.name"
        ]
    ];

    /** @var Loader */
    private $loader;
    /** @var EnvironmentConfigValidator */
    private $validator;

    protected function setUp()
    {
        $this->loader = new Loader(new BoxService());
        $this->validator = new EnvironmentConfigValidator();
    }

    public function testEmpty()
    {
        $exercise = $this->createExercise();
        $table = new VariablesTable();

        Assert::noError(
            function () use ($exercise, $table) {
                $this->validator->validate($exercise, $table);
            }
        );
    }

    public function testCannotFindExerciseFile()
    {
        $exercise = $this->createExercise();
        $table = $this->loader->loadVariablesTable(
            [
                [
                    "name" => "input",
                    "type" => "remote-file",
                    "value" => "input.wrong.name"
                ]
            ]
        );

        Assert::exception(
            function () use ($exercise, $table) {
                $this->validator->validate($exercise, $table);
            },
            ExerciseConfigException::class,
            "Exercise configuration error - Remote file 'input.wrong.name' not found in exercise files."
        );
    }

    public function testCorrect()
    {
        $exercise = $this->createExercise();
        $table = $this->loader->loadVariablesTable(self::$table);

        Assert::noError(
            function () use ($exercise, $table) {
                $this->validator->validate($exercise, $table);
            }
        );
    }

    /**
     * @return Exercise
     */
    private function createExercise(): Exercise
    {
        $user = new User("", "", "", "", "", "", new Instance());
        $exercise = Exercise::create($user, new Group("ext", new Instance()));

        $uploadedFile = new UploadedFile("input.name", new DateTime(), 234, $user);
        SupplementaryExerciseFile::fromUploadedFileAndExercise(
            $uploadedFile,
            $exercise,
            "input.hash"
        );

        return $exercise;
    }

}

$testCase = new TestEnvironmentConfigValidator();
$testCase->run();


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Zergatul.Cryptography.Symmetric;
using Zergatul.Cryptography.Symmetric.CipherMode;
using Zergatul.Cryptography.Hash;
using Zergatul.Network.Tls.Messages;

namespace Zergatul.Network.Tls
{
    internal class HMACCBCCipher : AbstractTlsSymmetricCipher
    {
        private AbstractBlockCipher _cipher;
        private AbstractHash _hash;

        private BlockCipherEncryptor _encryptor;
        private BlockCipherDecryptor _decryptor;
        private HMAC _encHMAC;
        private HMAC _decHMAC;

        public HMACCBCCipher(AbstractBlockCipher cipher, AbstractHash hash)
        {
            this._cipher = cipher;
            this._hash = hash;
        }

        public override void ApplySecurityParameters()
        {
            SecurityParameters.CipherType = CipherType.Block;

            SecurityParameters.BlockLength = (byte)_cipher.BlockSize;
            SecurityParameters.EncKeyLength = (byte)_cipher.KeySize;
            SecurityParameters.MACLength = (byte)_hash.HashSize;
            SecurityParameters.RecordIVLength = (byte)_cipher.BlockSize;
            SecurityParameters.FixedIVLength = 0;
        }

        public override void Init(TlsConnectionKeys keys, Role role)
        {
            byte[] encKey = role == Role.Client ? keys.ClientEncKey : keys.ServerEncKey;
            byte[] decKey = role == Role.Server ? keys.ClientEncKey : keys.ServerEncKey;
            byte[] encMacKey = role == Role.Client ? keys.ClientMACkey : keys.ServerMACkey;
            byte[] decMacKey = role == Role.Server ? keys.ClientMACkey : keys.ServerMACkey;

            var mode = new CBC();
            _encryptor = mode.CreateEncryptor(_cipher, encKey);
            _decryptor = mode.CreateDecryptor(_cipher, decKey);

            _encHMAC = new HMAC(_hash, encMacKey);
            _decHMAC = new HMAC(_hash, decMacKey);
        }

        protected override byte[] Encrypt(TLSCompressed compressed, ulong seqnum)
        {
            byte[] IV = new byte[SecurityParameters.RecordIVLength];
            Random.GetBytes(IV);

            // compute padding
            int modulo = (compressed.Fragment.Length + SecurityParameters.MACLength + 1) % SecurityParameters.BlockLength;
            byte paddingLength = (byte)(SecurityParameters.BlockLength - modulo);

            // compute MAC
            byte[] mac = ComputeMAC(_encHMAC, seqnum, compressed.Type, compressed.Version, compressed.Fragment);

            // data to be encrypted
            byte[] data = new byte[compressed.Fragment.Length + SecurityParameters.MACLength + 1 + paddingLength];
            int index = 0;
            Array.Copy(compressed.Fragment, 0, data, index, compressed.Fragment.Length);
            index += compressed.Fragment.Length;
            Array.Copy(mac, 0, data, index, SecurityParameters.MACLength);
            index += SecurityParameters.MACLength;
            for (; index < data.Length; index++)
                data[index] = paddingLength;

            return ByteArray.Concat(IV, _encryptor.Encrypt(IV, data));
        }

        protected override byte[] Decrypt(TLSCiphertext ciphertext, ulong seqnum)
        {
            // check length
            int minLength = (SecurityParameters.RecordIVLength + SecurityParameters.MACLength + SecurityParameters.BlockLength) / SecurityParameters.BlockLength * SecurityParameters.BlockLength;
            if (ciphertext.Fragment.Length < minLength)
                throw new TlsStreamException("Invalid data");

            byte[] IV = new byte[SecurityParameters.RecordIVLength];
            Array.Copy(ciphertext.Fragment, 0, IV, 0, SecurityParameters.RecordIVLength);

            byte[] encrypted = new byte[ciphertext.Fragment.Length - IV.Length];
            Array.Copy(ciphertext.Fragment, IV.Length, encrypted, 0, encrypted.Length);

            byte[] decrypted = _decryptor.Decrypt(IV, encrypted);

            // validate padding
            byte paddingLength = decrypted[decrypted.Length - 1];
            for (int i = 1; i <= paddingLength; i++)
                if (decrypted[decrypted.Length - i - 1] != paddingLength)
                    throw new TlsStreamException("Invalid padding");

            byte[] plaindata = new byte[decrypted.Length - 1 - paddingLength - SecurityParameters.MACLength];
            byte[] mac = new byte[SecurityParameters.MACLength];

            Array.Copy(decrypted, 0, plaindata, 0, plaindata.Length);
            Array.Copy(decrypted, plaindata.Length, mac, 0, mac.Length);

            // validate MAC
            var calculatedMAC = ComputeMAC(_decHMAC, seqnum, ciphertext.Type, ciphertext.Version, plaindata);
            if (!ByteArray.Equals(mac, calculatedMAC))
                throw new TlsStreamException("Invalid MAC");

            return plaindata;
        }

        public static byte[] ComputeMAC(HMAC hmac, ulong sequenceNum, ContentType type, ProtocolVersion version, byte[] data)
        {
            // RFC 5246 // Page 21
            /*
                The MAC is generated as:

                MAC(MAC_write_key, seq_num +
                                    TLSCompressed.type +
                                    TLSCompressed.version +
                                    TLSCompressed.length +
                                    TLSCompressed.fragment);

                where "+" denotes concatenation.

                seq_num
                    The sequence number for this record.

                MAC
                    The MAC algorithm specified by SecurityParameters.mac_algorithm.
            */
            byte[] concatenated = new byte[8 + 1 + 2 + 2 + data.Length];
            BitHelper.GetBytes(sequenceNum, ByteOrder.BigEndian, concatenated, 0);
            concatenated[8] = (byte)type;
            BitHelper.GetBytes((ushort)version, ByteOrder.BigEndian, concatenated, 9);
            BitHelper.GetBytes((ushort)data.Length, ByteOrder.BigEndian, concatenated, 11);
            Array.Copy(data, 0, concatenated, 13, data.Length);

            return hmac.ComputeHash(concatenated);
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
Project One: Maximum Sub-Array Summation
===

- In the specific folders for each algorithm
    - Python function
        - Input parameter: Array of ints
        - Return value: Single int of max subarray sum
    - Text file with pseudocode
    - Analysis of theoretical asymptotic runtimes

- Top level folder
    - (0) Main code
        - Run MSS_Problems.txt through each function
        - Compile results into MSS_Results.txt
    - (1) Test Suite code
        - Run test cases through each function
    - (2) Experimental Analysis code
        - Generate random input arrays for experimental analysis
        - Run random input arrays through each function
            - I/O and array generation aren't clocked
        - Generate plots of average experimental run times
        - Generate curve fits of experimental run time

- File Summary
    - 3 Python files in top level
        - MSS_Problems.txt --> MSS_Results.txt, Test Suite, Experimental Analysis
    - 4 Python files for Algorithms
        - Enumeration, "Better Enumeration", Divide-and-Conquer, Dynamic Programming

- Deliverables by Thursday night:
    - Alex: Algorithms 1 and 3
        - Python Code
        - Pseudo-code
        - Theoretical runtime analysis
    - Kyle: Algorithms 2 and 4
        - Python Code
        - Pseudo-code
        - Theoretical runtime analysis
    - Cash: Top level code


text:
APP := subs
SRC = main.c
OBJ = ${SRC:.c=.o}
EXTERN_OBJ = "../common/util.o"

include ../config.mk
include ../default.mk
include ../binary.mk


text:
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System;

namespace osu.Framework.Input
{
    /// <summary>
    /// A source from which we can retrieve user text input.
    /// Generally hides a native implementation from the game framework.
    /// </summary>
    public interface ITextInputSource
    {
        bool ImeActive { get; }

        string GetPendingText();

        void Deactivate(object sender);

        void Activate(object sender);

        event Action<string> OnNewImeComposition;
        event Action<string> OnNewImeResult;
    }
}


text:
/**
 * @author Mat Groves http://matgroves.com/ @Doormat23
 */

var $__Object$defineProperty = Object.defineProperty;
var $__Object$create = Object.create;
import AbstractFilter from './AbstractFilter';

var PixelateFilter = function(AbstractFilter) {
    function PixelateFilter() {
		AbstractFilter.call(this);

		this.passes = [this];

		// set the uniforms
		this.uniforms = {
			invert: {type: '1f', value: 0},
			dimensions: {type: '4fv', value:new Float32Array([10000, 100, 10, 10])},
			pixelSize: {type: '2f', value:{x:10, y:10}}
		};

		this.fragmentSrc = [
			'precision mediump float;',
			'varying vec2 vTextureCoord;',
			'varying vec4 vColor;',
			'uniform vec2 testDim;',
			'uniform vec4 dimensions;',
			'uniform vec2 pixelSize;',
			'uniform sampler2D uSampler;',

			'void main(void) {',
			'   vec2 coord = vTextureCoord;',

			'   vec2 size = dimensions.xy/pixelSize;',

			'   vec2 color = floor( ( vTextureCoord * size ) ) / size + pixelSize/dimensions.xy * 0.5;',
			'   gl_FragColor = texture2D(uSampler, color);',
			'}'
		];
	}

    PixelateFilter.prototype = $__Object$create(AbstractFilter.prototype);
    PixelateFilter.prototype.constructor = PixelateFilter;

    $__Object$defineProperty(PixelateFilter.prototype, "size", {
        get: function() {
            return this.uniforms.pixelSize.value;
        },

        set: function(value) {
            this.dirty = true;
            this.uniforms.pixelSize.value = value;
        },

        enumerable: true,
        configurable: true
    });

    return PixelateFilter;
}(AbstractFilter);

export default PixelateFilter;


text:
ENV['RAILS_ENV'] ||= 'test'
require 'spec_helper'
require File.expand_path('../rails/config/environment', __FILE__)
require 'rspec/rails'


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

<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
Uses of Interface org.apache.wicket.behavior.IBehaviorListener (Wicket Parent 1.5.7 API)
</TITLE>

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

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Uses of Interface
org.apache.wicket.behavior.IBehaviorListener

Packages that use IBehaviorListener

org.apache.wicket.ajax

org.apache.wicket.ajax.form

org.apache.wicket.ajax.markup.html.navigation.paging

org.apache.wicket.behavior

org.apache.wicket.extensions.ajax.markup.html

org.apache.wicket.extensions.ajax.markup.html.autocomplete

org.apache.wicket.extensions.ajax.markup.html.modal

Uses of IBehaviorListener in org.apache.wicket.ajax

Classes in org.apache.wicket.ajax that implement IBehaviorListener

 class
AbstractAjaxTimerBehavior

          A behavior that generates an AJAX update callback at a regular interval.

 class
AbstractDefaultAjaxBehavior

          The base class for Wicket's default AJAX implementation.

 class
AjaxEventBehavior

          An ajax behavior that is attached to a certain client-side (usually javascript) event, such as
 onClick, onChange, onKeyDown, etc.

 class
AjaxNewWindowNotifyingBehavior

          An Ajax behavior that notifies when a new browser window/tab is opened with
 url to a page instance which is already opened in another window/tab in the same user session.

 class
AjaxSelfUpdatingTimerBehavior

          Automatically re-renders the component it is attached to via AJAX at a regular interval.

Uses of IBehaviorListener in org.apache.wicket.ajax.form

Classes in org.apache.wicket.ajax.form that implement IBehaviorListener

 class
AjaxFormChoiceComponentUpdatingBehavior

          This is a Ajax Component Update Behavior that is meant for choices/groups that are not one
 component in the html but many.

 class
AjaxFormComponentUpdatingBehavior

          A behavior that updates the hosting FormComponent via ajax when an event it is attached to is
 triggered.

 class
AjaxFormSubmitBehavior

          Ajax event behavior that submits a form via ajax when the event it is attached to, is invoked.

 class
AjaxFormValidatingBehavior

          Ajax event behavior that submits the form and updates all form feedback panels on the page.

 class
OnChangeAjaxBehavior

          A behavior that updates the hosting FormComponent via ajax when value of the component is
 changed.

Uses of IBehaviorListener in org.apache.wicket.ajax.markup.html.navigation.paging

Classes in org.apache.wicket.ajax.markup.html.navigation.paging that implement IBehaviorListener

 class
AjaxPagingNavigationBehavior

          Ajax behavior for the paging navigation links.

Uses of IBehaviorListener in org.apache.wicket.behavior

Classes in org.apache.wicket.behavior that implement IBehaviorListener

 class
AbstractAjaxBehavior

          Abstract class for handling Ajax roundtrips.

Uses of IBehaviorListener in org.apache.wicket.extensions.ajax.markup.html

Classes in org.apache.wicket.extensions.ajax.markup.html that implement IBehaviorListener

protected  class
AjaxEditableLabel.EditorAjaxBehavior

protected  class
AjaxEditableLabel.LabelAjaxBehavior

Uses of IBehaviorListener in org.apache.wicket.extensions.ajax.markup.html.autocomplete

Classes in org.apache.wicket.extensions.ajax.markup.html.autocomplete that implement IBehaviorListener

 class
AbstractAutoCompleteBehavior

 class
AutoCompleteBehavior<T>

          This behavior builds on top of AbstractAutoCompleteBehavior by introducing the concept of
 a IAutoCompleteRenderer to make response writing easier.

Uses of IBehaviorListener in org.apache.wicket.extensions.ajax.markup.html.modal

Classes in org.apache.wicket.extensions.ajax.markup.html.modal that implement IBehaviorListener

protected  class
ModalWindow.CloseButtonBehavior

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Copyright © 2006-2012 Apache Software Foundation. All Rights Reserved.


text:
<!DOCTYPE html>
<html>
<head>
<link href="../generic.css" rel="stylesheet"/>
<script>
function performTest()
{
    Outline_init();
    PostponedActions_perform();

    Figures_insertFigure("nothing.png",null,false,"Sample caption");
    PostponedActions_perform();
}
</script>
</head>
<body>
[]
</body>
</html>


text:
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
 *
 *  (C) 2001 by Argonne National Laboratory.
 *      See COPYRIGHT in top-level directory.
 */

#include "mpiimpl.h"

/* -- Begin Profiling Symbol Block for routine MPI_Unpack */
#if defined(HAVE_PRAGMA_WEAK)
#pragma weak MPI_Unpack = PMPI_Unpack
#elif defined(HAVE_PRAGMA_HP_SEC_DEF)
#pragma _HP_SECONDARY_DEF PMPI_Unpack  MPI_Unpack
#elif defined(HAVE_PRAGMA_CRI_DUP)
#pragma _CRI duplicate MPI_Unpack as PMPI_Unpack
#endif
/* -- End Profiling Symbol Block */

/* Define MPICH_MPI_FROM_PMPI if weak symbols are not supported to build
   the MPI routines */
#ifndef MPICH_MPI_FROM_PMPI
#undef MPI_Unpack
#define MPI_Unpack PMPI_Unpack

#undef FUNCNAME
#define FUNCNAME MPIR_Unpack_impl
#undef FCNAME
#define FCNAME MPIU_QUOTE(FUNCNAME)
int MPIR_Unpack_impl(const void *inbuf, int insize, int *position,
                     void *outbuf, int outcount, MPI_Datatype datatype)
{
    int mpi_errno = MPI_SUCCESS;
    MPI_Aint first, last;
    MPID_Segment *segp;
    int contig;
    MPI_Aint dt_true_lb;
    MPI_Aint data_sz;

    if (insize == 0)
	goto fn_exit;

    /* Handle contig case quickly */
    if (HANDLE_GET_KIND(datatype) == HANDLE_KIND_BUILTIN) {
        contig     = TRUE;
        dt_true_lb = 0;
        data_sz    = outcount * MPID_Datatype_get_basic_size(datatype);
    } else {
        MPID_Datatype *dt_ptr;
        MPID_Datatype_get_ptr(datatype, dt_ptr);
	contig     = dt_ptr->is_contig;
        dt_true_lb = dt_ptr->true_lb;
        data_sz    = outcount * dt_ptr->size;
    }

    if (contig) {
        MPIU_Memcpy((char *) outbuf + dt_true_lb, (char *)inbuf + *position, data_sz);
        *position = (int)((MPI_Aint)*position + data_sz);
        goto fn_exit;
    }

    /* non-contig case */
    segp = MPID_Segment_alloc();
    MPIU_ERR_CHKANDJUMP1(segp == NULL, mpi_errno, MPI_ERR_OTHER, "**nomem", "**nomem %s", "MPID_Segment_alloc");
    mpi_errno = MPID_Segment_init(outbuf, outcount, datatype, segp, 0);
    MPIU_Assert(mpi_errno == MPI_SUCCESS);

    /* NOTE: the use of buffer values and positions in MPI_Unpack and in
     * MPID_Segment_unpack are quite different.  See code or docs or something.
     */
    first = 0;
    last  = SEGMENT_IGNORE_LAST;

    /* Ensure that pointer increment fits in a pointer */
    MPID_Ensure_Aint_fits_in_pointer((MPI_VOID_PTR_CAST_TO_MPI_AINT inbuf) +
				     (MPI_Aint) *position);

    MPID_Segment_unpack(segp,
			first,
			&last,
			(void *) ((char *) inbuf + *position));

    /* Ensure that calculation fits into an int datatype. */
    MPID_Ensure_Aint_fits_in_int((MPI_Aint)*position + last);

    *position = (int)((MPI_Aint)*position + last);

    MPID_Segment_free(segp);

 fn_exit:
    return mpi_errno;
 fn_fail:
    goto fn_exit;
}

#endif

#undef FUNCNAME
#define FUNCNAME MPI_Unpack
#undef FCNAME
#define FCNAME MPIU_QUOTE(FUNCNAME)
/*@
    MPI_Unpack - Unpack a buffer according to a datatype into contiguous memory

Input Parameters:
+ inbuf - input buffer start (choice)
. insize - size of input buffer, in bytes (integer)
. outcount - number of items to be unpacked (integer)
. datatype - datatype of each output data item (handle)
- comm - communicator for packed message (handle)

Output Parameters:
. outbuf - output buffer start (choice)

Inout/Output Parameters:
. position - current position in bytes (integer)

.N ThreadSafe

.N Fortran

.N Errors
.N MPI_SUCCESS
.N MPI_ERR_COMM
.N MPI_ERR_COUNT
.N MPI_ERR_TYPE
.N MPI_ERR_ARG

.seealso: MPI_Pack, MPI_Pack_size
@*/
int MPI_Unpack(const void *inbuf, int insize, int *position,
	       void *outbuf, int outcount, MPI_Datatype datatype,
	       MPI_Comm comm)
{
    int mpi_errno = MPI_SUCCESS;
    MPID_Comm *comm_ptr = NULL;
    MPID_MPI_STATE_DECL(MPID_STATE_MPI_UNPACK);

    MPIR_ERRTEST_INITIALIZED_ORDIE();

    MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_UNPACK);

    /* Validate parameters, especially handles needing to be converted */
#   ifdef HAVE_ERROR_CHECKING
    {
        MPID_BEGIN_ERROR_CHECKS;
        {
	    MPIR_ERRTEST_COMM(comm, mpi_errno);
        }
        MPID_END_ERROR_CHECKS;
    }
#   endif

    /* Convert MPI object handles to object pointers */
    MPID_Comm_get_ptr(comm, comm_ptr);

    /* Validate parameters and objects (post conversion) */
#   ifdef HAVE_ERROR_CHECKING
    {
        MPID_BEGIN_ERROR_CHECKS;
        {
	    if (insize > 0) {
		MPIR_ERRTEST_ARGNULL(inbuf, "input buffer", mpi_errno);
	    }
	    /* Note: outbuf could be MPI_BOTTOM; don't test for NULL */
	    MPIR_ERRTEST_COUNT(insize, mpi_errno);
	    MPIR_ERRTEST_COUNT(outcount, mpi_errno);

            /* Validate comm_ptr */
            MPID_Comm_valid_ptr(comm_ptr, mpi_errno);
	    if (mpi_errno != MPI_SUCCESS) goto fn_fail;
	    /* If comm_ptr is not valid, it will be reset to null */

	    MPIR_ERRTEST_DATATYPE(datatype, "datatype", mpi_errno);

	    if (datatype != MPI_DATATYPE_NULL &&
		HANDLE_GET_KIND(datatype) != HANDLE_KIND_BUILTIN) {
		MPID_Datatype *datatype_ptr = NULL;

		MPID_Datatype_get_ptr(datatype, datatype_ptr);
		MPID_Datatype_valid_ptr(datatype_ptr, mpi_errno);
		MPID_Datatype_committed_ptr(datatype_ptr, mpi_errno);
	    }
            if (mpi_errno != MPI_SUCCESS) goto fn_fail;
        }
        MPID_END_ERROR_CHECKS;
    }
#   endif /* HAVE_ERROR_CHECKING */

    /* ... body of routine ...  */

    mpi_errno = MPIR_Unpack_impl(inbuf, insize, position, outbuf, outcount, datatype);
    if (mpi_errno) goto fn_fail;

    /* ... end of body of routine ... */

  fn_exit:
    MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_UNPACK);
    return mpi_errno;

  fn_fail:
    /* --BEGIN ERROR HANDLING-- */
#   ifdef HAVE_ERROR_CHECKING
    {
	mpi_errno = MPIR_Err_create_code(
	    mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER, "**mpi_unpack",
	    "**mpi_unpack %p %d %p %p %d %D %C", inbuf, insize, position, outbuf, outcount, datatype, comm);
    }
#   endif
    mpi_errno = MPIR_Err_return_comm(comm_ptr, FCNAME, mpi_errno);
    goto fn_exit;
    /* --END ERROR HANDLING-- */
}


text:
public class Oper12 {
	public static void main(String[] args) {
		boolean b = true;
		System.out.println(b || false);
	}
}


text:
(function () {
    /* jshint newcap: false, strict: false */
    this.CarouselTest = AsyncTestCase("Carousel");

    this.CarouselTest.prototype.setUp = function () {
        this.sandbox = sinon.sandbox.create();
    };

    this.CarouselTest.prototype.tearDown = function () {
        this.sandbox.restore();
    };

    var queueTest = function(queue, fn) {
        queuedApplicationInit(queue,
            'lib/mockapplication',
            [
                'antie/widgets/carousel',
                "antie/widgets/carousel/strips/widgetstrip",
                "antie/widgets/carousel/mask",
                "antie/widgets/carousel/navigators/navigator",
                "antie/widgets/button",
                "antie/widgets/container",
                "antie/widgets/carousel/carouselcore"

            ],
            fn
        );
    };

    var stubClassPrototypes = function (self, classArray) {
        function stubUnstubbedFunctions(Class) {
            var prototype, propertyName, property;
            prototype = Class.prototype;
            for (propertyName in prototype) {
                property = prototype[propertyName];
                if ((typeof property === 'function') && !(property.restore && property.restore.sinon) && propertyName !== 'self') {
                    self.sandbox.stub(prototype, propertyName);
                }
            }
        }
        var i, currentClass;

        for (i = 0; i !== classArray.length; i += 1) {
            currentClass = classArray[i];
            stubUnstubbedFunctions(classArray[i]);
        }
    };

    this.CarouselTest.prototype.testContainerAPIRedirectsToAppropriateClasses = function (queue) {
	var self = this;
        function testFunction(application, Carousel, WidgetStrip, Mask, Navigator, Button) {
            var carousel;
            stubClassPrototypes(self, [WidgetStrip, Mask, Button, Navigator]);

            carousel = new Carousel('myCarousel');
            assertFalse("append", WidgetStrip.prototype.append.called);
            carousel.appendChildWidget(new Button());
            assertTrue("Append child widget appends to widget strip", WidgetStrip.prototype.append.called);

            assertFalse("getChildWidget", WidgetStrip.prototype.getChildWidget.called);
            carousel.getChildWidget("test");
            assertTrue("getChildWidget gets from widget strip", WidgetStrip.prototype.getChildWidget.called);

            assertFalse("getChildWidgetCount", WidgetStrip.prototype.getChildWidgetCount.called);
            carousel.getChildWidgetCount();
            assertTrue("getChildWidgetCount gets from widget strip", WidgetStrip.prototype.getChildWidgetCount.called);

            assertFalse("getChildWidgets", WidgetStrip.prototype.getChildWidgets.called);
            carousel.getChildWidgets();
            assertTrue("getChildWidgets gets from widget strip", WidgetStrip.prototype.widgets.called);

            assertFalse("hasChildWidget", WidgetStrip.prototype.hasChildWidget.called);
            carousel.hasChildWidget(new Button());
            assertTrue("hasChildWidget queries widget strip", WidgetStrip.prototype.hasChildWidget.called);

            assertFalse("setIndex", Navigator.prototype.setIndex.called);
            carousel.setActiveChildIndex(2);
            assertTrue("setActiveIndex sets on navigator", Navigator.prototype.setIndex.called);

            assertFalse("getActiveIndex", Navigator.prototype.currentIndex.called);
            carousel.getActiveChildIndex();
            assertTrue("getActiveIndex gets from navigator", Navigator.prototype.currentIndex.called);

            carousel.addClass("setTest");
            assertTrue("addClass passes through to widget strip", WidgetStrip.prototype.addClass.calledWith("setTest"));

            carousel.hasClass("hasTest");
            assertTrue("hasClass passes through to widget strip", WidgetStrip.prototype.hasClass.calledWith("hasTest"));

            carousel.removeClass("removeClass");
            assertTrue("removeClass passes through to widget strip", WidgetStrip.prototype.removeClass.calledWith("removeClass"));

            assertFalse("getClasses", WidgetStrip.prototype.getClasses.called);
            carousel.getClasses();
            assertTrue("getClasses passes through to widget strip", WidgetStrip.prototype.getClasses.called);

        }
        queueTest(queue, testFunction);

    };

    this.CarouselTest.prototype.testAppendChildWidgetCallsContainerPrototypeDuringInit = function (queue) {
	var self = this;
        function testFunction(application, Carousel, WidgetStrip, Mask, Navigator, Button, Container, CarouselCore) {
            var carousel;
            stubClassPrototypes(self, [WidgetStrip, Mask, Button, Navigator, Container]);
            self.sandbox.stub(CarouselCore.prototype, "append");
            carousel = new Carousel();
            assertTrue(Container.prototype.appendChildWidget.calledOnce);
            assertFalse(CarouselCore.prototype.append.calledOnce);
        }
        queueTest(queue, testFunction);
    };

    this.CarouselTest.prototype.testAppendChildWidgetCallsAppendAfterInit = function (queue) {
	var self = this;
        function testFunction(application, Carousel, WidgetStrip, Mask, Navigator, Button, Container, CarouselCore) {
            var carousel;
            stubClassPrototypes(self, [WidgetStrip, Mask, Button, Navigator, Container]);
            self.sandbox.stub(CarouselCore.prototype, "append");
            carousel = new Carousel();
            carousel.append(new Button());
            assertTrue(Container.prototype.appendChildWidget.calledOnce);
            assertTrue(CarouselCore.prototype.append.calledOnce);
        }
        queueTest(queue, testFunction);
    };

    this.CarouselTest.prototype.testSetActiveChildWidgetWithMaskCallsContainerPrototype = function (queue) {
	var self = this;
        function testFunction(application, Carousel, WidgetStrip, Mask, Navigator, Button, Container, CarouselCore) {
            var carousel;
            stubClassPrototypes(self, [WidgetStrip, Mask, Button, Navigator, Container]);
            self.sandbox.stub(CarouselCore.prototype, "setActiveWidget");
            carousel = new Carousel();
            carousel.setActiveChildWidget(carousel._mask);
            assertTrue(Container.prototype.setActiveChildWidget.calledOnce);
            assertFalse(CarouselCore.prototype.setActiveWidget.called);
        }
        queueTest(queue, testFunction);
    };

    this.CarouselTest.prototype.testSetActiveChildWidgetWithNonMaskCallsSetActiveWidget = function (queue) {
	var self = this;
        function testFunction(application, Carousel, WidgetStrip, Mask, Navigator, Button, Container, CarouselCore) {
            var carousel;
            stubClassPrototypes(self, [WidgetStrip, Mask, Button, Navigator, Container]);
            self.sandbox.stub(CarouselCore.prototype, "setActiveWidget");
            carousel = new Carousel();
            carousel.setActiveChildWidget(new Button());
            assertFalse(Container.prototype.setActiveChildWidget.called);
            assertTrue(CarouselCore.prototype.setActiveWidget.calledOnce);
        }
        queueTest(queue, testFunction);
    };

    this.CarouselTest.prototype.testHasChildWidgetWithMaskIdCallsCore = function (queue) {
	var self = this;
        function testFunction(application, Carousel, WidgetStrip, Mask, Navigator, Button, Container, CarouselCore) {
            var carousel;
            self.sandbox.stub(CarouselCore.prototype, 'hasChildWidget');
            self.sandbox.stub(WidgetStrip.prototype, 'hasChildWidget');
            stubClassPrototypes(self, [WidgetStrip, Mask, Button, Navigator, Container]);
            carousel = new Carousel();
            carousel.hasChildWidget(carousel._mask.id);
            assertTrue(CarouselCore.prototype.hasChildWidget.calledOnce);
            assertFalse(WidgetStrip.prototype.hasChildWidget.called);
        }
        queueTest(queue, testFunction);
    };

    this.CarouselTest.prototype.testHasChildWidgetWithNonMaskIdCallsWidgetStrip = function (queue) {
	var self = this;
        function testFunction(application, Carousel, WidgetStrip, Mask, Navigator, Button, Container, CarouselCore) {
            var carousel;
            self.sandbox.stub(CarouselCore.prototype, 'hasChildWidget');
            self.sandbox.stub(WidgetStrip.prototype, 'hasChildWidget');
            stubClassPrototypes(self, [WidgetStrip, Mask, Button, Navigator, Container]);
            carousel = new Carousel();
            carousel.hasChildWidget("testId");
            assertFalse(CarouselCore.prototype.hasChildWidget.called);
            assertTrue(WidgetStrip.prototype.hasChildWidget.calledOnce);
        }
        queueTest(queue, testFunction);
    };

    this.CarouselTest.prototype.testGetChildWidgetWithMaskIdCallsCore = function (queue) {
	var self = this;
        function testFunction(application, Carousel, WidgetStrip, Mask, Navigator, Button, Container, CarouselCore) {
            var carousel, widget;
            stubClassPrototypes(self, [WidgetStrip, Mask, Button, Navigator, Container]);
            carousel = new Carousel();
            widget = carousel.getChildWidget(carousel._mask.id);
            assertEquals(carousel._mask, widget);
        }
        queueTest(queue, testFunction);
    };

    this.CarouselTest.prototype.testGetChildWidgetWithNonMaskIdCallsWidgetStrip = function (queue) {
	var self = this;
        function testFunction(application, Carousel, WidgetStrip, Mask, Navigator, Button, Container, CarouselCore) {
            var carousel;
            self.sandbox.stub(WidgetStrip.prototype, 'getChildWidget');
            stubClassPrototypes(self, [WidgetStrip, Mask, Button, Navigator, Container]);
            carousel = new Carousel();
            carousel.getChildWidget("testId");
            assertTrue(WidgetStrip.prototype.getChildWidget.calledOnce);
        }
        queueTest(queue, testFunction);
    };

    this.CarouselTest.prototype.testInsertChildWidgetCallsInsert = function (queue) {
	var self = this;
        function testFunction(application, Carousel, WidgetStrip, Mask, Navigator, Button, Container, CarouselCore) {
            var carousel;
            stubClassPrototypes(self,[WidgetStrip, Mask, Button, Navigator, Container]);
            self.sandbox.stub(CarouselCore.prototype, "insert");
            carousel = new Carousel();
            carousel.insertChildWidget(new Button());
            assertTrue(CarouselCore.prototype.insert.calledOnce);
        }
        queueTest(queue, testFunction);
    };

    this.CarouselTest.prototype.testRemoveChildWidgetCallsRemove = function (queue) {
	var self = this;
        function testFunction(application, Carousel, WidgetStrip, Mask, Navigator, Button, Container, CarouselCore) {
            var carousel;
            stubClassPrototypes(self, [WidgetStrip, Mask, Button, Navigator, Container]);
            self.sandbox.stub(CarouselCore.prototype, "remove");
            carousel = new Carousel();
            carousel.removeChildWidget(new Button(), false);
            assertTrue(CarouselCore.prototype.remove.calledOnce);
        }
        queueTest(queue, testFunction);
    };

    this.CarouselTest.prototype.testRemoveChildWidgetsCallsRemoveAll = function (queue) {
	var self = this;
        function testFunction(application, Carousel, WidgetStrip, Mask, Navigator, Button, Container, CarouselCore) {
            var carousel;
            stubClassPrototypes(self, [WidgetStrip, Mask, Button, Navigator, Container]);
            self.sandbox.stub(CarouselCore.prototype, "removeAll");
            carousel = new Carousel();
            carousel.removeChildWidgets();
            assertTrue(CarouselCore.prototype.removeAll.calledOnce);
        }
        queueTest(queue, testFunction);
    };

}());


text:
// compose-filter.h

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Copyright 2005-2010 Google, Inc.
// Author: riley@google.com (Michael Riley)
//
// \file
// Classes for filtering the composition matches, e.g. for correct epsilon
// handling.

#ifndef FST_LIB_COMPOSE_FILTER_H__
#define FST_LIB_COMPOSE_FILTER_H__

#include <fst/fst.h>
#include <fst/fst-decl.h>  // For optional argument declarations
#include <fst/filter-state.h>
#include <fst/matcher.h>

namespace fst {

// COMPOSITION FILTERS - these determine which matches are allowed to
// proceed. The filter's state is represented by the type
// ComposeFilter::FilterState. The basic filters handle correct
// epsilon matching.  Their interface is:
//
// template <class M1, class M2>
// class ComposeFilter {
//  public:
//   typedef typename M1::FST1 FST1;
//   typedef typename M1::FST2 FST2;
//   typedef typename FST1::Arc Arc;
//   typedef ... FilterState;
//   typedef ... Matcher1;
//   typedef ... Matcher2;
//
//   // Required constructors.
//   ComposeFilter(const FST1 &fst1, const FST2 &fst2,
//   //            M1 *matcher1 = 0, M2 *matcher2 = 0);
//   // If safe=true, the copy is thread-safe. See Fst<>::Copy()
//   // for further doc.
//   ComposeFilter(const ComposeFilter<M1, M2> &filter,
//   //            bool safe = false);
//   // Return start state of filter.
//   FilterState Start() const;
//   // Specifies current composition state.
//   void SetState(StateId s1, StateId s2, const FilterState &f);
//
//   // Apply filter at current composition state to these transitions.
//   // If an arc label to be matched is kNolabel, then that side
//   // does not consume a symbol. Returns the new filter state or,
//   // if disallowed, FilterState::NoState(). The filter is permitted to
//   // modify its inputs, e.g. for optimizations.
//   FilterState FilterArc(Arc *arc1, Arc *arc2) const;

//   // Apply filter at current composition state to these final weights
//   // (cf. superfinal transitions). The filter may modify its inputs,
//   // e.g. for optimizations.
//   void FilterFinal(Weight *final1, Weight *final2) const;
//
//   // Return resp matchers. Ownership stays with filter. These
//   // methods allow the filter to access and possibly modify
//   // the composition matchers (useful e.g. with lookahead).
//   Matcher1 *GetMatcher1();
//   Matcher2 *GetMatcher2();
//
//   // This specifies how the filter affects the composition result
//   // properties. It takes as argument the properties that would
//   // apply with a trivial composition fitler.
//   uint64 Properties(uint64 props) const;
// };

// This filter allows only exact matching of symbols from FST1 with on
// FST2; e.g. no special interpretation of epsilons.  (Template arg
// default declared in fst-decl.h.)
template <class M1, class M2 /* = M1 */>
class NullComposeFilter {
 public:
  typedef typename M1::FST FST1;
  typedef typename M2::FST FST2;
  typedef typename FST1::Arc Arc;
  typedef CharFilterState FilterState;
  typedef M1 Matcher1;
  typedef M2 Matcher2;

  typedef typename Arc::StateId StateId;
  typedef typename Arc::Label Label;
  typedef typename Arc::Weight Weight;

  NullComposeFilter(const FST1 &fst1, const FST2 &fst2,
                         M1 *matcher1 = 0, M2 *matcher2 = 0)
      : matcher1_(matcher1 ? matcher1 : new M1(fst1, MATCH_OUTPUT)),
        matcher2_(matcher2 ? matcher2 : new M2(fst2, MATCH_INPUT)),
        fst1_(matcher1_->GetFst()),
        fst2_(matcher2_->GetFst()) {}

  NullComposeFilter(const NullComposeFilter<M1, M2> &filter,
                         bool safe = false)
      : matcher1_(filter.matcher1_->Copy(safe)),
        matcher2_(filter.matcher2_->Copy(safe)),
        fst1_(matcher1_->GetFst()),
        fst2_(matcher2_->GetFst()) {}

  ~NullComposeFilter() {
    delete matcher1_;
    delete matcher2_;
  }

  FilterState Start() const { return FilterState(0); }

  void SetState(StateId, StateId, const FilterState &) { }

  FilterState FilterArc(Arc *arc1, Arc *arc2) const {
    return (arc1->olabel == kNoLabel || arc2->ilabel == kNoLabel) ?
        FilterState::NoState() : FilterState(0);
  }

  void FilterFinal(Weight *, Weight *) const {}

  // Return resp matchers. Ownership stays with filter.
  Matcher1 *GetMatcher1() { return matcher1_; }
  Matcher2 *GetMatcher2() { return matcher2_; }

  uint64 Properties(uint64 props) const { return props; }

 private:
  Matcher1 *matcher1_;
  Matcher2 *matcher2_;
  const FST1 &fst1_;
  const FST2 &fst2_;

  void operator=(const NullComposeFilter<M1, M2> &);  // disallow
};

// This filter requires epsilons on FST1 to be read before epsilons on FST2.
// (Template arg default declared in fst-decl.h.)
template <class M1, class M2 /* = M1 */>
class SequenceComposeFilter {
 public:
  typedef typename M1::FST FST1;
  typedef typename M2::FST FST2;
  typedef typename FST1::Arc Arc;
  typedef CharFilterState FilterState;
  typedef M1 Matcher1;
  typedef M2 Matcher2;

  typedef typename Arc::StateId StateId;
  typedef typename Arc::Label Label;
  typedef typename Arc::Weight Weight;

  SequenceComposeFilter(const FST1 &fst1, const FST2 &fst2,
                        M1 *matcher1 = 0, M2 *matcher2 = 0)
      : matcher1_(matcher1 ? matcher1 : new M1(fst1, MATCH_OUTPUT)),
        matcher2_(matcher2 ? matcher2 : new M2(fst2, MATCH_INPUT)),
        fst1_(matcher1_->GetFst()),
        s1_(kNoStateId),
        s2_(kNoStateId),
        f_(kNoStateId) {}

  SequenceComposeFilter(const SequenceComposeFilter<M1, M2> &filter,
                        bool safe = false)
      : matcher1_(filter.matcher1_->Copy(safe)),
        matcher2_(filter.matcher2_->Copy(safe)),
        fst1_(matcher1_->GetFst()),
        s1_(kNoStateId),
        s2_(kNoStateId),
        f_(kNoStateId) {}

  ~SequenceComposeFilter() {
    delete matcher1_;
    delete matcher2_;
  }

  FilterState Start() const { return FilterState(0); }

  void SetState(StateId s1, StateId s2, const FilterState &f) {
    if (s1_ == s1 && s2_ == s2 && f == f_)
      return;
    s1_ = s1;
    s2_ = s2;
    f_ = f;
    size_t na1 = internal::NumArcs(fst1_, s1);
    size_t ne1 = internal::NumOutputEpsilons(fst1_, s1);
    bool fin1 = internal::Final(fst1_, s1) != Weight::Zero();
    alleps1_ = na1 == ne1 && !fin1;
    noeps1_ = ne1 == 0;
  }

  FilterState FilterArc(Arc *arc1, Arc *arc2) const {
    if (arc1->olabel == kNoLabel)
      return alleps1_ ? FilterState::NoState() :
        noeps1_ ? FilterState(0) : FilterState(1);
    else if (arc2->ilabel == kNoLabel)
      return f_ != FilterState(0) ? FilterState::NoState() : FilterState(0);
    else
      return arc1->olabel == 0 ? FilterState::NoState() : FilterState(0);
  }

  void FilterFinal(Weight *, Weight *) const {}

  // Return resp matchers. Ownership stays with filter.
  Matcher1 *GetMatcher1() { return matcher1_; }
  Matcher2 *GetMatcher2() { return matcher2_; }

  uint64 Properties(uint64 props) const { return props; }

 private:
  Matcher1 *matcher1_;
  Matcher2 *matcher2_;
  const FST1 &fst1_;
  StateId s1_;     // Current fst1_ state;
  StateId s2_;     // Current fst2_ state;
  FilterState f_;  // Current filter state
  bool alleps1_;   // Only epsilons (and non-final) leaving s1_?
  bool noeps1_;    // No epsilons leaving s1_?

  void operator=(const SequenceComposeFilter<M1, M2> &);  // disallow
};

// This filter requires epsilons on FST2 to be read before epsilons on FST1.
// (Template arg default declared in fst-decl.h.)
template <class M1, class M2 /* = M1 */>
class AltSequenceComposeFilter {
 public:
  typedef typename M1::FST FST1;
  typedef typename M2::FST FST2;
  typedef typename FST1::Arc Arc;
  typedef CharFilterState FilterState;
  typedef M1 Matcher1;
  typedef M2 Matcher2;

  typedef typename Arc::StateId StateId;
  typedef typename Arc::Label Label;
  typedef typename Arc::Weight Weight;

  AltSequenceComposeFilter(const FST1 &fst1, const FST2 &fst2,
                        M1 *matcher1 = 0, M2 *matcher2 = 0)
      : matcher1_(matcher1 ? matcher1 : new M1(fst1, MATCH_OUTPUT)),
        matcher2_(matcher2 ? matcher2 : new M2(fst2, MATCH_INPUT)),
        fst2_(matcher2_->GetFst()),
        s1_(kNoStateId),
        s2_(kNoStateId),
        f_(kNoStateId) {}

  AltSequenceComposeFilter(const AltSequenceComposeFilter<M1, M2> &filter,
                           bool safe = false)
      : matcher1_(filter.matcher1_->Copy(safe)),
        matcher2_(filter.matcher2_->Copy(safe)),
        fst2_(matcher2_->GetFst()),
        s1_(kNoStateId),
        s2_(kNoStateId),
        f_(kNoStateId) {}

  ~AltSequenceComposeFilter() {
    delete matcher1_;
    delete matcher2_;
  }

  FilterState Start() const { return FilterState(0); }

  void SetState(StateId s1, StateId s2, const FilterState &f) {
    if (s1_ == s1 && s2_ == s2 && f == f_)
      return;
    s1_ = s1;
    s2_ = s2;
    f_ = f;
    size_t na2 = internal::NumArcs(fst2_, s2);
    size_t ne2 = internal::NumInputEpsilons(fst2_, s2);
    bool fin2 = internal::Final(fst2_, s2) != Weight::Zero();
    alleps2_ = na2 == ne2 && !fin2;
    noeps2_ = ne2 == 0;
  }

  FilterState FilterArc(Arc *arc1, Arc *arc2) const {
    if (arc2->ilabel == kNoLabel)
      return alleps2_ ? FilterState::NoState() :
        noeps2_ ? FilterState(0) : FilterState(1);
    else if (arc1->olabel == kNoLabel)
      return f_ == FilterState(1) ? FilterState::NoState() : FilterState(0);
    else
      return arc1->olabel == 0 ? FilterState::NoState() : FilterState(0);
  }

  void FilterFinal(Weight *, Weight *) const {}

  // Return resp matchers. Ownership stays with filter.
  Matcher1 *GetMatcher1() { return matcher1_; }
  Matcher2 *GetMatcher2() { return matcher2_; }

  uint64 Properties(uint64 props) const { return props; }

 private:
  Matcher1 *matcher1_;
  Matcher2 *matcher2_;
  const FST2 &fst2_;
  StateId s1_;     // Current fst1_ state;
  StateId s2_;     // Current fst2_ state;
  FilterState f_;  // Current filter state
  bool alleps2_;   // Only epsilons (and non-final) leaving s2_?
  bool noeps2_;    // No epsilons leaving s2_?

void operator=(const AltSequenceComposeFilter<M1, M2> &);  // disallow
};

// This filter requires epsilons on FST1 to be matched with epsilons on FST2
// whenever possible. (Template arg default declared in fst-decl.h.)
template <class M1, class M2 /* = M1 */>
class MatchComposeFilter {
 public:
  typedef typename M1::FST FST1;
  typedef typename M2::FST FST2;
  typedef typename FST1::Arc Arc;
  typedef CharFilterState FilterState;
  typedef M1 Matcher1;
  typedef M2 Matcher2;

  typedef typename Arc::StateId StateId;
  typedef typename Arc::Label Label;
  typedef typename Arc::Weight Weight;

  MatchComposeFilter(const FST1 &fst1, const FST2 &fst2,
                     M1 *matcher1 = 0, M2 *matcher2 = 0)
      : matcher1_(matcher1 ? matcher1 : new M1(fst1, MATCH_OUTPUT)),
        matcher2_(matcher2 ? matcher2 : new M2(fst2, MATCH_INPUT)),
        fst1_(matcher1_->GetFst()),
        fst2_(matcher2_->GetFst()),
        s1_(kNoStateId),
        s2_(kNoStateId),
        f_(kNoStateId) {}

  MatchComposeFilter(const MatchComposeFilter<M1, M2> &filter,
                     bool safe = false)
      : matcher1_(filter.matcher1_->Copy(safe)),
        matcher2_(filter.matcher2_->Copy(safe)),
        fst1_(matcher1_->GetFst()),
        fst2_(matcher2_->GetFst()),
        s1_(kNoStateId),
        s2_(kNoStateId),
        f_(kNoStateId) {}

  ~MatchComposeFilter() {
    delete matcher1_;
    delete matcher2_;
  }

  FilterState Start() const { return FilterState(0); }

  void SetState(StateId s1, StateId s2, const FilterState &f) {
    if (s1_ == s1 && s2_ == s2 && f == f_)
      return;
    s1_ = s1;
    s2_ = s2;
    f_ = f;
    size_t na1 = internal::NumArcs(fst1_, s1);
    size_t ne1 = internal::NumOutputEpsilons(fst1_, s1);
    bool f1 = internal::Final(fst1_, s1) != Weight::Zero();
    alleps1_ = na1 == ne1 && !f1;
    noeps1_ = ne1 == 0;
    size_t na2 = internal::NumArcs(fst2_, s2);
    size_t ne2 = internal::NumInputEpsilons(fst2_, s2);
    bool f2 = internal::Final(fst2_, s2) != Weight::Zero();
    alleps2_ = na2 == ne2 && !f2;
    noeps2_ = ne2 == 0;
  }

  FilterState FilterArc(Arc *arc1, Arc *arc2) const {
    if (arc2->ilabel == kNoLabel)  // Epsilon on Fst1
      return f_ == FilterState(0) ?
          (noeps2_ ? FilterState(0) :
           (alleps2_ ? FilterState::NoState(): FilterState(1))) :
          (f_ == FilterState(1) ? FilterState(1) : FilterState::NoState());
    else if (arc1->olabel == kNoLabel)  // Epsilon on Fst2
      return f_ == FilterState(0) ?
          (noeps1_ ? FilterState(0) :
           (alleps1_ ? FilterState::NoState() : FilterState(2))) :
          (f_ == FilterState(2) ? FilterState(2) : FilterState::NoState());
    else if (arc1->olabel == 0)  // Epsilon on both
      return f_ == FilterState(0) ? FilterState(0) : FilterState::NoState();
    else  // Both are non-epsilons
      return FilterState(0);
  }

  void FilterFinal(Weight *, Weight *) const {}

  // Return resp matchers. Ownership stays with filter.
  Matcher1 *GetMatcher1() { return matcher1_; }
  Matcher2 *GetMatcher2() { return matcher2_; }

  uint64 Properties(uint64 props) const { return props; }

 private:
  Matcher1 *matcher1_;
  Matcher2 *matcher2_;
  const FST1 &fst1_;
  const FST2 &fst2_;
  StateId s1_;              // Current fst1_ state;
  StateId s2_;              // Current fst2_ state;
  FilterState f_;           // Current filter state ID
  bool alleps1_, alleps2_;  // Only epsilons (and non-final) leaving s1, s2?
  bool noeps1_, noeps2_;    // No epsilons leaving s1, s2?

  void operator=(const MatchComposeFilter<M1, M2> &);  // disallow
};

// This filter works with the MultiEpsMatcher to determine if
// 'multi-epsilons' are preserved in the composition output
// (rather than rewritten as 0) and ensures correct properties.
template <class F>
class MultiEpsFilter {
 public:
  typedef typename F::FST1 FST1;
  typedef typename F::FST2 FST2;
  typedef typename F::Arc Arc;
  typedef typename F::Matcher1 Matcher1;
  typedef typename F::Matcher2 Matcher2;
  typedef typename F::FilterState FilterState;
  typedef MultiEpsFilter<F> Filter;

  typedef typename Arc::StateId StateId;
  typedef typename Arc::Label Label;
  typedef typename Arc::Weight Weight;

  MultiEpsFilter(const FST1 &fst1, const FST2 &fst2,
                 Matcher1 *matcher1 = 0,  Matcher2 *matcher2 = 0,
                 bool keep_multi_eps = false)
      : filter_(fst1, fst2, matcher1, matcher2),
        keep_multi_eps_(keep_multi_eps) {}

  MultiEpsFilter(const Filter &filter, bool safe = false)
      : filter_(filter.filter_, safe),
        keep_multi_eps_(filter.keep_multi_eps_) {}

  FilterState Start() const { return filter_.Start(); }

  void SetState(StateId s1, StateId s2, const FilterState &f) {
    return filter_.SetState(s1, s2, f);
  }

  FilterState FilterArc(Arc *arc1, Arc *arc2) const {
    FilterState f = filter_.FilterArc(arc1, arc2);
    if (keep_multi_eps_) {
      if (arc1->olabel == kNoLabel)
        arc1->ilabel = arc2->ilabel;
      if (arc2->ilabel == kNoLabel)
        arc2->olabel = arc1->olabel;
    }
    return f;
  }

  void FilterFinal(Weight *w1, Weight *w2) const {
    return filter_.FilterFinal(w1, w2);
  }

  // Return resp matchers. Ownership stays with filter.
  Matcher1 *GetMatcher1() { return filter_.GetMatcher1(); }
  Matcher2 *GetMatcher2() { return filter_.GetMatcher2(); }

  uint64 Properties(uint64 iprops) const {
    uint64 oprops = filter_.Properties(iprops);
    return oprops & kILabelInvariantProperties & kOLabelInvariantProperties;
  }

 private:
  F filter_;
  bool keep_multi_eps_;
};

}  // namespace fst

#endif  // FST_LIB_COMPOSE_FILTER_H__


text:
.. _nucaptiveportalprofile:

nucaptiveportalprofile
===========================================

.. class:: nucaptiveportalprofile.NUCaptivePortalProfile(bambou.nurest_object.NUMetaRESTObject,):

Object representing a Wireless Access Captive Portal Profile which can be associated with SSID entities from which end users may be presented with instructions and condition of use when connecting to an open wireless access point.

Attributes
----------

- ``name`` (**Mandatory**): Name of the captive portal profile.

- ``captive_page`` (**Mandatory**): Attribute having the contents of captive portal page displayed to end user. User can possibly include very basic HTML tags like <p>, <ul> etc. in order to fomat the text displayed to the user.

- ``last_updated_by``: ID of the user who last updated the object.

- ``description``: Description for the captive portal profile.

- ``entity_scope``: Specify if scope of entity is Data center or Enterprise level

- ``portal_type`` (**Mandatory**): Type of the portal page.  Will decide if the NSG rendering the page will have a strict rendering of the welcoming page based on what is given by VSD, or if the information can be made customisable by an operator to include animations, videos, images, and other types of more complex scripts.

- ``external_id``: External object ID. Used for integration with third party systems

Parents
--------

- :ref:`nuenterprise.NUEnterprise<nuenterprise>`


text:
layout: post
---
One of the limitations of C# type inference is that you cannot use it to infer the type of a lambda expression.  For example, the following code will not compile

``` csharp
var f = () => 4;
```

Normally this is not too much of an issue because you can just explicitly declare the type of the lambda expression.

``` csharp
Func<int> f = () => 4;
```

However, this can be annoying at times.  Once you start defining complex lambda expressions the Func/Action declaration can be quite convoluted.  Even worse, if your lambda returns an anonymous type, there is no way to declare a Func<> with the anonymous type parameter because you cannot describe it's shape.

``` csharp
Func<'> f = () => new { Name = "foo" };
```

This is fixable though by using type inference.  The method is very similar to [other anonymous type type tricks]({% post_url 2007-10-01-casting-to-an-anonymous-type %}).  While lambda type inference is not supported for variable declaration it is supported for parameters.  C# supports return type inference so that can be used to type the variable.

``` csharp
static Func<T> Lambda<T>(Func<T> del)
{
    return del;
}

static void Main(string[] args)
{
    var f = Lambda(() => new { Name = "foo" });
}
```


text:
package com.amazonaws.services.elasticbeanstalk.model.transform;

import java.util.ArrayList;

import javax.xml.stream.events.XMLEvent;
import javax.annotation.Generated;

import com.amazonaws.services.elasticbeanstalk.model.*;
import com.amazonaws.transform.Unmarshaller;

import com.amazonaws.transform.StaxUnmarshallerContext;
import com.amazonaws.transform.SimpleTypeStaxUnmarshallers.*;

/**
 * DescribeConfigurationSettingsResult StAX Unmarshaller
 */

@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DescribeConfigurationSettingsResultStaxUnmarshaller implements Unmarshaller<DescribeConfigurationSettingsResult, StaxUnmarshallerContext> {

    public DescribeConfigurationSettingsResult unmarshall(StaxUnmarshallerContext context) throws Exception {
        DescribeConfigurationSettingsResult describeConfigurationSettingsResult = new DescribeConfigurationSettingsResult();
        int originalDepth = context.getCurrentDepth();
        int targetDepth = originalDepth + 1;

        if (context.isStartOfDocument())
            targetDepth += 2;

        while (true) {
            XMLEvent xmlEvent = context.nextEvent();
            if (xmlEvent.isEndDocument())
                return describeConfigurationSettingsResult;

            if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {

                if (context.testExpression("ConfigurationSettings", targetDepth)) {
                    describeConfigurationSettingsResult.withConfigurationSettings(new ArrayList<ConfigurationSettingsDescription>());
                    continue;
                }

                if (context.testExpression("ConfigurationSettings/member", targetDepth)) {
                    describeConfigurationSettingsResult.withConfigurationSettings(ConfigurationSettingsDescriptionStaxUnmarshaller.getInstance().unmarshall(
                            context));
                    continue;
                }

            } else if (xmlEvent.isEndElement()) {
                if (context.getCurrentDepth() < originalDepth) {
                    return describeConfigurationSettingsResult;
                }
            }
        }
    }

    private static DescribeConfigurationSettingsResultStaxUnmarshaller instance;

    public static DescribeConfigurationSettingsResultStaxUnmarshaller getInstance() {
        if (instance == null)
            instance = new DescribeConfigurationSettingsResultStaxUnmarshaller();
        return instance;
    }
}


text:
class Myclass
{

	bool isRightPressed = false;

	bool keyEnterReceiver::eventFilter(QObject* obj, QEvent* event)
	{
		if (event->type()==QEvent::KeyPress) {
			QKeyEvent* key = static_cast<QKeyEvent*>(event);
			if ( (key->key()==Qt::Key_Enter) || (key->key()==Qt::Key_Return) ) {
				//Enter or return was pressed
			} else {
				return QObject::eventFilter(obj, event);
			}
			return true;
		} else {
			return QObject::eventFilter(obj, event);
		}
		return false;
	}

};


text:
using namespace testing;
using namespace algorithms;

TEST(MinPriorityQueueTests, TestEmpty) {
  MinPriorityQueue<int> min_pq;
  ASSERT_TRUE(min_pq.IsEmpty()) << "Minimum Priority Queue initially not empty";
  min_pq.Insert(10);
  ASSERT_FALSE(min_pq.IsEmpty()) << "Minimum Priority Queue is empty after inserting an element";
}

TEST(MinPriorityQueueTests, TestGetMinimumElement) {
  MinPriorityQueue<int> min_pq;
  min_pq.Insert(50);
  ASSERT_EQ(min_pq.GetMin(), 50) << "Minimum element incorrect";

  min_pq.Insert(100);
  min_pq.Insert(30);
  min_pq.Insert(500);
  min_pq.Insert(50);
  min_pq.Insert(350);

  ASSERT_EQ(min_pq.GetMin(), 30) << "Minimum element incorrect";

  min_pq.Insert(10);

  ASSERT_EQ(min_pq.GetMin(), 10) << "Minimum element incorrect";
}

TEST(MinPriorityQueueTests, TestDeleteElement) {
  MinPriorityQueue<int> min_pq;
  min_pq.Insert(50);
  ASSERT_EQ(min_pq.GetMin(), 50) << "Minimum element incorrect";

  min_pq.Insert(100);
  min_pq.Insert(30);
  min_pq.Insert(500);
  min_pq.Insert(50);
  min_pq.Insert(350);

  min_pq.DeleteMin();
  ASSERT_EQ(min_pq.GetMin(), 50) << "Minimum element incorrect";
}

TEST(MinPriorityQueueTests, TestConstructionWithElements) {
  std::vector<int> elements{400, 300, 800, 150, 600, 200, 1000};

  MinPriorityQueue<int> min_pq(elements);

  ASSERT_FALSE(min_pq.IsEmpty()) << "Minimum Priority Queue is empty after constructing with vector of elements";

  ASSERT_EQ(min_pq.GetMin(), 150) << "Minimum element incorrect";
}

TEST(MinPriorityQueueTests, TestWithCustomClassAndComparator) {
  class Person {
    public:
      Person() {}

      Person(const std::string& name, int age) :
        name_{name},
        age_{age}
      {}

      Person(const Person& other) {
        name_ = other.name_;
        age_ = other.age_;
      }

      std::string name_;
      int age_;
  };

  std::vector<Person> elements{{"Dave", 21}, {"Robert", 25}, {"Christina", 10}, {"Timothy", 32}};

  auto comparator = [](const Person& left, const Person& right) -> bool {
    return left.age_ <= right.age_;
  };

  MinPriorityQueue<Person> min_pq(elements, comparator);

  ASSERT_FALSE(min_pq.IsEmpty()) << "Minimum Priority Queue is empty after constructing with vector of elements";

  ASSERT_EQ(min_pq.GetMin().age_, 10) << "Minimum element incorrect";
}

TEST(MinPriorityQueueTests, TestWithRandomGeneratedElements) {
  srand(static_cast<unsigned int>(time(NULL)));
  size_t size = (rand() % 5000) + 1;
  std::vector<int> elements(size);
  for (size_t index = 0; index < size; ++index) {
    elements[index] = (rand() % 5000) + 1;
  }

  std::vector<int> elements_sorted{elements};
  std::sort(elements_sorted.begin(), elements_sorted.end());

  MinPriorityQueue<int> min_pq(elements);
  size_t index = 0;

  while(!min_pq.IsEmpty() && index < elements_sorted.size()){
    ASSERT_EQ(min_pq.GetMin(), elements_sorted[index++]) << "Minimum element incorrect";
    min_pq.DeleteMin();
  }

  ASSERT_EQ(index, elements_sorted.size());
}