text:
package com.amazonaws.services.route53.model;

import java.io.Serializable;
import javax.annotation.Generated;

/**
 *

 * A complex type that contains the response to a GetHealthCheckLastFailureReason request.
 *

 *
 * @see AWS API Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class GetHealthCheckLastFailureReasonResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable,
        Cloneable {

    /**
     *

     * A list that contains one Observation element for each Amazon Route 53 health checker that is
     * reporting a last failure reason.
     *

     */
    private com.amazonaws.internal.SdkInternalList<HealthCheckObservation> healthCheckObservations;

    /**
     *

     * A list that contains one Observation element for each Amazon Route 53 health checker that is
     * reporting a last failure reason.
     *

     *
     * @return A list that contains one Observation element for each Amazon Route 53 health checker that is
     *         reporting a last failure reason.
     */

    public java.util.List<HealthCheckObservation> getHealthCheckObservations() {
        if (healthCheckObservations == null) {
            healthCheckObservations = new com.amazonaws.internal.SdkInternalList<HealthCheckObservation>();
        }
        return healthCheckObservations;
    }

    /**
     *

     * A list that contains one Observation element for each Amazon Route 53 health checker that is
     * reporting a last failure reason.
     *

     *
     * @param healthCheckObservations
     *        A list that contains one Observation element for each Amazon Route 53 health checker that is
     *        reporting a last failure reason.
     */

    public void setHealthCheckObservations(java.util.Collection<HealthCheckObservation> healthCheckObservations) {
        if (healthCheckObservations == null) {
            this.healthCheckObservations = null;
            return;
        }

        this.healthCheckObservations = new com.amazonaws.internal.SdkInternalList<HealthCheckObservation>(healthCheckObservations);
    }

    /**
     *

     * A list that contains one Observation element for each Amazon Route 53 health checker that is
     * reporting a last failure reason.
     *

     *

     * NOTE: This method appends the values to the existing list (if any). Use
     * {@link #setHealthCheckObservations(java.util.Collection)} or
     * {@link #withHealthCheckObservations(java.util.Collection)} if you want to override the existing values.
     *

     *
     * @param healthCheckObservations
     *        A list that contains one Observation element for each Amazon Route 53 health checker that is
     *        reporting a last failure reason.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public GetHealthCheckLastFailureReasonResult withHealthCheckObservations(HealthCheckObservation... healthCheckObservations) {
        if (this.healthCheckObservations == null) {
            setHealthCheckObservations(new com.amazonaws.internal.SdkInternalList<HealthCheckObservation>(healthCheckObservations.length));
        }
        for (HealthCheckObservation ele : healthCheckObservations) {
            this.healthCheckObservations.add(ele);
        }
        return this;
    }

    /**
     *

     * A list that contains one Observation element for each Amazon Route 53 health checker that is
     * reporting a last failure reason.
     *

     *
     * @param healthCheckObservations
     *        A list that contains one Observation element for each Amazon Route 53 health checker that is
     *        reporting a last failure reason.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public GetHealthCheckLastFailureReasonResult withHealthCheckObservations(java.util.Collection<HealthCheckObservation> healthCheckObservations) {
        setHealthCheckObservations(healthCheckObservations);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getHealthCheckObservations() != null)
            sb.append("HealthCheckObservations: ").append(getHealthCheckObservations());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof GetHealthCheckLastFailureReasonResult == false)
            return false;
        GetHealthCheckLastFailureReasonResult other = (GetHealthCheckLastFailureReasonResult) obj;
        if (other.getHealthCheckObservations() == null ^ this.getHealthCheckObservations() == null)
            return false;
        if (other.getHealthCheckObservations() != null && other.getHealthCheckObservations().equals(this.getHealthCheckObservations()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getHealthCheckObservations() == null) ? 0 : getHealthCheckObservations().hashCode());
        return hashCode;
    }

    @Override
    public GetHealthCheckLastFailureReasonResult clone() {
        try {
            return (GetHealthCheckLastFailureReasonResult) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

}


text:
import unittest
import os.path

from IECore import *

class TestCamera( unittest.TestCase ) :

	def test( self ) :

		c = Camera()
		self.assertEqual( c.getName(), "default" )
		self.assertEqual( c.getTransform(), None )
		self.assertEqual( c.parameters(), CompoundData() )

		cc = c.copy()
		self.assertEqual( cc.getName(), "default" )
		self.assertEqual( cc.getTransform(), None )
		self.assertEqual( cc.parameters(), CompoundData() )
		self.assertEqual( cc, c )

		Writer.create( cc, "test/IECore/data/camera.cob" ).write()
		ccc = Reader.create( "test/IECore/data/camera.cob" ).read()

		self.assertEqual( c, ccc )

		c.setName( "n" )
		self.assertEqual( c.getName(), "n" )

		c.setTransform( MatrixTransform( M44f.createScaled( V3f( 2 ) ) ) )
		self.assertEqual( c.getTransform(), MatrixTransform( M44f.createScaled( V3f( 2 ) ) ) )

		c.parameters()["fov"] = FloatData( 45 )
		self.assertEqual( c.parameters()["fov"], FloatData( 45 ) )

		# test copying and saving with some parameters and a transform
		cc = c.copy()
		self.assertEqual( cc, c )

		Writer.create( cc, "test/IECore/data/camera.cob" ).write()
		ccc = Reader.create( "test/IECore/data/camera.cob" ).read()
		self.assertEqual( ccc, c )

	def testAddStandardParameters( self ) :

		c = Camera()
		c.addStandardParameters()

		self.assertEqual( c.parameters()["resolution"].value, V2i( 640, 480 ) )
		self.assertEqual( c.parameters()["pixelAspectRatio"].value, 1.0 )
		aspectRatio = 640.0/480.0
		self.assertEqual( c.parameters()["screenWindow"].value, Box2f( V2f( -aspectRatio, -1 ), V2f( aspectRatio, 1 ) ) )

		self.assertEqual( c.parameters()["cropWindow"].value, Box2f( V2f( 0, 0 ), V2f( 1, 1 ) ) )
		self.assertEqual( c.parameters()["projection"].value, "orthographic" )
		self.assertEqual( c.parameters()["clippingPlanes"].value, V2f( 0.01, 100000 ) )
		self.assertEqual( c.parameters()["shutter"].value, V2f( 0 ) )

		c = Camera()
		c.parameters()["projection"] = StringData( "perspective" )
		c.parameters()["resolution"] = V2iData( V2i( 500, 1000 ) )
		c.parameters()["cropWindow"] = Box2fData( Box2f( V2f( 0.1 ), V2f( 0.9 ) ) )
		c.parameters()["clippingPlanes"] = V2fData( V2f( 1, 1000 ) )
		c.parameters()["shutter"] = V2fData( V2f( 1, 2 ) )
		c.addStandardParameters()
		self.assertEqual( c.parameters()["resolution"].value, V2i( 500, 1000 ) )
		self.assertEqual( c.parameters()["screenWindow"].value, Box2f( V2f( -1, -2 ), V2f( 1, 2 ) ) )
		self.assertEqual( c.parameters()["cropWindow"].value, Box2f( V2f( 0.1 ), V2f( 0.9 ) ) )
		self.assertEqual( c.parameters()["projection"].value, "perspective" )
		self.assertEqual( c.parameters()["projection:fov"].value, 90 )
		self.assertEqual( c.parameters()["clippingPlanes"].value, V2f( 1, 1000 ) )
		self.assertEqual( c.parameters()["shutter"].value, V2f( 1, 2 ) )

		# Negative clip planes on ortho cameras should be supported
		c = Camera()
		c.parameters()["clippingPlanes"] = V2fData( V2f( -1000, 1000 ) )
		c.addStandardParameters()
		self.assertEqual( c.parameters()["clippingPlanes"].value, V2f( -1000, 1000 ) )

	def testHash( self ) :

		c = Camera()
		h = c.hash()

		c.setName( "summink" )
		self.assertNotEqual( c.hash(), h )
		h = c.hash()

		c.setTransform( MatrixTransform( M44f() ) )
		self.assertNotEqual( c.hash(), h )
		h = c.hash()

		c.addStandardParameters()
		self.assertNotEqual( c.hash(), h )

	def testAddStandardParametersWithNonSquarePixels( self ) :

		c = Camera()
		c.parameters()["resolution"] = V2i( 100, 200 )
		c.parameters()["pixelAspectRatio"] = 2.0

		c.addStandardParameters()
		self.assertEqual( c.parameters()["screenWindow"].value, Box2f( V2f( -1 ), V2f( 1 ) ) )

	def tearDown( self ) :

		if os.path.isfile( "test/IECore/data/camera.cob" ) :
			os.remove( "test/IECore/data/camera.cob" )

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

redpajama_set_name: RedPajamaGithub


text:
// <copyright file="StringFunctions.cs" company="Peter Ibbotson">
// (C) Copyright 2017 Peter Ibbotson
// </copyright>
namespace ClassicBasic.Test.FunctionTests
{
    using System.Collections.Generic;
    using System.Linq;
    using ClassicBasic.Interpreter;
    using ClassicBasic.Interpreter.Exceptions;
    using ClassicBasic.Interpreter.Functions;
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    /// <summary>
    /// Test class for the string functions.
    /// </summary>
    [TestClass]
    public class StringFunctions
    {
        /// <summary>
        /// Test MID$ needs two or three parameters.
        /// </summary>
        /// <param name="count">Count of parameters to pass</param>
        /// <param name="throwsException">True if exception thrown.</param>
        [DataTestMethod]
        [DataRow(0, true)]
        [DataRow(1, true)]
        [DataRow(2, false)]
        [DataRow(3, false)]
        [DataRow(4, true)]
        public void StringTestMidDollarNeedsTwoParameters(int count, bool throwsException)
        {
            var sut = new MidDollar();

            var parameters = new List<Accumulator>
            {
                new Accumulator("ABCDEF"),
                new Accumulator(3.0),
                new Accumulator(2.0),
                new Accumulator(3.0)
            };

            var result = Test.Throws<SyntaxErrorException, Accumulator>(
                () => sut.Execute(parameters.Take(count).ToArray()),
                throwsException);
        }

        /// <summary>
        /// Test MID$ with various parameters.
        /// </summary>
        /// <param name="parameter1">First parameter.</param>
        /// <param name="parameter2">Second parameter.</param>
        /// <param name="parameter3">Third parameter (or null if missing).</param>
        /// <param name="expectedResult">Expected result.</param>
        /// <param name="throwsIllegalQuantity">Throws illegal quantity exception.</param>
        /// <param name="throwsTypeMismatch">Throws type mismatch exception.</param>
        [DataTestMethod]
        [DataRow("", 1.0, 1.0, "", false, false)]
        [DataRow("ABCDEF", 1.0, 3.0, "ABC", false, false)]
        [DataRow("ABCDEF", 2.0, 3.0, "BCD", false, false)]
        [DataRow("ABCDEF", 6.0, 1.0, "F", false, false)]
        [DataRow("ABCDEF", 7.0, 1.0, "", false, false)]
        [DataRow("ABCDEF", 2.0, null, "BCDEF", false, false)]
        [DataRow("ABCDEF", 6.0, null, "F", false, false)]
        [DataRow("ABCDEF", 7.0, null, "", false, false)]
        [DataRow("ABCDEF", 0.0, 1.0, "", true, false)]
        [DataRow("ABCDEF", 255.0, 1.0, "", false, false)]
        [DataRow("ABCDEF", 256.0, 1.0, "", true, false)]
        [DataRow("ABCDEF", 2.0, -1.0, "", true, false)]
        [DataRow("ABCDEF", 2.0, 0.0, "", false, false)]
        [DataRow("ABCDEF", 2.0, 255.0, "BCDEF", false, false)]
        [DataRow("ABCDEF", 2.0, 256.0, "", true, false)]
        [DataRow(1.0, 0.0, 2.2, "", false, true)]
        [DataRow("", "", 2.2, "", false, true)]
        [DataRow("", 0.0, "", "", false, true)]
        public void StringTestMidDollar(
            object parameter1,
            object parameter2,
            object parameter3,
            string expectedResult,
            bool throwsIllegalQuantity,
            bool throwsTypeMismatch)
        {
            var mismatchTypeExceptionThrown = false;
            var illegalQuantExceptionThrown = false;
            var sut = new MidDollar();
            string result;

            try
            {
                var parameters = new List<Accumulator> { new Accumulator(parameter1), new Accumulator(parameter2) };
                if (parameter3 != null)
                {
                    parameters.Add(new Accumulator(parameter3));
                }

                result = sut.Execute(parameters).ValueAsString();
                Assert.AreEqual(expectedResult, result);
            }
            catch (ClassicBasic.Interpreter.Exceptions.IllegalQuantityException)
            {
                illegalQuantExceptionThrown = true;
            }
            catch (ClassicBasic.Interpreter.Exceptions.TypeMismatchException)
            {
                mismatchTypeExceptionThrown = true;
            }

            Assert.AreEqual(throwsIllegalQuantity, illegalQuantExceptionThrown, "Illegal quant");
            Assert.AreEqual(throwsTypeMismatch, mismatchTypeExceptionThrown, "Mismatch");
        }

        /// <summary>
        /// Test LEFT$ needs two parameters.
        /// </summary>
        /// <param name="count">Count of parameters to pass</param>
        /// <param name="throwsException">True if exception thrown.</param>
        [DataTestMethod]
        [DataRow(0, true)]
        [DataRow(1, true)]
        [DataRow(2, false)]
        [DataRow(3, true)]
        public void StringTestLeftDollarNeedsTwoParameters(int count, bool throwsException)
        {
            var sut = new LeftDollar();

            var parameters = new List<Accumulator>
            {
                new Accumulator("ABCDEF"),
                new Accumulator(3.0),
                new Accumulator(2.0),
                new Accumulator(3.0)
            };

            var result = Test.Throws<SyntaxErrorException, Accumulator>(
                () => sut.Execute(parameters.Take(count).ToArray()),
                throwsException);
        }

        /// <summary>
        /// Test LEFT$ with various parameters.
        /// </summary>
        /// <param name="parameter1">First parameter.</param>
        /// <param name="parameter2">Second parameter.</param>
        /// <param name="expectedResult">Expected result.</param>
        /// <param name="throwsIllegalQuantity">Throws illegal quantity exception.</param>
        /// <param name="throwsTypeMismatch">Throws type mismatch exception.</param>
        [DataTestMethod]
        [DataRow("", 1.0, "", false, false)]
        [DataRow("ABCDEF", 1.0, "A", false, false)]
        [DataRow("ABCDEF", 2.0, "AB", false, false)]
        [DataRow("ABCDEF", 6.0, "ABCDEF", false, false)]
        [DataRow("ABCDEF", 7.0, "ABCDEF", false, false)]
        [DataRow("ABCDEF", 0.0, "ABCDEF", true, false)]
        [DataRow("ABCDEF", 255.0, "ABCDEF", false, false)]
        [DataRow("ABCDEF", 256.0, "ABCDEF", true, false)]
        [DataRow(0.0, 2.2, "ABCDEF", false, true)]
        [DataRow("A", "ABCDEF", "ABCDEF", false, true)]
        public void StringTestLeftDollar(object parameter1, object parameter2, string expectedResult, bool throwsIllegalQuantity, bool throwsTypeMismatch)
        {
            var mismatchTypeExceptionThrown = false;
            var illegalQuantExceptionThrown = false;
            var sut = new LeftDollar();
            string result;

            try
            {
                result = sut.Execute(new List<Accumulator> { new Accumulator(parameter1), new Accumulator(parameter2) })
                    .ValueAsString();
                Assert.AreEqual(expectedResult, result);
            }
            catch (ClassicBasic.Interpreter.Exceptions.IllegalQuantityException)
            {
                illegalQuantExceptionThrown = true;
            }
            catch (ClassicBasic.Interpreter.Exceptions.TypeMismatchException)
            {
                mismatchTypeExceptionThrown = true;
            }

            Assert.AreEqual(throwsIllegalQuantity, illegalQuantExceptionThrown, "Illegal quant");
            Assert.AreEqual(throwsTypeMismatch, mismatchTypeExceptionThrown, "Mismatch");
        }

        /// <summary>
        /// Test RIGHT$ needs two parameters.
        /// </summary>
        /// <param name="count">Count of parameters to pass</param>
        /// <param name="throwsException">True if exception thrown.</param>
        [DataTestMethod]
        [DataRow(0, true)]
        [DataRow(1, true)]
        [DataRow(2, false)]
        [DataRow(3, true)]
        public void StringTestRightDollarNeedsTwoParameters(int count, bool throwsException)
        {
            var sut = new RightDollar();

            var parameters = new List<Accumulator>
            {
                new Accumulator("ABCDEF"),
                new Accumulator(3.0),
                new Accumulator(2.0),
                new Accumulator(3.0)
            };

            var result = Test.Throws<SyntaxErrorException, Accumulator>(
                () => sut.Execute(parameters.Take(count).ToArray()),
                throwsException);
        }

        /// <summary>
        /// Test RIGHT$ with various parameters.
        /// </summary>
        /// <param name="parameter1">First parameter.</param>
        /// <param name="parameter2">Second parameter.</param>
        /// <param name="expectedResult">Expected result.</param>
        /// <param name="throwsIllegalQuantity">Throws illegal quantity exception.</param>
        /// <param name="throwsTypeMismatch">Throws type mismatch exception.</param>
        [DataTestMethod]
        [DataRow("", 1.0, "", false, false)]
        [DataRow("ABCDEF", 1.0, "F", false, false)]
        [DataRow("ABCDEF", 2.0, "EF", false, false)]
        [DataRow("ABCDEF", 6.0, "ABCDEF", false, false)]
        [DataRow("ABCDEF", 7.0, "ABCDEF", false, false)]
        [DataRow("ABCDEF", 0.0, "ABCDEF", true, false)]
        [DataRow("ABCDEF", 255.0, "ABCDEF", false, false)]
        [DataRow("ABCDEF", 256.0, "ABCDEF", true, false)]
        [DataRow(0.0, 2.2, "ABCDEF", false, true)]
        [DataRow("A", "ABCDEF", "ABCDEF", false, true)]
        public void StringTestRightDollar(object parameter1, object parameter2, string expectedResult, bool throwsIllegalQuantity, bool throwsTypeMismatch)
        {
            var mismatchTypeExceptionThrown = false;
            var illegalQuantExceptionThrown = false;
            var sut = new RightDollar();
            string result;

            try
            {
                result = sut.Execute(new List<Accumulator> { new Accumulator(parameter1), new Accumulator(parameter2) })
                    .ValueAsString();
                Assert.AreEqual(expectedResult, result);
            }
            catch (ClassicBasic.Interpreter.Exceptions.IllegalQuantityException)
            {
                illegalQuantExceptionThrown = true;
            }
            catch (ClassicBasic.Interpreter.Exceptions.TypeMismatchException)
            {
                mismatchTypeExceptionThrown = true;
            }

            Assert.AreEqual(throwsIllegalQuantity, illegalQuantExceptionThrown, "Illegal quant");
            Assert.AreEqual(throwsTypeMismatch, mismatchTypeExceptionThrown, "Mismatch");
        }

        /// <summary>
        /// Test Char dollar needs one parameter.
        /// </summary>
        /// <param name="count">Count of parameters to pass</param>
        /// <param name="throwsException">True if exception thrown.</param>
        [DataTestMethod]
        [DataRow(0, true)]
        [DataRow(1, false)]
        [DataRow(2, true)]
        public void StringTestCharDollarNeedsOneParameter(int count, bool throwsException)
        {
            var sut = new CharDollar();

            var parameters = new List<Accumulator> { };
            for (int i = 0; i < count; i++)
            {
                parameters.Add(new Accumulator(3.0));
            }

            var result = Test.Throws<SyntaxErrorException, Accumulator>(
                () => sut.Execute(parameters),
                throwsException);
        }

        /// <summary>
        /// Test CHR$ with various parameters.
        /// </summary>
        /// <param name="parameter">Parameter to function.</param>
        /// <param name="expectedResult">Expected result.</param>
        /// <param name="throwsIllegalQuantity">Throws illegal quantity exception.</param>
        /// <param name="throwsTypeMismatch">Throws type mismatch exception.</param>
        [DataTestMethod]
        [DataRow(32.0, " ", false, false)]
        [DataRow(65.0, "A", false, false)]
        [DataRow(short.MaxValue, "翿", false, false)]
        [DataRow(short.MinValue, "耀", false, false)]
        [DataRow(-1.0 + short.MinValue, "", true, false)]
        [DataRow(1.0 + short.MaxValue, "", true, false)]
        [DataRow("ABCDEF", "", false, true)]
        public void StringTestCharDollar(object parameter, string expectedResult, bool throwsIllegalQuantity, bool throwsTypeMismatch)
        {
            var mismatchTypeExceptionThrown = false;
            var illegalQuantExceptionThrown = false;
            var sut = new CharDollar();
            string result;

            try
            {
                result = sut.Execute(new List<Accumulator> { new Accumulator(parameter) }).ValueAsString();
                Assert.AreEqual(expectedResult, result);
            }
            catch (ClassicBasic.Interpreter.Exceptions.IllegalQuantityException)
            {
                illegalQuantExceptionThrown = true;
            }
            catch (ClassicBasic.Interpreter.Exceptions.TypeMismatchException)
            {
                mismatchTypeExceptionThrown = true;
            }

            Assert.AreEqual(throwsIllegalQuantity, illegalQuantExceptionThrown, "Illegal quant");
            Assert.AreEqual(throwsTypeMismatch, mismatchTypeExceptionThrown, "Mismatch");
        }

        /// <summary>
        /// Test ASC needs one parameter.
        /// </summary>
        /// <param name="count">Count of parameters to pass</param>
        /// <param name="throwsException">True if exception thrown.</param>
        [DataTestMethod]
        [DataRow(0, true)]
        [DataRow(1, false)]
        [DataRow(2, true)]
        public void StringTestAscNeedsOneParameter(int count, bool throwsException)
        {
            var sut = new Asc();

            var parameters = new List<Accumulator> { };
            for (int i = 0; i < count; i++)
            {
                parameters.Add(new Accumulator("A"));
            }

            var result = Test.Throws<SyntaxErrorException, Accumulator>(
                () => sut.Execute(parameters),
                throwsException);
        }

        /// <summary>
        /// Test ASC with various parameters.
        /// </summary>
        /// <param name="parameter">Parameter to function.</param>
        /// <param name="expectedResult">Expected result.</param>
        /// <param name="throwsIllegalQuantity">Throws illegal quantity exception.</param>
        /// <param name="throwsTypeMismatch">Throws type mismatch exception.</param>
        [DataTestMethod]
        [DataRow(" ", (short)32, false, false)]
        [DataRow("012345678", (short)48, false, false)]
        [DataRow("A", (short)65, false, false)]
        [DataRow("翿", short.MaxValue, false, false)]
        [DataRow("耀", short.MinValue, false, false)]
        [DataRow("", (short)0, true, false)]
        [DataRow(54.0, (short)0, false, true)]
        public void StringTestAsc(object parameter, short expectedResult, bool throwsIllegalQuantity, bool throwsTypeMismatch)
        {
            var mismatchTypeExceptionThrown = false;
            var illegalQuantExceptionThrown = false;
            var sut = new Asc();
            short result;

            try
            {
                result = sut.Execute(new List<Accumulator> { new Accumulator(parameter) }).ValueAsShort();
                Assert.AreEqual(expectedResult, result);
            }
            catch (ClassicBasic.Interpreter.Exceptions.IllegalQuantityException)
            {
                illegalQuantExceptionThrown = true;
            }
            catch (ClassicBasic.Interpreter.Exceptions.TypeMismatchException)
            {
                mismatchTypeExceptionThrown = true;
            }

            Assert.AreEqual(throwsIllegalQuantity, illegalQuantExceptionThrown, "Illegal quant");
            Assert.AreEqual(throwsTypeMismatch, mismatchTypeExceptionThrown, "Mismatch");
        }

        /// <summary>
        /// Test LEN needs one parameters.
        /// </summary>
        /// <param name="count">Count of parameters to pass</param>
        /// <param name="throwsException">True if exception thrown.</param>
        [DataTestMethod]
        [DataRow(0, true)]
        [DataRow(1, false)]
        [DataRow(2, true)]
        public void StringTestLenNeedsOneParameters(int count, bool throwsException)
        {
            var sut = new Len();

            var parameters = new List<Accumulator>
            {
                new Accumulator("ABCDEF"),
                new Accumulator(3.0),
            };

            var result = Test.Throws<SyntaxErrorException, Accumulator>(
                () => sut.Execute(parameters.Take(count).ToArray()),
                throwsException);
        }

        /// <summary>
        /// Test LEN with various parameters.
        /// </summary>
        /// <param name="parameter">Parameter to function.</param>
        /// <param name="expectedResult">Expected result.</param>
        /// <param name="throwsTypeMismatch">Throws type mismatch exception.</param>
        [DataTestMethod]
        [DataRow("", (short)0, false)]
        [DataRow("012345678", (short)9, false)]
        [DataRow("A", (short)1, false)]
        [DataRow(54.0, (short)0, true)]
        public void StringTestLen(object parameter, short expectedResult, bool throwsTypeMismatch)
        {
            var mismatchTypeExceptionThrown = false;
            var sut = new Len();
            short result;

            try
            {
                result = sut.Execute(new List<Accumulator> { new Accumulator(parameter) }).ValueAsShort();
                Assert.AreEqual(expectedResult, result);
            }
            catch (ClassicBasic.Interpreter.Exceptions.TypeMismatchException)
            {
                mismatchTypeExceptionThrown = true;
            }

            Assert.AreEqual(throwsTypeMismatch, mismatchTypeExceptionThrown, "Mismatch");
        }

        /// <summary>
        /// Test STR$ needs one parameters.
        /// </summary>
        /// <param name="count">Count of parameters to pass</param>
        /// <param name="throwsException">True if exception thrown.</param>
        [DataTestMethod]
        [DataRow(0, true)]
        [DataRow(1, false)]
        [DataRow(2, true)]
        public void StringTestStrDollarNeedsOneParameters(int count, bool throwsException)
        {
            var sut = new StrDollar();

            var parameters = new List<Accumulator>
            {
                new Accumulator(4.4),
                new Accumulator(3.0),
            };

            var result = Test.Throws<SyntaxErrorException, Accumulator>(
                () => sut.Execute(parameters.Take(count).ToArray()),
                throwsException);
        }

        /// <summary>
        /// Test STR$ with various parameters.
        /// </summary>
        /// <param name="parameter">Parameter to function.</param>
        /// <param name="expectedResult">Expected result.</param>
        /// <param name="throwsTypeMismatch">Throws type mismatch exception.</param>
        [DataTestMethod]
        [DataRow((short)-32, " -32", false)]
        [DataRow((short)0, " 0", false)]
        [DataRow((short)32, " 32", false)]
        [DataRow(-32.25, " -32.25", false)]
        [DataRow(0.0, " 0", false)]
        [DataRow(32.75, " 32.75", false)]
        [DataRow("A", "XX", true)]
        public void StringTestStrDollar(object parameter, string expectedResult, bool throwsTypeMismatch)
        {
            var mismatchTypeExceptionThrown = false;
            var sut = new StrDollar();
            string result;

            try
            {
                result = sut.Execute(new List<Accumulator> { new Accumulator(parameter) }).ValueAsString();
                Assert.AreEqual(expectedResult, result);
            }
            catch (ClassicBasic.Interpreter.Exceptions.TypeMismatchException)
            {
                mismatchTypeExceptionThrown = true;
            }

            Assert.AreEqual(throwsTypeMismatch, mismatchTypeExceptionThrown, "Mismatch");
        }

        /// <summary>
        /// Test VAL needs one parameters.
        /// </summary>
        /// <param name="count">Count of parameters to pass</param>
        /// <param name="throwsException">True if exception thrown.</param>
        [DataTestMethod]
        [DataRow(0, true)]
        [DataRow(1, false)]
        [DataRow(2, true)]
        public void StringTestValNeedsOneParameters(int count, bool throwsException)
        {
            var sut = new Val();

            var parameters = new List<Accumulator>
            {
                new Accumulator("ABCDEF"),
                new Accumulator(3.0),
            };

            var result = Test.Throws<SyntaxErrorException, Accumulator>(
                () => sut.Execute(parameters.Take(count).ToArray()),
                throwsException);
        }

        /// <summary>
        /// Test VAL with various parameters.
        /// </summary>
        /// <param name="parameter">Parameter to function.</param>
        /// <param name="expectedResult">Expected result.</param>
        /// <param name="throwsTypeMismatch">Throws type mismatch exception.</param>
        [DataTestMethod]
        [DataRow("", 0.0, false)]
        [DataRow("A", 0.0, false)]
        [DataRow("012345678", 12345678.0, false)]
        [DataRow("12.5", 12.5, false)]
        [DataRow("12.5E12", 1.25e13, false)]
        [DataRow(54.0, 0.0, true)]
        public void StringTestVal(object parameter, double expectedResult, bool throwsTypeMismatch)
        {
            var mismatchTypeExceptionThrown = false;
            var sut = new Val();
            double result;

            try
            {
                result = sut.Execute(new List<Accumulator> { new Accumulator(parameter) }).ValueAsDouble();
                Assert.AreEqual(expectedResult, result);
            }
            catch (ClassicBasic.Interpreter.Exceptions.TypeMismatchException)
            {
                mismatchTypeExceptionThrown = true;
            }

            Assert.AreEqual(throwsTypeMismatch, mismatchTypeExceptionThrown, "Mismatch");
        }
    }
}


text:
package com.amazonaws.services.codepipeline.model.transform;

import java.util.Map;
import java.util.List;

import com.amazonaws.AmazonClientException;
import com.amazonaws.services.codepipeline.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.util.BinaryUtils;
import com.amazonaws.util.StringUtils;
import com.amazonaws.util.IdempotentUtils;
import com.amazonaws.util.StringInputStream;
import com.amazonaws.util.json.*;

/**
 * FailureDetailsMarshaller
 */
public class FailureDetailsJsonMarshaller {

    /**
     * Marshall the given parameter object, and output to a SdkJsonGenerator
     */
    public void marshall(FailureDetails failureDetails,
            StructuredJsonGenerator jsonGenerator) {

        if (failureDetails == null) {
            throw new AmazonClientException(
                    "Invalid argument passed to marshall(...)");
        }

        try {
            jsonGenerator.writeStartObject();

            if (failureDetails.getType() != null) {
                jsonGenerator.writeFieldName("type").writeValue(
                        failureDetails.getType());
            }
            if (failureDetails.getMessage() != null) {
                jsonGenerator.writeFieldName("message").writeValue(
                        failureDetails.getMessage());
            }
            if (failureDetails.getExternalExecutionId() != null) {
                jsonGenerator.writeFieldName("externalExecutionId").writeValue(
                        failureDetails.getExternalExecutionId());
            }

            jsonGenerator.writeEndObject();
        } catch (Throwable t) {
            throw new AmazonClientException(
                    "Unable to marshall request to JSON: " + t.getMessage(), t);
        }
    }

    private static FailureDetailsJsonMarshaller instance;

    public static FailureDetailsJsonMarshaller getInstance() {
        if (instance == null)
            instance = new FailureDetailsJsonMarshaller();
        return instance;
    }

}


text:
ALTER TABLE `article`
ADD `slug` varchar(250) COLLATE 'utf8_czech_ci' NOT NULL AFTER `title`,
COMMENT='';


text:
import Phaser from 'phaser-ce';

import UIBase from 'src/app/sprites/ui/base';
import UIToggle from 'src/app/sprites/ui/base/toggle';
import UIMenu from 'src/app/sprites/ui/menu';

import Hero from 'src/app/chars/hero';

interface Config {
  id: string;
  game: Phaser.Game;
  subject: Hero;
  parent: UIBase;
};

interface Children {
  menu: UIMenu;
};

const width = 100;
const lineHeight = 12;
const marginTop = 12;
const marginLeft = 12;
const nameTop = 9;
const convoTop = 24;
const lineSpacing = -8;

class UIActions extends UIToggle<Children> {
  private game: Phaser.Game;
  private bgLayer: Phaser.Sprite;

  context: any;

  constructor(config: Config) {
    super({
      id: config.id,
      subject: config.subject,
      game: config.game,
      parent: config.parent,
      children: {
        menu: UIMenu,
      },
    });

    // setup
    this.game = config.game;
    this.bgLayer = this.game.make.sprite(0, 0);
    this.sprite.addChildAt(this.bgLayer, 0); // always put bg at the very first layer
  }

  setActions(item) {
    // cleanup
    if (this.bgLayer.children[0]) {
      (this.bgLayer.children[0] as any).destroy();
    }

    this.context = item;
    const options = [];
    const x = item.x + item.width;
    const y = item.y + item.height;

    if (item.consumable) {
      options.push({ name : 'Use' }, { name : 'Discard' });
    } else {
      if (item.equipped) {
        options.push({ name : 'Unequip' });
      } else {
        options.push({ name : 'Equip' }, { name : 'Discard' });
      }
    }

    const height = (options.length + 1) * lineHeight;
    const graphics = this.game.add.graphics(0, 0);

    // set a fill and line style
    graphics.beginFill(0x333333);
    graphics.lineStyle(3, 0xdddddd, 1);

    // draw a shape
    graphics.moveTo(0,0);
    graphics.lineTo(width, 0);
    graphics.lineTo(width, height);
    graphics.lineTo(0, height);
    graphics.lineTo(0, 0);
    graphics.endFill();

    const texture = graphics.generateTexture();
    graphics.destroy();

    const bg = this.game.make.sprite(0, 0, texture);
    this.bgLayer.addChild(bg);
    this.bgLayer.x = x;
    this.bgLayer.y = y;

    this.children.menu.createOptions(options);
    this.children.menu.sprite.x = x;
    this.children.menu.sprite.y = y;
  }
}

export default UIActions;


text:
package org.apache.nifi.processors.gcp.credentials.factory.strategies;

import com.google.auth.oauth2.ComputeEngineCredentials;
import com.google.auth.oauth2.GoogleCredentials;
import org.apache.nifi.components.PropertyDescriptor;
import org.apache.nifi.processors.gcp.credentials.factory.CredentialPropertyDescriptors;

import java.io.IOException;
import java.util.Map;

/**
 * Supports Google Compute Engine credentials. Fetches access tokens from the Google Compute Engine metadata server.
 *
 * @see
 *     Service Accounts for Instances
 */
public class ComputeEngineCredentialsStrategy extends AbstractBooleanCredentialsStrategy {
    public ComputeEngineCredentialsStrategy() {
        super("Compute Engine Credentials", CredentialPropertyDescriptors.USE_COMPUTE_ENGINE_CREDENTIALS);
    }

    @Override
    public GoogleCredentials getGoogleCredentials(Map<PropertyDescriptor, String> properties) throws IOException {
        return new ComputeEngineCredentials();
    }
}


text:
The OCCI playground is a tool to help you discover, learn and test the OCCI API and manage OCCI resources.

## And what is OCCI ?

OCCI is a set of specifications which standardize and unify the management of the Cloud. In this standard, everything is a *Resource* or
a *Link*. More informations [here](http://occi-wg.org/about/specification/)

## Getting started

You can explore the API by clicking on the [links](/compute), in the JSON or in this text, or by entering a target URL and clicking on the GET button.

You can post a sample of data by clicking %{
  "text": "here",
  "post": [
    {
        "address": "/compute",
        "data": {
          "kind":"http://schemas.ogf.org/occi/infrastructure#compute",
          "attributes": {
            "occi.compute.hostname" : "test",
            "occi.compute.state" : "inactive"
          },
          "id": "6df690d2-3158-40c4-88fb-d1c41584d6e5"
        }
    },
    {
        "address": "/storage",
        "data": {
          "kind":"http://schemas.ogf.org/occi/infrastructure#storage",
          "attributes": {
            "occi.storage.size" : 1000
          },
          "id": "6df690d2-3158-40c4-88fb-d1c41584d6e6"
        }
    },
    {
      "address": "/storagelink",
      "data": {
         "kind":"http://schemas.ogf.org/occi/infrastructure#storagelink",
         "attributes": {
           "occi.core.id":"6df690d2-3158-40c4-88fb-d1c41584d6e7",
           "occi.storagelink.deviceid":"/dev/vdc"
         },
         "target": {
           "location": "6df690d2-3158-40c4-88fb-d1c41584d6e6"
         },
         "source": {
           "location": "6df690d2-3158-40c4-88fb-d1c41584d6e5"
         }
      }
    }
  ]
}%(you need to have occi-infra on your server)
**DOESN'T WORK ON MART YET because of [wrong POST semantics](https://github.com/cgourdin/MartServer/issues/47#issuecomment-264481977)**

* The first URL you should know is [/-/](/-/).
It gives you the configuration of the OCCI server, list the **actions** you can do, and the **kinds** of resources you can interact with.
You can also discover the **kinds** of the current OCCI server by clicking on "Select Kind" at the top of the page.

* To access a categorie, use URLs of this type : [/storagelink](/storagelink)

* Each resource has an unique id. To access a resource, click on a link pointing to it, or use an URL of this type :
[/6df690d2-3158-40c4-88fb-d1c41584d6e5](/6df690d2-3158-40c4-88fb-d1c41584d6e5)

Moreover, the use of the four buttons are quite simple :

* GET: make a GET request with the target URL
* EDIT: switch the JSON view to editable, then you can make a POST or PUT to edit or create data
* DEL: make a DELETE request with the target URL
* M: Go to the kind (the Model) of a resource. You need to have a target URL pointing to a resource.

See further doc and tips in the [README](https://github.com/occiware/OCCInterface/blob/master/README.md).

### Switching server

You can switch the current OCCI server you are working on with the editable dropdown at the top of the page.

### PUT sample - infra (works on MART)

Here's the same sample as above but using PUT methods to the full URLs of the methods (works with MART) :

You can post a sample of data by clicking %{
  "text": "here",
  "put": [
    {
        "address": "/compute/6df690d2-3158-40c4-88fb-d1c41584d6e5",
        "data": {
          "kind":"http://schemas.ogf.org/occi/infrastructure#compute",
          "attributes": {
            "occi.compute.hostname" : "test",
            "occi.compute.state" : "inactive"
          },
          "id": "6df690d2-3158-40c4-88fb-d1c41584d6e5"
        }
    },
    {
        "address": "/storage/6df690d2-3158-40c4-88fb-d1c41584d6e6",
        "data": {
          "kind":"http://schemas.ogf.org/occi/infrastructure#storage",
          "attributes": {
            "occi.storage.size" : 1000
          },
          "id": "6df690d2-3158-40c4-88fb-d1c41584d6e6"
        }
    },
    {
      "address": "/storagelink/6df690d2-3158-40c4-88fb-d1c41584d6e7",
      "data": {
         "kind":"http://schemas.ogf.org/occi/infrastructure#storagelink",
         "attributes": {
           "occi.core.id":"6df690d2-3158-40c4-88fb-d1c41584d6e7",
           "occi.storagelink.deviceid":"/dev/vdc"
         },
         "target": {
           "location": "6df690d2-3158-40c4-88fb-d1c41584d6e6"
         },
         "source": {
           "location": "6df690d2-3158-40c4-88fb-d1c41584d6e5"
         }
      }
    }
  ]
}%(you need to have occi-infra on your server)

### action sample - infra
Doing an action is as simple as doing a POST to the resource with an action=actionName query parameter (you need to have created the previous infra sample resources first). First try to %{
  "text": "start the previously created VM",
  "post": [
    {
        "address": "/compute/6df690d2-3158-40c4-88fb-d1c41584d6e5?action=start",
        "data": {
          "action":"http://schemas.ogf.org/occi/infrastructure/compute/action#start",
          "attributes": {
          }
        }
    }
  ]
}%

Then try to %{
  "text": "stop it",
  "post": [
    {
        "address": "/compute/6df690d2-3158-40c4-88fb-d1c41584d6e5?action=stop",
        "data": {
          "action":"http://schemas.ogf.org/occi/infrastructure/compute/action#stop",
          "attributes": {
            "method": "graceful"
          }
        }
    }
  ]
}%.


text:
define("JBrowse/Store/SeqFeature/NCList", [
           'dojo/_base/declare',
           'dojo/_base/lang',
           'dojo/Deferred',
           'dojo/request/xhr',
           'JBrowse/Store/SeqFeature',
           'JBrowse/Store/DeferredFeaturesMixin',
           'JBrowse/Store/DeferredStatsMixin',
           'JBrowse/Util',
           'JBrowse/Model/ArrayRepr',
           'JBrowse/Store/NCList',
           'JBrowse/Store/LazyArray'
       ],
       function(
           declare,
           lang,
           Deferred,
           xhr,
           SeqFeatureStore,
           DeferredFeaturesMixin,
           DeferredStatsMixin,
           Util,
           ArrayRepr,
           GenericNCList,
           LazyArray
       ) {

/**
 * Implementation of SeqFeatureStore using nested containment
 * lists held in static files that are lazily fetched from the web
 * server.
 *
 * @class JBrowse.Store.SeqFeature.NCList
 * @extends SeqFeatureStore
 */

var idfunc = function() { return this._uniqueID; };
var parentfunc = function() { return this._parent; };
var childrenfunc = function() { return this.get('subfeatures'); };

return declare( SeqFeatureStore,
{
    constructor: function(args) {
        this.args = args;

        this.baseUrl = args.baseUrl;
        this.urlTemplates = { root: args.urlTemplate };

        this._deferred = {};
    },

    makeNCList: function() {
        return new GenericNCList();
    },

    loadNCList: function( refData, trackInfo, url ) {
        refData.nclist.importExisting( trackInfo.intervals.nclist,
                                       refData.attrs,
                                       url,
                                       trackInfo.intervals.urlTemplate,
                                       trackInfo.intervals.lazyClass
                                     );
    },

    getDataRoot: function( refName ) {
        if( ! this._deferred.root || this.curRefName != refName ) {
            var d = this._deferred.root = new Deferred();
            this.curRefName = refName;

            var refData = {
                nclist: this.makeNCList()
            };

            var url = this.resolveUrl(
		this._evalConf(this.urlTemplates.root),
                { refseq: refName }
            );

            // fetch the trackdata
            var thisB = this;
            xhr.get( url, { handleAs: 'json', failOk: true })
               .then( function( trackInfo, request ) {
                          //trackInfo = JSON.parse( trackInfo );
                          thisB._handleTrackInfo( refData, trackInfo, url );
                      },
                      function(error) {
                          if( error.response.status == 404 ) {
                              thisB._handleTrackInfo( refData, {}, url );
                          } else if( error.response.status != 200) {
                              thisB._failAllDeferred( "Server returned an HTTP " + error.response.status + " error" );
                          }
                          else
                              thisB._failAllDeferred( error );
                      }
                    );
        }
        return this._deferred.root;
    },

    _handleTrackInfo: function( refData, trackInfo, url ) {
        refData.stats = {
            featureCount: trackInfo.featureCount || 0,
            featureDensity: ( trackInfo.featureCount || 0 ) / this.refSeq.length
        };

        this.empty = !trackInfo.featureCount;

        if( trackInfo.intervals ) {
            refData.attrs = new ArrayRepr( trackInfo.intervals.classes );
            this.loadNCList( refData, trackInfo, url );
        }

        var histograms = trackInfo.histograms;
        if( histograms && histograms.meta ) {
            for (var i = 0; i < histograms.meta.length; i++) {
                histograms.meta[i].lazyArray =
                    new LazyArray( histograms.meta[i].arrayParams, url );
            }
            refData._histograms = histograms;
        }

        this._deferred.root.resolve( refData );
    },

    getGlobalStats: function( successCallback, errorCallback ) {
        return ( this._deferred.root || this.getDataRoot( this.browser.refSeq.name ) )
                   .then( function( data ) { successCallback( data.stats ); },
                          errorCallback
                        );
    },

    getRegionStats: function( query, successCallback, errorCallback ) {
        this.getDataRoot( query.ref )
            .then( function( data ) { successCallback( data.stats ); },
                   errorCallback
                 );
    },

    getRegionFeatureDensities: function( query, successCallback, errorCallback ) {
        this.getDataRoot( query.ref )
            .then( function( data ) {

                var numBins, basesPerBin;
                if( query.numBins ) {
                    numBins = query.numBins;
                    basesPerBin = (query.end - query.start)/numBins;
                }
                else if( query.basesPerBin ) {
                    basesPerBin = query.basesPerBin;
                    numBins = Math.ceil( (query.end-query.start)/basesPerBin );
                }
                else {
                    throw new Error('numBins or basesPerBin arg required for getRegionFeatureDensities');
                }

                // pick the relevant entry in our pre-calculated stats
                var statEntry = (function( basesPerBin, stats ) {
                    for (var i = 0; i < stats.length; i++) {
                        if( stats[i].basesPerBin >= basesPerBin ) {
                            return stats[i];
                            break;
                        }
                    }
                    return undefined;
                })( basesPerBin, data._histograms.stats || [] );

                // The histogramMeta array describes multiple levels of histogram detail,
                // going from the finest (smallest number of bases per bin) to the
                // coarsest (largest number of bases per bin).
                // We want to use coarsest histogramMeta that's at least as fine as the
                // one we're currently rendering.
                // TODO: take into account that the histogramMeta chosen here might not
                // fit neatly into the current histogram (e.g., if the current histogram
                // is at 50,000 bases/bin, and we have server histograms at 20,000
                // and 2,000 bases/bin, then we should choose the 2,000 histogramMeta
                // rather than the 20,000)
                var histogramMeta = data._histograms.meta[0];
                for (var i = 0; i < data._histograms.meta.length; i++) {
                    if( basesPerBin >= data._histograms.meta[i].basesPerBin )
                        histogramMeta = data._histograms.meta[i];
                }

                // number of bins in the server-supplied histogram for each current bin
                var binRatio = basesPerBin / histogramMeta.basesPerBin;

                // if the server-supplied histogram fits neatly into our requested
                if ( binRatio > .9
                     &&
                     Math.abs(binRatio - Math.round(binRatio)) < .0001
                   ) {
                       //console.log('server-supplied',query);
                       // we can use the server-supplied counts
                       var firstServerBin = Math.floor( query.start / histogramMeta.basesPerBin);
                       binRatio = Math.round(binRatio);
                       var histogram = [];
                       for (var bin = 0; bin < numBins; bin++)
                           histogram[bin] = 0;

                       histogramMeta.lazyArray.range(
                           firstServerBin,
                           firstServerBin + binRatio*numBins,
                           function(i, val) {
                               // this will count features that span the boundaries of
                               // the original histogram multiple times, so it's not
                               // perfectly quantitative.  Hopefully it's still useful, though.
                               histogram[ Math.floor( (i - firstServerBin) / binRatio ) ] += val;
                           },
                           function() {
                               successCallback({ bins: histogram, stats: statEntry });
                           }
                       );
                   } else {
                       //console.log('make own',query);
                       // make our own counts
                       data.nclist.histogram.call(
                           data.nclist,
                           query.start,
                           query.end,
                           numBins,
                           function( hist ) {
                               successCallback({ bins: hist, stats: statEntry });
                           });
                   }
               }, errorCallback );
    },

    getFeatures: function( query, origFeatCallback, finishCallback, errorCallback ) {
        if( this.empty ) {
            finishCallback();
            return;
        }

        var thisB = this;
        this.getDataRoot( query.ref )
            .then( function( data ) {
                thisB._getFeatures( data, query, origFeatCallback, finishCallback, errorCallback );
            }, errorCallback);
    },

    _getFeatures: function( data, query,  origFeatCallback, finishCallback, errorCallback ) {
        var thisB = this;
        var startBase  = query.start;
        var endBase    = query.end;
        var accessors  = data.attrs.accessors(),
        /** @inner */
        featCallBack = function( feature, path ) {
            // the unique ID is a stringification of the path in the
            // NCList where the feature lives; it's unique across the
            // top-level NCList (the top-level NCList covers a
            // track/chromosome combination)

            // only need to decorate a feature once
            if (! feature.decorated)  {
                var uniqueID = path.join(",");
                thisB._decorate_feature( accessors, feature, uniqueID );
            }
            return origFeatCallback( feature );
        };

        data.nclist.iterate.call( data.nclist, startBase, endBase, featCallBack, finishCallback, errorCallback );
    },

    // helper method to recursively add .get and .tags methods to a feature and its
    // subfeatures
    _decorate_feature: function( accessors, feature, id, parent ) {
        feature.get = accessors.get;
        // possibly include set method in decorations? not currently
        //    feature.set = accessors.set;
        feature.tags = accessors.tags;
        feature._uniqueID = id;
        feature.id = idfunc;
        feature._parent  = parent;
        feature.parent   = parentfunc;
        feature.children = childrenfunc;
        dojo.forEach( feature.get('subfeatures'), function(f,i) {
            this._decorate_feature( accessors, f, id+'-'+i, feature );
        },this);
        feature.decorated = true;
    }
});
});


text:
sqlUsername = exports.mysql:getMySQLUsername()
sqlPassword = exports.mysql:getMySQLPassword()
sqlDB = exports.mysql:getMySQLDBName()
sqlHost = exports.mysql:getMySQLHost()
sqlPort = exports.mysql:getMySQLPort()

handler = mysql_connect(sqlHost, sqlUsername, sqlPassword, sqlDB, sqlPort)

function checkMySQL()
	if not (mysql_ping(handler)) then
		handler = mysql_connect(sqlHost, sqlUsername, sqlPassword, sqlDB, sqlPort)
	end
end
setTimer(checkMySQL, 300000, 0)

function closeMySQL()
	if (handler) then
		mysql_close(handler)
		handler = nil
	end
end
addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), closeMySQL)
-- ////////////////////////////////////
-- //			MYSQL END			 //
-- ////////////////////////////////////

function correctTime(res)
	local hour, minutes = getTime()
	if hour == 18 and minutes == 00 then
		drawLottery()
	else
		local minutesLeft = 60 - minutes
		local hoursLeft = 17 - hour
		if hoursLeft < 0 then
			drawTime = ((hoursLeft*60)+1440) + minutesLeft
		else
			drawTime = (hoursLeft*60) + minutesLeft
		end
		drawTimer = setTimer ( drawLottery, drawTime*60000, 1 )
		outputDebugString("Lottery will be drawn in "..drawTime.." minutes.")
		drawTime = 0
	end

	-- check for lottery setting
	local result = mysql_query( handler, "SELECT COUNT(*) FROM settings WHERE name = 'lotteryjackpot'" )
	if result then
		if tonumber( mysql_result( result, 1, 1 ) ) == 0 then
			mysql_free_result( mysql_query( handler, "INSERT INTO settings (name, value) VALUES ('lotteryjackpot', 0)" ) )
		end
		mysql_free_result( result )
	end
end
addEventHandler("onResourceStart", getResourceRootElement(), correctTime)

function giveTicket(aPlayer)
	local PlayerID = getElementData(aPlayer, "dbid")
	local ticketNumber = tostring(math.random(1000, 9999))
	local result = mysql_query(handler, "SELECT characterid FROM lottery WHERE ticketnumber = " .. ticketNumber )
	if (mysql_num_rows(result) == 0) then
		mysql_free_result( mysql_query( handler, "INSERT INTO lottery (characterid, ticketnumber) VALUES (" .. PlayerID .. ", " .. ticketNumber .. " )" ) )
		mysql_free_result( mysql_query( handler, "UPDATE settings SET value = value + 40 WHERE name = 'lotteryjackpot'" ) )
		return tonumber(ticketNumber)
	else
		local result = mysql_query( handler, "SELECT COUNT(*) FROM lottery" )
		if result then
			if tonumber( mysql_result( result, 1, 1 ) or 0 ) >= 8999 then
				mysql_free_result( result )
				return false
			end
			mysql_free_result( result )
		else
			giveTicket(aPlayer)
		end
	end
end

function drawLottery()
	local query = mysql_query(handler, "SELECT value FROM settings WHERE name = 'lotteryjackpot'")
	local jackpot = tonumber(mysql_result(query, 1, 1))
	mysql_free_result(query)

	local drawNumbers = tostring(math.random(1000, 9999))
	local result = mysql_query(handler, "SELECT characterid, c.charactername FROM lottery l LEFT JOIN characters c ON l.characterid = c.id  WHERE ticketnumber = " .. drawNumbers)
	if (mysql_num_rows(result) ~= 0) then
		local charid = tonumber(mysql_result(result, 1, 1))
		local charname = mysql_result(result, 1, 2)

		local player = getPlayerFromName(charname)
		if player then
			local bankmoney = getElementData(player, "bankmoney")
			setElementData(player, "bankmoney", bankmoney+jackpot)
		else
			local query = mysql_query(handler, "UPDATE characters SET bankmoney=bankmoney+" .. jackpot .. " WHERE id=" .. charid)
			mysql_free_result(query)
		end
		mysql_free_result( mysql_query( handler, "INSERT INTO wiretransfers (`from`, `to`, `amount`, `reason`, `type`) VALUES (0, " .. charid .. ", " .. jackpot .. ", 'Won lottery', 3)" ) )
		mysql_free_result( mysql_query( handler, "UPDATE settings SET value = 0 WHERE name = 'lotteryjackpot'" ) )
		outputChatBox("* [LOTTERY] The winner of the lottery is: " .. charname:gsub("_", " ") .. "! The Jackpot of $" .. jackpot .. " will be transfered to his/her account.", getRootElement(), 0, 255, 0)
	else
		outputChatBox("* [LOTTERY] Nobody wins. The jackpot of $" .. jackpot .. " has been accumulated.", getRootElement(), 255, 255, 0)
	end
	drawTimer2 = setTimer ( drawLottery, 86400000, 1 )
	mysql_free_result(result)

	mysql_free_result( mysql_query(handler, "TRUNCATE TABLE lottery") )
	call( getResourceFromName( "item-system" ), "deleteAll", 68 )
end

addCommandHandler( "forcedrawlottery", function( thePlayer ) if exports.global:isPlayerLeadAdmin( thePlayer ) then drawLottery() end end )


text:
Event Datetimes

		<input type="hidden" name="datetime_IDs" id="datetime-IDs" value="">

		<input type="hidden" name="datetime_total_rows" id="datetime-total-rows" value="0">

Add New Datetime

					Event Start
					<input type="text" name="add_new_datetime[DTT_EVT_start]" id="add-new-event-datetime-DTT_EVT_start" class="ee-text-inp ee-datepicker" data-context="start-dtt" data-date-field-context="#add-event-datetime" data-related-field="#add-new-event-datetime-DTT_EVT_end" data-next-field="#add-new-event-datetime-DTT_EVT_start">

					Event End
					<input type="text" name="add_new_datetime[DTT_EVT_end]" id="add-new-event-datetime-DTT_EVT_end" class="ee-text-inp ee-datepicker" data-context="end-dtt" data-date-field-context="#add-event-datetime" data-related-field="#add-new-event-datetime-DTT_EVT_start" data-next-field="#add-new-event-datetime-DTT_reg_limit">

					Reg Limit
					<input type="text" name="add_new_datetime[DTT_reg_limit]" id="add-new-event-datetime-DTT_reg_limit" class="ee-small-text-inp">

					<button data-context="datetime" class="button-primary ee-create-button">
						Save Datetime
					</button>

Available Tickets

					Ticket
					On Sale
					Sell Until
					Status
					Price
					Qty
					Sold

					Free Admission

					$0.00

					0

						<fieldset id="fieldset-edit-ticketrow-1" class="ticket-fieldset" style="display:none">
							<legend>Edit Ticket</legend>
							<input type="hidden" name="edit_tickets[1][TKT_ID]" class="edit-ticket-TKT_ID" value="0">
							<input type="hidden" name="edit_tickets[1][TKT_row]" class="edit-ticket-TKT_row" value="1">
							<input type="text" name="edit_tickets[1][TKT_name]" class="edit-ticket-TKT_name ee-large-text-inp" placeholder="Ticket Title" value="Free Admission">

Total Final Price: $0.00

							<textarea name="edit_tickets[1][TKT_description]" class="edit-ticket-TKT_description ee-full-textarea-inp" placeholder="Ticket Description"></textarea>

Ticket Details

											Goes on Sale
											Sell Until

											<input type="text" name="edit_tickets[1][TKT_start_date]" class="edit-ticket-TKT_start_date ee-text-inp ee-datepicker" value="" data-context="start-ticket" data-date-field-context="#edit-ticketrow-1" data-related-field=".edit-ticket-TKT_end_date" data-next-field=".edit-ticket-TKT_end_date">
											<input type="text" name="edit_tickets[1][TKT_end_date]" class="edit-ticket-TKT_end_date ee-text-inp ee-datepicker" value="" data-context="end-ticket" data-date-field-context="#edit-ticketrow-1" data-related-field=".edit-ticket-TKT_start_date" data-next-field=".edit-ticket-TKT_qty">

											Quantity
											#Uses
											Min
											Max

											<input type="text" class="edit-ticket-TKT_qty ee-small-text-inp" name="edit_tickets[1][TKT_qty]" value="">
											<input type="text" class="edit-ticket-TKT_uses ee-small-text-inp" name="edit_tickets[1][TKT_uses]">
											<input type="text" class="edit-ticket-TKT_min ee-small-text-inp" name="edit_tickets[1][TKT_min]">
											<input type="text" class="edit-ticket-TKT_max ee-small-text-inp" name="edit_tickets[1[TKT_max]">

Base Ticket Price and Price Modifiers

											Price Type
											Name

											Amount

												<input type="hidden" name="edit_prices[1][1][PRT_ID]" class="edit-price-PRT_ID" value="1">
												Base Price
												<input type="hidden" name="ee_price_selected_operator[1][1]" class="ee-price-selected-operator" value="+">
												<input type="hidden" name="ee_price_selected_operator[1][1]" class="ee-price-selected-is-percent" value="0">

											<input type="hidden" name="edit_prices[1][1][PRC_ID]" class="edit-price-PRC_ID" value="1"><input type="text" class="edit-price-PRC_name ee-text-inp" name="edit_prices[1][1][PRC_name]" value="Free Admission">

												+/-
												+
												-
												$

												<input type="text" size="1" class="edit-price-PRC_amount ee-small-text-inp" name="edit_prices[1][1][PRC_amount]" value="0">
												%

											<button data-ticket-row="1" data-price-row="1" data-context="price" class="ee-create-button">+</button>

													<textarea name="edit_prices[1][1][PRT_description]" class="edit-price-PRC_desc ee-full-textarea-inp" placeholder="Edit the description for the price here">This is a free admission ticket</textarea>

											Total
											<input type="hidden" name="edit_tickets[1][TKT_price]" class="edit-tickets-TKT_price" value="0">$0.00</span
											<input type="hidden" name="price_total_rows_ticket1" id="price-total-rows-1" value="1">

Event Datetimes

This ticket will be usable (allow entrance) for the following selected event datetimes (click to select):

use this new ticket as a default ticket for any new events  <input type="checkbox" name="edit_tickets[1][TKT_is_default_selector]" class="edit-ticket-TKT_is_default_selector">
							<input type="hidden" name="edit_tickets[1][TKT_is_default]" class="edit-ticket-TKT_is_default" value="">
							<button class="button-primary ee-save-button" data-context="ticket" data-ticket-row="1">Save Ticket</button><button class="button-secondary ee-cancel-button" data-context="ticket" data-ticket-row="1">Cancel</button>

							<input type="hidden" name="starting_ticket_datetime_IDs[1]" id="starting-ticket-datetime-ids-1" value="" class="starting-ticket-datetime-ids">
							<input type="hidden" name="ticket_datetime_IDs" class="ticket-datetime-ids" id="ticket-datetime-ids-1" value="">

						<input type="hidden" name="ticket_price_ids[1][]" id="ticket-price-ids-1" class="ticket-price-ids" value="1">
						<input type="hidden" name="edit_tickets[1][TTM_ID]" class="ticket-template-id" value="0">

						</fieldset>

		<input type="hidden" name="ticket_IDs" id="ticket-IDs" value="">
		<input type="hidden" name="ticket_total_rows" id="ticket-total-rows" value="1">

<button class="button-secondary ee-create-button" data-context="ticket">Create New Ticket</button>

			<input type="hidden" name="edit_event_datetimes[DTTNUM][DTT_ID]" id="event-datetime-DTT_ID-DTTNUM" class="event-datetime-DTT_ID" value="15">

						Event Start
						<input type="text" name="edit_event_datetimes[DTTNUM][DTT_EVT_start]" id="event-datetime-DTT_EVT_start-DTTNUM" class="ee-text-inp event-datetime-DTT_EVT_start ee-datepicker"  data-context="start-dtt" data-date-field-context="#edit-event-datetime-DTTNUM" data-related-field=".event-datetime-DTT_EVT_end" data-next-field=".event-datetime-DTT_EVT_end">

						Event End
						<input type="text" name="edit_event_datetimes[DTTNUM][DTT_EVT_end]" id="event-datetime-DTT_EVT_end-DTTNUM" class="ee-text-inp event-datetime-DTT_EVT_end ee-datepicker"  data-context="end-dtt" data-date-field-context="#edit-event-datetime-DTTNUM" data-related-field=".event-datetime-DTT_EVT_start" data-next-field=".event-datetime-DTT_reg_limit">

						Reg Limit
						<input type="text" name="edit_event_datetimes[DTTNUM][DTT_reg_limit]" id="event-datetime-DTT_reg_limit-DTTNUM" class="ee-small-text-inp event-datetime-DTT_reg_limit">

						<button data-datetime-row="DTTNUM"  data-context="datetime" class="button-primary ee-save-button">
							Save Datetime
						</button>
						<button data-datetime-row="DTTNUM" data-context="datetime" class="button-secondary ee-cancel-button">
							Cancel
						</button>

				0

					<fieldset id="fieldset-edit-ticketrow-TICKETNUM" class="ticket-fieldset" style="display:none">
						<legend>Edit Ticket</legend>
						<input type="hidden" name="edit_tickets[TICKETNUM][TKT_ID]" class="edit-ticket-TKT_ID" value="0">
						<input type="hidden" name="edit_tickets[TICKETNUM][TKT_row]" class="edit-ticket-TKT_row" value="TICKETNUM">
						<input type="text" name="edit_tickets[TICKETNUM][TKT_name]" class="edit-ticket-TKT_name ee-large-text-inp" placeholder="Ticket Title" value="General Admission">

Total Final Price: $0.00

						<textarea name="edit_tickets[TICKETNUM][TKT_description]" class="edit-ticket-TKT_description ee-full-textarea-inp" placeholder="Ticket Description"></textarea>

Ticket Details

										Goes on Sale
										Sell Until

										<input type="text" name="edit_tickets[TICKETNUM][TKT_start_date]" class="edit-ticket-TKT_start_date ee-text-inp ee-datepicker" value="" data-context="start-ticket" data-date-field-context="#edit-ticketrow-TICKETNUM" data-related-field=".edit-ticket-TKT_end_date" data-next-field=".edit-ticket-TKT_end_date">
										<input type="text" name="edit_tickets[TICKETNUM][TKT_end_date]" class="edit-ticket-TKT_end_date ee-text-inp ee-datepicker" value="" data-context="end-ticket" data-date-field-context="#edit-ticketrow-TICKETNUM" data-related-field=".edit-ticket-TKT_start_date" data-next-field=".edit-ticket-TKT_qty">

										Quantity
										#Uses
										Min
										Max

										<input type="text" class="edit-ticket-TKT_qty ee-small-text-inp" name="edit_tickets[TICKETNUM][TKT_qty]" value="">
										<input type="text" class="edit-ticket-TKT_uses ee-small-text-inp" name="edit_tickets[TICKETNUM][TKT_uses]">
										<input type="text" class="edit-ticket-TKT_min ee-small-text-inp" name="edit_tickets[TICKETNUM][TKT_min]">
										<input type="text" class="edit-ticket-TKT_max ee-small-text-inp" name="edit_tickets[TICKETNUM[TKT_max]">

Base Ticket Price and Price Modifiers

										Price Type
										Name

										Amount

										Total
										$0.00</span
										<input type="hidden" name="price_total_rows_ticket[TICKETNUM]" id="price-total-rows-TICKETNUM" value="1">

Event Datetimes

This ticket will be usable (allow entrance) for the following selected event datetimes (click to select):

							use this new ticket as a default ticket for any new events  <input type="checkbox" name="edit_tickets[TICKETNUM][TKT_is_default_selector]" class="edit-ticket-TKT_is_default_selector">
							<input type="hidden" name="edit_tickets[1][TKT_is_default]" class="edit-ticket-TKT_is_default" value="">
							<button class="button-primary ee-save-button" data-context="ticket" data-ticket-row="TICKETNUM">Save Ticket</button><button class="button-secondary ee-cancel-button" data-context="ticket" data-ticket-row="TICKETNUM">Cancel</button>

						<input type="hidden" name="starting_ticket_datetime_IDs[TICKETNUM][]" id="starting-ticket-datetime-ids-TICKETNUM" value="" class="starting-ticket-datetime-ids">
						<input type="hidden" name="ticket_datetime_IDs[TICKETNUM][]" class="ticket-datetime-ids" id="ticket-datetime-ids-TICKETNUM" value="">

						<input type="hidden" name="ticket_price_ids[TICKETNUM][]" id="ticket-price-ids-TICKETNUM" class="ticket-price-ids">
						<input type="hidden" name="edit_tickets[TICKETNUM][TTM_ID]" class="ticket-template-id" value="0">
					</fieldset>

					<input type="hidden" name="edit_prices[TICKETNUM][PRICENUM][PRT_ID]" class="edit-price-PRT_ID" value="1">
					Base Price
					<input type="hidden" name="ee_price_selected_operator[TICKETNUM][PRICENUM]" class="ee-price-selected-operator" value="+">
					<input type="hidden" name="ee_price_selected_operator[TICKETNUM][PRICENUM]" class="ee-price-selected-is-percent" value="0">

					<input type="hidden" name="edit_prices[TICKETNUM][PRICENUM][PRC_ID]" class="edit-price-PRC_ID">
					<input type="hidden" name="edit_prices[TICKETNUM][PRICENUM][PRC_is_default]" class="edit-price-PRC_is_default">
					<input type="text" class="edit-price-PRC_name ee-text-inp" name="edit_prices[TICKETNUM][PRICENUM][PRC_name]" value="General Admission">

					+/-
					+
					-
					$

					<input type="text" size="1" class="edit-price-PRC_amount ee-small-text-inp" name="edit_prices[TICKETNUM][PRICENUM][PRC_amount]" value="50">
					%

				<button data-ticket-row="TICKETNUM" data-price-row="PRICENUM" data-context="price" class="ee-create-button">+</button>

						<textarea name="edit_prices[TICKETNUM][PRICENUM][PRT_description]" class="edit-price-PRC_desc ee-full-textarea-inp" placeholder="Edit the description for the price here"></textarea>

		<select name="edit_prices[TICKETNUM][PRICENUM][PRT_ID]" class="edit-price-PRT_ID">
			<option value="0">Select Price Modifier</option>
			<option value="3">Discount</option>
			<option value="4">Surcharge</option>
		</select>

				-1

				+0

		<input type="hidden" name="ee_price_selected[TICKETNUM][PRICENUM]" class="ee-price-selected-operator" value="-">
		<input type="hidden" name="ee_price_selected[TICKETNUM][PRICENUM]" class="ee-price-selected-is-percent" value="0">

Assigned Tickets

Add New Ticket

							Ticket Name
							Sale Starts
							Sell Until
							Price
							Qty

								<input type="text" name="add_new_ticket[TKT_name]" class="add-new-ticket-TKT_name">

								<input type="text" name="add_new_ticket[TKT_start_date]" class="add-new-ticket-TKT_start_date ee-datepicker" data-context="start-ticket" data-date-field-context="#edit-event-datetime-tickets-DTTNUM" data-related-field=".add-new-ticket-TKT_end_date" data-next-field=".add-new-ticket-TKT_end_date">

								<input type="text" name="add_new_ticket[TKT_end_date]" class="add-new-ticket-TKT_end_date ee-datepicker" data-context="end-ticket" data-date-field-context="#edit-event-datetime-tickets-DTTNUM" data-related-field=".add-new-ticket-TKT_start_date" data-next-field=".add-new-ticket-PRC_amount">

								<input type="text" name="add_new_ticket[PRC_amount]" class="add-new-ticket-PRC_amount" size="1">

								<input type="text" name="add_new_ticket[TKT_qty]" class="add-new-ticket-TKT_qty" size="1">

					<button data-context="short-ticket" data-datetime-row="DTTNUM" class="button-primary ee-create-button">
						Save Ticket
					</button>
					<button data-context="short-ticket" data-datetime-row="DTTNUM" class="button-secondary ee-cancel-button add-edit">
						Cancel
					</button>

			Total Tickets Sold: 0

			<input type="checkbox" name="datetime_ticket[DTTNUM][1]" class="datetime-ticket-checkbox" value="1">
			Free Admission: 0

			<input type="checkbox" name="datetime_ticket[DTTNUM][TICKETNUM]" class="datetime-ticket-checkbox" value="1">
			TKTNAME

			<input type="checkbox" name="ticket_datetime[DTTNUM][TICKETNUM]" class="datetime-ticket-checkbox" value="1">
			DTTDATE


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Frontiers of Fungal Diversity in India (Lucknow), (Prof. Kamal Festschrift) 506 (2003)

#### Original name
Vermiculariopsiella parva Kesh. Prasad, D'Souza & Bhat

### Remarks
null


text:
package cdc.gui.components.linkagesanalysis.dialog;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.JToolBar;
import javax.swing.SwingUtilities;
import javax.swing.border.BevelBorder;

import cdc.components.AbstractDistance;
import cdc.components.AbstractJoin;
import cdc.components.Filter;
import cdc.datamodel.DataColumnDefinition;
import cdc.datamodel.DataRow;
import cdc.gui.Configs;
import cdc.gui.OptionDialog;
import cdc.gui.components.linkagesanalysis.LoadingThread;
import cdc.gui.components.linkagesanalysis.ThreadCreatorInterface;
import cdc.gui.components.linkagesanalysis.spantable.SpanInfo;
import cdc.gui.components.linkagesanalysis.spantable.SpanTableModel;
import cdc.gui.components.uicomponents.FilterExpressionEditor;
import cdc.gui.external.JXErrorDialog;
import cdc.utils.Props;
import cdc.utils.RJException;

public class LinkagesWindowPanel extends JPanel {

	private static final String STRATUM_NAME = "Stratum name";
	private static final String CONFIDENCE = "Confidence";
	private static final String VIEW_PREFERENCES = "View preferences";
	private static final String REJECT_ALL_LINKAGES = "Reject all linkages";
	private static final String ACCEPT_ALL_LINKAGES = "Accept all linkages";
	private static final String LINKAGE_DETAILS = "Show linkage details";
	private static final String SORT_LINKAGES = "Sort linkages";
	private static final String SAVE_LINKAGES = "Export current view to a file";
	private static final String FILTER_LINKAGES = "Filter linkages";
	private static final String CONFIGURE_SORTING = "Configure sorting";
	private static final String CONFIGURE_FITER = "Configure fiter";

	private static int RECORDS_PER_PAGE = Props.getInteger("records-per-page", 200);

	private LinkagesPanel linkages;
	private SpanTableModel tableModel;

	private DataColumnDefinition[][] comparedColumns;
	private AbstractDistance[] compareDistances;
	private DataColumnDefinition[][] dataModel;
	private DataColumnDefinition confidence;
	private DataColumnDefinition stratum;

	private DataColumnDefinition[][] usedModel;

	private boolean acceptRejectOption;
	private boolean showSourceName;
	private ThreadCreatorInterface threadCreator;
	private LoadingThread loadingThread;

	private Filter filter;
	private DataColumnDefinition[] sortColumns;
	private int[] sortOrder;

	private JLabel statusMsg = new JLabel(" ", JLabel.LEFT);

	private Object mutex = new Object();

	private JLabel sortStatus;
	private JLabel filterStatus;

	private JTextField positionField;

	private List details = new ArrayList();
	private AbstractDetailsDialog detailsWindow;

	private List decisionListeners = new ArrayList();

	private Window parentWindow;
	private JToolBar toolBar;
	private JPanel statusBar;

	public LinkagesWindowPanel(Window parent, DataColumnDefinition[][] columns, boolean showDataSourceName, DataColumnDefinition confidenceColumn, DataColumnDefinition stratum, DataColumnDefinition[][] comparedColumns, AbstractDistance[] distances, ThreadCreatorInterface threadCreator, boolean acceptRejectOption) {
		this.parentWindow = parent;
		this.threadCreator = threadCreator;
		this.showSourceName = showDataSourceName;
		this.dataModel = columns;
		this.usedModel = comparedColumns;
		this.comparedColumns = comparedColumns;
		this.confidence = confidenceColumn;
		this.stratum = stratum;
		this.acceptRejectOption = acceptRejectOption;
		this.compareDistances = distances;

		toolBar = createToolBar();
		statusBar = createStatusBar();

		if (this.usedModel == null) {
			this.usedModel = dataModel;
		}

		tableModel = new SpanTableModel(getDefaultColumns());

		if (acceptRejectOption) {
			linkages = new LinkagesPanel(
				new DecisionCellCreator(new ActionListener() {
					public void actionPerformed(ActionEvent e) {
						notifyListeners(true);
					}
				},
				new ActionListener() {
					public void actionPerformed(ActionEvent e) {
						notifyListeners(false);
					}
				}), tableModel, dataModel.length == 2, stratum != null);
		} else {
			linkages = new LinkagesPanel(tableModel, dataModel.length > 1, stratum != null);
			linkages.setTableModel(tableModel, decodeUsedDistance(usedModel), decodeUsedCompColumns(usedModel));
		}

		setLayout(new BorderLayout());
		add(toolBar, BorderLayout.PAGE_START);
		add(linkages, BorderLayout.CENTER);
		add(statusBar, BorderLayout.SOUTH);

		linkages.addMouseOverRowListener(new MouseOverRowListener() {
			public void mouseOverRow(int rowId) {
				if (detailsWindow != null) {
					detailsWindow.setDetail((DataRow) details.get(rowId));
				}
			}
		});

		loadingThread = threadCreator.createNewThread(threadCreator, this, null, null, null);
		loadingThread.start();
	}

	private JPanel createStatusBar() {
		JPanel panel = new JPanel(new GridBagLayout());
		JPanel msgPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
		statusMsg.setVerticalTextPosition(JLabel.CENTER);
		msgPanel.add(statusMsg);
		panel.add(msgPanel, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0,0,0,0), 0, 0));
		JPanel sortStatusPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5, 0));
		sortStatusPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
		sortStatusPanel.add(new JLabel("Sort:"));
		sortStatus = new JLabel(Configs.bulbOff);
		sortStatusPanel.add(sortStatus);
		JPanel filterStatusPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5, 0));
		filterStatusPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
		filterStatusPanel.add(new JLabel("Filter:"));
		filterStatus = new JLabel(Configs.bulbOff);
		filterStatusPanel.add(filterStatus);
		panel.add(sortStatusPanel, new GridBagConstraints(2, 0, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0,0,0,0), 0, 0));
		panel.add(filterStatusPanel, new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0,0,0,0), 0, 0));
		msgPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));

		JPanel navigation = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
		JButton forward = Configs.getForwardButton();
		JButton backward = Configs.getBackwardButton();
		navigation.add(backward);
		navigation.add(positionField = new JTextField("1", 3));
		positionField.setEditable(false);
		positionField.setHorizontalAlignment(JTextField.CENTER);
		positionField.setBorder(BorderFactory.createEmptyBorder());
		navigation.add(forward);
		panel.add(navigation, new GridBagConstraints(3, 0, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0,0,0,0), 0, 0));
		backward.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if (loadingThread.moveCursorBackward()) {
					positionField.setText(String.valueOf(Integer.parseInt(positionField.getText()) - 1));
				}
			}
		});
		forward.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if (loadingThread.moveCursorForward()) {
					positionField.setText(String.valueOf(Integer.parseInt(positionField.getText()) + 1));
				}
			}
		});

		panel.add(new JPanel(new FlowLayout(FlowLayout.LEFT, 10, 10)), new GridBagConstraints(4, 0, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0,0,0,0), 0, 0));

		return panel;
	}

	private JToolBar createToolBar() {
		JToolBar tb = new JToolBar();

		JButton save = Configs.getSaveButton();
		save.setMaximumSize(new Dimension(30, 30));
		save.setBorder(BorderFactory.createEmptyBorder());
		save.setToolTipText(SAVE_LINKAGES);
		tb.add(save);
		save.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				//int decision = JOptionPane.showOptionDialog(parentWindow, SAVE_MESSAGE, "Save data", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, SAVE_OPTIONS, SAVE_OPTIONS[0]);
				RecordSavingPanel panel = new RecordSavingPanel();
				OptionDialog dialog = new OptionDialog(parentWindow, "Save data");
				dialog.setMainPanel(panel);
				if (dialog.getResult() == OptionDialog.RESULT_OK) {
					JDialog d = new JDialog(parentWindow, "Saving data...");
					d.setSize(180, 80);
					d.setLocationRelativeTo(parentWindow);
					d.setLayout(new BorderLayout());
					d.add(new JLabel(Configs.busyIcon, JLabel.CENTER), BorderLayout.CENTER);
					d.setModal(true);
					d.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
					Worker w = new Worker();
					w.fileName = panel.getFileName();
					w.all = panel.isSaveAll();
					w.dialog = d;
					w.start();
					d.setVisible(true);
				}
			}
		});

		tb.addSeparator();

		JButton filter = Configs.getFilterButton();
		filter.setMaximumSize(new Dimension(30, 30));
		filter.setBorder(BorderFactory.createEmptyBorder());
		filter.setToolTipText(FILTER_LINKAGES);
		if (acceptRejectOption) {
			filter.setEnabled(false);
		}
		tb.add(filter);
		filter.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				OptionDialog dialog = new OptionDialog(parentWindow, CONFIGURE_FITER);
				DataColumnDefinition[] cols;
				if (dataModel.length == 1) {
					cols = new DataColumnDefinition[dataModel[0].length];
				} else {
					cols = new DataColumnDefinition[dataModel[0].length + dataModel[1].length];
				}
				System.arraycopy(dataModel[0], 0, cols, 0, dataModel[0].length);
				if (dataModel.length != 1) {
					System.arraycopy(dataModel[1], 0, cols, dataModel[0].length, dataModel[1].length);
				}
				FilterExpressionEditor expr = new FilterExpressionEditor(dialog, cols, LinkagesWindowPanel.this.filter);
				expr.setPreferredSize(new Dimension(500, 300));
				expr.setEnabled(true);
				expr.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
				dialog.setMainPanel(expr);
				dialog.setSize(400, 300);
				while (true) {
					if (dialog.getResult() == OptionDialog.RESULT_OK) {
						stopLoadingThread();
						synchronized (mutex) {
							resetTableSettings();
						}
						Filter f = null;
						try {
							loadingThread = threadCreator.createNewThread(threadCreator, LinkagesWindowPanel.this, f = expr.getFilter(), sortColumns, sortOrder);
							positionField.setText("1");
							loadingThread.start();
						} catch (RJException ex) {
							JXErrorDialog.showDialog(parentWindow, "Filter expression error", ex);
						}
						LinkagesWindowPanel.this.filter = f;
					}
					break;
				}
			}
		});

		JButton sort = Configs.getSortButton();
		sort.setMaximumSize(new Dimension(30, 30));
		sort.setBorder(BorderFactory.createEmptyBorder());
		sort.setToolTipText(SORT_LINKAGES);
		tb.add(sort);
		sort.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				OptionDialog dialog = new OptionDialog(parentWindow, CONFIGURE_SORTING);
				AbstractSortingEditor sortPanel = null;
				if (dataModel.length != 1) {
					sortPanel = new SortingEditor(dataModel, confidence, comparedColumns, sortColumns, sortOrder, showSourceName);
				} else {
					sortPanel = new SortingEditorSingleSource(dataModel, sortColumns, sortOrder, showSourceName);
				}
				dialog.setMainPanel(sortPanel);
				dialog.setSize(400, 300);
				if (dialog.getResult() == OptionDialog.RESULT_OK) {

					stopLoadingThread();
					synchronized (mutex) {
						resetTableSettings();
					}
					loadingThread = threadCreator.createNewThread(threadCreator, LinkagesWindowPanel.this, LinkagesWindowPanel.this.filter, sortColumns = sortPanel.getSortColumns(), sortOrder = sortPanel.getSortOrder());
					positionField.setText("1");
					loadingThread.start();

				}
			}
		});

		tb.addSeparator();

		JButton details = Configs.getDetailsButton();
		details.setMaximumSize(new Dimension(30, 30));
		details.setBorder(BorderFactory.createEmptyBorder());
		details.setToolTipText(LINKAGE_DETAILS);
		tb.add(details);
		details.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if (detailsWindow != null) {
					detailsWindow.toFront();
				} else {
					if (usedModel.length != 1) {
						detailsWindow = new DetailsDialog(parentWindow, comparedColumns, dataModel);
					} else {
						detailsWindow = new DetailsDialogSingleSource(parentWindow, dataModel);
					}
					detailsWindow.addWindowListener(new WindowAdapter() {
						public void windowClosed(WindowEvent e) {
							detailsWindow = null;
						}
						public void windowClosing(WindowEvent e) {
							detailsWindow = null;
						}
					});
					detailsWindow.setVisible(true);
				}
			}
		});

		tb.addSeparator();

		if (!acceptRejectOption) {
//			JButton minus = Configs.getAnalysisMinusButton();
//			minus.setMaximumSize(new Dimension(30, 30));
//			minus.setToolTipText(ANALYZE_MINUS);
//			tb.add(minus);
//			minus.addActionListener(new ActionListener() {
//				public void actionPerformed(ActionEvent e) {
//					JOptionPane.showMessageDialog(ViewLinkagesDialog.this, "FRIL-integrated viewer for not joined records is not yet implemented.\n\nTo see the not joined data, navigate to the disk location\nwhere the results are saved and locate the minus files.");
//				}
//			});
		} else {
			JButton addAll = new JButton(Configs.scale(Configs.addAllButtonIcon, 30, 30));
			addAll.setPreferredSize(new Dimension(30, 30));
			addAll.setMaximumSize(new Dimension(30, 30));
			addAll.setBorder(BorderFactory.createEmptyBorder());
			addAll.setToolTipText(ACCEPT_ALL_LINKAGES);
			tb.add(addAll);
			addAll.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
					//int option = JOptionPane.showOptionDialog(ViewLinkagesDialog.this, ACCEPT_ALL_QUESTION, ACCEPT_ALL_LINKAGES, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, ACCEPT_ALL_BUTTONS, ACCEPT_ALL_BUTTONS[0]);
					doLinkages(true);
				}
			});

			JButton removeAll = new JButton(Configs.scale(Configs.removeAllButtonIcon, 30, 30));
			removeAll.setPreferredSize(new Dimension(30, 30));
			removeAll.setMaximumSize(new Dimension(30, 30));
			removeAll.setBorder(BorderFactory.createEmptyBorder());
			removeAll.setToolTipText(REJECT_ALL_LINKAGES);
			tb.add(removeAll);
			removeAll.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
					//int option = JOptionPane.showOptionDialog(ViewLinkagesDialog.this, REJECT_ALL_QUESTION, REJECT_ALL_LINKAGES, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, REJECT_ALL_BUTTONS, REJECT_ALL_BUTTONS[0]);
					doLinkages(false);
				}
			});
		}

		tb.addSeparator();

		JButton prefs = new JButton(Configs.scale(Configs.configurationButtonIconBig, 30, 30));
		prefs.setPreferredSize(new Dimension(30, 30));
		prefs.setMaximumSize(new Dimension(30, 30));
		prefs.setBorder(BorderFactory.createEmptyBorder());
		prefs.setToolTipText(VIEW_PREFERENCES);
		tb.add(prefs);
		prefs.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				AbstractColumnConfigDialog dialog;
				if (dataModel.length != 1) {
					dialog = new ColumnConfigDialog(parentWindow, linkages.getColors(), comparedColumns, dataModel, usedModel);
				} else {
					dialog = new ColumnConfigDialogSingleSource(parentWindow, linkages.getColors(), dataModel, usedModel);
				}
				dialog.setLocationRelativeTo(parentWindow);
				if (dialog.getResult() == ColumnConfigDialog.RESULT_OK) {
					stopLoadingThread();
					synchronized (mutex) {
						usedModel = dialog.getConfiguredColumns();
						tableModel = new SpanTableModel(getDefaultColumns());
						linkages.setTableModel(tableModel, decodeUsedDistance(usedModel), decodeUsedCompColumns(usedModel));
						linkages.setColors(dialog.getColorConfig());
						LinkagesWindowPanel.this.details.clear();
					}
					loadingThread = threadCreator.createNewThread(threadCreator, LinkagesWindowPanel.this, LinkagesWindowPanel.this.filter, sortColumns, sortOrder);
					positionField.setText("1");
					loadingThread.start();
				}
			}
		});

		return tb;
	}

	private Object[] getDefaultColumns() {
		int extraCols = (acceptRejectOption ? 1 : 0) + (stratum != null ? 1 : 0);
		String[] names = new String[usedModel[0].length + extraCols + (usedModel.length == 1 ? 0 : 1)];
		if (acceptRejectOption) {
			names[0] = "Decision";
		}
		if (usedModel.length > 1) {
			names[acceptRejectOption ? 1 : 0] = CONFIDENCE;
		}
		if (stratum != null) {
			names[extraCols] = STRATUM_NAME;
		}

		if (usedModel.length == 1) {
			for (int i = 0; i < names.length - extraCols; i++) {
				names[i + extraCols] = (showSourceName ? usedModel[0][i].toString() : usedModel[0][i].getColumnName());
			}
		} else {
			for (int i = 1; i < names.length - extraCols; i++) {
				if (usedModel[0][i-1] == null) {
					names[i + extraCols] = " --- / " + (showSourceName ? usedModel[1][i-1].toString() : usedModel[1][i-1].getColumnName());
				} else if (usedModel[1][i-1] == null) {
					names[i + extraCols] = (showSourceName ? usedModel[0][i-1].toString() : usedModel[0][i-1].getColumnName()) + " / --- ";
				} else {
					names[i + extraCols] = (showSourceName ? usedModel[0][i-1].toString() : usedModel[0][i-1].getColumnName()) + " / " +
									(showSourceName ? usedModel[1][i-1].toString() : usedModel[1][i-1].getColumnName());
				}
			}
		}
		return names;
	}

	public void addLinkage(DataRow linkage) throws InterruptedException {
		synchronized (mutex) {
			int extraColumns = (acceptRejectOption ? 1 : 0) + (stratum != null ? 1 : 0);
			String[][] data = new String[2][usedModel[0].length + 1 + extraColumns];
			String conf = linkage.getProperty(AbstractJoin.PROPERTY_CONFIDNCE);
			if (conf == null) {
				conf = linkage.getData(CONFIDENCE).getValue().toString();
			}
			data[0][acceptRejectOption ? 1 : 0] = conf;
			for (int i = 1; i < data[0].length - extraColumns; i++) {
				if (usedModel[0][i - 1] != null) {
					data[0][i + extraColumns] = linkage.getData(usedModel[0][i - 1]).getValue().toString();
				} else {
					data[0][i + extraColumns] = null;
				}
				if (usedModel[1][i - 1] != null) {
					data[1][i + extraColumns] = linkage.getData(usedModel[1][i - 1]).getValue().toString();
				} else {
					data[1][i + extraColumns] = null;
				}
			}
			if (stratum != null) {
				data[0][acceptRejectOption ? 2 : 1] = linkage.getData(stratum).getValue().toString();
			}

			details.add(linkage);

			Adder doRun;
			if (acceptRejectOption) {
				if (stratum != null) {
					doRun = new Adder(data, new SpanInfo[] {new SpanInfo(0, 0, 1, 2), new SpanInfo(0, 1, 1, 2), new SpanInfo(0, 2, 1, 2)});
				} else {
					doRun = new Adder(data, new SpanInfo[] {new SpanInfo(0, 0, 1, 2), new SpanInfo(0, 1, 1, 2)});
				}
			} else {
				if (stratum != null) {
					doRun = new Adder(data, new SpanInfo[] {new SpanInfo(0, 0, 1, 2), new SpanInfo(0, 1, 1, 2)});
				} else {
					doRun = new Adder(data, new SpanInfo[] {new SpanInfo(0, 0, 1, 2)});
				}
			}
//			try {
//				SwingUtilities.invokeAndWait(doRun);
//			} catch (InvocationTargetException e) {
//				e.printStackTrace();
//			} catch (InterruptedException e) {
//				doRun.ignore();
//				throw e;
//			}
			SwingUtilities.invokeLater(doRun);
		}

	}

	public void addRecord(DataRow record) throws InterruptedException {
		synchronized (mutex) {
			int extraColumns = (acceptRejectOption ? 1 : 0) + (stratum != null ? 1 : 0);
			String[][] data = new String[1][usedModel[0].length + extraColumns];
			for (int i = 0; i < data[0].length - extraColumns; i++) {
				data[0][i + extraColumns] = record.getData(usedModel[0][i]).getValue().toString();
			}
			if (stratum != null) {
				data[0][acceptRejectOption ? 2 : 1] = record.getData(stratum).getValue().toString();
			}

			details.add(record);

			Adder doRun = new Adder(data, new SpanInfo[] {});
			try {
				SwingUtilities.invokeAndWait(doRun);
			} catch (InvocationTargetException e) {
				e.printStackTrace();
			} catch (InterruptedException e) {
				doRun.ignore();
				throw e;
			}

		}

	}

	public void setStatusBarMessage(String string) {
		statusMsg.setText(string);
	}

	public void setFilterOn(boolean filter) {
		filterStatus.setIcon(filter ? Configs.bulbOn : Configs.bulbOff);
		filterStatus.repaint();
	}

	public void setSortOn(boolean sort) {
		sortStatus.setIcon(sort ? Configs.bulbOn : Configs.bulbOff);
		sortStatus.repaint();
	}

	private class Adder implements Runnable {
		private String[][] data;
		private SpanInfo[] spanInfos;
		private volatile boolean ignore = false;
		public Adder(String[][] data, SpanInfo[] spanInfos) {
			this.data = data;
			this.spanInfos = spanInfos;
		}
		public void run() {
			if (!ignore) {
				tableModel.addSpannedRows(data, spanInfos);
			}
		}
		public void ignore() {
			ignore = true;
		}
	}

	public int getRecordsPerPage() {
		return RECORDS_PER_PAGE;
	}

	public void clearTable() {
		synchronized (mutex) {
			Clearer c = new Clearer();
			try {
				SwingUtilities.invokeAndWait(c);
				details.clear();
			} catch (InterruptedException e) {
				c.ignore = true;
			} catch (InvocationTargetException e) {
				e.printStackTrace();
				c.ignore = true;
			}
		}
	}

	private class Clearer implements Runnable {

		boolean ignore = false;

		public void run() {
			if (!ignore) {
				tableModel = new SpanTableModel(getDefaultColumns());
				linkages.setTableModel(tableModel, true, decodeUsedDistance(usedModel), decodeUsedCompColumns(usedModel));
			}
		}

	}

	class Worker extends Thread {
		protected JDialog dialog;
		private boolean all;
		private String fileName;

		public void run() {
			try {
				sleep(500);
			} catch (InterruptedException e) {}
			loadingThread.saveToFile(fileName, all);
			dialog.setVisible(false);
		}
	}

	private void doLinkages(boolean acceptReject) {
		//stopLoadingThread();
		for (Iterator iterator = details.iterator(); iterator.hasNext();) {
			DataRow row = (DataRow) iterator.next();
			notifyAllListeners(acceptReject, row);
		}
		loadingThread.updateCursor();
	}

	private void notifyListeners(boolean accepted) {
		int rId = linkages.getSelectedLinkage();
		DataRow linkage = (DataRow) details.remove(rId);
		tableModel.removeRow(rId * 2);
		notifyAllListeners(accepted, linkage);
		loadingThread.updateCursor();
	}

	public void setVisible(boolean aFlag) {
		if (!aFlag) {
			stopLoadingThread();
		}
	}

	private void notifyAllListeners(boolean accepted, DataRow linkage) {
		for (Iterator iterator = decisionListeners.iterator(); iterator.hasNext();) {
			DecisionListener l = (DecisionListener) iterator.next();
			if (accepted) {
				l.linkageAccepted(linkage);
			} else {
				l.linkageRejected(linkage);
			}
		}
	}

	private void stopLoadingThread() {
		loadingThread.cancelReading();
		try {
			loadingThread.join();
		} catch (InterruptedException e1) {
			e1.printStackTrace();
		}
	}

	public DataRow[] getVisibleRows() {
		return (DataRow[]) details.toArray(new DataRow[] {});
	}

	public void addDecisionListener(DecisionListener l) {
		decisionListeners.add(l);
	}

	public void removeDecisionListener(DecisionListener l) {
		decisionListeners.add(l);
	}

	public void removeAllDecisionListeners() {
		decisionListeners.clear();
	}

	public void cancelThread() {
		if (loadingThread != null) {
			loadingThread.cancelReading();
		}
	}

	public JPanel getStatusBar() {
		return statusBar;
	}

	public JToolBar getToolBar() {
		return toolBar;
	}

	private void resetTableSettings() {
		tableModel = new SpanTableModel(getDefaultColumns());
		//usedModel = dataModel;
		linkages.setTableModel(tableModel, true, decodeUsedDistance(usedModel), decodeUsedCompColumns(usedModel));
		details.clear();
	}

	private AbstractDistance[] decodeUsedDistance(DataColumnDefinition[][] usedModel) {
		if (usedModel.length == 1) {
			return null;
		}
		List dst = new ArrayList();
		for (int i = 0; i < usedModel[0].length; i++) {
			if (usedModel[0][i] != null && usedModel[1][i] != null) {
				int id = getComparedId(i, usedModel);
				dst.add(compareDistances[id]);
			}
		}
		return (AbstractDistance[]) dst.toArray(new AbstractDistance[] {});
	}

	private DataColumnDefinition[][] decodeUsedCompColumns(DataColumnDefinition[][] usedModel) {
		if (usedModel.length == 1) {
			return null;
		}
		List usedCols = new ArrayList();
		for (int i = 0; i < usedModel[0].length; i++) {
			if (usedModel[0][i] != null && usedModel[1][i] != null) {
				int id = getComparedId(i, usedModel);
				usedCols.add(new DataColumnDefinition[] {comparedColumns[0][id], comparedColumns[1][id]});
			}
		}
		return (DataColumnDefinition[][]) usedCols.toArray(new DataColumnDefinition[][] {});
	}

	private int getComparedId(int i, DataColumnDefinition[][] usedModel) {
		for (int j = 0; j < comparedColumns[0].length; j++) {
			if (comparedColumns[0][j].equals(usedModel[0][i]) && comparedColumns[1][j].equals(usedModel[1][i])) {
				return j;
			}
		}
		return -1;
	}

	public DataColumnDefinition[][] getUsedModel() {
		return usedModel;
	}
}


text:
#ifndef IDBPendingTransactionMonitor_h
#define IDBPendingTransactionMonitor_h

#include "platform/heap/Handle.h"
#include "wtf/Noncopyable.h"

namespace blink {

class IDBTransaction;

// This class keeps track of the transactions created during the current
// Javascript execution context. Transactions have an internal |active| flag
// which is set to true on creation, but must be set to false when control
// returns to the event loop.
class IDBPendingTransactionMonitor {
    WTF_MAKE_NONCOPYABLE(IDBPendingTransactionMonitor);

public:
    IDBPendingTransactionMonitor();

    void addNewTransaction(IDBTransaction&);
    void deactivateNewTransactions();

private:
    PersistentHeapVector<Member<IDBTransaction> > m_transactions;
};

} // namespace blink

#endif // IDBPendingTransactionMonitor_h


text:
class LuaAnimationDef final
{
    static int Create(lua_State *f_vm);
    static int GetBonesCount(lua_State *f_vm);
    static int GetDuration(lua_State *f_vm);
protected:
    static void Init(lua_State *f_vm);

    friend class LuaVM;
};