text:
<?php

namespace React\Promise;

class FunctionRaceTest extends TestCase
{
    /** @test */
    public function shouldResolveEmptyInput()
    {
        $mock = $this->createCallableMock();
        $mock
            ->expects($this->once())
            ->method('__invoke')
            ->with($this->identicalTo(null));

        race(
            []
        )->then($mock);
    }

    /** @test */
    public function shouldResolveValuesArray()
    {
        $mock = $this->createCallableMock();
        $mock
            ->expects($this->once())
            ->method('__invoke')
            ->with($this->identicalTo(1));

        race(
            [1, 2, 3]
        )->then($mock);
    }

    /** @test */
    public function shouldResolvePromisesArray()
    {
        $mock = $this->createCallableMock();
        $mock
            ->expects($this->once())
            ->method('__invoke')
            ->with($this->identicalTo(2));

        $d1 = new Deferred();
        $d2 = new Deferred();
        $d3 = new Deferred();

        race(
            [$d1->promise(), $d2->promise(), $d3->promise()]
        )->then($mock);

        $d2->resolve(2);

        $d1->resolve(1);
        $d3->resolve(3);
    }

    /** @test */
    public function shouldResolveSparseArrayInput()
    {
        $mock = $this->createCallableMock();
        $mock
            ->expects($this->once())
            ->method('__invoke')
            ->with($this->identicalTo(null));

        race(
            [null, 1, null, 2, 3]
        )->then($mock);
    }

    /** @test */
    public function shouldRejectIfFirstSettledPromiseRejects()
    {
        $mock = $this->createCallableMock();
        $mock
            ->expects($this->once())
            ->method('__invoke')
            ->with($this->identicalTo(2));

        $d1 = new Deferred();
        $d2 = new Deferred();
        $d3 = new Deferred();

        race(
            [$d1->promise(), $d2->promise(), $d3->promise()]
        )->then($this->expectCallableNever(), $mock);

        $d2->reject(2);

        $d1->resolve(1);
        $d3->resolve(3);
    }

    /** @test */
    public function shouldAcceptAPromiseForAnArray()
    {
        $mock = $this->createCallableMock();
        $mock
            ->expects($this->once())
            ->method('__invoke')
            ->with($this->identicalTo(1));

        race(
            resolve([1, 2, 3])
        )->then($mock);
    }

    /** @test */
    public function shouldResolveToNullWhenInputPromiseDoesNotResolveToArray()
    {
        $mock = $this->createCallableMock();
        $mock
            ->expects($this->once())
            ->method('__invoke')
            ->with($this->identicalTo(null));

        race(
            resolve(1)
        )->then($mock);
    }

    /** @test */
    public function shouldRejectWhenInputPromiseRejects()
    {
        $mock = $this->createCallableMock();
        $mock
            ->expects($this->once())
            ->method('__invoke')
            ->with($this->identicalTo(null));

        race(
            reject()
        )->then($this->expectCallableNever(), $mock);
    }

    /** @test */
    public function shouldCancelInputPromise()
    {
        $mock = $this
            ->getMockBuilder('React\Promise\CancellablePromiseInterface')
            ->getMock();
        $mock
            ->expects($this->once())
            ->method('cancel');

        race($mock)->cancel();
    }

    /** @test */
    public function shouldCancelInputArrayPromises()
    {
        $mock1 = $this
            ->getMockBuilder('React\Promise\CancellablePromiseInterface')
            ->getMock();
        $mock1
            ->expects($this->once())
            ->method('cancel');

        $mock2 = $this
            ->getMockBuilder('React\Promise\CancellablePromiseInterface')
            ->getMock();
        $mock2
            ->expects($this->once())
            ->method('cancel');

        race([$mock1, $mock2])->cancel();
    }

    /** @test */
    public function shouldNotCancelOtherPendingInputArrayPromisesIfOnePromiseFulfills()
    {
        $mock = $this->createCallableMock();
        $mock
            ->expects($this->never())
            ->method('__invoke');

        $deferred = New Deferred($mock);
        $deferred->resolve();

        $mock2 = $this
            ->getMockBuilder('React\Promise\CancellablePromiseInterface')
            ->getMock();
        $mock2
            ->expects($this->never())
            ->method('cancel');

        race([$deferred->promise(), $mock2])->cancel();
    }

    /** @test */
    public function shouldNotCancelOtherPendingInputArrayPromisesIfOnePromiseRejects()
    {
        $mock = $this->createCallableMock();
        $mock
            ->expects($this->never())
            ->method('__invoke');

        $deferred = New Deferred($mock);
        $deferred->reject();

        $mock2 = $this
            ->getMockBuilder('React\Promise\CancellablePromiseInterface')
            ->getMock();
        $mock2
            ->expects($this->never())
            ->method('cancel');

        race([$deferred->promise(), $mock2])->cancel();
    }
}


text:
module Screp
  module TextUtilities

    def titlize(title)
      title.strip.split(' ').map(&:capitalize).join(' ')
    end

    def filename_scrub(filename,
                       unsafe_grep = /[^0-9A-Za-z]/,
                       safe_string = '_')
      filename.gsub(unsafe_grep, safe_string)
    end

    def typo(text, corrections)
      if text.respond_to? :each
        text.each do |t|
          typo_helper t, corrections
        end
      else
        typo_helper text, corrections
      end
    end

    private

    def typo_helper(text, corrections)
      corrections.each do |k,v|
        text.gsub!(k, v)
      end
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace Game.GameSystems
{
    using Entitas;

    public class SnakeMoveSystem : ReactiveSystem<GameEntity>
    {
        readonly GameContext gameContext;
        readonly IGroup<GameEntity> snakes;

        public SnakeMoveSystem(Contexts contexts) : base(contexts.game)
        {
            this.gameContext = contexts.game;

            this.snakes = this.gameContext.GetGroup(GameMatcher.AllOf(GameMatcher.SnakePosition, GameMatcher.SnakeDirection));
        }

        protected override void Execute(List<GameEntity> entities)
        {
            foreach (GameEntity snakeEntity in this.snakes.GetEntities())
            {
                List<Vector2> positions = new List<Vector2>(snakeEntity.snakePosition.positions);

                Vector2 update = Vector2.zero;
                Components.Direction direction = snakeEntity.snakeDirection.currentWantedDirection;
                switch (direction)
                {
                    case Components.Direction.Down:
                        update = Vector2.down;
                        break;
                    case Components.Direction.Up:
                        update = Vector2.up;
                        break;
                    case Components.Direction.Left:
                        update = Vector2.left;
                        break;
                    case Components.Direction.Right:
                        update = Vector2.right;
                        break;
                }

                Vector2 newHeadPosition = positions[0] + update;
                positions.Insert(0, newHeadPosition);
                positions.RemoveAt(positions.Count - 1);

                snakeEntity.ReplaceSnakePosition(positions);
                snakeEntity.ReplaceSnakeDirection(direction, direction);
            }
        }

        protected override bool Filter(GameEntity entity)
        {
            return true;
        }

        protected override ICollector<GameEntity> GetTrigger(IContext<GameEntity> context)
        {
            return context.CreateCollector(GameMatcher.AllOf(GameMatcher.MainTicker, GameMatcher.Ticker));
        }
    }
}


text:
package spec

import (
	"testing"
)

func TestIntegrationExternalDocs(t *testing.T) {
	var extDocs = ExternalDocumentation{"the name", "the url"}
	const extDocsYAML = "description: the name\nurl: the url\n"
	const extDocsJSON = `{"description":"the name","url":"the url"}`
	assertSerializeJSON(t, extDocs, extDocsJSON)
	assertSerializeYAML(t, extDocs, extDocsYAML)
	assertParsesJSON(t, extDocsJSON, extDocs)
	assertParsesYAML(t, extDocsYAML, extDocs)
}


text:
package net.jforum.security;

import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashSet;

/**
 * @author Rafael Steil
 * @version $Id$
 */
public class RoleValueCollection extends LinkedHashSet<Object> implements Serializable
{
	private static final long serialVersionUID = 4067802891802773419L;

	/**
	 * Gets a RoleValue by its name.
	 *
	 * @param valueName The RoleValue name
	 * @return The RoleValue object if found, or null if not found
	 */
	public RoleValue get(final String valueName)
	{
		for (final Iterator<Object> iter = this.iterator(); iter.hasNext(); ) {
			final RoleValue v = (RoleValue)iter.next();

			if (v.getValue().equals(valueName)) {
				return v;
			}
		}

		return null;
	}

	/**
	 * @see java.util.HashSet#contains(java.lang.Object)
	 */
	public boolean contains(final Object o)
	{
		return super.contains(o);
	}

	/**
	 * @see java.util.ArrayList#add(java.lang.Object)
	 */
	public boolean add(final Object o)
	{
		if (!(o instanceof RoleValue)) {
			throw new IllegalArgumentException("Object passed as parameter is not a RoleValue type");
		}

		return super.add(o);
	}

	/**
	 * @see java.util.Collection#addAll(java.util.Collection)
	 */
	public boolean addAll(final Collection<?> c)
	{
		boolean status = true;

		for (final Iterator<?> iter = c.iterator(); iter.hasNext(); ) {
			status = this.add(iter.next());
		}

		return status;
	}
}


text:
package indi.chen.hellojava.concurrent;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.regex.Pattern;

/**
 * LRU Cache for compiled regular expressions used by the libphonenumbers libary.
 *
 * @author chenshuai
 */
public class RegexCache {
    private LRUCache<String, Pattern> cache;

    public RegexCache(int size) {
        cache = new LRUCache<String, Pattern>(size);
    }

    public Pattern getPatternForRegex(String regex) {
        Pattern pattern = cache.get(regex);
        if (pattern == null) {
            pattern = Pattern.compile(regex);
            cache.put(regex, pattern);
        }
        return pattern;
    }

    // This method is used for testing.
    boolean containsRegex(String regex) {
        return cache.containsKey(regex);
    }

    private static class LRUCache<K, V> {
        // LinkedHashMap offers a straightforward implementation of LRU cache.
        private LinkedHashMap<K, V> map;
        private int size;

        public LRUCache(int size) {
            this.size = size;
            map = new LinkedHashMap<K, V>(size * 4 / 3 + 1, 0.75f, true) {
                @Override
                protected boolean removeEldestEntry(Map.Entry<K, V> eldest) {
                    return size() > LRUCache.this.size;
                }
            };
        }

        public synchronized V get(K key) {
            return map.get(key);
        }

        public synchronized void put(K key, V value) {
            map.put(key, value);
        }

        public synchronized boolean containsKey(K key) {
            return map.containsKey(key);
        }
    }
}


text:
@interface FocusCityViewCell()
@property (weak, nonatomic) IBOutlet UILabel *cityLabel;
@property (weak, nonatomic) IBOutlet UILabel *tempLabel;

@end
@implementation FocusCityViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

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

    // Configure the view for the selected state
}
- (void)setCityMode:(CityMode *)cityMode
{
    _cityMode = cityMode;
    self.cityLabel.text = cityMode.city;
    self.tempLabel.text = cityMode.temp;
}
@end


text:
typedef enum {
	IRStateDisconnect,
    IRStateConnecting,
    IRStateConnected
} ConnectionState;

typedef enum {
	IRErrorIllegalAddress	= -1,
	IRErrorCannotConnect	= -2
} ConnectionErrorCode;

@protocol Session
-(void) handleIncommingData : (NSData*) inIncommingData;
-(void) handleConnected;
-(void) handleDisconnect;
-(void) handleConnectionError:(int) inErrorCode;
@end

@protocol TCPEndPointHandlerProtocol
-(void) handleConnected;
-(void) handleConnectionFailed:(int) inError;
@end;

@interface TCPConnection : NSObject <TCPEndPointHandlerProtocol, NSStreamDelegate> {
	NSMutableData*	_localDataBuffer;
	NSMutableArray* _dataQueue;

    ConnectionState _state;

    id _session;

    BOOL _hasIncommingData;
    NSTimer* _idleTimer;

	NSInputStream*	_inputStream;
	NSOutputStream* _outputStream;
}

-(id) initWithSession:(id)inSession;

-(BOOL) connectTo:(NSString*)inHostname port:(int)inPort;
-(void) disconnect;

//-- recive and send
-(BOOL) sendData:(NSData*)inData immediately:(BOOL)immediate;
-(void) sendDataInInterval:(id) userInfo;
-(void) stopTimer;

-(void) readAvailableData;

-(void) handleIncommingData;
-(void) reciveLine:(NSData*) inData;
-(void) handleDisconnect;

-(void) acceptToWriteData;
-(void) handleConnected;
-(void) handleConnectionFailed:(int)inError;

-(void) handleInputStreamEvent:(NSStreamEvent)eventCode;
-(void) handleOutputStreamEvent:(NSStreamEvent)eventCode;

@end


text:
package com.aparapi.codegen.test;

import org.junit.Test;

public class AccessDoubleArrayTest extends com.aparapi.codegen.CodeGenJUnitBase {
    private static final String[] expectedOpenCL = {"#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n" +
        "\n" +
        "typedef struct This_s{\n" +
        "   __global double *doubles;\n" +
        "   int passid;\n" +
        "}This;\n" +
        "int get_pass_id(This *this){\n" +
        "   return this->passid;\n" +
        "}\n" +
        "__kernel void run(\n" +
        "   __global double *doubles, \n" +
        "   int passid\n" +
        "){\n" +
        "   This thisStruct;\n" +
        "   This* this=&thisStruct;\n" +
        "   this->doubles = doubles;\n" +
        "   this->passid = passid;\n" +
        "   {\n" +
        "      for (int i = 0; i<1024; i++){\n" +
        "         this->doubles[i]  = 1.0;\n" +
        "      }\n" +
        "      return;\n" +
        "   }\n" +
        "}\n" +
        "\n"};
    private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null;

    @Test
    public void AccessDoubleArrayTest() {
        test(com.aparapi.codegen.test.AccessDoubleArray.class, expectedException, expectedOpenCL);
    }

    @Test
    public void AccessDoubleArrayTestWorksWithCaching() {
        test(com.aparapi.codegen.test.AccessDoubleArray.class, expectedException, expectedOpenCL);
    }
}


text:
<?php session_start();

include_once("DB.php");
$GLOBALS['db']=new DB($host,$username,$password,$database);

class ad extends DB {
    private $todo;

    public function __construct(){
        $this->todo=$_POST['todo'];
        $this->dispatcher($this->todo);
    }

    public function dispatcher($todo){
        switch($todo){
            case "getAllAds":
                $this->getAllAds();
                break;
            case "getAdInfo":
                $this->getAdInfo();
                break;
            case "getAdsNumber":
                $this->getAdsNumber();
                break;
           case "getAdsByPageNumber":
                $this->getAdsByPageNumber();
                break;

        }
    }

    protected function getAllAds(){
        $_SESSION['filter']='1=1';
        $sql='select * from ads order by id desc limit 9';
        $result=$GLOBALS['db']->db_query($sql);

        $total=array();
        while($row = $GLOBALS['db']->db_assoc($result)){
            array_push($total, $row);
        }
        print(json_encode($total));
    }

    protected function getAdInfo(){
        $ad_id=$_POST['id'];
        $sql='select title,content from ads where id='.$ad_id;
        $result=$GLOBALS['db']->db_query($sql);
        $row = $GLOBALS['db']->db_assoc($result);

        print(json_encode($row));
    }

    protected function getAdsNumber(){
        $sql='select count(id) as numOfAds from ads where '.$_SESSION['filter'] ;
        $result=$GLOBALS['db']->db_query($sql);
        $row = $GLOBALS['db']->db_assoc($result);

        print(json_encode($row));
    }

   protected function getAdsByPageNumber(){
        $pageNum=$_POST['page'];
        $pageNum=abs(intval($pageNum)-1);
        $offset=$pageNum*9;

//        print(json_encode($offset));

        $sql='select * from ads order by id desc limit 9 offset '.$offset;
        $result=$GLOBALS['db']->db_query($sql);

        $total=array();
        while($row = $GLOBALS['db']->db_assoc($result)){
            array_push($total, $row);
        }
        print(json_encode($total));
    }

}

$ad_obj=new ad();

?>


text:
"use strict";

// This file relies on the fact that the following declarations have been made
// in runtime.js:
// var $Function = global.Function;

// ----------------------------------------------------------------------------

// Generator functions and objects are specified by ES6, sections 15.19.3 and
// 15.19.4.

function GeneratorObjectNext(value) {
  if (!IS_GENERATOR(this)) {
    throw MakeTypeError('incompatible_method_receiver',
                        ['[Generator].prototype.next', this]);
  }

  return %_GeneratorNext(this, value);
}

function GeneratorObjectThrow(exn) {
  if (!IS_GENERATOR(this)) {
    throw MakeTypeError('incompatible_method_receiver',
                        ['[Generator].prototype.throw', this]);
  }

  return %_GeneratorThrow(this, exn);
}

function GeneratorObjectIterator() {
  return this;
}

function GeneratorFunctionPrototypeConstructor(x) {
  if (%_IsConstructCall()) {
    throw MakeTypeError('not_constructor', ['GeneratorFunctionPrototype']);
  }
}

function GeneratorFunctionConstructor(arg1) {  // length == 1
  var source = NewFunctionString(arguments, 'function*');
  var global_proxy = %GlobalProxy(global);
  // Compile the string in the constructor and not a helper so that errors
  // appear to come from here.
  var f = %CompileString(source, true);
  if (!IS_FUNCTION(f)) return f;
  f = %_CallFunction(global_proxy, f);
  %FunctionMarkNameShouldPrintAsAnonymous(f);
  return f;
}

function SetUpGenerators() {
  %CheckIsBootstrapping();
  var GeneratorObjectPrototype = GeneratorFunctionPrototype.prototype;
  InstallFunctions(GeneratorObjectPrototype,
                   DONT_ENUM | DONT_DELETE | READ_ONLY,
                   ["next", GeneratorObjectNext,
                    "throw", GeneratorObjectThrow]);
  %FunctionSetName(GeneratorObjectIterator, '[Symbol.iterator]');
  %AddNamedProperty(GeneratorObjectPrototype, symbolIterator,
      GeneratorObjectIterator, DONT_ENUM | DONT_DELETE | READ_ONLY);
  %AddNamedProperty(GeneratorObjectPrototype, "constructor",
      GeneratorFunctionPrototype, DONT_ENUM | DONT_DELETE | READ_ONLY);
  %InternalSetPrototype(GeneratorFunctionPrototype, $Function.prototype);
  %SetCode(GeneratorFunctionPrototype, GeneratorFunctionPrototypeConstructor);
  %AddNamedProperty(GeneratorFunctionPrototype, "constructor",
      GeneratorFunction, DONT_ENUM | DONT_DELETE | READ_ONLY);
  %InternalSetPrototype(GeneratorFunction, $Function);
  %SetCode(GeneratorFunction, GeneratorFunctionConstructor);
}

SetUpGenerators();


text:
package gitbucket.core.model

trait ActivityComponent extends TemplateComponent { self: Profile =>
  import profile.simple._
  import self._

  lazy val Activities = TableQuery[Activities]

  class Activities(tag: Tag) extends Table[Activity](tag, "ACTIVITY") with BasicTemplate {
    val activityId = column[Int]("ACTIVITY_ID", O AutoInc)
    val activityUserName = column[String]("ACTIVITY_USER_NAME")
    val activityType = column[String]("ACTIVITY_TYPE")
    val message = column[String]("MESSAGE")
    val additionalInfo = column[String]("ADDITIONAL_INFO")
    val activityDate = column[java.util.Date]("ACTIVITY_DATE")
    def * = (userName, repositoryName, activityUserName, activityType, message, additionalInfo.?, activityDate, activityId) <> (Activity.tupled, Activity.unapply)
  }
}

case class Activity(
  userName: String,
  repositoryName: String,
  activityUserName: String,
  activityType: String,
  message: String,
  additionalInfo: Option[String],
  activityDate: java.util.Date,
  activityId: Int = 0
)


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.cloudasset.v1.model;

/**
 * Attached resource representation, which is defined by the corresponding service provider. It
 * represents an attached resource's payload.
 *
 *
 This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the Cloud Asset API. For a detailed explanation see:
 * https://developers.google.com/api-client-library/java/google-http-java-client/json
 *

 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class AttachedResource extends com.google.api.client.json.GenericJson {

  /**
   * The type of this attached resource. Example: `osconfig.googleapis.com/Inventory` You can find
   * the supported attached asset types of each resource in this table: `https://cloud.google.com
   * /asset-inventory/docs/supported-asset-types#searchable_asset_types`
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String assetType;

  /**
   * Versioned resource representations of this attached resource. This is repeated because there
   * could be multiple versions of the attached resource representations during version migration.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.util.List<VersionedResource> versionedResources;

  /**
   * The type of this attached resource. Example: `osconfig.googleapis.com/Inventory` You can find
   * the supported attached asset types of each resource in this table: `https://cloud.google.com
   * /asset-inventory/docs/supported-asset-types#searchable_asset_types`
   * @return value or {@code null} for none
   */
  public java.lang.String getAssetType() {
    return assetType;
  }

  /**
   * The type of this attached resource. Example: `osconfig.googleapis.com/Inventory` You can find
   * the supported attached asset types of each resource in this table: `https://cloud.google.com
   * /asset-inventory/docs/supported-asset-types#searchable_asset_types`
   * @param assetType assetType or {@code null} for none
   */
  public AttachedResource setAssetType(java.lang.String assetType) {
    this.assetType = assetType;
    return this;
  }

  /**
   * Versioned resource representations of this attached resource. This is repeated because there
   * could be multiple versions of the attached resource representations during version migration.
   * @return value or {@code null} for none
   */
  public java.util.List<VersionedResource> getVersionedResources() {
    return versionedResources;
  }

  /**
   * Versioned resource representations of this attached resource. This is repeated because there
   * could be multiple versions of the attached resource representations during version migration.
   * @param versionedResources versionedResources or {@code null} for none
   */
  public AttachedResource setVersionedResources(java.util.List<VersionedResource> versionedResources) {
    this.versionedResources = versionedResources;
    return this;
  }

  @Override
  public AttachedResource set(String fieldName, Object value) {
    return (AttachedResource) super.set(fieldName, value);
  }

  @Override
  public AttachedResource clone() {
    return (AttachedResource) super.clone();
  }

}


text:
/**
A view that slides back and forth and is designed to be a part of a
SlidingPane.

SlidingView objects have a "dragAnywhere" property, whose default value is true. This allows
the user to drag the view from any point inside the panel that is not already a
draggable region (e.g., a Scroller). If dragAnywhere is set to false, then the view
can still be dragged via any control inside it whose "slidingHandler" property is set to true.

The "peekWidth" property specifies the amount the paneview should be offset from the left
when it is selected. This allows controls on the underlying view object to the left
of the selected one to be partially revealed.

SlidingView has some other published properties that are less frequently used. The "minWidth"
property specifies a minimum width for view content, and "edgeDragging" lets the user
drag the view from its left edge. (The default value of edgeDragging is false.)

The last view in a SlidingPane is special, it is resized to fit the available space.
The onResize event is fired when this occurs.
*/
enyo.kind({
	name: "enyo.SlidingView",
	kind: enyo.Control,
	className: "enyo-sliding-view",
	layoutKind: "VFlexLayout",
	events: {
		onResize: ""
	},
	published: {
		/** Can drag panel from anywhere (note: does not work if there's another drag surface (e.g. scroller)). */
		dragAnywhere: true,
		/** Can drag/toggle by dragging on left edge of sliding panel. */
		edgeDragging: false,
		/** Whether content width should or should not be adjusted based on size changes. */
		fixedWidth: false,
		/** Minimum content width. */
		minWidth: 0,
		/** Amount we should be shifted right to reveal panel underneath us when selected. */
		peekWidth: 0,
		/** Whether or not the view may be dragged right to dismiss it */
		dismissible: false
	},
	//* @protected
	chrome: [
		{name: "shadow", className: "enyo-sliding-view-shadow"},
		{name: "client", className: "enyo-bg", kind: enyo.Control, flex: 1},
		// NOTE: used only as a hidden surface to move sliding from the left edge
		{name: "edgeDragger", slidingHandler: true, kind: enyo.Control, className: "enyo-sliding-view-nub"}
	],
	slidePosition: 0,
	create: function() {
		this.inherited(arguments);
		this.layout = new enyo.VFlexLayout();
		this.edgeDraggingChanged();
		this.minWidthChanged();
	},
	layoutKindChanged: function() {
		this.$.client.setLayoutKind(this.layoutKind);
	},
	edgeDraggingChanged: function() {
		this.$.edgeDragger.setShowing(this.edgeDragging);
	},
	// siblings
	findSiblings: function() {
		return this.pane.views;
	},
	getPreviousSibling: function() {
		return this.findSiblings()[this.index-1];
	},
	getNextSibling: function() {
		return this.findSiblings()[this.index+1];
	},
	getFirstSibling: function() {
		var s = this.findSiblings();
		return s[0];
	},
	getLastSibling: function() {
		var s = this.findSiblings();
		return s[s.length-1];
	},
	getLastShowingSibling: function() {
		var sibs = this.findSiblings();
		for (var i=0, s; s=sibs[i]; i++) {
			if (!s.showing) {
				return sibs[Math.max(0, i-1)];
			}
		}
		return sibs[i-1];
	},
	// selection
	select: function() {
		this.pane.selectView(this);
	},
	selectPrevious: function() {
		enyo.call(this.getPreviousSibling(), "select");
	},
	selectNext: function() {
		enyo.call(this.getNextSibling(), "select");
	},
	toggleSelected: function() {
		if (this == this.pane.view) {
			this.selectPrevious();
		} else {
			this.select();
		}
	},
	showingChanged: function(inOldValue) {
		if (!this.hasNode()) {
			this.inherited(arguments);
		} else if (!this.pane.dragging && (inOldValue != this.showing)) {
			this.dispatch(this.owner, this.showing ? this.onShow : this.onHide);
			this.pane.stopAnimation();
			if (this.showing) {
				this.inherited(arguments);
				this.pane.validateViewSizes();
				this.applySlideToNode(this.calcSlideHidden());
			}
			this.overSliding = true;
			this.pane.playAnimation(this);
		}
	},
	// sliding calculations
	calcSlide: function() {
		var i = this.index;
		var si = this.pane.view.index;
		var state = this.shouldSlideHidden() ? "Hidden" : (i == si ? "Selected" : (i < si ? "Before" : "After"));
		return this["calcSlide" + state]();
	},
	// FIXME: re-consider offset caching, pita: required to reset on resize.
	getLeftOffset: function() {
		if (this.hasNode()) {
			this._offset = undefined;
			return this._offset !== undefined ? this._offset : (this._offset = this.node.offsetLeft);
		}
		return 0;
	},
	calcSlideMin: function() {
		var x = this.getLeftOffset();
		return this.peekWidth - x;
	},
	calcSlideMax: function() {
		var c = this.getPreviousSibling();
		var x = (c && c.slidePosition) || 0;
		//this.log(this.id, x);
		return x;
	},
	// before selected
	calcSlideBefore: function() {
		var m = this.calcSlideMin();
		if (this.pane.isAnimating() || this.pane.dragging) {
			var c = this.getNextSibling();
			if (this.hasNode() && c) {
				return Math.max(m, c.slidePosition);
			}
		}
		return m;
	},
	calcSlideSelected: function() {
		return this.calcSlideMin();
	},
	// after selected
	calcSlideAfter: function() {
		if (this.pane.isAnimating() || this.pane.dragging) {
			return this.calcSlideMax();
		} else {
			var s = this.pane.view;
			return s ? s.calcSlideMin() : 0;
		}
	},
	calcSlideHidden: function() {
		var x = this.hasNode() && this.parent.hasNode() ? this.parent.node.offsetWidth - this.getLeftOffset() : 0;
		//this.log(this.slidePosition, x);
		return x;
	},
	shouldSlideHidden: function() {
		var p = this;
		do {
			if (!p.showing) {
				return true;
			}
		} while (p = p.getPreviousSibling());
	},
	// movement
	// move this sliding and validate next.
	move: function(inSlide) {
		this.applySlideToNode(inSlide);
		// validate next sibling...
		var c = this.getNextSibling();
		if (c) {
			c.validateSlide();
		}
	},
	applySlideToNode: function(inSlide) {
		if (inSlide != this.slidePosition && this.index) {
			this.lastSlidePosition = this.slidePosition;
			this.slidePosition = inSlide;
			if (this.hasNode()) {
				//this.log(this.id, inSlide);
				var t = inSlide !== null ? "translate3d(" + inSlide + "px,0,0)" : "";
				this.domStyles["-webkit-transform"] = this.node.style.webkitTransform = t;
			}
		}
	},
	// move to our calculated position
	validateSlide: function() {
		this.move(this.calcSlide());
	},
	// move all before this index to calculated position
	validateSlideBefore: function() {
		var s = this.getFirstSibling();
		while (s) {
			if (s.index != this.index) {
				s.applySlideToNode(s.calcSlide());
				s = s.getNextSibling();
			} else {
				break;
			}
		}
	},
	// animation
	canAnimate: function() {
		return (this.index != 0 && this.slidePosition != this.calcSlide());
	},
	// move this, then slide each previous and force before mode.
	animateMove: function(inSlide, inOverSliding) {
		this.move(inSlide);
		if (!inOverSliding) {
			var p = this.getPreviousSibling();
			while (p) {
				p.applySlideToNode(p.calcSlideBefore());
				p = p.getPreviousSibling();
			}
		}
	},
	// dragging
	dragstartHandler: function(inSender, e) {
		e.sliding = this;
	},
	isDraggableEvent: function(inEvent) {
		return this.findSlidingHandler(inEvent.dispatchTarget) || this.dragAnywhere;
	},
	findSlidingHandler: function(inControl) {
		var c = inControl;
		while (c && c.isDescendantOf(this)) {
			if (c.slidingHandler === false) {
				return;
			}
			if (c.slidingHandler) {
				return c;
			}
			c = c.parent;
		}
	},
	canDrag: function(inDelta) {
		this.dragMin = this.calcSlideMin();
		this.dragMax = this.calcSlideMax();
		//
		var i = this.index;
		var si = this.pane.view.index;
		// first index not draggable
		if (i && this.showing && i >= si) {
			var x = this.slidePosition + inDelta;
			var c = this.dragMax != this.dragMin && (x >= this.dragMin && x <= this.dragMax);
			return c;
		}
	},
	isAtDragMax: function() {
		return this.slidePosition == this.dragMax;
	},
	isAtDragMin: function() {
		return this.slidePosition == this.dragMin;
	},
	isAtDragBoundary: function() {
		return this.isAtDragMax() || this.isAtDragMin();
	},
	beginDrag: function(e, inDx) {
		this.validateSlideBefore();
		this.lastDragDx = e.dx;
		this.dragStart = this.slidePosition - inDx;
	},
	isMovingToSelect: function() {
		return this.slidePosition < this.lastSlidePosition;
	},
	drag: function(e) {
		// bail if we are waiting for an animation or not moving
		var x0 = e.dx + this.dragStart;
		if (this.pendingDragMove || (x0 == this.slidePosition)) {
			return;
		}
		this.shouldDragSelect = x0 < this.slidePosition;
		// if out of bounds, return boundary info
		if ((x0 < this.dragMin) || (x0 > this.dragMax && !this.overSliding) || (x0 < this.dragMax && this.overSliding)) {
			return {select: this.getDragSelect()};
		} else {
			// based on HI request, add extra "friction" to drag when overSliding.
			if (this.overSliding && !this.dismissible) {
				// diminimish the user's drag to 1/4 strength
				var ldx = this.lastDragDx || 0;
				x0 = (e.dx - ldx) / 4 + this.slidePosition;
			}
			this.lastDragDx =  e.dx;
			var x = Math.max(this.dragMin, Math.min(x0, this.overSliding ? 1e9 : this.dragMax));
			this.pendingDragMove = this._drag(x);
		}
	},
	_drag: function(inX) {
		this.move(inX);
		this.pendingDragMove = null;
	},
	dragFinish: function() {
		return {select: this.getDragSelect()};
	},
	getDragSelect: function() {
		if (this.shouldDragSelect && !this.overSliding) {
			return this;
		} else {
			// select previous sibling if it is out of position or first
			var p = this.getPreviousSibling();
			return p && ((p.slidePosition < p.calcSlideMax()) || (p.index == 0)) ? p : null;
		}
	},
	// sizing
	// don't auto-adjust width if fixedWidth is true
	fixedWidthChanged: function() {
		if (this.fixedWidth) {
			this.applySize();
		}
	},
	minWidthChanged: function() {
		this.$.client.applyStyle("min-width", this.minWidth || null);
	},
	applySize: function(inSuggestFit, inStopResizePropagation) {
		var w;
		if (inSuggestFit && !this.fixedWidth) {
			w = this.calcFitWidth();
		} else if (this.$.client.domStyles.width) {
			w = null;
		}
		if (w !== undefined) {
			w = (w ? w + "px" : null);
			// apply fast-like
			if (this.$.client.hasNode()) {
				this.$.client.domStyles.width = this.$.client.node.style.width = w;
				if (!inStopResizePropagation) {
					this.doResize(w);
					this.broadcastToControls("resize");
				}
			}
		}
	},
	calcFitWidth: function() {
		var w = null;
		if (this.hasNode() && this.$.client.hasNode()) {
			var pw = this.parent.getBounds().width;
			var l = this.getLeftOffset();
			var s = Math.min(this.slidePosition || 0, 0);
			w = Math.max(0, Math.min(pw, pw - l - s));
		}
		return w;
	},
	clickHandler: function(inSender, inEvent) {
		var r;
		if (this.findSlidingHandler(inEvent.dispatchTarget)) {
			this.toggleSelected();
			r = true;
		}
		return this.doClick(inEvent) || r;
	},
	setShadowShowing: function(inShow) {
		this.$.shadow.setShowing(inShow);
	}
});


text:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

include 'POD_database_helper.php';

 function query($parent_id) { //function to run a query

	$query = pdo_db()->query  ( "SELECT * FROM navigation WHERE parent_id=$parent_id");
	return $query;
}
function has_child($query) { //This function checks if the menus has childs or not
	$result=pdo_db()->query($query->queryString);
	$rows =count($result->fetchObject());
	if ($rows > 0) {
		return true;
	} else {
		return false;
	}
}
function fetch_menu($query) {
	while ( $result = $query->fetch(PDO::FETCH_ASSOC)) {
		$menu_id = $result ['id'];
		$menu_name = $result ['navigation_name'];
		$menu_link = $result ['navigation_link'];
		echo "
{$menu_name}";
		if (has_child ( query ( $menu_id))) {
			echo "
";
			fetch_menu ( query ( $menu_id) );
			echo "
";
		}
		echo "
";
	}
}
//call this function with 0 parent id


text:
package echo

import (
	"bytes"
	"encoding/xml"
	"fmt"
	"io"
	"mime/multipart"
	"net"
	"net/http"
	"net/url"
	"os"
	"path/filepath"
	"strings"
	"sync"
)

type (
	// Context represents the context of the current HTTP request. It holds request and
	// response objects, path, path parameters, data and registered handler.
	Context interface {
		// Request returns `*http.Request`.
		Request() *http.Request

		// SetRequest sets `*http.Request`.
		SetRequest(r *http.Request)

		// SetResponse sets `*Response`.
		SetResponse(r *Response)

		// Response returns `*Response`.
		Response() *Response

		// IsTLS returns true if HTTP connection is TLS otherwise false.
		IsTLS() bool

		// IsWebSocket returns true if HTTP connection is WebSocket otherwise false.
		IsWebSocket() bool

		// Scheme returns the HTTP protocol scheme, `http` or `https`.
		Scheme() string

		// RealIP returns the client's network address based on `X-Forwarded-For`
		// or `X-Real-IP` request header.
		// The behavior can be configured using `Echo#IPExtractor`.
		RealIP() string

		// Path returns the registered path for the handler.
		Path() string

		// SetPath sets the registered path for the handler.
		SetPath(p string)

		// Param returns path parameter by name.
		Param(name string) string

		// ParamNames returns path parameter names.
		ParamNames() []string

		// SetParamNames sets path parameter names.
		SetParamNames(names ...string)

		// ParamValues returns path parameter values.
		ParamValues() []string

		// SetParamValues sets path parameter values.
		SetParamValues(values ...string)

		// QueryParam returns the query param for the provided name.
		QueryParam(name string) string

		// QueryParams returns the query parameters as `url.Values`.
		QueryParams() url.Values

		// QueryString returns the URL query string.
		QueryString() string

		// FormValue returns the form field value for the provided name.
		FormValue(name string) string

		// FormParams returns the form parameters as `url.Values`.
		FormParams() (url.Values, error)

		// FormFile returns the multipart form file for the provided name.
		FormFile(name string) (*multipart.FileHeader, error)

		// MultipartForm returns the multipart form.
		MultipartForm() (*multipart.Form, error)

		// Cookie returns the named cookie provided in the request.
		Cookie(name string) (*http.Cookie, error)

		// SetCookie adds a `Set-Cookie` header in HTTP response.
		SetCookie(cookie *http.Cookie)

		// Cookies returns the HTTP cookies sent with the request.
		Cookies() []*http.Cookie

		// Get retrieves data from the context.
		Get(key string) interface{}

		// Set saves data in the context.
		Set(key string, val interface{})

		// Bind binds the request body into provided type `i`. The default binder
		// does it based on Content-Type header.
		Bind(i interface{}) error

		// Validate validates provided `i`. It is usually called after `Context#Bind()`.
		// Validator must be registered using `Echo#Validator`.
		Validate(i interface{}) error

		// Render renders a template with data and sends a text/html response with status
		// code. Renderer must be registered using `Echo.Renderer`.
		Render(code int, name string, data interface{}) error

		// HTML sends an HTTP response with status code.
		HTML(code int, html string) error

		// HTMLBlob sends an HTTP blob response with status code.
		HTMLBlob(code int, b []byte) error

		// String sends a string response with status code.
		String(code int, s string) error

		// JSON sends a JSON response with status code.
		JSON(code int, i interface{}) error

		// JSONPretty sends a pretty-print JSON with status code.
		JSONPretty(code int, i interface{}, indent string) error

		// JSONBlob sends a JSON blob response with status code.
		JSONBlob(code int, b []byte) error

		// JSONP sends a JSONP response with status code. It uses `callback` to construct
		// the JSONP payload.
		JSONP(code int, callback string, i interface{}) error

		// JSONPBlob sends a JSONP blob response with status code. It uses `callback`
		// to construct the JSONP payload.
		JSONPBlob(code int, callback string, b []byte) error

		// XML sends an XML response with status code.
		XML(code int, i interface{}) error

		// XMLPretty sends a pretty-print XML with status code.
		XMLPretty(code int, i interface{}, indent string) error

		// XMLBlob sends an XML blob response with status code.
		XMLBlob(code int, b []byte) error

		// Blob sends a blob response with status code and content type.
		Blob(code int, contentType string, b []byte) error

		// Stream sends a streaming response with status code and content type.
		Stream(code int, contentType string, r io.Reader) error

		// File sends a response with the content of the file.
		File(file string) error

		// Attachment sends a response as attachment, prompting client to save the
		// file.
		Attachment(file string, name string) error

		// Inline sends a response as inline, opening the file in the browser.
		Inline(file string, name string) error

		// NoContent sends a response with no body and a status code.
		NoContent(code int) error

		// Redirect redirects the request to a provided URL with status code.
		Redirect(code int, url string) error

		// Error invokes the registered HTTP error handler. Generally used by middleware.
		Error(err error)

		// Handler returns the matched handler by router.
		Handler() HandlerFunc

		// SetHandler sets the matched handler by router.
		SetHandler(h HandlerFunc)

		// Logger returns the `Logger` instance.
		Logger() Logger

		// Set the logger
		SetLogger(l Logger)

		// Echo returns the `Echo` instance.
		Echo() *Echo

		// Reset resets the context after request completes. It must be called along
		// with `Echo#AcquireContext()` and `Echo#ReleaseContext()`.
		// See `Echo#ServeHTTP()`
		Reset(r *http.Request, w http.ResponseWriter)
	}

	context struct {
		request  *http.Request
		response *Response
		path     string
		pnames   []string
		pvalues  []string
		query    url.Values
		handler  HandlerFunc
		store    Map
		echo     *Echo
		logger   Logger
		lock     sync.RWMutex
	}
)

const (
	defaultMemory = 32 << 20 // 32 MB
	indexPage     = "index.html"
	defaultIndent = "  "
)

func (c *context) writeContentType(value string) {
	header := c.Response().Header()
	if header.Get(HeaderContentType) == "" {
		header.Set(HeaderContentType, value)
	}
}

func (c *context) Request() *http.Request {
	return c.request
}

func (c *context) SetRequest(r *http.Request) {
	c.request = r
}

func (c *context) Response() *Response {
	return c.response
}

func (c *context) SetResponse(r *Response) {
	c.response = r
}

func (c *context) IsTLS() bool {
	return c.request.TLS != nil
}

func (c *context) IsWebSocket() bool {
	upgrade := c.request.Header.Get(HeaderUpgrade)
	return strings.EqualFold(upgrade, "websocket")
}

func (c *context) Scheme() string {
	// Can't use `r.Request.URL.Scheme`
	// See: https://groups.google.com/forum/#!topic/golang-nuts/pMUkBlQBDF0
	if c.IsTLS() {
		return "https"
	}
	if scheme := c.request.Header.Get(HeaderXForwardedProto); scheme != "" {
		return scheme
	}
	if scheme := c.request.Header.Get(HeaderXForwardedProtocol); scheme != "" {
		return scheme
	}
	if ssl := c.request.Header.Get(HeaderXForwardedSsl); ssl == "on" {
		return "https"
	}
	if scheme := c.request.Header.Get(HeaderXUrlScheme); scheme != "" {
		return scheme
	}
	return "http"
}

func (c *context) RealIP() string {
	if c.echo != nil && c.echo.IPExtractor != nil {
		return c.echo.IPExtractor(c.request)
	}
	// Fall back to legacy behavior
	if ip := c.request.Header.Get(HeaderXForwardedFor); ip != "" {
		i := strings.IndexAny(ip, ",")
		if i > 0 {
			return strings.TrimSpace(ip[:i])
		}
		return ip
	}
	if ip := c.request.Header.Get(HeaderXRealIP); ip != "" {
		return ip
	}
	ra, _, _ := net.SplitHostPort(c.request.RemoteAddr)
	return ra
}

func (c *context) Path() string {
	return c.path
}

func (c *context) SetPath(p string) {
	c.path = p
}

func (c *context) Param(name string) string {
	for i, n := range c.pnames {
		if i < len(c.pvalues) {
			if n == name {
				return c.pvalues[i]
			}
		}
	}
	return ""
}

func (c *context) ParamNames() []string {
	return c.pnames
}

func (c *context) SetParamNames(names ...string) {
	c.pnames = names

	l := len(names)
	if *c.echo.maxParam < l {
		*c.echo.maxParam = l
	}

	if len(c.pvalues) < l {
		// Keeping the old pvalues just for backward compatibility, but it sounds that doesn't make sense to keep them,
		// probably those values will be overriden in a Context#SetParamValues
		newPvalues := make([]string, l)
		copy(newPvalues, c.pvalues)
		c.pvalues = newPvalues
	}
}

func (c *context) ParamValues() []string {
	return c.pvalues[:len(c.pnames)]
}

func (c *context) SetParamValues(values ...string) {
	// NOTE: Don't just set c.pvalues = values, because it has to have length c.echo.maxParam at all times
	// It will brake the Router#Find code
	limit := len(values)
	if limit > *c.echo.maxParam {
		limit = *c.echo.maxParam
	}
	for i := 0; i < limit; i++ {
		c.pvalues[i] = values[i]
	}
}

func (c *context) QueryParam(name string) string {
	if c.query == nil {
		c.query = c.request.URL.Query()
	}
	return c.query.Get(name)
}

func (c *context) QueryParams() url.Values {
	if c.query == nil {
		c.query = c.request.URL.Query()
	}
	return c.query
}

func (c *context) QueryString() string {
	return c.request.URL.RawQuery
}

func (c *context) FormValue(name string) string {
	return c.request.FormValue(name)
}

func (c *context) FormParams() (url.Values, error) {
	if strings.HasPrefix(c.request.Header.Get(HeaderContentType), MIMEMultipartForm) {
		if err := c.request.ParseMultipartForm(defaultMemory); err != nil {
			return nil, err
		}
	} else {
		if err := c.request.ParseForm(); err != nil {
			return nil, err
		}
	}
	return c.request.Form, nil
}

func (c *context) FormFile(name string) (*multipart.FileHeader, error) {
	f, fh, err := c.request.FormFile(name)
	if err != nil {
		return nil, err
	}
	f.Close()
	return fh, nil
}

func (c *context) MultipartForm() (*multipart.Form, error) {
	err := c.request.ParseMultipartForm(defaultMemory)
	return c.request.MultipartForm, err
}

func (c *context) Cookie(name string) (*http.Cookie, error) {
	return c.request.Cookie(name)
}

func (c *context) SetCookie(cookie *http.Cookie) {
	http.SetCookie(c.Response(), cookie)
}

func (c *context) Cookies() []*http.Cookie {
	return c.request.Cookies()
}

func (c *context) Get(key string) interface{} {
	c.lock.RLock()
	defer c.lock.RUnlock()
	return c.store[key]
}

func (c *context) Set(key string, val interface{}) {
	c.lock.Lock()
	defer c.lock.Unlock()

	if c.store == nil {
		c.store = make(Map)
	}
	c.store[key] = val
}

func (c *context) Bind(i interface{}) error {
	return c.echo.Binder.Bind(i, c)
}

func (c *context) Validate(i interface{}) error {
	if c.echo.Validator == nil {
		return ErrValidatorNotRegistered
	}
	return c.echo.Validator.Validate(i)
}

func (c *context) Render(code int, name string, data interface{}) (err error) {
	if c.echo.Renderer == nil {
		return ErrRendererNotRegistered
	}
	buf := new(bytes.Buffer)
	if err = c.echo.Renderer.Render(buf, name, data, c); err != nil {
		return
	}
	return c.HTMLBlob(code, buf.Bytes())
}

func (c *context) HTML(code int, html string) (err error) {
	return c.HTMLBlob(code, []byte(html))
}

func (c *context) HTMLBlob(code int, b []byte) (err error) {
	return c.Blob(code, MIMETextHTMLCharsetUTF8, b)
}

func (c *context) String(code int, s string) (err error) {
	return c.Blob(code, MIMETextPlainCharsetUTF8, []byte(s))
}

func (c *context) jsonPBlob(code int, callback string, i interface{}) (err error) {
	indent := ""
	if _, pretty := c.QueryParams()["pretty"]; c.echo.Debug || pretty {
		indent = defaultIndent
	}
	c.writeContentType(MIMEApplicationJavaScriptCharsetUTF8)
	c.response.WriteHeader(code)
	if _, err = c.response.Write([]byte(callback + "(")); err != nil {
		return
	}
	if err = c.echo.JSONSerializer.Serialize(c, i, indent); err != nil {
		return
	}
	if _, err = c.response.Write([]byte(");")); err != nil {
		return
	}
	return
}

func (c *context) json(code int, i interface{}, indent string) error {
	c.writeContentType(MIMEApplicationJSONCharsetUTF8)
	c.response.Status = code
	return c.echo.JSONSerializer.Serialize(c, i, indent)
}

func (c *context) JSON(code int, i interface{}) (err error) {
	indent := ""
	if _, pretty := c.QueryParams()["pretty"]; c.echo.Debug || pretty {
		indent = defaultIndent
	}
	return c.json(code, i, indent)
}

func (c *context) JSONPretty(code int, i interface{}, indent string) (err error) {
	return c.json(code, i, indent)
}

func (c *context) JSONBlob(code int, b []byte) (err error) {
	return c.Blob(code, MIMEApplicationJSONCharsetUTF8, b)
}

func (c *context) JSONP(code int, callback string, i interface{}) (err error) {
	return c.jsonPBlob(code, callback, i)
}

func (c *context) JSONPBlob(code int, callback string, b []byte) (err error) {
	c.writeContentType(MIMEApplicationJavaScriptCharsetUTF8)
	c.response.WriteHeader(code)
	if _, err = c.response.Write([]byte(callback + "(")); err != nil {
		return
	}
	if _, err = c.response.Write(b); err != nil {
		return
	}
	_, err = c.response.Write([]byte(");"))
	return
}

func (c *context) xml(code int, i interface{}, indent string) (err error) {
	c.writeContentType(MIMEApplicationXMLCharsetUTF8)
	c.response.WriteHeader(code)
	enc := xml.NewEncoder(c.response)
	if indent != "" {
		enc.Indent("", indent)
	}
	if _, err = c.response.Write([]byte(xml.Header)); err != nil {
		return
	}
	return enc.Encode(i)
}

func (c *context) XML(code int, i interface{}) (err error) {
	indent := ""
	if _, pretty := c.QueryParams()["pretty"]; c.echo.Debug || pretty {
		indent = defaultIndent
	}
	return c.xml(code, i, indent)
}

func (c *context) XMLPretty(code int, i interface{}, indent string) (err error) {
	return c.xml(code, i, indent)
}

func (c *context) XMLBlob(code int, b []byte) (err error) {
	c.writeContentType(MIMEApplicationXMLCharsetUTF8)
	c.response.WriteHeader(code)
	if _, err = c.response.Write([]byte(xml.Header)); err != nil {
		return
	}
	_, err = c.response.Write(b)
	return
}

func (c *context) Blob(code int, contentType string, b []byte) (err error) {
	c.writeContentType(contentType)
	c.response.WriteHeader(code)
	_, err = c.response.Write(b)
	return
}

func (c *context) Stream(code int, contentType string, r io.Reader) (err error) {
	c.writeContentType(contentType)
	c.response.WriteHeader(code)
	_, err = io.Copy(c.response, r)
	return
}

func (c *context) File(file string) (err error) {
	f, err := os.Open(file)
	if err != nil {
		return NotFoundHandler(c)
	}
	defer f.Close()

	fi, _ := f.Stat()
	if fi.IsDir() {
		file = filepath.Join(file, indexPage)
		f, err = os.Open(file)
		if err != nil {
			return NotFoundHandler(c)
		}
		defer f.Close()
		if fi, err = f.Stat(); err != nil {
			return
		}
	}
	http.ServeContent(c.Response(), c.Request(), fi.Name(), fi.ModTime(), f)
	return
}

func (c *context) Attachment(file, name string) error {
	return c.contentDisposition(file, name, "attachment")
}

func (c *context) Inline(file, name string) error {
	return c.contentDisposition(file, name, "inline")
}

func (c *context) contentDisposition(file, name, dispositionType string) error {
	c.response.Header().Set(HeaderContentDisposition, fmt.Sprintf("%s; filename=%q", dispositionType, name))
	return c.File(file)
}

func (c *context) NoContent(code int) error {
	c.response.WriteHeader(code)
	return nil
}

func (c *context) Redirect(code int, url string) error {
	if code < 300 || code > 308 {
		return ErrInvalidRedirectCode
	}
	c.response.Header().Set(HeaderLocation, url)
	c.response.WriteHeader(code)
	return nil
}

func (c *context) Error(err error) {
	c.echo.HTTPErrorHandler(err, c)
}

func (c *context) Echo() *Echo {
	return c.echo
}

func (c *context) Handler() HandlerFunc {
	return c.handler
}

func (c *context) SetHandler(h HandlerFunc) {
	c.handler = h
}

func (c *context) Logger() Logger {
	res := c.logger
	if res != nil {
		return res
	}
	return c.echo.Logger
}

func (c *context) SetLogger(l Logger) {
	c.logger = l
}

func (c *context) Reset(r *http.Request, w http.ResponseWriter) {
	c.request = r
	c.response.reset(w)
	c.query = nil
	c.handler = NotFoundHandler
	c.store = nil
	c.path = ""
	c.pnames = nil
	c.logger = nil
	// NOTE: Don't reset because it has to have length c.echo.maxParam at all times
	for i := 0; i < *c.echo.maxParam; i++ {
		c.pvalues[i] = ""
	}
}


text:
package org.adligo.tests4j.models.shared.reference_groups.jse.v1_6;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import org.adligo.tests4j.models.shared.association.I_PackageConstantLookupModel;
import org.adligo.tests4j.shared.asserts.reference.NameOnlyReferenceGroup;
import org.adligo.tests4j.shared.asserts.reference.ReferenceGroupBaseDelegate;

/**
 * these are constants for the versions
 * of java, the plan is to support at least the
 * previous 3 minor versions (today on 8/26/2014 that would be 1.8, 1.7, 1.6)
 *
 * use, use the constant imports.
 * Classes included but removed before the
 * first version should be removed ASAP, if that ever happens.
 *
 * Note this doesn't implements JSE_1_7_Lang or JSE_1_8_Lang
 * since I am trying to support all the way back to 1_6
 * (although running 1.8 now).
 *
 * partially generated by org.adligo.tests4j_gen.console.JSEGroupGen
 * copy/pasting...
 * Also this class should eventually include the entire api
 * (public methods and fields), for assertion dependency.
 *
 * @author scott
 *
 */
public class JSE_1_6_XmlSax extends ReferenceGroupBaseDelegate implements I_JSE_1_6_XmlSax, I_PackageConstantLookupModel {
	private static final Map<String,String> CONSTANT_LOOKUP = getConstantLookup();
	public static final JSE_1_6_XmlSax INSTANCE = new JSE_1_6_XmlSax();

	private static Map<String,String> getConstantLookup() {
		Map<String,String> toRet = new HashMap<>();
		//autogenerated by org.adligo.tests4j_gen.console.JSEGroupGen
    toRet.put("org.xml.sax.AttributeList","ATTRIBUTE_LIST");
    toRet.put("org.xml.sax.Attributes","ATTRIBUTES");
    toRet.put("org.xml.sax.ContentHandler","CONTENT_HANDLER");
    toRet.put("org.xml.sax.DocumentHandler","DOCUMENT_HANDLER");
    toRet.put("org.xml.sax.DTDHandler","DTDHANDLER");
    toRet.put("org.xml.sax.EntityResolver","ENTITY_RESOLVER");
    toRet.put("org.xml.sax.ErrorHandler","ERROR_HANDLER");
    toRet.put("org.xml.sax.Locator","LOCATOR");
    toRet.put("org.xml.sax.Parser","PARSER");
    toRet.put("org.xml.sax.XMLFilter","XMLFILTER");
    toRet.put("org.xml.sax.XMLReader","XMLREADER");
    toRet.put("org.xml.sax.HandlerBase","HANDLER_BASE");
    toRet.put("org.xml.sax.InputSource","INPUT_SOURCE");
    toRet.put("org.xml.sax.SAXException","SAXEXCEPTION");
    toRet.put("org.xml.sax.SAXNotRecognizedException","SAXNOT_RECOGNIZED_EXCEPTION");
    toRet.put("org.xml.sax.SAXNotSupportedException","SAXNOT_SUPPORTED_EXCEPTION");
    toRet.put("org.xml.sax.SAXParseException","SAXPARSE_EXCEPTION");
		return Collections.unmodifiableMap(toRet);
	}
	private JSE_1_6_XmlSax() {
		super.setDelegate(new NameOnlyReferenceGroup(CONSTANT_LOOKUP.keySet()));
	}
	@Override
	public String getPackageName() {
		return "org.xml.sax";
	}
	@Override
	public String getConstantName(String javaName) {
		return CONSTANT_LOOKUP.get(javaName);
	}
	@Override
	public Map<String, String> getModelMap() {
		return CONSTANT_LOOKUP;
	};
}


text:
/*
 * DO NOT EDIT.  THIS FILE IS GENERATED FROM /builds/slave/rel-m-rel-xr-osx64-bld/build/modules/libpref/public/nsIPrefLocalizedString.idl
 */

#ifndef __gen_nsIPrefLocalizedString_h__
#define __gen_nsIPrefLocalizedString_h__

#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif

/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif

/* starting interface:    nsIPrefLocalizedString */
#define NS_IPREFLOCALIZEDSTRING_IID_STR "ae419e24-1dd1-11b2-b39a-d3e5e7073802"

#define NS_IPREFLOCALIZEDSTRING_IID \
  {0xae419e24, 0x1dd1, 0x11b2, \
    { 0xb3, 0x9a, 0xd3, 0xe5, 0xe7, 0x07, 0x38, 0x02 }}

class NS_NO_VTABLE NS_SCRIPTABLE nsIPrefLocalizedString : public nsISupports {
 public:

  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IPREFLOCALIZEDSTRING_IID)

  /* attribute wstring data; */
  NS_SCRIPTABLE NS_IMETHOD GetData(PRUnichar * *aData) = 0;
  NS_SCRIPTABLE NS_IMETHOD SetData(const PRUnichar * aData) = 0;

  /* wstring toString (); */
  NS_SCRIPTABLE NS_IMETHOD ToString(PRUnichar * *_retval NS_OUTPARAM) = 0;

  /* void setDataWithLength (in unsigned long length, [size_is (length)] in wstring data); */
  NS_SCRIPTABLE NS_IMETHOD SetDataWithLength(PRUint32 length, const PRUnichar * data) = 0;

};

  NS_DEFINE_STATIC_IID_ACCESSOR(nsIPrefLocalizedString, NS_IPREFLOCALIZEDSTRING_IID)

/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIPREFLOCALIZEDSTRING \
  NS_SCRIPTABLE NS_IMETHOD GetData(PRUnichar * *aData); \
  NS_SCRIPTABLE NS_IMETHOD SetData(const PRUnichar * aData); \
  NS_SCRIPTABLE NS_IMETHOD ToString(PRUnichar * *_retval NS_OUTPARAM); \
  NS_SCRIPTABLE NS_IMETHOD SetDataWithLength(PRUint32 length, const PRUnichar * data);

/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIPREFLOCALIZEDSTRING(_to) \
  NS_SCRIPTABLE NS_IMETHOD GetData(PRUnichar * *aData) { return _to GetData(aData); } \
  NS_SCRIPTABLE NS_IMETHOD SetData(const PRUnichar * aData) { return _to SetData(aData); } \
  NS_SCRIPTABLE NS_IMETHOD ToString(PRUnichar * *_retval NS_OUTPARAM) { return _to ToString(_retval); } \
  NS_SCRIPTABLE NS_IMETHOD SetDataWithLength(PRUint32 length, const PRUnichar * data) { return _to SetDataWithLength(length, data); }

/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIPREFLOCALIZEDSTRING(_to) \
  NS_SCRIPTABLE NS_IMETHOD GetData(PRUnichar * *aData) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetData(aData); } \
  NS_SCRIPTABLE NS_IMETHOD SetData(const PRUnichar * aData) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetData(aData); } \
  NS_SCRIPTABLE NS_IMETHOD ToString(PRUnichar * *_retval NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->ToString(_retval); } \
  NS_SCRIPTABLE NS_IMETHOD SetDataWithLength(PRUint32 length, const PRUnichar * data) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetDataWithLength(length, data); }

#if 0
/* Use the code below as a template for the implementation class for this interface. */

/* Header file */
class nsPrefLocalizedString : public nsIPrefLocalizedString
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_NSIPREFLOCALIZEDSTRING

  nsPrefLocalizedString();

private:
  ~nsPrefLocalizedString();

protected:
  /* additional members */
};

/* Implementation file */
NS_IMPL_ISUPPORTS1(nsPrefLocalizedString, nsIPrefLocalizedString)

nsPrefLocalizedString::nsPrefLocalizedString()
{
  /* member initializers and constructor code */
}

nsPrefLocalizedString::~nsPrefLocalizedString()
{
  /* destructor code */
}

/* attribute wstring data; */
NS_IMETHODIMP nsPrefLocalizedString::GetData(PRUnichar * *aData)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsPrefLocalizedString::SetData(const PRUnichar * aData)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* wstring toString (); */
NS_IMETHODIMP nsPrefLocalizedString::ToString(PRUnichar * *_retval NS_OUTPARAM)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void setDataWithLength (in unsigned long length, [size_is (length)] in wstring data); */
NS_IMETHODIMP nsPrefLocalizedString::SetDataWithLength(PRUint32 length, const PRUnichar * data)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* End of implementation class template. */
#endif

#define NS_PREFLOCALIZEDSTRING_CID                     \
  { /* {064d9cee-1dd2-11b2-83e3-d25ab0193c26} */       \
    0x064d9cee,                                        \
    0x1dd2,                                            \
    0x11b2,                                            \
    { 0x83, 0xe3, 0xd2, 0x5a, 0xb0, 0x19, 0x3c, 0x26 } \
  }
#define NS_PREFLOCALIZEDSTRING_CONTRACTID "@mozilla.org/pref-localizedstring;1"
#define NS_PREFLOCALIZEDSTRING_CLASSNAME "Pref LocalizedString"

#endif /* __gen_nsIPrefLocalizedString_h__ */


text:
package com.mitchellbosecke.pebble.spring4.context;

import org.springframework.context.ApplicationContext;
import org.springframework.util.Assert;

import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;

/**
 * <p>
 * Special object made available to templates in Spring MVC applications in
 * order to access beans in the Application Context.
 * </p>
 *
 * @author Eric Bussieres
 */
public class Beans implements Map<String, Object> {

  private final ApplicationContext ctx;

  public Beans(ApplicationContext ctx) {
    Assert.notNull(ctx, "Application Context cannot be null");
    this.ctx = ctx;
  }

  @Override
  public void clear() {
    throw new UnsupportedOperationException("Method \"clear\" not supported in Beans object");
  }

  @Override
  public boolean containsKey(Object key) {
    Assert.notNull(key, "Key cannot be null");
    return this.ctx.containsBean(key.toString());
  }

  @Override
  public boolean containsValue(Object value) {
    throw new UnsupportedOperationException("Method \"containsValue\" not supported in Beans object");
  }

  @Override
  public Set<java.util.Map.Entry<String, Object>> entrySet() {
    throw new UnsupportedOperationException("Method \"entrySet\" not supported in Beans object");
  }

  @Override
  public Object get(Object key) {
    Assert.notNull(key, "Key cannot be null");
    return this.ctx.getBean(key.toString());
  }

  @Override
  public boolean isEmpty() {
    return this.size() <= 0;
  }

  @Override
  public Set<String> keySet() {
    return new LinkedHashSet<>(Arrays.asList(this.ctx.getBeanDefinitionNames()));
  }

  @Override
  public Object put(String key, Object value) {
    throw new UnsupportedOperationException("Method \"put\" not supported in Beans object");
  }

  @Override
  public void putAll(Map<? extends String, ?> m) {
    throw new UnsupportedOperationException("Method \"putAll\" not supported in Beans object");
  }

  @Override
  public Object remove(Object key) {
    throw new UnsupportedOperationException("Method \"remove\" not supported in Beans object");
  }

  @Override
  public int size() {
    return this.ctx.getBeanDefinitionCount();
  }

  @Override
  public Collection<Object> values() {
    throw new UnsupportedOperationException("Method \"values\" not supported in Beans object");
  }

}


text:
package org.apache.pig.piggybank.test.evaluation;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import java.io.IOException;

import org.apache.pig.EvalFunc;
import org.apache.pig.data.Tuple;
import org.apache.pig.data.TupleFactory;
import org.apache.pig.piggybank.evaluation.IsInt;
import org.junit.Test;

public class TestIsInt {
    private static final EvalFunc<Boolean> isInt = new IsInt();
    private static Tuple testTuple = TupleFactory.getInstance().newTuple(1);

    @Test
    public void testIsInt() throws IOException {
        testTuple.set(0, "1234");
        assertTrue(isInt.exec(testTuple));

        testTuple.set(0, "1aaannn234");
        assertFalse(isInt.exec(testTuple));

        // This should be true as its within Integer range
        testTuple.set(0, "2147483647");
        assertTrue(isInt.exec(testTuple));

        // This should be false as its not within Integer range
        testTuple.set(0, "2147483648");
        assertFalse(isInt.exec(testTuple));

        testTuple.set(0, "-1234");
        assertTrue(isInt.exec(testTuple));
    }
}


text:
package com.viewpagerindicator.as.library.indicator;

import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.ViewConfigurationCompat;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;

import com.viewpagerindicator.as.R;
import com.viewpagerindicator.as.library.pageview.RecyclerViewPager;

/**
 * Draws a line for each page. The current page line is colored differently
 * than the unselected page lines.
 */
public class RecyclerLinePageIndicator extends View implements RecyclerPageIndicator {
    private static final int INVALID_POINTER = -1;

    private final Paint mPaintUnselected = new Paint(Paint.ANTI_ALIAS_FLAG);
    private final Paint mPaintSelected = new Paint(Paint.ANTI_ALIAS_FLAG);
    private RecyclerView mRecyclerView;
    private ViewPager.OnPageChangeListener mListener;
    private int mCurrentPage;
    private boolean mCentered;
    private float mLineWidth;
    private float mGapWidth;

    private int mTouchSlop;
    private float mLastMotionX = -1;
    private int mActivePointerId = INVALID_POINTER;
    private boolean mIsDragging;

    public RecyclerLinePageIndicator(Context context) {
        this(context, null);
    }

    public RecyclerLinePageIndicator(Context context, AttributeSet attrs) {
        this(context, attrs, R.attr.vpiLinePageIndicatorStyle);
    }

    public RecyclerLinePageIndicator(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        if (isInEditMode()) return;

        final Resources res = getResources();

        //Load defaults from resources
        final int defaultSelectedColor = res.getColor(R.color.default_line_indicator_selected_color);
        final int defaultUnselectedColor = res.getColor(R.color.default_line_indicator_unselected_color);
        final float defaultLineWidth = res.getDimension(R.dimen.default_line_indicator_line_width);
        final float defaultGapWidth = res.getDimension(R.dimen.default_line_indicator_gap_width);
        final float defaultStrokeWidth = res.getDimension(R.dimen.default_line_indicator_stroke_width);
        final boolean defaultCentered = res.getBoolean(R.bool.default_line_indicator_centered);

        //Retrieve styles attributes
        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.LinePageIndicator, defStyle, 0);

        mCentered = a.getBoolean(R.styleable.LinePageIndicator_centered, defaultCentered);
        mLineWidth = a.getDimension(R.styleable.LinePageIndicator_lineWidth, defaultLineWidth);
        mGapWidth = a.getDimension(R.styleable.LinePageIndicator_gapWidth, defaultGapWidth);
        setStrokeWidth(a.getDimension(R.styleable.LinePageIndicator_strokeWidth, defaultStrokeWidth));
        mPaintUnselected.setColor(a.getColor(R.styleable.LinePageIndicator_unselectedColor, defaultUnselectedColor));
        mPaintSelected.setColor(a.getColor(R.styleable.LinePageIndicator_selectedColor, defaultSelectedColor));

        Drawable background = a.getDrawable(R.styleable.LinePageIndicator_android_background);
        if (background != null) {
          setBackgroundDrawable(background);
        }

        a.recycle();

        final ViewConfiguration configuration = ViewConfiguration.get(context);
        mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
    }

    public void setCentered(boolean centered) {
        mCentered = centered;
        invalidate();
    }

    public boolean isCentered() {
        return mCentered;
    }

    public void setUnselectedColor(int unselectedColor) {
        mPaintUnselected.setColor(unselectedColor);
        invalidate();
    }

    public int getUnselectedColor() {
        return mPaintUnselected.getColor();
    }

    public void setSelectedColor(int selectedColor) {
        mPaintSelected.setColor(selectedColor);
        invalidate();
    }

    public int getSelectedColor() {
        return mPaintSelected.getColor();
    }

    public void setLineWidth(float lineWidth) {
        mLineWidth = lineWidth;
        invalidate();
    }

    public float getLineWidth() {
        return mLineWidth;
    }

    public void setStrokeWidth(float lineHeight) {
        mPaintSelected.setStrokeWidth(lineHeight);
        mPaintUnselected.setStrokeWidth(lineHeight);
        invalidate();
    }

    public float getStrokeWidth() {
        return mPaintSelected.getStrokeWidth();
    }

    public void setGapWidth(float gapWidth) {
        mGapWidth = gapWidth;
        invalidate();
    }

    public float getGapWidth() {
        return mGapWidth;
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);

        if (mRecyclerView == null) {
            return;
        }
        final int count = mRecyclerView.getAdapter().getItemCount();
        if (count == 0) {
            return;
        }

        if (mCurrentPage >= count) {
            setCurrentItem(count - 1);
            return;
        }

        final float lineWidthAndGap = mLineWidth + mGapWidth;
        final float indicatorWidth = (count * lineWidthAndGap) - mGapWidth;
        final float paddingTop = getPaddingTop();
        final float paddingLeft = getPaddingLeft();
        final float paddingRight = getPaddingRight();

        float verticalOffset = paddingTop + ((getHeight() - paddingTop - getPaddingBottom()) / 2.0f);
        float horizontalOffset = paddingLeft;
        if (mCentered) {
            horizontalOffset += ((getWidth() - paddingLeft - paddingRight) / 2.0f) - (indicatorWidth / 2.0f);
        }

        //Draw stroked circles
        for (int i = 0; i < count; i++) {
            float dx1 = horizontalOffset + (i * lineWidthAndGap);
            float dx2 = dx1 + mLineWidth;
            canvas.drawLine(dx1, verticalOffset, dx2, verticalOffset, (i == mCurrentPage) ? mPaintSelected : mPaintUnselected);
        }
    }

    public boolean onTouchEvent(MotionEvent ev) {
        if (super.onTouchEvent(ev)) {
            return true;
        }
        if ((mRecyclerView == null) || (mRecyclerView.getAdapter().getItemCount() == 0)) {
            return false;
        }

        final int action = ev.getAction() & MotionEventCompat.ACTION_MASK;
        switch (action) {
            case MotionEvent.ACTION_DOWN:
                mActivePointerId = MotionEventCompat.getPointerId(ev, 0);
                mLastMotionX = ev.getX();
                break;

            case MotionEvent.ACTION_MOVE: {
                final int activePointerIndex = MotionEventCompat.findPointerIndex(ev, mActivePointerId);
                final float x = MotionEventCompat.getX(ev, activePointerIndex);
                final float deltaX = x - mLastMotionX;

                if (!mIsDragging) {
                    if (Math.abs(deltaX) > mTouchSlop) {
                        mIsDragging = true;
                    }
                }

                if (mIsDragging) {
                    mLastMotionX = x;
                }

                break;
            }

            case MotionEvent.ACTION_CANCEL:
            case MotionEvent.ACTION_UP:
                if (!mIsDragging) {
                    final int count = mRecyclerView.getAdapter().getItemCount();
                    final int width = getWidth();
                    final float halfWidth = width / 2f;
                    final float sixthWidth = width / 6f;

                    if ((mCurrentPage > 0) && (ev.getX() < halfWidth - sixthWidth)) {
                        if (action != MotionEvent.ACTION_CANCEL) {
                            mRecyclerView.scrollToPosition(mCurrentPage - 1);
                        }
                        return true;
                    } else if ((mCurrentPage < count - 1) && (ev.getX() > halfWidth + sixthWidth)) {
                        if (action != MotionEvent.ACTION_CANCEL) {
                            mRecyclerView.scrollToPosition(mCurrentPage + 1);
                        }
                        return true;
                    }
                }

                mIsDragging = false;
                mActivePointerId = INVALID_POINTER;
                break;

            case MotionEventCompat.ACTION_POINTER_DOWN: {
                final int index = MotionEventCompat.getActionIndex(ev);
                mLastMotionX = MotionEventCompat.getX(ev, index);
                mActivePointerId = MotionEventCompat.getPointerId(ev, index);
                break;
            }

            case MotionEventCompat.ACTION_POINTER_UP:
                final int pointerIndex = MotionEventCompat.getActionIndex(ev);
                final int pointerId = MotionEventCompat.getPointerId(ev, pointerIndex);
                if (pointerId == mActivePointerId) {
                    final int newPointerIndex = pointerIndex == 0 ? 1 : 0;
                    mActivePointerId = MotionEventCompat.getPointerId(ev, newPointerIndex);
                }
                mLastMotionX = MotionEventCompat.getX(ev, MotionEventCompat.findPointerIndex(ev, mActivePointerId));
                break;
        }

        return true;
    }

    @Override
    public void setViewPager(RecyclerView view) {
        if (mRecyclerView == view) {
            return;
        }
        if (mRecyclerView != null) {
            //Clear us from the old pager.
            wrapViewPager(mRecyclerView).clearOnPageChangedListeners();;
            wrapViewPager(mRecyclerView).clearOnScrollListeners();
        }

        if (view.getAdapter() == null) {
            throw new IllegalStateException("ViewPager does not have adapter instance.");
        }

        mRecyclerView = view;

        wrapViewPager(mRecyclerView).addOnPageChangedListener(new RecyclerViewPager.OnPageChangedListener() {
           @Override
           public void OnPageChanged(int oldPosition, int newPosition) {
               mCurrentPage = newPosition;
               invalidate();

               if (mListener != null) {
                   mListener.onPageSelected(newPosition);
               }

           }
        });
        wrapViewPager(mRecyclerView).addOnScrollListener(new RecyclerView.OnScrollListener() {
            @Override
            public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
                super.onScrollStateChanged(recyclerView, newState);

                if (mListener != null) {
                    mListener.onPageScrollStateChanged(newState);
                }
            }

            @Override
            public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
                super.onScrolled(recyclerView, dx, dy);
                if (mListener != null) {
                    mListener.onPageScrolled(wrapViewPager(mRecyclerView).getCurrentPosition(), 0f, dx);
                }
            }
        });
        invalidate();
    }

    @Override
    public void setViewPager(RecyclerView view, int initialPosition) {
        setViewPager(view);
        setCurrentItem(initialPosition);
    }

    @Override
    public void setCurrentItem(int item) {
        if (mRecyclerView == null) {
            throw new IllegalStateException("ViewPager has not been bound.");
        }
        mRecyclerView.scrollToPosition(item);
        mCurrentPage = item;
        invalidate();
    }

    @Override
    public void notifyDataSetChanged() {
        invalidate();
    }

//    @Override
//    public void onPageScrollStateChanged(int state) {
//        if (mListener != null) {
//            mListener.onPageScrollStateChanged(state);
//        }
//    }
//
//    @Override
//    public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
//        if (mListener != null) {
//            mListener.onPageScrolled(position, positionOffset, positionOffsetPixels);
//        }
//    }
//
//    @Override
//    public void onPageSelected(int position) {
//        mCurrentPage = position;
//        invalidate();
//
//        if (mListener != null) {
//            mListener.onPageSelected(position);
//        }
//    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        setMeasuredDimension(measureWidth(widthMeasureSpec), measureHeight(heightMeasureSpec));
    }

    /**
     * Determines the width of this view
     *
     * @param measureSpec
     *            A measureSpec packed into an int
     * @return The width of the view, honoring constraints from measureSpec
     */
    private int measureWidth(int measureSpec) {
        float result;
        int specMode = MeasureSpec.getMode(measureSpec);
        int specSize = MeasureSpec.getSize(measureSpec);

        if ((specMode == MeasureSpec.EXACTLY) || (mRecyclerView == null)) {
            //We were told how big to be
            result = specSize;
        } else {
            //Calculate the width according the views count
            final int count = mRecyclerView.getAdapter().getItemCount();
            result = getPaddingLeft() + getPaddingRight() + (count * mLineWidth) + ((count - 1) * mGapWidth);
            //Respect AT_MOST value if that was what is called for by measureSpec
            if (specMode == MeasureSpec.AT_MOST) {
                result = Math.min(result, specSize);
            }
        }
        return (int)Math.ceil(result);
    }

    /**
     * Determines the height of this view
     *
     * @param measureSpec
     *            A measureSpec packed into an int
     * @return The height of the view, honoring constraints from measureSpec
     */
    private int measureHeight(int measureSpec) {
        float result;
        int specMode = MeasureSpec.getMode(measureSpec);
        int specSize = MeasureSpec.getSize(measureSpec);

        if (specMode == MeasureSpec.EXACTLY) {
            //We were told how big to be
            result = specSize;
        } else {
            //Measure the height
            result = mPaintSelected.getStrokeWidth() + getPaddingTop() + getPaddingBottom();
            //Respect AT_MOST value if that was what is called for by measureSpec
            if (specMode == MeasureSpec.AT_MOST) {
                result = Math.min(result, specSize);
            }
        }
        return (int)Math.ceil(result);
    }

    @Override
    public void onRestoreInstanceState(Parcelable state) {
        SavedState savedState = (SavedState)state;
        super.onRestoreInstanceState(savedState.getSuperState());
        mCurrentPage = savedState.currentPage;
        requestLayout();
    }

    @Override
    public Parcelable onSaveInstanceState() {
        Parcelable superState = super.onSaveInstanceState();
        SavedState savedState = new SavedState(superState);
        savedState.currentPage = mCurrentPage;
        return savedState;
    }

    static class SavedState extends BaseSavedState {
        int currentPage;

        public SavedState(Parcelable superState) {
            super(superState);
        }

        private SavedState(Parcel in) {
            super(in);
            currentPage = in.readInt();
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            super.writeToParcel(dest, flags);
            dest.writeInt(currentPage);
        }

        @SuppressWarnings("UnusedDeclaration")
        public static final Creator<SavedState> CREATOR = new Creator<SavedState>() {
            @Override
            public SavedState createFromParcel(Parcel in) {
                return new SavedState(in);
            }

            @Override
            public SavedState[] newArray(int size) {
                return new SavedState[size];
            }
        };
    }

    public void setmListener(ViewPager.OnPageChangeListener mListener) {
        this.mListener = mListener;
    }

    private RecyclerViewPager wrapViewPager ( RecyclerView view) {
        if (view  instanceof  RecyclerViewPager) {
            return (RecyclerViewPager) view;
        }
        throw  new IllegalArgumentException("this view is not RecyclerViewPager type");
    }
}


text:
import { PlywoodValue, Set } from '../datatypes/index';
import { SQLDialect } from '../dialect/baseDialect';

import {
  ChainableUnaryExpression,
  Expression,
  ExpressionJS,
  ExpressionValue,
} from './baseExpression';

export class PowerExpression extends ChainableUnaryExpression {
  static op = 'Power';
  static fromJS(parameters: ExpressionJS): PowerExpression {
    return new PowerExpression(ChainableUnaryExpression.jsToValue(parameters));
  }

  constructor(parameters: ExpressionValue) {
    super(parameters, dummyObject);
    this._ensureOp('power');
    this._checkOperandTypes('NUMBER');
    this._checkExpressionTypes('NUMBER');
    this.type = Set.isSetType(this.operand.type) ? this.operand.type : this.expression.type;
  }

  protected _calcChainableUnaryHelper(operandValue: any, expressionValue: any): PlywoodValue {
    if (operandValue == null || expressionValue == null) return null;
    return Set.crossBinary(operandValue, expressionValue, (a, b) => {
      const pow = Math.pow(a, b);
      return isNaN(pow) ? null : pow;
    });
  }

  protected _getSQLChainableUnaryHelper(
    dialect: SQLDialect,
    operandSQL: string,
    expressionSQL: string,
  ): string {
    return `POWER(${operandSQL},${expressionSQL})`;
  }

  protected specialSimplify(): Expression {
    const { operand, expression } = this;
    if (expression.equals(Expression.ZERO)) return Expression.ONE;
    if (expression.equals(Expression.ONE)) return operand;
    return this;
  }
}

Expression.register(PowerExpression);


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Jace.Operations
{
    public abstract class Constant<T> : Operation
    {
        public Constant(DataType dataType, T value)
            : base(dataType, false, true)
        {
            this.Value = value;
        }

        public T Value { get; private set; }

        public override bool Equals(object obj)
        {
            Constant<T> other = obj as Constant<T>;
            if (other != null)
                return this.Value.Equals(other.Value);
            else
                return false;
        }

        public override int GetHashCode()
        {
            return this.Value.GetHashCode();
        }
    }

    public class IntegerConstant : Constant<int>
    {
        public IntegerConstant(int value)
            : base(DataType.Integer, value)
        {
        }
    }

    public class FloatingPointConstant : Constant<double>
    {
        public FloatingPointConstant(double value)
            : base(DataType.FloatingPoint, value)
        {
        }
    }
}


text:
#include <aws/s3/model/PutObjectRequest.h>
#include <aws/core/AmazonWebServiceResult.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
#include <aws/core/utils/HashingUtils.h>

#include <utility>

using namespace Aws::S3::Model;
using namespace Aws::Utils::Stream;
using namespace Aws::Utils;
using namespace Aws;

PutObjectRequest::PutObjectRequest() :
    m_aCLHasBeenSet(false),
    m_bucketHasBeenSet(false),
    m_cacheControlHasBeenSet(false),
    m_contentDispositionHasBeenSet(false),
    m_contentEncodingHasBeenSet(false),
    m_contentLanguageHasBeenSet(false),
    m_contentLength(0),
    m_contentLengthHasBeenSet(false),
    m_contentMD5HasBeenSet(false),
    m_expires(0.0),
    m_expiresHasBeenSet(false),
    m_grantFullControlHasBeenSet(false),
    m_grantReadHasBeenSet(false),
    m_grantReadACPHasBeenSet(false),
    m_grantWriteACPHasBeenSet(false),
    m_keyHasBeenSet(false),
    m_metadataHasBeenSet(false),
    m_serverSideEncryptionHasBeenSet(false),
    m_storageClassHasBeenSet(false),
    m_websiteRedirectLocationHasBeenSet(false),
    m_sSECustomerAlgorithmHasBeenSet(false),
    m_sSECustomerKeyHasBeenSet(false),
    m_sSECustomerKeyMD5HasBeenSet(false),
    m_sSEKMSKeyIdHasBeenSet(false),
    m_requestPayerHasBeenSet(false)
{
}

Aws::Http::HeaderValueCollection PutObjectRequest::GetRequestSpecificHeaders() const
{
  Aws::Http::HeaderValueCollection headers;
  Aws::StringStream ss;
  if(m_aCLHasBeenSet)
  {
   headers.insert(Aws::Http::HeaderValuePair("x-amz-acl", ObjectCannedACLMapper::GetNameForObjectCannedACL(m_aCL)));
  }

  if(m_cacheControlHasBeenSet)
  {
   ss << m_cacheControl;
   headers.insert(Aws::Http::HeaderValuePair("cache-control", ss.str()));
   ss.str("");
  }

  if(m_contentDispositionHasBeenSet)
  {
   ss << m_contentDisposition;
   headers.insert(Aws::Http::HeaderValuePair("content-disposition", ss.str()));
   ss.str("");
  }

  if(m_contentEncodingHasBeenSet)
  {
   ss << m_contentEncoding;
   headers.insert(Aws::Http::HeaderValuePair("content-encoding", ss.str()));
   ss.str("");
  }

  if(m_contentLanguageHasBeenSet)
  {
   ss << m_contentLanguage;
   headers.insert(Aws::Http::HeaderValuePair("content-language", ss.str()));
   ss.str("");
  }

  if(m_contentLengthHasBeenSet)
  {
   ss << m_contentLength;
   headers.insert(Aws::Http::HeaderValuePair("content-length", ss.str()));
   ss.str("");
  }

  if(m_contentMD5HasBeenSet)
  {
   ss << m_contentMD5;
   headers.insert(Aws::Http::HeaderValuePair("content-md5", ss.str()));
   ss.str("");
  }

  if(m_expiresHasBeenSet)
  {
   ss << m_expires;
   headers.insert(Aws::Http::HeaderValuePair("expires", ss.str()));
   ss.str("");
  }

  if(m_grantFullControlHasBeenSet)
  {
   ss << m_grantFullControl;
   headers.insert(Aws::Http::HeaderValuePair("x-amz-grant-full-control", ss.str()));
   ss.str("");
  }

  if(m_grantReadHasBeenSet)
  {
   ss << m_grantRead;
   headers.insert(Aws::Http::HeaderValuePair("x-amz-grant-read", ss.str()));
   ss.str("");
  }

  if(m_grantReadACPHasBeenSet)
  {
   ss << m_grantReadACP;
   headers.insert(Aws::Http::HeaderValuePair("x-amz-grant-read-acp", ss.str()));
   ss.str("");
  }

  if(m_grantWriteACPHasBeenSet)
  {
   ss << m_grantWriteACP;
   headers.insert(Aws::Http::HeaderValuePair("x-amz-grant-write-acp", ss.str()));
   ss.str("");
  }

  if(m_metadataHasBeenSet)
  {
   for(const auto& item : m_metadata)
   {
     ss << "x-amz-meta-" << item.first;
     headers.insert(Aws::Http::HeaderValuePair(ss.str(), item.second));
     ss.str();
   }
  }

  if(m_serverSideEncryptionHasBeenSet)
  {
   headers.insert(Aws::Http::HeaderValuePair("x-amz-server-side-encryption", ServerSideEncryptionMapper::GetNameForServerSideEncryption(m_serverSideEncryption)));
  }

  if(m_storageClassHasBeenSet)
  {
   headers.insert(Aws::Http::HeaderValuePair("x-amz-storage-class", StorageClassMapper::GetNameForStorageClass(m_storageClass)));
  }

  if(m_websiteRedirectLocationHasBeenSet)
  {
   ss << m_websiteRedirectLocation;
   headers.insert(Aws::Http::HeaderValuePair("x-amz-website-redirect-location", ss.str()));
   ss.str("");
  }

  if(m_sSECustomerAlgorithmHasBeenSet)
  {
   ss << m_sSECustomerAlgorithm;
   headers.insert(Aws::Http::HeaderValuePair("x-amz-server-side-encryption-customer-algorithm", ss.str()));
   ss.str("");
  }

  if(m_sSECustomerKeyHasBeenSet)
  {
   ss << m_sSECustomerKey;
   headers.insert(Aws::Http::HeaderValuePair("x-amz-server-side-encryption-customer-key", ss.str()));
   ss.str("");
  }

  if(m_sSECustomerKeyMD5HasBeenSet)
  {
   ss << m_sSECustomerKeyMD5;
   headers.insert(Aws::Http::HeaderValuePair("x-amz-server-side-encryption-customer-key-md5", ss.str()));
   ss.str("");
  }

  if(m_sSEKMSKeyIdHasBeenSet)
  {
   ss << m_sSEKMSKeyId;
   headers.insert(Aws::Http::HeaderValuePair("x-amz-server-side-encryption-aws-kms-key-id", ss.str()));
   ss.str("");
  }

  if(m_requestPayerHasBeenSet)
  {
   headers.insert(Aws::Http::HeaderValuePair("x-amz-request-payer", RequestPayerMapper::GetNameForRequestPayer(m_requestPayer)));
  }

  return std::move(headers);

}


text:
package com.sun.source.tree;

import java.util.List;
import javax.lang.model.element.Name;

/**
 * A tree node for a type parameter.
 *
 * For example:
 *

 *   name
 *
 *   name extends bounds
 *

 *
 * @see "The Java Language Specification, 3rd ed, section 4.4"
 *
 * @author Peter von der Ahé
 * @author Jonathan Gibbons
 * @since 1.6
 */
public interface TypeParameterTree extends Tree {
    Name getName();
    List<? extends Tree> getBounds();
}


text:
@namespace "library://ns.adobe.com/flex/mx";
@namespace charts "mx.charts.chartClasses.*";

BarSeries
{
	labelClass: ClassReference("mx.controls.Label");
}

BarChart
{
	labelClass: ClassReference("mx.controls.Label");
}

ColumnSeries
{
	labelClass: ClassReference("mx.controls.Label");
}

ColumnChart
{
	labelClass: ClassReference("mx.controls.Label");
}

AxisRenderer
{
	labelClass: ClassReference("mx.controls.Label");
}


text:
BUILD_STEP_FILE="$(mktemp)"
BUILD_STEP_PID=''
BUILD_STEP_DELAY='1m'

build_step_log() {
	echo "$(date) -- ${*}"
}

# start a build step, and log every
build_step() {
	echo "${*}" > "${BUILD_STEP_FILE}"
	build_step_log "starting: $(cat "${BUILD_STEP_FILE}")"
	[ -n "${BUILD_STEP_PID}" ] && return
	while sleep "${BUILD_STEP_DELAY}"
	do
		build_step_log "running: $(cat "${BUILD_STEP_FILE}")"
	done & BUILD_STEP_PID=${!}
}

# clean up the logging of build steps
build_steps_cleanup() {
	[ -n "${BUILD_STEP_PID}" ] && kill "${BUILD_STEP_PID}"
	rm -f "${BUILD_STEP_FILE}"
	BUILD_STEP_PID=''
}

# automatically stop build step logging and cleanup temporary file
trap build_steps_cleanup EXIT


text:
DumpManager::DumpManager(unsigned long address, unsigned int maxOffset, unsigned int depth, DumpDataList &dumps, PointerOffsets &offsets, string filename) : m_outFile(filename, ofstream::out)
{
	m_continue = false;
	m_address = address;
	m_dumps = dumps;
	m_offsets = offsets;
	m_maxOffset = maxOffset;
	m_depth = depth;
	m_cancel = false;
	m_status = DATAMANAGER_STATUS_IDLE;
	unsigned int tmp[] = { 6, 3, 2, 1, 1 };
	maxResList = vector<unsigned int>(tmp, tmp+5);
}
DumpManager::DumpManager(unsigned long address, DumpDataList &dumps, string inputFname, string scanFname) : m_inFile(inputFname, ifstream::in), m_outFile(scanFname, ofstream::out)
{
	m_continue = true;
	m_address = address;
	m_dumps = dumps;
	m_cancel = false;
	m_status = DATAMANAGER_STATUS_IDLE;
}

DumpManager::~DumpManager()
{
	m_dumps.clear();
	m_offsets.clear();
}

void DumpManager::start()
{
	m_status = DATAMANAGER_STATUS_WORKING;
	if (m_outFile) //we didn't create the file
		m_outFile << CCCHEAT_VERSION << '\n';
	m_thread = thread(&DumpManager::run, this);
}

void DumpManager::readInFile()
{
	string version;
	ScanResultList ls;
	m_inFile.seekg(0);
	m_inFile >> version;
	while (1)
	{
		unsigned long address;
		unsigned int offset;
		unsigned int depth;
		PointerOffsets po;
		if (m_cancel) return;
		m_inFile >> hex >> address >> depth;
		if (m_inFile.eof())
			break;
		for (unsigned int i=0; i<depth; ++i)
		{
			m_inFile >> hex >> offset;
			po.push_back(offset);
		}
		unsigned long val = refreshAddress(address, po); //lets check the current value of the pointer
		if (val != 0 && val == m_address) //this pointer still points to where we expect, lets add it to the list
		{
			ls.push_back(ScanResult(address, po));
			if (ls.size() == 4)
			{
				addResults(ls);
				ls.clear();
			}
		}
	}
	if (ls.size() > 0)
	{
		addResults(ls);
		ls.clear();
	}
}

unsigned long DumpManager::refreshAddress(unsigned long address, PointerOffsets offsets)
{
	unsigned int currentOffset = offsets.back();
	offsets.pop_back();
	for (DumpDataList::const_iterator it = m_dumps.begin(); it != m_dumps.end(); ++it)
	{
		if (address >= (*it)->header.begin && address <= (*it)->header.end)
		{
			if (m_cancel) return 0;
			char *data = (*it)->data;
			unsigned long newAddress = BSWAP32(*(unsigned long*) (&data[address - (*it)->header.begin]));
			newAddress += currentOffset;
			if (offsets.size() == 0)
				return newAddress;
			return refreshAddress(newAddress, offsets);
		}
	}
	return 0;
}

void DumpManager::run()
{
	int res = 1;
	if (m_continue) //read in file info
	{
		readInFile();
	}
	else
	{
		while (res && !m_cancel)
		{
			res = process();
		}
	}
	if (m_outFile)
		m_outFile.close();
	if (m_cancel)
		m_status = DATAMANAGER_STATUS_CANCELED;
	else
		m_status = DATAMANAGER_STATUS_COMPLETE;
}

void DumpManager::cancel()
{
	lock_guard<mutex> lock(m_addDumpScanLock);
	m_cancel = true;
	for (auto it = m_scannerList.begin(); it!= m_scannerList.end(); ++it)
	{
		(*it)->cancel();
	}
}

void DumpManager::addResults(ScanResultList &ls)
{
	lock_guard<mutex> lock(m_totalResultLock);
	//m_totalResults.insert(m_totalResults.end(), ls.begin(), ls.end());
	for (ScanResultList::const_iterator it = ls.begin(); it != ls.end(); ++it)
	{
		m_totalResults.push_back(*it);
		if (m_outFile)
		{
			m_outFile << hex << it->address << " " << it->offsets.size() << " ";
			for (PointerOffsets::const_iterator pt = it->offsets.begin(); pt != it->offsets.end(); ++pt)
				m_outFile << hex << *pt << " ";
			m_outFile << '\n';
		}
	}
}

int DumpManager::process()
{
	int res;
	shared_ptr<DumpScan> s;
	ScanResultList sr;
	unsigned int depth=0;
	lock_guard<mutex> lock(m_addDumpScanLock);
	if (m_cancel)
	{
		m_scannerList.clear();
		return 0;
	}
	if (m_scannerList.size() == 0)
	{
		s = make_shared<DumpScan>(m_address, m_maxOffset, m_dumps, m_offsets, maxResList[depth]);
		res = s->startProcess();
		switch (res)
		{
		case DUMP_SCAN_STATUS_CONTINUE: //we must continue this one
			sr = s->getResults();
			addResults(sr);
			pushScanDump(s); //add ourself
			if (s->getDepth() < m_depth)
			{
				depth = s->getDepth();
				for (ScanResultList::iterator it = sr.begin(); it != sr.end(); ++it)
				{
					s = make_shared<DumpScan>( it->address, m_maxOffset, m_dumps, it->offsets, maxResList[depth] );
					pushScanDump(s);
				}
			}
			m_currentScanner = m_scannerList.begin();
			break;
		case DUMP_SCAN_STATUS_DONE: //this one is done!
			sr = s->getResults();
			addResults(sr);
			if (s->getDepth() < m_depth)
			{
				depth = s->getDepth();
				for (ScanResultList::iterator it = sr.begin(); it != sr.end(); ++it)
				{
					s = make_shared<DumpScan>( it->address, m_maxOffset, m_dumps, it->offsets, maxResList[depth] );
					pushScanDump(s);
				}
			}
			m_currentScanner = m_scannerList.begin();
			break;
		case DUMP_SCAN_STATUS_CANCEL: //this one is canceled
			//m_scannerList.clear();
			return 0;
			break;
		}
	}
	else //we have some scanner objects!
	{
		s = *m_currentScanner;
		DumpScanList::iterator tmp = m_currentScanner;
		bool isLastDepth = false;
		//if (++tmp != m_scannerList.end())
		if (++tmp == m_scannerList.end())
		{
			//if (s->getDepth() != (*tmp)->getDepth()) //we are at the last scanner of this depth
				isLastDepth = true;
		}

		if (s->getResults().size() == 0)
			res = s->startProcess();
		else
			res = s->continueProcess();
		switch (res)
		{
		case DUMP_SCAN_STATUS_CONTINUE: //we must continue this one
			sr = s->getResults();
			addResults(sr);
			if (s->getDepth() < m_depth)
			{
				depth = s->getDepth();
				for (ScanResultList::iterator it = sr.begin(); it != sr.end(); ++it)
				{
					s = make_shared<DumpScan>( it->address, m_maxOffset, m_dumps, it->offsets, maxResList[depth] );
					pushScanDump(s);
				}
				if (isLastDepth)
					m_currentScanner = m_scannerList.begin();
				else
				{
					m_currentScanner++;
					if (m_currentScanner == m_scannerList.end())
					{
						m_currentScanner = m_scannerList.begin();
					}
				}
			}
			else
			{
				m_currentScanner++;
				if (m_currentScanner == m_scannerList.end())
				{
					m_currentScanner = m_scannerList.begin();
				}
			}
			break;
		case DUMP_SCAN_STATUS_DONE: //this one is done!
			sr = s->getResults();
			addResults(sr);

			m_currentScanner = m_scannerList.erase(m_currentScanner);

#if 0
			//make sure we aren't cancelling our scan
			m_addDumpScanLock.lock();
			if (!m_cancel)
				m_currentScanner = m_scannerList.erase(m_currentScanner);
			m_addDumpScanLock.unlock();
#endif
			if (s->getDepth() < m_depth)
			{
				depth = s->getDepth();
				for (ScanResultList::iterator it = sr.begin(); it != sr.end(); ++it)
				{
					s = make_shared<DumpScan>( it->address, m_maxOffset, m_dumps, it->offsets, maxResList[depth] );
					pushScanDump(s);
				}
				if (isLastDepth)
					m_currentScanner = m_scannerList.begin();
				else
				{
					m_currentScanner++;
					if (m_currentScanner == m_scannerList.end())
					{
						m_currentScanner = m_scannerList.begin();
					}
				}
			}
			else
			{
				if (m_currentScanner == m_scannerList.end())
					m_currentScanner = m_scannerList.begin();
			}
			break;
		case DUMP_SCAN_STATUS_CANCEL: //this one is canceled
			m_scannerList.clear();
			return 0;
			break;
		}
	}
	return m_scannerList.size();
}


text:
<?php

// UserBundle:User:show.html.twig
return array (
);