text:
package fr.lteconsulting.hexa.client.ui.miracle;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.JsArray;
import com.google.gwt.dom.client.Element;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyDownEvent;
import com.google.gwt.event.dom.client.KeyDownHandler;
import com.google.gwt.event.dom.client.MouseDownEvent;
import com.google.gwt.event.dom.client.MouseDownHandler;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.HTMLTable.Cell;
import com.google.gwt.user.client.ui.Widget;
import fr.lteconsulting.hexa.client.tools.JQuery;
import fr.lteconsulting.hexa.client.ui.miracle.Edits.Editor;

public class DynArrayInFlexTable<T> implements Prints<Iterable<T>>, DynArrayManager<T>, HasColumns<T>
{
	MiracleTable table;
	RefMng<T> refMng;

	ArrayList<ColumnMng<T>> columns = new ArrayList<ColumnMng<T>>();

	Comparator<T> userComparator = null;

	// edition state
	private class EditionState
	{
		// int editedRow = -1;
		int editedCol = -1;
		T editedObject = null;
		Printer editedPrinter = null;
		Editor editedEditor = null;

		void close()
		{
			if( editedEditor != null )
				editedEditor.close();
			editedEditor = null;
		}
	}

	EditionState edition = null;

	public DynArrayInFlexTable( MiracleTable table, RefMng<T> refMng )
	{
		this.table = table;
		this.refMng = refMng;

		table.addClickHandler( onTableClick );

		table.addDomHandler( onTableKeyUp, KeyDownEvent.getType() );

		table.addMouseDownHandler( onTableMouseDown );
	}

	@Override
	public void addColumn( PrintsOn<T> column, Edits<T> editMng, CellClickMng<T> clickMng, PrintsOn<Void> hdrPrintsOn, CellClickMng<Void> hdrClickMng )
	{
		columns.add( new ColumnMng<T>( column, editMng, clickMng, hdrPrintsOn, hdrClickMng ) );
	}

	@Override
	public void printHeaders()
	{
		int nbCols = columns.size();
		for( int i = 0; i < nbCols; i++ )
			columns.get( i ).hdrPrintsOn.print( null, table.getHdrPrinter( i ) );
	}

	@Override
	public void print( Iterable<T> data )
	{
		killCurrentEdit();
		table.clear( true );

		if( data == null )
			return;

		if( userComparator != null )
		{
			ArrayList<T> tmp = new ArrayList<T>();
			for( T t : data )
			{
				int ins = Collections.binarySearch( tmp, t, userComparator );
				tmp.add( -ins - 1, t );
			}
			data = tmp;
		}

		// each row
		int j = 0;
		for( T d : data )
		{
			printRow( d, j );

			j++;
		}
	}

	@Override
	public void updateRow( T object )
	{
		// find the row associated with this object
		int objectRef = refMng.getRef( object );
		int row = getRow( objectRef );

		if( edition != null && refMng.getRef( edition.editedObject ) == objectRef )
			killCurrentEdit();

		int insPos = userComparator != null ? getInsertPoint( object ) : row;

		// insert or move the row to the right place and create a cell printer
		if( row < 0 )
		{
			// new
			if( insPos >= 0 )
				table.insertRow( insPos );
			else
				insPos = table.getRowCount();
		}
		else
		{
			if( insPos != row )
			{
				GWT.log( "is at row " + row + " but should be at " + insPos );
				insPos = moveRowFor( row, insPos, objectRef );
			}
		}

		// print the row
		printRow( object, insPos );
	}

	// return the row it was moved to
	private int moveRowFor( int actual, int target, int objectRef )
	{
		Element tr = table.getBodyElement().getChild( actual ).cast();
		assert tr.getPropertyInt( "ref" ) == objectRef; // just to be sure we do what we want

		Element parent = tr.getParentElement().cast();

		parent.removeChild( tr );

		if( target < 0 )
		{
			DOM.appendChild( parent, tr );
			return parent.getChildCount() - 1;
		}

		if( target >= actual )
			target--;

		DOM.insertChild( parent, tr, target );

		return target;
	}

	@Override
	public void deleteRow( int ref )
	{
		int row = getRow( ref );
		if( row < 0 )
			return;

		// to reset the edition state, just in case... (an only if we are
		// editing on the row we delete)
		if( edition != null && refMng.getRef( edition.editedObject ) == ref )
			killCurrentEdit();

		table.removeRow( row );
	}

	@Override
	public void setComparator( Comparator<T> comparator )
	{
		userComparator = comparator;
		sortAndPrint( comparator );
	}

	public void sortAndPrint( final Comparator<T> userComparator )
	{
		class It
		{
			Element tr;
			T object;

			It( int row, Element tr, T object )
			{
				this.object = object;
				this.tr = tr;
			}
		}
		;

		ArrayList<It> its = new ArrayList<It>();

		// get all objects from the table
		int nbRows = table.getRowCount();
		for( int r = 0; r < nbRows; r++ )
		{
			Element tr = table.getRowFormatter().getElement( r );
			int ref = tr.getPropertyInt( "ref" );
			its.add( new It( r, tr, refMng.getObject( ref ) ) );
		}

		// sort them
		Collections.sort( its, new Comparator<It>()
		{
			@Override
			public int compare( It o1, It o2 )
			{
				return userComparator.compare( o1.object, o2.object );
			}
		} );

		// now reorder the lines
		for( int j = 0; j < its.size(); j++ )
		{
			int refAtRow = getRefAtRow( j );
			int needRef = refMng.getRef( its.get( j ).object );
			if( needRef != refAtRow )
			{
				// we have to take the row and put it at its right place
				Element tr = its.get( j ).tr;
				assert tr.getPropertyInt( "ref" ) == needRef; // just to be sure
																// we do what we
																// want
				DOM.insertChild( tr.getParentElement(), tr, j );
			}
		}
	}

	private int getRefAtRow( int row )
	{
		return table.getRowFormatter().getElement( row ).getPropertyInt( "ref" );
	}

	// return the row index of the row associated to the object referenced as
	// objectRef
	// returns -1 if the row is not found
	private int getRow( int objectRef )
	{
		JsArray<Element> rows = JQuery.get().jqSelect( "tr[ref=\"" + objectRef + "\"]", table.getBodyElement() );
		if( rows.length() > 1 )
			return -1; // an error actually
		if( rows.length() == 0 )
			return -1;
		Element tr = rows.get( 0 );
		int row = DOM.getChildIndex( tr.getParentElement(), tr );

		return row;
	}

	private void printRow( T object, int row )
	{
		// to reset the edition state, just in case...
		if( edition != null && refMng.getRef( edition.editedObject ) == refMng.getRef( object ) )
			killCurrentEdit();

		// each column
		for( int i = 0; i < columns.size(); i++ )
			columns.get( i ).prints.print( object, new CellInFlexTablePrinter( table, row, i ) );

		// writes the element reference on the corresponding row element
		// note that this does not create a hard link to the referenced object
		// so
		// no garbage is created here

		// to avoid cases when the colummn has printed nothing and the row
		// doesnt exist
		if( table.getRowCount() <= row )
			table.setText( row, 0, "" );
		table.getRowFormatter().getElement( row ).setPropertyInt( "ref", refMng.getRef( object ) );
	}

	private boolean beginEdit( int row, int col )
	{
		if( edition != null && getRefAtRow( row ) == refMng.getRef( edition.editedObject ) )
			return true; // already began !!!

		killCurrentEdit();

		Edits<T> editMng = columns.get( col ).edits;
		if( editMng == null )
			return false;

		// find the T object that has been clicked
		int ref = table.getRowFormatter().getElement( row ).getPropertyInt( "ref" );
		T object = refMng.getObject( ref );
		assert object != null;
		if( object == null )
			return false;

		Element td = table.getCellFormatter().getElement( row, col );

		edition = new EditionState();

		// initialize and set the current edit
		// edition.editedRow = row;
		edition.editedCol = col;
		edition.editedObject = object;

		// create a Printer corresponding to this cell
		edition.editedPrinter = new CellInFlexTablePrinter( table, row, col );

		edition.editedPrinter = new DynamicTablePrinter( object, col );

		// create an editor and init it
		// -2 to remove padding : HACK HACK HACK
		edition.editedEditor = editMng.createEditor( edition.editedObject, edition.editedPrinter, onEdit, td.getOffsetWidth() - 2, td.getClientHeight() - 2 );

		return true;
	}

	private class DynamicTablePrinter implements Printer
	{
		final CellInFlexTablePrinter printer;

		DynamicTablePrinter( T object, int col )
		{
			printer = new CellInFlexTablePrinter( table, getRow( refMng.getRef( object ) ), col );
		}

		@Override
		public void setWidget( Widget widget )
		{
			printer.setWidget( widget );
		}

		@Override
		public void setText( String text )
		{
			printer.setText( text );
		}

		@Override
		public void setHTML( String html )
		{
			printer.setHTML( html );
		}
	}

	private static class CellPos
	{
		int row;
		int col;

		CellPos( int row, int col )
		{
			this.row = row;
			this.col = col;
		}
	}

	private final ClickHandler onTableClick = new ClickHandler()
	{
		@Override
		public void onClick( ClickEvent event )
		{
			// event.preventDefault();
			// event.stopPropagation();

			Cell cell = DynArrayInFlexTable.this.table.getCellForEvent( event );

			// if clicking on a cell that is in editing mode, return
			if( cell != null && edition != null && (refMng.getRef( edition.editedObject ) == getRefAtRow( cell.getRowIndex() ) && edition.editedCol == cell.getCellIndex()) )
				return;

			killCurrentEdit();

			if( cell == null )
			{
				// try to see if it's not on a th element
				int hdr = table.getHeaderForEvent( event.getNativeEvent() );
				if( hdr < 0 )
					return;

				CellClickMng<Void> clickMng = columns.get( hdr ).hdrClickMng;
				if( clickMng == null )
					return;

				// get the printer, and go
				Printer printer = table.getHdrPrinter( hdr );
				clickMng.onTableClick( null, DOM.eventGetTarget( Event.as( event.getNativeEvent() ) ), printer );

				return;
			}

			boolean fHandled = false;

			// Tries edition
			fHandled = beginEdit( cell.getRowIndex(), cell.getCellIndex() );

			// If not handled, tries click manager
			if( !fHandled )
			{
				// if there is a click manager
				CellClickMng<T> clickMng = columns.get( cell.getCellIndex() ).clicks;
				if( clickMng != null )
				{
					// find the T object that has been clicked
					int ref = table.getRowFormatter().getElement( cell.getRowIndex() ).getPropertyInt( "ref" );
					T object = refMng.getObject( ref );
					if( object == null )
						return;

					CellInFlexTablePrinter pr = new CellInFlexTablePrinter( table, cell.getRowIndex(), cell.getCellIndex() );

					fHandled = clickMng.onTableClick( object, DOM.eventGetTarget( Event.as( event.getNativeEvent() ) ), pr );
				}
			}
		}
	};

	private final MouseDownHandler onTableMouseDown = new MouseDownHandler()
	{
		@Override
		public void onMouseDown( MouseDownEvent event )
		{
			// try to see if it's not on a th element
			int hdr = table.getHeaderForEvent( event.getNativeEvent() );
			if( hdr < 0 )
				return;

			Element th = table.getEventTargetHeader( Event.as( event.getNativeEvent() ) );
			DragDrop.initiate( th, onDragDrop, hdr, Event.as( event.getNativeEvent() ) );
		}
	};

	DragDrop.Callback<Integer> onDragDrop = new DragDrop.Callback<Integer>()
	{
		@Override
		public String getGhostInnerHTML( Integer cookie, Element source )
		{
			// TODO Auto-generated method stub
			return null;
		}

		@Override
		public void onDragDropFinished( Integer cookie, Element source, Element destination )
		{
			Element th = table.getElementTargetHeader( destination );
			if( th == null )
				return;

			int newPos = DOM.getChildIndex( DOM.getParent( th ), th );

			ColumnMng<T> dum = columns.get( cookie );
			columns.set( cookie, columns.get( newPos ) );
			columns.set( newPos, dum );

			printHeaders();
			// Redraw all objects in the table
			int nbRows = table.getRowCount();
			for( int r = 0; r < nbRows; r++ )
			{
				Element tr = table.getRowFormatter().getElement( r );
				int ref = tr.getPropertyInt( "ref" );
				printRow( refMng.getObject( ref ), r );
			}
		}
	};

	private final Edits.Callback onEdit = new Edits.Callback()
	{
		@Override
		public void cancelEdition()
		{
			killCurrentEdit();
		}

		@Override
		public void validateEdition( boolean fJumpNext )
		{
			// just forget the edition state, but don't redraw
			// that means we let the client continue drawing on its cell
			if( edition != null && fJumpNext )
			{
				CellPos next = getNextPos( getRow( refMng.getRef( edition.editedObject ) ), edition.editedCol );

				edition.close();
				edition = null;

				beginEdit( next.row, next.col );
			}
		}
	};

	// wait a bit to avoid ui jitter...
	// use refMng in case the data change during the time waited
	private void killCurrentEdit()
	{
		if( edition == null )
			return;

		// reprints the cell
		// cols.get( edition.editedCol ).print( edition.editedObject,
		// edition.editedPrinter );

		// reprints the cell, with uptodate data
		columns.get( edition.editedCol ).prints.print( refMng.getObject( refMng.getRef( edition.editedObject ) ), edition.editedPrinter );

		edition.close();
		edition = null;
	}

	private int getInsertPoint( T object )
	{
		int nbRows = table.getRowCount();
		int objectRef = refMng.getRef( object );

		if( userComparator != null )
		{
			// search the insert position
			for( int i = 0; i < nbRows; i++ )
			{
				int refAtRow = getRefAtRow( i );
				if( userComparator.compare( object, refMng.getObject( refAtRow ) ) <= 0 )
				{
					if( refAtRow == objectRef )
					{
						// keep the same place only if lesser than th nxt item
						// or if there is no next
						if( i + 1 == nbRows )
						{
							return i;
						}
						else
						{
							int refAtNextRow = getRefAtRow( i + 1 );
							if( userComparator.compare( object, refMng.getObject( refAtNextRow ) ) <= 0 )
								return i;
						}
					}
					else
					{
						return i;
					}
				}
			}
		}

		return -1;
	}

	CellPos getNextPos( int row, int col )
	{
		// either on the same row
		for( int c = col + 1; c < columns.size(); c++ )
		{
			if( columns.get( c ).edits != null )
				return new CellPos( row, c );
		}

		// or on the next
		row = (row + 1) % table.getRowCount();
		for( int c = 0; c < columns.size(); c++ )
		{
			if( columns.get( c ).edits != null )
				return new CellPos( row, c );
		}

		return null;
	}

	CellPos getPrevPos( int row, int col )
	{
		// either on the same row
		for( int c = col - 1; c >= 0; c-- )
		{
			if( columns.get( c ).edits != null )
				return new CellPos( col, c );
		}

		// or on the previous
		row = (row + table.getRowCount() - 1) % table.getRowCount();
		for( int c = columns.size() - 1; c >= 0; c-- )
		{
			if( columns.get( c ).edits != null )
				return new CellPos( row, c );
		}

		return null;
	}

	private final KeyDownHandler onTableKeyUp = new KeyDownHandler()
	{
		@Override
		public void onKeyDown( KeyDownEvent event )
		{
			if( event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE )
			{
				if( edition == null )
					return;

				event.stopPropagation();
				event.preventDefault();

				killCurrentEdit();
			}
			else if( event.getNativeKeyCode() == KeyCodes.KEY_TAB )
			{
				if( edition == null )
					return;

				event.stopPropagation();
				event.preventDefault();

				// find next cell to be edited

				int editionRow = getRow( refMng.getRef( edition.editedObject ) );
				CellPos pos = null;
				if( event.isShiftKeyDown() )
					pos = getPrevPos( editionRow, edition.editedCol );
				else
					pos = getNextPos( editionRow, edition.editedCol );

				if( pos != null )
				{
					beginEdit( pos.row, pos.col );
					return;
				}
			}
		}
	};

	@Override
	public void clearAllRows()
	{
		// to reset the edition state, just in case...
		killCurrentEdit();

		table.clear( true );
	}
}


text:
//
//  BFButton.h
//  BFKit
//
//  The MIT License (MIT)
//
//  Copyright (c) 2014 - 2015 Fabrizio Brancati. All rights reserved.
//
//  Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
//  in the Software without restriction, including without limitation the rights
//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//  copies of the Software, and to permit persons to whom the Software is
//  furnished to do so, subject to the following conditions:
//
//  The above copyright notice and this permission notice shall be included in all
//  copies or substantial portions of the Software.
//
//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//  SOFTWARE.

@import Foundation;
@import UIKit;

/**
 *  This class add some useful methods to UIButton that cannot be in a category
 */
@interface BFButton : UIButton

/**
 *  Create an UIButton with a fade animation from image to highlightedImage on touch
 *
 *  @param frame            Button's frame
 *  @param image            Button's image
 *  @param highlightedImage Button's highlighted image
 *  @param fadeDuration     Fade duration
 *
 *  @return Return the created BFButton, subclass of UIButton
 */
- (id)initWithFrame:(CGRect)frame
              image:(UIImage *)image
   highlightedImage:(UIImage *)highlightedImage
       fadeDuration:(CGFloat)fadeDuration;

@end

redpajama_set_name: RedPajamaGithub


text:
package com.microsoft.azure.management.containerinstance.v2017_10_01_preview.implementation;

import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl;
import com.microsoft.azure.management.containerinstance.v2017_10_01_preview.ContainerGroup;
import rx.Observable;
import java.util.List;
import com.microsoft.azure.management.containerinstance.v2017_10_01_preview.Container;
import com.microsoft.azure.management.containerinstance.v2017_10_01_preview.ImageRegistryCredential;
import com.microsoft.azure.management.containerinstance.v2017_10_01_preview.ContainerGroupRestartPolicy;
import com.microsoft.azure.management.containerinstance.v2017_10_01_preview.IpAddress;
import com.microsoft.azure.management.containerinstance.v2017_10_01_preview.OperatingSystemTypes;
import com.microsoft.azure.management.containerinstance.v2017_10_01_preview.Volume;
import com.microsoft.azure.management.containerinstance.v2017_10_01_preview.ContainerGroupPropertiesInstanceView;

class ContainerGroupImpl extends GroupableResourceCoreImpl<ContainerGroup, ContainerGroupInner, ContainerGroupImpl, ContainerInstanceManager> implements ContainerGroup, ContainerGroup.Definition, ContainerGroup.Update {
    ContainerGroupImpl(String name, ContainerGroupInner inner, ContainerInstanceManager manager) {
        super(name, inner, manager);
    }

    @Override
    public Observable<ContainerGroup> createResourceAsync() {
        ContainerGroupsInner client = this.manager().inner().containerGroups();
        return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner())
            .map(innerToFluentMap(this));
    }

    @Override
    public Observable<ContainerGroup> updateResourceAsync() {
        ContainerGroupsInner client = this.manager().inner().containerGroups();
        return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner())
            .map(innerToFluentMap(this));
    }

    @Override
    protected Observable<ContainerGroupInner> getInnerAsync() {
        ContainerGroupsInner client = this.manager().inner().containerGroups();
        return client.getByResourceGroupAsync(this.resourceGroupName(), this.name());
    }

    @Override
    public boolean isInCreateMode() {
        return this.inner().id() == null;
    }

    @Override
    public List<Container> containers() {
        return this.inner().containers();
    }

    @Override
    public List<ImageRegistryCredential> imageRegistryCredentials() {
        return this.inner().imageRegistryCredentials();
    }

    @Override
    public ContainerGroupPropertiesInstanceView instanceView() {
        return this.inner().instanceView();
    }

    @Override
    public IpAddress ipAddress() {
        return this.inner().ipAddress();
    }

    @Override
    public OperatingSystemTypes osType() {
        return this.inner().osType();
    }

    @Override
    public String provisioningState() {
        return this.inner().provisioningState();
    }

    @Override
    public ContainerGroupRestartPolicy restartPolicy() {
        return this.inner().restartPolicy();
    }

    @Override
    public List<Volume> volumes() {
        return this.inner().volumes();
    }

    @Override
    public ContainerGroupImpl withContainers(List<Container> containers) {
        this.inner().withContainers(containers);
        return this;
    }

    @Override
    public ContainerGroupImpl withOsType(OperatingSystemTypes osType) {
        this.inner().withOsType(osType);
        return this;
    }

    @Override
    public ContainerGroupImpl withImageRegistryCredentials(List<ImageRegistryCredential> imageRegistryCredentials) {
        this.inner().withImageRegistryCredentials(imageRegistryCredentials);
        return this;
    }

    @Override
    public ContainerGroupImpl withIpAddress(IpAddress ipAddress) {
        this.inner().withIpAddress(ipAddress);
        return this;
    }

    @Override
    public ContainerGroupImpl withRestartPolicy(ContainerGroupRestartPolicy restartPolicy) {
        this.inner().withRestartPolicy(restartPolicy);
        return this;
    }

    @Override
    public ContainerGroupImpl withVolumes(List<Volume> volumes) {
        this.inner().withVolumes(volumes);
        return this;
    }

}


text:
namespace stdplus
{
namespace exception
{

TEST(Exception, IgnoreNoError)
{
    ignore([] {})();
    ignore([]() mutable { throw std::runtime_error("Boom"); })();
    EXPECT_EQ(int(), ignore([]() -> int { throw 1; })());
    auto x = std::make_unique<int>(1);
    auto y = std::make_unique<int>(2);
    auto z = std::make_unique<int>(3);
    EXPECT_EQ(3, ignore([x = std::move(x)](auto&& v) { return *v + *x; })(y));
    EXPECT_EQ(5, ignore([z = std::move(z)](auto v) { return *v + *z; })(
                     std::move(y)));
}

TEST(Exception, IgnoreQuiet)
{
    ignoreQuiet([] {})();
    ignoreQuiet([]() mutable { throw std::runtime_error("Boom"); })();
}

} // namespace exception
} // namespace stdplus


text:
<?php

namespace Bluz\Tests\Validator\Rule;

use Bluz\Tests;
use Bluz\Validator\Rule\InRule as Rule;

/**
 * Class InTest
 *
 * @package Bluz\Tests\Validator\Rule
 */
class InTest extends Tests\FrameworkTestCase
{
    /**
     * @dataProvider providerForPass
     *
     * @param      $input
     * @param null $haystack
     */
    public function testSuccessInValidatorCases($input, $haystack = null)
    {
        $rule = new Rule($haystack);
        self::assertTrue($rule->validate($input));
        self::assertNotEmpty($rule->__toString());
    }

    /**
     * @dataProvider providerForFail
     *
     * @param      $input
     * @param null $haystack
     */
    public function testInvalidInValidatorCases($input, $haystack = null)
    {
        $rule = new Rule($haystack);
        self::assertFalse($rule->validate($input));
        self::assertNotEmpty($rule->__toString());
    }

    /**
     * @return array
     */
    public function providerForPass(): array
    {
        return array(
            ['foo', ['foo', 'bar']],
            ['foo', 'foo'],
            ['foo', 'barfoobaz'],
            ['foo', 'barbazFOO'],
            ['1', [1, 2, 3]],
            ['1', ['1', 2, 3]],
        );
    }

    /**
     * @return array
     */
    public function providerForFail(): array
    {
        return array(
            ['', 'barfoobaz'],
            ['', 42],
            ['bat', ['foo', 'bar']],
            ['foo', 'barfaabaz'],
            [4, [1, 2, 3]],
        );
    }
}


text:
#ifndef __GRIDLINES_H_
#define __GRIDLINES_H_

#include <vector>
using std::vector;

#include <string>
using std::string;
#include "grid/grid.h"
#include "grid/line.h"

/**
 * Class calculates all lines of a grid using hough transformation.
 * Consideres all points with a percentage higher than "isSolidPoint" variable.
 * Contains a method to write the lines to file (GnuPlot or own lin)
 *
 * @author Uwe Hebbelmann, Sebastian Stock, Andre Schemschat
 *
 * @date 25.02.2008
 */
class gridlines
{
 private:
    /** Minimal percentage for a solid point relevant for a line */
    double isSolidPoint;

    /** contains all lines of the grid */
    vector<line> lines;

 public:
    /** @brief CTOR */
    gridlines(grid* g, int max_distance, double isSolidPoint);

    /**
     * @brief Creates the lines for the grid g and stores them in the vector "lines"
     */
    void createLines(grid* g, int max_distance);

    /** @brief Returns the vector with the lines */
    vector<line>* getLines();

    /** @brief Writes the lines to a gnuplot file */
    void writeGnuPlot(string file);

    /** @brief Writes the lines to a lin file */
    void writeLin(string file);
};

#endif


text:
{% extends "fancypages/block.html" %}
{% load fp_block_tags %}

{% block block_content %}
{% render_attribute "text" "safe" %}
{% endblock %}


text:
<?php

declare(strict_types=1);

/*
 * This file is part of the GeckoPackages.
 *
 * (c) GeckoPackages https://github.com/GeckoPackages
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace GeckoPackages\Bson;

/**
 * Iterator (reader) for BSON files.
 *
 * Reads BSON files @see https://en.wikipedia.org/wiki/BSON as produced by
 * `mongodump` @see https://docs.mongodb.com/manual/reference/program/mongodump/
 * into JSON encoded strings.
 *
 * @api
 *
 * @author SpacePossum
 */
final class BsonFileIterator implements \Iterator
{
    const CONSTRUCT_ARRAY = 2;
    const CONSTRUCT_JSON = 1;
    const CONSTRUCT_STD = 3;

    /**
     * @var string|false
     */
    private $content = false;

    /**
     * @var resource
     */
    private $fileHandle;

    /**
     * @var int >= 0
     */
    private $key = 0;

    /**
     * @var int >= 0
     */
    private $maxUnpackSize;

    /**
     * @var callable
     */
    private $decoder;

    /**
     * @param string|\SplFileInfo $file               file to read
     * @param int                 $constructType      see class "CONSTRUCT_*" constants
     * @param int                 $maxUnpackSize      in bytes, > 0, never bigger than the file size, default 5MiB
     * @param int                 $jsonDecodeMaxDepth used for "CONSTRUCT_ARRAY" and "CONSTRUCT_STD", @see https://secure.php.net/manual/en/function.json-decode.php
     * @param int                 $jsonDecodeOptions  used for "CONSTRUCT_ARRAY" and "CONSTRUCT_STD", @see https://secure.php.net/manual/en/function.json-decode.php
     *
     * @throws \InvalidArgumentException
     */
    public function __construct(
        $file,
        int $constructType = 1,
        int $maxUnpackSize = 5242880, // 5*1024*1024 bytes
        int $jsonDecodeMaxDepth = 512,
        int $jsonDecodeOptions = 0
    ) {
        $this->resolveFileHandle($file);
        $this->resolveDecoder($constructType, $jsonDecodeMaxDepth, $jsonDecodeOptions);
        $this->resolveMaxUnpackSize($maxUnpackSize, $file instanceof \SplFileInfo ? $file->getPathname() : $file);
    }

    public function __destruct()
    {
        @\fclose($this->fileHandle); // best effort
    }

    /**
     * Return type based on config passes during construction.
     *
     * @return string|array|\stdClass|false
     */
    public function current()
    {
        return $this->content;
    }

    /**
     * Integer set to 0 on start, increments on reading an item from file.
     *
     * Note: the key is always set as the position of an item in a file.
     * It is _not_ derived from the data within the file (therefor also not
     * from the items it contains).
     *
     * @return int >= 0
     */
    public function key()
    {
        return $this->key;
    }

    /**
     * {@inheritdoc}
     *
     * @throws \UnexpectedValueException
     */
    public function next()
    {
        $this->content = \fread($this->fileHandle, 4);
        if (\feof($this->fileHandle)) {
            $this->content = false;

            return;
        }

        \fseek($this->fileHandle, -4, SEEK_CUR);
        $this->content = \unpack('V', $this->content);
        $length = \array_shift($this->content);

        if ($length > $this->maxUnpackSize) {
            throw new \UnexpectedValueException(\sprintf(
                'Invalid data at item #%d, size %d exceeds max. unpack size %d.',
                1 + $this->key, $length, $this->maxUnpackSize
            ));
        }

        $decoder = $this->decoder;
        $this->content = $decoder($this->key, \MongoDB\BSON\toJSON(\fread($this->fileHandle, $length)));

        ++$this->key;
    }

    /**
     * {@inheritdoc}
     */
    public function rewind()
    {
        \fseek($this->fileHandle, 0);
        $this->next(); // implicit sets `$this->content`
        $this->key = 0;
    }

    /**
     * @return bool
     */
    public function valid()
    {
        return false !== $this->content;
    }

    private function resolveFileHandle($file)
    {
        if ($file instanceof \SplFileInfo) {
            $file = $file->getPathname();
        } elseif (!\is_string($file)) {
            throw new \InvalidArgumentException(\sprintf(
                '%s is not a file.',
                \is_object($file) ? \get_class($file) : \gettype($file).(\is_resource($file) ? '' : '#"'.$file.'"')
            ));
        }

        if (!\is_file($file)) {
            throw new \InvalidArgumentException(\sprintf('%s is not a file.', \is_dir($file) ? 'directory#"'.$file.'"' : '"'.$file.'"'));
        }

        if (!\is_readable($file)) {
            throw new \InvalidArgumentException(\sprintf('file "%s" is not readable.', $file));
        }

        $fileHandle = @\fopen($file, 'rb');
        if (false === $fileHandle) {
            $error = \error_get_last();
            throw new \RuntimeException(\sprintf(
                'Failed to open file "%s" for reading.%s',
                $file, null === $error ? '' : ' '.$error['message']
            ));
        }

        $this->fileHandle = $fileHandle;
    }

    private function resolveDecoder(int $constructType, int $jsonDecodeMaxDepth, int $jsonDecodeOptions)
    {
        switch ($constructType) {
            case self::CONSTRUCT_JSON:
                $this->decoder = function ($key, $content) {
                    return $content;
                };

                return;
            case self::CONSTRUCT_ARRAY:
                $assoc = true;

                break;
            case self::CONSTRUCT_STD:
                $assoc = false;

                break;
            default:
                throw new \InvalidArgumentException(\sprintf(
                    'Construct type must be any of integers "%s" got "%d".',
                    \implode(', ', [self::CONSTRUCT_JSON, self::CONSTRUCT_ARRAY, self::CONSTRUCT_STD]), $constructType
                ));
        }

        if ($jsonDecodeMaxDepth < 1) {
            throw new \InvalidArgumentException(\sprintf(
                'Expected integer > 0 for JSON decode max depth, got "%s".',
                \is_object($jsonDecodeMaxDepth) ? \get_class($jsonDecodeMaxDepth) : \gettype($jsonDecodeMaxDepth).(\is_resource($jsonDecodeMaxDepth) ? '' : '#'.$jsonDecodeMaxDepth)
            ));
        }

        $this->decoder = function ($key, $content) use ($assoc, $jsonDecodeMaxDepth, $jsonDecodeOptions) {
            $content = @\json_decode($content, $assoc, $jsonDecodeMaxDepth, $jsonDecodeOptions);
            if (null === $content) {
                throw new \UnexpectedValueException(\sprintf('Invalid JSON "%s" at item #%d.', \json_last_error_msg(), 1 + $key));
            }

            return $content;
        };
    }

    /**
     * @param mixed  $maxUnpackSize
     * @param string $file
     *
     * @throws \InvalidArgumentException
     */
    private function resolveMaxUnpackSize(int $maxUnpackSize, string $file)
    {
        if ($maxUnpackSize <= 0) {
            throw new \InvalidArgumentException(\sprintf(
                'Expected integer > 0 for max. unpack size, got "%s".',
                \is_object($maxUnpackSize) ? \get_class($maxUnpackSize) : \gettype($maxUnpackSize).(\is_resource($maxUnpackSize) ? '' : '#'.$maxUnpackSize)
            ));
        }

        $this->maxUnpackSize = \min($maxUnpackSize, \filesize($file));
    }
}


text:
from twisted.trial import unittest

from twisted.words.protocols.jabber import jid

class JIDParsingTest(unittest.TestCase):
    def testParse(self):
        # Basic forms
        self.assertEquals(jid.parse("user@host/resource"),
                          ("user", "host", "resource"))
        self.assertEquals(jid.parse("user@host"),
                          ("user", "host", None))
        self.assertEquals(jid.parse("host"),
                          (None, "host", None))
        self.assertEquals(jid.parse("host/resource"),
                          (None, "host", "resource"))

        # More interesting forms
        self.assertEquals(jid.parse("foo/bar@baz"),
                          (None, "foo", "bar@baz"))
        self.assertEquals(jid.parse("boo@foo/bar@baz"),
                          ("boo", "foo", "bar@baz"))
        self.assertEquals(jid.parse("boo@foo/bar/baz"),
                          ("boo", "foo", "bar/baz"))
        self.assertEquals(jid.parse("boo/foo@bar@baz"),
                          (None, "boo", "foo@bar@baz"))
        self.assertEquals(jid.parse("boo/foo/bar"),
                          (None, "boo", "foo/bar"))
        self.assertEquals(jid.parse("boo//foo"),
                          (None, "boo", "/foo"))

    def testInvalid(self):
        # No host
        try:
            jid.parse("user@")
            assert 0
        except jid.InvalidFormat:
            assert 1

        # Double @@
        try:
            jid.parse("user@@host")
            assert 0
        except jid.InvalidFormat:
            assert 1

        # Multiple @
        try:
            jid.parse("user@host@host")
            assert 0
        except jid.InvalidFormat:
            assert 1

    def testPrep(self):
        # case map of user
        self.assertEquals(jid.prep("UsEr", "host", "resource"),
                          ("user", "host", "resource"))

        # case map of host
        self.assertEquals(jid.prep("user", "hoST", "resource"),
                          ("user", "host", "resource"))

        # no case map of resource
        self.assertNotEquals(jid.prep("user", "host", "Resource"),
                             ("user", "host", "resource"))

class JIDClassTest(unittest.TestCase):
    def testBasic(self):
        j = jid.internJID("user@host")
        self.assertEquals(j.userhost(), "user@host")
        self.assertEquals(j.user, "user")
        self.assertEquals(j.host, "host")
        self.assertEquals(j.resource, None)

        j2 = jid.internJID("user@host")
        self.assertEquals(id(j), id(j2))

        j_uhj = j.userhostJID()
        self.assertEquals(id(j), id(j_uhj))


text:
//
//  EFCircularTrig.h
//
//
//  Created by Eliot Fowler on 12/3/13.
//  Copyright (c) 2013 Eliot Fowler. All rights reserved.
//

#import <Foundation/Foundation.h>

/**
 *  Helper class that provides interfaces for calculations involving trigonometry.
 *  Also includes function for drawing arcs.
 */
@interface EFCircularTrig : NSObject

/**
 *  Determines the angle between two points on a circle
 *
 *  @param fromPoint Point on the circle circumference
 *  @param toPoint   Point on the circle circumference
 *
 *  @return Angle in degrees between the two points, relative to North as 0 degrees (clockwise)
 */
+(CGFloat) angleRelativeToNorthFromPoint:(CGPoint)fromPoint
                                 toPoint:(CGPoint)toPoint;

/**
 *  Determine the coordinates of a point on a circle at a given angle
 *
 *  @param radius         Radius of the circle
 *  @param angleFromNorth Angle from North as 0 degrees (clockwise)
 *
 *  @return Point on the circle circumference
 */
+(CGPoint)pointOnRadius:(CGFloat)radius
       atAngleFromNorth:(CGFloat)angleFromNorth;

/**
 *  Draw a filled circle using current context settings
 *
 *  @param ctx    Graphics context within which to fill a circle
 *  @param center Center of the circle to draw
 *  @param radius Radius of the circle to draw
 */
+(void) drawFilledCircleInContext:(CGContextRef)ctx
                           center:(CGPoint)center
                           radius:(CGFloat)radius;

/**
 *  Draw an empty circle with a variable line width using current context settings
 *
 *  @param ctx       Graphics context within which to fill a circle
 *  @param center    Center of the circle to draw
 *  @param radius    Radius of the circle to draw
 *  @param lineWidth Width of line to draw around circle (centered on radius)
 */
+(void) drawUnfilledCircleInContext:(CGContextRef)ctx
                             center:(CGPoint)center
                             radius:(CGFloat)radius
                          lineWidth:(CGFloat)lineWidth;

/**
 *  Draw an unfilled arc (ie partial circle) with a variable line width using current context settings
 *
 *  @param ctx                Graphics context within which to fill a circle
 *  @param center             Center of the circle to draw
 *  @param radius             Radius of the circle to draw
 *  @param lineWidth          Width of line to draw around circle (centered on radius)
 *  @param fromAngleFromNorth Angle in degrees to draw arc from (clockwise)
 *  @param toAngleFromNorth   Angle in degrees to draw arc to (clockwise)
 */
+(void) drawUnfilledArcInContext:(CGContextRef)ctx
                          center:(CGPoint)center
                          radius:(CGFloat)radius
                       lineWidth:(CGFloat)lineWidth
              fromAngleFromNorth:(CGFloat)fromAngleFromNorth
                toAngleFromNorth:(CGFloat)toAngleFromNorth;

/**
 *  Calculates how many degrees an arc spans along the circumference of a circle
 *
 *  @param arcLength Length of arc segment along circle circumference
 *  @param radius    Radius of circle whose circumference arc sits upon
 *
 *  @return Degrees from start of arc to end of arc along circle's circumference
 */
+(CGFloat) degreesForArcLength:(CGFloat)arcLength
            onCircleWithRadius:(CGFloat)radius;

/**
 *  Given an unfilled arc or circle, determine width from arc center to outside edge of line
 *
 *  @param radius    Radius of the arc
 *  @param lineWidth Width of line drawn around arc
 *
 *  @return Distance from center to outer edge of unfilled arc
 */
+(CGFloat) outerRadiuOfUnfilledArcWithRadius:(CGFloat)radius
                                   lineWidth:(CGFloat)lineWidth;

/**
 *  Given an unfilled arc or circle, determine width from arc center to inside edge of line
 *
 *  @param radius    Radius of the arc
 *  @param lineWidth Width of line drawn around arc
 *
 *  @return Distance from center to inner edge of unfilled arc
 */
+(CGFloat)innerRadiusOfUnfilledArcWithRadius:(CGFloat)radius
                                   lineWidth:(CGFloat)lineWidth;

@end


text:
'use strict';

var MemoryStorer = require('./storer/Memory'),
	CacheManager = require('./CacheManager');

module.exports = new CacheManager(new MemoryStorer());


text:
<?php

namespace Olmo\PageBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class OlmoPageBundle extends Bundle
{
}


text:
using System;
using System.Reflection;
using Deq.Search.Soe.Endpoints;
using Deq.Search.Soe.Infastructure.Commands;
using Deq.Search.Soe.Infastructure.Endpoints;
using ESRI.ArcGIS.SOESupport;

namespace Deq.Search.Soe.Commands {
    /// <summary>
    ///     Creates the SOE rest implementation. Searches the assembly and adds all endpoints denoted
    ///     with the Endpoint attribute.
    /// </summary>
    public class CreateRestImplementationCommand : Command<SoeRestImpl> {
        private const string Restoperation = "RestOperation";

        private readonly Assembly _assemblyToScan;

        /// <summary>
        ///     Initializes a new instance of the <see cref="CreateRestImplementationCommand" /> class.
        /// </summary>
        /// <param name="assembly"> The assembly. </param>
        public CreateRestImplementationCommand(Assembly assembly) {
            _assemblyToScan = assembly;
        }

        /// <summary>
        ///     code to execute when command is run. adds a default ResourceHandler and scans assembly
        ///     for all OperationHandlers marked with the EndpointAttribute
        /// </summary>
        protected override void Execute() {
            var resource = new RestResource(typeof (VersionEndpoint).Assembly.FullName, false, VersionEndpoint.Handler);

            foreach (var type in CommandExecutor.ExecuteCommand(
                new FindAllEndpointsCommand(_assemblyToScan))) {
                if (!typeof (IRestEndpoint).IsAssignableFrom(type)) {
                    continue;
                }

                var methodInfo = type.GetMethod(Restoperation);
                var instance = Activator.CreateInstance(type);

                var restOperation = methodInfo.Invoke(instance, null) as RestOperation;

                if (restOperation == null) {
                    continue;
                }

                resource.operations.Add(restOperation);
            }

            Result = new SoeRestImpl(Assembly.GetExecutingAssembly().FullName, resource);
        }

        public override string ToString() {
            return string.Format("{0}", "CreateRestImplementationCommand");
        }
    }
}


text:
/**
 * Class Declaration Processor for the CellScript Parser
 */

var parserUtils = require("js-parser-utils"),
    validators = parserUtils.validators,
    constants = parserUtils.constants,
    utils = parserUtils.utils,
    ExtensionManager = new parserUtils.ExtensionManager();

/// public interface ///
module.exports = {

    tokenType: "keyword/"+constants.moduleKeyword,

    include: function(extensionDefinition) {
        ExtensionManager.include(extensionDefinition)
    },

    canProcess: function(state) {
        var result = ExtensionManager.inject("canProcess", this, state, utils);
        if(result.hasResult) return result.value;
        return validators.isModule(state);
    },

    process: function(state) {
        state.leaf();

        state.item.type = "module";
        state.next(); // Skip the module marker.

        var result = ExtensionManager.inject("process", this, state, utils);
        if(result.hasResult) return result.value;

        utils.block(state, "function", "module");
    }

};


text:
namespace operations_research {
namespace sat {

// This class represents a number in [0, ub]. The encoding uses ub binary
// variables x_i with i in [0, ub) where x_i means that the number is > i. It is
// called an EncodingNode, because it represents one node of the tree used to
// encode a cardinality constraint.
//
// In practice, not all literals are explicitly created:
// - Only the literals in [lb, current_ub) are "active" at a given time.
// - The represented number is known to be >= lb.
// - It may be greater than current_ub, but the extra literals will be only
//   created lazily. In all our solves, the literal current_ub - 1, will always
//   be assumed to false (i.e. the number will be <= current_ub - 1).
// - Note that lb may increase and ub decrease as more information is learned
//   about this node by the sat solver.
//
// This is roughly based on the cardinality constraint encoding described in:
// Bailleux and Yacine Boufkhad, "Efficient CNF Encoding of Boolean Cardinality
// Constraints", In Proc. of CP 2003, pages 108-122, 2003.
class EncodingNode {
 public:
  EncodingNode() {}

  // Constructs a EncodingNode of size one, just formed by the given literal.
  explicit EncodingNode(Literal l);

  // Creates a "full" encoding node on n new variables, the represented number
  // beeing in [lb, ub = lb + n). The variables are added to the given solver
  // with the basic implications linking them:
  //   literal(0) >= ... >= literal(n-1)
  void InitializeFullNode(int n, EncodingNode* a, EncodingNode* b,
                          SatSolver* solver);

  // Creates a "lazy" encoding node representing the sum of a and b.
  // Only one literals will be created by this operation. Note that no clauses
  // linking it with a or b are added by this function.
  void InitializeLazyNode(EncodingNode* a, EncodingNode* b, SatSolver* solver);

  // Returns a literal with the meaning 'this node number is > i'.
  // The given i must be in [lb_, current_ub).
  Literal GreaterThan(int i) const { return literal(i - lb_); }

  // Accessors to size() and literals in [lb, current_ub).
  int size() const { return literals_.size(); }
  Literal literal(int i) const {
    CHECK_GE(i, 0);
    CHECK_LT(i, literals_.size());
    return literals_[i];
  }

  // Sort by decreasing depth first and then by increasing variable index.
  // This is meant to be used by the priority queue in MergeAllNodesWithPQ().
  bool operator<(const EncodingNode& other) const {
    return depth_ > other.depth_ ||
           (depth_ == other.depth_ && other.for_sorting_ > for_sorting_);
  }

  // Creates a new literals and increases current_ub.
  // Returns false if we were already at the upper bound for this node.
  bool IncreaseCurrentUB(SatSolver* solver);

  // Removes the left-side literals fixed to 1 and returns the number of
  // literals removed this way. Note that this increases lb_ and reduces the
  // number of active literals. It also removes any right-side literals fixed to
  // 0. If such a literal exists, ub is updated accordingly.
  int Reduce(const SatSolver& solver);

  // Fix the right-side variables with indices >= to the given upper_bound to
  // false.
  void ApplyUpperBound(int64 upper_bound, SatSolver* solver);

  void set_weight(Coefficient w) { weight_ = w; }
  Coefficient weight() const { return weight_; }

  int depth() const { return depth_; }
  int lb() const { return lb_; }
  int current_ub() const { return lb_ + literals_.size(); }
  int ub() const { return ub_; }
  EncodingNode* child_a() const { return child_a_; }
  EncodingNode* child_b() const { return child_b_; }

 private:
  int depth_;
  int lb_;
  int ub_;
  BooleanVariable for_sorting_;

  Coefficient weight_;
  EncodingNode* child_a_;
  EncodingNode* child_b_;

  // The literals of this node in order.
  std::vector<Literal> literals_;
};

// Note that we use <= because on 32 bits architecture, the size will actually
// be smaller than 64 bytes.
COMPILE_ASSERT(sizeof(EncodingNode) <= 64,
               ERROR_EncodingNode_is_not_well_compacted);

// Merges the two given EncodingNodes by creating a new node that corresponds to
// the sum of the two given ones. Only the left-most binary variable is created
// for the parent node, the other ones will be created later when needed.
EncodingNode LazyMerge(EncodingNode* a, EncodingNode* b, SatSolver* solver);

// Increases the size of the given node by one. To keep all the needed relations
// with its children, we also need to increase their size by one, and so on
// recursively. Also adds all the necessary clauses linking the newly added
// literals.
void IncreaseNodeSize(EncodingNode* node, SatSolver* solver);

// Merges the two given EncodingNode by creating a new node that corresponds to
// the sum of the two given ones. The given upper_bound is interpreted as a
// bound on this sum, and allows creating fewer binary variables.
EncodingNode FullMerge(Coefficient upper_bound, EncodingNode* a,
                       EncodingNode* b, SatSolver* solver);

// Merges all the given nodes two by two until there is only one left. Returns
// the final node which encodes the sum of all the given nodes.
EncodingNode* MergeAllNodesWithDeque(Coefficient upper_bound,
                                     const std::vector<EncodingNode*>& nodes,
                                     SatSolver* solver,
                                     std::deque<EncodingNode>* repository);

// Same as MergeAllNodesWithDeque() but use a priority queue to merge in
// priority nodes with smaller sizes.
EncodingNode* LazyMergeAllNodeWithPQ(const std::vector<EncodingNode*>& nodes,
                                     SatSolver* solver,
                                     std::deque<EncodingNode>* repository);

// Returns a vector with one new EncodingNode by variable in the given
// objective. Sets the offset to the negated sum of the negative coefficient,
// because in this case we negate the literals to have only positive
// coefficients.
std::vector<EncodingNode*> CreateInitialEncodingNodes(
    const std::vector<Literal>& literals,
    const std::vector<Coefficient>& coeffs, Coefficient* offset,
    std::deque<EncodingNode>* repository);
std::vector<EncodingNode*> CreateInitialEncodingNodes(
    const LinearObjective& objective_proto, Coefficient* offset,
    std::deque<EncodingNode>* repository);

// Reduces the nodes using the now fixed literals, update the lower-bound, and
// returns the set of assumptions for the next round of the core-based
// algorithm. Returns an empty set of assumptions if everything is fixed.
std::vector<Literal> ReduceNodesAndExtractAssumptions(
    Coefficient upper_bound, Coefficient stratified_lower_bound,
    Coefficient* lower_bound, std::vector<EncodingNode*>* nodes,
    SatSolver* solver);

// Returns the minimum weight of the nodes in the core. Note that the literal in
// the core must appear in the same order as the one in nodes.
Coefficient ComputeCoreMinWeight(const std::vector<EncodingNode*>& nodes,
                                 const std::vector<Literal>& core);

// Returns the maximum node weight under the given upper_bound. Returns zero if
// no such weight exist (note that a node weight is strictly positive, so this
// make sense).
Coefficient MaxNodeWeightSmallerThan(const std::vector<EncodingNode*>& nodes,
                                     Coefficient upper_bound);

// Updates the encoding using the given core. The literals in the core must
// match the order in nodes.
void ProcessCore(const std::vector<Literal>& core, Coefficient min_weight,
                 std::deque<EncodingNode>* repository,
                 std::vector<EncodingNode*>* nodes, SatSolver* solver);

}  // namespace sat
}  // namespace operations_research

#endif  // OR_TOOLS_SAT_ENCODING_H_


text:
<?php

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

if(!$this->userDetails->user_is_vendor){ ?>
<div class="buttonBar-right">
	<button class="button" type="submit" onclick="javascript:return myValidator(userForm, true);" ><?php echo $this->button_lbl ?></button>

	<button class="button" type="reset" onclick="window.location.href='<?php echo JRoute::_('index.php?option=com_virtuemart&view=user', FALSE); ?>'" ><?php echo vmText::_('COM_VIRTUEMART_CANCEL'); ?></button>
</div>
<?php }
if( $this->userDetails->virtuemart_user_id!=0) {
    echo $this->loadTemplate('vmshopper');
}

echo $this->loadTemplate('address_userfields');

if ($this->userDetails->JUser->get('id') ) {
  echo $this->loadTemplate('address_addshipto');
}

if(!empty($this->virtuemart_userinfo_id)){
	echo '<input type="hidden" name="virtuemart_userinfo_id" value="'.(int)$this->virtuemart_userinfo_id.'" />';
}
?>
<input type="hidden" name="task" value="saveUser" />
<input type="hidden" name="address_type" value="<?php echo $this->address_type; ?>"/>


text:
/*
 * GeoMOOSE Site Configuration
 * This file should never be modified! Please use over rides
 * in the mapbook!
 */

var CONFIGURATION = {
	/** links_bar_html - HTML to be contained in the bar after the header and before the toolbar. */
	'links_bar_html' : "",
	/** waiting_html - Message to use when a user is waiting for something to load. */
	'waiting_html' : 'Loading...',
	/** mapserver_url - The URL to use for MapServer-type map sources. */
	'mapserver_url' : "",
	/** control_panel_side - Change which side on which the control panel resides. */
	'control_panel_side' : 'left',
	/** mapfile_root - The filesystem path on which all mapfiles reside. Used for Mapserver-type map sources. */
	'mapfile_root' : "",
	/** mapbook - The URL to the mapbook. Defaults to php/getmapbook.php. */
	'mapbook' : "php/getmapbook.php",
	/** fractional_zoom - Toggles whether 'in between' zooms or strict steps should be supported. */
	'fractional_zoom' : false,
	/** scales - List of scales to be used in the zoom-ladder. */
	'scales' : [1,2,4,8,16,32,64,128,256,500,1000,5000],
	/** max_extent - The maximum bounding box of the map. */
	'max_extent' : [189783.560000,4816309.330000,761653.524114,5472346.500000],
	/** initial_extent - The initial bounding box view of the map. */
	'initial_extent' : [410438.542057,5125011.551363637,540998.542057,5163644.278636363],
	/** projection - The projection to be used for the map. */
	'projection' : "EPSG:26915",
	/** ground_units - Set the ground units of the map. Defaults to 'm'. */
	'ground_units' : 'm',
	'coordinate_display' : {
		xy: true,	/** coordinate_display.xy - Toggle whether Ground Units will be displayed in the coordinate display. Defaults true. */
		latlon: true,	/** coordinate_display.latlon - Toggle whether Longitude and Latitude will be displayed in the coordinate display. Defaults true. */
		usng: true	/** coordinate_display.usng - Toggle whether U.S. National Grid will be displayed in the coordinate display. Defaults true. */
	},
	/** catalog_name - Set the catalog's label. Defaults to 'Catalog' */
	'catalog_name' : 'Catalog',
	/** group_checkboxes - Allow entire groups to be toggled on or off with a global checkbox. Defaults to true.  */
	'group_checkboxes' : true,
	/** flashy_bits - Toggles Animations on or off. Defaults to true*/
	'flashy_bits' : true,
	/** zoomto - Object representing the zoom to drop downs. */
	'zoomto' : {},
	/** jumpto_scales - Object containing the label:scale values for the scale jumper. */
	'jumpto_scales' : {
		'1:12000' : 12000,
		'1:2400' : 2400,
		'1:1200' : 1200,
		'1:120' : 120
	},
	/** startup_service - Service to call at startup. Defaults to false */
	'startup_service' : false,
	'toolbar' : {
		'show_labels' : false /** toolbar.show_labels - Toggles whether the toolbar should render all labels by default. Defaults to false. */
	},
	/** layer_control_order - Changes the display order of the layer controls.  Stored as an array. */
	'layer_control_order' : ['activate', 'popups', 'up','down','fade','unfade','refresh','cycle','legend','metadata'],
	/** layer_controls - object containing objects describing the layer controls. */
	'layer_controls' : {
		'activate' : {on: false, tip: 'Activate ${layer} for use with layer contextual tools.'},
		'popups' : {on: false, tip: 'Show Floating Popups for ${layer}'},
		/* Up and down are essentially deprecated, Duck 06/09/2012 */
		'up' : {on: false, tip: 'Move ${layer} up on the stack'},
		'down' : {on: false, tip: 'Move ${layer} down on the stack'},
		'fade' : {on: true, change_percent: 10, tip: 'Fade ${layer}'},
		'unfade' : {on: true, change_percent: 10, tip: 'Unfade ${layer}'},
		'refresh' : {on: false, tip: 'Manually refresh ${layer}'},
		'cycle' : {on: false, tip: 'Refresh ${layer} every 10 seconds', seconds: 10},
		'legend' : {on: true, tip: 'Show legend for ${layer}'},
		'metadata' : {on: true, tip: 'Show metadata for ${layer}'}
	},
	'layer_options' : {
		/** layer_options.transitionEffect - OpenLayers defined transition effect for all layers. Defaults to null. */
		'transitionEffect': "null",
		/** layer_options.buffer - OpenLayers vector layer buffer radius. Defaults to 0. */
		'buffer': 0,
		/** layer_options.ratio - OpenLayers "ratio" for vector layers. Defaults to 1. */
		'ratio': 1
	},
	'catalog' : {
		/** catalog.toggle_controls - Turn on or off the ability to hide the layer controls in the catalog. Defaults to true. */
		'toggle_controls' : true,
		/** catalog.show_controls - Turn on or off the controls in the catalog. Defaults to true. */
		'show_controls' :  true
	},
	/** reference_map - Not yet implemented. */
	'reference_map' : {
		'enabled' : true,
		'maximized' : true,
		'width': 250,
		'height':  100,
		'minimum_ratio' : 10,
		'maximum_ratio' : 20
	},
	/** cursor - Object of CSS cursor definitions */
	'cursor' : {
		/** cursor.pan - CSS for pan tool. */
		pan: "url(cursors/pan.gif) 9 9,url(cursors/pan.cur),move",
		/** cursor.zoomout - CSS for zoomout tool. */
		zoomout: "url(cursors/zoomout2.gif) 5 5,url(cursors/zoomout2.cur),crosshair",
		/** cursor.zoomin - CSS for zoomin tool. */
		zoomin: "url(cursors/zoomin2.gif) 5 5,url(cursors/zoomin2.cur),crosshair",
		/** cursor.measure - CSS for measure tool. */
		measure: "url(cursors/measure2.gif),url(cursors/measure2.cur),crosshair",
		/** cursor.measurearea - CSS for measurearea tool. */
		measurearea: "url(cursors/measure2.gif),url(cursors/measure2.cur),crosshair"
	},
	'scale_line' : {
		/** scale_line.enabled - Toggle whether the scale lien should be displayed on the map. Defaults to true. */
		'enabled' : true,
		/** scale_line.top_units - What units to display on the top of the scale line. */
		'top_units' : 'ft',
		/** scale_line.bottom_units - What units to display on the bottom of the scale line. */
		'bottom_units' : 'mi',
		/** scale_line.width - The width, in pixels, of the scale line. */
		'width' : 200
	},
	/** measure_tool - options for the measure tools. */
	'measure_tool' : {
		/** measure_tool.precision - Number of digits to display in the readings. */
		'precision' : 3,
		/** measure_tool.style - OpenLayers style object. */
		'style' : {
			"Point" : {
				pointRadius: 4,
				graphicName: "square",
				fillColor: "white",
				fillOpacity: 1,
				strokeWidth: 1,
				strokeOpacity: 1,
				strokeColor: "#333333"
			},
			"Line" : {
				strokeWidth: 2,
				strokeColor: "#FF0000"
			},
			"Polygon" : {
				strokeWidth: 2,
				strokeColor: "#FF0000",
				fillColor: "#00FF00",
				fillOpacity: .5
			}
		},
		/** measure_tool.line_units - Default units to use for Line measurements. */
		'line_units' : 'ft',
		/** measure_tool.area_units - Default units to use for Area measurements. */
		'area_units' : 'acre'
	},
	/** default_tool - Tool to default to when GeoMOOSE.activateDefaultTool is called. */
	default_tool: 'pan',
	/** popups - options for controlling the behavior of popups. */
	popups: {
		/** popups.left_offset - This is used in conjunction with popup CSS styling to properly position the mouse after a popup has been dragged. */
		left_offset: 43
	},
	/** services - Options for controlling the behaviour of services. */
	services: {
		/** services.disable_hidden_tabs - Toggle whether to disable tables when they have been hidden. Defaults to false. */
		disable_hidden_tabs: false,
		highlight_layer: 'highlight/highlight'
	},
	/** messages - Object of error messages. */
	messages: {
		/** messages.requirement_failure - Shown when the user does not fill in a required feild. */
		requirement_failure : 'You forgot to fill in a required field!',
		/** messages.invalid_tool - Shown when a user tries to start a tool which is not properly configured. */
		invalid_tool : 'SERVICE CONFIGURATION ERROR! Drawing tool %TOOL% not available!',
		/** messages.service_config_error - Shown when an admin does not properly configure the tools for a service. */
		service_config_error : 'SERVICE CONFIGURATION ERROR! You must specify a default tool when setting "show-tools" to "true"!',
		/** messages.mapbook_invalid - Shown when the server does not return a valid mapbook contents. */
		mapbook_invalid: 'Could not load a mapbook. If you are the system administrator, you should look into this, if you are not the system administrator you should tell them about this. Suggestions:

The mapbook may not be returning XML.

The mapbook may be returning malformed XML.

PHP may not be responding.

',
		/** message.mapbook_version - Shown when a user tries to load a 1.X version of the mapbook. */
		mapbook_version : 'Specified mapbook version %VERSION% is older than 2.0. No promises this will work.',
		/** mapbook_param_error - Shown when the mapbook contains an invalid <param> tag. */
		mapbook_param_error : 'Error reading the value of "%FIELD%", please check your mapbook configuration.',
		/** messages.service_return_error - Shown when a service failes to return valid XML. */
		service_return_error : 'The service you called did not return valid XML. If you are the system administrator, you should look into this, if you are not the system administrator you should tell them about this.'
	}
};