text:
<?php

namespace app\controllers;

use Yii;
use app\models\Tools;
use app\models\ToolsSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\web\UploadedFile;

/**
 * ToolsController implements the CRUD actions for Tools model.
 */
class ToolsController extends Controller
{
    /**
     * @inheritdoc
     */
    public function behaviors()
    {
        return [
            'verbs' => [
                'class' => VerbFilter::className(),
                'actions' => [
                    'delete' => ['POST'],
                ],
            ],
        ];
    }

    /**
     * Lists all Tools models.
     * @return mixed
     */
    public function actionIndex()
    {
        $searchModel = new ToolsSearch();
        $dataProvider = $searchModel->search(Yii::$app->request->queryParams);

        return $this->render('index', [
            'searchModel' => $searchModel,
            'dataProvider' => $dataProvider,
        ]);
    }

    /**
     * Displays a single Tools model.
     * @param integer $id
     * @return mixed
     */
    public function actionView($id)
    {
        return $this->render('view', [
            'model' => $this->findModel($id),
        ]);
    }

    /**
     * Creates a new Tools model.
     * If creation is successful, the browser will be redirected to the 'view' page.
     * @return mixed
     */
    public function actionCreate()
    {
        $model = new Tools();

       if ($model->load(Yii::$app->request->post())) {
            $file = UploadedFile::getInstance($model,'tool_img');
             if(isset($file->size) && $file->size!=0){
                $model->picture = $file->name;
                $file->saveAs('toolpicture/'.$file->name);
                }
            $model->save();
            return $this->redirect(['view', 'id' => $model->id]);
        } else {
            return $this->render('create', [
                'model' => $model,
            ]);
        }
    }

    /**
     * Updates an existing Tools model.
     * If update is successful, the browser will be redirected to the 'view' page.
     * @param integer $id
     * @return mixed
     */
    public function actionUpdate($id)
    {
        $model = $this->findModel($id);

        if ($model->load(Yii::$app->request->post())) {
            $file = UploadedFile::getInstance($model,'tool_img');
             if(isset($file->size) && $file->size!=0){
                $model->picture = $file->name;
                $file->saveAs('toolpicture/'.$file->name);
                }
            $model->save();
            return $this->redirect(['view', 'id' => $model->id]);
        } else {
            return $this->render('update', [
                'model' => $model,
            ]);
        }
    }

    /**
     * Deletes an existing Tools model.
     * If deletion is successful, the browser will be redirected to the 'index' page.
     * @param integer $id
     * @return mixed
     */
    public function actionDelete($id)
    {
        $this->findModel($id)->delete();

        return $this->redirect(['index']);
    }

    /**
     * Finds the Tools model based on its primary key value.
     * If the model is not found, a 404 HTTP exception will be thrown.
     * @param integer $id
     * @return Tools the loaded model
     * @throws NotFoundHttpException if the model cannot be found
     */
    protected function findModel($id)
    {
        if (($model = Tools::findOne($id)) !== null) {
            return $model;
        } else {
            throw new NotFoundHttpException('The requested page does not exist.');
        }
    }
}


text:
<layout name="layout" />

用户管理

            修改信息

                <form class="stdform stdform2" method="post" action="{:U('Admin/Rbac/setRoleHandle')}">

                        学号
                        <input type="text" name="stu_num" id="firstname2" class="longinput" value="{$user.stu_num}" />

                        身份证后六位
                        <input type="text" name="stu_idcard" id="lastname2" class="longinput" value="{$user.stu_idcard}" />

                        邮箱
                        <input type="text" name="email" id="email2" class="longinput" value="{$user.email}" />

                        昵称
                        <input type="text" name="nickname" id="email2" class="longinput" value="{$user.nickname}" />

                        真实姓名
                        <input type="text" name="realname" id="email2" class="longinput" value="{$user.real_name}" />

                        密码
                        <input type="password" name="password" id="email2" class="longinput" value="{$user.password}" />

                        权限
                            <select name="role" id="selection2">
                                <volist name="user['role']" id="ro">
                                    <option value="{$ro.id}">{$ro.remark}</option>
                                </volist>
                                <volist name="role" id="vo">
                                    <option value="{$vo.id}">{$vo.remark}</option>
                                </volist>
                            </select>

                        <button class="submit radius2">提交</button>
                        <input type="hidden" name="uid" class="reset radius2" value="{$user.id}" />
                        <input type="reset" class="reset radius2" value="重置" />

                </form>

redpajama_set_name: RedPajamaGithub


text:
        <link href="style.css" rel="stylesheet" />

        Transmutation cantrip

        Casting Time:  1 action

        Range:  30 feet

        Components:  V

        Duration:  Up to 1 minute

            You manifest a minor wonder, a sign of supernatural
            power, within range. You create one of the following
            magical effects within range:
            • Your voice booms up to three times as loud as normal
            for 1 minute.

            • You cause flames toflicker, brighten, dim, or change
            color for 1 minute.

            • You cause harmless tremors in the ground for 1
            minute.

            • You create an instantaneous sound that originates
            from a point of your choice within range, such as a
            rumble of thunder, the cry of a raven, or ominous
            whispers.

            • You instantaneously cause an unlocked door or window
            tofly open or slam shut.

            • You alter the appearance of your eyes for 1 minute.

            If you cast this spell multiple times, you can have up to
            three of its 1-minute effects active at a time, and you can
            dismiss such an effect as an action.


text:
package com.farsunset.ichat.cim.push;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.farsunset.ichat.nio.mutual.Message;
import com.farsunset.ichat.nio.session.CIMSession;
import com.farsunset.ichat.nio.session.DefaultSessionManager;

/**
 * 消息发送实现类
 *
 * @author farsunset (3979434@qq.com)
 */
public class DefaultMessagePusher implements  CIMMessagePusher {

	private final Log log = LogFactory.getLog(getClass());

	private DefaultSessionManager sessionManager;

    public void setSessionManager(DefaultSessionManager sessionManager) {
		this.sessionManager = sessionManager;
	}

	/**
     * 向用户发送消息
     * @param msg
     */
	public void pushMessageToUser(Message msg) {
		CIMSession session = sessionManager.getSession(msg.getReceiver());
		System.out.println(msg.getReceiver()+"-------");
		/*服务器集群时,可以在此 判断当前session是否连接于本台服务器,如果是,继续往下走,如果不是,将此消息发往当前session连接的服务器并 return
		if(!session.isLocalhost()){//判断当前session是否连接于本台服务器,如不是

			MessageDispatcher.execute(msg, session.getHost());
			return;
		}
		*/

		if (session != null && session.isConnected()) {

			/*//如果用户标示了DeviceToken 且 需要后台推送(Pushable=1) 说明这是ios设备需要使用anps发送

			if(StringUtil.isNotEmpty(session.getDeviceToken())&&session.getPushable()==User.PUSHABLE)
			{
				try {
					deliverByANPS(msg,session.getDeviceToken());
					msg.setStatus(Message.STATUS_SEND);
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
					msg.setStatus(Message.STATUS_NOT_SEND);
				}
			}else
			{

				//推送消息
				session.deliver(MessageUtil.transform(msg));
			}*/

			//推送消息
			  session.write(msg);
			  System.out.println(msg.getContent()+"-------");

		}else{

			/*User target = ((UserService)ContextHolder.getBean("userServiceImpl")).getUserByAccount(msg.getReceiver());
			//如果用户标示了DeviceToken 且 需要后台推送(Pushable=1) 说明这是ios设备需要使用anps发送
			if(StringUtil.isNotEmpty(target.getDeviceToken())&&target.getPushable()==User.PUSHABLE)
			{
				try {
					deliverByANPS(msg,target.getDeviceToken());
					msg.setStatus(Message.STATUS_SEND);
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
					msg.setStatus(Message.STATUS_NOT_SEND);
				}

			} */
			//未发送
		}
		try{
			//可以在这保存消息到数据库
			//((MessageService)ContextHolder.getBean("messageServiceImpl")).save(msg);
		}catch(Exception e){
			log.warn(" Messages insert to database failure!!");
		}
	}

/*	public void deliverByANPS(Message msg,String deviceToken) throws Exception {

		    String alert = getMessageTile(msg);
			// 被推送的iphone应用程序标示符
			PayLoad payLoad = new PayLoad();
			payLoad.addAlert(alert);
			payLoad.addBadge(1);
			payLoad.addSound("default");
			PushNotificationManager pushManager = PushNotificationManager.getInstance();
			pushManager.addDevice(deviceToken, deviceToken);
			String host = ConfigManager.getInstance().get("apple.anps.host"); // 测试用的苹果推送服务器
			int port = Integer.parseInt(ConfigManager.getInstance().get("apple.anps.port"));

			String password = ConfigManager.getInstance().get("apple.anps.p12.password");
            String p12File =  ConfigManager.getInstance().get("apple.anps.p12.file");
			pushManager.initializeConnection(host, port,this.getClass().getClassLoader().getResourceAsStream(p12File), password,
					SSLConnectionHelper.KEYSTORE_TYPE_PKCS12);

			// Send Push
			Device client = pushManager.getDevice(deviceToken);
			pushManager.sendNotification(client, payLoad); // 推送消息
			pushManager.stopConnection();
			pushManager.removeDevice(deviceToken);

	}

 */
}


text:
<?php

namespace LegalThings;

/**
 * @covers \LegalThings\PermissionMatcher
 */
class PermissionMatcherTest extends \Codeception\TestCase\Test
{
    /**
     * @var \UnitTester
     */
    protected $tester;

    /**
     * @var PermissionMatcher
     */
    protected $matcher;

    protected function _before()
    {
        $this->matcher = new PermissionMatcher();
    }

    protected function assertArrayMatches($expected, $source)
    {
        sort($expected);
        sort($source);
        $this->assertEquals($expected, $source);
    }

    // tests
    public function testMatchString()
    {
        $permissions = [
            'admin' => 'write',
            'guest' => 'read'
        ];

        $this->assertArrayMatches(['write'], $this->matcher->match($permissions, ['admin']));
        $this->assertArrayMatches(['write'], $this->matcher->match($permissions, ['admin', 'foo']));
        $this->assertArrayMatches(['read'], $this->matcher->match($permissions, ['guest']));
        $this->assertArrayMatches([], $this->matcher->match($permissions, ['foo']));
        $this->assertArrayMatches(['read', 'write'], $this->matcher->match($permissions, ['admin', 'guest']));
    }

    public function testMatchArray()
    {
        $permissions = [
            'admin' => ['read', 'write'],
            'guest' => ['read'],
            'owner' => ['manage']
        ];

        $this->assertArrayMatches(['read', 'write'], $this->matcher->match($permissions, ['admin']));
        $this->assertArrayMatches(['read', 'write'], $this->matcher->match($permissions, ['admin', 'foo']));
        $this->assertArrayMatches(['read'], $this->matcher->match($permissions, ['guest']));
        $this->assertArrayMatches([], $this->matcher->match($permissions, ['foo']));
        $this->assertArrayMatches(['read', 'write', 'manage'], $this->matcher->match($permissions, ['admin', 'guest', 'owner']));
    }

    public function testMatchNested()
    {
        $permissions = [
            'admin' => 'read',
            'admin.support' => 'write',
            'admin.dev' => 'develop'
        ];

        $this->assertArrayMatches(['read'], $this->matcher->match($permissions, ['admin']));
        $this->assertArrayMatches(['write'], $this->matcher->match($permissions, ['admin.support']));
        $this->assertArrayMatches(['read', 'write'], $this->matcher->match($permissions, ['admin', 'admin.support']));
    }

    public function testMatchWildcard()
    {
        $permissions = [
            'admin' => 'read',
            'admin.support' => 'write',
            'admin.dev' => 'develop',
            'admin.dev.tester' => 'test',
            'guest' => 'find',
            'guest.support' => 'sing',
            '*.support' => 'dance'
        ];

        $this->assertArrayMatches(['read'], $this->matcher->match($permissions, ['admin']));
        $this->assertArrayMatches(['write', 'develop', 'test'], $this->matcher->match($permissions, ['admin.*']));
        $this->assertArrayMatches(['test'], $this->matcher->match($permissions, ['admin.*.*']));
        $this->assertArrayMatches(['read', 'write', 'develop', 'test'], $this->matcher->match($permissions, ['admin', 'admin.*']));
        $this->assertArrayMatches(['develop', 'test'], $this->matcher->match($permissions, ['admin.d*']));

        $this->assertArrayMatches(['write', 'dance'], $this->matcher->match($permissions, ['admin.support']));
        $this->assertArrayMatches(['sing', 'dance'], $this->matcher->match($permissions, ['guest.support']));
        $this->assertArrayMatches(['dance'], $this->matcher->match($permissions, ['foo.support']));
        $this->assertArrayMatches(['write', 'sing', 'dance'], $this->matcher->match($permissions, ['*.support']));
    }

    public function testMatchCaseInsensitivePath()
    {
        $permissions = [
            'AdMiN' => 'read'
        ];

        $this->assertArrayMatches(['read'], $this->matcher->match($permissions, ['admin']));
        $this->assertArrayMatches(['read'], $this->matcher->match($permissions, ['ADMIN']));
        $this->assertArrayMatches(['read'], $this->matcher->match($permissions, ['AdMiN']));
        $this->assertArrayMatches(['read'], $this->matcher->match($permissions, ['aDmIn']));
    }

    public function testMatchResource()
    {
        $permissions = [
            '/admin' => 'read',
            '/admin/support' => 'write',
            '/admin/dev' => 'develop',
            '/bar/' => 'drink'
        ];

        $this->assertArrayMatches(['read'], $this->matcher->match($permissions, ['/admin']));
        $this->assertArrayMatches(['write'], $this->matcher->match($permissions, ['/admin/support']));
        $this->assertArrayMatches(['read', 'write'], $this->matcher->match($permissions, ['/admin', '/admin/support']));

        $this->assertArrayMatches(['read'], $this->matcher->match($permissions, ['/admin/']));
        $this->assertArrayMatches(['read'], $this->matcher->match($permissions, ['/admin/?']));
        $this->assertArrayMatches(['read'], $this->matcher->match($permissions, ['/admin?']));

        $this->assertArrayMatches(['drink'], $this->matcher->match($permissions, ['/bar']));
    }

    public function testMatchResourceWithQueryParams()
    {
        $permissions = [
            '/admin' => 'read',
            '/admin?role=support' => 'write',
            '/admin?role=dev' => 'develop',
            '/admin?job=lawyer&from=amsterdam' => 'party'
        ];

        $this->assertArrayMatches(['read'], $this->matcher->match($permissions, ['/admin']));
        $this->assertArrayMatches(['write'], $this->matcher->match($permissions, ['/admin?role=support']));
        $this->assertArrayMatches(['read', 'write'], $this->matcher->match($permissions, ['/admin', '/admin?role=support']));

        $this->assertArrayMatches(['party'], $this->matcher->match($permissions, ['/admin?job=lawyer&from=amsterdam']));
        $this->assertArrayMatches(['party'], $this->matcher->match($permissions, ['/admin?from=amsterdam&job=lawyer']));

        $this->assertArrayMatches([], $this->matcher->match($permissions, ['/admin/super?job=lawyer']));
        $this->assertArrayMatches([], $this->matcher->match($permissions, ['/foo']));
    }

    public function testMatchWildcardResource()
    {
        $permissions = [
            '/admin' => 'read',
            '/admin/support' => 'write',
            '/admin/dev' => 'develop',
            '/admin/dev/tester' => 'test',
            '/guest' => 'find',
            '/guest/support' => 'sing',
            '/*/support' => 'dance'
        ];

        $this->assertArrayMatches(['read'], $this->matcher->match($permissions, ['/admin']));
        $this->assertArrayMatches(['write', 'develop', 'test'], $this->matcher->match($permissions, ['/admin/*']));
        $this->assertArrayMatches(['test'], $this->matcher->match($permissions, ['/admin/*/*']));
        $this->assertArrayMatches(['read', 'write', 'develop', 'test'], $this->matcher->match($permissions, ['/admin', '/admin/*']));
        $this->assertArrayMatches(['develop', 'test'], $this->matcher->match($permissions, ['/admin/d*']));

        $this->assertArrayMatches(['write', 'dance'], $this->matcher->match($permissions, ['/admin/support']));
        $this->assertArrayMatches(['sing', 'dance'], $this->matcher->match($permissions, ['/guest/support']));
        $this->assertArrayMatches(['dance'], $this->matcher->match($permissions, ['/foo/support']));
        $this->assertArrayMatches(['write', 'sing', 'dance'], $this->matcher->match($permissions, ['/*/support']));
    }

    public function testMatchCaseInsensitiveQueryParams()
    {
        $permissions = [
            '/admin?ROlE=support' => 'write',
            '/admin?Job=lawyer&FROM=amsterdam' => 'party'
        ];

        $this->assertArrayMatches(['write'], $this->matcher->match($permissions, ['/admin?role=support']));
        $this->assertArrayMatches(['write'], $this->matcher->match($permissions, ['/admin?RolE=support']));
        $this->assertArrayMatches(['party'], $this->matcher->match($permissions, ['/admin?joB=lawyer&FroM=amsterdam']));
    }

    public function testMatchInverted()
    {
        $permissions = [
            'dev' => ['develop'],
            '!admin' => 'foo',
            'admin' => ['read', 'write']
        ];

        $this->assertArrayMatches(['develop', 'foo'], $this->matcher->match($permissions, ['dev']));
        $this->assertArrayMatches(['develop', 'read', 'write'], $this->matcher->match($permissions, ['dev', 'admin']));
        $this->assertArrayMatches(['foo'], $this->matcher->match($permissions, ['bar']));
        $this->assertArrayMatches(['read', 'write'], $this->matcher->match($permissions, ['admin']));
        $this->assertArrayMatches(['read', 'write'], $this->matcher->match($permissions, ['guest', 'admin']));
    }

    public function testMatchFull()
    {
        $permissions = [
            'admin' => 'read',
            'admin.support' => 'write',
            'admin.dev' => 'develop',
            'admin.dev.tester' => 'test',
            'guest' => 'find',
            'guest.support' => 'sing',
            '*.support' => 'dance'
        ];

        $this->assertEquals([
            'read' => ['admin']
        ], $this->matcher->matchFull($permissions, ['admin']));

        $this->assertEquals([
            'write' => ['admin.support', 'admin.*'],
            'develop' => ['admin.dev', 'admin.*'],
            'test' => ['admin.dev.tester', 'admin.*']
        ], $this->matcher->matchFull($permissions, ['admin.*']));

        $this->assertEquals([
            'test' => ['admin.dev.tester', 'admin.*.*']
        ], $this->matcher->matchFull($permissions, ['admin.*.*']));

        $this->assertEquals([
            'read' => ['admin'],
            'write' => ['admin.support', 'admin.*'],
            'develop' => ['admin.dev', 'admin.*'],
            'test' => ['admin.dev.tester', 'admin.*']
        ], $this->matcher->matchFull($permissions, ['admin', 'admin.*']));

        $this->assertEquals([
            'develop' => ['admin.dev', 'admin.d*'],
            'test' => ['admin.dev.tester', 'admin.d*']
        ], $this->matcher->matchFull($permissions, ['admin.d*']));
    }
}


text:
using EcsRx.Components;
using EcsRx.Components.Accessor;
using EcsRx.Entities;

namespace EcsRx.Extensions
{
    public static class IComponentAccessorExtensions
    {
        public static ref T Add<T>(this IComponentAccessor<T> accessor, IEntity entity)
            where T : IComponent, new() => ref entity.AddComponent<T>(accessor.ComponentTypeId);
    }
}


text: export const FETCH_PROJECTS = 'FETCH_PROJECTS';


text:
package test.env;

import javax.swing.*;
import java.awt.*;

/** @author eav 2009 */
public class WrapperPanel
        extends JPanel
{
    protected final JComponent component;

    public WrapperPanel( final JComponent component )
    {
        this( component, false );
    }

    public WrapperPanel( final JComponent component,
                         final boolean scroll )
    {
        super( new BorderLayout() );
        this.component = component;
        if ( scroll )
        {
            add( new JScrollPane( component ), BorderLayout.CENTER );
        }
        else
        {
            add( component, BorderLayout.CENTER );
        }
    }

    public JComponent unwrap()
    {
        return component;
    }
}


text:
module PostgreSQL
  module Connector
    def self.included(cls)
      cls.class_exec do
        include Log::Dependency

        extend Build
        extend ConfigureConnection
        extend Instance
        extend Settings

        setting :host
        setting :database
        setting :username
        setting :password
      end
    end

    def connection
      @connection ||= connect
    end

    def connect
      logger.trace "Connecting to database \"#{database}\" (Host: #{host})"

      Sequel.database_timezone = :utc

      Sequel.connect("postgresql://#{username}:#{password}@#{host}/#{database}?").tap do |connection|
        logger.debug "Connected to database \"#{database}\" (Host: #{host})"

        if respond_to? :specialize
          logger.trace "Specializing the connection to \"#{database}\" (Host: #{host})"
          specialize(connection)
          logger.debug "Specialized the connection to \"#{database}\" (Host: #{host})"
        end
      end
    end

    module Instance
      def instance
        @instance ||= build
      end
    end

    module Build
      def build
        instance = new

        settings = self.settings

        namespace = settings_namespace
        if namespace.nil?
          settings.set instance
        else
          settings.set instance, namespace
        end

        instance
      end

      def settings_namespace
        'postgres_connection'
      end
    end

    module ConfigureConnection
      def configure_connection(receiver, attr_name: nil)
        attr_name ||= :db_connection

        connection = instance.connection
        receiver.public_send "#{attr_name}=", connection
        connection
      end
    end

    module Settings
      def self.extended(cls)
        cls.singleton_class.class_exec do
          extend Virtual::Macro
          abstract :settings
        end
      end
    end
  end
end


text:
namespace Snow.Extensions
{
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;

    public static class IoExtensions
    {
        private static bool IsIn(this string name, IEnumerable<string> names)
        {
            return names.Contains(name.ToLower(), StringComparer.OrdinalIgnoreCase);
        }

        private static readonly string[] IgnoredFiles = { "cname", "compile.snow.bat", "snow.config", ".nojekyll", ".gitignore", ".deployment" };
        private static readonly string[] IgnoredDirectories = { ".git", "svn", ".svn", "snow", ".nojekyll", ".gitignore" };

        public static void Empty(this DirectoryInfo directory)
        {
            var files = directory.GetFiles().Where(x => !x.Name.IsIn(IgnoredFiles));

            " - Directory Cleanup before Compiling...".OutputIfDebug();

            foreach (var file in files)
            {
                file.Name.OutputIfDebug(prefixWith: " - Deleting File: ");
                file.Delete();
            }

            var directories = directory.GetDirectories()
                                       .Select(d => d)
                                       .Where(d => !d.Name.IsIn(IgnoredDirectories));

            foreach (var subDirectory in directories)
            {
                subDirectory.Name.OutputIfDebug(prefixWith: " - Deleting Dir: ");
                subDirectory.DeleteDirectory();
            }
        }

        public static void DeleteDirectory(this DirectoryInfo directory)
        {
            var files = directory.GetFiles();
            var dirs = directory.GetDirectories();

            foreach (var file in files)
            {
                file.Delete();
            }

            foreach (var dir in dirs)
            {
                DeleteDirectory(dir);
            }

            directory.Delete(true);
        }

        public static void Copy(this DirectoryInfo sourceDirectory, string destDirName, bool copySubDirs)
        {
            var dirs = sourceDirectory.GetDirectories();

            // If the source directory does not exist, throw an exception.
            if (!sourceDirectory.Exists)
            {
                throw new DirectoryNotFoundException("Source directory does not exist or could not be found: " + sourceDirectory);
            }

            // If the destination directory does not exist, create it.
            if (!Directory.Exists(destDirName))
            {
                Directory.CreateDirectory(destDirName);
            }

            // Get the file contents of the directory to copy.
            var files = sourceDirectory.GetFiles();

            foreach (var file in files)
            {
                // Create the path to the new copy of the file.
                var temppath = Path.Combine(destDirName, file.Name);

                // Copy the file.
                file.CopyTo(temppath, false);
            }

            // If copySubDirs is true, copy the subdirectories.
            if (copySubDirs)
            {
                foreach (var subdir in dirs)
                {
                    // Create the subdirectory.
                    string temppath = Path.Combine(destDirName, subdir.Name);

                    // Copy the subdirectories.
                    subdir.Copy(temppath, true);
                }
            }
        }
    }
}


text:
package com.beepscore.android.findmissingnumber;

import android.app.Application;
import android.test.ApplicationTestCase;

/**
 * Testing Fundamentals
 */
public class ApplicationTest extends ApplicationTestCase<Application> {
    public ApplicationTest() {
        super(Application.class);
    }
}


text:
package io.siddhi.core.query.pattern;

import io.siddhi.core.SiddhiAppRuntime;
import io.siddhi.core.SiddhiManager;
import io.siddhi.core.event.Event;
import io.siddhi.core.query.output.callback.QueryCallback;
import io.siddhi.core.stream.input.InputHandler;
import io.siddhi.core.util.EventPrinter;
import org.apache.log4j.Logger;
import org.testng.AssertJUnit;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

public class LogicalPatternTestCase {

    private static final Logger log = Logger.getLogger(LogicalPatternTestCase.class);
    private int inEventCount;
    private int removeEventCount;
    private boolean eventArrived;

    @BeforeMethod
    public void init() {
        inEventCount = 0;
        removeEventCount = 0;
        eventArrived = false;
    }

    @Test
    public void testQuery1() throws InterruptedException {
        log.info("testPatternLogical1 - OUT 1");

        SiddhiManager siddhiManager = new SiddhiManager();

        String streams = "" +
                "define stream Stream1 (symbol string, price float, volume int); " +
                "define stream Stream2 (symbol string, price float, volume int); ";
        String query = "" +
                "@info(name = 'query1') " +
                "from e1=Stream1[price > 20] -> e2=Stream2[price > e1.price] or e3=Stream2['IBM' == symbol] " +
                "select e1.symbol as symbol1, e2.symbol as symbol2 " +
                "insert into OutputStream ;";

        SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(streams + query);

        siddhiAppRuntime.addCallback("query1", new QueryCallback() {
            @Override
            public void receive(long timestamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timestamp, inEvents, removeEvents);
                if (inEvents != null) {
                    inEventCount = inEventCount + inEvents.length;
                    AssertJUnit.assertArrayEquals(new Object[]{"WSO2", "GOOG"}, inEvents[0].getData());
                    eventArrived = true;
                }
                if (removeEvents != null) {
                    removeEventCount = removeEventCount + removeEvents.length;
                }
                eventArrived = true;
            }

        });

        InputHandler stream1 = siddhiAppRuntime.getInputHandler("Stream1");
        InputHandler stream2 = siddhiAppRuntime.getInputHandler("Stream2");

        siddhiAppRuntime.start();

        stream1.send(new Object[]{"WSO2", 55.6f, 100});
        Thread.sleep(100);
        stream2.send(new Object[]{"GOOG", 59.6f, 100});
        Thread.sleep(100);

        AssertJUnit.assertEquals("Number of success events", 1, inEventCount);
        AssertJUnit.assertEquals("Number of remove events", 0, removeEventCount);
        AssertJUnit.assertEquals("Event arrived", true, eventArrived);

        siddhiAppRuntime.shutdown();
    }

    @Test
    public void testQuery2() throws InterruptedException {
        log.info("testPatternLogical2 - OUT 1");

        SiddhiManager siddhiManager = new SiddhiManager();

        String streams = "" +
                "define stream Stream1 (symbol string, price float, volume int); " +
                "define stream Stream2 (symbol string, price float, volume int); ";
        String query = "" +
                "@info(name = 'query1') " +
                "from e1=Stream1[price > 20] -> e2=Stream2[price > e1.price] or e3=Stream2['IBM' == symbol] " +
                "select e1.symbol as symbol1, e2.symbol as symbol2 " +
                "insert into OutputStream ;";

        SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(streams + query);

        siddhiAppRuntime.addCallback("query1", new QueryCallback() {
            @Override
            public void receive(long timestamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timestamp, inEvents, removeEvents);
                if (inEvents != null) {
                    inEventCount = inEventCount + inEvents.length;
                    AssertJUnit.assertArrayEquals(new Object[]{"WSO2", null}, inEvents[0].getData());
                    eventArrived = true;
                }
                if (removeEvents != null) {
                    removeEventCount = removeEventCount + removeEvents.length;
                }
                eventArrived = true;
            }

        });

        InputHandler stream1 = siddhiAppRuntime.getInputHandler("Stream1");
        InputHandler stream2 = siddhiAppRuntime.getInputHandler("Stream2");

        siddhiAppRuntime.start();

        stream1.send(new Object[]{"WSO2", 55.6f, 100});
        Thread.sleep(100);
        stream2.send(new Object[]{"IBM", 10.7f, 100});
        Thread.sleep(100);

        AssertJUnit.assertEquals("Number of success events", 1, inEventCount);
        AssertJUnit.assertEquals("Number of remove events", 0, removeEventCount);
        AssertJUnit.assertEquals("Event arrived", true, eventArrived);

        siddhiAppRuntime.shutdown();
    }

    @Test
    public void testQuery3() throws InterruptedException {
        log.info("testPatternLogical3 - OUT 1");

        SiddhiManager siddhiManager = new SiddhiManager();

        String streams = "" +
                "define stream Stream1 (symbol string, price float, volume int); " +
                "define stream Stream2 (symbol string, price float, volume int); ";
        String query = "" +
                "@info(name = 'query1') " +
                "from e1=Stream1[price > 20] -> e2=Stream2[price > e1.price] or e3=Stream2['IBM' == symbol] " +
                "select e1.symbol as symbol1, e2.price as price2, e3.price as price3 " +
                "insert into OutputStream ;";

        SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(streams + query);

        siddhiAppRuntime.addCallback("query1", new QueryCallback() {
            @Override
            public void receive(long timestamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timestamp, inEvents, removeEvents);
                if (inEvents != null) {
                    inEventCount = inEventCount + inEvents.length;
                    AssertJUnit.assertArrayEquals(new Object[]{"WSO2", 72.7f, null}, inEvents[0].getData());
                    eventArrived = true;
                }
                if (removeEvents != null) {
                    removeEventCount = removeEventCount + removeEvents.length;
                }
                eventArrived = true;
            }

        });

        InputHandler stream1 = siddhiAppRuntime.getInputHandler("Stream1");
        InputHandler stream2 = siddhiAppRuntime.getInputHandler("Stream2");

        siddhiAppRuntime.start();

        stream1.send(new Object[]{"WSO2", 55.6f, 100});
        Thread.sleep(100);
        stream2.send(new Object[]{"IBM", 72.7f, 100});
        Thread.sleep(100);
        stream2.send(new Object[]{"IBM", 75.7f, 100});
        Thread.sleep(100);

        AssertJUnit.assertEquals("Number of success events", 1, inEventCount);
        AssertJUnit.assertEquals("Number of remove events", 0, removeEventCount);
        AssertJUnit.assertEquals("Event arrived", true, eventArrived);

        siddhiAppRuntime.shutdown();
    }

    @Test
    public void testQuery4() throws InterruptedException {
        log.info("testPatternLogical4 - OUT 1");

        SiddhiManager siddhiManager = new SiddhiManager();

        String streams = "" +
                "define stream Stream1 (symbol string, price float, volume int); " +
                "define stream Stream2 (symbol string, price float, volume int); ";
        String query = "" +
                "@info(name = 'query1') " +
                "from e1=Stream1[price > 20] -> e2=Stream2[price > e1.price] and e3=Stream2['IBM' == symbol] " +
                "select e1.symbol as symbol1, e2.price as price2, e3.price as price3 " +
                "insert into OutputStream ;";

        SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(streams + query);

        siddhiAppRuntime.addCallback("query1", new QueryCallback() {
            @Override
            public void receive(long timestamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timestamp, inEvents, removeEvents);
                if (inEvents != null) {
                    inEventCount = inEventCount + inEvents.length;
                    AssertJUnit.assertArrayEquals(new Object[]{"WSO2", 72.7f, 4.7f}, inEvents[0].getData());
                    eventArrived = true;
                }
                if (removeEvents != null) {
                    removeEventCount = removeEventCount + removeEvents.length;
                }
                eventArrived = true;
            }

        });

        InputHandler stream1 = siddhiAppRuntime.getInputHandler("Stream1");
        InputHandler stream2 = siddhiAppRuntime.getInputHandler("Stream2");

        siddhiAppRuntime.start();

        stream1.send(new Object[]{"WSO2", 55.6f, 100});
        Thread.sleep(100);
        stream2.send(new Object[]{"GOOG", 72.7f, 100});
        Thread.sleep(100);
        stream2.send(new Object[]{"IBM", 4.7f, 100});
        Thread.sleep(100);

        AssertJUnit.assertEquals("Number of success events", 1, inEventCount);
        AssertJUnit.assertEquals("Number of remove events", 0, removeEventCount);
        AssertJUnit.assertEquals("Event arrived", true, eventArrived);

        siddhiAppRuntime.shutdown();
    }

    @Test
    public void testQuery5() throws InterruptedException {
        log.info("testPatternLogical5 - OUT 1");

        SiddhiManager siddhiManager = new SiddhiManager();

        String streams = "" +
                "define stream Stream1 (symbol string, price float, volume int); " +
                "define stream Stream2 (symbol string, price float, volume int); ";
        String query = "" +
                "@info(name = 'query1') " +
                "from e1=Stream1[price > 20] -> e2=Stream2[price > e1.price] and e3=Stream2['IBM' == symbol] " +
                "select e1.symbol as symbol1, e2.price as price2, e3.price as price3 " +
                "insert into OutputStream ;";

        SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(streams + query);

        siddhiAppRuntime.addCallback("query1", new QueryCallback() {
            @Override
            public void receive(long timestamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timestamp, inEvents, removeEvents);
                if (inEvents != null) {
                    inEventCount = inEventCount + inEvents.length;
                    AssertJUnit.assertArrayEquals(new Object[]{"WSO2", 72.7f, 72.7f}, inEvents[0].getData());
                    eventArrived = true;
                }
                if (removeEvents != null) {
                    removeEventCount = removeEventCount + removeEvents.length;
                }
                eventArrived = true;
            }

        });

        InputHandler stream1 = siddhiAppRuntime.getInputHandler("Stream1");
        InputHandler stream2 = siddhiAppRuntime.getInputHandler("Stream2");

        siddhiAppRuntime.start();

        stream1.send(new Object[]{"WSO2", 55.6f, 100});
        Thread.sleep(100);
        stream2.send(new Object[]{"IBM", 72.7f, 100});
        Thread.sleep(100);
        stream2.send(new Object[]{"IBM", 75.7f, 100});
        Thread.sleep(100);

        AssertJUnit.assertEquals("Number of success events", 1, inEventCount);
        AssertJUnit.assertEquals("Number of remove events", 0, removeEventCount);
        AssertJUnit.assertEquals("Event arrived", true, eventArrived);

        siddhiAppRuntime.shutdown();
    }

    @Test
    public void testQuery6() throws InterruptedException {
        log.info("testPatternLogical6 - OUT 1");

        SiddhiManager siddhiManager = new SiddhiManager();

        String streams = "" +
                "define stream Stream1 (symbol string, price float, volume int); " +
                "define stream Stream2 (symbol string, price float, volume int); ";
        String query = "" +
                "@info(name = 'query1') " +
                "from e1=Stream1[price > 20] -> e2=Stream2[price > e1.price] and e3=Stream1['IBM' == symbol] " +
                "select e1.symbol as symbol1, e2.price as price2, e3.price as price3 " +
                "insert into OutputStream ;";

        SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(streams + query);

        siddhiAppRuntime.addCallback("query1", new QueryCallback() {
            @Override
            public void receive(long timestamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timestamp, inEvents, removeEvents);
                if (inEvents != null) {
                    inEventCount = inEventCount + inEvents.length;
                    AssertJUnit.assertArrayEquals(new Object[]{"WSO2", 72.7f, 75.7f}, inEvents[0].getData());
                    eventArrived = true;
                }
                if (removeEvents != null) {
                    removeEventCount = removeEventCount + removeEvents.length;
                }
                eventArrived = true;
            }

        });

        InputHandler stream1 = siddhiAppRuntime.getInputHandler("Stream1");
        InputHandler stream2 = siddhiAppRuntime.getInputHandler("Stream2");

        siddhiAppRuntime.start();

        stream1.send(new Object[]{"WSO2", 55.6f, 100});
        Thread.sleep(100);
        stream2.send(new Object[]{"IBM", 72.7f, 100});
        Thread.sleep(100);
        stream1.send(new Object[]{"IBM", 75.7f, 100});
        Thread.sleep(100);

        AssertJUnit.assertEquals("Number of success events", 1, inEventCount);
        AssertJUnit.assertEquals("Number of remove events", 0, removeEventCount);
        AssertJUnit.assertEquals("Event arrived", true, eventArrived);

        siddhiAppRuntime.shutdown();
    }

    @Test
    public void testQuery7() throws InterruptedException {
        log.info("testPatternLogical7 - OUT 1");

        SiddhiManager siddhiManager = new SiddhiManager();

        String streams = "" +
                "define stream Stream1 (symbol string, price float, volume int); " +
                "define stream Stream2 (symbol string, price float, volume int); ";
        String query = "" +
                "@info(name = 'query1') " +
                "from e1=Stream1[price > 20] and e2=Stream2[price >30] -> e3=Stream2['IBM' == symbol] " +
                "select e1.symbol as symbol1, e2.price as price2, e3.price as price3 " +
                "insert into OutputStream ;";

        SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(streams + query);

        siddhiAppRuntime.addCallback("query1", new QueryCallback() {
            @Override
            public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timeStamp, inEvents, removeEvents);
                if (inEvents != null) {
                    inEventCount = inEventCount + inEvents.length;
                    AssertJUnit.assertArrayEquals(new Object[]{"WSO2", 72.7f, 4.7f}, inEvents[0].getData());
                    eventArrived = true;
                }
                if (removeEvents != null) {
                    removeEventCount = removeEventCount + removeEvents.length;
                }
                eventArrived = true;
            }

        });

        InputHandler stream1 = siddhiAppRuntime.getInputHandler("Stream1");
        InputHandler stream2 = siddhiAppRuntime.getInputHandler("Stream2");

        siddhiAppRuntime.start();

        stream1.send(new Object[]{"WSO2", 55.6f, 100});
        Thread.sleep(100);
        stream2.send(new Object[]{"GOOG", 72.7f, 100});
        Thread.sleep(100);
        stream2.send(new Object[]{"IBM", 4.7f, 100});
        Thread.sleep(100);

        AssertJUnit.assertEquals("Number of success events", 1, inEventCount);
        AssertJUnit.assertEquals("Number of remove events", 0, removeEventCount);
        AssertJUnit.assertEquals("Event arrived", true, eventArrived);

        siddhiAppRuntime.shutdown();
    }

    @Test
    public void testQuery8() throws InterruptedException {
        log.info("testPatternLogical8 - OUT 1");

        SiddhiManager siddhiManager = new SiddhiManager();

        String streams = "" +
                "define stream Stream1 (symbol string, price float, volume int); " +
                "define stream Stream2 (symbol string, price float, volume int); ";
        String query = "" +
                "@info(name = 'query1') " +
                "from e1=Stream1[price > 20] or e2=Stream2[price >30] -> e3=Stream2['IBM' == symbol] " +
                "select e1.symbol as symbol1, e2.price as price2, e3.price as price3 " +
                "insert into OutputStream ;";

        SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(streams + query);

        siddhiAppRuntime.addCallback("query1", new QueryCallback() {
            @Override
            public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timeStamp, inEvents, removeEvents);
                if (inEvents != null) {
                    inEventCount = inEventCount + inEvents.length;
                    AssertJUnit.assertArrayEquals(new Object[]{"WSO2", null, 4.7f}, inEvents[0].getData());
                    eventArrived = true;
                }
                if (removeEvents != null) {
                    removeEventCount = removeEventCount + removeEvents.length;
                }
                eventArrived = true;
            }

        });

        InputHandler stream1 = siddhiAppRuntime.getInputHandler("Stream1");
        InputHandler stream2 = siddhiAppRuntime.getInputHandler("Stream2");

        siddhiAppRuntime.start();

        stream1.send(new Object[]{"WSO2", 55.6f, 100});
        Thread.sleep(100);
        stream2.send(new Object[]{"GOOG", 72.7f, 100});
        Thread.sleep(100);
        stream2.send(new Object[]{"IBM", 4.7f, 100});
        Thread.sleep(100);

        AssertJUnit.assertEquals("Number of success events", 1, inEventCount);
        AssertJUnit.assertEquals("Number of remove events", 0, removeEventCount);
        AssertJUnit.assertEquals("Event arrived", true, eventArrived);

        siddhiAppRuntime.shutdown();
    }

    @Test
    public void testQuery9() throws InterruptedException {
        log.info("testPatternLogical9 - OUT 1");

        SiddhiManager siddhiManager = new SiddhiManager();

        String streams = "" +
                "define stream Stream1 (symbol string, price float, volume int); " +
                "define stream Stream2 (symbol string, price float, volume int); ";
        String query = "" +
                "@info(name = 'query1') " +
                "from e1=Stream1[price > 20] or e2=Stream2[price >30] -> e3=Stream2['IBM' == symbol] " +
                "select e1.symbol as symbol1, e2.price as price2, e3.price as price3 " +
                "insert into OutputStream ;";

        SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(streams + query);

        siddhiAppRuntime.addCallback("query1", new QueryCallback() {
            @Override
            public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timeStamp, inEvents, removeEvents);
                if (inEvents != null) {
                    inEventCount = inEventCount + inEvents.length;
                    AssertJUnit.assertArrayEquals(new Object[]{null, 72.7f, 4.7f}, inEvents[0].getData());
                    eventArrived = true;
                }
                if (removeEvents != null) {
                    removeEventCount = removeEventCount + removeEvents.length;
                }
                eventArrived = true;
            }

        });

        InputHandler stream2 = siddhiAppRuntime.getInputHandler("Stream2");

        siddhiAppRuntime.start();

        stream2.send(new Object[]{"GOOG", 72.7f, 100});
        Thread.sleep(100);
        stream2.send(new Object[]{"IBM", 4.7f, 100});
        Thread.sleep(100);

        AssertJUnit.assertEquals("Number of success events", 1, inEventCount);
        AssertJUnit.assertEquals("Number of remove events", 0, removeEventCount);
        AssertJUnit.assertEquals("Event arrived", true, eventArrived);

        siddhiAppRuntime.shutdown();
    }

    @Test
    public void testQuery10() throws InterruptedException {
        log.info("testPatternLogical10 - OUT 1");

        SiddhiManager siddhiManager = new SiddhiManager();

        String streams = "" +
                "define stream Stream1 (symbol string, price float, volume int); " +
                "define stream Stream2 (symbol string, price float, volume int); ";
        String query = "" +
                "@info(name = 'query1') " +
                "from e1=Stream1[price > 20] or e2=Stream2[price >30] -> e3=Stream2['IBM' == symbol] " +
                "select e1.symbol as symbol1, e2.price as price2, e3.price as price3 " +
                "insert into OutputStream ;";

        SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(streams + query);

        siddhiAppRuntime.addCallback("query1", new QueryCallback() {
            @Override
            public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timeStamp, inEvents, removeEvents);
                if (inEvents != null) {
                    inEventCount = inEventCount + inEvents.length;
                    AssertJUnit.assertArrayEquals(new Object[]{"WSO2", null, 4.7f}, inEvents[0].getData());
                    eventArrived = true;
                }
                if (removeEvents != null) {
                    removeEventCount = removeEventCount + removeEvents.length;
                }
                eventArrived = true;
            }

        });

        InputHandler stream1 = siddhiAppRuntime.getInputHandler("Stream1");
        InputHandler stream2 = siddhiAppRuntime.getInputHandler("Stream2");

        siddhiAppRuntime.start();

        stream1.send(new Object[]{"WSO2", 55.6f, 100});
        Thread.sleep(100);
        stream2.send(new Object[]{"IBM", 4.7f, 100});
        Thread.sleep(100);

        AssertJUnit.assertEquals("Number of success events", 1, inEventCount);
        AssertJUnit.assertEquals("Number of remove events", 0, removeEventCount);
        AssertJUnit.assertEquals("Event arrived", true, eventArrived);

        siddhiAppRuntime.shutdown();
    }

    @Test
    public void testQuery11() throws InterruptedException {
        log.info("testPatternLogical11 - OUT 2");

        SiddhiManager siddhiManager = new SiddhiManager();

        String streams = "" +
                "define stream Stream1 (symbol string, price float, volume int); " +
                "define stream Stream2 (symbol string, price float, volume int); " +
                "define stream Stream3 (symbol string, price float, volume int); ";

        String query = "" +
                "@info(name = 'query1') " +
                "from every e1=Stream1[price >20] -> e2=Stream2['IBM' == symbol] and " +
                "e3=Stream3['WSO2' == symbol]" +
                "select e1.price as price1, e2.price as price2, e3.price as price3 " +
                "insert into OutputStream ;";

        SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(streams + query);

        siddhiAppRuntime.addCallback("query1", new QueryCallback() {
            @Override
            public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timeStamp, inEvents, removeEvents);
                if (inEvents != null) {
                    inEventCount = inEventCount + inEvents.length;
                    switch (inEventCount) {
                        case 1:
                            AssertJUnit.assertArrayEquals(new Object[]{25.5f, 45.5f, 46.56f}, inEvents[0].getData());
                            break;
                        case 2:
                            AssertJUnit.assertArrayEquals(new Object[]{59.65f, 45.5f, 46.56f}, inEvents[0].getData());
                            break;
                        default:
                            AssertJUnit.assertEquals("Number of success events", 2, inEventCount);
                    }
                    eventArrived = true;
                }
                if (removeEvents != null) {
                    removeEventCount = removeEventCount + removeEvents.length;
                }
                eventArrived = true;
            }

        });

        InputHandler stream1 = siddhiAppRuntime.getInputHandler("Stream1");
        InputHandler stream2 = siddhiAppRuntime.getInputHandler("Stream2");
        InputHandler stream3 = siddhiAppRuntime.getInputHandler("Stream3");

        siddhiAppRuntime.start();

        stream1.send(new Object[]{"IBM", 25.5f, 100});
        Thread.sleep(100);
        stream1.send(new Object[]{"IBM", 59.65f, 100});
        Thread.sleep(100);
        stream2.send(new Object[]{"IBM", 45.5f, 100});
        Thread.sleep(100);
        stream3.send(new Object[]{"WSO2", 46.56f, 100});
        Thread.sleep(100);

        AssertJUnit.assertEquals("Number of success events", 2, inEventCount);
        AssertJUnit.assertEquals("Number of remove events", 0, removeEventCount);
        AssertJUnit.assertEquals("Event arrived", true, eventArrived);

        siddhiAppRuntime.shutdown();
    }

    @Test
    public void testQuery12() throws InterruptedException {
        log.info("testPatternLogical12 - OUT 2");

        SiddhiManager siddhiManager = new SiddhiManager();

        String streams = "" +
                "define stream Stream1 (symbol string, price float, volume int); " +
                "define stream Stream2 (symbol string, price float, volume int); " +
                "define stream Stream3 (symbol string, price float, volume int); ";

        String query = "" +
                "@info(name = 'query1') " +
                "from every e1=Stream1[price >20] -> e2=Stream2['IBM' == symbol] or " +
                "e3=Stream3['WSO2' == symbol]" +
                "select e1.price as price1, e2.price as price2, e3.price as price3 " +
                "insert into OutputStream ;";

        SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(streams + query);

        siddhiAppRuntime.addCallback("query1", new QueryCallback() {
            @Override
            public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timeStamp, inEvents, removeEvents);
                if (inEvents != null) {
                    inEventCount = inEventCount + inEvents.length;
                    switch (inEventCount) {
                        case 1:
                            AssertJUnit.assertArrayEquals(new Object[]{25.5f, 45.5f, null}, inEvents[0].getData());
                            break;
                        case 2:
                            AssertJUnit.assertArrayEquals(new Object[]{59.65f, 45.5f, null}, inEvents[0].getData());
                            break;
                        default:
                            AssertJUnit.assertEquals("Number of success events", 2, inEventCount);
                    }
                    eventArrived = true;
                }
                if (removeEvents != null) {
                    removeEventCount = removeEventCount + removeEvents.length;
                }
                eventArrived = true;
            }

        });

        InputHandler stream1 = siddhiAppRuntime.getInputHandler("Stream1");
        InputHandler stream2 = siddhiAppRuntime.getInputHandler("Stream2");
        InputHandler stream3 = siddhiAppRuntime.getInputHandler("Stream3");

        siddhiAppRuntime.start();

        stream1.send(new Object[]{"IBM", 25.5f, 100});
        Thread.sleep(100);
        stream1.send(new Object[]{"IBM", 59.65f, 100});
        Thread.sleep(100);
        stream2.send(new Object[]{"IBM", 45.5f, 100});
        Thread.sleep(100);

        AssertJUnit.assertEquals("Number of success events", 2, inEventCount);
        AssertJUnit.assertEquals("Number of remove events", 0, removeEventCount);
        AssertJUnit.assertEquals("Event arrived", true, eventArrived);

        siddhiAppRuntime.shutdown();
    }

    @Test
    public void testQuery13() throws InterruptedException {
        log.info("testQuery13 - OUT 1");

        SiddhiManager siddhiManager = new SiddhiManager();

        String streams = "" +
                "define stream Stream1 (symbol string, price float, volume int); " +
                "define stream Stream2 (symbol string, price float, volume int); ";
        String query = "" +
                "@info(name = 'query1') " +
                "from e1=Stream1[price > 20] and e2=Stream2[price >30] " +
                "select e1.symbol as symbol1, e2.price as price2 " +
                "insert into OutputStream ;";

        SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(streams + query);

        siddhiAppRuntime.addCallback("query1", new QueryCallback() {
            @Override
            public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timeStamp, inEvents, removeEvents);
                if (inEvents != null) {
                    inEventCount = inEventCount + inEvents.length;
                    AssertJUnit.assertArrayEquals(new Object[]{"WSO2", 35.0f}, inEvents[0].getData());
                    eventArrived = true;
                }
                if (removeEvents != null) {
                    removeEventCount = removeEventCount + removeEvents.length;
                }
                eventArrived = true;
            }

        });

        InputHandler stream1 = siddhiAppRuntime.getInputHandler("Stream1");
        InputHandler stream2 = siddhiAppRuntime.getInputHandler("Stream2");

        siddhiAppRuntime.start();

        stream1.send(new Object[]{"WSO2", 25.0f, 100});
        Thread.sleep(100);
        stream2.send(new Object[]{"IBM", 35.0f, 100});
        Thread.sleep(100);
        stream1.send(new Object[]{"GOOGLE", 45.0f, 100});
        Thread.sleep(100);
        stream2.send(new Object[]{"ORACLE", 55.0f, 100});
        Thread.sleep(100);

        AssertJUnit.assertEquals("Number of success events", 1, inEventCount);
        AssertJUnit.assertEquals("Number of remove events", 0, removeEventCount);
        AssertJUnit.assertEquals("Event arrived", true, eventArrived);

        siddhiAppRuntime.shutdown();
    }

    @Test
    public void testQuery14() throws InterruptedException {
        log.info("testQuery14 - OUT 1");

        SiddhiManager siddhiManager = new SiddhiManager();

        String streams = "" +
                "define stream Stream1 (symbol string, price float, volume int); " +
                "define stream Stream2 (symbol string, price float, volume int); ";
        String query = "" +
                "@info(name = 'query1') " +
                "from e1=Stream1[price > 20] or e2=Stream2[price >30] " +
                "select e1.symbol as symbol1, e2.price as price2 " +
                "insert into OutputStream ;";

        SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(streams + query);

        siddhiAppRuntime.addCallback("query1", new QueryCallback() {
            @Override
            public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timeStamp, inEvents, removeEvents);
                if (inEvents != null) {
                    inEventCount = inEventCount + inEvents.length;
                    eventArrived = true;
                    AssertJUnit.assertArrayEquals(new Object[]{"WSO2", null}, inEvents[0].getData());
                }
                if (removeEvents != null) {
                    removeEventCount = removeEventCount + removeEvents.length;
                }
                eventArrived = true;
            }

        });

        InputHandler stream1 = siddhiAppRuntime.getInputHandler("Stream1");
        InputHandler stream2 = siddhiAppRuntime.getInputHandler("Stream2");

        siddhiAppRuntime.start();

        stream1.send(new Object[]{"WSO2", 25.0f, 100});
        Thread.sleep(100);
        stream2.send(new Object[]{"IBM", 35.0f, 100});
        Thread.sleep(100);
        stream2.send(new Object[]{"ORACLE", 45.0f, 100});
        Thread.sleep(100);

        AssertJUnit.assertEquals("Number of success events", 1, inEventCount);
        AssertJUnit.assertEquals("Number of remove events", 0, removeEventCount);
        AssertJUnit.assertEquals("Event arrived", true, eventArrived);

        siddhiAppRuntime.shutdown();
    }

    @Test
    public void testQuery15() throws InterruptedException {
        log.info("testQuery15 - OUT 2");

        SiddhiManager siddhiManager = new SiddhiManager();

        String streams = "" +
                "define stream Stream1 (symbol string, price float, volume int); " +
                "define stream Stream2 (symbol string, price float, volume int); ";
        String query = "" +
                "@info(name = 'query1') " +
                "from every (e1=Stream1[price > 20] and e2=Stream2[price >30]) " +
                "select e1.symbol as symbol1, e2.price as price2 " +
                "insert into OutputStream ;";

        SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(streams + query);

        siddhiAppRuntime.addCallback("query1", new QueryCallback() {
            @Override
            public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timeStamp, inEvents, removeEvents);
                if (inEvents != null) {
                    inEventCount = inEventCount + inEvents.length;
                    eventArrived = true;
                    switch (inEventCount) {
                        case 1:
                            AssertJUnit.assertArrayEquals(new Object[]{"WSO2", 35.0f}, inEvents[0].getData());
                            break;
                        case 2:
                            AssertJUnit.assertArrayEquals(new Object[]{"GOOGLE", 55.0f}, inEvents[0].getData());
                    }
                }
                if (removeEvents != null) {
                    removeEventCount = removeEventCount + removeEvents.length;
                }
                eventArrived = true;
            }

        });

        InputHandler stream1 = siddhiAppRuntime.getInputHandler("Stream1");
        InputHandler stream2 = siddhiAppRuntime.getInputHandler("Stream2");

        siddhiAppRuntime.start();

        stream1.send(new Object[]{"WSO2", 25.0f, 100});
        Thread.sleep(100);
        stream2.send(new Object[]{"IBM", 35.0f, 100});
        Thread.sleep(100);
        stream1.send(new Object[]{"GOOGLE", 45.0f, 100});
        Thread.sleep(100);
        stream2.send(new Object[]{"ORACLE", 55.0f, 100});
        Thread.sleep(100);

        AssertJUnit.assertEquals("Number of success events", 2, inEventCount);
        AssertJUnit.assertEquals("Number of remove events", 0, removeEventCount);
        AssertJUnit.assertEquals("Event arrived", true, eventArrived);

        siddhiAppRuntime.shutdown();
    }

    @Test
    public void testQuery16() throws InterruptedException {
        log.info("testQuery16 - OUT 3");

        SiddhiManager siddhiManager = new SiddhiManager();

        String streams = "" +
                "define stream Stream1 (symbol string, price float, volume int); " +
                "define stream Stream2 (symbol string, price float, volume int); ";
        String query = "" +
                "@info(name = 'query1') " +
                "from every (e1=Stream1[price > 20] or e2=Stream2[price >30]) " +
                "select e1.symbol as symbol1, e2.price as price2 " +
                "insert into OutputStream ;";

        SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(streams + query);

        siddhiAppRuntime.addCallback("query1", new QueryCallback() {
            @Override
            public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timeStamp, inEvents, removeEvents);
                if (inEvents != null) {
                    inEventCount = inEventCount + inEvents.length;
                    eventArrived = true;

                    switch (inEventCount) {
                        case 1:
                            AssertJUnit.assertArrayEquals(new Object[]{"WSO2", null}, inEvents[0].getData());
                            break;
                        case 2:
                            AssertJUnit.assertArrayEquals(new Object[]{null, 35.0f}, inEvents[0].getData());
                            break;
                        case 3:
                            AssertJUnit.assertArrayEquals(new Object[]{null, 45.0f}, inEvents[0].getData());
                    }
                }
                if (removeEvents != null) {
                    removeEventCount = removeEventCount + removeEvents.length;
                }
                eventArrived = true;
            }

        });

        InputHandler stream1 = siddhiAppRuntime.getInputHandler("Stream1");
        InputHandler stream2 = siddhiAppRuntime.getInputHandler("Stream2");

        siddhiAppRuntime.start();

        stream1.send(new Object[]{"WSO2", 25.0f, 100});
        Thread.sleep(100);
        stream2.send(new Object[]{"IBM", 35.0f, 100});
        Thread.sleep(100);
        stream2.send(new Object[]{"ORACLE", 45.0f, 100});
        Thread.sleep(100);

        AssertJUnit.assertEquals("Number of success events", 3, inEventCount);
        AssertJUnit.assertEquals("Number of remove events", 0, removeEventCount);
        AssertJUnit.assertEquals("Event arrived", true, eventArrived);

        siddhiAppRuntime.shutdown();
    }

    @Test
    public void testQuery17() throws InterruptedException {
        log.info("testQuery17 - OUT 0");

        SiddhiManager siddhiManager = new SiddhiManager();

        String streams = "" +
                "define stream Stream1 (symbol string, price float, volume int); " +
                "define stream Stream2 (symbol string, price float, volume int); ";
        String query = "" +
                "@info(name = 'query1') " +
                "from e1=Stream1[price > 20] -> e2=Stream2[price > e1.price] or e3=Stream2['IBM' == symbol] " +
                " within 1 sec " +
                "select e1.symbol as symbol1, e2.symbol as symbol2 " +
                "insert into OutputStream ;";

        SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(streams + query);

        siddhiAppRuntime.addCallback("query1", new QueryCallback() {
            @Override
            public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timeStamp, inEvents, removeEvents);
                if (inEvents != null) {
                    inEventCount = inEventCount + inEvents.length;
                    eventArrived = true;
                }
                if (removeEvents != null) {
                    removeEventCount = removeEventCount + removeEvents.length;
                }
                eventArrived = true;
            }

        });

        InputHandler stream1 = siddhiAppRuntime.getInputHandler("Stream1");
        InputHandler stream2 = siddhiAppRuntime.getInputHandler("Stream2");

        siddhiAppRuntime.start();

        stream1.send(new Object[]{"WSO2", 55.6f, 100});
        Thread.sleep(1100);
        stream2.send(new Object[]{"GOOG", 59.6f, 100});
        Thread.sleep(100);

        AssertJUnit.assertEquals("Number of success events", 0, inEventCount);
        AssertJUnit.assertEquals("Number of remove events", 0, removeEventCount);
        AssertJUnit.assertEquals("Event arrived", false, eventArrived);

        siddhiAppRuntime.shutdown();
    }

    @Test
    public void testQuery18() throws InterruptedException {
        log.info("testQuery18 - OUT 0");

        SiddhiManager siddhiManager = new SiddhiManager();

        String streams = "" +
                "define stream Stream1 (symbol string, price float, volume int); " +
                "define stream Stream2 (symbol string, price float, volume int); ";
        String query = "" +
                "@info(name = 'query1') " +
                "from e1=Stream1[price > 20] -> e2=Stream2[price > e1.price] and e3=Stream2['IBM' == symbol] " +
                " within 1 sec " +
                "select e1.symbol as symbol1, e2.price as price2, e3.price as price3 " +
                "insert into OutputStream ;";

        SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(streams + query);

        siddhiAppRuntime.addCallback("query1", new QueryCallback() {
            @Override
            public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timeStamp, inEvents, removeEvents);
                if (inEvents != null) {
                    inEventCount = inEventCount + inEvents.length;
                    eventArrived = true;
                }
                if (removeEvents != null) {
                    removeEventCount = removeEventCount + removeEvents.length;
                }
                eventArrived = true;
            }

        });

        InputHandler stream1 = siddhiAppRuntime.getInputHandler("Stream1");
        InputHandler stream2 = siddhiAppRuntime.getInputHandler("Stream2");

        siddhiAppRuntime.start();

        stream1.send(new Object[]{"WSO2", 55.6f, 100});
        Thread.sleep(100);
        stream2.send(new Object[]{"GOOG", 72.7f, 100});
        Thread.sleep(1100);
        stream2.send(new Object[]{"IBM", 4.7f, 100});
        Thread.sleep(100);

        AssertJUnit.assertEquals("Number of success events", 0, inEventCount);
        AssertJUnit.assertEquals("Number of remove events", 0, removeEventCount);
        AssertJUnit.assertEquals("Event arrived", false, eventArrived);

        siddhiAppRuntime.shutdown();
    }

    @Test
    public void testQuery19() throws InterruptedException {
        log.info("testQuery19 - OUT 2");

        SiddhiManager siddhiManager = new SiddhiManager();

        String streams = "" +
                "define stream Stream1 (symbol string, price float, volume int); " +
                "define stream Stream2 (symbol string, price float, volume int); " +
                "define stream Stream3 (symbol string, price float, volume int); ";
        String query = "" +
                "@info(name = 'query1') " +
                "from every (e1=Stream1[price>10] and e2=Stream2[price>20]) -> e3=Stream3[price>30] " +
                "select e1.symbol as symbol1, e2.symbol as symbol2, e3.symbol as symbol3 " +
                "insert into OutputStream ;";

        SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(streams + query);

        siddhiAppRuntime.addCallback("query1", new QueryCallback() {
            @Override
            public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timeStamp, inEvents, removeEvents);
                if (inEvents != null) {
                    inEventCount = inEventCount + inEvents.length;
                    eventArrived = true;

                    switch (inEventCount) {
                        case 1:
                            AssertJUnit.assertArrayEquals(new Object[]{"ORACLE", "MICROSOFT", "GOOGLE"},
                                    inEvents[0].getData());
                            break;
                        case 2:
                            AssertJUnit.assertArrayEquals(new Object[]{"IBM", "WSO2", "GOOGLE"}, inEvents[0].getData());
                    }
                }
                if (removeEvents != null) {
                    removeEventCount = removeEventCount + removeEvents.length;
                }
                eventArrived = true;
            }

        });

        InputHandler stream1 = siddhiAppRuntime.getInputHandler("Stream1");
        InputHandler stream2 = siddhiAppRuntime.getInputHandler("Stream2");
        InputHandler stream3 = siddhiAppRuntime.getInputHandler("Stream3");

        siddhiAppRuntime.start();

        stream1.send(new Object[]{"ORACLE", 15.0f, 100});
        Thread.sleep(100);
        stream2.send(new Object[]{"MICROSOFT", 45.0f, 100});
        Thread.sleep(100);
        stream1.send(new Object[]{"IBM", 55.0f, 100});
        Thread.sleep(100);
        stream2.send(new Object[]{"WSO2", 65.0f, 100});
        Thread.sleep(100);
        stream3.send(new Object[]{"GOOGLE", 75.0f, 100});
        Thread.sleep(100);

        AssertJUnit.assertEquals("Number of success events", 2, inEventCount);
        AssertJUnit.assertEquals("Number of remove events", 0, removeEventCount);
        AssertJUnit.assertTrue("Event arrived", eventArrived);

        siddhiAppRuntime.shutdown();
    }
}


text:
package edu.sjsu.cohort6.openstack.common.util;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.type.TypeFactory;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;

import javax.ws.rs.core.Response;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.logging.Logger;

/**
 * Created by rwatsh on 9/22/15.
 */
public class CommonUtils {

    private static final Logger log = Logger.getLogger(CommonUtils.class.getName());
    /**
     * Converts a JSON array of objects to List of Java Object types.
     * For example, convert a JSON array of students to List<Student>.
     *
     * @param jsonArrayStr
     * @param clazz
     * @param <T>
     * @return
     * @throws IOException
     */
    public static <T> List<T> convertJsonArrayToList(String jsonArrayStr, Class<T> clazz) throws IOException {
        ObjectMapper mapper = new ObjectMapper();
        //jsonArrayStr = removeIdField(jsonArrayStr);
        return mapper.readValue(jsonArrayStr,
                TypeFactory.defaultInstance().constructCollectionType(List.class, clazz));
    }

    /**
     * Convert JSON string to object.
     *
     * @param jsonStr
     * @param clazz
     * @param <T>
     * @return
     * @throws IOException
     */
    public static <T> T convertJsonToObject(String jsonStr, Class<T> clazz) throws IOException {
        ObjectMapper mapper = new ObjectMapper();
        //jsonStr = removeIdField(jsonStr);
        return mapper.readValue(jsonStr, clazz);
    }

    /**
     * This method was needed to parse entity attribute out of other "unwanted" properties that Jersey response was
     * appending. With this approach any unsturctured JSON data can be parsed into a generic JSONObject type and
     * only the desired field of a known name can be singled out of it. Once we single out the entity piece from the
     * response we use Jackson again to parse entity to our known type (Student, Course or User).
     *
     * @param response      jersey response
     * @param clazz         the known type
     * @return
     * @throws IOException
     * @throws org.json.simple.parser.ParseException
     */
    public static <T> T convertJsonToObject(Response response, Class<T> clazz) throws IOException, org.json.simple.parser.ParseException {
        String json = getJsonFromResponse(response);
        return convertJsonToObject(json, clazz);
    }

    /**
     * This method parses the generic jersey response to a generic JSONObject and singles out the "entity" piece
     * from the generic response.
     *
     * @param response
     * @return
     * @throws org.json.simple.parser.ParseException
     */
    private static String getJsonFromResponse(Response response) throws org.json.simple.parser.ParseException {
        String c = response.readEntity(String.class);
        log.info(c.toString());
        JSONParser parser=new JSONParser();
        JSONObject json = (JSONObject) parser.parse(c);
        JSONObject jsonObject = (JSONObject) json.get("entity");
        return jsonObject.toJSONString();
    }

    /**
     * Converts object to JSON string representation.
     * It could even be a list of objects which will be converted to JSON array on objects.
     *
     * @param object
     * @param <T>
     * @return
     * @throws IOException
     */
    public static <T> String convertObjectToJson(T object) throws IOException {
        final ObjectMapper mapper = new ObjectMapper();
        mapper.enable(SerializationFeature.INDENT_OUTPUT);
        return mapper.writeValueAsString(object);
    }

    public static String convertListToJson(List<?> list) throws IOException {
        if (list == null) {
            // return empty list
            list = new ArrayList<Object>();
        }
        final ByteArrayOutputStream out = new ByteArrayOutputStream();
        final ObjectMapper mapper = new ObjectMapper();

        mapper.writeValue(out, list);

        final byte[] data = out.toByteArray();
        return new String(data);
    }

    private static String generateMD5Hash(String plaintext) throws NoSuchAlgorithmException {
        MessageDigest m = MessageDigest.getInstance("MD5");
        m.reset();
        m.update(plaintext.getBytes());
        byte[] digest = m.digest();
        BigInteger bigInt = new BigInteger(1, digest);
        String hashtext = bigInt.toString(16);
        // Now we need to zero pad it if you actually want the full 32 chars.
        while (hashtext.length() < 32) {
            hashtext = "0" + hashtext;
        }
        return hashtext;
    }

    /**
     * Converts string form of date in a Date object in UTC timezone.
     *
     * @param dateInString
     * @return
     * @throws ParseException
     */
    public static Date getDateFromString(String dateInString) throws ParseException {
        SimpleDateFormat sdf = new SimpleDateFormat("M-dd-yyyy HH:mm");
        return sdf.parse(dateInString);
    }
}


text:
# About speed
We add a method at [ExoPlayer.java](https://github.com/yangwuan55/ExoPlayer/blob/playbackSpeed/library/src/main/java/com/google/android/exoplayer2/ExoPlayer.java)

```java

  /**
   * @param speed the speed factor: speed_of_playback / speed_of_real_clock
   */
  void setPlaybackSpeed(float speed);

```

just use the [SimpleExoPlayer](https://github.com/yangwuan55/ExoPlayer/blob/playbackSpeed/library/src/main/java/com/google/android/exoplayer2/SimpleExoPlayer.java).

Or you can run the [demo](https://github.com/yangwuan55/ExoPlayer/tree/playbackSpeed/demo_speed).

Hope useful to you.

#Thanks
[BigPeach](https://github.com/BigPeach)

[K Sun](https://github.com/jcodeing)


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FiveLib.IO;

namespace FiveLib.Ausar.Cache.Structures
{
    internal class DataReferenceDefinitionStruct : IBinarySerializable
    {
        public int ParentStructIndex;
        public int Unknown4;
        public int TargetIndex;
        public int FieldBlockIndex;
        public uint FieldBlockOffset;

        public void Serialize(BinarySerializer s)
        {
            s.Value(ref ParentStructIndex);
            s.Value(ref Unknown4);
            s.Value(ref TargetIndex);
            s.Value(ref FieldBlockIndex);
            s.Value(ref FieldBlockOffset);
        }
    }
}


text:
package org.jkiss.dbeaver.ext.db2.model.dict;

import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.ext.db2.editors.DB2ObjectType;
import org.jkiss.dbeaver.model.DBPNamedObject;

/**
 * DB2 Type of Package Dependency
 *
 * @author Denis Forveille
 */
public enum DB2PackageDepType implements DBPNamedObject {
    A("Table alias", DB2ObjectType.ALIAS),

    B("Trigger", DB2ObjectType.TRIGGER),

    D("Server"),

    F("Routine", DB2ObjectType.ROUTINE),

    G("Global temporary table", DB2ObjectType.TABLE),

    I("Index", DB2ObjectType.INDEX),

    M("Function Mapping", DB2ObjectType.UDF),

    N("Nickname", DB2ObjectType.NICKNAME),

    O("Privilege dependency on all subtables or subviews in a table or view hierarchy"),

    P("Page Size"),

    Q("Sequence", DB2ObjectType.SEQUENCE),

    R("UDT", DB2ObjectType.UDT),

    S("MQT", DB2ObjectType.MQT),

    T("Table", DB2ObjectType.TABLE),

    U("Typed table", DB2ObjectType.TABLE),

    V("View", DB2ObjectType.VIEW),

    W("Typed view", DB2ObjectType.VIEW),

    X("Index extension"),

    Z("XSR object", DB2ObjectType.XML_SCHEMA),

    m("Module", DB2ObjectType.MODULE),

    n("Database Partiton Group"),

    q("Sequence alias", DB2ObjectType.ALIAS),

    u("Module alias", DB2ObjectType.ALIAS),

    v("Global variable", DB2ObjectType.VARIABLE),

    ZZ_4("Application-period temporal table"),

    ZZ_5("Application-period temporal table");

    public static final String FAKE_PREFIX = "ZZ_";

    private String name;
    private DB2ObjectType db2ObjectType;

    // -----------
    // Constructor
    // -----------

    private DB2PackageDepType(String name, DB2ObjectType db2ObjectType)
    {
        this.name = name;
        this.db2ObjectType = db2ObjectType;
    }

    private DB2PackageDepType(String name)
    {
        this(name, null);
    }

    // -----------------------
    // Display @Property Value
    // -----------------------
    @Override
    public String toString()
    {
        return name;
    }

    // ----------------
    // Standard Getters
    // ----------------

    @NotNull
    @Override
    public String getName()
    {
        return name;
    }

    public DB2ObjectType getDb2ObjectType()
    {
        return db2ObjectType;
    }

}


text:
using System.ComponentModel.DataAnnotations;

namespace OpenInvoicePeru.Comun.Dto.Intercambio
{
    public class CrearTokenRequest
    {
        [Required]
        public string ClientId { get; set; }

        [Required]
        public string ClientSecret { get; set; }
    }
}


text:
package com.desperado.customerlib.view.infiniteviewpager;

import android.content.Context;
import android.view.animation.Interpolator;
import android.widget.Scroller;

public class FixedSpeedScroller extends Scroller {
    private int scrollSpeed = 450;

    public FixedSpeedScroller(Context context) {
        super(context);
    }

    public FixedSpeedScroller(Context context, Interpolator interpolator, int scrollSpeed) {
        super(context, interpolator);
        this.scrollSpeed = scrollSpeed;
    }

    @Override
    public void startScroll(int startX, int startY, int dx, int dy, int duration) {
        super.startScroll(startX, startY, dx, dy, this.scrollSpeed);
    }
}


text:
package inmemory

import (
	"context"
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestNewInMemoryManager(t *testing.T) {
	ctx := context.Background()
	inMemoryManager := NewInMemoryManager()
	inMemoryManager.UpdateConfig(ctx, map[string]interface{}{
		"ldap_url":         "ldaps://ldap.vmware.com",
		"ldap_timeout":     5,
		"ldap_verify_cert": true,
	})
	assert.Equal(t, "ldaps://ldap.vmware.com", inMemoryManager.Get(ctx, "ldap_url").GetString())
	assert.Equal(t, 5, inMemoryManager.Get(ctx, "ldap_timeout").GetInt())
	assert.Equal(t, true, inMemoryManager.Get(ctx, "ldap_verify_cert").GetBool())
}


text:
Go package for easier work with websockets.

## Install

```
go get gopkg.in/aliukevicius/dispatcher.v1
```

## Import

```
import "gopkg.in/aliukevicius/dispatcher.v1"
```

## Example

Please check the example folder for details.

### Server side
```go

func createUserHandler() dispatcher.Handler {
	return func(conn *dispatcher.Conn, data interface{}) {

		uData := data.(map[string]interface{})

		user := newUser{
			ID:       101,
			Name:     uData["name"].(string),
			Email:    uData["email"].(string),
			Passowrd: "password",
		}

		conn.Emit("newUser", user)
	}
}

func timeBroadcaster(disp *dispatcher.Dispatcher) {
	for {
		time.Sleep(time.Second)
		disp.Broadcast("time", time.Now().Format("2006-01-02 15:04:05"))
	}
}

```

### Client side

```js

	d.On('newUser', function (data) {
		console.log("New user: ", data);
	});

	msg = {
		name: "John Doe",
		email: "john@dispatcher.doe"
	};

	d.Emit("createUser", msg);

	d.Join("time", function (data) {
		console.log("Time: ", data);
	});

	d.Join("chat", function (data) {
		console.log("Chat message: ", data)
	});

	d.Broadcast("chat", "Awesome chat message!");

```


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

<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
T - 索引
</TITLE>

<META NAME="date" CONTENT="2011-11-21">

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

      概述
      软件包
      类
      使用
      树
      已过时
    索引
      帮助

 上一个字母
 下一个字母

  框架
 无框架

  所有类

A B C D E F G H I J L M N O P Q R S T V W X

T

tab_no_cd -
类 com.teleca.jamendo.R.drawable 中的静态变量

tab_review -
类 com.teleca.jamendo.R.drawable 中的静态变量

tab_size -
类 com.teleca.jamendo.R.dimen 中的静态变量

TableLayout -
类 com.teleca.jamendo.R.id 中的静态变量

TableRow01 -
类 com.teleca.jamendo.R.id 中的静态变量

TabReviews -
类 com.teleca.jamendo.R.id 中的静态变量

TabTracks -
类 com.teleca.jamendo.R.id 中的静态变量

TAG -
类 com.teleca.jamendo.JamendoApplication 中的静态变量

Tag used for DDMS logging

teleca_logo -
类 com.teleca.jamendo.R.drawable 中的静态变量

teleca_logo_splash -
类 com.teleca.jamendo.R.drawable 中的静态变量

terms_button -
类 com.teleca.jamendo.R.string 中的静态变量

terms_of_use -
类 com.teleca.jamendo.R.string 中的静态变量

TermsButton -
类 com.teleca.jamendo.R.id 中的静态变量

textView1 -
类 com.teleca.jamendo.R.id 中的静态变量

timeline_bkg -
类 com.teleca.jamendo.R.drawable 中的静态变量

timeline_frg -
类 com.teleca.jamendo.R.drawable 中的静态变量

toggleFirstRun -
类 com.teleca.jamendo.R.id 中的静态变量

top100_fail -
类 com.teleca.jamendo.R.string 中的静态变量

TopBar -
类 com.teleca.jamendo.R.id 中的静态变量

TotalTimeTextView -
类 com.teleca.jamendo.R.id 中的静态变量

Track - com.teleca.jamendo.api 中的 类
Unit track

 fielddescriptionexample
 idnumeric id of the track108254
 namename of the track"Tout se passera bien"
 durationlength of the track (in seconds)310
 urllink to the page of the track on Jamendo (lyrics)http://www.jamendo.com/track/108254
 streammusic stream of the trackhttp://www.jamendo.com/track/108254

Track() -
类 com.teleca.jamendo.api.Track 的构造方法

track_row -
类 com.teleca.jamendo.R.layout 中的静态变量

trackAvailable(Track) -
接口 com.teleca.jamendo.util.download.DownloadDatabase 中的方法

Checks if tracks is available

trackAvailable(Track) -
类 com.teleca.jamendo.util.download.DownloadDatabaseImpl 中的方法

trackAvailable(Track) -
接口 com.teleca.jamendo.util.download.DownloadProvider 中的方法

trackAvailable(Track) -
类 com.teleca.jamendo.util.download.DownloadProviderDbImpl 中的方法

TrackBuilder - com.teleca.jamendo.api.impl 中的 类

TrackBuilder() -
类 com.teleca.jamendo.api.impl.TrackBuilder 的构造方法

TrackComparator - com.teleca.jamendo.api.impl 中的 类

TrackComparator() -
类 com.teleca.jamendo.api.impl.TrackComparator 的构造方法

TrackDatabaseBuilder - com.teleca.jamendo.db 中的 类

TrackDatabaseBuilder() -
类 com.teleca.jamendo.db.TrackDatabaseBuilder 的构造方法

TrackRowArtistAlbum -
类 com.teleca.jamendo.R.id 中的静态变量

TrackRowDuration -
类 com.teleca.jamendo.R.id 中的静态变量

TrackRowName -
类 com.teleca.jamendo.R.id 中的静态变量

TrackRowProgress -
类 com.teleca.jamendo.R.id 中的静态变量

TrackRowRatingBar -
类 com.teleca.jamendo.R.id 中的静态变量

tracks -
类 com.teleca.jamendo.R.string 中的静态变量

tray_handle_normal -
类 com.teleca.jamendo.R.drawable 中的静态变量

tray_handle_pressed -
类 com.teleca.jamendo.R.drawable 中的静态变量

tray_handle_selected -
类 com.teleca.jamendo.R.drawable 中的静态变量

tray_line_normal -
类 com.teleca.jamendo.R.drawable 中的静态变量

tray_line_pressed -
类 com.teleca.jamendo.R.drawable 中的静态变量

tray_line_selected -
类 com.teleca.jamendo.R.drawable 中的静态变量

tutorial -
类 com.teleca.jamendo.R.layout 中的静态变量

tutorial_close -
类 com.teleca.jamendo.R.string 中的静态变量

tutorial_gesture_next -
类 com.teleca.jamendo.R.string 中的静态变量

tutorial_gesture_playpause -
类 com.teleca.jamendo.R.string 中的静态变量

tutorial_gesture_prev -
类 com.teleca.jamendo.R.string 中的静态变量

tutorial_gesture_stop -
类 com.teleca.jamendo.R.string 中的静态变量

tutorial_gestures -
类 com.teleca.jamendo.R.string 中的静态变量

tutorial_shufflerepeat -
类 com.teleca.jamendo.R.string 中的静态变量

tutorial_shufflerepeat_playlist -
类 com.teleca.jamendo.R.string 中的静态变量

tutorial_title -
类 com.teleca.jamendo.R.string 中的静态变量

tutorial_toggle_firstrun -
类 com.teleca.jamendo.R.string 中的静态变量

tutorial_welcome -
类 com.teleca.jamendo.R.string 中的静态变量

TutorialDialog - com.teleca.jamendo.dialog 中的 类
Tutorial dialog
TutorialDialog(Context) -
类 com.teleca.jamendo.dialog.TutorialDialog 的构造方法

TutorialDialog(Context, int) -
类 com.teleca.jamendo.dialog.TutorialDialog 的构造方法

TutorialDialog(Context, boolean, OnCancelListener) -
类 com.teleca.jamendo.dialog.TutorialDialog 的构造方法

TYPE_SECTION_HEADER -
类 com.teleca.jamendo.adapter.SeparatedListAdapter 中的静态变量

      概述
      软件包
      类
      使用
      树
      已过时
    索引
      帮助

 上一个字母
 下一个字母

  框架
 无框架

  所有类

A B C D E F G H I J L M N O P Q R S T V W X


text:
@interface TBMirrorDetailTableCell()

@end

@implementation TBMirrorDetailTableCell

- (void)awakeFromNib {
    // Initialization code
}

//- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
//        [self addSubview:self.btn];
    }

    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

}

@end


text:
@class OHSegmentedControl;

@protocol OHSegmentedControlDelegate <NSObject>

- (void)onSegmentedControl:(OHSegmentedControl*)segmentedControl indexSelected:(NSInteger)index;

@end

@interface OHSegmentedControl : UIView

@property (strong, nonatomic) UIColor* tintColor;
@property (strong, nonatomic) NSArray* titles;
@property (assign, nonatomic) NSInteger selectedIndex;

@end


text:
package zookeeper

import (
	"bufio"
	"fmt"
	"net"
	"os"
	"regexp"
	"strconv"
	"strings"
	"time"

	"github.com/influxdb/telegraf/plugins/inputs"
)

// Zookeeper is a zookeeper plugin
type Zookeeper struct {
	Servers []string
}

var sampleConfig = `
  # An array of address to gather stats about. Specify an ip or hostname
  # with port. ie localhost:2181, 10.0.0.1:2181, etc.

  # If no servers are specified, then localhost is used as the host.
  # If no port is specified, 2181 is used
  servers = [":2181"]
`

var defaultTimeout = time.Second * time.Duration(5)

// SampleConfig returns sample configuration message
func (z *Zookeeper) SampleConfig() string {
	return sampleConfig
}

// Description returns description of Zookeeper plugin
func (z *Zookeeper) Description() string {
	return `Reads 'mntr' stats from one or many zookeeper servers`
}

// Gather reads stats from all configured servers accumulates stats
func (z *Zookeeper) Gather(acc inputs.Accumulator) error {
	if len(z.Servers) == 0 {
		return nil
	}

	for _, serverAddress := range z.Servers {
		if err := z.gatherServer(serverAddress, acc); err != nil {
			return err
		}
	}
	return nil
}

func (z *Zookeeper) gatherServer(address string, acc inputs.Accumulator) error {
	_, _, err := net.SplitHostPort(address)
	if err != nil {
		address = address + ":2181"
	}

	c, err := net.DialTimeout("tcp", address, defaultTimeout)
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		return err
	}
	defer c.Close()

	fmt.Fprintf(c, "%s\n", "mntr")
	rdr := bufio.NewReader(c)
	scanner := bufio.NewScanner(rdr)

	service := strings.Split(address, ":")
	if len(service) != 2 {
		return fmt.Errorf("Invalid service address: %s", address)
	}
	tags := map[string]string{"server": service[0], "port": service[1]}

	fields := make(map[string]interface{})
	for scanner.Scan() {
		line := scanner.Text()

		re := regexp.MustCompile(`^zk_(\w+)\s+([\w\.\-]+)`)
		parts := re.FindStringSubmatch(string(line))

		if len(parts) != 3 {
			return fmt.Errorf("unexpected line in mntr response: %q", line)
		}

		measurement := strings.TrimPrefix(parts[1], "zk_")
		sValue := string(parts[2])

		iVal, err := strconv.ParseInt(sValue, 10, 64)
		if err == nil {
			fields[measurement] = iVal
		} else {
			fields[measurement] = sValue
		}
	}
	acc.AddFields("zookeeper", fields, tags)

	return nil
}

func init() {
	inputs.Add("zookeeper", func() inputs.Input {
		return &Zookeeper{}
	})
}


text:
package me.cyning.gifle.app.base;

import android.app.Activity;

import me.cyning.gifle.app.R;

/**
 * 页面的特效
 */
public class AcitvityHelper {

	/**
	 * @param activity
     *
<----

	 */
	static public void enterWithAnimationIn(Activity activity){
		activity.overridePendingTransition(R.anim.action_push_right_in, R.anim.action_push_left_out);
	}
    /**
     * @param activity
     *
--->

     */
	static public void finishWithAnimationOut(Activity activity){
        activity.overridePendingTransition(R.anim.action_push_left_in, R.anim.action_push_right_out);
	}
	static public void finishWithAnimation(Activity act,int enterAnim,int exitAnim ){
		act.overridePendingTransition(enterAnim, exitAnim);
	}
    static public void enterLeft(Activity act,int enterAnim,int exitAnim ){
        act.overridePendingTransition(R.anim.action_push_right_in,R.anim.action_push_left_out );
    }
    static public void exitRight(Activity act){
        act.overridePendingTransition(R.anim.hold,R.anim.action_push_right_out);
    }

}


text:
<!DOCTYPE html>

<meta charset='UTF-8'>
<title>Instalação do Cacic 3.0</title>
<link rel='shortcut icon' href='img/logo-bits.png'>
<link rel='stylesheet' href='css/style.css'>
<link rel='stylesheet' href='dist/css/bootstrap.css'>
<link rel='stylesheet' href='dist/css/bootstrap-theme.css'>

Instalador automático do cacic 3.0

					Lembre-se que antes de executar esse instalador você já deve ter
					criado o banco de dados e configurado propriamente o seu ambiente
					conforme as orientações no endereço: Instalação
						GerenteCacic_3.0 passo a passo - Utilizando o instalador.

Se já configurou corretamente seu ambiente, clique em continuar.

						Continuar


text:
<!DOCTYPE html>

    <meta charset='utf-8'>
    <meta http-equiv="X-UA-Compatible" content="chrome=1">

    <link rel="stylesheet" type="text/css" href="stylesheets/stylesheet.css" media="screen">
    <link rel="stylesheet" type="text/css" href="stylesheets/github-dark.css" media="screen">
    <link rel="stylesheet" type="text/css" href="stylesheets/print.css" media="print">

    <title>Fisiología: introducción by elmonje</title>

Fisiología: introducción

Resúmenes para los TP de introducción a fisiología

          Download as .zip
          Download as .tar.gz
          View on GitHub

Ver...

TP 0

TP 1

TP 2