text:
package es.deusto.weblab.client.lab.controller;

//TODO: current reportMessages are not good at all :-(
//TODO: translations

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.json.client.JSONValue;
import com.google.gwt.user.client.Cookies;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.Window.ClosingEvent;
import com.google.gwt.user.client.Window.ClosingHandler;

import es.deusto.weblab.client.HistoryProperties;
import es.deusto.weblab.client.WebLabLabLoader;
import es.deusto.weblab.client.comm.callbacks.ISessionIdCallback;
import es.deusto.weblab.client.comm.callbacks.IUserInformationCallback;
import es.deusto.weblab.client.comm.callbacks.IVoidCallback;
import es.deusto.weblab.client.comm.exceptions.CommException;
import es.deusto.weblab.client.comm.exceptions.core.SessionNotFoundException;
import es.deusto.weblab.client.comm.exceptions.login.LoginException;
import es.deusto.weblab.client.configuration.IConfigurationManager;
import es.deusto.weblab.client.dto.NullSessionID;
import es.deusto.weblab.client.dto.SessionID;
import es.deusto.weblab.client.dto.experiments.Command;
import es.deusto.weblab.client.dto.experiments.Experiment;
import es.deusto.weblab.client.dto.experiments.ExperimentAllowed;
import es.deusto.weblab.client.dto.experiments.ExperimentID;
import es.deusto.weblab.client.dto.reservations.ConfirmedReservationStatus;
import es.deusto.weblab.client.dto.reservations.PostReservationReservationStatus;
import es.deusto.weblab.client.dto.reservations.ReservationStatus;
import es.deusto.weblab.client.dto.users.User;
import es.deusto.weblab.client.lab.comm.ILabCommunication;
import es.deusto.weblab.client.lab.comm.UploadStructure;
import es.deusto.weblab.client.lab.comm.callbacks.IExperimentsAllowedCallback;
import es.deusto.weblab.client.lab.comm.callbacks.IReservationCallback;
import es.deusto.weblab.client.lab.comm.callbacks.IResponseCommandCallback;
import es.deusto.weblab.client.lab.comm.exceptions.NoCurrentReservationException;
import es.deusto.weblab.client.lab.experiments.ExperimentBase;
import es.deusto.weblab.client.lab.experiments.ExperimentFactory;
import es.deusto.weblab.client.lab.experiments.ExperimentFactory.IExperimentLoadedCallback;
import es.deusto.weblab.client.lab.experiments.IBoardBaseController;
import es.deusto.weblab.client.lab.ui.IUIManager;

public class LabController implements ILabController {

	// Constants
	public static final String WAITING_INSTANCES_MIN_POLLING_TIME_PROPERTY = "polling.time.waitinginstances.min";
	public static final String WAITING_INSTANCES_MAX_POLLING_TIME_PROPERTY = "polling.time.waitinginstances.max";
	public static final String WAITING_CONFIRMATION_POLLING_TIME_PROPERTY = "polling.time.waitingconfirmation";
	public static final String WAITING_MIN_POLLING_TIME_PROPERTY = "polling.time.waiting.min";
	public static final String WAITING_MAX_POLLING_TIME_PROPERTY = "polling.time.waiting.max";

	public static final int DEFAULT_WAITING_MIN_POLLING_TIME = 1000;
	public static final int DEFAULT_WAITING_MAX_POLLING_TIME = 10 * 1000;
	public static final int DEFAULT_WAITING_INSTANCES_MIN_POLLING_TIME = 1000;
	public static final int DEFAULT_WAITING_INSTANCES_MAX_POLLING_TIME = 10 * 1000;
	public static final int DEFAULT_WAITING_CONFIRMATION_POLLING_TIME = 400;

	// These two constants are specially useful while debugging the application
	public static final boolean REPORT_BIG_ERROR_ON_STATE_FAILURE = true;
	public static final boolean RETURN_ON_STATE_FAILURE = true;

	// Managers
	private final IConfigurationManager configurationManager;
	private final ILabCommunication communications;
	private IUIManager uimanager;

	// Current session variables
	private SessionID currentSession;
	private final IPollingHandler pollingHandler;
	private ExperimentAllowed[] experimentsAllowed;

	private boolean externallyLoggedIn = false;
	private boolean externallyReserved = false;
	private boolean finishOnClose = true;

	private class SessionVariables {
		private ExperimentBase currentExperimentBase;
		private boolean experimentVisible = false;
		private SessionID reservationId = new NullSessionID();

		public void showExperiment(){
			this.experimentVisible = true;
		}

		public void hideExperiment(){
			this.experimentVisible = true;
		}

		public boolean isExperimentVisible(){
			return this.experimentVisible;
		}

		public void setCurrentExperimentBase(ExperimentBase currentExperimentBase) {
		    this.currentExperimentBase = currentExperimentBase;
		}

		public ExperimentBase getCurrentExperimentBase() {
		    return this.currentExperimentBase;
		}

		public void setReservationId(String reservationId) {
			this.reservationId = new SessionID(reservationId);
		}

		public void removeReservationId() {
			this.reservationId = new NullSessionID();
		}

		public SessionID getReservationId(){
			return this.reservationId;
		}
	}

	private final SessionVariables     sessionVariables = new SessionVariables();
	private final boolean              isMobile;
	private final boolean              isFacebook;

	public LabController(
				IConfigurationManager configurationManager,
				ILabCommunication  communications,
				IPollingHandler       pollingHandler,
				boolean               isMobile,
				boolean               isFacebook
			){
		this.configurationManager = configurationManager;
		this.communications       = communications;
		this.pollingHandler       = pollingHandler;
		this.isMobile             = isMobile;
		this.isFacebook           = isFacebook;

		Window.addWindowClosingHandler(new ClosingHandler() {
			@Override
			public void onWindowClosing(ClosingEvent event) {
				onWindowClose();
			}
		});

		History.addValueChangeHandler(new ValueChangeHandler<String>() {

			@Override
			public void onValueChange(ValueChangeEvent<String> event) {
				if(getCurrentSession() != null && !getCurrentSession().isNull()) {
					HistoryProperties.reloadHistory();
					loadUserHomeWindow();
				}
			}
		});
	}

	private class ExtendedTimer extends Timer{
		IControllerRunnable runnable;
		public ExtendedTimer(IControllerRunnable runnable){
			super();
			this.runnable = runnable;
		}
		@Override
		public void run() {
			this.runnable.run();
		}
	}

	protected void createTimer(int millis, IControllerRunnable runnable){
		final Timer timer = new ExtendedTimer(runnable);
		timer.schedule(millis);
	}

	public interface IControllerRunnable{
		public void run();
	}

	SessionID getCurrentSession(){
		return this.currentSession;
	}

	boolean isFacebook(){
		return this.isFacebook;
	}

	IUIManager getUIManager(){
		return this.uimanager;
	}

	@Override
	public void setUIManager(IUIManager uimanager){
		this.uimanager = uimanager;
	}

	public class TimerCreator{
		public void createTimer(int millis, IControllerRunnable runnable){
			LabController.this.createTimer(millis, runnable);
		}
	}

	@Override
	public void checkSessionIdStillValid(SessionID sessionId, final IValidSessionCallback callback) {
		this.communications.getUserInformation(sessionId, new IUserInformationCallback() {

			@Override
			public void onFailure(CommException e) {
				callback.sessionRejected();
			}

			@Override
			public void onSuccess(User userInformation) {
				callback.sessionConfirmed();
			}
		});
	}

	@Override
	public void setReservationId(String reservationId){
		this.sessionVariables.setReservationId(reservationId);
	}

	@Override
	public void removeReservationId(){
		this.sessionVariables.removeReservationId();
	}

	@Override
	public SessionID getReservationId(){
		return this.sessionVariables.getReservationId();
	}

	@Override
	public boolean isExperimentReserved() {
		return !this.sessionVariables.getReservationId().isNull();
	}

	private void startSession(SessionID sessionID){
		this.currentSession = sessionID;

		this.communications.getUserInformation(this.currentSession, new IUserInformationCallback(){
			@Override
			public void onSuccess(final User userInformation) {
				LabController.this.uimanager.onLoggedIn(userInformation);
			}

			@Override
			public void onFailure(CommException e) {
				LabController.this.uimanager.onError(e.getMessage());
			}
		});
	}

	@Override
	public void login(String username, String password){
		this.communications.login(username, password, new ISessionIdCallback(){
			@Override
			public void onSuccess(SessionID sessionId) {
				LabController.this.startSession(sessionId);
			}

			@Override
			public void onFailure(CommException e) {
				if(e instanceof LoginException){
					LabController.this.uimanager.onWrongLoginOrPasswordGiven();
				}else{
					LabController.this.uimanager.onErrorAndFinishSession(e.getMessage());
				}
			}
		});
	}

	@Override
	public void startLoggedIn(SessionID sessionId, boolean externallyLoggedIn){
		this.externallyLoggedIn = externallyLoggedIn;
		this.startSession(sessionId);
	}

	@Override
	public void startReserved(final SessionID reservationId, final ExperimentID experimentId){
		this.externallyLoggedIn = true;
		this.externallyReserved = true;

		this.currentSession = null;
		setReservationId(reservationId.getRealId());

		final IBoardBaseController boardBaseController = new BoardBaseController(this);
	    final ExperimentFactory factory = new ExperimentFactory(boardBaseController);
	    final IExperimentLoadedCallback experimentLoadedCallback = new IExperimentLoadedCallback() {

			@Override
			public void onFailure(Throwable e) {
				LabController.this.uimanager.onError("Couldn't instantiate experiment: " + e.getMessage());
				e.printStackTrace();
			}

			@Override
			public void onExperimentLoaded(ExperimentBase experimentBase) {
				// Show the experiment
				LabController.this.sessionVariables.setCurrentExperimentBase(experimentBase);
				final ExperimentAllowed defaultExperimentAllowed = new ExperimentAllowed(new Experiment(0, experimentId.getExperimentName(), experimentId.getCategory(), new Date(), new Date()), 100);
				LabController.this.uimanager.onExperimentChosen(defaultExperimentAllowed, experimentBase, true);
				experimentBase.initializeReserved();
				LabController.this.sessionVariables.showExperiment();

				// And start in the queue
				final ReservationStatusCallback reservationStatusCallback = createReservationStatusCallback(experimentId);
				LabController.this.communications.getReservationStatus(reservationId, reservationStatusCallback);
			}
		};
	    factory.experimentFactory(experimentId, experimentLoadedCallback, this.isMobile);
	}

	@Override
	public boolean startedLoggedIn(){
		return this.externallyLoggedIn;
	}

	@Override
	public boolean startedReserved(){
		return this.externallyReserved;
	}

	@Override
	public void logout(){
		this.communications.logout(this.currentSession, new IVoidCallback(){
			@Override
			public void onSuccess() {
				// Sometimes stored with different paths
				Cookies.removeCookie(WebLabLabLoader.LOGIN_WEBLAB_SESSION_ID_COOKIE);
				Cookies.removeCookie(WebLabLabLoader.LOGIN_WEBLAB_SESSION_ID_COOKIE);
				Cookies.removeCookie(WebLabLabLoader.WEBLAB_SESSION_ID_COOKIE);
				Cookies.removeCookie(WebLabLabLoader.WEBLAB_SESSION_ID_COOKIE);
				LabController.this.uimanager.onLoggedOut();
			}

			@Override
			public void onFailure(CommException e) {
				// Sometimes stored with different paths
				Cookies.removeCookie(WebLabLabLoader.LOGIN_WEBLAB_SESSION_ID_COOKIE);
				Cookies.removeCookie(WebLabLabLoader.LOGIN_WEBLAB_SESSION_ID_COOKIE);
				Cookies.removeCookie(WebLabLabLoader.WEBLAB_SESSION_ID_COOKIE);
				Cookies.removeCookie(WebLabLabLoader.WEBLAB_SESSION_ID_COOKIE);
				LabController.this.sessionVariables.hideExperiment();
				LabController.this.uimanager.onErrorAndFinishSession(e.getMessage());
			}
		});
	}

	@Override
	public void retrieveAllowedExperiments() {
		LabController.this.communications.listExperiments(LabController.this.currentSession, new IExperimentsAllowedCallback(){
			@Override
			public void onSuccess(ExperimentAllowed[] experimentsAllowed) {
				LabController.this.experimentsAllowed = experimentsAllowed;
				loadUserHomeWindow();
			}

			@Override
			public void onFailure(CommException e) {
				LabController.this.uimanager.onError(e.getMessage());
			}
		});
	}

	@Override
	public void loadUserHomeWindow(){
		this.uimanager.setAllowedExperiments(this.experimentsAllowed);

		final String selectedExperimentName     = HistoryProperties.getValue(HistoryProperties.EXPERIMENT_NAME);
		final String selectedExperimentCategory = HistoryProperties.getValue(HistoryProperties.EXPERIMENT_CATEGORY);
		if(selectedExperimentName != null && selectedExperimentCategory != null){
			for(ExperimentAllowed experimentAllowed : this.experimentsAllowed){
				final String currentExperimentAllowedName     = experimentAllowed.getExperiment().getName();
				final String currentExperimentAllowedCategory = experimentAllowed.getExperiment().getCategory().getCategory();
				if(currentExperimentAllowedName.equals(selectedExperimentName) && currentExperimentAllowedCategory.equals(selectedExperimentCategory)){
					chooseExperiment(experimentAllowed);
					return;
				}
			}
		}

		HistoryProperties.setValue(HistoryProperties.PAGE, HistoryProperties.HOME);

		this.uimanager.onAllowedExperimentsRetrieved(this.experimentsAllowed);
	}

	@Override
	public void cleanExperimentPanel(){
		if(!this.externallyLoggedIn){
			loadUserHomeWindow();
		}else{
			this.uimanager.onExperimentInteractionFinished();
		}
	}

	@Override
	public void reserveExperiment(ExperimentID experimentId){
		final ReservationStatusCallback reservationStatusCallback = createReservationStatusCallback(experimentId);

		final JSONValue initialData = this.sessionVariables.getCurrentExperimentBase().getInitialData();
		this.communications.reserveExperiment(this.currentSession, experimentId, initialData, reservationStatusCallback);
	}

	private ReservationStatusCallback createReservationStatusCallback(ExperimentID experimentId) {
		// We delegate the reservation on the ReservationHandler class
		final ReservationStatusCallback reservationStatusCallback = new ReservationStatusCallback();

		// Set the different parameters
		reservationStatusCallback.setTimerCreator(new TimerCreator());
		reservationStatusCallback.setUimanager(this.uimanager);
		reservationStatusCallback.setConfigurationManager(this.configurationManager);
		reservationStatusCallback.setPollingHandler(this.pollingHandler);
		reservationStatusCallback.setExperimentBeingReserved(experimentId);
		reservationStatusCallback.setCommunications(this.communications);
		reservationStatusCallback.setController(this);
		reservationStatusCallback.setExperimentBaseBeingReserved(this.sessionVariables.getCurrentExperimentBase());
		return reservationStatusCallback;
	}

	final IReservationCallback postReservationDataCallback = new IReservationCallback() {

		private void onError(String message){
			LabController.this.sessionVariables.hideExperiment();
			LabController.this.uimanager.onCleanReservation();
			LabController.this.uimanager.onError(message);
		}

		@Override
		public void onFailure(CommException e) {
			onError(e.getMessage());
			e.printStackTrace();
		}

		@Override
		public void onSuccess(ReservationStatus reservation) {
			if(!LabController.this.sessionVariables.isExperimentVisible())
				return;

			if(reservation instanceof PostReservationReservationStatus){
				final PostReservationReservationStatus status = (PostReservationReservationStatus)reservation;
				if(status.isFinished()){
					LabController.this.sessionVariables.getCurrentExperimentBase().postEndWrapper(status.getInitialData(), status.getEndData());
				}else{
					final Timer t = new Timer() {

						@Override
						public void run() {
							pollForPostReservationData();
						}
					};
					t.schedule(200);
				}
			}else if(reservation instanceof ConfirmedReservationStatus){
				final Timer t = new Timer() {

					@Override
					public void run() {
						pollForPostReservationData();
					}
				};
				t.schedule(200);
			}else
				this.onError("Unexpected reservation status obtained while waiting for " + PostReservationReservationStatus.class.getName() + ": " + reservation.getClass().getName() + ": " + reservation);
		}
	};

	private void pollForPostReservationData(){
		this.communications.getReservationStatus(this.sessionVariables.getReservationId(), this.postReservationDataCallback);
	}

	private void onWindowClose() {
		if(isExperimentReserved() && this.finishOnClose) {
			this.communications.finishedExperiment(this.sessionVariables.getReservationId(), new IVoidCallback(){
				@Override
				public void onFailure(CommException e) { }

				@Override
				public void onSuccess() { }
			});
		}
	}

	@Override
	public void disableFinishOnClose() {
		this.finishOnClose = false;
	}

	@Override
	public void finishReservation() {
		this.pollingHandler.stop();
		this.sessionVariables.getCurrentExperimentBase().endWrapper();

		this.communications.finishedExperiment(this.sessionVariables.getReservationId(), new IVoidCallback(){

			@Override
			public void onSuccess(){
				if(LabController.this.sessionVariables.getCurrentExperimentBase().expectsPostEnd()
						&& LabController.this.sessionVariables.isExperimentVisible()){

					pollForPostReservationData();

				}else{
					System.out.println("expects post end?" + LabController.this.sessionVariables.getCurrentExperimentBase().expectsPostEnd());
					System.out.println("is experiment visible?" + LabController.this.sessionVariables.isExperimentVisible());
					LabController.this.sessionVariables.hideExperiment();
					LabController.this.uimanager.onCleanReservation();
				}
			}

			@Override
			public void onFailure(CommException e) {
				LabController.this.sessionVariables.hideExperiment();
				LabController.this.uimanager.onCleanReservation();
				LabController.this.uimanager.onError(e.getMessage());
				e.printStackTrace();
			}
		});
	}

	public void cleanExperiment() {

		this.pollingHandler.stop();
		this.sessionVariables.getCurrentExperimentBase().endWrapper();

		this.communications.finishedExperiment(this.sessionVariables.getReservationId(), new IVoidCallback(){
			@Override
			public void onSuccess(){
				LabController.this.sessionVariables.hideExperiment();
				LabController.this.uimanager.onCleanReservation();
			}
			@Override
			public void onFailure(CommException e) {
				LabController.this.sessionVariables.hideExperiment();
				LabController.this.uimanager.onCleanReservation();
			}
		});
	}

	@Override
	public void finishReservationAndLogout(){

		this.pollingHandler.stop();
		this.sessionVariables.getCurrentExperimentBase().endWrapper();

		this.communications.finishedExperiment(this.sessionVariables.getReservationId(), new IVoidCallback(){
			@Override
			public void onSuccess(){
				LabController.this.sessionVariables.hideExperiment();
				LabController.this.uimanager.onCleanReservation();
				LabController.this.logout();
			}
			@Override
			public void onFailure(CommException e) {
				LabController.this.sessionVariables.hideExperiment();
				LabController.this.uimanager.onCleanReservation();
				LabController.this.logout();
			}
		});
	}

	/**
	 * Sends a command to be executed asynchronously on the server side.
	 * @param  command Command to execute
	 * @param callback Callback through which to notify when the request has finished,
	 * which might take a while.
	 */
	@Override
	public void sendAsyncCommand(Command command, IResponseCommandCallback callback) {
		this.communications.sendAsyncCommand(this.sessionVariables.getReservationId(), command, callback);
	}

	/**
	 * Sends a file to be handled asynchronously on the server side.
	 * @param uploadStructure Upload structure describing the file to send
	 * @param callback Callback through which to notify when the request has finished,
	 * which might take a while.
	 */
	@Override
	public void sendAsyncFile(UploadStructure uploadStructure, IResponseCommandCallback callback) {
		this.communications.sendAsyncFile(this.sessionVariables.getReservationId(), uploadStructure, callback);
	}

	/**
	 * Sends a command to be executed synchronously on the server side. Note that this call,
	 * client-side, is still asynchronous.
	 * @param command Command to execute
	 * @param callback Callback through which to notify when the request has finished.
	 */
	@Override
	public void sendCommand(Command command, IResponseCommandCallback callback) {
		this.communications.sendCommand(this.sessionVariables.getReservationId(), command, callback);
	}

	/**
	 * Sends a file to be handled synchronously on the server side. Note that this call,
	 * client-side, is still asynchronous.
	 * @param uploadStructure Upload structure describing the file to send
	 * @param callback Callback through which to notify when the request has finished.
	 */
	@Override
	public void sendFile(UploadStructure uploadStructure, IResponseCommandCallback callback) {
	    GWT.log("sendFile en communications", null);
		this.communications.sendFile(this.sessionVariables.getReservationId(), uploadStructure, callback);
	}

	@Override
	public void poll(){
		this.communications.poll(
				this.sessionVariables.getReservationId(),
				new IVoidCallback(){
					@Override
					public void onSuccess() {
						// Nothing to do
					}

					@Override
					public void onFailure(CommException e) {
						if(e instanceof NoCurrentReservationException){
							LabController.this.finishReservation();
						} else if (e instanceof SessionNotFoundException) {
							LabController.this.finishReservationAndLogout();
						} else {
							LabController.this.sessionVariables.hideExperiment();
							LabController.this.uimanager.onErrorAndFinishReservation(e.getMessage());
							LabController.this.cleanExperiment();
						}
					}
				}
			);
	}

	@Override
	public void chooseExperiment(final ExperimentAllowed experimentAllowed) {
		final Map<String, String> newHistoryValues = new HashMap<String, String>();
		newHistoryValues.put(HistoryProperties.EXPERIMENT_CATEGORY, experimentAllowed.getExperiment().getCategory().getCategory());
		newHistoryValues.put(HistoryProperties.EXPERIMENT_NAME,     experimentAllowed.getExperiment().getName());
		newHistoryValues.put(HistoryProperties.PAGE,                HistoryProperties.EXPERIMENT);
		HistoryProperties.setValues(newHistoryValues);

	    final IBoardBaseController boardBaseController = new BoardBaseController(this);
	    final ExperimentFactory factory = new ExperimentFactory(boardBaseController);
	    final IExperimentLoadedCallback experimentLoadedCallback = new IExperimentLoadedCallback() {

			@Override
			public void onFailure(Throwable e) {
				LabController.this.uimanager.onError("Couldn't instantiate experiment: " + e.getMessage());
				e.printStackTrace();
			}

			@Override
			public void onExperimentLoaded(ExperimentBase experimentBase) {
				LabController.this.sessionVariables.setCurrentExperimentBase(experimentBase);
				LabController.this.uimanager.onExperimentChosen(experimentAllowed, experimentBase, false);
				experimentBase.initialize();
				LabController.this.sessionVariables.showExperiment();
			}
		};
	    factory.experimentFactory(experimentAllowed.getExperiment().getExperimentUniqueName(), experimentLoadedCallback, this.isMobile);
	}

	@Override
	public void stopPolling() {
		this.pollingHandler.stop();
	}
}


text:
package cmd

import (
	Config "github.com/cm-igarashi-ryosuke/lazy-awslogs/lib/config"
	"github.com/spf13/cobra"
)

type configSetFlag struct {
	profile string
	region  string
}

var _configSetFlag configSetFlag

// setCmd represents the set command
var configSetCmd = &cobra.Command{
	Use:   "set",
	Short: "Set current config settings",
	Long:  `Set current config settings.`,
	Run:   configSetRun,
}

func configSetRun(cmd *cobra.Command, args []string) {
	config := Config.Load()
	if _configSetFlag.profile != "" {
		config.SetCurrentEnvironmentParam(Config.Profile, _configSetFlag.profile)
	}
	if _configSetFlag.region != "" {
		config.SetCurrentEnvironmentParam(Config.Region, _configSetFlag.region)
	}
}

func init() {
	configCmd.AddCommand(configSetCmd)
	configSetCmd.Flags().StringVarP(&_configSetFlag.profile, "config-profile", "", "", "Set default AWS credentials profile")
	configSetCmd.Flags().StringVarP(&_configSetFlag.region, "config-region", "", "", "Set default AWS Region")
}

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8"?>
<plugin_manifest>
        <field key="author" value="Curverider" />
        <field key="version" value="1.5" />
        <field key="description" value="Elgg notifications plugin" />
        <field key="website" value="http://www.elgg.org/" />
        <field key="copyright" value="(C) Curverider 2008-2009" />
        <field key="licence" value="GNU Public License version 2" />
        <field key="elgg_version" value="2009030702" />
</plugin_manifest>


text:
import * as React from 'react';
import * as Popper from 'popper.js';
import { CSSModule } from '../index';

export interface DropdownMenuProps extends React.HTMLAttributes<HTMLElement> {
    [key: string]: any;
    tag?: string | React.ReactType;
    right?: boolean;
    className?: string;
    cssModule?: CSSModule;
    flip?: boolean;
    modifiers?: Popper.Modifiers;
    persist?: boolean;
    positionFixed?: boolean;
}

declare class DropdownMenu<T = {[key: string]: any}> extends React.Component<DropdownMenuProps> {}
export default DropdownMenu;


text:
Test for binding output parameter of encrypted values for all types
--SKIPIF--
<?php require('skipif_versions_old.inc'); ?>
--FILE--
<?php
require_once('MsCommon.inc');

$conn = AE\connect();

// Create the table
$tbname = GetTempTableName("", false);
$colMetaArr = array( new AE\ColumnMeta("int", "c1_int"),
                     new AE\ColumnMeta("smallint", "c2_smallint"),
                     new AE\ColumnMeta("tinyint", "c3_tinyint"),
                     new AE\ColumnMeta("bit", "c4_bit"),
                     new AE\ColumnMeta("bigint", "c5_bigint"),
                     new AE\ColumnMeta("decimal(18,5)", "c6_decimal"),
                     new AE\ColumnMeta("numeric(10,5)", "c7_numeric"),
                     new AE\ColumnMeta("float", "c8_float"),
                     new AE\ColumnMeta("real", "c9_real"),
                     new AE\ColumnMeta("date", "c10_date"),
                     new AE\ColumnMeta("datetime", "c11_datetime"),
                     new AE\ColumnMeta("datetime2", "c12_datetime2"),
                     new AE\ColumnMeta("datetimeoffset", "c13_datetimeoffset"),
                     new AE\ColumnMeta("time", "c14_time"),
                     new AE\ColumnMeta("char(5)", "c15_char"),
                     new AE\ColumnMeta("varchar(max)", "c16_varchar"),
                     new AE\ColumnMeta("nchar(5)", "c17_nchar"),
                     new AE\ColumnMeta("nvarchar(max)", "c18_nvarchar"));
AE\createTable($conn, $tbname, $colMetaArr);

// Create a Store Procedure
$spname = 'selectAllColumns';
createProc($conn, $spname, "@c1_int int OUTPUT, @c2_smallint smallint OUTPUT,
                @c3_tinyint tinyint OUTPUT, @c4_bit bit OUTPUT,
                @c5_bigint bigint OUTPUT, @c6_decimal decimal(18,5) OUTPUT,
                @c7_numeric numeric(10,5) OUTPUT, @c8_float float OUTPUT,
                @c9_real real OUTPUT, @c10_date date OUTPUT,
                @c11_datetime datetime OUTPUT, @c12_datetime2 datetime2 OUTPUT,
                @c13_datetimeoffset datetimeoffset OUTPUT, @c14_time time OUTPUT,
                @c15_char char(5) OUTPUT, @c16_varchar varchar(max) OUTPUT,
                @c17_nchar nchar(5) OUTPUT, @c18_nvarchar nvarchar(max) OUTPUT", "SELECT @c1_int = c1_int, @c2_smallint = c2_smallint,
                @c3_tinyint = c3_tinyint, @c4_bit = c4_bit,
                @c5_bigint = c5_bigint, @c6_decimal = c6_decimal,
                @c7_numeric = c7_numeric, @c8_float = c8_float,
                @c9_real = c9_real, @c10_date = c10_date,
                @c11_datetime = c11_datetime, @c12_datetime2 = c12_datetime2,
                @c13_datetimeoffset = c13_datetimeoffset, @c14_time = c14_time,
                @c15_char = c15_char, @c16_varchar = c16_varchar,
                @c17_nchar = c17_nchar, @c18_nvarchar = c18_nvarchar
                FROM $tbname");
// Insert data
$inputs = array( "c1_int" => 2147483647,
                 "c2_smallint" => 32767,
                 "c3_tinyint" => 255,
                 "c4_bit" => 1,
                 "c5_bigint" => 922337203685479936,
                 "c6_decimal" => 9223372036854.80000,
                 "c7_numeric" => 21474.83647,
                 "c8_float" => 9223372036.8548,
                 "c9_real" => 2147.483,
                 "c10_date" => '9999-12-31',
                 "c11_datetime" => '9999-12-31 23:59:59.997',
                 "c12_datetime2" => '9999-12-31 23:59:59.9999999',
                 "c13_datetimeoffset" => '9999-12-31 23:59:59.9999999 +14:00',
                 "c14_time" => '23:59:59.9999999',
                 "c15_char" => 'th, n',
                 "c16_varchar" => 'This large row size can cause errors (such as error 512) during some normal operations, such as a clustered index key update, or sorts of the full column set, which users cannot anticipate until performing an operation.',
                 "c17_nchar" => 'th Un',
                 "c18_nvarchar" => 'When prefixing a string constant with the letter N, the implicit conversion will result in a Unicode string if the constant to convert does not exceed the max length for a Unicode string data type (4,000).' );
$stmt = AE\insertRow($conn, $tbname, $inputs);

// Call store procedure
$outSql = AE\getCallProcSqlPlaceholders($spname, count($inputs));

$intOut = 0;
$smallintOut = 0;
$tinyintOut = 0;
$bitOut = 0;
$bigintOut = 0.0;
$decimalOut = 0.0;
$numericOut = 0.0;
$floatOut = 0.0;
$realOut = 0.0;
$dateOut = '';
$datetimeOut = '';
$datetime2Out = '';
$datetimeoffsetOut = '';
$timeOut = '';
$charOut = '';
$varcharOut = '';
$ncharOut = '';
$nvarcharOut = '';
$stmt = sqlsrv_prepare($conn, $outSql, array( array( &$intOut, SQLSRV_PARAM_OUT ),
                                        array( &$smallintOut, SQLSRV_PARAM_OUT ),
                                        array( &$tinyintOut, SQLSRV_PARAM_OUT ),
                                        array( &$bitOut, SQLSRV_PARAM_OUT ),
                                        array( &$bigintOut, SQLSRV_PARAM_OUT ),
                                        array( &$decimalOut, SQLSRV_PARAM_OUT ),
                                        array( &$numericOut, SQLSRV_PARAM_OUT ),
                                        array( &$floatOut, SQLSRV_PARAM_OUT ),
                                        array( &$realOut, SQLSRV_PARAM_OUT ),
                                        array( &$dateOut, SQLSRV_PARAM_OUT ),
                                        array( &$datetimeOut, SQLSRV_PARAM_OUT ),
                                        array( &$datetime2Out, SQLSRV_PARAM_OUT ),
                                        array( &$datetimeoffsetOut, SQLSRV_PARAM_OUT ),
                                        array( &$timeOut, SQLSRV_PARAM_OUT ),
                                        array( &$charOut, SQLSRV_PARAM_OUT ),
                                        array( &$varcharOut, SQLSRV_PARAM_OUT ),
                                        array( &$ncharOut, SQLSRV_PARAM_OUT ),
                                        array( &$nvarcharOut, SQLSRV_PARAM_OUT )));
sqlsrv_execute($stmt);

print("intOut: " . $intOut . "\n");
print("smallintOut: " . $smallintOut . "\n");
print("tinyintOut: " . $tinyintOut . "\n");
print("bitOut: " . $bitOut . "\n");
print("bigintOut: " . $bigintOut . "\n");
print("decimalOut: " . $decimalOut . "\n");
print("numericOut: " . $numericOut . "\n");
print("floatOut: " . $floatOut . "\n");
print("realOut: " . $realOut . "\n");
print("dateOut: " . $dateOut . "\n");
print("datetimeOut: " . $datetimeOut . "\n");
print("datetime2Out: " . $datetime2Out . "\n");
print("datetimeoffsetOut: " . $datetimeoffsetOut . "\n");
print("timeOut: " . $timeOut . "\n");
print("charOut: " . $charOut . "\n");
print("varcharOut: " . $varcharOut . "\n");
print("ncharOut: " . $ncharOut . "\n");
print("nvarcharOut: " . $nvarcharOut . "\n");

sqlsrv_query($conn, "DROP PROCEDURE $spname");
sqlsrv_query($conn, "DROP TABLE $tbname");
sqlsrv_free_stmt($stmt);
sqlsrv_close($conn);

?>
--EXPECTREGEX--
intOut: 2147483647
smallintOut: 32767
tinyintOut: 255
bitOut: 1
bigintOut: 9.2233720368548E\+17
decimalOut: 9223372036854\.8
numericOut: 21474\.83647
floatOut: 9223372036\.8548
realOut: 2147\.4829101562
dateOut: 9999-12-31
datetimeOut: (9999-12-31 23:59:59\.997|Dec 31 9999 11:59PM)
datetime2Out: 9999-12-31 23:59:59\.9999999
datetimeoffsetOut: 9999-12-31 23:59:59\.9999999 \+14:00
timeOut: 23:59:59\.9999999
charOut: th\, n
varcharOut: This large row size can cause errors \(such as error 512\) during some normal operations\, such as a clustered index key update\, or sorts of the full column set\, which users cannot anticipate until performing an operation\.
ncharOut: th Un
nvarcharOut: When prefixing a string constant with the letter N\, the implicit conversion will result in a Unicode string if the constant to convert does not exceed the max length for a Unicode string data type \(4,000\)\.


text:
var should = require('should'), // jshint ignore:line
    sinon = require('sinon'),
    getTitle = require('../../../server/data/meta/title'),
    settingsCache = require('../../../server/settings/cache'),
    sandbox = sinon.sandbox.create();

describe('getTitle', function () {
    var localSettingsCache = {};

    beforeEach(function () {
        sandbox.stub(settingsCache, 'get', function (key) {
            return localSettingsCache[key];
        });
    });

    afterEach(function () {
        sandbox.restore();
        localSettingsCache = {};
    });

    it('should return meta_title if on data root', function () {
        var title = getTitle({
            meta_title: 'My test title'
        });

        title.should.equal('My test title');
    });

    it('should return blog title if on home', function () {
        localSettingsCache.title = 'My blog title';

        var title = getTitle({}, {context: 'home'});
        title.should.equal('My blog title');
    });

    it('should return author name - blog title if on data author page', function () {
        localSettingsCache.title = 'My blog title 2';

        var title = getTitle({
            author: {
                name: 'Author Name'
            }
        }, {context: ['author']});

        title.should.equal('Author Name - My blog title 2');
    });

    it('should return author page title if on data author page with more then one page', function () {
        localSettingsCache.title = 'My blog title 2';

        var title = getTitle({
            author: {
                name: 'Author Name'
            }
        }, {
            context: ['author'],
            pagination: {
                total: 40,
                page: 3
            }
        });

        title.should.equal('Author Name - Page 3 - My blog title 2');
    });

    it('should return tag name - blog title if on data tag page no meta_title', function () {
        localSettingsCache.title = 'My blog title 3';

        var title = getTitle({
            tag: {
                name: 'Tag Name'
            }
        }, {context: ['tag']});

        title.should.equal('Tag Name - My blog title 3');
    });

    it('should return tag name - page - blog title if on data tag page no meta_title', function () {
        localSettingsCache.title = 'My blog title 3';

        var title = getTitle({
            tag: {
                name: 'Tag Name'
            }
        }, {
            context: ['tag'],
            pagination: {
                total: 40,
                page: 39
            }
        });

        title.should.equal('Tag Name - Page 39 - My blog title 3');
    });

    it('should return tag meta_title if in tag data', function () {
        var title = getTitle({
            tag: {
                name: 'Tag Name',
                meta_title: 'My Tag Meta Title!'
            }
        }, {context: ['tag']});

        title.should.equal('My Tag Meta Title!');
    });

    it('should return post title if in post context', function () {
        var title = getTitle({
            post: {
                title: 'My awesome post!'
            }
        }, {context: ['post']});

        title.should.equal('My awesome post!');
    });

    it('should return post title if in amp context', function () {
        var title = getTitle({
            post: {
                title: 'My awesome post!'
            }
        }, {context: ['amp', 'post']});

        title.should.equal('My awesome post!');
    });

    it('should return post title if in page context', function () {
        var title = getTitle({
            post: {
                title: 'My awesome page!'
            }
        }, {context: ['page']});

        title.should.equal('My awesome page!');
    });

    it('should return post title if in amp and page context', function () {
        var title = getTitle({
            post: {
                title: 'My awesome page!'
            }
        }, {context: ['amp', 'page']});

        title.should.equal('My awesome page!');
    });

    it('should return post meta_title if in post data', function () {
        var title = getTitle({
            post: {
                name: 'My awesome post!',
                meta_title: 'My Tag Meta Title Post!  '
            }
        }, {context: ['post']});

        title.should.equal('My Tag Meta Title Post!');
    });

    it('should return post meta_title if amp context in post data', function () {
        var title = getTitle({
            post: {
                name: 'My awesome post!',
                meta_title: 'My Tag Meta Title Post!  '
            }
        }, {context: ['amp', 'post']});

        title.should.equal('My Tag Meta Title Post!');
    });

    it('should return blog title with page if unknown type', function () {
        localSettingsCache.title = 'My blog title 4';

        var title = getTitle({}, {
            context: ['paged'],
            pagination: {
                total: 40,
                page: 35
            }
        });

        title.should.equal('My blog title 4 - Page 35');
    });
});


text:
<?php namespace App\Action;

use App\Magnet;
use Foolz\SphinxQL\SphinxQL;

class FindRelatedMagnetsAction
{
    public function execute(Magnet $magnet): array
    {
        if (!$magnet->related_query) {
            return [];
        }

        $builder = $magnet->search(
            $magnet->related_query,
            fn (SphinxQL $builder) => $builder->match('title', $magnet->related_query, true)->execute()
        );

        return array_filter(
            \Arr::pluck($builder->raw(), 'id'),
            fn ($item) => intval($item) !== $magnet->id
        );
    }
}


text:
package com.web.common.web.common.util.oss;

import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;

import com.web.common.web.common.util.oss.UploadProgress.STATUS;

/**
 * 上传结束状态通知
 *
 * @author: chengweixiong@uworks.cc
 * @date:2015年10月22日 下午8:32:09
 */
public class ProgressInputStream extends FilterInputStream {
    private static final int NOTIFICATION_THRESHOLD = 8 * 1024;
    private int receivedBytes = 0;
    private UploadProgress progress;

    protected ProgressInputStream(InputStream in, UploadProgress progress) {
        super(in);
        this.progress = progress;
    }

    @Override public int read(byte[] b, int off, int len) throws IOException {
        int byteCount = super.read(b, off, len);
        if (byteCount != -1) {
            receivedBytes += byteCount;
        }

        if (receivedBytes % NOTIFICATION_THRESHOLD == 0 || byteCount == -1) {
            notify(receivedBytes, byteCount);
        }
        return byteCount;

    }

    @Override public void close() throws IOException {
        super.close();
    }

    private void notify(int bytesRead, int lastByte) {
        progress.setRecievedBytes(bytesRead);
        if (lastByte == -1) {
            progress.setStatus(STATUS.FINISH);
        } else {
            progress.setStatus(STATUS.UPLOADING);
        }
    }
}


text:
import unittest

from mitorrent import pieces

class TestPiecesHashing(unittest.TestCase):

    def test_hash_binary_piece(self):
        test = pieces.hash_binary_piece(b'Hello World')
        self.assertEqual(
            test,
            b'\nMU\xa8\xd7x\xe5\x02/\xabp\x19w\xc5\xd8@\xbb\xc4\x86\xd0')

class TestRoundUpTwo(unittest.TestCase):

    def test_round_up_2_neative(self):
        self.assertRaises(ValueError, pieces.round_up_2, -10)

    def test_round_up_2_zero(self):
        self.assertRaises(ValueError, pieces.round_up_2, 0)

    def test_round_up_2_three(self):
        test = pieces.round_up_2(3)
        self.assertEqual(test, 4)

    def test_round_up_2_normal(self):
        test = pieces.round_up_2(1024)
        self.assertEqual(test, 1024)

    def test_round_up_2_large(self):
        test = pieces.round_up_2(1536)
        self.assertEqual(test, 2048)

class TestFindPieceSize(unittest.TestCase):

    def test_find_piece_size_negative(self):
        test = pieces.find_piece_size(-1024)
        self.assertEqual(test, 0)

    def test_find_piece_size_one(self):
        test = pieces.find_piece_size(1)
        self.assertEqual(test, 16384)

    def test_find_piece_size_zero(self):
        test = pieces.find_piece_size(0)
        self.assertEqual(test, 0)

    def test_find_piece_size_14KiB(self):
        test = pieces.find_piece_size(144179199)
        self.assertEqual(test, 65536)

    def test_find_piece_size_30MiB(self):
        test = pieces.find_piece_size(30410000)
        self.assertEqual(test, 65536)

    def test_find_piece_size_760MiB(self):
        test = pieces.find_piece_size(796900000)
        self.assertEqual(test, 524288)

    def test_find_piece_size_1_5GiB(self):
        test = pieces.find_piece_size(1610000000)
        self.assertEqual(test, 1048576)

    def test_find_piece_size_1_5GiB_500MiB_max_length(self):
        test = pieces.find_piece_size(1610000000,
                                      max_piece_length=536870912)
        self.assertEqual(test, 1048576)

    def test_find_piece_size_105TiB_256MiB_max_length(self):
        test = pieces.find_piece_size(115400000000000,
                                      max_piece_length=268435456)
        self.assertEqual(test, 268435456)

    def test_find_piece_size_105TiB_invalid_max_length(self):
        test = pieces.find_piece_size(115400000000000,
                                      max_piece_length=425769801)
        self.assertEqual(test, 16777216)

    def test_find_piece_size_189YiB(self):
        test = pieces.find_piece_size(228500000000000000000000000)
        self.assertEqual(test, 16777216)

    def test_find_piece_size_189YiB_1024MiB_max_length(self):
        test = pieces.find_piece_size(228500000000000000000000000,
                                      max_piece_length=1073741824)
        self.assertEqual(test, 1073741824)

if __name__ == '__main__':
    unittest.main()


text:
package liquibase.database.typeconversion;

import liquibase.database.DatabaseFactory;
import liquibase.database.Database;

public class TypeConversionReport {
    public static void main(String[] args) {
        for (Database database : DatabaseFactory.getInstance().getImplementedDatabases()) {
            TypeConverter typeConverter = TypeConverterFactory.getInstance().findTypeConverter(database);
            System.out.println("Database: "+database.getTypeName()+", Converter: "+typeConverter.getClass().getName());
            System.out.println("'bigint'="+typeConverter.getBigIntType());
            System.out.println("'blob'="+typeConverter.getBlobType());
            System.out.println("'boolean'="+typeConverter.getBooleanType());
            System.out.println("'char'="+typeConverter.getCharType());
            System.out.println("'clob'="+typeConverter.getClobType());
            System.out.println("'currency'="+typeConverter.getCurrencyType());
            System.out.println("'datetime'="+typeConverter.getDateTimeType());
            System.out.println("'double'="+typeConverter.getDoubleType());
            System.out.println("'float'="+typeConverter.getFloatType());
            System.out.println("'int'="+typeConverter.getIntType());
            System.out.println("'time'="+typeConverter.getTimeType());
            System.out.println("'tinyint'="+typeConverter.getTinyIntType());
            System.out.println("'uuid'="+typeConverter.getUUIDType());
            System.out.println("'varchar'="+typeConverter.getVarcharType());

            System.out.println("");
        }
    }
}


text:
from .common import set_mem_rlimit, run_monitored, get_mem_info

import os
import tempfile
import collections
from io import BytesIO

import numpy as np

try:
    from scipy.io import savemat, loadmat
except ImportError:
    pass

from .common import Benchmark

class MemUsage(Benchmark):
    param_names = ['size', 'compressed']
    timeout = 4*60
    unit = "actual/optimal memory usage ratio"

    @property
    def params(self):
        return [list(self._get_sizes().keys()), [True, False]]

    def _get_sizes(self):
        sizes = collections.OrderedDict([
            ('1M', 1e6),
            ('10M', 10e6),
            ('100M', 100e6),
            ('300M', 300e6),
            # ('500M', 500e6),
            # ('1000M', 1000e6),
        ])
        return sizes

    def setup(self, size, compressed):
        set_mem_rlimit()
        self.sizes = self._get_sizes()
        size = int(self.sizes[size])

        mem_info = get_mem_info()
        try:
            mem_available = mem_info['memavailable']
        except KeyError:
            mem_available = mem_info['memtotal']

        max_size = int(mem_available * 0.7)//4

        if size > max_size:
            raise NotImplementedError()

        # Setup temp file
        f = tempfile.NamedTemporaryFile(delete=False, suffix='.mat')
        f.close()
        self.filename = f.name

    def teardown(self, size, compressed):
        os.unlink(self.filename)

    def track_loadmat(self, size, compressed):
        size = int(self.sizes[size])

        x = np.random.rand(size//8).view(dtype=np.uint8)
        savemat(self.filename, dict(x=x), do_compression=compressed, oned_as='row')
        del x

        code = """
        from scipy.io import loadmat
        loadmat('%s')
        """ % (self.filename,)
        time, peak_mem = run_monitored(code)

        return peak_mem / size

    def track_savemat(self, size, compressed):
        size = int(self.sizes[size])

        code = """
        import numpy as np
        from scipy.io import savemat
        x = np.random.rand(%d//8).view(dtype=np.uint8)
        savemat('%s', dict(x=x), do_compression=%r, oned_as='row')
        """ % (size, self.filename, compressed)
        time, peak_mem = run_monitored(code)
        return peak_mem / size

class StructArr(Benchmark):
    params = [
        [(10, 10, 20), (20, 20, 40), (30, 30, 50)],
        [False, True]
    ]
    param_names = ['(vars, fields, structs)', 'compression']

    @staticmethod
    def make_structarr(n_vars, n_fields, n_structs):
        var_dict = {}
        for vno in range(n_vars):
            vname = 'var%00d' % vno
            end_dtype = [('f%d' % d, 'i4', 10) for d in range(n_fields)]
            s_arrs = np.zeros((n_structs,), dtype=end_dtype)
            var_dict[vname] = s_arrs
        return var_dict

    def setup(self, nvfs, compression):
        n_vars, n_fields, n_structs = nvfs

        self.var_dict = StructArr.make_structarr(n_vars, n_fields, n_structs)
        self.str_io = BytesIO()

        savemat(self.str_io, self.var_dict, do_compression=compression)

    def time_savemat(self, nvfs, compression):
        savemat(self.str_io, self.var_dict, do_compression=compression)

    def time_loadmat(self, nvfs, compression):
        loadmat(self.str_io)


text:
<!--
Describe what this PR does. All but trivial changes (e.g. typos)
should start with an issue. Mention the issue number here.
-->

### Checklist ###
<!--
Mark an `[x]` for completed items, if you're not sure leave them unchecked and we can assist.
-->

* [ ] All authors have signed the CLA at https://cla.js.foundation/jquery/jquery
* [ ] New tests have been added to show the fix or feature works
* [ ] Grunt build and unit tests pass locally with these changes
* [ ] If needed, a docs issue/PR was created at https://github.com/jquery/api.jquery.com

<!--
Thanks! Bots and humans will be around shortly to check it out.
-->


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Special Publication College of Agriculture, National Taiwan University 8: 196 (1959)

#### Original name
Acrothecium canavaliae Sawada

### Remarks
null


text:
CommonJS module that fires a browser native event.

Should be compatible with IE6+ and reasonable browsers.

It doesn't perform any validation on the provided event object.

It really just fires it, using either `Element.prototype.dispatchEvent` or `Element.prototype.fireEvent`.

``` js
// Create a native event somehow (this is out of this module's scope)
var createNativeEvent = require("create-event");
var eventType = "click";
var nativeEvent = createNativeEvent(eventType);

// Fire it on an element
var element = document.createElement("div");
var fire = require("fire-native-event");
fire(element, nativeEvent, eventType);
```


text:
function pass = test_splitting(pref)

if ( nargin == 0 )
    pref = chebfunpref();
end

% Store current globlal state.
p = chebfunpref();
chebfunpref.setDefaults('factory')

warnState = warning('off', 'CHEBFUN:splitting:deprecated');

try
    % Testing takes place inside this TRY CATCH.

    pass(1) = strcmp(splitting(), 'off');

    pass(2) = strcmp(splitting('on'), 'off');

    pass(3) = strcmp(splitting(), 'on');

    F = @(x) cos(pi*x).*sign(x);
    f = chebfun(@(x) F(x), [-1 1]);
    x = linspace(-1, 1, 20);
    err = norm(f(x) - F(x), inf);
    pass(4) = numel(f.domain > 1) && err < 2*epslevel(f);

    pass(5) = strcmp(splitting('off'), 'on');

    pass(6) = strcmp(splitting(), 'off');

catch ME
    % Reset preferences and warning state
    chebfunpref.setDefaults(p);
    warning(warnState);

    % Rethrow error:
    rethrow(ME)
end

% Return to default settings:
chebfunpref.setDefaults(p);
warning(warnState);

end


text:
{% load i18n macro pagination %}

{% macro "header" %}

        {% if total > 1 %}
            {% trans "Pages:" %}
            {% if prev_page %}
                « {% trans "previous" %}
            {% endif %}

            {% for page_index in page_range %}
                {% if not page_index %}
                    ...
                {% else %}
                    {% if page_index == current %}
                        {{ page_index }}
                    {% else %}
                        {{ page_index }}
                    {% endif %}
                {% endif %}
            {% endfor %}

            {% if next_page %}
                {% trans "next" %} »
            {% endif %}
        {% endif %}

{% endmacro %}

    {% callmacro "header" %}
        {{ body|safe }}
    {% callmacro "header" %}

        {% include "django-ajax/_loader.html" %}


text:
using namespace chrono;

ChSolverAPGD::ChSolverAPGD()
    : ChSolverParallel(),
      mg_tmp_norm(0),
      mb_tmp_norm(0),
      obj1(0),
      obj2(0),
      norm_ms(0),
      dot_g_temp(0),
      theta(1),
      theta_new(0),
      beta_new(0),
      t(0),
      L(0),
      g_diff(0) {
}

void ChSolverAPGD::UpdateR() {
  const CompressedMatrix<real>& D_n_T = data_manager->host_data.D_n_T;
  const DynamicVector<real>& M_invk = data_manager->host_data.M_invk;
  const DynamicVector<real>& b = data_manager->host_data.b;
  DynamicVector<real>& R = data_manager->host_data.R;
  DynamicVector<real>& s = data_manager->host_data.s;

  uint num_contacts = data_manager->num_rigid_contacts;

  s.resize(data_manager->num_rigid_contacts);
  reset(s);

  rigid_rigid->Build_s();

  ConstSubVectorType b_n = blaze::subvector(b, 0, num_contacts);
  SubVectorType R_n = blaze::subvector(R, 0, num_contacts);
  SubVectorType s_n = blaze::subvector(s, 0, num_contacts);

  R_n = -b_n - D_n_T * M_invk - s_n;
}

uint ChSolverAPGD::SolveAPGD(const uint max_iter,
                             const uint size,
                             const DynamicVector<real>& r,
                             DynamicVector<real>& gamma) {
  real& residual = data_manager->measures.solver.residual;
  real& objective_value = data_manager->measures.solver.objective_value;

  DynamicVector<real> one(size, 1.0);
  data_manager->system_timer.start("ChSolverParallel_Solve");
  gamma_hat.resize(size);
  N_gamma_new.resize(size);
  temp.resize(size);
  g.resize(size);
  gamma_new.resize(size);
  y.resize(size);

  residual = 10e30;
  g_diff = 1.0 / pow(size, 2.0);

  theta = 1;
  theta_new = theta;
  beta_new = 0.0;
  mb_tmp_norm = 0, mg_tmp_norm = 0;
  obj1 = 0.0, obj2 = 0.0;
  dot_g_temp = 0, norm_ms = 0;

  // Is the initial projection necessary?
  // Project(gamma.data());
  // gamma_hat = gamma;
  // ShurProduct(gamma, mg);
  // mg = mg - r;

  temp = gamma - one;
  real norm_temp = sqrt((real)(temp, temp));

  // If gamma is one temp should be zero, in that case set L to one
  // We cannot divide by 0
  if (norm_temp == 0) {
    L = 1.0;
  } else {
    // If the N matrix is zero for some reason, temp will be zero
    ShurProduct(temp, temp);
    // If temp is zero then L will be zero
    L = sqrt((real)(temp, temp)) / norm_temp;
  }
  // When L is zero the step length can't be computed, in this case just return
  // If the N is indeed zero then solving doesn't make sense
  if (L == 0) {
    // For certain simulations returning here will not perform any iterations
    // even when there are contacts that aren't resolved. Changed it from return 0
    // to L=t=1;
    // return 0;
    L = t = 1;
  } else {
    // Compute the step size
    t = 1.0 / L;
  }
  y = gamma;
  // If no iterations are performed or the residual is NAN (which is shouldnt be)
  // make sure that gamma_hat has something inside of it. Otherwise gamma will be
  // overwritten with a vector of zero size
  gamma_hat = gamma;

  for (current_iteration = 0; current_iteration < max_iter; current_iteration++) {
    ShurProduct(y, g);
    g = g - r;
    gamma_new = y - t * g;

    Project(gamma_new.data());

    ShurProduct(gamma_new, N_gamma_new);
    obj1 = 0.5 * (gamma_new, N_gamma_new) - (gamma_new, r);

    ShurProduct(y, temp);
    obj2 = 0.5 * (y, temp) - (y, r);

    temp = gamma_new - y;
    dot_g_temp = (g, temp);
    norm_ms = (temp, temp);
    while (obj1 > obj2 + dot_g_temp + 0.5 * L * norm_ms) {
      L = 2.0 * L;
      t = 1.0 / L;
      gamma_new = y - t * g;
      Project(gamma_new.data());
      ShurProduct(gamma_new, N_gamma_new);
      obj1 = 0.5 * (gamma_new, N_gamma_new) - (gamma_new, r);
      temp = gamma_new - y;
      dot_g_temp = (g, temp);
      norm_ms = (temp, temp);
    }
    theta_new = (-pow(theta, 2.0) + theta * sqrt(pow(theta, 2.0) + 4.0)) / 2.0;
    beta_new = theta * (1.0 - theta) / (pow(theta, 2.0) + theta_new);

    temp = gamma_new - gamma;
    y = beta_new * temp + gamma_new;
    dot_g_temp = (g, temp);

    // Compute the residual
    temp = gamma_new - g_diff * (N_gamma_new - r);
    real temp_dota = (real)(temp, temp);
    // ಠ_ಠ THIS PROJECTION IS IMPORTANT! (╯°□°)╯︵ ┻━┻
    // If turned off the residual will be very incorrect! Turning it off can cause the solver to effectively use the
    // solution found in the first step because the residual never get's smaller. (You can convince yourself of this by
    // looking at the objective function value and watch it decrease while the residual and the current solution remain
    // the same.)
    Project(temp.data());
    temp = (1.0 / g_diff) * (gamma_new - temp);
    real temp_dotb = (real)(temp, temp);
    real res = sqrt(temp_dotb);

    if (res < residual) {
      residual = res;
      gamma_hat = gamma_new;
    }

    // Compute the objective value
    temp = 0.5 * N_gamma_new - r;
    objective_value = (gamma_new, temp);

    AtIterationEnd(residual, objective_value);

    if (data_manager->settings.solver.test_objective) {
      if (objective_value <= data_manager->settings.solver.tolerance_objective) {
        break;
      }
    } else {
      if (residual < data_manager->settings.solver.tol_speed) {
        break;
      }
    }

    if (dot_g_temp > 0) {
      y = gamma_new;
      theta_new = 1.0;
    }

    L = 0.9 * L;
    t = 1.0 / L;
    theta = theta_new;
    gamma = gamma_new;

    if (data_manager->settings.solver.update_rhs) {
      UpdateR();
    }
  }

  gamma = gamma_hat;

  data_manager->system_timer.stop("ChSolverParallel_Solve");
  return current_iteration;
}


text:
package main

import (
	"encoding/json"
	"fmt"
	"runtime"
	"strconv"
	"time"

	"github.com/containerd/containerd/platforms"
	cniversion "github.com/containernetworking/cni/pkg/version"
	"github.com/containers/buildah/define"
	iversion "github.com/containers/image/v5/version"
	ispecs "github.com/opencontainers/image-spec/specs-go"
	rspecs "github.com/opencontainers/runtime-spec/specs-go"
	"github.com/spf13/cobra"
)

//Overwritten at build time
var (
	GitCommit  string
	buildInfo  string
	cniVersion string
)

type versionInfo struct {
	Version       string `json:"version"`
	GoVersion     string `json:"goVersion"`
	ImageSpec     string `json:"imageSpec"`
	RuntimeSpec   string `json:"runtimeSpec"`
	CniSpec       string `json:"cniSpec"`
	LibcniVersion string `json:"libcniVersion"`
	ImageVersion  string `json:"imageVersion"`
	GitCommit     string `json:"gitCommit"`
	Built         string `json:"built"`
	OsArch        string `json:"osArch"`
	BuildPlatform string `json:"buildPlatform"`
}

type versionOptions struct {
	json bool
}

func init() {
	var opts versionOptions

	//cli command to print out the version info of buildah
	versionCommand := &cobra.Command{
		Use:   "version",
		Short: "Display the Buildah version information",
		Long:  "Displays Buildah version information.",
		RunE: func(c *cobra.Command, args []string) error {
			return versionCmd(opts)
		},
		Args:    cobra.NoArgs,
		Example: `buildah version`,
	}
	versionCommand.SetUsageTemplate(UsageTemplate())

	flags := versionCommand.Flags()
	flags.BoolVar(&opts.json, "json", false, "output in JSON format")

	rootCmd.AddCommand(versionCommand)
}

func versionCmd(opts versionOptions) error {
	var err error
	buildTime := int64(0)
	if buildInfo != "" {
		//converting unix time from string to int64
		buildTime, err = strconv.ParseInt(buildInfo, 10, 64)
		if err != nil {
			return err
		}
	}

	version := versionInfo{
		Version:       define.Version,
		GoVersion:     runtime.Version(),
		ImageSpec:     ispecs.Version,
		RuntimeSpec:   rspecs.Version,
		CniSpec:       cniversion.Current(),
		LibcniVersion: cniVersion,
		ImageVersion:  iversion.Version,
		GitCommit:     GitCommit,
		Built:         time.Unix(buildTime, 0).Format(time.ANSIC),
		OsArch:        runtime.GOOS + "/" + runtime.GOARCH,
		BuildPlatform: platforms.DefaultString(),
	}

	if opts.json {
		data, err := json.MarshalIndent(version, "", "    ")
		if err != nil {
			return err
		}
		fmt.Printf("%s\n", data)
		return nil
	}

	fmt.Println("Version:        ", version.Version)
	fmt.Println("Go Version:     ", version.GoVersion)
	fmt.Println("Image Spec:     ", version.ImageSpec)
	fmt.Println("Runtime Spec:   ", version.RuntimeSpec)
	fmt.Println("CNI Spec:       ", version.CniSpec)
	fmt.Println("libcni Version: ", version.LibcniVersion)
	fmt.Println("image Version:  ", version.ImageVersion)
	fmt.Println("Git Commit:     ", version.GitCommit)

	//Prints out the build time in readable format
	fmt.Println("Built:          ", version.Built)
	fmt.Println("OS/Arch:        ", version.OsArch)
	fmt.Println("BuildPlatform:  ", version.BuildPlatform)

	return nil
}


text:
@echo on
setlocal
cd ..
call environment.bat
call bin\camel-protocol-bridge.bat
endlocal


text:
package com.lacuz.cherish;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import com.lacuz.cherish.greendao.entity.Birth;
import com.lacuz.cherish.greendao.gen.BirthDao;
import com.lacuz.cherish.greendao.gen.DaoMaster;
import com.lacuz.cherish.greendao.gen.DaoSession;

import org.junit.Test;
import org.junit.runner.RunWith;

import java.util.List;

import static org.junit.Assert.*;

/**
 * Instrumentation test, which will execute on an Android device.
 *
 * @see Testing documentation
 */
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
    DaoMaster daoMaster;
    DaoSession daoSession;
    BirthDao birthDao;
    Context appContext;
    @Test
    public void useAppContext() throws Exception {
        // Context of the app under test.
        appContext = InstrumentationRegistry.getTargetContext();
        assertEquals("com.example.myproject", appContext.getPackageName());
        getStuDao();
//        addTest();
        queryList();
    }

    private void queryList() {
        List<Birth> stuList = birthDao.queryBuilder().list();
        if (stuList != null) {
            String searchAllInfo = "";
            for (int i = 0; i < stuList.size(); i++) {
                Birth stu = stuList.get(i);
                searchAllInfo += stu.toString()+ "\n";
            }
            System.out.println(searchAllInfo);
        }

    }

    private void getStuDao() {
        // 创建数据
        DaoMaster.DevOpenHelper devOpenHelper = new DaoMaster.DevOpenHelper(appContext, "cherish.db", null);
        daoMaster = new DaoMaster(devOpenHelper.getWritableDatabase());
        daoSession = daoMaster.newSession();
        birthDao = daoSession.getBirthDao();
    }

    private void addTest(){
        birthDao.insert(Birth.createEntity());
        birthDao.insert(Birth.createEntity());
        birthDao.insert(Birth.createEntity());
        birthDao.insert(Birth.createEntity());
        birthDao.insert(Birth.createEntity());
        birthDao.insert(Birth.createEntity());
    }

}


text:
@interface DateFormatterTests : XCTestCase

@property (nonatomic, strong) DateFormatter *dateFormatter;
@property (nonatomic, strong) NSDate *date;

@end

@implementation DateFormatterTests

- (void)setUp {
    [super setUp];

    self.dateFormatter = [DateFormatter new];

    NSString *stringDate = @"2015-12-06 12:39:05";
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    self.date = [dateFormatter dateFromString:stringDate];
}

- (void)tearDown {
    self.dateFormatter = nil;
    self.date = nil;

    [super tearDown];
}

- (void)testSuccessObtainDateWithDayMonthYearTimeFormat {
    // given
    NSString *expectedFormattedDateString = @"6 December 2015 в 12:39";
    NSString *actualFormattedDateString = nil;

    // when
    actualFormattedDateString = [self.dateFormatter obtainDateWithDayMonthYearTimeFormat:self.date];

    // then
    XCTAssertEqualObjects(expectedFormattedDateString, actualFormattedDateString);
}

- (void)testSuccessObtainDateWithDayMonthTimeFormat {
    // given
    NSString *expectedFormattedDateString = @"6 December в 12:39";
    NSString *actualFormattedDateString = nil;

    // when
    actualFormattedDateString = [self.dateFormatter obtainDateWithDayMonthTimeFormat:self.date];

    // then
    XCTAssertEqualObjects(expectedFormattedDateString, actualFormattedDateString);
}

- (void)testSuccessObtainDateWithDayMonthYearFormat {
    // given
    NSString *expectedFormattedDateString = @"6 December 2015";
    NSString *actualFormattedDateString = nil;

    // when
    actualFormattedDateString = [self.dateFormatter obtainDateWithDayMonthYearFormat:self.date];

    // then
    XCTAssertEqualObjects(expectedFormattedDateString, actualFormattedDateString);
}

- (void)testSuccessObtainDateWithDayMonthFormat {
    // given
    NSString *expectedFormattedDateString = @"6 December";
    NSString *actualFormattedDateString = nil;

    // when
    actualFormattedDateString = [self.dateFormatter obtainDateWithDayMonthFormat:self.date];

    // then
    XCTAssertEqualObjects(expectedFormattedDateString, actualFormattedDateString);
}

- (void)testSuccessObtainDateWithMonthFormat {
    // given
    NSString *expectedFormattedDateString = @"December";
    NSString *actualFormattedDateString = nil;

    // when
    actualFormattedDateString = [self.dateFormatter obtainDateWithMonthFormat:self.date];

    // then
    XCTAssertEqualObjects(expectedFormattedDateString, actualFormattedDateString);
}

- (void)testSuccessObtainDateWithDayFormat {
    // given
    NSString *expectedFormattedDateString = @"6";
    NSString *actualFormattedDateString = nil;

    // when
    actualFormattedDateString = [self.dateFormatter obtainDateWithDayFormat:self.date];

    // then
    XCTAssertEqualObjects(expectedFormattedDateString, actualFormattedDateString);
}

- (void)testSuccessObtainDateWithTimeFormat {
    // given
    NSString *expectedFormattedDateString = @"12:39";
    NSString *actualFormattedDateString = nil;

    // when
    actualFormattedDateString = [self.dateFormatter obtainDateWithTimeFormat:self.date];

    // then
    XCTAssertEqualObjects(expectedFormattedDateString, actualFormattedDateString);
}

@end


text:
package glisp

import (
	"errors"
	"fmt"
)

type Generator struct {
	env          *Glisp
	funcname     string
	tail         bool
	scopes       int
	instructions []Instruction
}

type Loop struct {
	stmtname       SexpSymbol
	loopStart      int
	loopLen        int
	breakOffset    int // i.e. relative to loopStart
	continueOffset int // i.e. relative to loopStart
}

func (loop *Loop) IsStackElem() {}

func NewGenerator(env *Glisp) *Generator {
	gen := new(Generator)
	gen.env = env
	gen.instructions = make([]Instruction, 0)
	// tail marks whether or not we are in the tail position
	gen.tail = false
	// scopes is the number of extra (non-function) scopes we've created
	gen.scopes = 0
	return gen
}

func (gen *Generator) AddInstructions(instr []Instruction) {
	gen.instructions = append(gen.instructions, instr...)
}

func (gen *Generator) AddInstruction(instr Instruction) {
	gen.instructions = append(gen.instructions, instr)
}

func (gen *Generator) GenerateBegin(expressions []Sexp) error {
	size := len(expressions)
	oldtail := gen.tail
	gen.tail = false
	if size == 0 {
		return errors.New("No expressions found")
	}
	for _, expr := range expressions[:size-1] {
		err := gen.Generate(expr)
		if err != nil {
			return err
		}
		// insert pops after all but the last instruction
		// that way the stack remains clean
		gen.AddInstruction(PopInstr(0))
	}
	gen.tail = oldtail
	return gen.Generate(expressions[size-1])
}

func buildSexpFun(env *Glisp, name string, funcargs SexpArray,
	funcbody []Sexp) (SexpFunction, error) {
	gen := NewGenerator(env)
	gen.tail = true

	if len(name) == 0 {
		gen.funcname = env.GenSymbol("__anon").name
	} else {
		gen.funcname = name
	}

	argsyms := make([]SexpSymbol, len(funcargs))

	for i, expr := range funcargs {
		switch t := expr.(type) {
		case SexpSymbol:
			argsyms[i] = t
		default:
			return MissingFunction,
				errors.New("function argument must be symbol")
		}
	}

	varargs := false
	nargs := len(funcargs)

	if len(argsyms) >= 2 && argsyms[len(argsyms)-2].name == "&" {
		argsyms[len(argsyms)-2] = argsyms[len(argsyms)-1]
		argsyms = argsyms[0 : len(argsyms)-1]
		varargs = true
		nargs = len(argsyms) - 1
	}

	for i := len(argsyms) - 1; i >= 0; i-- {
		gen.AddInstruction(PutInstr{argsyms[i]})
	}
	err := gen.GenerateBegin(funcbody)
	if err != nil {
		return MissingFunction, err
	}
	gen.AddInstruction(ReturnInstr{nil})

	newfunc := GlispFunction(gen.instructions)
	return MakeFunction(gen.funcname, nargs, varargs, newfunc), nil
}

func (gen *Generator) GenerateFn(args []Sexp) error {
	if len(args) < 2 {
		return errors.New("malformed function definition")
	}

	var funcargs SexpArray

	switch expr := args[0].(type) {
	case SexpArray:
		funcargs = expr
	default:
		return errors.New("function arguments must be in vector")
	}

	funcbody := args[1:]
	sfun, err := buildSexpFun(gen.env, "", funcargs, funcbody)
	if err != nil {
		return err
	}
	gen.AddInstruction(PushInstrClosure{sfun})

	return nil
}

func (gen *Generator) GenerateDef(args []Sexp) error {
	if len(args) != 2 {
		return errors.New("Wrong number of arguments to def")
	}

	var sym SexpSymbol
	switch expr := args[0].(type) {
	case SexpSymbol:
		sym = expr
	default:
		return errors.New("Definition name must by symbol")
	}

	gen.tail = false
	err := gen.Generate(args[1])
	if err != nil {
		return err
	}
	gen.AddInstruction(PutInstr{sym})
	gen.AddInstruction(PushInstr{SexpNull})
	return nil
}

func (gen *Generator) GenerateDefn(args []Sexp) error {
	if len(args) < 3 {
		return errors.New("Wrong number of arguments to defn")
	}

	var funcargs SexpArray
	switch expr := args[1].(type) {
	case SexpArray:
		funcargs = expr
	default:
		return errors.New("function arguments must be in vector")
	}

	var sym SexpSymbol
	switch expr := args[0].(type) {
	case SexpSymbol:
		sym = expr
	default:
		return errors.New("Definition name must by symbol")
	}

	sfun, err := buildSexpFun(gen.env, sym.name, funcargs, args[2:])
	if err != nil {
		return err
	}

	gen.AddInstruction(PushInstr{sfun})
	gen.AddInstruction(PutInstr{sym})
	gen.AddInstruction(PushInstr{SexpNull})

	return nil
}

func (gen *Generator) GenerateDefmac(args []Sexp) error {
	if len(args) < 3 {
		return errors.New("Wrong number of arguments to defmac")
	}

	var funcargs SexpArray
	switch expr := args[1].(type) {
	case SexpArray:
		funcargs = expr
	default:
		return errors.New("function arguments must be in vector")
	}

	var sym SexpSymbol
	switch expr := args[0].(type) {
	case SexpSymbol:
		sym = expr
	default:
		return errors.New("Definition name must by symbol")
	}

	sfun, err := buildSexpFun(gen.env, sym.name, funcargs, args[2:])
	if err != nil {
		return err
	}

	gen.env.macros[sym.number] = sfun
	gen.AddInstruction(PushInstr{SexpNull})

	return nil
}

func (gen *Generator) GenerateMacexpand(args []Sexp) error {
	if len(args) != 1 {
		return WrongNargs
	}

	var list SexpPair
	var islist bool
	var ismacrocall bool

	switch t := args[0].(type) {
	case SexpPair:
		if IsList(t.tail) {
			list = t
			islist = true
		}
	default:
		islist = false
	}

	var macro SexpFunction
	if islist {
		switch t := list.head.(type) {
		case SexpSymbol:
			macro, ismacrocall = gen.env.macros[t.number]
		default:
			ismacrocall = false
		}
	}

	if !ismacrocall {
		gen.AddInstruction(PushInstr{args[0]})
		return nil
	}

	macargs, err := ListToArray(list.tail)
	if err != nil {
		return err
	}

	env := gen.env.Duplicate()
	expr, err := env.Apply(macro, macargs)
	if err != nil {
		return err
	}
	gen.AddInstruction(PushInstr{expr})
	return nil
}

func (gen *Generator) GenerateShortCircuit(or bool, args []Sexp) error {
	size := len(args)

	subgen := NewGenerator(gen.env)
	subgen.scopes = gen.scopes
	subgen.tail = gen.tail
	subgen.funcname = gen.funcname
	subgen.Generate(args[size-1])
	instructions := subgen.instructions

	for i := size - 2; i >= 0; i-- {
		subgen = NewGenerator(gen.env)
		subgen.Generate(args[i])
		subgen.AddInstruction(DupInstr(0))
		subgen.AddInstruction(BranchInstr{or, len(instructions) + 2})
		subgen.AddInstruction(PopInstr(0))
		instructions = append(subgen.instructions, instructions...)
	}
	gen.AddInstructions(instructions)

	return nil
}

func (gen *Generator) GenerateCond(args []Sexp) error {
	if len(args)%2 == 0 {
		return errors.New("missing default case")
	}

	subgen := NewGenerator(gen.env)
	subgen.tail = gen.tail
	subgen.scopes = gen.scopes
	subgen.funcname = gen.funcname
	err := subgen.Generate(args[len(args)-1])
	if err != nil {
		return err
	}
	instructions := subgen.instructions

	for i := len(args)/2 - 1; i >= 0; i-- {
		subgen.Reset()
		err := subgen.Generate(args[2*i])
		if err != nil {
			return err
		}
		pred_code := subgen.instructions

		subgen.Reset()
		subgen.tail = gen.tail
		subgen.scopes = gen.scopes
		subgen.funcname = gen.funcname
		err = subgen.Generate(args[2*i+1])
		if err != nil {
			return err
		}
		body_code := subgen.instructions

		subgen.Reset()
		subgen.AddInstructions(pred_code)
		subgen.AddInstruction(BranchInstr{false, len(body_code) + 2})
		subgen.AddInstructions(body_code)
		subgen.AddInstruction(JumpInstr{len(instructions) + 1})
		subgen.AddInstructions(instructions)
		instructions = subgen.instructions
	}

	gen.AddInstructions(instructions)
	return nil
}

func (gen *Generator) GenerateQuote(args []Sexp) error {
	for _, expr := range args {
		gen.AddInstruction(PushInstr{expr})
	}
	return nil
}

func (gen *Generator) GenerateLet(name string, args []Sexp) error {
	if len(args) < 2 {
		return errors.New("malformed let statement")
	}

	lstatements := make([]SexpSymbol, 0)
	rstatements := make([]Sexp, 0)
	var bindings []Sexp

	switch expr := args[0].(type) {
	case SexpArray:
		bindings = []Sexp(expr)
	default:
		return errors.New("let bindings must be in array")
	}

	if len(bindings)%2 != 0 {
		return errors.New("uneven let binding list")
	}

	for i := 0; i < len(bindings)/2; i++ {
		switch t := bindings[2*i].(type) {
		case SexpSymbol:
			lstatements = append(lstatements, t)
		default:
			return errors.New("cannot bind to non-symbol")
		}
		rstatements = append(rstatements, bindings[2*i+1])
	}

	gen.AddInstruction(AddScopeInstr(0))
	gen.scopes++

	if name == "let*" {
		for i, rs := range rstatements {
			err := gen.Generate(rs)
			if err != nil {
				return err
			}
			gen.AddInstruction(PutInstr{lstatements[i]})
		}
	} else if name == "let" {
		for _, rs := range rstatements {
			err := gen.Generate(rs)
			if err != nil {
				return err
			}
		}
		for i := len(lstatements) - 1; i >= 0; i-- {
			gen.AddInstruction(PutInstr{lstatements[i]})
		}
	}
	err := gen.GenerateBegin(args[1:])
	if err != nil {
		return err
	}
	gen.AddInstruction(RemoveScopeInstr(0))
	gen.scopes--

	return nil
}

func (gen *Generator) GenerateAssert(args []Sexp) error {
	if len(args) != 1 {
		return WrongNargs
	}
	err := gen.Generate(args[0])
	if err != nil {
		return err
	}

	reterrmsg := fmt.Sprintf("Assertion failed: %s\n",
		args[0].SexpString())
	gen.AddInstruction(BranchInstr{true, 2})
	gen.AddInstruction(ReturnInstr{errors.New(reterrmsg)})
	gen.AddInstruction(PushInstr{SexpNull})
	return nil
}

func (gen *Generator) GenerateInclude(args []Sexp) error {
	if len(args) < 1 {
		return WrongNargs
	}

	var err error
	var exps []Sexp

	var sourceItem func(item Sexp) error

	sourceItem = func(item Sexp) error {
		switch t := item.(type) {
		case SexpArray:
			for _, v := range t {
				if err := sourceItem(v); err != nil {
					return err
				}
			}
		case SexpPair:
			expr := item
			for expr != SexpNull {
				list := expr.(SexpPair)
				if err := sourceItem(list.head); err != nil {
					return err
				}
				expr = list.tail
			}
		case SexpStr:
			exps, err = gen.env.ParseFile(string(t))
			if err != nil {
				return err
			}

			err = gen.GenerateBegin(exps)
			if err != nil {
				return err
			}

		default:
			return fmt.Errorf("include: Expected `string`, `list`, `array` given type %T val %v", item, item)
		}

		return nil
	}

	for _, v := range args {
		err = sourceItem(v)
		if err != nil {
			return err
		}
	}

	return nil
}

func (gen *Generator) GenerateCallBySymbol(sym SexpSymbol, args []Sexp) error {
	switch sym.name {
	case "and":
		return gen.GenerateShortCircuit(false, args)
	case "or":
		return gen.GenerateShortCircuit(true, args)
	case "cond":
		return gen.GenerateCond(args)
	case "quote":
		return gen.GenerateQuote(args)
	case "def":
		return gen.GenerateDef(args)
	case "fn":
		return gen.GenerateFn(args)
	case "defn":
		return gen.GenerateDefn(args)
	case "begin":
		return gen.GenerateBegin(args)
	case "let":
		return gen.GenerateLet("let", args)
	case "let*":
		return gen.GenerateLet("let*", args)
	case "assert":
		return gen.GenerateAssert(args)
	case "defmac":
		return gen.GenerateDefmac(args)
	case "macexpand":
		return gen.GenerateMacexpand(args)
	case "syntax-quote":
		return gen.GenerateSyntaxQuote(args)
	case "include":
		return gen.GenerateInclude(args)
	}

	macro, found := gen.env.macros[sym.number]
	if found {
		// calling Apply on the current environment will screw up
		// the stack, creating a duplicate environment is safer
		env := gen.env.Duplicate()
		expr, err := env.Apply(macro, args)
		if err != nil {
			return err
		}
		return gen.Generate(expr)
	}

	oldtail := gen.tail
	gen.tail = false
	err := gen.GenerateAll(args)
	if err != nil {
		return err
	}
	if oldtail && sym.name == gen.funcname {
		// to do a tail call
		// pop off all the extra scopes
		// then jump to beginning of function
		for i := 0; i < gen.scopes; i++ {
			gen.AddInstruction(RemoveScopeInstr(0))
		}
		gen.AddInstruction(GotoInstr{0})
	} else {
		gen.AddInstruction(CallInstr{sym, len(args)})
	}
	gen.tail = oldtail
	return nil
}

func (gen *Generator) GenerateDispatch(fun Sexp, args []Sexp) error {
	gen.GenerateAll(args)
	gen.Generate(fun)
	gen.AddInstruction(DispatchInstr{len(args)})
	return nil
}

func (gen *Generator) GenerateCall(expr SexpPair) error {
	arr, _ := ListToArray(expr.tail)
	switch head := expr.head.(type) {
	case SexpSymbol:
		return gen.GenerateCallBySymbol(head, arr)
	}
	return gen.GenerateDispatch(expr.head, arr)
}

func (gen *Generator) GenerateArray(arr SexpArray) error {
	err := gen.GenerateAll(arr)
	if err != nil {
		return err
	}
	gen.AddInstruction(CallInstr{gen.env.MakeSymbol("array"), len(arr)})
	return nil
}

func (gen *Generator) Generate(expr Sexp) error {
	switch e := expr.(type) {
	case SexpSymbol:
		gen.AddInstruction(GetInstr{e})
		return nil
	case SexpPair:
		if IsList(e) {
			err := gen.GenerateCall(e)
			if err != nil {
				return errors.New(
					fmt.Sprintf("Error generating %s:\n%v",
						expr.SexpString(), err))
			}
			return nil
		} else {
			gen.AddInstruction(PushInstr{expr})
		}
	case SexpArray:
		return gen.GenerateArray(e)
	default:
		gen.AddInstruction(PushInstr{expr})
		return nil
	}
	return nil
}

func (gen *Generator) GenerateAll(expressions []Sexp) error {
	for _, expr := range expressions {
		err := gen.Generate(expr)
		if err != nil {
			return err
		}
	}
	return nil
}

func (gen *Generator) Reset() {
	gen.instructions = make([]Instruction, 0)
	gen.tail = false
	gen.scopes = 0
}

// side-effect (or main effect) has to be pushing an expression on the top of
// the datastack that represents the expanded and substituted expression
func (gen *Generator) GenerateSyntaxQuote(args []Sexp) error {

	if len(args) != 1 {
		return errors.New("syntax-quote takes exactly one argument")
	}
	arg := args[0]

	// need to handle arrays, since they can have unquotes
	// in them too.
	switch arg.(type) {
	case SexpArray:
		gen.generateSyntaxQuoteArray(arg)
		return nil
	case SexpPair:
		if !IsList(arg) {
			break
		}
		gen.generateSyntaxQuoteList(arg)
		return nil
	case SexpHash:
		gen.generateSyntaxQuoteHash(arg)
		return nil
	}
	gen.AddInstruction(PushInstr{arg})
	return nil
}

func (gen *Generator) generateSyntaxQuoteList(arg Sexp) error {

	switch a := arg.(type) {
	case SexpPair:
		//good, required here
	default:
		return fmt.Errorf("arg to generateSyntaxQuoteList() must be list; got %T", a)
	}

	// things that need unquoting end up as
	// (unquote mysym)
	// i.e. a pair
	// list of length 2 exactly, with first atom
	// being "unquote" and second being the symbol
	// to substitute.
	quotebody, _ := ListToArray(arg)

	if len(quotebody) == 2 {
		var issymbol bool
		var sym SexpSymbol
		switch t := quotebody[0].(type) {
		case SexpSymbol:
			sym = t
			issymbol = true
		default:
			issymbol = false
		}
		if issymbol {
			if sym.name == "unquote" {
				gen.Generate(quotebody[1])
				return nil
			} else if sym.name == "unquote-splicing" {
				gen.Generate(quotebody[1])
				gen.AddInstruction(ExplodeInstr(0))
				return nil
			}
		}
	}

	gen.AddInstruction(PushInstr{SexpMarker})

	for _, expr := range quotebody {
		gen.GenerateSyntaxQuote([]Sexp{expr})
	}

	gen.AddInstruction(SquashInstr(0))

	return nil
}

func (gen *Generator) generateSyntaxQuoteArray(arg Sexp) error {

	var arr SexpArray
	switch a := arg.(type) {
	case SexpArray:
		//good, required here
		arr = a
	default:
		return fmt.Errorf("arg to generateSyntaxQuoteArray() must be an array; got %T", a)
	}

	gen.AddInstruction(PushInstr{SexpMarker})
	for _, expr := range arr {
		gen.AddInstruction(PushInstr{SexpMarker})
		gen.GenerateSyntaxQuote([]Sexp{expr})
		gen.AddInstruction(SquashInstr(0))
		gen.AddInstruction(ExplodeInstr(0))
	}
	gen.AddInstruction(VectorizeInstr(0))
	return nil
}

func (gen *Generator) generateSyntaxQuoteHash(arg Sexp) error {

	var hash SexpHash
	switch a := arg.(type) {
	case SexpHash:
		//good, required here
		hash = a
	default:
		return fmt.Errorf("arg to generateSyntaxQuoteHash() must be a hash; got %T", a)
	}
	n := HashCountKeys(hash)
	gen.AddInstruction(PushInstr{SexpMarker})
	for i := 0; i < n; i++ {
		// must reverse order here to preserve order on rebuild
		key := (*hash.KeyOrder)[(n-i)-1]
		val, err := hash.HashGet(key)
		if err != nil {
			return err
		}
		// value first, since value comes second on rebuild
		gen.AddInstruction(PushInstr{SexpMarker})
		gen.GenerateSyntaxQuote([]Sexp{val})
		gen.AddInstruction(SquashInstr(0))
		gen.AddInstruction(ExplodeInstr(0))

		gen.AddInstruction(PushInstr{SexpMarker})
		gen.GenerateSyntaxQuote([]Sexp{key})
		gen.AddInstruction(SquashInstr(0))
		gen.AddInstruction(ExplodeInstr(0))
	}
	gen.AddInstruction(HashizeInstr{
		HashLen:  n,
		TypeName: *(hash.TypeName),
	})
	return nil
}


text:
IoP Core version 0.12.1 is now available from:

  <https://iop.org/bin/iop-core-0.12.1/>

This is a new minor version release, including the BIP9, BIP68 and BIP112
softfork, various bugfixes and updated translations.

Please report bugs using the issue tracker at github:

  <https://github.com/bitcoin/bitcoin/issues>

Upgrading and downgrading
=========================

How to Upgrade
--------------

If you are running an older version, shut it down. Wait until it has completely
shut down (which might take a few minutes for older versions), then run the
installer (on Windows) or just copy over /Applications/IoP-Qt (on Mac) or
iopd/iop-qt (on Linux).

Downgrade warning
-----------------

### Downgrade to a version < 0.12.0

Because release 0.12.0 and later will obfuscate the chainstate on every
fresh sync or reindex, the chainstate is not backwards-compatible with
pre-0.12 versions of IoP Core or other software.

If you want to downgrade after you have done a reindex with 0.12.0 or later,
you will need to reindex when you first start IoP Core version 0.11 or
earlier.

Notable changes
===============

First version bits BIP9 softfork deployment
-------------------------------------------

This release includes a soft fork deployment to enforce [BIP68][],
[BIP112][] and [BIP113][] using the [BIP9][] deployment mechanism.

The deployment sets the block version number to 0x20000001 between
midnight 1st May 2016 and midnight 1st May 2017 to signal readiness for
deployment. The version number consists of 0x20000000 to indicate version
bits together with setting bit 0 to indicate support for this combined
deployment, shown as "csv" in the `getblockchaininfo` RPC call.

For more information about the soft forking change, please see
<https://github.com/bitcoin/bitcoin/pull/7648>

This specific backport pull-request can be viewed at
<https://github.com/bitcoin/bitcoin/pull/7543>

[BIP9]: https://github.com/iop/bips/blob/master/bip-0009.mediawiki
[BIP68]: https://github.com/iop/bips/blob/master/bip-0068.mediawiki
[BIP112]: https://github.com/iop/bips/blob/master/bip-0112.mediawiki
[BIP113]: https://github.com/iop/bips/blob/master/bip-0113.mediawiki

BIP68 soft fork to enforce sequence locks for relative locktime
---------------------------------------------------------------

[BIP68][] introduces relative lock-time consensus-enforced semantics of
the sequence number field to enable a signed transaction input to remain
invalid for a defined period of time after confirmation of its corresponding
outpoint.

For more information about the implementation, see
<https://github.com/bitcoin/bitcoin/pull/7184>

BIP112 soft fork to enforce OP_CHECKSEQUENCEVERIFY
--------------------------------------------------

[BIP112][] redefines the existing OP_NOP3 as OP_CHECKSEQUENCEVERIFY (CSV)
for a new opcode in the IoP scripting system that in combination with
[BIP68][] allows execution pathways of a script to be restricted based
on the age of the output being spent.

For more information about the implementation, see
<https://github.com/bitcoin/bitcoin/pull/7524>

BIP113 locktime enforcement soft fork
-------------------------------------

IoP Core 0.11.2 previously introduced mempool-only locktime
enforcement using GetMedianTimePast(). This release seeks to
consensus enforce the rule.

IoP transactions currently may specify a locktime indicating when
they may be added to a valid block.  Current consensus rules require
that blocks have a block header time greater than the locktime specified
in any transaction in that block.

Miners get to choose what time they use for their header time, with the
consensus rule being that no node will accept a block whose time is more
than two hours in the future.  This creates a incentive for miners to
set their header times to future values in order to include locktimed
transactions which weren't supposed to be included for up to two more
hours.

The consensus rules also specify that valid blocks may have a header
time greater than that of the median of the 11 previous blocks.  This
GetMedianTimePast() time has a key feature we generally associate with
time: it can't go backwards.

[BIP113][] specifies a soft fork enforced in this release that
weakens this perverse incentive for individual miners to use a future
time by requiring that valid blocks have a computed GetMedianTimePast()
greater than the locktime specified in any transaction in that block.

Mempool inclusion rules currently require transactions to be valid for
immediate inclusion in a block in order to be accepted into the mempool.
This release begins applying the BIP113 rule to received transactions,
so transaction whose time is greater than the GetMedianTimePast() will
no longer be accepted into the mempool.

**Implication for miners:** you will begin rejecting transactions that
would not be valid under BIP113, which will prevent you from producing
invalid blocks when BIP113 is enforced on the network. Any
transactions which are valid under the current rules but not yet valid
under the BIP113 rules will either be mined by other miners or delayed
until they are valid under BIP113. Note, however, that time-based
locktime transactions are more or less unseen on the network currently.

**Implication for users:** GetMedianTimePast() always trails behind the
current time, so a transaction locktime set to the present time will be
rejected by nodes running this release until the median time moves
forward. To compensate, subtract one hour (3,600 seconds) from your
locktimes to allow those transactions to be included in mempools at
approximately the expected time.

For more information about the implementation, see
<https://github.com/bitcoin/bitcoin/pull/6566>

Miscellaneous
-------------

The p2p alert system is off by default. To turn on, use `-alert` with
startup configuration.

0.12.1 Change log
=================

Detailed release notes follow. This overview includes changes that affect
behavior, not code moves, refactors and string updates. For convenience in locating
the code changes and accompanying discussion, both the pull request and
git merge commit are mentioned.

### RPC and other APIs
- #7739 `7ffc2bd` Add abandoned status to listtransactions (jonasschnelli)

### Block and transaction handling
- #7543 `834aaef` Backport BIP9, BIP68 and BIP112 with softfork (btcdrak)

### P2P protocol and network code
- #7804 `90f1d24` Track block download times per individual block (sipa)
- #7832 `4c3a00d` Reduce block timeout to 10 minutes (laanwj)

### Validation
- #7821 `4226aac` init: allow shutdown during 'Activating best chain...' (laanwj)
- #7835 `46898e7` Version 2 transactions remain non-standard until CSV activates (sdaftuar)

### Build system
- #7487 `00d57b4` Workaround Travis-side CI issues (luke-jr)
- #7606 `a10da9a` No need to set -L and --location for curl (MarcoFalke)
- #7614 `ca8f160` Add curl to packages (now needed for depends) (luke-jr)
- #7776 `a784675` Remove unnecessary executables from gitian release (laanwj)

### Wallet
- #7715 `19866c1` Fix calculation of balances and available coins. (morcos)

### Miscellaneous
- #7617 `f04f4fd` Fix markdown syntax and line terminate LogPrint (MarcoFalke)
- #7747 `4d035bc` added depends cross compile info (accraze)
- #7741 `a0cea89` Mark p2p alert system as deprecated (btcdrak)
- #7780 `c5f94f6` Disable bad-chain alert (btcdrak)

Credits
=======

Thanks to everyone who directly contributed to this release:

- accraze
- Alex Morcos
- BtcDrak
- Jonas Schnelli
- Luke Dashjr
- MarcoFalke
- Mark Friedenbach
- NicolasDorier
- Pieter Wuille
- Suhas Daftuar
- Wladimir J. van der Laan

As well as everyone that helped translating on [Transifex](https://www.transifex.com/projects/p/iop/).


text:
package org.apache.tamaya.core.internal.logging;

import org.slf4j.spi.LocationAwareLogger;

import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogRecord;

/**
 *

 * java.util.logging.Logger implementation delegating to SLF4J.
 *

 *

 * Methods {@link java.util.logging.Logger#setParent(Logger)}, {@link java.util.logging.Logger#getParent()},
 * {@link java.util.logging.Logger#setUseParentHandlers(boolean)} and
 * {@link java.util.logging.Logger#getUseParentHandlers()} are not overrriden.
 *

 *

 * Level annotation inspired by {@link org.slf4j.bridge.SLF4JBridgeHandler}:
 *

 *

 *

 * FINEST  -> TRACE
 * FINER   -> DEBUG
 * FINE    -> DEBUG
 * CONFIG  -> DEBUG
 * INFO    -> INFO
 * WARN ING -> WARN
 * SEVER   -> ERROR
 *

 */
public class Slf4jLogger extends AbstractDelegatingLogger {

    private static final String FQCN = AbstractDelegatingLogger.class.getName();

    private final org.slf4j.Logger logger;
    private LocationAwareLogger locationAwareLogger;

    public Slf4jLogger(final String name, final String resourceBundleName) {
        super(name, resourceBundleName);
        logger = org.slf4j.LoggerFactory.getLogger(name);
        if (logger instanceof LocationAwareLogger) {
            locationAwareLogger = (LocationAwareLogger) logger;
        }
    }

    @Override
    protected boolean supportsHandlers() {
        return true;
    }

    @Override
    public Level getLevel() {
        final Level level;
        // Verify fromMap the wider (trace) to the narrower (error)
        if (logger.isTraceEnabled()) {
            level = Level.FINEST;
        } else if (logger.isDebugEnabled()) {
            // map to the lowest between FINER, FINE and CONFIG
            level = Level.FINER;
        } else if (logger.isInfoEnabled()) {
            level = Level.INFO;
        } else if (logger.isWarnEnabled()) {
            level = Level.WARNING;
        } else if (logger.isErrorEnabled()) {
            level = Level.SEVERE;
        } else {
            level = Level.OFF;
        }
        return level;
    }

    @Override
    public boolean isLoggable(final Level level) {
        final int i = level.intValue();
        if (i == Level.OFF.intValue()) {
            return false;
        } else if (i >= Level.SEVERE.intValue()) {
            return logger.isErrorEnabled();
        } else if (i >= Level.WARNING.intValue()) {
            return logger.isWarnEnabled();
        } else if (i >= Level.INFO.intValue()) {
            return logger.isInfoEnabled();
        } else if (i >= Level.FINER.intValue()) {
            return logger.isDebugEnabled();
        }
        return logger.isTraceEnabled();
    }

    @Override
    protected void internalLogFormatted(final String msg, final LogRecord record) {

        final Level level = record.getLevel();
        final Throwable t = record.getThrown();

        final Handler[] targets = getHandlers();
        if (targets != null) {
            for (final Handler h : targets) {
                h.publish(record);
            }
        }
        if (!getUseParentHandlers()) {
            return;
        }

        /*
        * As we can not use a "switch ... case" block but only a "if ... else if ..." block, the order current the
        * comparisons is important. We first try log level FINE then INFO, WARN, FINER, etc
        */
        if (Level.FINE.equals(level)) {
            if (locationAwareLogger == null) {
                logger.debug(msg, t);
            } else {
                locationAwareLogger.log(null, FQCN, LocationAwareLogger.DEBUG_INT, msg, null, t);
            }
        } else if (Level.INFO.equals(level)) {
            if (locationAwareLogger == null) {
                logger.info(msg, t);
            } else {
                locationAwareLogger.log(null, FQCN, LocationAwareLogger.INFO_INT, msg, null, t);
            }
        } else if (Level.WARNING.equals(level)) {
            if (locationAwareLogger == null) {
                logger.warn(msg, t);
            } else {
                locationAwareLogger.log(null, FQCN, LocationAwareLogger.WARN_INT, msg, null, t);
            }
        } else if (Level.FINER.equals(level)) {
            if (locationAwareLogger == null) {
                logger.trace(msg, t);
            } else {
                locationAwareLogger.log(null, FQCN, LocationAwareLogger.DEBUG_INT, msg, null, t);
            }
        } else if (Level.FINEST.equals(level)) {
            if (locationAwareLogger == null) {
                logger.trace(msg, t);
            } else {
                locationAwareLogger.log(null, FQCN, LocationAwareLogger.TRACE_INT, msg, null, t);
            }
        } else if (Level.ALL.equals(level)) {
            // should never occur, all is used to configure java.util.logging
            // but not accessible by the API Logger.xxx() API
            if (locationAwareLogger == null) {
                logger.error(msg, t);
            } else {
                locationAwareLogger.log(null, FQCN, LocationAwareLogger.ERROR_INT, msg, null, t);
            }
        } else if (Level.SEVERE.equals(level)) {
            if (locationAwareLogger == null) {
                logger.error(msg, t);
            } else {
                locationAwareLogger.log(null, FQCN, LocationAwareLogger.ERROR_INT, msg, null, t);
            }
        } else if (Level.CONFIG.equals(level)) {
            if (locationAwareLogger == null) {
                logger.debug(msg, t);
            } else {
                locationAwareLogger.log(null, FQCN, LocationAwareLogger.DEBUG_INT, msg, null, t);
            }
        }
        // don't log if Level.OFF
    }
}


text:
package com.ibm.jbatch.tck.artifacts.chunkartifacts;

import com.ibm.jbatch.tck.artifacts.chunktypes.InventoryRecord;

@javax.inject.Named("inventoryProcessor")
public class InventoryProcessor implements javax.batch.api.chunk.ItemProcessor{

	@Override
	public InventoryRecord processItem(Object record) throws Exception {

	    //The processor doesn't really do anything in this test. It just passes along
	    //the item item and the quantity to the item writer to create and order in the
	    //order table.

		int itemID = ((InventoryRecord)record).getItemID();
		int quantity = ((InventoryRecord)record).getQuantity();

		return new InventoryRecord(itemID, quantity);
	}

}


text:
package com.maxifier.mxcache;

import com.maxifier.mxcache.context.CacheContext;
import org.mockito.Mockito;
import org.testng.Assert;
import org.testng.annotations.Test;

/**
 * @author Alexander Kochurov (alexander.kochurov@maxifier.com)
 */
public class CacheFactoryUTest {
    @Test
    public void testSetDefaultContext() throws Exception {
        CacheContext defaultContext = CacheFactory.getDefaultContext();
        Assert.assertNotNull(defaultContext);
        CacheContext mock = Mockito.mock(CacheContext.class);
        CacheFactory.setDefaultContext(mock);
        Assert.assertSame(CacheFactory.getDefaultContext(), mock);
        CacheFactory.setDefaultContext(null);
        Assert.assertSame(CacheFactory.getDefaultContext(), defaultContext);
    }
}


text:
/*
 * Created on Apr 17, 2007
 *
 * TODO
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package org.seqcode.gsebricks.types;

public class GeneralType implements EchoType {

    public GeneralType() {}

    public String getName() {
        return "OBJECT";
    }

    public boolean isParameterSubstitute(EchoType paramType) {
        return isSubType(paramType);
    }

    public boolean isReturnSubstitute(EchoType retType) {
        return retType.isSubType(this);
    }

    public boolean isSubType(EchoType et) {
        if(et.equals(this)) { return true; }
        return false;
    }

    public boolean equals(Object o) {
        return o instanceof GeneralType;
    }

    public int hashCode() {
        return 17;
    }

    public String toString() { return getName(); }
}


text:
* Remove strftime and dump.
* Add bower.json.

## 5.0

* Remove Modernizr entirely, and alter dependent code accordingly.

## 4.0

* Reorganize into new GitHub repository.
* No functional changes since 3.1.