text:
package cz.metacentrum.perun.core.implApi.modules.attributes;

import cz.metacentrum.perun.core.api.Attribute;
import cz.metacentrum.perun.core.api.AttributeDefinition;
import cz.metacentrum.perun.core.api.Group;
import cz.metacentrum.perun.core.api.Member;
import cz.metacentrum.perun.core.api.exceptions.AttributeNotExistsException;
import cz.metacentrum.perun.core.api.exceptions.InternalErrorException;
import cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException;
import cz.metacentrum.perun.core.api.exceptions.WrongAttributeValueException;
import cz.metacentrum.perun.core.api.exceptions.WrongReferenceAttributeValueException;
import cz.metacentrum.perun.core.impl.PerunSessionImpl;

import java.util.ArrayList;
import java.util.List;

/**
 * Abstract class for Member Group Virtual Attributes modules.
 * Implements methods for modules to perform default function.
 * In the function that the method in the module does nothing, it is not necessary to implement it, simply extend this abstract class.
 *
 * author: Oliver Mrazik
 * version: 2015-04-16
 */
public abstract class MemberGroupVirtualAttributesModuleAbstract extends MemberGroupAttributesModuleAbstract implements MemberGroupVirtualAttributesModuleImplApi {

	@Override
	public Attribute getAttributeValue(PerunSessionImpl sess, Member member, Group group, AttributeDefinition attribute) throws InternalErrorException {
		return new Attribute(attribute);
	}

	@Override
	public boolean setAttributeValue(PerunSessionImpl sess, Member member, Group group, Attribute attribute) throws InternalErrorException, WrongReferenceAttributeValueException {
		return false;
	}

	@Override
	public boolean removeAttributeValue(PerunSessionImpl sess, Member member, Group group, AttributeDefinition attribute) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException {
		return false;
	}

	@Override
	public List<String> resolveVirtualAttributeValueChange(PerunSessionImpl perunSession, String message) throws InternalErrorException, WrongReferenceAttributeValueException, AttributeNotExistsException, WrongAttributeAssignmentException {
		return new ArrayList<>();
	}

	@Override
	public List<String> getStrongDependencies() {
		List<String> dependecies = new ArrayList<>();
		return dependecies;
	}
}


text:
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) > [puppeteer](./puppeteer.md) > [Protocol](./puppeteer.protocol.md) > [Overlay](./puppeteer.protocol.overlay.md) > [SetShowPaintRectsRequest](./puppeteer.protocol.overlay.setshowpaintrectsrequest.md) > [result](./puppeteer.protocol.overlay.setshowpaintrectsrequest.result.md)

## Protocol.Overlay.SetShowPaintRectsRequest.result property

True for showing paint rectangles

<b>Signature:</b>

```typescript
result: boolean;
```

redpajama_set_name: RedPajamaGithub


text:
layout: post
title: Purity
---
Acabo de terminar de leer el útlimo libro de Jonathan Franzen, Purity y decir que al igual que Las correcciones y Libertad los dos trabajos anteriores que le había leído, este también me ha encantado.


text:
<?php
namespace Produit\Controller;

use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
use Produit\Model\Produit;
use Produit\Form\ProduitForm;
use Zend\Session\Container;

class ProduitController extends AbstractActionController
{
	protected $produitTable;
	protected $fournitureTable;

	public function init()
    {
    	$session = new Container('user');
    	if(isset($_SESSION['user']))
    	{
    		if(isset($_SESSION['user']['username']) && $_SESSION['user']['status'] == 'blocked')
    		{
    			return $this->redirect()->toRoute('blocked');
    		}
    	}
    	return (null);
    }

	public function getProduitTable()
	{
		if(!$this->produitTable)
		{
			$sm = $this->getServiceLocator();
			$this->produitTable = $sm->get('Produit\Model\ProduitTable');
		}
		return $this->produitTable;
	}

	public function getFournitureTable()
	{
		if(!$this->fournitureTable)
		{
			$sm = $this->getServiceLocator();
			$this->fournitureTable = $sm->get('Fourniture\Model\FournitureTable');
		}
		return $this->fournitureTable;
	}

	public function indexAction()
	{
    	$ret = null;
    	if (($ret = $this->init()) != null)
    		return ($ret);

		if(isset($_SESSION['user']))
		{
			if(isset($_SESSION['user']['role']) && $_SESSION['user']['role'] == '3')
			{
				return new ViewModel(array(
					'produits' => $this->getProduitTable()->fetchAll(),
				));
			}
			else
			{
				return $this->redirect()->toRoute('forbidden');
			}
		}
		else
		{
			return $this->redirect()->toRoute('forbidden');
		}
	}

	public function addAction()
	{
    	$ret = null;
    	if (($ret = $this->init()) != null)
    		return ($ret);

    	$session = new Container('user');
    	if(isset($_SESSION['user']) && $_SESSION['user']['role'] != '3')
    	{
    		return $this->redirect()->toRoute('forbidden');
    	}

		$form = new ProduitForm();
		$form->get('submit')->setValue('Add');

		$request = $this->getRequest();
		if($request->isPost())
		{
			$produit = new Produit();
			$form->setInputFilter($produit->getInputFilter());
			$form->setData($request->getPost());
			if($form->isValid())
			{
				$produit->exchangeArray($form->getData());
				$this->getProduitTable()->saveProduit($produit);

				return $this->redirect()->toRoute('produit');
			}
		}
		return array('form' => $form);
	}

	public function addlinkAction()
	{
		$fournitures = $this->getFournitureTable()->fetchAll();

		return new ViewModel(array('fournitures' => $fournitures));
	}

	public function editAction()
	{
    	$ret = null;
    	if (($ret = $this->init()) != null)
    		return ($ret);

    	$session = new Container('user');
    	if(isset($_SESSION['user']) && $_SESSION['user']['role'] != '3')
    	{
    		return $this->redirect()->toRoute('forbidden');
    	}

		$id = (int) $this->params()->fromRoute('id', '0');
		if(!$id)
		{
			return $this->redirect()->toRoute('produit', array(
				'action' => 'add'
				));
		}

		try{
			$produit = $this->getProduitTable()->getProduit($id);
		}
		catch (\Exception $ex) {
			return $this->redirect()->toRoute('produit', array(
				'action' => 'index'
				));
		}

		$form = new ProduitForm();
		$form->bind($produit);
		$form->get('submit')->setAttribute('value', 'Edit');

		$request = $this->getRequest();
		if($request->isPost())
		{
			$form->setInputFilter($produit->getInputFilter());
			$form->setData($request->getPost());

			if($form->isValid())
			{
				$this->getProduitTable()->saveProduit($produit);

				return $this->redirect()->toRoute('produit');
			}
		}

		return array(
			'id' => $id,
			'form' => $form,
			);
	}

	public function deleteAction()
	{
    	$ret = null;
    	if (($ret = $this->init()) != null)
    		return ($ret);

    	$session = new Container('user');
    	if(isset($_SESSION['user']) && $_SESSION['user']['role'] != '3')
    	{
    		return $this->redirect()->toRoute('forbidden');
    	}

		$id = (int) $this->params()->fromRoute('id', '0');
		if(!$id)
		{
			return $this->redirect()->toRoute('produit');
		}

		$request = $this->getRequest();
		if($request->isPost())
		{
			$del = $request->getPost('del', 'No');

			if($del == 'Yes')
			{
				$id = (int) $request->getPost('id');
				$this->getProduitTable()->deleteProduit($id);
			}

			return $this->redirect()->toRoute('produit');
		}

		return array(
			'id' => $id,
			'produit' => $this->getProduitTable()->getProduit($id),
			);
	}

	public function panierAction()
	{
		$session = new Container('user');

		$id = (int) $this->params()->fromRoute('id', '0');
		if(!$id)
		{
			return $this->redirect()->toRoute('restaurant');
		}
		if(!isset($_SESSION['user']['panier']))
		{
			$_SESSION['user']['panier'] = array();
		}
		$produit = $this->getProduitTable()->getProduit($id);
		$panier = $_SESSION['user']['panier'];
		array_push($panier, $produit);
		$session->offsetSet('panier', $panier);

		return $this->redirect()->toRoute('restaurant', array('action' => 'carte', 'id' => $produit->id_restaurant));
	}

	public function viewpanierAction()
	{
		$session = new Container('user');
		if(!isset($_SESSION['user']['tmp']))
		{
			$session->offsetSet('tmp', $_SESSION['user']['panier']);
		}

		$id_resto = $_SESSION['user']['last_resto'];
		$tmp = $_SESSION['user']['tmp'];
		if($session->offsetExists('panier'))
		{
			foreach($_SESSION['user']['panier'] as $k => $v)
			{
				if($v->id_restaurant != $id_resto)
				{
					unset($_SESSION['user']['panier'][$k]);
				}
			}
			$produits = $_SESSION['user']['panier'];

			$total = 0;
			foreach ($produits as $key => $value) {
				$total += $value->prix;
			}

			return new ViewModel(array(
				'produits' => $produits,
				'total' => $total,
				'tmp' => $tmp,
				'id_resto' => $id_resto,
			));
		}
		else
		{
			$error = "Veuillez nous excuser mais il n'y a rien dans votre panier ! :)";
			return new ViewModel(array(
				'error' => $error,
				'tmp' => $tmp,
				'id_resto' => $id_resto,
			));
		}
	}

	public function removeItemAction()
	{
		$session = new Container('user');
		$id = (int) $this->params()->fromRoute('id');

		$tmp = $_SESSION['user']['tmp'];
		$panier = $_SESSION['user']['panier'];
		unset($panier[$id]);
		unset($tmp[$id]);

		$_SESSION['user']['panier'] = $panier;
		$_SESSION['user']['tmp'] = $tmp;
		return $this->redirect()->toRoute('produit', array('action' => 'viewpanier'));
	}

	public function cleanPanierAction()
	{
		$session = new Container('user');

		$_SESSION['user']['panier'] = NULL;
		$_SESSION['user']['tmp'] = NULL;
		$this->redirect()->toRoute('produit', array('action' => 'viewpanier'));
	}
}


text:
package gomock

import (
	"sync"

	"github.com/qur/gomock/interfaces"
)

// A TestReporter is something that can be used to report test failures.
// It is satisfied by the standard library's *testing.T.
type TestReporter interface {
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
}

// A Controller represents the top-level control of a mock ecosystem.
// It defines the scope and lifetime of mock objects, as well as their expectations.
// It is safe to call Controller's methods from multiple goroutines.
type Controller struct {
	mu            sync.Mutex
	t             TestReporter
	expectedCalls callSet
}

// Make sure Controller implements interfaces.MockController
var _ interfaces.MockController = &Controller{}

func NewController(t TestReporter) *Controller {
	return &Controller{
		t:             t,
		expectedCalls: make(callSet),
	}
}

func (ctrl *Controller) RecordCall(receiver interface{}, method string, args ...interface{}) interfaces.Call {
	// TODO: check arity, types.
	margs := make([]Matcher, len(args))
	for i, arg := range args {
		if m, ok := arg.(Matcher); ok {
			margs[i] = m
		} else {
			margs[i] = Eq(arg)
		}
	}

	ctrl.mu.Lock()
	defer ctrl.mu.Unlock()

	call := &Call{t: ctrl.t, receiver: receiver, method: method, args: margs, minCalls: 1, maxCalls: 1}

	ctrl.expectedCalls.Add(call)
	return call
}

func (ctrl *Controller) Call(receiver interface{}, method string, args ...interface{}) []interface{} {
	ctrl.mu.Lock()
	defer ctrl.mu.Unlock()

	expected := ctrl.expectedCalls.FindMatch(receiver, method, args)
	if expected == nil {
		ctrl.t.Fatalf("no matching expected call: %T.%v(%v)", receiver, method, args)
	}

	// Two things happen here:
	// * the matching call no longer needs to check prerequite calls,
	// * and the prerequite calls are no longer expected, so remove them.
	preReqCalls := expected.dropPrereqs()
	for _, preReqCall := range preReqCalls {
		ctrl.expectedCalls.Remove(preReqCall)
	}

	rets, action := expected.call(args)
	if expected.exhausted() {
		ctrl.expectedCalls.Remove(expected)
	}

	// Don't hold the lock while doing the call's action (if any)
	// so that actions may execute concurrently.
	// We use the deferred Unlock to capture any panics that happen above;
	// here we add a deferred Lock to balance it.
	ctrl.mu.Unlock()
	defer ctrl.mu.Lock()
	if action != nil {
		action()
	}

	return rets
}

func (ctrl *Controller) Finish() {
	ctrl.mu.Lock()
	defer ctrl.mu.Unlock()

	// If we're currently panicking, probably because this is a deferred call,
	// pass through the panic.
	if err := recover(); err != nil {
		panic(err)
	}

	// Check that all remaining expected calls are satisfied.
	failures := false
	for _, methodMap := range ctrl.expectedCalls {
		for _, calls := range methodMap {
			for _, call := range calls {
				if !call.satisfied() {
					ctrl.t.Errorf("missing call(s) to %v", call)
					failures = true
				}
			}
		}
	}
	if failures {
		ctrl.t.Fatalf("aborting test due to missing call(s)")
	}
}


text:
BSLS_IDENT_RCSID(s_baltst_mysequencewithchoices_h, "$Id$ $CSID$")
BSLS_IDENT_PRAGMA_ONCE

//@PURPOSE: Provide value-semantic attribute classes

#include <bslalg_typetraits.h>

#include <bdlat_attributeinfo.h>

#include <bdlat_selectioninfo.h>

#include <bdlat_typetraits.h>

#include <bsls_objectbuffer.h>

#include <bsls_assert.h>

#include <bsl_iosfwd.h>
#include <bsl_limits.h>

namespace BloombergLP {

namespace s_baltst { class MySequenceWithChoicesChoice1; }
namespace s_baltst { class MySequenceWithChoicesChoice2; }
namespace s_baltst { class MySequenceWithChoices; }
namespace s_baltst {

                     // ==================================
                     // class MySequenceWithChoicesChoice1
                     // ==================================

class MySequenceWithChoicesChoice1 {

    // INSTANCE DATA
    union {
        bsls::ObjectBuffer< int > d_choiceA;
        bsls::ObjectBuffer< int > d_choiceB;
    };

    int                           d_selectionId;

  public:
    // TYPES

    enum {
        SELECTION_ID_UNDEFINED = -1
      , SELECTION_ID_CHOICE_A = 0
      , SELECTION_ID_CHOICE_B = 1
    };

    enum {
        NUM_SELECTIONS = 2
    };

    enum {
        SELECTION_INDEX_CHOICE_A = 0
      , SELECTION_INDEX_CHOICE_B = 1
    };

    // CONSTANTS
    static const char CLASS_NAME[];

    static const bdlat_SelectionInfo SELECTION_INFO_ARRAY[];

    // CLASS METHODS
    static const bdlat_SelectionInfo *lookupSelectionInfo(int id);
        // Return selection information for the selection indicated by the
        // specified 'id' if the selection exists, and 0 otherwise.

    static const bdlat_SelectionInfo *lookupSelectionInfo(
                                                       const char *name,
                                                       int         nameLength);
        // Return selection information for the selection indicated by the
        // specified 'name' of the specified 'nameLength' if the selection
        // exists, and 0 otherwise.

    // CREATORS
    MySequenceWithChoicesChoice1();
        // Create an object of type 'MySequenceWithChoicesChoice1' having the
        // default value.

    MySequenceWithChoicesChoice1(const MySequenceWithChoicesChoice1& original);
        // Create an object of type 'MySequenceWithChoicesChoice1' having the
        // value of the specified 'original' object.

#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
    MySequenceWithChoicesChoice1(MySequenceWithChoicesChoice1&& original) noexcept;
        // Create an object of type 'MySequenceWithChoicesChoice1' having the
        // value of the specified 'original' object.  After performing this
        // action, the 'original' object will be left in a valid, but
        // unspecified state.
#endif

    ~MySequenceWithChoicesChoice1();
        // Destroy this object.

    // MANIPULATORS
    MySequenceWithChoicesChoice1& operator=(const MySequenceWithChoicesChoice1& rhs);
        // Assign to this object the value of the specified 'rhs' object.

#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
    MySequenceWithChoicesChoice1& operator=(MySequenceWithChoicesChoice1&& rhs);
        // Assign to this object the value of the specified 'rhs' object.
        // After performing this action, the 'rhs' object will be left in a
        // valid, but unspecified state.
#endif

    void reset();
        // Reset this object to the default value (i.e., its value upon default
        // construction).

    int makeSelection(int selectionId);
        // Set the value of this object to be the default for the selection
        // indicated by the specified 'selectionId'.  Return 0 on success, and
        // non-zero value otherwise (i.e., the selection is not found).

    int makeSelection(const char *name, int nameLength);
        // Set the value of this object to be the default for the selection
        // indicated by the specified 'name' of the specified 'nameLength'.
        // Return 0 on success, and non-zero value otherwise (i.e., the
        // selection is not found).

    int& makeChoiceA();
    int& makeChoiceA(int value);
        // Set the value of this object to be a "ChoiceA" value.  Optionally
        // specify the 'value' of the "ChoiceA".  If 'value' is not specified,
        // the default "ChoiceA" value is used.

    int& makeChoiceB();
    int& makeChoiceB(int value);
        // Set the value of this object to be a "ChoiceB" value.  Optionally
        // specify the 'value' of the "ChoiceB".  If 'value' is not specified,
        // the default "ChoiceB" value is used.

    template<class MANIPULATOR>
    int manipulateSelection(MANIPULATOR& manipulator);
        // Invoke the specified 'manipulator' on the address of the modifiable
        // selection, supplying 'manipulator' with the corresponding selection
        // information structure.  Return the value returned from the
        // invocation of 'manipulator' if this object has a defined selection,
        // and -1 otherwise.

    int& choiceA();
        // Return a reference to the modifiable "ChoiceA" selection of this
        // object if "ChoiceA" is the current selection.  The behavior is
        // undefined unless "ChoiceA" is the selection of this object.

    int& choiceB();
        // Return a reference to the modifiable "ChoiceB" selection of this
        // object if "ChoiceB" is the current selection.  The behavior is
        // undefined unless "ChoiceB" is the selection of this object.

    // ACCESSORS
    bsl::ostream& print(bsl::ostream& stream,
                        int           level = 0,
                        int           spacesPerLevel = 4) const;
        // Format this object to the specified output 'stream' at the
        // optionally specified indentation 'level' and return a reference to
        // the modifiable 'stream'.  If 'level' is specified, optionally
        // specify 'spacesPerLevel', the number of spaces per indentation level
        // for this and all of its nested objects.  Each line is indented by
        // the absolute value of 'level * spacesPerLevel'.  If 'level' is
        // negative, suppress indentation of the first line.  If
        // 'spacesPerLevel' is negative, suppress line breaks and format the
        // entire output on one line.  If 'stream' is initially invalid, this
        // operation has no effect.  Note that a trailing newline is provided
        // in multiline mode only.

    int selectionId() const;
        // Return the id of the current selection if the selection is defined,
        // and -1 otherwise.

    template<class ACCESSOR>
    int accessSelection(ACCESSOR& accessor) const;
        // Invoke the specified 'accessor' on the non-modifiable selection,
        // supplying 'accessor' with the corresponding selection information
        // structure.  Return the value returned from the invocation of
        // 'accessor' if this object has a defined selection, and -1 otherwise.

    const int& choiceA() const;
        // Return a reference to the non-modifiable "ChoiceA" selection of this
        // object if "ChoiceA" is the current selection.  The behavior is
        // undefined unless "ChoiceA" is the selection of this object.

    const int& choiceB() const;
        // Return a reference to the non-modifiable "ChoiceB" selection of this
        // object if "ChoiceB" is the current selection.  The behavior is
        // undefined unless "ChoiceB" is the selection of this object.

    bool isChoiceAValue() const;
        // Return 'true' if the value of this object is a "ChoiceA" value, and
        // return 'false' otherwise.

    bool isChoiceBValue() const;
        // Return 'true' if the value of this object is a "ChoiceB" value, and
        // return 'false' otherwise.

    bool isUndefinedValue() const;
        // Return 'true' if the value of this object is undefined, and 'false'
        // otherwise.

    const char *selectionName() const;
        // Return the symbolic name of the current selection of this object.
};

// FREE OPERATORS
inline
bool operator==(const MySequenceWithChoicesChoice1& lhs, const MySequenceWithChoicesChoice1& rhs);
    // Return 'true' if the specified 'lhs' and 'rhs' objects have the same
    // value, and 'false' otherwise.  Two 'MySequenceWithChoicesChoice1' objects have the same
    // value if either the selections in both objects have the same ids and
    // the same values, or both selections are undefined.

inline
bool operator!=(const MySequenceWithChoicesChoice1& lhs, const MySequenceWithChoicesChoice1& rhs);
    // Return 'true' if the specified 'lhs' and 'rhs' objects do not have the
    // same values, as determined by 'operator==', and 'false' otherwise.

inline
bsl::ostream& operator<<(bsl::ostream& stream, const MySequenceWithChoicesChoice1& rhs);
    // Format the specified 'rhs' to the specified output 'stream' and
    // return a reference to the modifiable 'stream'.

}  // close package namespace

// TRAITS

BDLAT_DECL_CHOICE_WITH_BITWISEMOVEABLE_TRAITS(s_baltst::MySequenceWithChoicesChoice1)

namespace s_baltst {

                     // ==================================
                     // class MySequenceWithChoicesChoice2
                     // ==================================

class MySequenceWithChoicesChoice2 {

    // INSTANCE DATA
    union {
        bsls::ObjectBuffer< int > d_choiceC;
        bsls::ObjectBuffer< int > d_choiceD;
    };

    int                           d_selectionId;

  public:
    // TYPES

    enum {
        SELECTION_ID_UNDEFINED = -1
      , SELECTION_ID_CHOICE_C = 0
      , SELECTION_ID_CHOICE_D = 1
    };

    enum {
        NUM_SELECTIONS = 2
    };

    enum {
        SELECTION_INDEX_CHOICE_C = 0
      , SELECTION_INDEX_CHOICE_D = 1
    };

    // CONSTANTS
    static const char CLASS_NAME[];

    static const bdlat_SelectionInfo SELECTION_INFO_ARRAY[];

    // CLASS METHODS
    static const bdlat_SelectionInfo *lookupSelectionInfo(int id);
        // Return selection information for the selection indicated by the
        // specified 'id' if the selection exists, and 0 otherwise.

    static const bdlat_SelectionInfo *lookupSelectionInfo(
                                                       const char *name,
                                                       int         nameLength);
        // Return selection information for the selection indicated by the
        // specified 'name' of the specified 'nameLength' if the selection
        // exists, and 0 otherwise.

    // CREATORS
    MySequenceWithChoicesChoice2();
        // Create an object of type 'MySequenceWithChoicesChoice2' having the
        // default value.

    MySequenceWithChoicesChoice2(const MySequenceWithChoicesChoice2& original);
        // Create an object of type 'MySequenceWithChoicesChoice2' having the
        // value of the specified 'original' object.

#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
    MySequenceWithChoicesChoice2(MySequenceWithChoicesChoice2&& original) noexcept;
        // Create an object of type 'MySequenceWithChoicesChoice2' having the
        // value of the specified 'original' object.  After performing this
        // action, the 'original' object will be left in a valid, but
        // unspecified state.
#endif

    ~MySequenceWithChoicesChoice2();
        // Destroy this object.

    // MANIPULATORS
    MySequenceWithChoicesChoice2& operator=(const MySequenceWithChoicesChoice2& rhs);
        // Assign to this object the value of the specified 'rhs' object.

#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
    MySequenceWithChoicesChoice2& operator=(MySequenceWithChoicesChoice2&& rhs);
        // Assign to this object the value of the specified 'rhs' object.
        // After performing this action, the 'rhs' object will be left in a
        // valid, but unspecified state.
#endif

    void reset();
        // Reset this object to the default value (i.e., its value upon default
        // construction).

    int makeSelection(int selectionId);
        // Set the value of this object to be the default for the selection
        // indicated by the specified 'selectionId'.  Return 0 on success, and
        // non-zero value otherwise (i.e., the selection is not found).

    int makeSelection(const char *name, int nameLength);
        // Set the value of this object to be the default for the selection
        // indicated by the specified 'name' of the specified 'nameLength'.
        // Return 0 on success, and non-zero value otherwise (i.e., the
        // selection is not found).

    int& makeChoiceC();
    int& makeChoiceC(int value);
        // Set the value of this object to be a "ChoiceC" value.  Optionally
        // specify the 'value' of the "ChoiceC".  If 'value' is not specified,
        // the default "ChoiceC" value is used.

    int& makeChoiceD();
    int& makeChoiceD(int value);
        // Set the value of this object to be a "ChoiceD" value.  Optionally
        // specify the 'value' of the "ChoiceD".  If 'value' is not specified,
        // the default "ChoiceD" value is used.

    template<class MANIPULATOR>
    int manipulateSelection(MANIPULATOR& manipulator);
        // Invoke the specified 'manipulator' on the address of the modifiable
        // selection, supplying 'manipulator' with the corresponding selection
        // information structure.  Return the value returned from the
        // invocation of 'manipulator' if this object has a defined selection,
        // and -1 otherwise.

    int& choiceC();
        // Return a reference to the modifiable "ChoiceC" selection of this
        // object if "ChoiceC" is the current selection.  The behavior is
        // undefined unless "ChoiceC" is the selection of this object.

    int& choiceD();
        // Return a reference to the modifiable "ChoiceD" selection of this
        // object if "ChoiceD" is the current selection.  The behavior is
        // undefined unless "ChoiceD" is the selection of this object.

    // ACCESSORS
    bsl::ostream& print(bsl::ostream& stream,
                        int           level = 0,
                        int           spacesPerLevel = 4) const;
        // Format this object to the specified output 'stream' at the
        // optionally specified indentation 'level' and return a reference to
        // the modifiable 'stream'.  If 'level' is specified, optionally
        // specify 'spacesPerLevel', the number of spaces per indentation level
        // for this and all of its nested objects.  Each line is indented by
        // the absolute value of 'level * spacesPerLevel'.  If 'level' is
        // negative, suppress indentation of the first line.  If
        // 'spacesPerLevel' is negative, suppress line breaks and format the
        // entire output on one line.  If 'stream' is initially invalid, this
        // operation has no effect.  Note that a trailing newline is provided
        // in multiline mode only.

    int selectionId() const;
        // Return the id of the current selection if the selection is defined,
        // and -1 otherwise.

    template<class ACCESSOR>
    int accessSelection(ACCESSOR& accessor) const;
        // Invoke the specified 'accessor' on the non-modifiable selection,
        // supplying 'accessor' with the corresponding selection information
        // structure.  Return the value returned from the invocation of
        // 'accessor' if this object has a defined selection, and -1 otherwise.

    const int& choiceC() const;
        // Return a reference to the non-modifiable "ChoiceC" selection of this
        // object if "ChoiceC" is the current selection.  The behavior is
        // undefined unless "ChoiceC" is the selection of this object.

    const int& choiceD() const;
        // Return a reference to the non-modifiable "ChoiceD" selection of this
        // object if "ChoiceD" is the current selection.  The behavior is
        // undefined unless "ChoiceD" is the selection of this object.

    bool isChoiceCValue() const;
        // Return 'true' if the value of this object is a "ChoiceC" value, and
        // return 'false' otherwise.

    bool isChoiceDValue() const;
        // Return 'true' if the value of this object is a "ChoiceD" value, and
        // return 'false' otherwise.

    bool isUndefinedValue() const;
        // Return 'true' if the value of this object is undefined, and 'false'
        // otherwise.

    const char *selectionName() const;
        // Return the symbolic name of the current selection of this object.
};

// FREE OPERATORS
inline
bool operator==(const MySequenceWithChoicesChoice2& lhs, const MySequenceWithChoicesChoice2& rhs);
    // Return 'true' if the specified 'lhs' and 'rhs' objects have the same
    // value, and 'false' otherwise.  Two 'MySequenceWithChoicesChoice2' objects have the same
    // value if either the selections in both objects have the same ids and
    // the same values, or both selections are undefined.

inline
bool operator!=(const MySequenceWithChoicesChoice2& lhs, const MySequenceWithChoicesChoice2& rhs);
    // Return 'true' if the specified 'lhs' and 'rhs' objects do not have the
    // same values, as determined by 'operator==', and 'false' otherwise.

inline
bsl::ostream& operator<<(bsl::ostream& stream, const MySequenceWithChoicesChoice2& rhs);
    // Format the specified 'rhs' to the specified output 'stream' and
    // return a reference to the modifiable 'stream'.

}  // close package namespace

// TRAITS

BDLAT_DECL_CHOICE_WITH_BITWISEMOVEABLE_TRAITS(s_baltst::MySequenceWithChoicesChoice2)

namespace s_baltst {

                        // ===========================
                        // class MySequenceWithChoices
                        // ===========================

class MySequenceWithChoices {

    // INSTANCE DATA
    MySequenceWithChoicesChoice2  d_second;
    MySequenceWithChoicesChoice1  d_first;

  public:
    // TYPES
    enum {
        ATTRIBUTE_ID_FIRST  = 0
      , ATTRIBUTE_ID_SECOND = 1
    };

    enum {
        NUM_ATTRIBUTES = 2
    };

    enum {
        ATTRIBUTE_INDEX_FIRST  = 0
      , ATTRIBUTE_INDEX_SECOND = 1
    };

    // CONSTANTS
    static const char CLASS_NAME[];

    static const bdlat_AttributeInfo ATTRIBUTE_INFO_ARRAY[];

  public:
    // CLASS METHODS
    static const bdlat_AttributeInfo *lookupAttributeInfo(int id);
        // Return attribute information for the attribute indicated by the
        // specified 'id' if the attribute exists, and 0 otherwise.

    static const bdlat_AttributeInfo *lookupAttributeInfo(
                                                       const char *name,
                                                       int         nameLength);
        // Return attribute information for the attribute indicated by the
        // specified 'name' of the specified 'nameLength' if the attribute
        // exists, and 0 otherwise.

    // CREATORS
    MySequenceWithChoices();
        // Create an object of type 'MySequenceWithChoices' having the default
        // value.

    MySequenceWithChoices(const MySequenceWithChoices& original);
        // Create an object of type 'MySequenceWithChoices' having the value of
        // the specified 'original' object.

#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
    MySequenceWithChoices(MySequenceWithChoices&& original) = default;
        // Create an object of type 'MySequenceWithChoices' having the value of
        // the specified 'original' object.  After performing this action, the
        // 'original' object will be left in a valid, but unspecified state.
#endif

    ~MySequenceWithChoices();
        // Destroy this object.

    // MANIPULATORS
    MySequenceWithChoices& operator=(const MySequenceWithChoices& rhs);
        // Assign to this object the value of the specified 'rhs' object.

#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
    MySequenceWithChoices& operator=(MySequenceWithChoices&& rhs);
        // Assign to this object the value of the specified 'rhs' object.
        // After performing this action, the 'rhs' object will be left in a
        // valid, but unspecified state.
#endif

    void reset();
        // Reset this object to the default value (i.e., its value upon
        // default construction).

    template<class MANIPULATOR>
    int manipulateAttributes(MANIPULATOR& manipulator);
        // Invoke the specified 'manipulator' sequentially on the address of
        // each (modifiable) attribute of this object, supplying 'manipulator'
        // with the corresponding attribute information structure until such
        // invocation returns a non-zero value.  Return the value from the
        // last invocation of 'manipulator' (i.e., the invocation that
        // terminated the sequence).

    template<class MANIPULATOR>
    int manipulateAttribute(MANIPULATOR& manipulator, int id);
        // Invoke the specified 'manipulator' on the address of
        // the (modifiable) attribute indicated by the specified 'id',
        // supplying 'manipulator' with the corresponding attribute
        // information structure.  Return the value returned from the
        // invocation of 'manipulator' if 'id' identifies an attribute of this
        // class, and -1 otherwise.

    template<class MANIPULATOR>
    int manipulateAttribute(MANIPULATOR&  manipulator,
                            const char   *name,
                            int           nameLength);
        // Invoke the specified 'manipulator' on the address of
        // the (modifiable) attribute indicated by the specified 'name' of the
        // specified 'nameLength', supplying 'manipulator' with the
        // corresponding attribute information structure.  Return the value
        // returned from the invocation of 'manipulator' if 'name' identifies
        // an attribute of this class, and -1 otherwise.

    MySequenceWithChoicesChoice1& first();
        // Return a reference to the modifiable "First" attribute of this
        // object.

    MySequenceWithChoicesChoice2& second();
        // Return a reference to the modifiable "Second" attribute of this
        // object.

    // ACCESSORS
    bsl::ostream& print(bsl::ostream& stream,
                        int           level = 0,
                        int           spacesPerLevel = 4) const;
        // Format this object to the specified output 'stream' at the
        // optionally specified indentation 'level' and return a reference to
        // the modifiable 'stream'.  If 'level' is specified, optionally
        // specify 'spacesPerLevel', the number of spaces per indentation level
        // for this and all of its nested objects.  Each line is indented by
        // the absolute value of 'level * spacesPerLevel'.  If 'level' is
        // negative, suppress indentation of the first line.  If
        // 'spacesPerLevel' is negative, suppress line breaks and format the
        // entire output on one line.  If 'stream' is initially invalid, this
        // operation has no effect.  Note that a trailing newline is provided
        // in multiline mode only.

    template<class ACCESSOR>
    int accessAttributes(ACCESSOR& accessor) const;
        // Invoke the specified 'accessor' sequentially on each
        // (non-modifiable) attribute of this object, supplying 'accessor'
        // with the corresponding attribute information structure until such
        // invocation returns a non-zero value.  Return the value from the
        // last invocation of 'accessor' (i.e., the invocation that terminated
        // the sequence).

    template<class ACCESSOR>
    int accessAttribute(ACCESSOR& accessor, int id) const;
        // Invoke the specified 'accessor' on the (non-modifiable) attribute
        // of this object indicated by the specified 'id', supplying 'accessor'
        // with the corresponding attribute information structure.  Return the
        // value returned from the invocation of 'accessor' if 'id' identifies
        // an attribute of this class, and -1 otherwise.

    template<class ACCESSOR>
    int accessAttribute(ACCESSOR&   accessor,
                        const char *name,
                        int         nameLength) const;
        // Invoke the specified 'accessor' on the (non-modifiable) attribute
        // of this object indicated by the specified 'name' of the specified
        // 'nameLength', supplying 'accessor' with the corresponding attribute
        // information structure.  Return the value returned from the
        // invocation of 'accessor' if 'name' identifies an attribute of this
        // class, and -1 otherwise.

    const MySequenceWithChoicesChoice1& first() const;
        // Return a reference offering non-modifiable access to the "First"
        // attribute of this object.

    const MySequenceWithChoicesChoice2& second() const;
        // Return a reference offering non-modifiable access to the "Second"
        // attribute of this object.
};

// FREE OPERATORS
inline
bool operator==(const MySequenceWithChoices& lhs, const MySequenceWithChoices& rhs);
    // Return 'true' if the specified 'lhs' and 'rhs' attribute objects have
    // the same value, and 'false' otherwise.  Two attribute objects have the
    // same value if each respective attribute has the same value.

inline
bool operator!=(const MySequenceWithChoices& lhs, const MySequenceWithChoices& rhs);
    // Return 'true' if the specified 'lhs' and 'rhs' attribute objects do not
    // have the same value, and 'false' otherwise.  Two attribute objects do
    // not have the same value if one or more respective attributes differ in
    // values.

inline
bsl::ostream& operator<<(bsl::ostream& stream, const MySequenceWithChoices& rhs);
    // Format the specified 'rhs' to the specified output 'stream' and
    // return a reference to the modifiable 'stream'.

}  // close package namespace

// TRAITS

BDLAT_DECL_SEQUENCE_WITH_BITWISEMOVEABLE_TRAITS(s_baltst::MySequenceWithChoices)

// ============================================================================
//                         INLINE FUNCTION DEFINITIONS
// ============================================================================

namespace s_baltst {

                     // ----------------------------------
                     // class MySequenceWithChoicesChoice1
                     // ----------------------------------

// CLASS METHODS
// CREATORS
inline
MySequenceWithChoicesChoice1::MySequenceWithChoicesChoice1()
: d_selectionId(SELECTION_ID_UNDEFINED)
{
}

inline
MySequenceWithChoicesChoice1::~MySequenceWithChoicesChoice1()
{
    reset();
}

// MANIPULATORS
template <class MANIPULATOR>
int MySequenceWithChoicesChoice1::manipulateSelection(MANIPULATOR& manipulator)
{
    switch (d_selectionId) {
      case MySequenceWithChoicesChoice1::SELECTION_ID_CHOICE_A:
        return manipulator(&d_choiceA.object(),
                SELECTION_INFO_ARRAY[SELECTION_INDEX_CHOICE_A]);
      case MySequenceWithChoicesChoice1::SELECTION_ID_CHOICE_B:
        return manipulator(&d_choiceB.object(),
                SELECTION_INFO_ARRAY[SELECTION_INDEX_CHOICE_B]);
      default:
        BSLS_ASSERT(MySequenceWithChoicesChoice1::SELECTION_ID_UNDEFINED == d_selectionId);
        return -1;
    }
}

inline
int& MySequenceWithChoicesChoice1::choiceA()
{
    BSLS_ASSERT(SELECTION_ID_CHOICE_A == d_selectionId);
    return d_choiceA.object();
}

inline
int& MySequenceWithChoicesChoice1::choiceB()
{
    BSLS_ASSERT(SELECTION_ID_CHOICE_B == d_selectionId);
    return d_choiceB.object();
}

// ACCESSORS
inline
int MySequenceWithChoicesChoice1::selectionId() const
{
    return d_selectionId;
}

template <class ACCESSOR>
int MySequenceWithChoicesChoice1::accessSelection(ACCESSOR& accessor) const
{
    switch (d_selectionId) {
      case SELECTION_ID_CHOICE_A:
        return accessor(d_choiceA.object(),
                SELECTION_INFO_ARRAY[SELECTION_INDEX_CHOICE_A]);
      case SELECTION_ID_CHOICE_B:
        return accessor(d_choiceB.object(),
                SELECTION_INFO_ARRAY[SELECTION_INDEX_CHOICE_B]);
      default:
        BSLS_ASSERT(SELECTION_ID_UNDEFINED == d_selectionId);
        return -1;
    }
}

inline
const int& MySequenceWithChoicesChoice1::choiceA() const
{
    BSLS_ASSERT(SELECTION_ID_CHOICE_A == d_selectionId);
    return d_choiceA.object();
}

inline
const int& MySequenceWithChoicesChoice1::choiceB() const
{
    BSLS_ASSERT(SELECTION_ID_CHOICE_B == d_selectionId);
    return d_choiceB.object();
}

inline
bool MySequenceWithChoicesChoice1::isChoiceAValue() const
{
    return SELECTION_ID_CHOICE_A == d_selectionId;
}

inline
bool MySequenceWithChoicesChoice1::isChoiceBValue() const
{
    return SELECTION_ID_CHOICE_B == d_selectionId;
}

inline
bool MySequenceWithChoicesChoice1::isUndefinedValue() const
{
    return SELECTION_ID_UNDEFINED == d_selectionId;
}

                     // ----------------------------------
                     // class MySequenceWithChoicesChoice2
                     // ----------------------------------

// CLASS METHODS
// CREATORS
inline
MySequenceWithChoicesChoice2::MySequenceWithChoicesChoice2()
: d_selectionId(SELECTION_ID_UNDEFINED)
{
}

inline
MySequenceWithChoicesChoice2::~MySequenceWithChoicesChoice2()
{
    reset();
}

// MANIPULATORS
template <class MANIPULATOR>
int MySequenceWithChoicesChoice2::manipulateSelection(MANIPULATOR& manipulator)
{
    switch (d_selectionId) {
      case MySequenceWithChoicesChoice2::SELECTION_ID_CHOICE_C:
        return manipulator(&d_choiceC.object(),
                SELECTION_INFO_ARRAY[SELECTION_INDEX_CHOICE_C]);
      case MySequenceWithChoicesChoice2::SELECTION_ID_CHOICE_D:
        return manipulator(&d_choiceD.object(),
                SELECTION_INFO_ARRAY[SELECTION_INDEX_CHOICE_D]);
      default:
        BSLS_ASSERT(MySequenceWithChoicesChoice2::SELECTION_ID_UNDEFINED == d_selectionId);
        return -1;
    }
}

inline
int& MySequenceWithChoicesChoice2::choiceC()
{
    BSLS_ASSERT(SELECTION_ID_CHOICE_C == d_selectionId);
    return d_choiceC.object();
}

inline
int& MySequenceWithChoicesChoice2::choiceD()
{
    BSLS_ASSERT(SELECTION_ID_CHOICE_D == d_selectionId);
    return d_choiceD.object();
}

// ACCESSORS
inline
int MySequenceWithChoicesChoice2::selectionId() const
{
    return d_selectionId;
}

template <class ACCESSOR>
int MySequenceWithChoicesChoice2::accessSelection(ACCESSOR& accessor) const
{
    switch (d_selectionId) {
      case SELECTION_ID_CHOICE_C:
        return accessor(d_choiceC.object(),
                SELECTION_INFO_ARRAY[SELECTION_INDEX_CHOICE_C]);
      case SELECTION_ID_CHOICE_D:
        return accessor(d_choiceD.object(),
                SELECTION_INFO_ARRAY[SELECTION_INDEX_CHOICE_D]);
      default:
        BSLS_ASSERT(SELECTION_ID_UNDEFINED == d_selectionId);
        return -1;
    }
}

inline
const int& MySequenceWithChoicesChoice2::choiceC() const
{
    BSLS_ASSERT(SELECTION_ID_CHOICE_C == d_selectionId);
    return d_choiceC.object();
}

inline
const int& MySequenceWithChoicesChoice2::choiceD() const
{
    BSLS_ASSERT(SELECTION_ID_CHOICE_D == d_selectionId);
    return d_choiceD.object();
}

inline
bool MySequenceWithChoicesChoice2::isChoiceCValue() const
{
    return SELECTION_ID_CHOICE_C == d_selectionId;
}

inline
bool MySequenceWithChoicesChoice2::isChoiceDValue() const
{
    return SELECTION_ID_CHOICE_D == d_selectionId;
}

inline
bool MySequenceWithChoicesChoice2::isUndefinedValue() const
{
    return SELECTION_ID_UNDEFINED == d_selectionId;
}

                        // ---------------------------
                        // class MySequenceWithChoices
                        // ---------------------------

// CLASS METHODS
// MANIPULATORS
template <class MANIPULATOR>
int MySequenceWithChoices::manipulateAttributes(MANIPULATOR& manipulator)
{
    int ret;

    ret = manipulator(&d_first, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_FIRST]);
    if (ret) {
        return ret;
    }

    ret = manipulator(&d_second, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_SECOND]);
    if (ret) {
        return ret;
    }

    return 0;
}

template <class MANIPULATOR>
int MySequenceWithChoices::manipulateAttribute(MANIPULATOR& manipulator, int id)
{
    enum { NOT_FOUND = -1 };

    switch (id) {
      case ATTRIBUTE_ID_FIRST: {
        return manipulator(&d_first, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_FIRST]);
      }
      case ATTRIBUTE_ID_SECOND: {
        return manipulator(&d_second, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_SECOND]);
      }
      default:
        return NOT_FOUND;
    }
}

template <class MANIPULATOR>
int MySequenceWithChoices::manipulateAttribute(
        MANIPULATOR&  manipulator,
        const char   *name,
        int           nameLength)
{
    enum { NOT_FOUND = -1 };

    const bdlat_AttributeInfo *attributeInfo =
                                         lookupAttributeInfo(name, nameLength);
    if (0 == attributeInfo) {
        return NOT_FOUND;
    }

    return manipulateAttribute(manipulator, attributeInfo->d_id);
}

inline
MySequenceWithChoicesChoice1& MySequenceWithChoices::first()
{
    return d_first;
}

inline
MySequenceWithChoicesChoice2& MySequenceWithChoices::second()
{
    return d_second;
}

// ACCESSORS
template <class ACCESSOR>
int MySequenceWithChoices::accessAttributes(ACCESSOR& accessor) const
{
    int ret;

    ret = accessor(d_first, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_FIRST]);
    if (ret) {
        return ret;
    }

    ret = accessor(d_second, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_SECOND]);
    if (ret) {
        return ret;
    }

    return 0;
}

template <class ACCESSOR>
int MySequenceWithChoices::accessAttribute(ACCESSOR& accessor, int id) const
{
    enum { NOT_FOUND = -1 };

    switch (id) {
      case ATTRIBUTE_ID_FIRST: {
        return accessor(d_first, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_FIRST]);
      }
      case ATTRIBUTE_ID_SECOND: {
        return accessor(d_second, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_SECOND]);
      }
      default:
        return NOT_FOUND;
    }
}

template <class ACCESSOR>
int MySequenceWithChoices::accessAttribute(
        ACCESSOR&   accessor,
        const char *name,
        int         nameLength) const
{
    enum { NOT_FOUND = -1 };

    const bdlat_AttributeInfo *attributeInfo =
          lookupAttributeInfo(name, nameLength);
    if (0 == attributeInfo) {
       return NOT_FOUND;
    }

    return accessAttribute(accessor, attributeInfo->d_id);
}

inline
const MySequenceWithChoicesChoice1& MySequenceWithChoices::first() const
{
    return d_first;
}

inline
const MySequenceWithChoicesChoice2& MySequenceWithChoices::second() const
{
    return d_second;
}

}  // close package namespace

// FREE FUNCTIONS

inline
bool s_baltst::operator==(
        const s_baltst::MySequenceWithChoicesChoice1& lhs,
        const s_baltst::MySequenceWithChoicesChoice1& rhs)
{
    typedef s_baltst::MySequenceWithChoicesChoice1 Class;
    if (lhs.selectionId() == rhs.selectionId()) {
        switch (rhs.selectionId()) {
          case Class::SELECTION_ID_CHOICE_A:
            return lhs.choiceA() == rhs.choiceA();
          case Class::SELECTION_ID_CHOICE_B:
            return lhs.choiceB() == rhs.choiceB();
          default:
            BSLS_ASSERT(Class::SELECTION_ID_UNDEFINED == rhs.selectionId());
            return true;
        }
    }
    else {
        return false;
   }
}

inline
bool s_baltst::operator!=(
        const s_baltst::MySequenceWithChoicesChoice1& lhs,
        const s_baltst::MySequenceWithChoicesChoice1& rhs)
{
    return !(lhs == rhs);
}

inline
bsl::ostream& s_baltst::operator<<(
        bsl::ostream& stream,
        const s_baltst::MySequenceWithChoicesChoice1& rhs)
{
    return rhs.print(stream, 0, -1);
}

inline
bool s_baltst::operator==(
        const s_baltst::MySequenceWithChoicesChoice2& lhs,
        const s_baltst::MySequenceWithChoicesChoice2& rhs)
{
    typedef s_baltst::MySequenceWithChoicesChoice2 Class;
    if (lhs.selectionId() == rhs.selectionId()) {
        switch (rhs.selectionId()) {
          case Class::SELECTION_ID_CHOICE_C:
            return lhs.choiceC() == rhs.choiceC();
          case Class::SELECTION_ID_CHOICE_D:
            return lhs.choiceD() == rhs.choiceD();
          default:
            BSLS_ASSERT(Class::SELECTION_ID_UNDEFINED == rhs.selectionId());
            return true;
        }
    }
    else {
        return false;
   }
}

inline
bool s_baltst::operator!=(
        const s_baltst::MySequenceWithChoicesChoice2& lhs,
        const s_baltst::MySequenceWithChoicesChoice2& rhs)
{
    return !(lhs == rhs);
}

inline
bsl::ostream& s_baltst::operator<<(
        bsl::ostream& stream,
        const s_baltst::MySequenceWithChoicesChoice2& rhs)
{
    return rhs.print(stream, 0, -1);
}

inline
bool s_baltst::operator==(
        const s_baltst::MySequenceWithChoices& lhs,
        const s_baltst::MySequenceWithChoices& rhs)
{
    return  lhs.first() == rhs.first()
         && lhs.second() == rhs.second();
}

inline
bool s_baltst::operator!=(
        const s_baltst::MySequenceWithChoices& lhs,
        const s_baltst::MySequenceWithChoices& rhs)
{
    return !(lhs == rhs);
}

inline
bsl::ostream& s_baltst::operator<<(
        bsl::ostream& stream,
        const s_baltst::MySequenceWithChoices& rhs)
{
    return rhs.print(stream, 0, -1);
}

}  // close enterprise namespace
#endif

// GENERATED BY @BLP_BAS_CODEGEN_VERSION@
// USING bas_codegen.pl s_baltst_mysequencewithchoices.xsd --mode msg --includedir . --msgComponent mysequencewithchoices --noRecurse --noExternalization --noHashSupport --noAggregateConversion
// ----------------------------------------------------------------------------
// NOTICE:
//      Copyright 2022 Bloomberg Finance L.P. All rights reserved.
//      Property of Bloomberg Finance L.P. (BFLP)
//      This software is made available solely pursuant to the
//      terms of a BFLP license agreement which governs its use.
// ------------------------------- END-OF-FILE --------------------------------


text:
package org.apache.deltaspike.test.scheduler.custom;

import org.apache.deltaspike.scheduler.api.Scheduled;

@Scheduled(cronExpression = "*/1 * * * * ?")
public class AutoRegisteredJob implements CustomJob
{
}


text:
<?php

/* TwigBundle:Exception:trace.txt.twig */
class __TwigTemplate_ea0ab750958f432567096d76c4cad40ba68f42f6124b782484087a379d3d4bcc extends Twig_Template
{
    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        $this->parent = false;

        $this->blocks = array(
        );
    }

    protected function doDisplay(array $context, array $blocks = array())
    {
        $__internal_fbd37368e9ec5cc9050b86bf7bb42e04f14b14e7b985a6aefc4484ea1ad4cdf5 = $this->env->getExtension("Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension");
        $__internal_fbd37368e9ec5cc9050b86bf7bb42e04f14b14e7b985a6aefc4484ea1ad4cdf5->enter($__internal_fbd37368e9ec5cc9050b86bf7bb42e04f14b14e7b985a6aefc4484ea1ad4cdf5_prof = new Twig_Profiler_Profile($this->getTemplateName(), "template", "TwigBundle:Exception:trace.txt.twig"));

        $__internal_482730fc23b13cfb101bf893dd1a8aada1e294ec24767c180bcb4ca7e561ed1a = $this->env->getExtension("Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension");
        $__internal_482730fc23b13cfb101bf893dd1a8aada1e294ec24767c180bcb4ca7e561ed1a->enter($__internal_482730fc23b13cfb101bf893dd1a8aada1e294ec24767c180bcb4ca7e561ed1a_prof = new Twig_Profiler_Profile($this->getTemplateName(), "template", "TwigBundle:Exception:trace.txt.twig"));

        // line 1
        if ($this->getAttribute(($context["trace"] ?? $this->getContext($context, "trace")), "function", array())) {
            // line 2
            echo "at ";
            echo (($this->getAttribute(($context["trace"] ?? $this->getContext($context, "trace")), "class", array()) . $this->getAttribute(($context["trace"] ?? $this->getContext($context, "trace")), "type", array())) . $this->getAttribute(($context["trace"] ?? $this->getContext($context, "trace")), "function", array()));
            echo "(";
            echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\CodeExtension')->formatArgs($this->getAttribute(($context["trace"] ?? $this->getContext($context, "trace")), "args", array()));
            echo ")";
        }
        // line 4
        if (( !twig_test_empty((($this->getAttribute(($context["trace"] ?? null), "file", array(), "any", true, true)) ? (_twig_default_filter($this->getAttribute(($context["trace"] ?? null), "file", array()), "")) : (""))) &&  !twig_test_empty((($this->getAttribute(($context["trace"] ?? null), "line", array(), "any", true, true)) ? (_twig_default_filter($this->getAttribute(($context["trace"] ?? null), "line", array()), "")) : (""))))) {
            // line 5
            echo (($this->getAttribute(($context["trace"] ?? $this->getContext($context, "trace")), "function", array())) ? ("
     (") : ("at "));
            echo twig_replace_filter(strip_tags($this->env->getExtension('Symfony\Bridge\Twig\Extension\CodeExtension')->formatFile($this->getAttribute(($context["trace"] ?? $this->getContext($context, "trace")), "file", array()), $this->getAttribute(($context["trace"] ?? $this->getContext($context, "trace")), "line", array()))), array((" at line " . $this->getAttribute(($context["trace"] ?? $this->getContext($context, "trace")), "line", array())) => ""));
            echo ":";
            echo $this->getAttribute(($context["trace"] ?? $this->getContext($context, "trace")), "line", array());
            echo (($this->getAttribute(($context["trace"] ?? $this->getContext($context, "trace")), "function", array())) ? (")") : (""));
        }

        $__internal_fbd37368e9ec5cc9050b86bf7bb42e04f14b14e7b985a6aefc4484ea1ad4cdf5->leave($__internal_fbd37368e9ec5cc9050b86bf7bb42e04f14b14e7b985a6aefc4484ea1ad4cdf5_prof);

        $__internal_482730fc23b13cfb101bf893dd1a8aada1e294ec24767c180bcb4ca7e561ed1a->leave($__internal_482730fc23b13cfb101bf893dd1a8aada1e294ec24767c180bcb4ca7e561ed1a_prof);

    }

    public function getTemplateName()
    {
        return "TwigBundle:Exception:trace.txt.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  36 => 5,  34 => 4,  27 => 2,  25 => 1,);
    }

    /** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */
    public function getSource()
    {
        @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED);

        return $this->getSourceContext()->getCode();
    }

    public function getSourceContext()
    {
        return new Twig_Source("{% if trace.function %}
at {{ trace.class ~ trace.type ~ trace.function }}({{ trace.args|format_args }})
{%- endif -%}
{% if trace.file|default('') is not empty and trace.line|default('') is not empty %}
  {{- trace.function ? '\\n     (' : 'at '}}{{ trace.file|format_file(trace.line)|striptags|replace({ (' at line ' ~ trace.line): '' }) }}:{{ trace.line }}{{ trace.function ? ')' }}
{%- endif %}
", "TwigBundle:Exception:trace.txt.twig", "C:\\Users\\Edward\\Curso-Componiendo-Con-Symfony\\vendor\\symfony\\symfony\\src\\Symfony\\Bundle\\TwigBundle/Resources/views/Exception/trace.txt.twig");
    }
}


text:
<?php

namespace AppBundle\Component\OAuthClient;

abstract class AbstractOAuthClient
{
    protected $config;

    protected $userAgent = 'Topxia OAuth Client 1.0';

    protected $connectTimeout = 30;

    protected $timeout = 30;

    public function __construct($config)
    {
        $this->config = $config;
    }

    abstract public function getAuthorizeUrl($callbackUrl);

    abstract public function getAccessToken($code, $callbackUrl);

    abstract public function getUserInfo($token);

    /**
     * HTTP POST.
     *
     * @param string $url    要请求的url地址
     * @param array  $params 请求的参数
     *
     * @return string
     */
    public function postRequest($url, $params)
    {
        $curl = curl_init();

        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($curl, CURLOPT_USERAGENT, $this->userAgent);
        curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $this->connectTimeout);
        curl_setopt($curl, CURLOPT_TIMEOUT, $this->timeout);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_HEADER, 0);
        curl_setopt($curl, CURLOPT_POST, 1);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $params);
        curl_setopt($curl, CURLOPT_URL, $url);

        // curl_setopt($curl, CURLINFO_HEADER_OUT, TRUE );

        $response = curl_exec($curl);

        curl_close($curl);

        return $response;
    }

    public function getRequest($url, $params)
    {
        $curl = curl_init();

        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($curl, CURLOPT_USERAGENT, $this->userAgent);
        curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $this->connectTimeout);
        curl_setopt($curl, CURLOPT_TIMEOUT, $this->timeout);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_HEADER, 0);

        $url = $url.'?'.http_build_query($params);
        curl_setopt($curl, CURLOPT_URL, $url);

        $response = curl_exec($curl);

        curl_close($curl);

        return $response;
    }
}


text:
package com.appleframework.auto.open.platform.response;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;

import com.appleframework.rop.response.ErrorResponse;

/**
 * @author cruise.xu
 * @version 1.0
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "tokenErrorResponse")
public class TokenErrorResponse extends ErrorResponse {

	private String code;
	private String message;

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

}


text:
package org.batfish.representation.cisco;

import java.io.Serializable;
import java.util.SortedMap;
import java.util.TreeMap;

public class PrefixList implements Serializable {

  private final SortedMap<Long, PrefixListLine> _lines;

  private final String _name;

  public PrefixList(String name) {
    _lines = new TreeMap<>();
    _name = name;
  }

  public void addLine(PrefixListLine r) {
    _lines.put(r.getSeq(), r);
  }

  public SortedMap<Long, PrefixListLine> getLines() {
    return _lines;
  }

  public String getName() {
    return _name;
  }

  public long getNextSeq() {
    if (_lines.isEmpty()) {
      return 10L;
    }
    return _lines.lastKey() + 10L;
  }
}


text:
// Generated by CoffeeScript 1.6.3
var Model, Server, SocketServer, cluster, connect, exports, fs, http, https, jsdom, os, path, send, watch,
  __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };

fs = require('fs');

os = require('os');

http = require('http');

path = require('path');

send = require('send');

https = require('https');

cluster = require('cluster');

watch = require('chokidar').watch;

jsdom = require('jsdom');

connect = require('connect');

SocketServer = require('./socket');

Model = require('./model');

Server = (function() {
  function Server(app, options) {
    var arg, authenticate, context, i, markup, name, value, _base, _base1, _base2, _base3, _base4, _base5, _base6, _base7, _base8, _i, _j, _len, _ref, _ref1, _ref2, _ref3,
      _this = this;
    this.app = app;
    this.options = options != null ? options : {};
    _ref = process.argv.slice(1);
    for (_i = 0, _len = _ref.length; _i < _len; _i++) {
      arg = _ref[_i];
      if (!(__indexOf.call(arg, '=') >= 0)) {
        continue;
      }
      _ref1 = arg.split('='), name = _ref1[0], value = _ref1[1];
      this.options[name] = value;
    }
    if ((_base = this.options).debug == null) {
      _base.debug = (_ref2 = process.platform) === 'darwin' || _ref2 === 'win32';
    }
    if ((_base1 = this.options).project_path == null) {
      _base1.project_path = process.cwd();
    }
    if ((_base2 = this.options).static_dir == null) {
      _base2.static_dir = this.options.project_path + (this.options.debug && '/build' || '/dist');
    }
    if ((_base3 = this.options).static_url == null) {
      _base3.static_url = '/_static/';
    }
    if ((_base4 = this.options).ssl == null) {
      _base4.ssl = this.ssl_autoconfig();
    }
    if ((_base5 = this.options).port == null) {
      _base5.port = this.options.debug && 3000 || (this.options.ssl && 443 || 80);
    }
    if ((_base6 = this.options).cluster == null) {
      _base6.cluster = !this.options.debug && os.cpus().length || false;
    }
    if ((_base7 = this.options).redirect == null) {
      _base7.redirect = true;
    }
    if ((_base8 = this.options).indexing == null) {
      _base8.indexing = true;
    }
    if (this.options.cluster && cluster.isMaster) {
      for (i = _j = 1, _ref3 = this.options.cluster; 1 <= _ref3 ? _j <= _ref3 : _j >= _ref3; i = 1 <= _ref3 ? ++_j : --_j) {
        cluster.fork();
      }
    } else {
      this.listener = connect();
      this.listener.use((require('connect-slashes'))(false));
      this["static"](this.options.static_url, this.options.static_dir);
      if (this.options.debug) {
        this["static"]('/src', '/src', false);
      }
      if (this.options.ssl) {
        this.server = https.createServer(this.options.ssl, this.listener).listen(this.options.port);
        if (this.options.redirect && this.options.port === 443) {
          this.create_redirect_server(80, 443);
        }
      } else {
        this.server = http.createServer(this.listener).listen(port);
      }
      context = this.app;
      authenticate = function(info, cb) {
        return cb(true);
      };
      this.socket = new SocketServer(this.server, context, authenticate);
      this.listener.use('/favicon.ico', function(req, res) {
        res.writeHead(404);
        return res.end();
      });
      if (this.options.indexing) {
        markup = fs.readFileSync(this.options.static_dir + '/index.html');
        jsdom.env({
          html: markup,
          features: {
            FetchExternalResources: false
          },
          done: function(errors, window) {
            var k, v;
            for (k in window) {
              v = window[k];
              if (typeof global[k] === 'undefined') {
                global[k] = v;
              }
            }
            return _this.listener.use('/', function(req, res) {
              var fn_view, t;
              t = new Date;
              fn_view = _this.app.prototype.dispatch(req.url, true);
              _this.app.prototype.current.once('rendered', function() {
                res.write(window.document.innerHTML);
                res.end();
                return console.log('>>> served ', req.url, ' in ', new Date - t, ' msecs');
              });
              return fn_view();
            });
          }
        });
      } else {
        this.listener.use('/', function(req, res) {
          return send(req, '/index.html').root(_this.options.static_dir).pipe(res);
        });
      }
    }
  }

  Server.prototype["static"] = function(url, dir, live) {
    var expires;
    if (live == null) {
      live = this.options.debug;
    }
    expires = this.options.debug && 0 || (3600 * 24 * 365);
    this.listener.use(url, connect["static"](dir, {
      maxAge: expires
    }));
    if (live) {
      return this.livereload(url, dir);
    }
  };

  Server.prototype.livereload = function(url, dir) {
    var _this = this;
    return watch(path.normalize(dir)).on('change', function(path) {
      return fs.readFile(path, function(err, buf) {
        return _this.socket.broadcast({
          namespace: 'livereload',
          path: url + path.slice(dir.length + 1),
          content: buf.toString()
        });
      });
    });
  };

  Server.prototype.ssl_autoconfig = function() {
    var file_not_found, ssl;
    try {
      ssl = {
        key: fs.readFileSync(this.options.project_path + '/ssl/server.key'),
        cert: fs.readFileSync(this.options.project_path + '/ssl/server.crt')
      };
      return ssl;
    } catch (_error) {
      file_not_found = _error;
      return false;
    }
  };

  Server.prototype.create_redirect_server = function(port_from, port_to) {
    return http.createServer(function(req, res) {
      var secure_host;
      secure_host = req.headers.host.replace(/:[0-9]+/, ":" + port_to);
      res.writeHead(301, {
        Location: 'https://' + secure_host + req.url
      });
      return res.end();
    }).listen(port_from);
  };

  return Server;

})();

exports = module.exports = Server;

/*
//@ sourceMappingURL=server.map
*/


text:
require 'rails_helper'

RSpec.describe RailsIds::Sensors::BlacklistInputValidation do
  it 'detects sql injection' do
    request = ActionDispatch::Request.new(nil)
    RailsIds::Sensors::BlacklistInputValidation.run(
      request, { clean: 'Hello World!' }, nil, 'identifier'
    )
    expect(RailsIds::Event.all.count).to eq(0)

    RailsIds::Sensors::BlacklistInputValidation.run(
      request, { suspicious: '\';--' }, nil, 'identifier'
    )
    expect(RailsIds::Event.all.count).to eq(1)
    expect(RailsIds::Event.where(weight: 'attack').count).to eq(0)

    RailsIds::Sensors::BlacklistInputValidation.run(
      request, { attack: 'foo\' OR 1!=2;--' }, nil, 'identifier'
    )
    expect(RailsIds::Event.where(weight: 'attack').count).to eq(1)
  end

  it 'detects xss' do
    request = ActionDispatch::Request.new(nil)

    RailsIds::Sensors::BlacklistInputValidation.run(
      request, { clean: 'Hello World!' }, nil, 'identifier'
    )
    expect(RailsIds::Event.all.count).to eq(0)

    RailsIds::Sensors::BlacklistInputValidation.run(
      request, { suspicious: 'Love < All > Live' }, nil, 'identifier'
    )
    expect(RailsIds::Event.all.count).to eq(1)
    expect(RailsIds::Event.where(weight: 'attack').count).to eq(0)

    RailsIds::Sensors::BlacklistInputValidation.run(
      request, { attack: '<script>alert(\'Attackable\')</script>' }, nil, 'identifier'
    )
    expect(RailsIds::Event.where(weight: 'attack').count).to eq(1)
  end

  it 'detects unprintable chars' do
  end

  it 'detects file access' do
    request = ActionDispatch::Request.new(nil)

    RailsIds::Sensors::BlacklistInputValidation.run(
      request, { clean: 'Read more ...' }, nil, 'identifier'
    )
    expect(RailsIds::Event.all.count).to eq(0)

    RailsIds::Sensors::BlacklistInputValidation.run(
      request, { suspicious: '../private.log' }, nil, 'identifier'
    )
    expect(RailsIds::Event.all.count).to eq(1)
    expect(RailsIds::Event.where(weight: 'attack').count).to eq(0)
  end
end


text:
package com.mapswithme.maps.purchase;

import androidx.annotation.StringRes;
import com.mapswithme.maps.R;

public enum BookmarksAllSubscriptionPage
{
  FIRST(R.string.all_pass_subscription_message_title,
        R.string.all_pass_subscription_message_subtitle),
  SECOND(R.string.all_pass_subscription_message_title_3,
         R.string.all_pass_subscription_message_subtitle_3),
  THIRD(R.string.all_pass_subscription_message_title_2,
        R.string.all_pass_subscription_message_subtitle_2);

  @StringRes
  private final int mTitleId;
  @StringRes
  private final int mDescriptionId;

  BookmarksAllSubscriptionPage(@StringRes int titleId, @StringRes int descriptionId)
  {
    mTitleId = titleId;
    mDescriptionId = descriptionId;
  }

  @StringRes
  public int getTitleId()
  {
    return mTitleId;
  }

  @StringRes
  public int getDescriptionId()
  {
    return mDescriptionId;
  }
}


text:
using SDKTemplate;
using System;
using System.Collections.Generic;
using System.Linq;
using Windows.Foundation;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;

namespace SDKTemplate
{
    public sealed partial class Scenario2 : Page
    {
        private MainPage rootPage = MainPage.Current;
        public List<SampleDataModel> AllItems = SampleDataModel.GetSampleData();

        public Scenario2()
        {
            this.InitializeComponent();
        }

        private SampleDataModel GetDataModelForCurrentListViewFlyout()
        {
            // Obtain the ListViewItem for which the user requested a context menu.
            var listViewItem = SharedFlyout.Target;

            // Get the data model for the ListViewItem.
            return (SampleDataModel)ItemListView.ItemFromContainer(listViewItem);
        }

        private void OpenMenuItem_Click(object sender, RoutedEventArgs e)
        {
            SampleDataModel model = GetDataModelForCurrentListViewFlyout();
            rootPage.NotifyUser($"Item: {model.Title}, Action: Open", NotifyType.StatusMessage);
        }

        private void PrintMenuItem_Click(object sender, RoutedEventArgs e)
        {
            SampleDataModel model = GetDataModelForCurrentListViewFlyout();
            rootPage.NotifyUser($"Item: {model.Title}, Action: Print", NotifyType.StatusMessage);
        }

        private void DeleteMenuItem_Click(object sender, RoutedEventArgs e)
        {
            SampleDataModel model = GetDataModelForCurrentListViewFlyout();
            rootPage.NotifyUser($"Item: {model.Title}, Action: Delete", NotifyType.StatusMessage);
        }
    }
}


text:
import $ from "jquery"
import { data as sd } from "sharify"
// FIXME: not sure why we require jquery/blueimp packages
require("jquery-ui")
require("blueimp-file-upload")
require("jquery.iframe-transport")

const routes = {
  ".*": () => {
    if (sd.PARTNER_NEW_LAYOUT === true) {
      require("../apps/partner2/client/index.coffee").init()
    } else if (sd.PARTNER_NEW_LAYOUT === false) {
      require("../apps/partner/client/index.coffee").init()
    }
  },
  "/galleries": require("../apps/galleries_institutions/client/index.coffee"),
  "/institutions": require("../apps/galleries_institutions/client/index.coffee"),
  "/auction-partnerships": require("../apps/partnerships/client/index.coffee")
    .init,
  "/institution-partnerships": require("../apps/partnerships/client/index.coffee")
    .init,
  "/show/.*": require("../apps/show/client/index.coffee").init,
  "/shows": require("../apps/shows/client/index.coffee").init,
}

for (let path in routes) {
  const init = routes[path]
  if (location.pathname.match(path)) {
    $(init)
  }
}


text:
import json
import os

import perf_insights_project

import webapp2
from webapp2 import Route

from perf_insights import local_directory_corpus_driver
from perf_insights import corpus_query
from perf_insights import map_runner
from perf_insights import function_handle
from perf_insights.results import json_output_formatter

def _RelPathToUnixPath(p):
  return p.replace(os.sep, '/')

class TestListHandler(webapp2.RequestHandler):
  def get(self, *args, **kwargs): # pylint: disable=unused-argument
    project = perf_insights_project.PerfInsightsProject()
    test_relpaths = ['/' + _RelPathToUnixPath(x)
                     for x in project.FindAllTestModuleRelPaths()]

    tests = {'test_relpaths': test_relpaths}
    tests_as_json = json.dumps(tests)
    self.response.content_type = 'application/json'
    return self.response.write(tests_as_json)

class RunMapFunctionHandler(webapp2.RequestHandler):

  def post(self, *args, **kwargs):  # pylint: disable=unused-argument
    handle_dict = json.loads(self.request.body)

    map_function_handle = function_handle.FunctionHandle.FromDict(handle_dict)
    handle_with_filenames = map_function_handle.ConvertHrefsToAbsFilenames(
        self.app)

    corpus_driver = local_directory_corpus_driver.LocalDirectoryCorpusDriver(
        trace_directory=kwargs.pop('_pi_data_dir'),
        url_resolver=self.app.GetURLForAbsFilename)

    # TODO(nduca): pass self.request.params to the map function [maybe].
    query_string = self.request.get('corpus_query', 'True')
    query = corpus_query.CorpusQuery.FromString(query_string)

    trace_handles = corpus_driver.GetTraceHandlesMatchingQuery(query)

    self._RunMapper(trace_handles, handle_with_filenames)

  def _RunMapper(self, trace_handles, map_function_handle):
    self.response.content_type = 'application/json'
    output_formatter = json_output_formatter.JSONOutputFormatter(
        self.response.out)

    runner = map_runner.MapRunner(trace_handles, map_function_handle,
                                  jobs=map_runner.AUTO_JOB_COUNT,
                                  output_formatters=[output_formatter])
    runner.Run()

class PerfInsightsDevServerConfig(object):
  def __init__(self):
    self.project = perf_insights_project.PerfInsightsProject()

  def GetName(self):
    return 'perf_insights'

  def GetRunUnitTestsUrl(self):
    return '/perf_insights/tests.html'

  def AddOptionstToArgParseGroup(self, g):
    g.add_argument('--pi-data-dir',
                   default=self.project.perf_insights_test_data_path)

  def GetRoutes(self, args):  # pylint: disable=unused-argument
    return [
      Route('/perf_insights/tests', TestListHandler),
      Route('/perf_insights_examples/run_map_function',
            RunMapFunctionHandler,
            defaults={
              '_pi_data_dir':
                  os.path.abspath(os.path.expanduser(args.pi_data_dir))
            })
    ]

  def GetSourcePaths(self, args):  # pylint: disable=unused-argument
    return list(self.project.source_paths)

  def GetTestDataPaths(self, args):  # pylint: disable=unused-argument
    return [('/perf_insights/test_data/',
             os.path.abspath(os.path.expanduser(args.pi_data_dir)))]


text:
using System;
using Newtonsoft.Json;

namespace SurveyMonkey.Containers
{
    [JsonConverter(typeof(TolerantJsonConverter))]
    public class User
    {
        public long? Id { get; set; }
        public string Username { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public string Language { get; set; }
        public string Email { get; set; }
        public string AccountType { get; set; }
        public DateTime? DateCreated { get; set; }
        public DateTime? DateLastLogin { get; set; }
        internal string Href { get; set; }
    }
}


text:
package main

import "fmt"
import "net"
import "os"

import "unicode/utf8"

// Copy everything from the pty master to the socket.
func handleOutputSock(ptym *os.File, conn *net.TCPConn) {
	buf := make([]byte, 512)
	var payload, overflow []byte
	// TODO: more graceful exit on socket close / process exit.
	for {
		n, err := ptym.Read(buf)
		if err != nil {
			fmt.Println("failed to read from pty master: ", err)
			return
		}

		// Empty the overflow from the last read into the payload first.
		payload = append(payload[0:], overflow...)
		overflow = nil
		// Then empty the new buf read into the payload.
		payload = append(payload, buf[:n]...)

		// Strip out any incomplete utf-8 from current payload into overflow.
		for !utf8.Valid(payload) {
			overflow = append(overflow[:0], append(payload[len(payload)-1:], overflow[0:]...)...)
			payload = payload[:len(payload)-1]
		}

		// Send out the finished payload as long as it's not empty.
		if len(payload) >= 1 {
			_, err = conn.Write(payload)
	        if err != nil {
	            fmt.Println("Write: ", err)
	        }
		}

		// Empty the payload.
		payload = nil
	}
}

// Read from the websocket, copying to the pty master.
func handleInputSock(ptym *os.File, conn *net.TCPConn) {
	for {
        buf := make([]byte, 512)
        bytes, err := conn.Read(buf)
        if err != nil {
            return
        }

        buf = buf[:bytes]
		ptym.Write(buf)
	}
}

func ptySetupSock(conn *net.TCPConn, sizeFlag string) {
	ptym, cmd := start()
	setPtySize(ptym, sizeFlag)

	go func() {
		handleOutputSock(ptym, conn)
	}()

	go func() {
		handleInputSock(ptym, conn)
	}()

	// Listen for a new winsize on stdin.
	for {
		var newSize string
		_, scanErr := fmt.Scanln(&newSize)
		if scanErr != nil {
			fmt.Println("scan failed: ", scanErr)
		}

		setPtySize(ptym, newSize)
		fmt.Println("new size: ", newSize)
	}

	stop(ptym, cmd)
	conn.Close()
}


text:
// --------------------------------------------------------------------------------------------------------------------
//  <copyright file="DirectDispatcherTests.cs" company="No lock... no deadlock" product="Michonne">
//     Copyright 2014 Cyrille DUPUYDAUBY (@Cyrdup), Thomas PIERRAIN (@tpierrain)
//     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>
//   --------------------------------------------------------------------------------------------------------------------
namespace Michonne.Tests
{
    using System.Threading;

    using NFluent;

    using NUnit.Framework;

    [TestFixture]
    public class DirectDispatcherTests
    {
        private string executingThreadName;

        [SetUp]
        public void SetUp()
        {
            this.executingThreadName = null;
        }

        [Test]
        public void DirectDispatcherExecutesTasksInTheCallerThread()
        {
            var directDispatcher = new DirectDispatcher();
            if (Thread.CurrentThread.Name == null)
            {
                Thread.CurrentThread.Name = "unit Test thread";
            }

            directDispatcher.Dispatch(() => this.executingThreadName = Thread.CurrentThread.Name);

            Check.That(this.executingThreadName).IsEqualTo(Thread.CurrentThread.Name).And.IsNotNull();
        }
    }
}


text:
<?php

namespace Magento\Framework\Composer\Test\Unit;

use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\Composer\ComposerFactory;
use Magento\Framework\Composer\ComposerJsonFinder;
use Magento\Framework\Filesystem\Driver\File;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;

class ComposerFactoryTest extends \PHPUnit_Framework_TestCase
{
    /** @var string Test COMPOSER_HOME environment variable value */
    private $testComposerHome = __DIR__ . '/_files/composer_home';

    /** @var string Location of test fixtures */
    private $fixturesDir = __DIR__ . '/_files/';

    /** @var string Original value of COMPOSER_HOME environment variable */
    private $originalComposerHome;

    /** @var File */
    private $fileDriver;

    public function setUp()
    {
        $this->fileDriver = new File();
        $this->originalComposerHome = getenv('COMPOSER_HOME');
        putenv('COMPOSER_HOME');
    }

    public function tearDown()
    {
        if ($this->originalComposerHome) {
            putenv('COMPOSER_HOME=' . $this->originalComposerHome);
        }

        // Composer home directory is created one level up from where composer.json is.
        if (is_dir($this->testComposerHome)) {
            $this->fileDriver->deleteDirectory($this->testComposerHome);
        }
    }

    public function testCreate()
    {
        $objectManager = new ObjectManager($this);
        $dirListMock = $this->getMockBuilder(DirectoryList::class)->disableOriginalConstructor()->getMock();
        $composerJsonFinderMock = $this->getMockBuilder(ComposerJsonFinder::class)
            ->disableOriginalConstructor()
            ->getMock();

        $composerJsonPath = $this->fixturesDir . 'composer.json';

        $dirListMock->expects($this->once())
            ->method('getPath')
            ->willReturn($this->testComposerHome);
        $composerJsonFinderMock->expects($this->once())
            ->method('findComposerJson')
            ->willReturn($composerJsonPath);

        /** @var ComposerFactory $factory */
        $factory = $objectManager->getObject(
            ComposerFactory::class,
            [
                'directoryList' => $dirListMock,
                'composerJsonFinder' => $composerJsonFinderMock
            ]
        );

        $this->assertInstanceOf(\Composer\Composer::class, $factory->create());
    }
}


text:
    interface IComparable<T> {
       compareTo(other: T);
    }

    declare function sort<U extends IComparable<U>>(items: U[]): U[];


text:
<?php
require_once('TypeTest.php');

class IntTest extends TypeTest {
    public function setUp() {
        $this->validValue = 1;
        $this->validValues = array(1, 2, 3);

        $this->invalidValue = true;
        $this->invalidValues = array(1, 2, 'foo');

        $this->callable = 'Want\int';
        $this->type = 'int';
    }
}


text:
package xserver.autoapi.constant;

public class FileConstant {

	public static enum Dirs {
		css, font, js, picture
	}

	public static Boolean contains(String name){
		Dirs[] values = Dirs.values();
		for (Dirs dirs : values) {
			if(dirs.toString().equals(name)){
				return true;
			}
		}
		return false;
	}
}


text:
<?php

namespace Tests\Support\Controllers;

use CodeIgniter\API\ResponseTrait;
use CodeIgniter\Controller;
use RuntimeException;

/**
 * This is a testing only controller, intended to blow up in multiple
 * ways to make sure we catch them.
 */
class Popcorn extends Controller
{
    use ResponseTrait;

    public function index()
    {
        return 'Hi there';
    }

    public function pop()
    {
        return $this->respond('Oops', 567, 'Surprise');
    }

    public function popper()
    {
        throw new RuntimeException('Surprise', 500);
    }

    public function weasel()
    {
        return $this->respond('', 200);
    }

    public function oops()
    {
        return $this->failUnauthorized();
    }

    public function goaway()
    {
        return redirect()->to('/');
    }

    /**
     * @see https://github.com/codeigniter4/CodeIgniter4/issues/1834
     */
    public function index3()
    {
        return $this->response->setJSON(['lang' => $this->request->getLocale()]);
    }

    public function canyon()
    {
        echo 'Hello-o-o ' . $this->request->getGet('foo');
    }

    public function cat()
    {
    }

    public function json()
    {
        return $this->respond(['answer' => 42]);
    }

    public function xml()
    {
        return $this->respond('<my><pet>cat</pet></my>');
    }

    public function toindex()
    {
        return redirect()->route('testing-index');
    }

    public function echoJson()
    {
        return $this->response->setJSON($this->request->getJSON());
    }
}