text:
package com.thinkaurelius.titan;

import com.google.common.base.Preconditions;
import com.thinkaurelius.titan.diskstorage.StaticBuffer;
import com.thinkaurelius.titan.diskstorage.WriteBuffer;
import com.thinkaurelius.titan.diskstorage.util.StaticArrayBuffer;
import com.thinkaurelius.titan.diskstorage.util.WriteByteBuffer;
import com.thinkaurelius.titan.graphdb.database.idhandling.IDHandler;
import com.thinkaurelius.titan.graphdb.types.system.BaseKey;
import com.thinkaurelius.titan.graphdb.types.system.BaseLabel;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.cliffc.high_scale_lib.NonBlockingHashMapLong;

import javax.annotation.Nonnull;
import java.lang.reflect.AnnotatedType;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Random;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.ConcurrentHashMap;

public class TestBed {

    static enum TEnum {

        ONE, TWO, THREE {
            @Override
            public String toString() {
                return "three";
            }
        }, FOUR;

        @Override
        public String toString() {
            return super.toString().toLowerCase();
        }

    }

    static class A {

        private int c = 0;
        private final Object o;

        A(final Object o) {
            this.o = o;
        }

        public void inc() {
            c++;
        }

    }

    public static class B {

        public B(int a) {}

    }

    private static final void doSomethingExpensive(int milliseconds) {
        double d=0.0;
        Random r = new Random();
        for (int i=0;i<10000*milliseconds;i++) d+=Math.pow(1.1,r.nextDouble());

    }

    private static final ArrayList<Object> mixedList = new ArrayList<Object>() {{
        add("try1");
        add(2);
    }};

    private static void throwOuter() throws Exception {
        throw throwInner(new IllegalArgumentException("Test"));
    }

    private static Exception throwInner(Exception e) throws Exception {
        return e;
    }

    private static int plusFive(int num) {
        return num+5;
    }

    public static class TestA {

        final Number a;
        final String b;

        public TestA(Number a, String b) {
            this.a = a;
            this.b = b;
        }
    }

    interface Observer {

        boolean observes();

        void observe(Object o);

        static Observer NO_OP = new Observer() {

            @Override
            public boolean observes() {
                return false;
            }

            @Override
            public void observe(Object o) {
                System.out.println(o);
            }
        };

    }

    static class ObserverManager implements Observer {

        private boolean observed = false;

        public void observe(Object o, Observer other) {
            if (!observed && !other.observes()) return;
            observe(o);
            other.observe(o);
        }

        public void observe(Object o1, Object o2, Observer other) {
            if (!observed && !other.observes()) return;
            List combined = new ArrayList<>();
            combined.add(o1);
            combined.add(o2);
            observe(combined);
            other.observe(combined);
        }

        public boolean observes() {
            return observed;
        }

        @Override
        public void observe(Object o) {
            System.out.println(o);
        }

    }

    static class Context {

        private final ObserverManager om;
        private final Observer os;

        Context(ObserverManager om, Observer os) {
            this.om = om;
            this.os = os;
        }

        public void observe(Object o) {
            om.observe(o,os);
        }

        public void observe(Object o1, Object o2) {
            om.observe(o1,o2,os);
        }

    }

    static class Container {
        private final String s1;
        private final String s2;

        Container(String s1, String s2) {
            this.s1 = s1;
            this.s2 = s2;
        }
    }

    public static @Nonnull String getInt(@Nonnull int a, int b) {
        return String.valueOf(a+b);
    }

    /**
     * @param args
     * @throws java.io.IOException
     */
    public static void main(String[] args) throws Exception {
        Method method = TestBed.class.getMethod("getInt",int.class,int.class);
        AnnotatedType rt = method.getAnnotatedReturnType();
        System.out.println(rt.getType());
        System.out.println(rt.getAnnotations().length);
        System.out.println(method.getAnnotations().length);
        for (int i = 0; i < method.getAnnotations().length; i++) {
            System.out.println(method.getAnnotations()[i]);
        }

//        String[] s = {"a","b","c","d","e","f","g","h","i","x","u"};
//        int len = s.length;
//        Random random = new Random();
//
//        Context c = new Context(new ObserverManager(),Observer.NO_OP);
//        //Warmup
//        for (int i = 0; i < 1000000000; i++) {
//            c.observe(s[1],s[2]);
//        }
//        long before = System.nanoTime();
//        for (int i = 0; i < 1000000000; i++) {
//            c.observe(s[1],s[2]);
//        }
//        long total = System.nanoTime()-before;
//        System.out.println("Total time: " + total/1000000);

        System.exit(0);

        final ScheduledExecutorService exe = new ScheduledThreadPoolExecutor(1,new RejectedExecutionHandler() {
            @Override
            public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
                r.run();
            }
        });
        ScheduledFuture future = exe.scheduleWithFixedDelay(new Runnable() {
            AtomicInteger atomicInt = new AtomicInteger(0);

            @Override
            public void run() {
                try {
                for (int i=0;i<10;i++) {
                    exe.submit(new Runnable() {

                        private final int number = atomicInt.incrementAndGet();

                        @Override
                        public void run() {
                            try {
                                Thread.sleep(150);
                            } catch (InterruptedException e) {
                                e.printStackTrace();
                            }
                            System.out.println(number);
                        }
                    });
                    System.out.println("Submitted: "+i);
//                    doSomethingExpensive(20);
                }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        },0,1, TimeUnit.SECONDS);
        Thread.sleep(10000);
//        future.get(1,TimeUnit.SECONDS);
        System.out.println("Cancel: " + future.cancel(false));
        System.out.println("Done: " + future.isDone());
        exe.shutdown();
//        Thread.sleep(2000);
        System.out.println("Terminate: " + exe.awaitTermination(5,TimeUnit.SECONDS));
        System.out.println("DONE");
        NonBlockingHashMapLong<String> id1 = new NonBlockingHashMapLong<String>(128);
        ConcurrentHashMap<Long,String> id2 = new ConcurrentHashMap<Long, String>(128,0.75f,2);

    }

    public static String toBinary(int b) {
        String res = Integer.toBinaryString(b);
        while (res.length() < 32) res = "0" + res;
        return res;

    }

}


text:
(function($) {
	$.widget('ui.gauge', {
		options: {
			value:0,
			max:100,
			width:100,
			duration:1000,
			formatter:null
		},
		min:0,
		_create: function() {
			this.element.find('.body').remove();
			this.element
			.addClass('ui-gauge')
			.attr({
				role:'gauge'
			})
			.append(
				$('<div />').attr('class', 'body')
				.append(
					$('<div />').attr('class', 'bar')
					.append(
						$('<span />').attr('class', 'text')
					)
				).append(
					$('<span />').attr('class', 'text')
				)
			)
			.data('max', this.options.max)
			.data('value', this._value());

			this.oldValue = this._value();

			this.element[0].animateValue = this.oldValue;
			this._refreshElement();
		},
		_destroy: function() {
			this.element.find('.body').remove();
			this.element
			.removeClass('ui-gauge')
			.removeAttr('role')
			.removeData('min')
			.removeData('max')
			.removeData('value')
		},
		value: function(value) {
			if (value === undefined) {
				// getter
				return this._value();
			} else {
				// setter
				this._setOption('value', value);

				return this;
			}
		},
		_value: function() {
			var value = this.options.value;
			if (typeof value !== 'number') {
				value = 0;
			}

			return Math.min(this.options.max, Math.max(this.min, value));
		},
		reset: function(value, max) {
			var duration = this.options.duration;

			this._setOption('duration', 0);
			this._setOption('max', max);
			this._setOption('value', value);
			this._setOption('duration', duration);
		},
		max: function(value) {
			// getter
			return this.options.max;
		},
		_setOption: function(key, value) {
			switch (key) {
				case 'value':
					this.element.data('value', value);

					break;
				case 'min':
					this.element.data('min', value);

					break;
				case 'max':
					this.element.data('max', value);

					break;
			}

			$.Widget.prototype._setOption.apply(this, arguments);
			this._refreshElement();
		},
		_width: function() {
			var body = this.element.find('.body');

			return body.innerWidth() -
				body.cssFloat('border-left-width') -
				body.cssFloat('border-right-width');
		},
		_refreshElement: function() {
			var that = this;
			var text = this.element.find('.body').find('.text');

			this.element.width(this.options.width);
			text.width(this._width());

			var value = this.value();
			if (this.oldValue != value) {
				this.element
					.attr('animate-value', this.oldValue)
					.animate(
						{animateValue:value},
						{
							duration:this.options.duration,
							easing:'swing',
							step: function(s) {
								that._refreshBar(s);
							},
							complete: function() {
								$(this).removeAttr('animate-value');
							}
						}
					);

				this.oldValue = value;
			} else {
				this._refreshBar(this._value());
			}
		},
		_refreshBar: function(value) {
			var body = this.element.find('.body');
			var bar = body.find('.bar');
			var text = body.find('.text');
			var max = this.options.max;
			var percentage = value / this.options.max;
			var width = Math.floor(this._width() * percentage);
			var formatter = this.options.formatter;

			bar.width(width);
			if (formatter) {
				text.text(formatter(value, max));
			}
		},
		getDuration: function() {
			return this.options.duration;
		}
	});
})(jQuery);

redpajama_set_name: RedPajamaGithub


text:
<?php
namespace NS;
use \foo;
use \foo;
use function ast\parse_code;
use function ast\parse_file as parse_code;
use const PHP_VERSION;
use const PHP_VERSION;

var_export(parse_code('x.php', 50));
var_export(new Foo());
var_export(PHP_VERSION);


text:
int main (int argc, char* argv[])
{
	gtk_init(&argc, &argv);

	GtkWidget* window;
	window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
	g_signal_connect(window, "delete-event", G_CALLBACK(gtk_main_quit), NULL);
	gtk_widget_show(window);

	gtk_main();
	return 0;
}


text:
package org.jbpm.workbench.pr.events;

import org.jboss.errai.common.client.api.annotations.Portable;

@Portable
public class ProcessInstanceSelectionEvent {

    private Long processInstanceId;
    private String processDefId;
    private String deploymentId;
    private Integer processInstanceStatus;
    private String processDefName;
    private boolean forLog;
    private String serverTemplateId;

    public ProcessInstanceSelectionEvent() {
    }

    public ProcessInstanceSelectionEvent(String deploymentId, Long processInstanceId, String processDefId, String processDefName, Integer processInstanceStatus, String serverTemplateId) {
        this.processInstanceId = processInstanceId;
        this.processDefId = processDefId;
        this.deploymentId = deploymentId;
        this.processInstanceStatus = processInstanceStatus;
        this.processDefName = processDefName;
        this.serverTemplateId = serverTemplateId;
        this.forLog = false;
    }

    public ProcessInstanceSelectionEvent(String deploymentId, Long processInstanceId, String processDefId,
                                         String processDefName, Integer processInstanceStatus, boolean forLog, String serverTemplateId) {
        this(deploymentId, processInstanceId, processDefId, processDefName, processInstanceStatus, serverTemplateId);
        this.forLog = forLog;
    }

    public Long getProcessInstanceId() {
        return processInstanceId;
    }

    public String getProcessDefId() {
        return processDefId;
    }

    public String getDeploymentId() {
        return deploymentId;
    }

    public Integer getProcessInstanceStatus() {
        return processInstanceStatus;
    }

    public String getProcessDefName() {
        return processDefName;
    }

    public String getServerTemplateId() {
        return serverTemplateId;
    }

    @Override
    public String toString() {
        return "ProcessInstanceSelectionEvent{" + "processInstanceId=" + processInstanceId + ", processDefId=" + processDefId + ", deploymentId=" + deploymentId + ", processInstanceStatus=" + processInstanceStatus + ", processDefName=" + processDefName + '}';
    }

    @Override
    @SuppressWarnings("PMD.AvoidMultipleUnaryOperators")
    public int hashCode() {
        int hash = 7;
        hash = 37 * hash + (this.processInstanceId != null ? this.processInstanceId.hashCode() : 0);
        hash = ~~hash;
        hash = 37 * hash + (this.processDefId != null ? this.processDefId.hashCode() : 0);
        hash = ~~hash;
        hash = 37 * hash + (this.deploymentId != null ? this.deploymentId.hashCode() : 0);
        hash = ~~hash;
        hash = 37 * hash + (this.processInstanceStatus != null ? this.processInstanceStatus.hashCode() : 0);
        hash = ~~hash;
        hash = 37 * hash + (this.processDefName != null ? this.processDefName.hashCode() : 0);
        hash = ~~hash;
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final ProcessInstanceSelectionEvent other = (ProcessInstanceSelectionEvent) obj;
        if (this.processInstanceId != other.processInstanceId && (this.processInstanceId == null || !this.processInstanceId.equals(other.processInstanceId))) {
            return false;
        }
        if (this.processDefId == null ? other.processDefId != null : !this.processDefId.equals(other.processDefId)) {
            return false;
        }
        if (this.deploymentId == null ? other.deploymentId != null : !this.deploymentId.equals(other.deploymentId)) {
            return false;
        }
        if (this.processInstanceStatus != other.processInstanceStatus && (this.processInstanceStatus == null || !this.processInstanceStatus.equals(other.processInstanceStatus))) {
            return false;
        }
        if (this.processDefName == null ? other.processDefName != null : !this.processDefName.equals(other.processDefName)) {
            return false;
        }
        return true;
    }

    public boolean isForLog() {
        return forLog;
    }

}


text:
@interface MOBProjectionEPSG2237 : MOBProjection

@end


text:
#include "Precompiled.h"
#include "XMEnemy.h"
#include "Node/Character/Player/XMPlayer.h"

#include "Node/Bullet/Enemy/XMSmallBullet.h"
#include "Node/Bullet/Enemy/XMGoblinRiderBullet.h"

XMEnemy::XMEnemy ( KDvoid )
{
	m_sType = new char[64];
}

XMEnemy::~XMEnemy ( KDvoid )
{
	delete m_sType;
}

KDbool XMEnemy::initWithContentsOfFile ( const std::string& filename )
{
	if ( !XMCharacter::initWithContentsOfFile ( filename ) )
	{
		return KD_FALSE;
	}

	this->playIdleAnimation ( );

	return KD_TRUE;
}

KDvoid XMEnemy::initVariable ( KDvoid )
{
	XMCharacter::initVariable ( );

	m_nScore = m_pCharacterDict->valueForKey ( "Score" )->intValue ( );
	m_bIsPlayAI = KD_FALSE;
}

KDvoid XMEnemy::setFilterInfo ( KDvoid )
{
	ColliderFilter			pColliderFilter;
	pColliderFilter.setCategoryBits ( CATEGORY_ENEMY );
	pColliderFilter.setGroupIndex ( GROUPINDEX_ENEMY );
	m_pArmature->setColliderFilter ( &pColliderFilter );

	if ( m_pArmature->getBone ( "WEAPON" ) != KD_NULL )
	{
		ColliderFilter		pColliderFilter2;
		pColliderFilter2.setCategoryBits ( CATEGORY_EWEAPON );
		pColliderFilter2.setGroupIndex ( GROUPINDEX_ENEMY );
		m_pArmature->getBone ( "WEAPON" )->setColliderFilter ( &pColliderFilter2 );
	}
}

KDvoid XMEnemy::homingPlayer ( KDfloat fDelta )
{
	m_bIsPlayAI = KD_TRUE;

	Point		tPlayerPosition = m_pPlayer->getArmature ( )->getPosition ( );
	Point		tMyPosition = this->getArmature ( )->getPosition ( );

	if ( tPlayerPosition.x + 100 >= tMyPosition.x && tPlayerPosition.x < tMyPosition.x &&
		 tPlayerPosition.y + 50 >= tMyPosition.y && tPlayerPosition.y - 100 < tMyPosition.y )
	{
		this->playSlashAnimation ( 1 );
		m_bIsPlayAI = KD_FALSE;
		unschedule ( schedule_selector ( XMEnemy::homingPlayer ) );
		return;
	}

	if ( tPlayerPosition.x + 100 < tMyPosition.x )
	{
		tMyPosition.x -= 5;
	}
	else
	{
		tMyPosition.x += 5;
	}

	if ( tPlayerPosition.y < tMyPosition.y )
	{
		if ( tPlayerPosition.y + 5 <= tMyPosition.y )
		{
			tMyPosition.y -= 5;
		}
		else
		{
			tMyPosition.y -= tMyPosition.y - tPlayerPosition.y;
		}

	}
	else if ( tPlayerPosition.y > tMyPosition.y )
	{
		if ( tPlayerPosition.y - 5 >= tMyPosition.y )
		{
			tMyPosition.y += 5;
		}
		else
		{
			tMyPosition.y += tPlayerPosition.y - tMyPosition.y;
		}

	}

	this->getArmature ( )->setPosition ( tMyPosition );
}

KDint XMEnemy::getScore ( KDvoid )
{
	return m_nScore;
}

KDbool XMEnemy::slash ( KDvoid )
{
	playSlashAnimation ( 1 );

	return KD_TRUE;
}

CallFunc* XMEnemy::makeLastAction ( KDvoid )
{
	return CallFunc::create
	(
		[ & ] ( )
		{
			m_bIsPlayAI = KD_FALSE;
		}
	);
}

FiniteTimeAction* XMEnemy::makeMoveRandom ( KDfloat fTime )
{
	KDint		nX =  CCRANDOM_BETWEEN ( 200,	m_tContentSize.width );
	KDint		nY =  CCRANDOM_BETWEEN (   0,	m_tContentSize.height );

	return EaseInOut::create ( MoveTo::create ( fTime, makeRandomPoint ( ) ), 2 );
}

FiniteTimeAction* XMEnemy::makeMoveLinear ( Point tPoint, KDfloat fTime )
{
	return EaseInOut::create ( MoveTo::create ( fTime, tPoint ), 2 );
}

FiniteTimeAction* XMEnemy::makeMoveEvade ( KDfloat fTime )
{
	KDint		nReturnX = CCRANDOM_BETWEEN ( m_tContentSize.width / 2,	m_tContentSize.width );
	KDint		nReturnY = kdRand ( ) % (KDint) m_tContentSize.height;
	Point		tReturnPoint = Point ( nReturnX, nReturnY );

	return JumpTo::create ( fTime, tReturnPoint, 50, 1 );
}

FiniteTimeAction* XMEnemy::makeMoveFlash ( Point tPoint, KDfloat fTime )
{
	FadeOut*	pFadeOutAction = FadeOut::create ( 0.3f );

	CallFunc*	pCallFunc1 = CallFunc::create
	(
		[ & ] ( )
		{
			m_pArmature->getB2Body ( )->SetActive ( KD_FALSE );
		}
	);

	DelayTime*	pDelayTime = DelayTime::create ( fTime );

	MoveTo*		pMoveTo = MoveTo::create ( 0, tPoint );

	CallFunc*	pCallFunc2 = CallFunc::create
	(
		[ & ] ( )
		{
			m_pArmature->getB2Body ( )->SetActive ( KD_TRUE );
		}
	);

	return Sequence::create ( pFadeOutAction, pCallFunc1, pDelayTime, pMoveTo, pCallFunc2, pFadeOutAction->reverse ( ), nullptr );
}

FiniteTimeAction* XMEnemy::makeMoveLeft ( Point tEnemyPoint, KDfloat fTime )
{
	KDfloat fRand = CCRANDOM_BETWEEN ( 0, tEnemyPoint.x ) ;
	tEnemyPoint.x = fRand;

	return EaseInOut::create ( MoveTo::create ( fTime, tEnemyPoint ), 1 );
}

FiniteTimeAction* XMEnemy::makeMoveRight ( Point tEnemyPoint, KDfloat fTime )
{
	KDfloat fRand = CCRANDOM_BETWEEN ( tEnemyPoint.x, m_tContentSize.width ) ;
	tEnemyPoint.x = fRand;

	return EaseInOut::create ( MoveTo::create ( fTime, tEnemyPoint ), 1 );
}

FiniteTimeAction* XMEnemy::makeMoveUp ( Point tEnemyPoint, KDfloat fTime )
{
	KDfloat fRand = CCRANDOM_BETWEEN ( tEnemyPoint.y, m_tContentSize.height ) ;
	tEnemyPoint.y = fRand;

	return EaseInOut::create ( MoveTo::create ( fTime, tEnemyPoint ), 1 );
}

FiniteTimeAction* XMEnemy::makeMoveDown	( Point tEnemyPoint, KDfloat fTime )
{
	KDfloat fRand = CCRANDOM_BETWEEN ( 0, tEnemyPoint.y ) ;
	tEnemyPoint.y = fRand;
	return EaseInOut::create ( MoveTo::create ( fTime, tEnemyPoint ), 1 );
}

Point XMEnemy::makeRandomPoint ( KDvoid )
{
	KDint		nX =  CCRANDOM_BETWEEN ( 200,	m_tContentSize.width );
	KDint		nY =  CCRANDOM_BETWEEN (   0,	m_tContentSize.height );

	return Point ( nX, nY );
}

XMPlayer* XMEnemy::getPlayer ( )
{
	return m_pPlayer;
}

KDfloat XMEnemy::getAngle ( Point tPoint1, Point tPoint2 )
{
	KDfloat			dx = tPoint2.x - tPoint1.x;
	KDfloat			dy = tPoint2.y - tPoint1.y;

	KDdouble		dRad = kdAtan2 ( dy, dx );
	KDdouble		dDegree = dRad * ( 180 / KD_PI_F );

	if ( dDegree < 0 )
	{
		dDegree += 360;
	}

	return dDegree;
}

KDfloat XMEnemy::getRadius ( Point tPoint1, Point tPoint2 )
{
	return kdSqrt ( kdPow ( tPoint2.x - tPoint1.x, 2 ) + kdPow ( tPoint2.y - tPoint1.y, 2 ) );
}

KDvoid XMEnemy::runActionByArray ( Array* pArray )
{
	kdAssert ( pArray != KD_NULL );

	for ( KDint i = 0; i < pArray->count ( ); i++ )
	{
		if ( FiniteTimeAction* pAction = dynamic_cast< FiniteTimeAction* > ( pArray->getObjectAtIndex ( i ) ) )
		{
			kdAssert ( pAction != KD_NULL );
		}
	}

	m_bIsPlayAI = KD_TRUE;

	pArray->addObject ( makeLastAction ( ) );

	m_pArmature->runAction ( Sequence::create ( pArray ) );
}

KDfloat XMEnemy::getMaxHP ( KDvoid )
{
	if ( kdStrcmp ( m_sType, "BOSS" ) == 0 )
	{
		return m_fMaxHP * BOSS_STATE_RATE;
	}
	return m_fMaxHP;
}

KDvoid XMEnemy::setMaxHP ( KDfloat nMaxHP )
{
	m_fMaxHP = nMaxHP;
}

KDfloat XMEnemy::getCurrentHP ( KDvoid )
{
	if ( kdStrcmp ( m_sType, "BOSS" ) == 0 )
	{
		return m_fCurrentHP * BOSS_STATE_RATE;
	}
	return m_fCurrentHP;
}
KDvoid XMEnemy::setCurrentHP ( KDfloat nCurrentHP )
{
	m_fCurrentHP = nCurrentHP;
}

KDfloat XMEnemy::getMoveSpeed ( KDvoid )
{
	if ( kdStrcmp ( m_sType, "BOSS" ) == 0 )
	{
		return m_fMoveSpeed * BOSS_STATE_RATE;
	}
	return m_fMoveSpeed;
}

KDvoid XMEnemy::setMoveSpeed ( KDfloat fMoveSpeed )
{
	m_fMoveSpeed = fMoveSpeed;
}

KDfloat XMEnemy::getShootDamage ( KDvoid )
{
	if ( kdStrcmp ( m_sType, "BOSS" ) == 0 )
	{
		return m_fShootDamage * BOSS_STATE_RATE;
	}
	return m_fShootDamage;
}

KDvoid XMEnemy::setShootDamage ( KDfloat nShootDamage )
{
	m_fShootDamage = nShootDamage;
}

KDfloat XMEnemy::getSlashDamage ( KDvoid )
{
	if ( kdStrcmp ( m_sType, "BOSS" ) == 0 )
	{
		return m_fSlashDamage * BOSS_STATE_RATE;
	}
	return m_fSlashDamage;
}

KDvoid XMEnemy::setSlashDamage ( KDfloat nSlashDamage )
{
	m_fSlashDamage = nSlashDamage;
}

XMEnemyBullet* XMEnemy::makeBullet ( BULLET_TYPE eBulletType )
{
	XMEnemyBullet*	pBullet = nullptr;
	switch ( eBulletType )
	{
		case BULLET_SMALL		: pBullet = XMSmallBullet::create ( m_pParentWorld );				break;
		case BULLET_GOBLINRIDER : pBullet = XMGoblinRiderBullet::create ( m_pParentWorld );			break;

		default					: pBullet = XMSmallBullet::create ( m_pParentWorld );				break;
	}

	return pBullet;
}

KDvoid XMEnemy::shootLinear ( BULLET_TYPE eBulletType, KDfloat fSpeed )
{
	XMEnemyBullet*		pBullet = makeBullet ( eBulletType );
	pBullet->setPosition ( m_pArmature->getPosition ( ) );
	this->getParent ( )->addChild ( pBullet );

	pBullet->shootLinear ( SHOOTDIRECTION_LEFT, fSpeed );
	playShootAnimation ( );
}

KDvoid XMEnemy::shootAiming ( BULLET_TYPE eBulletType, KDfloat fSpeed )
{
	Point				tPoint = m_pPlayer->getArmature ( )->getPosition ( );

	XMEnemyBullet*		pBullet = makeBullet ( eBulletType );
	pBullet->setPosition ( m_pArmature->getPosition ( ) );
	this->getParent ( )->addChild ( pBullet );

	pBullet->shootAiming ( tPoint, fSpeed );
	playShootAnimation ( );
}

KDvoid XMEnemy::shootMulti ( BULLET_TYPE eBulletType, KDint nBulletCount, KDdouble dDegree )
{
	Point		tPoint1 = m_pArmature->getPosition ( );
	Point		tPoint2 = m_pPlayer->getArmature ( )->getPosition ( );

	KDdouble	dAngle = getAngle ( tPoint1, tPoint2 );
	KDint		nHalfBullet = nBulletCount / 2;
	KDdouble	r = getRadius ( tPoint1, tPoint2 );
	KDdouble	dMaxDegree;

	if ( nBulletCount % 2 == 0 )	// ¦¼ö
	{
		dMaxDegree = dAngle + ( dDegree * ( nHalfBullet - 1 ) ) + ( dDegree / 2.0f );
	}
	else	// Ȧ¼ö
	{
		dMaxDegree = dAngle + ( dDegree * nHalfBullet );
	}

	Array*		pArray = Array::create ( );

	for ( KDint i = 0; i < nBulletCount; i++ )
	{
		CallFunc*		pCallFunc = CallFunc::create
		(
			[ &, tPoint1, r, dMaxDegree, dDegree, i ] ( )
			{
				Node*			pNode = this->getParent ( );
				XMEnemyBullet*	pBullet = makeBullet ( BULLET_SMALL );

				Point tPoint1 = m_pArmature->getPosition ( );
				Point tPoint2 = m_pPlayer->getArmature ( )->getPosition ( );

				pBullet->setPosition ( tPoint1 );
				pBullet->setDamage ( this->getShootDamage ( ) );

				pNode->addChild ( pBullet, ZORDER_BULLET );

				KDdouble		dCurrentDegree = dMaxDegree - ( dDegree * i );
				KDdouble		rad = dCurrentDegree * KD_PI_F / 180.0f;

				Point			tDestPoint = Point ( 0, 0 );
				tDestPoint.x = r * kdCos ( rad ) + tPoint1.x;
				tDestPoint.y = r * kdSin ( rad ) + tPoint1.y;

				pBullet->shootAiming ( tDestPoint );
			}
		);

		pArray->addObject ( pCallFunc );
	}

	playShootAnimation ( );

	this->runActionByArray ( pArray );
}

KDvoid XMEnemy::shootMultiDelay ( BULLET_TYPE eBulletType, KDint nBulletCount, KDdouble dDegree, KDfloat fDelay )
{
	Point		tPoint1 = m_pArmature->getPosition ( );
	Point		tPoint2 = m_pPlayer->getArmature ( )->getPosition ( );

	KDdouble	dAngle = getAngle ( tPoint1, tPoint2 );
	KDint		nHalfBullet = nBulletCount / 2;
	KDdouble	r = getRadius ( tPoint1, tPoint2 );
	KDdouble	dMaxDegree;

	if ( nBulletCount % 2 == 0 )	// ¦¼ö
	{
		dMaxDegree = dAngle + ( dDegree * ( nHalfBullet - 1 ) ) + ( dDegree / 2.0f );
	}
	else	// Ȧ¼ö
	{
		dMaxDegree = dAngle + ( dDegree * nHalfBullet );
	}

	Array*		pActionArray = Array::create ( );

	for ( KDint i = 0; i < nBulletCount; i++ )
	{
		CallFunc* pCallFunc = CallFunc::create
		(
			[ &, tPoint1, r, dMaxDegree, dDegree, i ] ( )
			{
				Node*			pNode = this->getParent ( );
				XMEnemyBullet*	pBullet = makeBullet ( BULLET_SMALL );

				pBullet->setPosition ( tPoint1 );
				pBullet->setDamage ( this->getShootDamage ( ) );

				pNode->addChild ( pBullet, ZORDER_BULLET );

				KDdouble		dCurrentDegree = dMaxDegree - ( dDegree * i );
				KDdouble		rad = dCurrentDegree * KD_PI_F / 180.0f;

				Point			tDestPoint = Point ( 0, 0 );

				tDestPoint.x = r * kdCos ( rad ) + tPoint1.x;
				tDestPoint.y = r * kdSin ( rad ) + tPoint1.y;

				pBullet->shootAiming ( tDestPoint );
			}
		);

		pActionArray->addObject ( pCallFunc );
		pActionArray->addObject ( DelayTime::create ( fDelay ) );
	}
	playShootAnimation ( );

	this->runActionByArray ( pActionArray );
}

KDvoid XMEnemy::shootDivide ( BULLET_TYPE eBulletType, KDint nBulletCount, KDdouble dTotalDegree )
{
	Point		tPoint1 = m_pArmature->getPosition ( );
	Point		tPoint2 = m_pPlayer->getArmature ( )->getPosition ( );

	KDdouble	dAngle = getAngle ( tPoint1, tPoint2 );
	KDint		nHalfBullet = nBulletCount / 2;
	KDdouble	r = getRadius ( tPoint1, tPoint2 );

	KDdouble	dStartDegree;
	KDdouble	dIntervalDegree = dTotalDegree / nBulletCount;
	KDint		nI = 1;

	if ( nBulletCount % 2 == 0 )	// ¦¼ö
	{
		dStartDegree = dAngle + ( dIntervalDegree / 2 );
	}
	else
	{
		dStartDegree = dAngle;
	}

	Array*		pActionArray = Array::create ( );

	for ( KDint i = 0; i < nBulletCount; i++ )
	{
		dStartDegree = dStartDegree + ( dIntervalDegree * nI * i );
		nI = nI * -1;

		CallFunc*	pCallFunc = CallFunc::create
		(
			[ &, tPoint1, r, dStartDegree, dIntervalDegree, nI ] ( )
			{
				Node*				pNode = this->getParent ( );
				XMEnemyBullet*		pBullet = makeBullet ( BULLET_SMALL );

				pBullet->setPosition ( tPoint1 );
				pBullet->setDamage ( this->getShootDamage ( ) );

				pNode->addChild ( pBullet, ZORDER_BULLET );

				Point tDestPoint = Point ( 0, 0 );

				KDdouble rad = dStartDegree * KD_PI_F / 180.0f;

				tDestPoint.x = r * kdCos ( rad ) + tPoint1.x;
				tDestPoint.y = r * kdSin ( rad ) + tPoint1.y;

				pBullet->shootAiming ( tDestPoint );
			}
		);

		pActionArray->addObject ( pCallFunc );
	}

	playShootAnimation ( );

	this->runActionByArray ( pActionArray );
}

KDvoid XMEnemy::shootDivideDelay ( BULLET_TYPE eBulletType, KDint nBulletCount, KDdouble dTotalDegree, KDfloat fDelay )
{
	Point		tPoint1 = m_pArmature->getPosition ( );
	Point		tPoint2 = m_pPlayer->getArmature ( )->getPosition ( );

	KDdouble	dAngle = getAngle ( tPoint1, tPoint2 );
	KDint		nHalfBullet = nBulletCount / 2;
	KDdouble	r = getRadius ( tPoint1, tPoint2 );

	KDdouble	dStartDegree;
	KDdouble	dIntervalDegree = dTotalDegree / nBulletCount;
	KDint		nI = 1;

	if ( nBulletCount % 2 == 0 )	// ¦¼ö
	{
		dStartDegree = dAngle + ( dIntervalDegree / 2 );
	}
	else
	{
		dStartDegree = dAngle;
	}

	Array*		pActionArray = Array::create ( );

	for ( KDint i = 0; i < nBulletCount; i++ )
	{
		dStartDegree = dStartDegree + ( dIntervalDegree * nI * i );
		nI = nI * -1;

		CallFunc*	pCallFunc = CallFunc::create
		(
			[ &, tPoint1, r, dStartDegree, dIntervalDegree, nI ] ( )
			{
				Node*				pNode = this->getParent ( );
				XMEnemyBullet*		pBullet = makeBullet ( BULLET_SMALL );

				pBullet->setPosition ( tPoint1 );
				pBullet->setDamage ( this->getShootDamage ( ) );

				pNode->addChild ( pBullet, ZORDER_BULLET );

				Point tDestPoint = Point ( 0, 0 );

				KDdouble rad = dStartDegree * KD_PI_F / 180.0f;

				tDestPoint.x = r * kdCos ( rad ) + tPoint1.x;
				tDestPoint.y = r * kdSin ( rad ) + tPoint1.y;

				pBullet->shootAiming ( tDestPoint );
			}
		);

		pActionArray->addObject ( pCallFunc );
		pActionArray->addObject ( DelayTime::create ( fDelay ) );
	}

	playShootAnimation ( );

	this->runActionByArray ( pActionArray );
}


text:
require 'spec_helper'
require "settings"
require "threads/EC2"

include MultiEc2Kiq

describe Ec2 do
  let(:dynamodb) { double("Dynamodb") }

  before(:all) do
    Settings.source(File.expand_path("../../../lib/settings.yml", __FILE__))
    instance = Settings.instances[0]
    @ec2 = Ec2.new(instance["id"], instance["region"])
  end

  it 'should ec2 start.' do
    expect(@ec2).to receive(:start_instance)
    result = @ec2.start
    expect(result).to eq(true)
  end

  describe 'start_wait_until_stop' do
    it 'get to_stop status' do
      expect(@ec2).to receive(:dynamodb).and_return(dynamodb).at_least(:once)
      expect(@ec2).to receive(:start)
      expect(dynamodb).to receive(:started).with(anything)
      expect(dynamodb).to receive(:wait_until_to_stop).with(anything).and_return(true)
      expect(@ec2).to receive(:stop_instance)
      expect(dynamodb).to receive(:stopped).with(anything)

      result = @ec2.start_wait_until_stop
      expect(result).to eq(true)
    end

    it 'to_stop does not exist.' do
      expect(@ec2).to receive(:dynamodb).and_return(dynamodb).at_least(:once)
      expect(@ec2).to receive(:start)
      expect(dynamodb).to receive(:started).with(anything)
      expect(dynamodb).to receive(:wait_until_to_stop).with(anything).and_return(false)

      result = @ec2.start_wait_until_stop
      expect(result).to eq(true)
    end
  end
end


text:
from pypdevs.simulator import Simulator

# Import the model to be simulated
from model import TrafficSystem

#    ======================================================================

# 1. Instantiate the (Coupled or Atomic) DEVS at the root of the
#  hierarchical model. This effectively instantiates the whole model
#  thanks to the recursion in the DEVS model constructors (__init__).
#
trafficSystem = TrafficSystem(name="trafficSystem")

#    ======================================================================

# 2. Link the model to a DEVS Simulator:
#  i.e., create an instance of the 'Simulator' class,
#  using the model as a parameter.
sim = Simulator(trafficSystem)

#    ======================================================================

# 3. Perform all necessary configurations, the most commonly used are:

# A. Termination time (or termination condition)
#    Using a termination condition will execute a provided function at
#    every simulation step, making it possible to check for certain states
#    being reached.
#    It should return True to stop simulation, or Falso to continue.
def terminate_whenStateIsReached(clock, model):
    return model.trafficLight.state.get() == "manual"
sim.setTerminationCondition(terminate_whenStateIsReached)

#    A termination time is prefered over a termination condition,
#    as it is much simpler to use.
#    e.g. to simulate until simulation time 400.0 is reached
sim.setTerminationTime(400.0)

# B. Set the use of a tracer to show what happened during the simulation run
#    Both writing to stdout or file is possible:
#    pass None for stdout, or a filename for writing to that file
sim.setVerbose(None)

#    ======================================================================

# 4. Simulate the model
sim.simulate()

#    ======================================================================

# 5. (optional) Extract data from the simulated model
print("Simulation terminated with traffic light in state %s" % (trafficSystem.trafficLight.state.get()))


text:
<?php

use yii\helpers\Inflector;
use yii\helpers\StringHelper;

/* @var $this yii\web\View */
/* @var $generator yii\gii\generators\crud\Generator */

$urlParams = $generator->generateUrlParams();
$nameAttribute = $generator->getNameAttribute();

echo "<?php\n";
?>

use yii\helpers\Html;
use <?= $generator->indexWidgetType === 'grid' ? "yii\\grid\\GridView" : "yii\\widgets\\ListView" ?>;

/* @var $this yii\web\View */
<?= !empty($generator->searchModelClass) ? "/* @var \$searchModel " . ltrim($generator->searchModelClass, '\\') . " */\n" : '' ?>
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = <?= $generator->generateString(Inflector::pluralize(Inflector::camel2words(StringHelper::basename($generator->modelClass)))) ?>;
$this->params['breadcrumbs'][] = $this->title;
?>

                <button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>

Filter

                <?php if(!empty($generator->searchModelClass)): ?>
                <?= "    <?php " . ($generator->indexWidgetType === 'grid' ? "// " : "") ?>echo $this->render('_search', ['model' => $searchModel]); ?>
                <?php endif; ?>

                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>

<div class="<?= Inflector::camel2id(StringHelper::basename($generator->modelClass)) ?>-index">

        <?= "<?= " ?>Html::a(<?= $generator->generateString(" Create {modelClass}", ['modelClass' => Inflector::camel2words(StringHelper::basename($generator->modelClass))]) ?>, ['create'], ['class' => 'btn btn-success']) ?>

        <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#filter">
             Filter
        </button>

<?php if ($generator->indexWidgetType === 'grid'): ?>
    <?= "<?= " ?>GridView::widget([
        'dataProvider' => $dataProvider,
        <?= !empty($generator->searchModelClass) ? "'filterModel' => \$searchModel,\n        'columns' => [\n" : "'columns' => [\n"; ?>
            ['class' => 'yii\grid\SerialColumn'],

<?php
$count = 0;
if (($tableSchema = $generator->getTableSchema()) === false) {
    foreach ($generator->getColumnNames() as $name) {
        if (++$count < 6) {
            echo "            '" . $name . "',\n";
        } else {
            echo "            // '" . $name . "',\n";
        }
    }
} else {
    foreach ($tableSchema->columns as $column) {
        $format = $generator->generateColumnFormat($column);
        if (++$count < 6) {
            echo "            '" . $column->name . ($format === 'text' ? "" : ":" . $format) . "',\n";
        } else {
            echo "            // '" . $column->name . ($format === 'text' ? "" : ":" . $format) . "',\n";
        }
    }
}
?>

            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>
<?php else: ?>
    <?= "<?= " ?>ListView::widget([
        'dataProvider' => $dataProvider,
        'itemOptions' => ['class' => 'item'],
        'itemView' => function ($model, $key, $index, $widget) {
            return Html::a(Html::encode($model-><?= $nameAttribute ?>), ['view', <?= $urlParams ?>]);
        },
    ]) ?>
<?php endif; ?>


text:
#nullable disable
namespace PasPasPas.Parsing.SyntaxTree.Abstract {

    /// <summary>
    ///     target for an expression
    /// </summary>
    public interface IExpressionTarget {

        /// <summary>
        ///     value of this expression target
        /// </summary>
        IExpression Value { get; set; }

    }
}


text:
Yet another Progress Bar written in Javascript.

# Usage examples
* [Progress Bar with default options](https://jsfiddle.net/jcsmorais/Lzkuz6af/)
* [Progress Bar with starting value](https://jsfiddle.net/jcsmorais/5jqc3xw7/)
* [Progress Bar with custom formatter](https://jsfiddle.net/jcsmorais/7phwqjod/)
* [Progress Bar with custom style](https://jsfiddle.net/jcsmorais/3wken654/)
* [Progress Bar with custom style and animation](https://jsfiddle.net/jcsmorais/852hehrL/)

# API
| Method        | Params              | Type     | Description                                                                                |
|---------------|---------------------|----------|-------------------------------------------------------------------|
| `init`        | `selector`            | `string`   | First Element within the DOM that matches given selector. |
|               | `[options]`           | `Object`   | Progress Bar options. |
|               | `[options.max]`       | `number`   | Total tasks to execute, defaults to `1` if none supplied. |
|               | `[options.value]`     | `number`   | Total of tasks completed, defaults to `0` if none supplied. |
|               | `[options.formatter]` | `Function` | Format used for progress bar text updates performed via `setText`, defaults to `${iteration.percentage}%`. Other variables available through `${iteration}` are: `${iteration.value}` and `${iteration.max}`. |
|               | `[options.text]`      | `string`   | Initialize progress bar text, defaults to none. |
| `setProgress` | `percentage`          | `number`   | Update progress bar progress, `percentage` is a number between `0` and `100`. |
| `setValue`    | `value`               | `number`   | Update progress bar value, `value` is a number between `0` and `options.max`. |
| `setText`     | `string`              | `string`   | Update progress bar text. |

# Events
| Event                        | Params                    | Type     | Description                                                                                |
|------------------------------|---------------------------|----------|---------------------------------|
| `progressus:progress:change` | `event.detail.percentage` | `number` | Triggered when progress changes. |
| `progressus:value:change`    | `event.detail.value`      | `number` | Triggered when value changes. |
| `progressus:text:change`     | `event.detail.text`       | `text`   | Triggered when text changes. |


text:
Visit:

https://github.com/huacnlee/rails-settings-cached/releases

## 2.6.0

- Allows call key in Setting instance to support use keys in ActionView helpers.
  - Fix #212 not can use `f.select` with Setting instance method.
- Brake Changes: Limit use `var`, `value` as Setting key, now will raise error.

## 2.5.3

- Improve implement for avoid use `eval` method.
- Fix #211, support Proc default value for readonly field.

## 2.5.2

- Avoid allocate string on get value.

## 2.5.1

- Do validate on directly assignment (#202)

```rb
irb> Setting.default_locale = "foo"
ActiveRecord::RecordInvalid: (Validation failed: Default locale is not included in [zh-CN, en, jp])
```

## 2.5.0

- Add `validates` options to special the Rails Validation for fields (#201)

```rb
class Setting < RailsSettings::Base
  # cache_prefix { "v1" }
  field :app_name, default: "Rails Settings", validates: { presence: true, length: { in: 2..20 } }
  field :default_locale, default: "zh-CN", validates: { presence: true, inclusion: { in: %w[zh-CN en jp], message: "is not included in [zh-CN, en, jp]" } }
end
```

## 2.4.1

- Fix request_cache for backward compatible with Rails 5.0.x;
- No effect for Rails 5.2+;

In Rails 5.0:

```ruby
# You must add request_store dependency in to you Gemfile
gem "request_store"
gem "rails-settings-cached"
```

## 2.4.0

- Use [ActiveSupport::CurrentAttributes](https://api.rubyonrails.org/classes/ActiveSupport/CurrentAttributes.html) instead of the [request_store](https://github.com/steveklabnik/request_store) for storage request cache.
- Remove request_store dependency.

## 2.3.5

- Allows to use Setting without database connection, fallback to default value.

This changes is used to avoid startup errors in a database-free environment (such as assets:precompile in Docker build).

## 2.3.3

- Allows use setting, that if table was not ready (before migrate), print a warning and returns default value.

## 2.3.2

- Fix hash type with indifferent access.

```rb
Setting.smtp_settings = { foo: 1, bar: 2 }
Setting.smtp_settings[:foo]
=> 1
Setting.smtp_settings["foo"]
=> 1
```

## 2.3.1

- Add `get_field` method to get field option.

```rb
class Setting
  field :admin_emails, type: :array, default: "huacnlee"
end

Setting.get_field(:admin_emails)
=> { key: "admin_emails", type: :array, default: "huacnlee@gmail.com", readonly: false }
```

- Add `editable_keys` to get keys that allow to modify.
- Add `readonly_keys` to get readonly keys.

## 2.2.1

- Fix generator module name `Settings` conflict issue. #172

## 2.2.0

- Improve setting to support Float and BigDecimal.
- Add `Setting.keys` methods to get all keys.

## 2.1.0

- Fix default array separator, remove "space", now only: `\n` and `,`.
- Add `separator` option for speical the separator for Array type.

  For example:

  ```rb
  class Setting < RailsSettings::Base
    field :tips, type: :array, separator: /[\n]+/
    field :keywords, type: :array, separator: ","
  end
  ```

## 2.0.4

- Fix #166 avoid define method to super class.

## 2.0.0

> 🚨 BREAK CHANGES WARNING:
> rails-settings-cached 2.x has redesign the API, the new version will compatible with the stored setting values by older version.
> But you must read the README.md again, and follow guides to change your Setting model.

- New design release.
- No more `scope` support (RailsSettings::Extend has removed);
- No more YAML file.
- Requuire Ruby 2.5+, Rails 5.0+
- You must use `field` method to statement the setting keys before use.

  For example:

  ```rb
  class Setting < RailsSettings::Base
    field :host, default: "http://example.com"
    field :readonly_item, type: :integer, default: 100, readonly: true
    field :user_limits, type: :integer, default: 1
    field :admin_emails, type: :array, default: %w[admin@rubyonrails.org]
    field :captcha_enable, type: :boolean, default: 1
    field :smtp_settings, type: :hash, default: {
      host: "foo.com",
      username: "foo@bar.com",
      password: "123456"
    }
  end
  ```

- One SQL or Cache hit in each request, even you has multiple of keys call in a page.

  > NOTE: This design will load all settings from db/cache in memory, so I recommend that you do not design a lot of Setting keys (below 1000 keys), and do not store large value。

## Changes logs for 0.x

https://github.com/huacnlee/rails-settings-cached/blob/0.x/CHANGELOG.md


text:
springbokjs-library-skeleton
============================

A skeleton for a springbokjs library with compilation from es6 and tests

## Use

```
git clone git@github.com:christophehurpeau/springbokjs-library-skeleton.git YOUR_PROJECT_NAME
cd YOUR_PROJECT_NAME
rm -Rf .git
```


text:
//////////////////////////////////////////////////////////////////////////////////////
//
//  Copyright (c) 2014-2015, Egret Technology Inc.
//  All rights reserved.
//  Redistribution and use in source and binary forms, with or without
//  modification, are permitted provided that the following conditions are met:
//
//     * Redistributions of source code must retain the above copyright
//       notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above copyright
//       notice, this list of conditions and the following disclaimer in the
//       documentation and/or other materials provided with the distribution.
//     * Neither the name of the Egret nor the
//       names of its contributors may be used to endorse or promote products
//       derived from this software without specific prior written permission.
//
//  THIS SOFTWARE IS PROVIDED BY EGRET AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
//  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
//  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
//  IN NO EVENT SHALL EGRET AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
//  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
//  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA,
//  OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
//  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
//  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
//  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////////////

module egret.gui {

	/**
	 * @class egret.gui.ListBase
	 * @classdesc
	 * 支持选择内容的所有组件的基类。
	 * @extends egret.gui.SkinnableDataContainer
	 */
	export class ListBase extends SkinnableDataContainer{
		/**
		 * 未选中任何项时的索引值
		 * @constant egret.gui.ListBase.NO_SELECTION
		 */
		public static NO_SELECTION:number = -1;

		/**
		 * 未设置缓存选中项的值
		 * @constant egret.gui.ListBase.NO_PROPOSED_SELECTION
		 */
		public static NO_PROPOSED_SELECTION:number = -2;
		/**
		 * 自定义的选中项
		 * @constant egret.gui.ListBase.CUSTOM_SELECTED_ITEM
		 */
		public static CUSTOM_SELECTED_ITEM:number = -3;

		/**
		 * 构造函数
		 * @method egret.gui.ListBase#constructor
		 */
		public constructor(){
			super();
		}

		/**
		 * 正在进行所有数据源的刷新操作
		 * @member egret.gui.ListBase#_doingWholesaleChanges
		 */
		public _doingWholesaleChanges:boolean = false;

		private dataProviderChanged:boolean = false;

        public _setDataProvider(value):void{
            if (this.dataProvider)
                this.dataProvider.removeEventListener(CollectionEvent.COLLECTION_CHANGE,
                    this.dataProvider_collectionChangeHandler,this);

            this.dataProviderChanged = true;
            this._doingWholesaleChanges = true;

            if (value)
                value.addEventListener(CollectionEvent.COLLECTION_CHANGE,
                    this.dataProvider_collectionChangeHandler,this);

            super._setDataProvider(value);
            this.invalidateProperties();
        }

        /**
         * 布局对象
		 * @member egret.gui.ListBase#layout
         */
        public get layout():LayoutBase{
            return (this.dataGroup)
                ? this.dataGroup.layout
                : this._dataGroupProperties.layout;
        }
		/**
		 * @inheritDoc
		 */
		public set layout(value:LayoutBase){
			if (value && this.useVirtualLayout)
				value.useVirtualLayout = true;

			this._setLayout(value);
		}

		private _labelField:string = "label";

        private labelFieldOrFunctionChanged: boolean = false;

		/**
		 * 数据项如果是一个对象,此属性为数据项中用来显示标签文字的字段名称。
		 * 若设置了labelFunction,则设置此属性无效。
		 * @member egret.gui.ListBase#labelField
		 */
		public get labelField():string{
			return this._labelField;
		}

		public set labelField(value:string){
            this._setLabelField(value);
		}

        public _setLabelField(value:string){
            if (value == this._labelField)
                return;
            this._labelField = value;
            this.labelFieldOrFunctionChanged = true;
            this.invalidateProperties();
        }

        private _labelFunction: Function = null;

		/**
		 * 用户提供的函数,在每个项目上运行以确定其标签。
		 * 示例:function labelFunc(item:Object):String 。
		 * @member egret.gui.ListBase#labelFunction
		 */
		public get labelFunction():Function{
			return this._labelFunction;
		}

		public set labelFunction(value:Function){
			this._setLabelFunction(value);
		}

        public _setLabelFunction(value:Function):void{
            if (value == this._labelFunction)
                return;

            this._labelFunction = value;
            this.labelFieldOrFunctionChanged = true;
            this.invalidateProperties();
        }

		public _requireSelection:boolean = false;

		private requireSelectionChanged:boolean = false;

		/**
		 * 如果为 true,则必须始终在控件中选中数据项目。

		 * 如果该值为 true,则始终将 selectedIndex 属性设置为 0 和 (dataProvider.length - 1) 之间的一个值。
		 * @member egret.gui.ListBase#requireSelection
		 */
		public get requireSelection():boolean{
			return this._requireSelection;
		}

		public set requireSelection(value:boolean){
			this._setRequireSelection(value);
		}

        public _setRequireSelection(value:boolean):void{
            if (value == this._requireSelection)
                return;

            this._requireSelection = value;

            if (value){
                this.requireSelectionChanged = true;
                this.invalidateProperties();
            }
        }

		/**
		 * 在属性提交前缓存真实的选中项的值
		 */
		public _proposedSelectedIndex:number = ListBase.NO_PROPOSED_SELECTION;

		public _selectedIndex:number = ListBase.NO_SELECTION;

		/**
		 * 选中项目的基于 0 的索引。

		 * 或者如果未选中项目,则为-1。设置 selectedIndex 属性会取消选择当前选定的项目并选择指定索引位置的数据项目。

		 * 当用户通过与控件交互来更改 selectedIndex 属性时,此控件将分派 change 和 changing 事件。

		 * 当以编程方式更改 selectedIndex 属性的值时,此控件不分派 change 和 changing 事件。
		 * @member egret.gui.ListBase#selectedIndex
		 */
		public get selectedIndex():number{
			return this._getSelectedIndex();
		}

        public _getSelectedIndex():number{
            if (this._proposedSelectedIndex != ListBase.NO_PROPOSED_SELECTION)
                return this._proposedSelectedIndex;

            return this._selectedIndex;
        }

		public set selectedIndex(value:number){
			this._setSelectedIndex(value, false);
		}

		/**
		 * 是否允许自定义的选中项
		 */
		public _allowCustomSelectedItem:boolean = false;
		/**
		 * 索引改变后是否需要抛出事件
		 */
		public _dispatchChangeAfterSelection:boolean = false;

		/**
		 * 设置选中项
		 */
		public _setSelectedIndex(value:number, dispatchChangeEvent:boolean = false):void{
			if (value == this.selectedIndex){
				return;
			}

			if (dispatchChangeEvent)
				this._dispatchChangeAfterSelection = (this._dispatchChangeAfterSelection || dispatchChangeEvent);
			this._proposedSelectedIndex = value;
			this.invalidateProperties();
		}

		/**
		 *  在属性提交前缓存真实选中项的数据源
		 */
        public _pendingSelectedItem: any = undefined;

        private _selectedItem: any = null;

		/**
		 * 当前已选中的项目。设置此属性会取消选中当前选定的项目并选择新指定的项目。

		 * 当用户通过与控件交互来更改 selectedItem 属性时,此控件将分派 change 和 changing 事件。

		 * 当以编程方式更改 selectedItem 属性的值时,此控件不分派 change 和 changing 事件。
		 * @member egret.gui.ListBase#selectedItem
		 */
		public get selectedItem():any{
			if (this._pendingSelectedItem !== undefined)
				return this._pendingSelectedItem;

			if (this._allowCustomSelectedItem && this.selectedIndex == ListBase.CUSTOM_SELECTED_ITEM)
				return this._selectedItem;

			if (this.selectedIndex == ListBase.NO_SELECTION || this.dataProvider == null)
				return undefined;

			return this.dataProvider.length > this.selectedIndex ? this.dataProvider.getItemAt(this.selectedIndex) : undefined;
		}

		public set selectedItem(value:any){
			this._setSelectedItem(value, false);
		}

		/**
		 * 设置选中项数据源
		 * @method egret.gui.ListBase#_setSelectedItem
		 * @param value {any}
		 * @param dispatchChangeEvent {boolean}
		 */
		public _setSelectedItem(value:any, dispatchChangeEvent:boolean = false):void{
			if (this.selectedItem === value)
				return;

			if (dispatchChangeEvent)
				this._dispatchChangeAfterSelection = (this._dispatchChangeAfterSelection || dispatchChangeEvent);

			this._pendingSelectedItem = value;
			this.invalidateProperties();
		}

		private _useVirtualLayout:boolean = false;

		/**
		 * 是否使用虚拟布局,默认flase
		 * @member egret.gui.ListBase#useVirtualLayout
		 */
		public get useVirtualLayout():boolean{
			return this._getUseVirtualLayout();
		}

        public _getUseVirtualLayout():boolean{
            return (this.layout) ? this.layout.useVirtualLayout : this._useVirtualLayout;
        }

		public set useVirtualLayout(value:boolean){
            this._setUseVirtualLayout(value);
		}

        public _setUseVirtualLayout(value:boolean):void{
            if (value == this.useVirtualLayout)
                return;

            this._useVirtualLayout = value;
            if (this.layout)
                this.layout.useVirtualLayout = value;
        }

		/**
		 * 处理对组件设置的属性
		 * @method egret.gui.ListBase#commitProperties
		 */
		public commitProperties():void{
			super.commitProperties();

			if (this.dataProviderChanged){
				this.dataProviderChanged = false;
				this._doingWholesaleChanges = false;

				if (this.selectedIndex >= 0 && this.dataProvider && this.selectedIndex < this.dataProvider.length)
					this.itemSelected(this.selectedIndex, true);
				else if (this.requireSelection)
					this._proposedSelectedIndex = 0;
				else
					this._setSelectedIndex(-1, false);
			}

			if (this.requireSelectionChanged){
				this.requireSelectionChanged = false;

				if (this.requireSelection &&
					this.selectedIndex == ListBase.NO_SELECTION &&
					this.dataProvider &&
					this.dataProvider.length > 0){
					this._proposedSelectedIndex = 0;
				}
			}

			if (this._pendingSelectedItem !== undefined){
				if (this.dataProvider)
					this._proposedSelectedIndex = this.dataProvider.getItemIndex(this._pendingSelectedItem);
				else
					this._proposedSelectedIndex = ListBase.NO_SELECTION;

				if (this._allowCustomSelectedItem && this._proposedSelectedIndex == -1){
					this._proposedSelectedIndex = ListBase.CUSTOM_SELECTED_ITEM;
					this._selectedItem = this._pendingSelectedItem;
				}

				this._pendingSelectedItem = undefined;
			}

			var changedSelection:boolean = false;
			if (this._proposedSelectedIndex != ListBase.NO_PROPOSED_SELECTION)
				changedSelection = this.commitSelection();

			if (this.selectedIndexAdjusted){
				this.selectedIndexAdjusted = false;
				if (!changedSelection){
                    UIEvent.dispatchUIEvent(this,UIEvent.VALUE_COMMIT);
				}
			}

			if (this.labelFieldOrFunctionChanged){
				if (this.dataGroup!=null){
					var itemIndex:number;

					if (this.layout && this.layout.useVirtualLayout){
                        var list:Array<number> = this.dataGroup.getElementIndicesInView();
                        var length:number = list.length;
						for (var i:number = 0;i<length;i++){
                            var itemIndex:number = list[i];
							this.updateRendererLabelProperty(itemIndex);
						}
					}
					else{
						var n:number = this.dataGroup.numElements;
						for (itemIndex = 0; itemIndex < n; itemIndex++){
							this.updateRendererLabelProperty(itemIndex);
						}
					}
				}

				this.labelFieldOrFunctionChanged = false;
			}
		}

		/**
		 *  更新项呈示器文字标签
		 */
		private updateRendererLabelProperty(itemIndex:number):void{
			var renderer:IItemRenderer = <IItemRenderer><any> (this.dataGroup.getElementAt(itemIndex));
			if (renderer)
				renderer.label = this.itemToLabel(renderer.data);
		}

		/**
		 * 添加外观部件时调用
		 * @method egret.gui.ListBase#partAdded
		 * @param partName {string}
		 * @param instance {any}
		 */
		public partAdded(partName:string, instance:any):void{
			super.partAdded(partName, instance);

			if (instance == this.dataGroup){
				if (this._useVirtualLayout && this.dataGroup.layout)
					this.dataGroup.layout.useVirtualLayout = true;

				this.dataGroup.addEventListener(
					RendererExistenceEvent.RENDERER_ADD, this.dataGroup_rendererAddHandler, this);
				this.dataGroup.addEventListener(
					RendererExistenceEvent.RENDERER_REMOVE, this.dataGroup_rendererRemoveHandler, this);
			}
		}

		/**
		 * 正删除外观部件的实例时调用
		 * @method egret.gui.ListBase#partRemoved
		 * @param partName {string}
		 * @param instance {any}
		 */
		public partRemoved(partName:string, instance:any):void{
			super.partRemoved(partName, instance);

			if (instance == this.dataGroup){
				this.dataGroup.removeEventListener(
					RendererExistenceEvent.RENDERER_ADD, this.dataGroup_rendererAddHandler, this);
				this.dataGroup.removeEventListener(
					RendererExistenceEvent.RENDERER_REMOVE, this.dataGroup_rendererRemoveHandler, this);
			}
		}

		/**
		 * 更新项呈示器,以备使用或重用
		 * @method egret.gui.ListBase#updateRenderer
		 * @param renderer {IItemRenderer}
		 * @param itemIndex {number}
		 * @param data {any}
		 * @returns {IItemRenderer}
		 */
		public updateRenderer(renderer:IItemRenderer, itemIndex:number, data:any):IItemRenderer{
			this.itemSelected(itemIndex, this._isItemIndexSelected(itemIndex));
			return super.updateRenderer(renderer, itemIndex, data);
		}

		/**
		 * 如果有一个数据项目,则返回呈示器应该显示的正确文本,同时将 labelField 和 labelFunction 属性考虑在内
		 * @method egret.gui.ListBase#itemToLabel
		 * @param item {any}
		 * @returns {string}
		 */
		public itemToLabel(item:any):string{
			if (this._labelFunction != null)
				return this._labelFunction(item);

			if (typeof(item) == "string")
				return <string> item;

			if (item instanceof XML){
				try{
					if (item[this.labelField].length() != 0)
						item = item[this.labelField];
				}
				catch(e){
				}
			}
			else if (item instanceof Object){
				try{
					if (item[this.labelField] != null)
						item = item[this.labelField];
				}
				catch(e){
				}
			}

			if (typeof(item) == "string")
				return <string> item;

			try{
				if (item !== null)
					return item.toString();
			}
			catch(e){
			}

			return " ";
		}

		/**
		 * 选中或取消选中项目时调用。子类必须覆盖此方法才可设置选中项。
		 * @method egret.gui.ListBase#itemSelected
		 * @param index {number} 已选中的项目索引。
		 * @param selected {boolean} true为选中,false取消选中
		 */
		public itemSelected(index:number, selected:boolean):void{
			if(!this.dataGroup)
				return;
			var renderer:IItemRenderer = <IItemRenderer><any> (this.dataGroup.getElementAt(index));
			if(renderer==null)
				return;
			renderer.selected = selected;
		}

		/**
		 * 返回指定索引是否等于当前选中索引
		 */
		public _isItemIndexSelected(index:number):boolean{
			return index == this.selectedIndex;
		}

		/**
		 * 提交选中项属性,返回是否成功提交,false表示被取消
		 * @method egret.gui.ListBase#commitSelection
		 * @param dispatchChangedEvents {boolean}
		 * @returns {boolean}
		 */
		public commitSelection(dispatchChangedEvents:boolean = true):boolean{
			var maxIndex:number = this.dataProvider ? this.dataProvider.length - 1 : -1;
			var oldSelectedIndex:number = this._selectedIndex;
			var e:IndexChangeEvent;

			if (!this._allowCustomSelectedItem || this._proposedSelectedIndex != ListBase.CUSTOM_SELECTED_ITEM){
				if (this._proposedSelectedIndex < ListBase.NO_SELECTION)
					this._proposedSelectedIndex = ListBase.NO_SELECTION;
				if (this._proposedSelectedIndex > maxIndex)
					this._proposedSelectedIndex = maxIndex;
				if (this.requireSelection && this._proposedSelectedIndex == ListBase.NO_SELECTION &&
					this.dataProvider && this.dataProvider.length > 0){
					this._proposedSelectedIndex = ListBase.NO_PROPOSED_SELECTION;
					this._dispatchChangeAfterSelection = false;
					return false;
				}
			}

			var tmpProposedIndex:number = this._proposedSelectedIndex;

			if (this._dispatchChangeAfterSelection){
                var result:boolean = IndexChangeEvent.dispatchIndexChangeEvent(this,
                    IndexChangeEvent.CHANGING,this._selectedIndex,this._proposedSelectedIndex,true);
				if (!result){
					this.itemSelected(this._proposedSelectedIndex, false);
					this._proposedSelectedIndex = ListBase.NO_PROPOSED_SELECTION;
					this._dispatchChangeAfterSelection = false;
					return false;
				}

			}

			this._selectedIndex = tmpProposedIndex;
			this._proposedSelectedIndex = ListBase.NO_PROPOSED_SELECTION;

			if (oldSelectedIndex != ListBase.NO_SELECTION)
				this.itemSelected(oldSelectedIndex, false);
			if (this._selectedIndex != ListBase.NO_SELECTION)
				this.itemSelected(this._selectedIndex, true);

			//子类若需要自身抛出Change事件,而不是在此处抛出,可以设置dispatchChangedEvents为false
			if (dispatchChangedEvents){
				if (this._dispatchChangeAfterSelection){
                    IndexChangeEvent.dispatchIndexChangeEvent(this,
                        IndexChangeEvent.CHANGE,oldSelectedIndex,this._selectedIndex);
					this._dispatchChangeAfterSelection = false;
				}
                UIEvent.dispatchUIEvent(this,UIEvent.VALUE_COMMIT);;
			}

			return true;
		}

		private selectedIndexAdjusted:boolean = false;
		/**
		 * 仅调整选中索引值而不更新选中项,即在提交属性阶段itemSelected方法不会被调用,也不会触发changing和change事件。
		 * @method egret.gui.ListBase#adjustSelection
		 * @param newIndex {number} 新索引。
		 * @param add {boolean} 如果已将项目添加到组件,则为 true;如果已删除项目,则为 false。
		 */
		public adjustSelection(newIndex:number, add:boolean=false):void{
			if (this._proposedSelectedIndex != ListBase.NO_PROPOSED_SELECTION)
				this._proposedSelectedIndex = newIndex;
			else
				this._selectedIndex = newIndex;
			this.selectedIndexAdjusted = true;
			this.invalidateProperties();
		}

		/**
		 * 数据项添加
		 * @method egret.gui.ListBase#itemAdded
		 * @param index {number}
		 */
		public itemAdded(index:number):void{
			if (this._doingWholesaleChanges)
				return;

			if (this.selectedIndex == ListBase.NO_SELECTION){
				if (this.requireSelection)
					this.adjustSelection(index,true);
			}
			else if (index <= this.selectedIndex){
				this.adjustSelection(this.selectedIndex + 1,true);
			}
		}

		/**
		 * 数据项移除
		 * @method egret.gui.ListBase#itemRemoved
		 * @param index {number}
		 */
		public itemRemoved(index:number):void{
			if (this.selectedIndex == ListBase.NO_SELECTION || this._doingWholesaleChanges)
				return;

			if (index == this.selectedIndex){
				if (this.requireSelection && this.dataProvider && this.dataProvider.length > 0){
					if (index == 0){
						this._proposedSelectedIndex = 0;
						this.invalidateProperties();
					}
					else
						this._setSelectedIndex(0, false);
				}
				else
					this.adjustSelection(-1,false);
			}
			else if (index < this.selectedIndex){
				this.adjustSelection(this.selectedIndex - 1,false);
			}
		}

		/**
		 * 项呈示器被添加
		 * @method egret.gui.ListBase#dataGroup_rendererAddHandler
		 * @param event {RendererExistenceEvent}
		 */
		public dataGroup_rendererAddHandler(event:RendererExistenceEvent):void{
			var renderer:DisplayObject = <DisplayObject><any> (event.renderer);

			if (renderer == null)
				return;

			renderer.addEventListener(TouchEvent.TOUCH_ROLL_OVER, this.item_mouseEventHandler, this);
			renderer.addEventListener(TouchEvent.TOUCH_ROLL_OUT, this.item_mouseEventHandler, this);
		}
		/**
		 * 项呈示器被移除
		 * @method egret.gui.ListBase#dataGroup_rendererRemoveHandler
		 * @param event {RendererExistenceEvent}
		 */
		public dataGroup_rendererRemoveHandler(event:RendererExistenceEvent):void{
			var renderer:DisplayObject = <DisplayObject> <any>(event.renderer);

			if (renderer == null)
				return;

			renderer.removeEventListener(TouchEvent.TOUCH_ROLL_OVER, this.item_mouseEventHandler, this);
			renderer.removeEventListener(TouchEvent.TOUCH_ROLL_OUT, this.item_mouseEventHandler, this);
		}

		private static TYPE_MAP:any = {rollOver:"itemRollOver",
			rollOut:"itemRollOut"};

		/**
		 * 项呈示器鼠标事件
		 */
		private item_mouseEventHandler(event:TouchEvent):void{
			var type:string = event.type;
			type = ListBase.TYPE_MAP[type];
			if (this.hasEventListener(type)){
				var itemRenderer:IItemRenderer = <IItemRenderer><any> (event.currentTarget);
				this._dispatchListEvent(event,type,itemRenderer);
			}
		}
		/**
		 * 抛出列表事件
		 * @method egret.gui.ListBase#_dispatchListEvent
		 * @param touchEvent {TouchEvent} 相关联的鼠标事件
		 * @param type {string} 事件名称
		 * @param itemRenderer {IItemRenderer} 关联的条目渲染器实例
		 */
		public _dispatchListEvent(touchEvent:TouchEvent,type:string,itemRenderer:IItemRenderer):void{
			var itemIndex:number = -1;
			if (itemRenderer)
				itemIndex = itemRenderer.itemIndex;
			else
				itemIndex = this.dataGroup.getElementIndex(<IVisualElement> (touchEvent.currentTarget));

            var item:any = this.dataProvider.getItemAt(itemIndex);
            ListEvent.dispatchListEvent(this,
                type,touchEvent,itemIndex,item,itemRenderer);
		}

		/**
		 * 数据源发生改变
		 * @method egret.gui.ListBase#dataProvider_collectionChangeHandler
		 * @param event {CollectionEvent}
		 */
		public dataProvider_collectionChangeHandler(event:CollectionEvent):void{
			var items:Array<any> = event.items;
			if (event.kind == CollectionEventKind.ADD){
				var length:number = items.length;
				for (var i:number = 0; i < length; i++){
					this.itemAdded(event.location + i);
				}
			}
			else if (event.kind == CollectionEventKind.REMOVE){
				length = items.length;
				for (i = length-1; i >= 0; i--){
					this.itemRemoved(event.location + i);
				}
			}
			else if (event.kind == CollectionEventKind.MOVE){
				this.itemRemoved(event.oldLocation);
				this.itemAdded(event.location);
			}
			else if (event.kind == CollectionEventKind.RESET){
				if (this.dataProvider.length == 0){
					this._setSelectedIndex(ListBase.NO_SELECTION, false);
				}
				else{
					this.dataProviderChanged = true;
					this.invalidateProperties();
				}
			}
			else if (event.kind == CollectionEventKind.REFRESH){
				this.dataProviderRefreshed();
			}
		}

		/**
		 * 数据源刷新
		 */
		public dataProviderRefreshed():void{
			this._setSelectedIndex(ListBase.NO_SELECTION, false);
		}
	}
}


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

namespace GoogleMeasurementProtocol.Parameters.Timing
{
   /// <summary>
    /// Specifies the time it took for a page to load. The value is in milliseconds.
   /// </summary>
    public class PageLoadTime : Parameter
    {
        public PageLoadTime(int value)
            : base(value)
        {
        }

        public override string Name
        {
            get { return "plt"; }
        }

        public override List<string> SupportedHitTypes
        {
            get { return new List<string> { HitTypes.Timing }; }
        }

        public override Type ValueType
        {
            get { return typeof(int); }
        }
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Webharvest script used to read articles from archive.

  IPFW News Paper - The Communicator
  http://archive.org/search.php?query=%28collection%3Aindianapurduefortwaynestudentnewspaper%20OR%20mediatype%3Aindianapurduefortwaynestudentnewspaper%29%20AND%20-mediatype%3Acollection&sort=-downloads
-->
<config>
	<var-def name="pageUrl">http://archive.org/search.php?query=%28collection%3Aindianapurduefortwaynestudentnewspaper%20OR%20mediatype%3Aindianapurduefortwaynestudentnewspaper%29%20AND%20-mediatype%3Acollection&sort=-downloads&page=</var-def>
	<loop item="page" index="i">
	    <list>
	        <tokenize delimiters=",">1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25</tokenize>
	    </list>
	    <body>
	        <loop item="link" index="i" filter="unique">
			    <list>
			        <xpath expression="//a/@href">
			            <html-to-xml>
			                <http url="${pageUrl}${page}"/>
			            </html-to-xml>
			        </xpath>
			    </list>
			    <body>
				    <case>
				        <if condition='${link.toString().startsWith("/details/communicator")}'>
				            <file action="append" type="text" path="C:/Projects/communicator/communicator-links.txt">
					            <template>http://archive.org${link}${sys.cr}${sys.lf}</template>
					        </file>
				        </if>
				    </case>
			    </body>
			</loop>
	    </body>
	</loop>
</config>


text:
"use strict";
import { combineReducers } from 'redux';

import ActiveSurvey from './activeSurvey/Survey';
import Promocode from './Promocode';

export default combineReducers({
    Promocode,
    ActiveSurvey
});


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

<title>Serialized Form</title>
<meta name="date" content="2017-03-29">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Serialized Form

Package ev3dev.sensors.slamtec

Class ev3dev.sensors.slamtec.RPLidarA1ServiceException extends java.lang.Exception implements Serializable

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes


text:
class UserSerializer < ActiveModel::Serializer
  embed :ids

  attributes :id, :username
end


text:
package org.tools.javaparser;

import com.sun.source.tree.*;
import com.sun.source.util.TreeScanner;

import java.util.List;

public class SourceVisitor extends TreeScanner<Void, Void> {

    private JavaSourceObject javaSourceObject;

    public SourceVisitor() {
        javaSourceObject = new JavaSourceObject();
    }

    public JavaSourceObject getJavaSourceObject() {
        return javaSourceObject;
    }

    @Override
    public Void visitCompilationUnit(CompilationUnitTree node, Void aVoid) {
        javaSourceObject.setPath(node.getSourceFile().getName());
        return super.visitCompilationUnit(node, aVoid);
    }

    @Override
    public Void visitClass(ClassTree node, Void aVoid) {
        formatPtrln("\nvisitClass      class: %s", node.getSimpleName());
        javaSourceObject.setName(node.getSimpleName().toString());
        javaSourceObject.addNode(JavaSourceNode.NodeType.TYPE_CLASS, node.getSimpleName().toString());
        return super.visitClass(node, aVoid);
    }

    @Override
    public Void visitVariable(VariableTree node, Void aVoid) {
        formatPtrln("\nvisitVariable   variable: %s, type: %s, kind: %s", node.getName(), node.getType(), node.getKind());
        formatPtrln("                   value: %s", node.getInitializer());
        javaSourceObject.addNode(JavaSourceNode.NodeType.TYPE_VARIABLE, node.getName().toString());
        if (node.getInitializer() != null) {
            javaSourceObject.getCurrentNode().setExpression(node.getKind().name(), node.getType().toString(), node.getInitializer().toString());
        }
        return super.visitVariable(node, aVoid);
    }

    @Override
    public Void visitMethod(MethodTree node, Void aVoid) {
        formatPtrln("\nvisitMethod     method: %s", node.getName());
        javaSourceObject.addNode(JavaSourceNode.NodeType.TYPE_METHOD, node.getName().toString());
        return super.visitMethod(node, aVoid);
    }

    @Override
    public Void visitAnnotation(AnnotationTree node, Void aVoid) {

        formatPtrln("visitAnnotation annotation: %s", node.getAnnotationType());
        javaSourceObject.getCurrentNode().addAnnotation("@"+node.getAnnotationType().toString());

        List<? extends ExpressionTree> expressions = node.getArguments();
        for (ExpressionTree expression : expressions) {
            Tree.Kind kind = expression.getKind();
            formatPtrln("                    expression: %s", expression.toString());
            formatPtrln("                          kind: %s", expression.getKind());
            javaSourceObject.getCurrentNode().getCurrentAnnotation().addExpression(new JavaSourceExpression(expression.getKind().name(), null, expression.toString()));
        }

        return super.visitAnnotation(node, aVoid);
    }

    public void formatPtrln(String format, Object... args) {
        // System.out.println(String.format(format, args));
    }
}


text:
<?php

namespace yii\amqp\exceptions\client;

/**
 * Class ConnectionException
 *
 * @package yii\amqp\exceptions
 */
class ConnectionException extends AmqpException
{
}


text:
class SinatraHealthCheck::Checker

  DEFAULT_OPTS = {
    :aggregator => SinatraHealthCheck::Status::StrictAggregator.new,
    :exit       => true,
    :health     => true,
    :logger     => nil,
    :signals    => %w[TERM INT],
    :systems    => {},
    :timeout    => 10,
    :wait       => 0,
  }

  require 'thread'

  attr_accessor :health
  attr_reader :systems

  # Create a health checker.
  # Params:
  # ++aggrgator++: an aggregator for substatuus, default: StrictAggregator
  # ++exit++: call ++exit++ at the end of ++graceful_stop++
  # ++health++: initial health state
  # ++logger++: a logger
  # ++signals++: array of signals to register a graceful stop handler
  # ++systems++: a hash of subsystems responding to .status
  # ++timeout++: timeout for graceful stop in seconds
  # ++wait++: wait before setting health to unhealthy
  def initialize(opts = {})
    @opts = DEFAULT_OPTS.merge(opts)
    @aggregator = SinatraHealthCheck::Status::OverwritingAggregator.new(@opts[:aggregator])
    @health = @opts[:health]
    @systems = @opts[:systems]
    trap(@opts[:signals])
  end

  # Set application to unhealthy state and stop it after wating for ++@timeout++.
  def graceful_stop
    # set to unhealthy state
    unless @stopper
      # spawn a thread to stop application after a given time
      @stopper = Thread.new do
        if @opts[:wait] > 0
          logger.info "asked to stop application, waiting for #{@opts[:wait]}s before doing so" if logger
          sleep @opts[:wait]
        end
        logger.info "stopping application, waiting for #{@opts[:timeout]}s" if logger
        @health = false
        sleep @opts[:timeout]
        logger.info "exit application" if logger
        exit if @opts[:exit]
      end
    end
  end

  # Waits for the stopping thread to finish
  def join
    @stopper.join if @stopper
  end

  # Returns a Status object
  def status
    statuus = {}
    systems.each { |k,v| statuus[k] = v.status if v.respond_to?(:status) }
    @aggregator.aggregate(statuus, health ? nil : SinatraHealthCheck::Status.new(:error, 'app is unhealthy'))
  end

  def healthy?
    status.level != :error
  end

  private

  def logger
    @opts[:logger]
  end

  # Register signal handler to stop application gracefully.
  # Params:
  # ++signals++: array of signal names
  def trap(signals)
    if signals and signals.size > 0
      logger.info "register graceful stop handler for signals: #{signals.join(', ')}" if logger
      signals.each do |sig|
        Signal.trap(sig) { graceful_stop }
      end
    end
  end
end


text:
module ag.grid {

    var utils = Utils;

    export class HeaderRenderer {

        private headerTemplateLoader: HeaderTemplateLoader;
        private gridOptionsWrapper: GridOptionsWrapper;
        private columnController: ColumnController;
        private angularGrid: Grid;
        private filterManager: FilterManager;
        private $scope: any;
        private $compile: any;
        private ePinnedLeftHeader: HTMLElement;
        private ePinnedRightHeader: HTMLElement;
        private eHeaderContainer: HTMLElement;
        private eHeaderViewport: HTMLElement;
        private eRoot: HTMLElement;

        private headerElements: RenderedHeaderElement[] = [];

        public init(gridOptionsWrapper: GridOptionsWrapper, columnController: ColumnController, gridPanel: GridPanel,
                    angularGrid: Grid, filterManager: FilterManager, $scope: any, $compile: any,
                    headerTemplateLoader: HeaderTemplateLoader) {
            this.gridOptionsWrapper = gridOptionsWrapper;
            this.columnController = columnController;
            this.angularGrid = angularGrid;
            this.filterManager = filterManager;
            this.$scope = $scope;
            this.$compile = $compile;
            this.headerTemplateLoader = headerTemplateLoader;
            this.findAllElements(gridPanel);
        }

        private findAllElements(gridPanel: GridPanel) {
            this.ePinnedLeftHeader = gridPanel.getPinnedLeftHeader();
            this.ePinnedRightHeader = gridPanel.getPinnedRightHeader();
            this.eHeaderContainer = gridPanel.getHeaderContainer();
            this.eHeaderViewport = gridPanel.getHeaderViewport();
            this.eRoot = gridPanel.getRoot();
        }

        public refreshHeader() {
            utils.removeAllChildren(this.ePinnedLeftHeader);
            utils.removeAllChildren(this.ePinnedRightHeader);
            utils.removeAllChildren(this.eHeaderContainer);

            this.headerElements.forEach( (headerElement: RenderedHeaderElement) => {
                headerElement.destroy();
            });
            this.headerElements = [];

            this.insertHeaderRowsIntoContainer(this.columnController.getLeftDisplayedColumnGroups(), this.ePinnedLeftHeader);
            this.insertHeaderRowsIntoContainer(this.columnController.getRightDisplayedColumnGroups(), this.ePinnedRightHeader);
            this.insertHeaderRowsIntoContainer(this.columnController.getCenterDisplayedColumnGroups(), this.eHeaderContainer);
        }

        private addTreeNodesAtDept(cellTree: ColumnGroupChild[], dept: number, result: ColumnGroupChild[]): void {
            cellTree.forEach( (abstractColumn) => {
                if (dept===0) {
                    result.push(abstractColumn);
                } else if (abstractColumn instanceof ColumnGroup) {
                    var columnGroup = <ColumnGroup> abstractColumn;
                    this.addTreeNodesAtDept(columnGroup.getDisplayedChildren(), dept-1, result);
                } else {
                    // we are looking for children past a column, so have come to the end,
                    // do nothing, and because the tree is balanced, the result of this recursion
                    // will be an empty list.
                }
            });
        }

        public setPinnedColContainerWidth() {
            if (this.gridOptionsWrapper.isForPrint()) {
                // pinned col doesn't exist when doing forPrint
                return;
            }

            var pinnedLeftWidth = this.columnController.getPinnedLeftContainerWidth() + 'px';
            this.eHeaderViewport.style.marginLeft = pinnedLeftWidth;

            var pinnedRightWidth = this.columnController.getPinnedRightContainerWidth() + 'px';
            this.eHeaderViewport.style.marginRight = pinnedRightWidth;
        }

        private insertHeaderRowsIntoContainer(cellTree: ColumnGroupChild[], eContainerToAddTo: HTMLElement): void {

            // if we are displaying header groups, then we have many rows here.
            // go through each row of the header, one by one.
            for (var dept = 0; ; dept++) {

                var nodesAtDept: ColumnGroupChild[] = [];
                this.addTreeNodesAtDept(cellTree, dept, nodesAtDept);

                // we want to break the for loop when we get to an empty set of cells,
                // that's how we know we have finished rendering the last row.
                if (nodesAtDept.length===0) {
                    break;
                }

                var eRow: HTMLElement = document.createElement('div');
                eRow.className = 'ag-header-row';
                eRow.style.top = (dept * this.gridOptionsWrapper.getHeaderHeight()) + 'px';
                eRow.style.height = this.gridOptionsWrapper.getHeaderHeight() + 'px';

                nodesAtDept.forEach( (child: ColumnGroupChild) => {
                    var renderedHeaderElement = this.createHeaderElement(child);
                    this.headerElements.push(renderedHeaderElement);
                    eRow.appendChild(renderedHeaderElement.getGui());
                });

                eContainerToAddTo.appendChild(eRow);
            }
        }

        private createHeaderElement(columnGroupChild: ColumnGroupChild): RenderedHeaderElement {
            if (columnGroupChild instanceof ColumnGroup) {
                return new RenderedHeaderGroupCell(<ColumnGroup> columnGroupChild, this.gridOptionsWrapper,
                    this.columnController, this.eRoot, this.angularGrid, this.$scope,
                    this.filterManager, this.$compile);
            } else {
                return new RenderedHeaderCell(<Column> columnGroupChild, null, this.gridOptionsWrapper,
                    this.$scope, this.filterManager, this.columnController, this.$compile,
                    this.angularGrid, this.eRoot, this.headerTemplateLoader);
            }
        }

        public updateSortIcons() {
            this.headerElements.forEach( (headerElement: RenderedHeaderElement) => {
                headerElement.refreshSortIcon();
            });
        }

        public updateFilterIcons() {
            this.headerElements.forEach( (headerElement: RenderedHeaderElement) => {
                headerElement.refreshFilterIcon();
            });
        }

        public onIndividualColumnResized(column: Column): void {
            this.headerElements.forEach( (headerElement: RenderedHeaderElement) => {
                headerElement.onIndividualColumnResized(column);
            });
        }
    }
}


text: cuevasocial-mobile


text:
class CQuasarGame : public CQuasarBaseGame
{
    public:

        //
        // Constructor for this game.
        //

        static IGame* createInstanceSet1(
        );

        static IGame* createInstanceSet2(
        );

        static IGame* createInstanceSet3(
        );

        //
        // IGame Interface - wholly implemented in the Base game.
        //
    private:

        //
        // Different ROM sets supplied.
        //
        CQuasarGame(
            const ROM_REGION *romRegion
        );

};

#endif