text:
package experiment.percongress;

import data.Congress;
import data.TextDataset;
import data.Vote;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Random;
import org.apache.commons.cli.ParseException;
import util.CLIUtils;
import util.IOUtils;

/**
 *
 * @author vietan
 */
public class HeldoutVotePredExpt extends VotePredExpt {

    @Override
    public String getConfiguredExptFolder() {
        return "heldout-vote-cv-" + numFolds + "-" + teRatio + "-" + trToDevRatio;
    }

    @Override
    public void run() {
        if (verbose) {
            logln("Running ...");
        }
        ArrayList<Integer> runningFolds = new ArrayList<Integer>();
        if (cmd.hasOption("fold")) {
            String foldList = cmd.getOptionValue("fold");
            for (String f : foldList.split(",")) {
                runningFolds.add(Integer.parseInt(f));
            }
        }

        loadFormattedData();

        setupSampling();

        File configureFolder = new File(new File(experimentPath, congressNum),
                getConfiguredExptFolder());

        for (int ff = 0; ff < numFolds; ff++) {
            if (!runningFolds.isEmpty() && !runningFolds.contains(ff)) {
                continue;
            }
            if (verbose) {
                logln("--- Running fold " + ff);
            }

            File foldFolder = new File(configureFolder, "fold-" + ff);
            IOUtils.createFolder(foldFolder);

            inputCrossValidatedVotes(ff);

            runModel(foldFolder);
        }
        evaluate();
    }

    @Override
    public void preprocess() {
        if (verbose) {
            logln("Preprocessing ...");
        }
        try {
            loadFormattedData();
            outputCrossValidatedVotes();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("Exception while preprocessing");
        }
    }

    /**
     * Create and output cross-validated data.
     *
     * @throws java.lang.Exception
     */
    private void outputCrossValidatedVotes() throws Exception {
        File cvFolder = new File(processedDataFolder, getConfiguredExptFolder());
        IOUtils.createFolder(cvFolder);

        if (verbose) {
            logln("--- Outputing cross-validated data to " + cvFolder);
        }

        Random rand = new Random(1);
        double[] probs = new double[2];
        probs[0] = teRatio; // for test
        probs[1] = probs[0] + (1.0 - probs[0]) * trToDevRatio;
        for (int ff = 0; ff < numFolds; ff++) {
            BufferedWriter writer = IOUtils.getBufferedWriter(new File(cvFolder,
                    "fold-" + ff + ".dat"));
            writer.write(votes.length + "\n");

            int numTrain = 0;
            int numDev = 0;
            int numTest = 0;

            trainVotes = new boolean[votes.length][];
            devVotes = new boolean[votes.length][];
            testVotes = new boolean[votes.length][];

            for (int aa = 0; aa < votes.length; aa++) {
                writer.write(aa + "\t" + votes[aa].length);
                for (int vv = 0; vv < votes[aa].length; vv++) {
                    if (votes[aa][vv] == Vote.MISSING) {
                        writer.write("\t" + Vote.MISSING);
                        continue;
                    }
                    double val = rand.nextDouble();
                    if (val < probs[0]) {
                        writer.write("\t" + TEST_POSFIX);
                        numTest++;
                    } else if (val < probs[1]) {
                        writer.write("\t" + TRAIN_POSFIX);
                        numTrain++;
                    } else {
                        writer.write("\t" + DEV_POSFIX);
                        numDev++;
                    }
                }
                writer.write("\n");
            }

            if (verbose) {
                logln("--- Fold " + ff);
                logln("--- --- # training votes: " + numTrain);
                logln("--- --- # development votes: " + numDev);
                logln("--- --- # test votes: " + numTest);
            }

            writer.close();
        }
    }

    /**
     * Load cross-validated data.
     *
     * @param ff Fold index
     */
    private void inputCrossValidatedVotes(int ff) {
        File cvFolder = new File(processedDataFolder, getConfiguredExptFolder());
        try {
            BufferedReader reader = IOUtils.getBufferedReader(new File(cvFolder,
                    "fold-" + ff + ".dat"));
            int numAuthors = Integer.parseInt(reader.readLine());

            trainVotes = new boolean[numAuthors][];
            devVotes = new boolean[numAuthors][];
            testVotes = new boolean[numAuthors][];
            int numTrain = 0;
            int numDev = 0;
            int numTest = 0;
            for (int aa = 0; aa < numAuthors; aa++) {
                String[] sline = reader.readLine().split("\t");
                if (aa != Integer.parseInt(sline[0])) {
                    throw new RuntimeException("Mismatch");
                }
                int voteLength = Integer.parseInt(sline[1]);
                if (voteLength != sline.length - 2) {
                    throw new RuntimeException("Mismatch. " + voteLength
                            + " vs. " + (sline.length - 2));
                }
                trainVotes[aa] = new boolean[voteLength];
                devVotes[aa] = new boolean[voteLength];
                testVotes[aa] = new boolean[voteLength];
                for (int ii = 0; ii < voteLength; ii++) {
                    switch (sline[ii + 2]) {
                        case TRAIN_POSFIX:
                            trainVotes[aa][ii] = true;
                            numTrain++;
                            break;
                        case DEV_POSFIX:
                            devVotes[aa][ii] = true;
                            numDev++;
                            break;
                        case TEST_POSFIX:
                            testVotes[aa][ii] = true;
                            numTest++;
                            break;
                    }
                }
            }
            reader.close();

            this.trainAuthorIndices = new ArrayList<>();
            for (int aa = 0; aa < numAuthors; aa++) {
                this.trainAuthorIndices.add(aa);
            }

            this.trainBillIndices = new ArrayList<>();
            for (int bb = 0; bb < trainVotes[0].length; bb++) {
                this.trainBillIndices.add(bb);
            }

            if (verbose) {
                logln("--- Fold " + ff + " loaded");
                logln("--- --- # training votes: " + numTrain);
                logln("--- --- # development votes: " + numDev);
                logln("--- --- # test votes: " + numTest);
            }
        } catch (IOException | RuntimeException e) {
            e.printStackTrace();
            throw new RuntimeException("Exception while inputing cross-validated votes");
        }
    }

    public static void main(String[] args) {
        try {
            long sTime = System.currentTimeMillis();

            addOptions();

            cmd = parser.parse(options, args);
            if (cmd.hasOption("help")) {
                CLIUtils.printHelp(getHelpString(HeldoutVotePredExpt.class
                        .getName()), options);
                return;
            }

            verbose = cmd.hasOption("v");
            debug = cmd.hasOption("d");

            Congress.setVerbose(verbose);
            Congress.setDebug(debug);
            TextDataset.setDebug(debug);
            TextDataset.setVerbose(verbose);

            HeldoutVotePredExpt expt = new HeldoutVotePredExpt();
            expt.setup();
            String runMode = CLIUtils.getStringArgument(cmd, "run-mode", "run");
            switch (runMode) {
                case "run":
                    expt.run();
                    break;
                case "evaluate":
                    expt.evaluate();
                    break;
                case "create-cv":
                    expt.preprocess();
                    break;
                default:
                    throw new RuntimeException("Run mode " + runMode + " is not supported");
            }

            // date and time
            DateFormat df = new SimpleDateFormat("dd/MM/yy HH:mm:ss");
            Date dateobj = new Date();
            long eTime = (System.currentTimeMillis() - sTime) / 1000;
            System.out.println("Elapsed time: " + eTime + "s");
            System.out.println("End time: " + df.format(dateobj));
        } catch (RuntimeException | ParseException e) {
            e.printStackTrace();
        }
    }
}


text:
module Pk
{
    export module PkTransitionAnimation
    {
        export class Default implements Pk.I.TransitionAnimation {

            public event:PkEvent = new PkEvent('PkTADefault', this);

            start()
            {
                // animation here
                // ...

                this.event.dispatch(Pk.E.OnTransitionEndStart);
            }

            end()
            {
                // animation here
                // ...

                this.event.dispatch(Pk.E.OnTransitionEndEnd);
            }
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
Food::Food(GamefieldPtr mGamefield, uint32_t mId, const Vector& mPosition) :
		Element(mGamefield, mId, mPosition, mGamefield->getOptions().food.color, mGamefield->getOptions().food.size,
				mGamefield->getOptions().food.mass) {

}


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.jenkins-ci.plugins</groupId>
    <artifactId>plugin</artifactId>
    <version>4.41</version>
    <relativePath />
  </parent>

  <groupId>org.jenkins-ci.plugins</groupId>
  <artifactId>repo</artifactId>
  <version>1.16.1-SNAPSHOT</version>
  <packaging>hpi</packaging>
  <name>Jenkins REPO plugin</name>
  <description>Integrates Jenkins with REPO SCM</description>
  <url>https://github.com/jenkinsci/repo-plugin/blob/master/README.adoc</url>

  <properties>
    <revision>1.15.1</revision>
    <changelist>-SNAPSHOT</changelist>
    <jenkins.version>2.346.1</jenkins.version>
    <java.level>8</java.level>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  </properties>

  <licenses>
    <license>
      <name>MIT</name>
      <url>http://www.opensource.org/licenses/mit-license.php</url>
      <comments>Copyright 2011 Brad Larson. All rights reserved.</comments>
    </license>
  </licenses>

  <developers>
    <developer>
      <id>rsandell</id>
      <name>Robert Sandell</name>
      <email>rsandell@cloudbees.com</email>
      <roles>
        <role>babysitter</role>
      </roles>
      <timezone>+1</timezone>
    </developer>
    <developer>
      <id>aep</id>
      <name>Arvid E. Picciani</name>
      <email>aep-jenkins@exys.org</email>
      <roles>
        <role>developer</role>
        <role>maintainer</role>
      </roles>
      <timezone>+1</timezone>
    </developer>
    <developer>
      <id>bjarkef</id>
      <name>Bjarke Freund-Hansen</name>
      <email>bjarkefh@gmail.com</email>
      <roles>
        <role>developer</role>
        <role>maintainer</role>
      </roles>
      <timezone>+1</timezone>
    </developer>
    <developer>
      <id>bklarson</id>
      <name>Brad Larson</name>
      <email>bklarson@gmail.com</email>
      <roles>
        <role>developer</role>
        <role>maintainer</role>
      </roles>
      <timezone>-6</timezone>
    </developer>
  </developers>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>2.17</version>
        <configuration>
          <configLocation>checkstyle.xml</configLocation>
          <failsOnError>true</failsOnError>
          <consoleOutput>true</consoleOutput>
        </configuration>
        <executions>
          <execution>
            <id>compile-checkstyle</id>
            <goals>
              <goal>checkstyle</goal>
            </goals>
            <phase>compile</phase>
          </execution>
          <execution>
            <id>test-check</id>
            <goals>
              <goal>check</goal>
            </goals>
            <phase>test</phase>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jxr-plugin</artifactId>
      </plugin>
    </plugins>
  </reporting>

  <dependencies>

  </dependencies>

  <distributionManagement>
    <repository>
      <id>maven.jenkins-ci.org</id>
      <url>https://repo.jenkins-ci.org/releases</url>
    </repository>
  </distributionManagement>

  <scm>
    <connection>scm:git:git://github.com/jenkinsci/repo-plugin.git</connection>
    <developerConnection>scm:git:git@github.com:jenkinsci/repo-plugin.git</developerConnection>
    <url>http://github.com/jenkinsci/repo-plugin</url>
    <tag>HEAD</tag>
  </scm>

    <repositories>
        <repository>
            <id>repo.jenkins-ci.org</id>
            <url>https://repo.jenkins-ci.org/public/</url>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>repo.jenkins-ci.org</id>
            <url>https://repo.jenkins-ci.org/public/</url>
        </pluginRepository>
    </pluginRepositories>
</project>


text:
namespace java.util
{
	[global::MonoJavaBridge.JavaClass()]
	public partial class Vector : java.util.AbstractList, List, RandomAccess, java.lang.Cloneable, java.io.Serializable
	{
		internal new static global::MonoJavaBridge.JniGlobalHandle staticClass;
		protected Vector(global::MonoJavaBridge.JNIEnv @__env) : base(@__env)
		{
		}
		private static global::MonoJavaBridge.MethodId _m0;
		public override void add(int arg0, java.lang.Object arg1)
		{
			global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::java.util.Vector.staticClass, "add", "(ILjava/lang/Object;)V", ref global::java.util.Vector._m0, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
		}
		private static global::MonoJavaBridge.MethodId _m1;
		public override bool add(java.lang.Object arg0)
		{
			return global::MonoJavaBridge.JavaBridge.CallBooleanMethod(this, global::java.util.Vector.staticClass, "add", "(Ljava/lang/Object;)Z", ref global::java.util.Vector._m1, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m2;
		public override global::java.lang.Object get(int arg0)
		{
			return global::MonoJavaBridge.JavaBridge.CallObjectMethod(this, global::java.util.Vector.staticClass, "get", "(I)Ljava/lang/Object;", ref global::java.util.Vector._m2, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0)) as java.lang.Object;
		}
		private static global::MonoJavaBridge.MethodId _m3;
		public override bool equals(java.lang.Object arg0)
		{
			return global::MonoJavaBridge.JavaBridge.CallBooleanMethod(this, global::java.util.Vector.staticClass, "equals", "(Ljava/lang/Object;)Z", ref global::java.util.Vector._m3, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m4;
		public override global::java.lang.String toString()
		{
			return global::MonoJavaBridge.JavaBridge.CallSealedClassObjectMethod<java.lang.String>(this, global::java.util.Vector.staticClass, "toString", "()Ljava/lang/String;", ref global::java.util.Vector._m4) as java.lang.String;
		}
		private static global::MonoJavaBridge.MethodId _m5;
		public override int hashCode()
		{
			return global::MonoJavaBridge.JavaBridge.CallIntMethod(this, global::java.util.Vector.staticClass, "hashCode", "()I", ref global::java.util.Vector._m5);
		}
		private static global::MonoJavaBridge.MethodId _m6;
		public virtual global::java.lang.Object clone()
		{
			return global::MonoJavaBridge.JavaBridge.CallObjectMethod(this, global::java.util.Vector.staticClass, "clone", "()Ljava/lang/Object;", ref global::java.util.Vector._m6) as java.lang.Object;
		}
		private static global::MonoJavaBridge.MethodId _m7;
		public override int indexOf(java.lang.Object arg0)
		{
			return global::MonoJavaBridge.JavaBridge.CallIntMethod(this, global::java.util.Vector.staticClass, "indexOf", "(Ljava/lang/Object;)I", ref global::java.util.Vector._m7, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m8;
		public virtual int indexOf(java.lang.Object arg0, int arg1)
		{
			return global::MonoJavaBridge.JavaBridge.CallIntMethod(this, global::java.util.Vector.staticClass, "indexOf", "(Ljava/lang/Object;I)I", ref global::java.util.Vector._m8, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
		}
		private static global::MonoJavaBridge.MethodId _m9;
		public override void clear()
		{
			global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::java.util.Vector.staticClass, "clear", "()V", ref global::java.util.Vector._m9);
		}
		private static global::MonoJavaBridge.MethodId _m10;
		public override bool isEmpty()
		{
			return global::MonoJavaBridge.JavaBridge.CallBooleanMethod(this, global::java.util.Vector.staticClass, "isEmpty", "()Z", ref global::java.util.Vector._m10);
		}
		private static global::MonoJavaBridge.MethodId _m11;
		public virtual int lastIndexOf(java.lang.Object arg0, int arg1)
		{
			return global::MonoJavaBridge.JavaBridge.CallIntMethod(this, global::java.util.Vector.staticClass, "lastIndexOf", "(Ljava/lang/Object;I)I", ref global::java.util.Vector._m11, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
		}
		private static global::MonoJavaBridge.MethodId _m12;
		public override int lastIndexOf(java.lang.Object arg0)
		{
			return global::MonoJavaBridge.JavaBridge.CallIntMethod(this, global::java.util.Vector.staticClass, "lastIndexOf", "(Ljava/lang/Object;)I", ref global::java.util.Vector._m12, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m13;
		public override bool contains(java.lang.Object arg0)
		{
			return global::MonoJavaBridge.JavaBridge.CallBooleanMethod(this, global::java.util.Vector.staticClass, "contains", "(Ljava/lang/Object;)Z", ref global::java.util.Vector._m13, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m14;
		public override bool addAll(java.util.Collection arg0)
		{
			return global::MonoJavaBridge.JavaBridge.CallBooleanMethod(this, global::java.util.Vector.staticClass, "addAll", "(Ljava/util/Collection;)Z", ref global::java.util.Vector._m14, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m15;
		public override bool addAll(int arg0, java.util.Collection arg1)
		{
			return global::MonoJavaBridge.JavaBridge.CallBooleanMethod(this, global::java.util.Vector.staticClass, "addAll", "(ILjava/util/Collection;)Z", ref global::java.util.Vector._m15, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
		}
		private static global::MonoJavaBridge.MethodId _m16;
		public override int size()
		{
			return global::MonoJavaBridge.JavaBridge.CallIntMethod(this, global::java.util.Vector.staticClass, "size", "()I", ref global::java.util.Vector._m16);
		}
		private static global::MonoJavaBridge.MethodId _m17;
		public override global::java.lang.Object[] toArray(java.lang.Object[] arg0)
		{
			return global::MonoJavaBridge.JavaBridge.CallArrayObjectMethod<java.lang.Object>(this, global::java.util.Vector.staticClass, "toArray", "([Ljava/lang/Object;)[Ljava/lang/Object;", ref global::java.util.Vector._m17, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0)) as java.lang.Object[];
		}
		private static global::MonoJavaBridge.MethodId _m18;
		public override global::java.lang.Object[] toArray()
		{
			return global::MonoJavaBridge.JavaBridge.CallArrayObjectMethod<java.lang.Object>(this, global::java.util.Vector.staticClass, "toArray", "()[Ljava/lang/Object;", ref global::java.util.Vector._m18) as java.lang.Object[];
		}
		private static global::MonoJavaBridge.MethodId _m19;
		public virtual void addElement(java.lang.Object arg0)
		{
			global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::java.util.Vector.staticClass, "addElement", "(Ljava/lang/Object;)V", ref global::java.util.Vector._m19, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m20;
		public virtual global::java.lang.Object elementAt(int arg0)
		{
			return global::MonoJavaBridge.JavaBridge.CallObjectMethod(this, global::java.util.Vector.staticClass, "elementAt", "(I)Ljava/lang/Object;", ref global::java.util.Vector._m20, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0)) as java.lang.Object;
		}
		private static global::MonoJavaBridge.MethodId _m21;
		public override global::java.lang.Object remove(int arg0)
		{
			return global::MonoJavaBridge.JavaBridge.CallObjectMethod(this, global::java.util.Vector.staticClass, "remove", "(I)Ljava/lang/Object;", ref global::java.util.Vector._m21, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0)) as java.lang.Object;
		}
		private static global::MonoJavaBridge.MethodId _m22;
		public override bool remove(java.lang.Object arg0)
		{
			return global::MonoJavaBridge.JavaBridge.CallBooleanMethod(this, global::java.util.Vector.staticClass, "remove", "(Ljava/lang/Object;)Z", ref global::java.util.Vector._m22, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m23;
		public virtual global::java.util.Enumeration elements()
		{
			return global::MonoJavaBridge.JavaBridge.CallIJavaObjectMethod<java.util.Enumeration>(this, global::java.util.Vector.staticClass, "elements", "()Ljava/util/Enumeration;", ref global::java.util.Vector._m23) as java.util.Enumeration;
		}
		private static global::MonoJavaBridge.MethodId _m24;
		public override global::java.lang.Object set(int arg0, java.lang.Object arg1)
		{
			return global::MonoJavaBridge.JavaBridge.CallObjectMethod(this, global::java.util.Vector.staticClass, "set", "(ILjava/lang/Object;)Ljava/lang/Object;", ref global::java.util.Vector._m24, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1)) as java.lang.Object;
		}
		private static global::MonoJavaBridge.MethodId _m25;
		public virtual void copyInto(java.lang.Object[] arg0)
		{
			global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::java.util.Vector.staticClass, "copyInto", "([Ljava/lang/Object;)V", ref global::java.util.Vector._m25, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m26;
		public virtual void trimToSize()
		{
			global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::java.util.Vector.staticClass, "trimToSize", "()V", ref global::java.util.Vector._m26);
		}
		private static global::MonoJavaBridge.MethodId _m27;
		public virtual void ensureCapacity(int arg0)
		{
			global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::java.util.Vector.staticClass, "ensureCapacity", "(I)V", ref global::java.util.Vector._m27, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m28;
		public virtual void setSize(int arg0)
		{
			global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::java.util.Vector.staticClass, "setSize", "(I)V", ref global::java.util.Vector._m28, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m29;
		public virtual int capacity()
		{
			return global::MonoJavaBridge.JavaBridge.CallIntMethod(this, global::java.util.Vector.staticClass, "capacity", "()I", ref global::java.util.Vector._m29);
		}
		private static global::MonoJavaBridge.MethodId _m30;
		public virtual global::java.lang.Object firstElement()
		{
			return global::MonoJavaBridge.JavaBridge.CallObjectMethod(this, global::java.util.Vector.staticClass, "firstElement", "()Ljava/lang/Object;", ref global::java.util.Vector._m30) as java.lang.Object;
		}
		private static global::MonoJavaBridge.MethodId _m31;
		public virtual global::java.lang.Object lastElement()
		{
			return global::MonoJavaBridge.JavaBridge.CallObjectMethod(this, global::java.util.Vector.staticClass, "lastElement", "()Ljava/lang/Object;", ref global::java.util.Vector._m31) as java.lang.Object;
		}
		private static global::MonoJavaBridge.MethodId _m32;
		public virtual void setElementAt(java.lang.Object arg0, int arg1)
		{
			global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::java.util.Vector.staticClass, "setElementAt", "(Ljava/lang/Object;I)V", ref global::java.util.Vector._m32, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
		}
		private static global::MonoJavaBridge.MethodId _m33;
		public virtual void removeElementAt(int arg0)
		{
			global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::java.util.Vector.staticClass, "removeElementAt", "(I)V", ref global::java.util.Vector._m33, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m34;
		public virtual void insertElementAt(java.lang.Object arg0, int arg1)
		{
			global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::java.util.Vector.staticClass, "insertElementAt", "(Ljava/lang/Object;I)V", ref global::java.util.Vector._m34, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
		}
		private static global::MonoJavaBridge.MethodId _m35;
		public virtual bool removeElement(java.lang.Object arg0)
		{
			return global::MonoJavaBridge.JavaBridge.CallBooleanMethod(this, global::java.util.Vector.staticClass, "removeElement", "(Ljava/lang/Object;)Z", ref global::java.util.Vector._m35, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m36;
		public virtual void removeAllElements()
		{
			global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::java.util.Vector.staticClass, "removeAllElements", "()V", ref global::java.util.Vector._m36);
		}
		private static global::MonoJavaBridge.MethodId _m37;
		public override bool containsAll(java.util.Collection arg0)
		{
			return global::MonoJavaBridge.JavaBridge.CallBooleanMethod(this, global::java.util.Vector.staticClass, "containsAll", "(Ljava/util/Collection;)Z", ref global::java.util.Vector._m37, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m38;
		public override bool removeAll(java.util.Collection arg0)
		{
			return global::MonoJavaBridge.JavaBridge.CallBooleanMethod(this, global::java.util.Vector.staticClass, "removeAll", "(Ljava/util/Collection;)Z", ref global::java.util.Vector._m38, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m39;
		public override bool retainAll(java.util.Collection arg0)
		{
			return global::MonoJavaBridge.JavaBridge.CallBooleanMethod(this, global::java.util.Vector.staticClass, "retainAll", "(Ljava/util/Collection;)Z", ref global::java.util.Vector._m39, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m40;
		public override global::java.util.List subList(int arg0, int arg1)
		{
			return global::MonoJavaBridge.JavaBridge.CallIJavaObjectMethod<java.util.List>(this, global::java.util.Vector.staticClass, "subList", "(II)Ljava/util/List;", ref global::java.util.Vector._m40, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1)) as java.util.List;
		}
		private static global::MonoJavaBridge.MethodId _m41;
		protected override void removeRange(int arg0, int arg1)
		{
			global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::java.util.Vector.staticClass, "removeRange", "(II)V", ref global::java.util.Vector._m41, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
		}
		private static global::MonoJavaBridge.MethodId _m42;
		public Vector(int arg0, int arg1) : base(global::MonoJavaBridge.JNIEnv.ThreadEnv)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::java.util.Vector._m42.native == global::System.IntPtr.Zero)
				global::java.util.Vector._m42 = @__env.GetMethodIDNoThrow(global::java.util.Vector.staticClass, "<init>", "(II)V");
			global::MonoJavaBridge.JniLocalHandle handle = @__env.NewObject(java.util.Vector.staticClass, global::java.util.Vector._m42, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
			Init(@__env, handle);
		}
		private static global::MonoJavaBridge.MethodId _m43;
		public Vector(int arg0) : base(global::MonoJavaBridge.JNIEnv.ThreadEnv)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::java.util.Vector._m43.native == global::System.IntPtr.Zero)
				global::java.util.Vector._m43 = @__env.GetMethodIDNoThrow(global::java.util.Vector.staticClass, "<init>", "(I)V");
			global::MonoJavaBridge.JniLocalHandle handle = @__env.NewObject(java.util.Vector.staticClass, global::java.util.Vector._m43, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
			Init(@__env, handle);
		}
		private static global::MonoJavaBridge.MethodId _m44;
		public Vector() : base(global::MonoJavaBridge.JNIEnv.ThreadEnv)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::java.util.Vector._m44.native == global::System.IntPtr.Zero)
				global::java.util.Vector._m44 = @__env.GetMethodIDNoThrow(global::java.util.Vector.staticClass, "<init>", "()V");
			global::MonoJavaBridge.JniLocalHandle handle = @__env.NewObject(java.util.Vector.staticClass, global::java.util.Vector._m44);
			Init(@__env, handle);
		}
		private static global::MonoJavaBridge.MethodId _m45;
		public Vector(java.util.Collection arg0) : base(global::MonoJavaBridge.JNIEnv.ThreadEnv)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::java.util.Vector._m45.native == global::System.IntPtr.Zero)
				global::java.util.Vector._m45 = @__env.GetMethodIDNoThrow(global::java.util.Vector.staticClass, "<init>", "(Ljava/util/Collection;)V");
			global::MonoJavaBridge.JniLocalHandle handle = @__env.NewObject(java.util.Vector.staticClass, global::java.util.Vector._m45, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
			Init(@__env, handle);
		}
		static Vector()
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			global::java.util.Vector.staticClass = @__env.NewGlobalRef(@__env.FindClass("java/util/Vector"));
		}
	}
}


text:
package org.wso2.carbon.iot.android.sense.speech.detector.util;

/**
 * Calculates the similarity of strings.
 */
public class StringSimilarity {

    /**
     * Calculates the similarity (a number within 0 and 1) between two strings.
     */
    public static double similarity(String s1, String s2) {
        String longer = s1, shorter = s2;
        if (s1.length() < s2.length()) { // longer should always have greater length
            longer = s2;
            shorter = s1;
        }
        int longerLength = longer.length();
        if (longerLength == 0) {
            return 1.0; /* both strings are zero length */
        }
        return ((longerLength - editDistance(longer, shorter)) / (double) longerLength) * 100;
    }

    // Example implementation of the Levenshtein Edit Distance
    // See http://rosettacode.org/wiki/Levenshtein_distance#Java
    private static int editDistance(String s1, String s2) {
        s1 = s1.toLowerCase();
        s2 = s2.toLowerCase();

        int[] costs = new int[s2.length() + 1];
        for (int i = 0; i <= s1.length(); i++) {
            int lastValue = i;
            for (int j = 0; j <= s2.length(); j++) {
                if (i == 0)
                    costs[j] = j;
                else {
                    if (j > 0) {
                        int newValue = costs[j - 1];
                        if (s1.charAt(i - 1) != s2.charAt(j - 1))
                            newValue = Math.min(Math.min(newValue, lastValue),
                                    costs[j]) + 1;
                        costs[j - 1] = lastValue;
                        lastValue = newValue;
                    }
                }
            }
            if (i > 0)
                costs[s2.length()] = lastValue;
        }
        return costs[s2.length()];
    }

}


text:
function axis = polygonSymmetryAxis(poly)
%POLYGONSYMMETRYAXIS Try to identify symmetry axis of polygon.
%
%   LINE = polygonSymmetryAxis(POLY)
%   Returns a line that minimize difference between the polygon POLY and
%   its reflection with the line.
%   The difference metric between the two polygons is the sum of distances
%   between each vertex of original polygon to the reflected polygon.
%
%   Example
%     % identify symmetry axis of an ellipse
%     elli = [50 50 40 20 30];
%     poly = ellipseToPolygon(elli, 100);
%     line = polygonSymmetryAxis(poly);
%     figure; hold on;
%     drawEllipse(elli);
%     axis equal; axis ([0 100 0 100]);
%     drawLine(line);
%
%   See also
%   transforms2d, transformPoint, distancePointPolygon

% ------
% Author: David Legland
% e-mail: david.legland@nantes.inra.fr
% Created: 2015-04-28,    using Matlab 8.4.0.150421 (R2014b)
% Copyright 2015 INRA - Cepia Software Platform.

% start by centering the polygon
center = polygonCentroid(poly);
poly = bsxfun(@minus, poly, center);

% first performs a rough search with 8 angles
initAngles = linspace(0, pi, 9);
initAngles(end) = [];
initRes = zeros(8, 1);
for i = 1:8
    line = createLine([0 0 cos(initAngles(i)) sin(initAngles(i))]);
    rotMat = createLineReflection(line);
    polyRot = transformPoint(poly, rotMat);
    initRes(i) = sum(distancePointPolygon(poly, polyRot).^2);
end

% keep the angle that gives best result
[dummy, indMin] = min(initRes); %#ok<ASGLU>
initAngle = initAngles(indMin);

% Compute angle that best fit between polygon and its symmetric along line
thetaMin = fminbnd(...
    @(theta) sum(distancePointPolygon(transformPoint(poly, createLineReflection([0 0 cos(theta) sin(theta)])), poly).^2), ...
    initAngle-pi/4, initAngle+pi/4);

% format as a line
axis = [center cos(thetaMin) sin(thetaMin)];


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Gasterom. Ung. 89 (1904)

#### Original name
Lycoperdon saccatum Vahl, 1794

### Remarks
null


text:
@interface CAItem ()
@property (nonatomic) NSNumber *contentSize;
@property (nonatomic) NSString *name;
@property (nonatomic) NSString *slug;
@property (nonatomic) BOOL isPrivate;
@property (nonatomic) BOOL isFavorite;
@property (nonatomic) BOOL isSubscribed;
@property (nonatomic) NSURL *url;
@property (nonatomic) NSURL *contentURL;
@property (nonatomic) NSURL *downloadURL;
@property (nonatomic) CAItemType type;
@property (nonatomic) NSInteger views;
@property (nonatomic) NSURL *iconURL;
@property (nonatomic) NSURL *remoteURL;
@property (nonatomic) NSURL *redirectURL;
@property (nonatomic) NSString *source;
@property (nonatomic) NSDate *deteledAt;
@property (nonatomic) NSDate *expiresAt;
@property (nonatomic) NSInteger expiresAfter;
@end

@implementation CAItem

+ (CAItemType)typeForAPIValue:(NSString *)value {
    if ([value isEqualToString:kImage]) {
        return CAItemTypeImage;
    }
    if ([value isEqualToString:kText]) {
        return CAItemTypeText;
    }
    else if ([value isEqualToString:kVideo]) {
        return CAItemTypeVideo;
    }
    else if ([value isEqualToString:kArchive]) {
        return CAItemTypeArchive;
    }
    else if ([value isEqualToString:kBookmark]) {
        return CAItemTypeBookmark;
    }
    else if ([value isEqualToString:kAudio]) {
        return CAItemTypeAudio;
    }

    return CAItemTypeUnknown;
}

+ (NSString *)apiValueForItemType:(CAItemType)type {
    switch (type) {
        case CAItemTypeBookmark:
            return kBookmark;
        case CAItemTypeArchive:
            return kArchive;
        case CAItemTypeVideo:
            return kVideo;
        case CAItemTypeText:
            return kText;
        case CAItemTypeImage:
            return kImage;
        case CAItemTypeAudio:
            return kAudio;
        default:
            return kUnkown;
    }
}

- (NSDictionary *)preprocessedDictionary:(NSDictionary *)dictionary {
    NSMutableDictionary *mutableDictionary = [[super preprocessedDictionary:dictionary] mutableCopy];
    NSURL *url = [NSURL URLWithString:dictionary[kHref]];
    NSInteger uniqueId = [url.lastPathComponent integerValue];

    mutableDictionary[kUniqueId] = @(uniqueId);

    if (![mutableDictionary.allKeys containsObject:kURL] && [mutableDictionary.allKeys containsObject:kShareURL]) {
        mutableDictionary[kURL] = mutableDictionary[kShareURL];
    }
    if (![mutableDictionary[kContentSize] isKindOfClass:[NSNumber class]]) {
        mutableDictionary[kContentSize] = @(0);
    }

    return mutableDictionary;
}

- (BOOL)updateWithDictionary:(NSDictionary *)dictionary {
    BOOL changed = [super updateWithDictionary:dictionary];
    if (changed) {
        self.name         = dictionary[kName];
        self.contentSize  = dictionary[kContentSize];
        self.isPrivate    = [dictionary[kPrivate] boolValue];
        self.isFavorite   = [dictionary[kFavorite] boolValue];
        self.isSubscribed = [dictionary[kSubscribed] boolValue];
        self.url          = [NSURL URLWithString:dictionary[kURL]];
        self.downloadURL  = [NSURL URLWithString:dictionary[kDownloadURL]];
        self.contentURL   = [NSURL URLWithString:dictionary[kContentURL]];
        self.type         = [CAItem typeForAPIValue:dictionary[kItemType]];
        self.views        = [dictionary[kViewCounter] integerValue];
        self.iconURL      = [NSURL URLWithString:dictionary[kIcon]];
        self.remoteURL    = [NSURL URLWithString:dictionary[kRemoteURL]];
        self.redirectURL  = [NSURL URLWithString:dictionary[kRedirectURL]];
        self.source       = dictionary[kSource];
        self.deteledAt    = [NSDate dateFromISO8601String:dictionary[kDeletedAt]];
        self.expiresAt    = [NSDate dateFromISO8601String:dictionary[kExpiresAt]];
        self.expiresAfter = [dictionary[kExpiresAfter] integerValue];
        self.slug         = self.url.lastPathComponent;
    }
    return changed;
}

- (void)updateExpirationStatusWithDictionary:(NSDictionary *)dictionary {
    self.expiresAt    = [NSDate dateFromISO8601String:dictionary[kExpiresAt]];
    self.expiresAfter = [dictionary[kExpiresAfter] integerValue];
}

- (void)updateFavoriteStatusWithDictionary:(NSDictionary *)dictionary {
    self.isFavorite = [dictionary[kFavorite] boolValue];
}

@end


text:
<?php

namespace Magento\Bundle\Model\Product;

class PriceTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var \PHPUnit_Framework_MockObject_MockObject
     */
    protected $ruleFactoryMock;

    /**
     * @var \PHPUnit_Framework_MockObject_MockObject
     */
    protected $localeDateMock;

    /**
     * @var \PHPUnit_Framework_MockObject_MockObject
     */
    protected $storeManagerMock;

    /**
     * @var \PHPUnit_Framework_MockObject_MockObject
     */
    protected $customerSessionMock;

    /**
     * @var \PHPUnit_Framework_MockObject_MockObject
     */
    protected $eventManagerMock;

    /**
     * @var \PHPUnit_Framework_MockObject_MockObject
     */
    protected $catalogHelperMock;

    /**
     * @var \PHPUnit_Framework_MockObject_MockObject
     */
    protected $storeMock;

    /**
     * @var \Magento\Bundle\Model\Product\Price
     */
    protected $model;

    /**
     * @var \Magento\Framework\Pricing\PriceCurrencyInterface|\PHPUnit_Framework_MockObject_MockObject
     */
    protected $priceCurrency;

    /**
     * @var \Magento\Customer\Api\GroupManagementInterface
     */
    protected $groupManagement;

    protected function setUp()
    {
        $this->ruleFactoryMock = $this->getMock(
            '\Magento\CatalogRule\Model\Resource\RuleFactory',
            [],
            [],
            '',
            false
        );
        $this->storeManagerMock = $this->getMock('\Magento\Store\Model\StoreManagerInterface');
        $this->localeDateMock = $this->getMock('\Magento\Framework\Stdlib\DateTime\TimezoneInterface');
        $this->customerSessionMock = $this->getMock('\Magento\Customer\Model\Session', [], [], '', false);
        $this->eventManagerMock = $this->getMock('\Magento\Framework\Event\ManagerInterface');
        $this->catalogHelperMock = $this->getMock('\Magento\Catalog\Helper\Data', [], [], '', false);
        $this->storeMock = $this->getMock('\Magento\Store\Model\Store', [], [], '', false);
        $this->priceCurrency = $this->getMockBuilder('Magento\Framework\Pricing\PriceCurrencyInterface')->getMock();
        $this->groupManagement = $this->getMockBuilder('Magento\Customer\Api\GroupManagementInterface')
            ->getMockForAbstractClass();

        $this->model = new \Magento\Bundle\Model\Product\Price(
            $this->ruleFactoryMock,
            $this->storeManagerMock,
            $this->localeDateMock,
            $this->customerSessionMock,
            $this->eventManagerMock,
            $this->priceCurrency,
            $this->groupManagement,
            $this->catalogHelperMock
        );
    }

    /**
     * @param float $finalPrice
     * @param float $specialPrice
     * @param int $callsNumber
     * @param bool $dateInInterval
     * @param float $expected
     *
     * @covers \Magento\Bundle\Model\Product\Price::calculateSpecialPrice
     * @covers \Magento\Bundle\Model\Product\Price::__construct
     * @dataProvider calculateSpecialPrice
     */
    public function testCalculateSpecialPrice($finalPrice, $specialPrice, $callsNumber, $dateInInterval, $expected)
    {
        $this->localeDateMock->expects($this->exactly($callsNumber))
            ->method('isScopeDateInInterval')->will($this->returnValue($dateInInterval));

        $this->storeManagerMock->expects($this->any())
            ->method('getStore')->will($this->returnValue($this->storeMock));

        $this->storeMock->expects($this->any())
            ->method('roundPrice')->will($this->returnArgument(0));

        $this->assertEquals(
            $expected,
            $this->model->calculateSpecialPrice($finalPrice, $specialPrice, date('Y-m-d'), date('Y-m-d'))
        );
    }

    /**
     * @return array
     */
    public function calculateSpecialPrice()
    {
        return [
            [10, null, 0, true, 10],
            [10, false, 0, true, 10],
            [10, 50, 1, false, 10],
            [10, 50, 1, true, 5],
            [0, 50, 1, true, 0],
            [10, 100, 1, true, 10],
        ];
    }
}


text:
class AddPdpTables < ActiveRecord::Migration
  def change
    create_table :atmosphere_user_appliance_types do |t|
      t.belongs_to :user
      t.belongs_to :appliance_type

      t.string :role
    end
  end
end


text:
<?php
/**
 * @package epfl
 * Template name: Aside: only children
 */

require_once(__DIR__.'/page.php');


text:
import pytest

from bomb_defusal.modules import Port, PortType

class TestPort(object):
    @pytest.mark.parametrize('port', [PortType.DVI_D, PortType.SERIAL])
    def test_indication(self, port):
        subject = Port(None, port)
        assert port == subject.port

    def test_invalid_port(self):
        with pytest.raises(ValueError):
            Port(None, 'INVALID')


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">test3</string>
</resources>


text:
"""Implementation of Nash Conv metric for a policy.

In the context of mean field games, the Nash Conv is the difference between:
- the value of a policy against the distribution of that policy,
- and the best response against the distribution of the policy.
"""

from open_spiel.python import policy as policy_std
from open_spiel.python.mfg import value
from open_spiel.python.mfg.algorithms import best_response_value
from open_spiel.python.mfg.algorithms import distribution
from open_spiel.python.mfg.algorithms import policy_value

class NashConv(object):
  """Computes the Nash Conv of a policy."""

  def __init__(self, game, policy: policy_std.Policy, root_state=None):
    """Initializes the nash conv.

    Args:
      game: The game to analyze.
      policy: A `policy.Policy` object.
      root_state: The state of the game at which to start. If `None`, the game
        root state is used.
    """
    self._game = game
    self._policy = policy
    if root_state is None:
      self._root_states = game.new_initial_states()
    else:
      self._root_states = [root_state]
    self._distrib = distribution.DistributionPolicy(
        self._game, self._policy, root_state=root_state)
    self._pi_value = policy_value.PolicyValue(
        self._game,
        self._distrib,
        self._policy,
        value.TabularValueFunction(self._game),
        root_state=root_state)
    self._br_value = best_response_value.BestResponse(
        self._game,
        self._distrib,
        value.TabularValueFunction(self._game),
        root_state=root_state)

  def nash_conv(self):
    """Returns the nash conv.

    Returns:
      A float representing the nash conv for the policy.
    """
    return sum([
        self._br_value.eval_state(state) - self._pi_value.eval_state(state)
        for state in self._root_states
    ])

  def br_values(self):
    """Returns the best response values to the policy distribution.

    Returns:
      A List[float] representing the best response values for a policy
        distribution.
    """
    return [self._br_value.eval_state(state) for state in self._root_states]

  @property
  def distribution(self) -> distribution.DistributionPolicy:
    return self._distrib


text:
/*******************************************************************************
 The block below describes the properties of this module, and is read by
 the Projucer to automatically generate project code that uses it.
 For details about the syntax and how to create or use a module, see the
 JUCE Module Format.md file.

 BEGIN_JUCE_MODULE_DECLARATION

  ID:                 juce_data_structures
  vendor:             juce
  version:            6.0.8
  name:               JUCE data model helper classes
  description:        Classes for undo/redo management, and smart data structures.
  website:            http://www.juce.com/juce
  license:            GPL/Commercial

  dependencies:       juce_events

 END_JUCE_MODULE_DECLARATION

*******************************************************************************/

#pragma once
#define JUCE_DATA_STRUCTURES_H_INCLUDED

//==============================================================================
#include <juce_events/juce_events.h>

#include "undomanager/juce_UndoableAction.h"
#include "undomanager/juce_UndoManager.h"
#include "values/juce_Value.h"
#include "values/juce_ValueTree.h"
#include "values/juce_ValueTreeSynchroniser.h"
#include "values/juce_CachedValue.h"
#include "values/juce_ValueWithDefault.h"
#include "app_properties/juce_PropertiesFile.h"
#include "app_properties/juce_ApplicationProperties.h"


text:
var isPrototype = require('./_isPrototype'),
    nativeKeys = require('./_nativeKeys');

/** Used for built-in method references. */
var objectProto = Object.prototype;

/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;

/**
 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
 *
 * @private
 * @param {Object} object The object to query.
 * @returns {Array} Returns the array of property names.
 */
function baseKeys(object) {
    if (!isPrototype(object)) {
        return nativeKeys(object);
    }
    var result = [];
    for (var key in Object(object)) {
        if (hasOwnProperty.call(object, key) && key != 'constructor') {
            result.push(key);
        }
    }
    return result;
}

module.exports = baseKeys;


text:
// Copyright 2019 The Bazel Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

package com.google.devtools.build.lib.bazel.rules.ninja.file;

import com.google.common.base.Throwables;
import com.google.common.collect.Lists;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import java.util.List;
import java.util.concurrent.ExecutionException;

/**
 * Helper class for accumulating the scheduled {@link ListenableFuture} sub-tasks and gathering
 * their results.
 *
 * @param <T> the type that ListenableFuture returns
 * @param <E> the type of exception, that the computation task can throw
 */
public class CollectingListFuture<T, E extends Exception> {
  private final List<ListenableFuture<T>> futures;
  private final Class<E> exceptionClazz;

  /** @param exceptionClazz the class of exception, that the computation task can throw */
  public CollectingListFuture(Class<E> exceptionClazz) {
    this.exceptionClazz = exceptionClazz;
    futures = Lists.newArrayList();
  }

  /** Adds future to the list */
  public void add(ListenableFuture<T> future) {
    futures.add(future);
  }

  /** Returns the list of combined results of all futures, registered with {@link #add}. */
  public List<T> getResult() throws E, InterruptedException {
    try {
      return Futures.allAsList(futures).get();
    } catch (InterruptedException | ExecutionException e) {
      Throwable causeOrSelf = e.getCause();
      if (causeOrSelf == null) {
        causeOrSelf = e;
      }
      Throwables.propagateIfPossible(causeOrSelf, exceptionClazz, InterruptedException.class);
      throw new IllegalStateException(e);
    }
  }
}


text:
/*jshint node:true, mocha:true*/
/**
 * @author lattmann / https://github.com/lattmann
 */

var testFixture = require('../_globals');

describe('Plugin Manager Base', function () {
    'use strict';

    var WebGME = testFixture.WebGME,
        PluginManagerBase = testFixture.requirejs('plugin/PluginManagerBase'),
        PluginGenerator = testFixture.requirejs('plugin/PluginGenerator/PluginGenerator/PluginGenerator'),
        MinimalWorkingExample = testFixture.requirejs(
            'plugin/MinimalWorkingExample/MinimalWorkingExample/MinimalWorkingExample'),
        logger = testFixture.logger;

    describe('plugin manager API', function () {

        var gmeConfig = testFixture.getGmeConfig(),
            should = testFixture.should;

        it('should instantiate PluginManagerBase and have defined properties', function () {
            var pluginManagerBase,
                pluginManagerConfig = {
                    PluginGenerator: PluginGenerator
                };

            pluginManagerBase = new PluginManagerBase(null, null, logger, pluginManagerConfig, gmeConfig);

            should.exist(pluginManagerBase);
            pluginManagerBase.should.have.property('logger');
            pluginManagerBase.should.have.property('_Core');
            pluginManagerBase.should.have.property('_storage');
            pluginManagerBase.should.have.property('_plugins');
            pluginManagerBase.should.have.property('_pluginConfigs');

            pluginManagerBase.should.have.property('initialize');
            pluginManagerBase.should.have.property('getPluginByName');
            pluginManagerBase.should.have.property('getPluginContext');
            pluginManagerBase.should.have.property('executePlugin');
        });

        it('should initialize PluginManagerBase', function () {
            var pluginManagerBase,
                pluginManagerConfig = {};

            pluginManagerBase = new PluginManagerBase(null, null, logger, pluginManagerConfig, gmeConfig);

            (function () {
                pluginManagerBase.initialize(null, null, null);
            }).should.not.throw();
        });

        it('should get plugin by name', function () {
            var pluginManagerBase,
                pluginManagerConfig = {
                    PluginGenerator: PluginGenerator
                };

            pluginManagerBase = new PluginManagerBase(null, null, logger, pluginManagerConfig, gmeConfig);

            pluginManagerBase.initialize(null, null, null);
            pluginManagerBase.getPluginByName('PluginGenerator').should.equal(PluginGenerator);
        });

    });

    describe('Plugin execution', function () {
        var storage,
            project,
            core,
            root,
            commit,
            baseCommit,
            rootHash,

            rimraf = testFixture.rimraf,
            BlobClient = testFixture.BlobClient,
            server,
            bcParam = {},
            blobClient,

            gmeAuth,

            gmeConfig = testFixture.getGmeConfig();

        gmeConfig.server.https.enable = false;

        before(function (done) {
            // we have to set the config here
            bcParam.serverPort = gmeConfig.server.port;
            bcParam.server = '127.0.0.1';
            bcParam.httpsecure = gmeConfig.server.https.enable;
            server = testFixture.WebGME.standaloneServer(gmeConfig);
            server.start(function () {

                blobClient = new BlobClient(bcParam);

                testFixture.clearDBAndGetGMEAuth(gmeConfig, 'PluginManagerBase')
                    .then(function (gmeAuth_) {
                        gmeAuth = gmeAuth_;
                        storage = testFixture.getMemoryStorage(logger, gmeConfig, gmeAuth);
                        return storage.openDatabase();
                    })
                    .then(function () {

                        testFixture.importProject(storage, {
                            projectSeed: './test/plugin/PluginManagerBase/project.json',
                            projectName: 'PluginManagerBase',
                            gmeConfig: gmeConfig,
                            logger: logger
                        }, function (err, result) {
                            if (err) {
                                done(err);
                                return;
                            }
                            project = result.project;
                            core = result.core;
                            root = result.rootNode;
                            commit = result.commitHash;
                            baseCommit = result.commitHash;
                            rootHash = core.getHash(root);
                            done();
                        });
                    });

            });
        });

        beforeEach(function (done) {
            rimraf('./test-tmp/blob-storage', function (err) {
                if (err) {
                    done(err);
                    return;
                }
                done();
            });
        });

        after(function (done) {
            server.stop(done);
        });

        it.skip('should execute plugin MinimalWorkingExample on commit and save', function (done) {
            // Plugins in the client are associated with a branch.
            var pluginManagerBase,
                pluginManagerConfig = {
                    PluginGenerator: PluginGenerator,
                    MinimalWorkingExample: MinimalWorkingExample
                },
                managerConfiguration = {
                    commit: commit,
                    activeSelection: [],
                    blobClient: blobClient
                };

            pluginManagerBase = new PluginManagerBase(project, WebGME.core, logger, pluginManagerConfig, gmeConfig);

            pluginManagerBase.initialize(null, null, null);
            pluginManagerBase.executePlugin('MinimalWorkingExample', managerConfiguration, function (err/*, result*/) {
                // TODO: do proper check.
                if (err) {
                    done(new Error(err));
                    return;
                }
                //console.log(result);
                done();
            });
        });

        it('should execute plugin MinimalWorkingExample on branch and save', function (done) {
            var pluginManagerBase,
                pluginManagerConfig = {
                    PluginGenerator: PluginGenerator,
                    MinimalWorkingExample: MinimalWorkingExample
                },
                managerConfiguration = {
                    branchName: 'master',
                    activeSelection: [],
                    blobClient: blobClient
                };

            pluginManagerBase = new PluginManagerBase(project, WebGME.core, logger, pluginManagerConfig, gmeConfig);

            pluginManagerBase.initialize(null, null, null);
            project.getBranchHash('master')
                .then(function (branchHash) {
                    testFixture.expect(branchHash).to.not.equal(null);
                    managerConfiguration.commit = branchHash;
                    pluginManagerBase.executePlugin('MinimalWorkingExample', managerConfiguration, function (err/*, result*/) {
                        // TODO: do proper check.
                        if (err) {
                            done(new Error(err));
                            return;
                        }
                        //console.log(result);
                        done();
                    });
                })
                .catch(done);
        });

        it('should execute plugin PluginGenerator', function (done) {
            var pluginManagerBase,
                pluginManagerConfig = {
                    PluginGenerator: PluginGenerator
                },
                managerConfiguration = {
                    commit: commit,
                    branchName: 'master',
                    activeSelection: [],
                    blobClient: blobClient
                };

            pluginManagerBase = new PluginManagerBase(project, WebGME.core, logger, pluginManagerConfig, gmeConfig);

            pluginManagerBase.initialize(null, null, null);
            pluginManagerBase.executePlugin('PluginGenerator', managerConfiguration, function (err/*, result*/) {
                // TODO: do proper check.
                if (err) {
                    done(new Error(err));
                    return;
                }
                //console.log(result);
                done();
            });
        });

        it('should execute plugin when branchName is given', function (done) {
            var pluginManagerBase,
                pluginManagerConfig = {
                    PluginGenerator: PluginGenerator
                },
                managerConfiguration = {
                    branchName: 'master',
                    activeSelection: [],
                    blobClient: blobClient
                };

            pluginManagerBase = new PluginManagerBase(project, WebGME.core, logger, pluginManagerConfig, gmeConfig);

            pluginManagerBase.initialize(null, null, null);
            project.getBranchHash('master')
                .then(function (branchHash) {
                    testFixture.expect(branchHash).to.not.equal(null);
                    managerConfiguration.commit = branchHash;
                    pluginManagerBase.executePlugin('PluginGenerator', managerConfiguration, function (err/*, result*/) {
                        // TODO: do proper check.
                        if (err) {
                            done(new Error(err));
                            return;
                        }
                        //console.log(result);
                        done();
                    });
                })
                .catch(done);
        });

        it('should fail to execute plugin when invalid branchName is given', function (done) {
            var pluginManagerBase,
                pluginManagerConfig = {
                    PluginGenerator: PluginGenerator
                },
                managerConfiguration = {
                    branchName: 'does not exist',
                    activeSelection: [],
                    blobClient: blobClient
                };

            pluginManagerBase = new PluginManagerBase(project, WebGME.core, logger, pluginManagerConfig, gmeConfig);

            pluginManagerBase.initialize(null, null, null);
            pluginManagerBase.executePlugin('PluginGenerator', managerConfiguration, function (err/*, result*/) {
                // TODO: do proper check.
                if (err.indexOf('cannot find branch') > -1) {
                    done();
                    return;
                }
                //console.log(result);
                done(new Error('should have failed with cannot find branch'));
            });
        });

        it('should execute plugin when root is in active selection', function (done) {
            var pluginManagerBase,
                pluginManagerConfig = {
                    PluginGenerator: PluginGenerator
                },
                managerConfiguration = {
                    commit: commit,
                    branchName: 'master',
                    activeSelection: [''],
                    blobClient: blobClient
                };

            pluginManagerBase = new PluginManagerBase(project, WebGME.core, logger, pluginManagerConfig, gmeConfig);

            pluginManagerBase.initialize(null, null, null);
            pluginManagerBase.executePlugin('PluginGenerator', managerConfiguration, function (err/*, result*/) {
                // TODO: do proper check.
                if (err) {
                    done(new Error(err));
                    return;
                }
                //console.log(result);
                done();
            });
        });

        it('should execute plugin when root is active node', function (done) {
            var pluginManagerBase,
                pluginManagerConfig = {
                    PluginGenerator: PluginGenerator
                },
                managerConfiguration = {
                    branchName: 'master',
                    commit: commit,
                    activeNode: '',
                    activeSelection: [''],
                    blobClient: blobClient
                };

            pluginManagerBase = new PluginManagerBase(project, WebGME.core, logger, pluginManagerConfig, gmeConfig);

            pluginManagerBase.initialize(null, null, null);
            pluginManagerBase.executePlugin('PluginGenerator', managerConfiguration, function (err/*, result*/) {
                // TODO: do proper check.
                if (err) {
                    done(new Error(err));
                    return;
                }
                //console.log(result);
                done();
            });
        });

        it('should execute plugin with error, when active node is not found', function (done) {
            var pluginManagerBase,
                pluginManagerConfig = {
                    PluginGenerator: PluginGenerator
                },
                managerConfiguration = {
                    commit: commit,
                    activeNode: 'does not exist',
                    branchName: 'master',
                    activeSelection: [''],
                    blobClient: blobClient
                };

            pluginManagerBase = new PluginManagerBase(project, WebGME.core, logger, pluginManagerConfig, gmeConfig);

            pluginManagerBase.initialize(null, null, null);
            pluginManagerBase.executePlugin('PluginGenerator', managerConfiguration, function (err/*, result*/) {
                // TODO: do proper check.
                if (err.indexOf('unable to load') > -1) {
                    done();
                    return;
                }
                done(new Error('should have failed to load node'));
            });
        });

        it('should execute plugin, when active selection (node) is not found', function (done) {
            var pluginManagerBase,
                pluginManagerConfig = {
                    PluginGenerator: PluginGenerator
                },
                managerConfiguration = {
                    commit: commit,
                    activeSelection: ['does not exist'],
                    blobClient: blobClient,
                    branchName: 'master'
                };

            pluginManagerBase = new PluginManagerBase(project, WebGME.core, logger, pluginManagerConfig, gmeConfig);

            pluginManagerBase.initialize(null, null, null);
            pluginManagerBase.executePlugin('PluginGenerator', managerConfiguration, function (err/*, result*/) {
                // TODO: do proper check.
                if (err) {
                    done(new Error(err));
                    return;
                }
                //console.log(result);
                done();
            });
        });

        it('should execute plugin with error, when commit is invalid hash', function (done) {
            var pluginManagerBase,
                pluginManagerConfig = {
                    PluginGenerator: PluginGenerator
                },
                managerConfiguration = {
                    commit: 'does not exist',
                    activeSelection: [''],
                    blobClient: blobClient,
                    branchName: 'master'
                };

            pluginManagerBase = new PluginManagerBase(project, WebGME.core, logger, pluginManagerConfig, gmeConfig);

            pluginManagerBase.initialize(null, null, null);
            pluginManagerBase.executePlugin('PluginGenerator', managerConfiguration, function (err, result) {
                testFixture.expect(err).to.not.equal(null);
                testFixture.expect(err.message)
                    .to.equal('Invalid argument, data.before is not a number nor a valid hash.');

                done();
            });
        });

        it('should execute plugin with error, when commit does not exist', function (done) {
            var pluginManagerBase,
                pluginManagerConfig = {
                    PluginGenerator: PluginGenerator
                },
                managerConfiguration = {
                    commit: '#doesnotexist',
                    activeSelection: [''],
                    blobClient: blobClient,
                    branchName: 'master'
                };

            pluginManagerBase = new PluginManagerBase(project, WebGME.core, logger, pluginManagerConfig, gmeConfig);

            pluginManagerBase.initialize(null, null, null);
            pluginManagerBase.executePlugin('PluginGenerator', managerConfiguration, function (err, result) {
                testFixture.expect(err).to.not.equal(null);
                testFixture.expect(err.message)
                    .to.include('object does not exist #doesnotexist');

                done();
            });
        });
    });

});


text:
package org.bdgenomics.convert.htsjdk;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import com.google.inject.Inject;

import com.google.inject.assistedinject.Assisted;

import htsjdk.samtools.SAMFileHeader;
import htsjdk.samtools.SAMReadGroupRecord;
import htsjdk.samtools.SAMRecord;
import htsjdk.samtools.SAMUtils;

import org.bdgenomics.convert.AbstractConverter;
import org.bdgenomics.convert.ConversionException;
import org.bdgenomics.convert.ConversionStringency;

import org.bdgenomics.formats.avro.Alignment;

import org.slf4j.Logger;

/**
 * Convert Alignment to htsjdk SAMRecord.
 */
public final class AlignmentToSamRecord extends AbstractConverter<Alignment, SAMRecord> {

    /** Regex to capture attributes. */
    private static final Pattern ATTRIBUTE = Pattern.compile("([^:]{2,4}):([AifZHB]):(.*)");

    /** Regex to capture array attribute types. */
    private static final Pattern ARRAY_ATTRIBUTE = Pattern.compile("([cCiIsSf]{1},)(.*)");

    /** Header. */
    private final SAMFileHeader header;

    /**
     * Create a new Alignment to htsjdk SAMRecord converter with the specified header.
     *
     * @param header header, must not be null
     */
    @Inject
    public AlignmentToSamRecord(@Assisted final SAMFileHeader header) {
        super(Alignment.class, SAMRecord.class);

        checkNotNull(header);
        this.header = header;
    }

    @Override
    public SAMRecord convert(final Alignment alignment,
                             final ConversionStringency stringency,
                             final Logger logger) throws ConversionException {

        if (alignment == null) {
            warnOrThrow(alignment, "must not be null", null, stringency, logger);
            return null;
        }

        SAMRecord builder = new SAMRecord(header);
        builder.setReadName(alignment.getReadName());
        builder.setReadString(alignment.getSequence());

        if (alignment.getQualityScores() == null) {
            builder.setBaseQualityString("*");
        }
        else {
            builder.setBaseQualityString(alignment.getQualityScores());
        }

        String readGroupId = alignment.getReadGroupId();
        if (readGroupId != null) {
            builder.setAttribute("RG", readGroupId);

            SAMReadGroupRecord readGroup = header.getReadGroup(readGroupId);
            if (readGroup != null && readGroup.getLibrary() != null) {
                builder.setAttribute("LB", readGroup.getLibrary());
            }
            if (readGroup != null && readGroup.getPlatformUnit() != null) {
                builder.setAttribute("PU", readGroup.getPlatformUnit());
            }
        }

        if (alignment.getMateReferenceName() != null) {
            builder.setMateReferenceName(alignment.getMateReferenceName());
        }
        if (alignment.getMateAlignmentStart() != null) {
            builder.setMateAlignmentStart(alignment.getMateAlignmentStart().intValue() + 1);
        }
        if (alignment.getInsertSize() != null) {
            builder.setInferredInsertSize(alignment.getInsertSize().intValue());
        }

        if (alignment.getReadPaired() != null) {
            boolean readPaired = alignment.getReadPaired();
            builder.setReadPairedFlag(readPaired);

            if (readPaired) {
                if (alignment.getMateNegativeStrand() != null) {
                    builder.setMateNegativeStrandFlag(alignment.getMateNegativeStrand());
                }
                if (alignment.getMateMapped() != null) {
                    builder.setMateUnmappedFlag(!alignment.getMateMapped());
                }
                if (alignment.getProperPair() != null) {
                    builder.setProperPairFlag(alignment.getProperPair());
                }
                if (alignment.getReadInFragment() != null) {
                    builder.setFirstOfPairFlag(alignment.getReadInFragment() == 0);
                    builder.setSecondOfPairFlag(alignment.getReadInFragment() == 1);
                }
            }
        }

        if (alignment.getDuplicateRead() != null) {
            builder.setDuplicateReadFlag(alignment.getDuplicateRead());
        }

        if (alignment.getReadMapped() != null) {
            boolean readMapped = alignment.getReadMapped();
            builder.setReadUnmappedFlag(!readMapped);

            if (alignment.getReadNegativeStrand() != null) {
                builder.setReadNegativeStrandFlag(alignment.getReadNegativeStrand());
            }

            if (readMapped) {
                if (alignment.getReferenceName() == null) {
                    warnOrThrow(alignment, "referenceName must not be null if read aligned", null, stringency, logger);
                }
                else {
                    builder.setReferenceName(alignment.getReferenceName());
                }

                if (alignment.getCigar() != null) {
                    builder.setCigarString(alignment.getCigar());
                }
                if (alignment.getPrimaryAlignment() != null) {
                    builder.setNotPrimaryAlignmentFlag(!alignment.getPrimaryAlignment());
                }
                if (alignment.getSupplementaryAlignment() != null) {
                    builder.setSupplementaryAlignmentFlag(alignment.getSupplementaryAlignment());
                }
                if (alignment.getStart() != null) {
                    builder.setAlignmentStart(alignment.getStart().intValue() + 1);
                }
                if (alignment.getMappingQuality() != null) {
                    builder.setMappingQuality(alignment.getMappingQuality());
                }
            }
            else {
                builder.setMappingQuality(0);
            }
        }

        if (alignment.getFailedVendorQualityChecks() != null) {
            builder.setReadFailsVendorQualityCheckFlag(alignment.getFailedVendorQualityChecks());
        }
        if (alignment.getMismatchingPositions() != null) {
            builder.setAttribute("MD", alignment.getMismatchingPositions());
        }
        if (alignment.getOriginalQualityScores() != null) {
            builder.setOriginalBaseQualities(SAMUtils.fastqToPhred(alignment.getOriginalQualityScores()));
        }
        if (alignment.getOriginalCigar() != null) {
            builder.setAttribute("OC", alignment.getOriginalCigar());
        }
        if (alignment.getOriginalStart() != null) {
            builder.setAttribute("OP", alignment.getOriginalStart().intValue() + 1);
        }

        if (alignment.getAttributes() != null) {
            String[] tokens = alignment.getAttributes().split("\t");
            for (String token : tokens) {
                Matcher m = ATTRIBUTE.matcher(token);
                if (m.matches()) {
                    String tagName = m.group(1);
                    String tagType = m.group(2);
                    String value = m.group(3);

                    if ("B".equals(tagType)) {
                        m = ARRAY_ATTRIBUTE.matcher(value);
                        if (m.matches()) {
                            tagType = tagType + ":" + m.group(1);
                            value = m.group(2);
                        }
                    }

                    switch (tagType) {
                    case "A":
                        builder.setAttribute(tagName, value.charAt(0));
                    case "i":
                        builder.setAttribute(tagName, Integer.valueOf(value));
                    case "f":
                        builder.setAttribute(tagName, Float.valueOf(value));
                    case "Z":
                        builder.setAttribute(tagName, value);
                    case "H":
                        builder.setAttribute(tagName, value.getBytes());
                    case "B:c,":
                    case "B:C,":
                        builder.setAttribute(tagName, splitToByteArray(value));
                    case "B:i,":
                    case "B:I,":
                        builder.setAttribute(tagName, splitToIntegerArray(value));
                    case "B:s,":
                    case "B:S,":
                        builder.setAttribute(tagName, splitToShortArray(value));
                    case "B:f,":
                        builder.setAttribute(tagName, splitToFloatArray(value));
                    default:
                        warnOrThrow(alignment, "invalid attribute type " + tagType, null, stringency, logger);
                    }
                }
            }
        }

        return builder;
    }

    /**
     * Split the specified value to a byte array.
     *
     * @param value value
     * @return the specified value split to a byte array
     */
    static byte[] splitToByteArray(final String value) {
        String[] tokens = value.split(",");
        byte[] bytes = new byte[tokens.length];
        for (int i = 0; i < tokens.length; i++) {
            bytes[i] = Byte.valueOf(tokens[i]);
        }
        return bytes;
    }

    /**
     * Split the specified value to an integer array.
     *
     * @param value value
     * @return the specified value split to an integer array
     */
    static int[] splitToIntegerArray(final String value) {
        String[] tokens = value.split(",");
        int[] ints = new int[tokens.length];
        for (int i = 0; i < tokens.length; i++) {
            ints[i] = Integer.valueOf(tokens[i]);
        }
        return ints;
    }

    /**
     * Split the specified value to a short array.
     *
     * @param value value
     * @return the specified value split to a short array
     */
    static short[] splitToShortArray(final String value) {
        String[] tokens = value.split(",");
        short[] shorts = new short[tokens.length];
        for (int i = 0; i < tokens.length; i++) {
            shorts[i] = Short.valueOf(tokens[i]);
        }
        return shorts;
    }

    /**
     * Split the specified value to a float array.
     *
     * @param value value
     * @return the specified value split to a float array
     */
    static float[] splitToFloatArray(final String value) {
        String[] tokens = value.split(",");
        float[] floats = new float[tokens.length];
        for (int i = 0; i < tokens.length; i++) {
            floats[i] = Float.valueOf(tokens[i]);
        }
        return floats;
    }
}


text:
var constant = {};

constant.pageCount = 4;
constant.khanServer = "http://s3.amazonaws.com/KA-youtube-converted/";
constant.videoType = "mp4";


text:
package org.goodsManagement.po;

import java.util.Date;

public class OutRepositoryDto {
    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column outrepository.id
     *
     * @mbggenerated Sun Sep 20 19:32:38 CST 2015
     */
    private Integer id;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column outrepository.outtime
     *
     * @mbggenerated Sun Sep 20 19:32:38 CST 2015
     */
    private Date outtime;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column outrepository.goodid
     *
     * @mbggenerated Sun Sep 20 19:32:38 CST 2015
     */
    private Integer goodid;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column outrepository.goodnumber
     *
     * @mbggenerated Sun Sep 20 19:32:38 CST 2015
     */
    private Integer goodnumber;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column outrepository.operatorid
     *
     * @mbggenerated Sun Sep 20 19:32:38 CST 2015
     */
    private Integer operatorid;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column outrepository.deptid
     *
     * @mbggenerated Sun Sep 20 19:32:38 CST 2015
     */
    private Integer deptid;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column outrepository.standardnumber
     *
     * @mbggenerated Sun Sep 20 19:32:38 CST 2015
     */
    private Integer standardnumber;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column outrepository.comments
     *
     * @mbggenerated Sun Sep 20 19:32:38 CST 2015
     */
    private String comments;

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column outrepository.id
     *
     * @return the value of outrepository.id
     *
     * @mbggenerated Sun Sep 20 19:32:38 CST 2015
     */
    public Integer getId() {
        return id;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column outrepository.id
     *
     * @param id the value for outrepository.id
     *
     * @mbggenerated Sun Sep 20 19:32:38 CST 2015
     */
    public void setId(Integer id) {
        this.id = id;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column outrepository.outtime
     *
     * @return the value of outrepository.outtime
     *
     * @mbggenerated Sun Sep 20 19:32:38 CST 2015
     */
    public Date getOuttime() {
        return outtime;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column outrepository.outtime
     *
     * @param outtime the value for outrepository.outtime
     *
     * @mbggenerated Sun Sep 20 19:32:38 CST 2015
     */
    public void setOuttime(Date outtime) {
        this.outtime = outtime;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column outrepository.goodid
     *
     * @return the value of outrepository.goodid
     *
     * @mbggenerated Sun Sep 20 19:32:38 CST 2015
     */
    public Integer getGoodid() {
        return goodid;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column outrepository.goodid
     *
     * @param goodid the value for outrepository.goodid
     *
     * @mbggenerated Sun Sep 20 19:32:38 CST 2015
     */
    public void setGoodid(Integer goodid) {
        this.goodid = goodid;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column outrepository.goodnumber
     *
     * @return the value of outrepository.goodnumber
     *
     * @mbggenerated Sun Sep 20 19:32:38 CST 2015
     */
    public Integer getGoodnumber() {
        return goodnumber;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column outrepository.goodnumber
     *
     * @param goodnumber the value for outrepository.goodnumber
     *
     * @mbggenerated Sun Sep 20 19:32:38 CST 2015
     */
    public void setGoodnumber(Integer goodnumber) {
        this.goodnumber = goodnumber;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column outrepository.operatorid
     *
     * @return the value of outrepository.operatorid
     *
     * @mbggenerated Sun Sep 20 19:32:38 CST 2015
     */
    public Integer getOperatorid() {
        return operatorid;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column outrepository.operatorid
     *
     * @param operatorid the value for outrepository.operatorid
     *
     * @mbggenerated Sun Sep 20 19:32:38 CST 2015
     */
    public void setOperatorid(Integer operatorid) {
        this.operatorid = operatorid;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column outrepository.deptid
     *
     * @return the value of outrepository.deptid
     *
     * @mbggenerated Sun Sep 20 19:32:38 CST 2015
     */
    public Integer getDeptid() {
        return deptid;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column outrepository.deptid
     *
     * @param deptid the value for outrepository.deptid
     *
     * @mbggenerated Sun Sep 20 19:32:38 CST 2015
     */
    public void setDeptid(Integer deptid) {
        this.deptid = deptid;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column outrepository.standardnumber
     *
     * @return the value of outrepository.standardnumber
     *
     * @mbggenerated Sun Sep 20 19:32:38 CST 2015
     */
    public Integer getStandardnumber() {
        return standardnumber;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column outrepository.standardnumber
     *
     * @param standardnumber the value for outrepository.standardnumber
     *
     * @mbggenerated Sun Sep 20 19:32:38 CST 2015
     */
    public void setStandardnumber(Integer standardnumber) {
        this.standardnumber = standardnumber;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column outrepository.comments
     *
     * @return the value of outrepository.comments
     *
     * @mbggenerated Sun Sep 20 19:32:38 CST 2015
     */
    public String getComments() {
        return comments;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column outrepository.comments
     *
     * @param comments the value for outrepository.comments
     *
     * @mbggenerated Sun Sep 20 19:32:38 CST 2015
     */
    public void setComments(String comments) {
        this.comments = comments == null ? null : comments.trim();
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <artifactId>ActionBazaar</artifactId>
        <groupId>com.actionbazaar.chapter3</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <groupId>com.actionbazaar.chapter3</groupId>
    <artifactId>ActionBazaar-ear</artifactId>
    <packaging>ear</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>Action Bazaar EAR</name>
    <url>http://code.google.com/p/action-bazaar/</url>
    <repositories>
            <repository>
                <id>java.net2</id>
                <name>Repository hosting the jee6 artifacts</name>
                <url>http://download.java.net/maven/2</url>
            </repository>
            <repository>
                <url>http://download.java.net/maven/2/</url>
                <id>jsf20</id>
                <layout>default</layout>
            </repository>
            <repository>
                <id>JBoss</id>
                <name>JBoss Repository</name>
                <url>https://repository.jboss.org/nexus/content/groups/public/</url>
            </repository>
            <repository>
                <id>Glassfish</id>
                <name>Glassfish Repository</name>
                <url>http://download.java.net/maven/glassfish</url>
            </repository>
            <repository>
                <id>prime-repo</id>
                <name>PrimeFaces Maven Repository</name>
                <url>http://repository.primefaces.org</url>
                <layout>default</layout>
            </repository>
        </repositories>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-ear-plugin</artifactId>
                <version>2.7</version>
                <configuration>
                    <version>6</version>
                    <defaultLibBundleDir>lib</defaultLibBundleDir>
                    <modules>
                        <jarModule>
                            <groupId>com.actionbazaar.chapter3</groupId>
                            <artifactId>ActionBazaar-client</artifactId>
                            <bundleFileName>ActionBazaar-client.jar</bundleFileName>
                            <includeInApplicationXml>true</includeInApplicationXml>
                        </jarModule>
                        <webModule>
                            <groupId>com.actionbazaar.chapter3</groupId>
                            <bundleFileName>ActionBazaar-web.war</bundleFileName>
                            <artifactId>ActionBazaar-web</artifactId>
                            <contextRoot>actionbazaar</contextRoot>
                        </webModule>
                        <ejbModule>
                            <groupId>com.actionbazaar.chapter3</groupId>
                            <bundleFileName>ActionBazaar-ejb.jar</bundleFileName>
                            <artifactId>ActionBazaar-ejb</artifactId>
                        </ejbModule>
                    </modules>
                </configuration>
            </plugin>
        </plugins>
        <finalName>ActionBazaar-ear</finalName>
    </build>
    <dependencies>
        <dependency>
            <groupId>com.actionbazaar.chapter3</groupId>
            <artifactId>ActionBazaar-client</artifactId>
            <version>1.0-SNAPSHOT</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>com.actionbazaar.chapter3</groupId>
            <artifactId>ActionBazaar-ejb</artifactId>
            <version>1.0-SNAPSHOT</version>
            <type>ejb</type>
        </dependency>
        <dependency>
            <groupId>com.actionbazaar.chapter3</groupId>
            <artifactId>ActionBazaar-web</artifactId>
            <version>1.0-SNAPSHOT</version>
            <type>war</type>
        </dependency>
    </dependencies>
    <properties>
        <netbeans.hint.deploy.server>gfv3ee6</netbeans.hint.deploy.server>
    </properties>
</project>


text:
package com.thoughtworks.go.helper;

import com.thoughtworks.go.config.MagicalGoConfigXmlWriter;
import com.thoughtworks.go.config.PipelineConfig;
import com.thoughtworks.go.config.materials.mercurial.HgMaterial;
import com.thoughtworks.go.config.parts.PartialConfigHelper;
import com.thoughtworks.go.domain.materials.Material;

import java.io.File;

/**
 * An scm repository that is a configuration repository. Helper for tests.
 */
public class ConfigTestRepo {
    private final File baseDir;
    private final HgMaterial material;
    private  PartialConfigHelper partialConfigHelper;
    private HgTestRepo repo;

    public ConfigTestRepo(HgTestRepo repo,MagicalGoConfigXmlWriter xmlWriter)
    {
        this.repo = repo;
        baseDir = repo.prepareWorkDirectory();
        material = repo.updateTo(baseDir);

        partialConfigHelper = new PartialConfigHelper(xmlWriter,baseDir);
    }

    public void addPipelineToRepositoryAndPush(String fileName, PipelineConfig pipelineConfig) throws Exception {
        File file = new File(baseDir, fileName);
        partialConfigHelper.addFileWithPipeline(fileName, pipelineConfig);

        repo.addCommitPush(material, "added pipeline config", baseDir, file);
    }
    public void addCodeToRepositoryAndPush(String fileName,String comment, String content) throws Exception {
        File file = new File(baseDir, fileName);
        partialConfigHelper.writeFileWithContent(fileName, content);

        repo.addCommitPush(material, comment, baseDir, file);
    }

    public HgMaterial getMaterial() {
        return material;
    }
}


text:
using System;
using System.Xml.Serialization;
using HyperFastCgi.Helpers.Logging;

namespace HyperFastCgi.Configuration
{
	[Serializable]
	[XmlRoot("log")]
	public class LogConfig
	{
		private LogLevel level = LogLevel.Error;
		private bool writeToConsole = true;

		[XmlAttribute("level")]
		public LogLevel Level {
			get { return level; }
			set { level = value; }
		}

		[XmlAttribute("write-to-console")]
		public bool WriteToConsole {
			get { return writeToConsole; }
			set { writeToConsole = value; }
		}
	}
}


text:
namespace net {

namespace ct {

namespace {

const char kLogDescription[] = "somelog";

class SignedCertificateTimestampTest : public ::testing::Test {
 public:
  virtual void SetUp() OVERRIDE {
    GetX509CertSCT(&sample_sct_);
    sample_sct_->origin = SignedCertificateTimestamp::SCT_FROM_OCSP_RESPONSE;
    sample_sct_->log_description = kLogDescription;
  }

 protected:
  scoped_refptr<SignedCertificateTimestamp> sample_sct_;
};

TEST_F(SignedCertificateTimestampTest, PicklesAndUnpickles) {
  Pickle pickle;

  sample_sct_->Persist(&pickle);
  PickleIterator iter(pickle);

  scoped_refptr<SignedCertificateTimestamp> unpickled_sct(
      SignedCertificateTimestamp::CreateFromPickle(&iter));

  SignedCertificateTimestamp::LessThan less_than;

  ASSERT_FALSE(less_than(sample_sct_, unpickled_sct));
  ASSERT_FALSE(less_than(unpickled_sct, sample_sct_));
  ASSERT_EQ(sample_sct_->origin, unpickled_sct->origin);
  ASSERT_EQ(sample_sct_->log_description, unpickled_sct->log_description);
}

}  // namespace

}  // namespace ct

}  // namespace net


text:
from datetime import date
import tornado.escape
import tornado.ioloop
import tornado.web
import logging

import json

from pymongo import MongoClient     #Load Results into MongoDB

#Website
#http://www.drdobbs.com/open-source/building-restful-apis-with-tornado/240160382?pgno=1

#http://localhost:8898/?get_json={"34":35,"35":36}
#https://www.safaribooksonline.com/library/view/introduction-to-tornado/9781449312787/ch01s02.html

from tornado.log import enable_pretty_logging
enable_pretty_logging()

client = MongoClient()
db = client.kirk

class RESTHandler(tornado.web.RequestHandler):
    def get(self):
        json_request = self.get_argument('get_json')
        logging.info("RESTHandler Request")
        logging.info(json_request)
        result = db.robot.insert_one(json.loads(json_request))
        self.write('{"return":"good"}')
application = tornado.web.Application([
    (r"/", RESTHandler)
])

if __name__ == "__main__":
    application.listen(8889)
    tornado.ioloop.IOLoop.instance().start()


text:
<!doctype html>

    <meta charset="utf-8">

    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="manifest" href="manifest.json">
    <meta name="mobile-web-app-capable" content="yes">
    <link href="https://fonts.googleapis.com/css?family=Lora:400,400italic,700,700italic" rel="stylesheet" type="text/css">
    <link href="https://fonts.googleapis.com/css?family=Montserrat:200,500" rel="stylesheet">
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <title>Kane Clover - UX Designer & Full Stack Developer</title>

    If you're seeing this message, that means JavaScript has been disabled on your browser, please enable JS to make this app work.


text:
'use strict';

var express = require('express'),
    app = express(),
    port = process.env.PORT || 9000,
    path = require('path'),
    ngAppPath = path.resolve(__dirname, '../app'), //serve our angular app
    version = 'v1';

// Configuration
app.set('port', port);
app.engine('html', require('ejs').renderFile);
app.set('view engine', 'html');
// Serve static angular app
app.use(express.static(ngAppPath));
app.set('views', ngAppPath);

// Register all backend url endpoints
require(__dirname + '/controller/api-routes.js')(app, version);

// Start server
var server = app.listen(port, function() {
    console.log('Server started on port: ' + port);
});

// Export the server as a module.
module.exports = server;


text:
#import <iWorkImport/TSSStyle.h>

#import "TSSPreset-Protocol.h"

@class NSString;

// Not exported
@interface TSWPListStyle : TSSStyle <TSSPreset>
{
}

+ (id)presetStyleDescriptor;
+ (id)pDefaultLabelValuesForLabelTypeProperty:(int)arg1;
+ (id)pLabelTypeArrayForType:(int)arg1;
+ (id)CJKListNameForNumberType:(int)arg1;
+ (id)propertyMapForListNumberType:(int)arg1;
+ (id)listStyleWithNumberType:(int)arg1 inStyleSheet:(id)arg2 withNumberedPresetStyle:(id)arg3;
+ (id)numberedlistStyleForPresets:(id)arg1;
+ (id)harvardStyleWithContext:(id)arg1;
+ (id)defaultStyleWithContext:(id)arg1 type:(int)arg2;
+ (id)defaultStyleWithContext:(id)arg1;
+ (id)defaultPropertyMap;
+ (id)defaultMissingBulletImage;
+ (id)defaultLabelGeometries;
+ (id)defaultLabelIndents;
+ (id)defaultTextIndents;
+ (void)pGetDefaultTextIndentFloats:(double [9])arg1;
+ (_Bool)defaultTieredNumber;
+ (int)defaultLabelNumberType;
+ (id)defaultLabelString;
+ (int)firstLabelTypeForPropertyMapping:(id)arg1;
+ (int)labelTypeForLevel:(unsigned long long)arg1 forPropertyMapping:(id)arg2;
+ (int)effectiveTypeForLevel:(unsigned long long)arg1 forPropertyMapping:(id)arg2;
+ (int)pLabelTypeForLevel:(unsigned long long)arg1 forPropertyMapping:(id)arg2 includeDegenerateLevels:(_Bool)arg3;
+ (_Bool)isDefaultMissingBulletImage:(id)arg1;
+ (id)propertiesAllowingNSNull;
+ (id)properties;
+ (id)stickyOverrideProperties;
@property(readonly, nonatomic) NSString *presetKind;
- (void)saveToArchive:(struct ListStyleArchive *)arg1 archiver:(id)arg2;
- (void)saveToArchiver:(id)arg1;
- (void)loadFromArchive:(const struct ListStyleArchive *)arg1 unarchiver:(id)arg2;
- (id)initFromUnarchiver:(id)arg1;
- (id)overridePropertyMapWithValue:(id)arg1 forProperty:(int)arg2 atParagraphLevels:(id)arg3 withContext:(id)arg4;
- (id)pOverrideArrayWithValue:(id)arg1 forProperty:(int)arg2 atParagraphLevels:(id)arg3 withContext:(id)arg4;
- (int)firstLabelType;
- (int)labelTypeForLevel:(unsigned long long)arg1;
- (int)effectiveTypeForLevel:(unsigned long long)arg1;
- (double)textIndentForLevel:(unsigned long long)arg1 fontSize:(double)arg2;
- (double)labelIndentForLevel:(unsigned long long)arg1;
- (id)initWithContext:(id)arg1 name:(id)arg2 overridePropertyMap:(id)arg3 isVariation:(_Bool)arg4;

@end


text:
namespace aid {

    template<typename Type>
    struct void_delete {
        void operator()(void* ptr) {
            delete static_cast<Type*>(ptr);
        }
    };

}


text:
<!DOCTYPE html>

    <title>Example</title>

    <link rel="stylesheet" type="text/css" href="jquery-ui-1.8.16.custom.css"/>

    <form>
        <input class="jqButton" type="submit" id="inputSubmit" value="Submit">
        <input class="jqButton" type="reset" id="inputReset" value="Reset">
        <input class="jqButton" type="button" id="inputButton" value="Input Button">
        <button class="jqButton">Button Element</button>
        A Element
    </form>