text:
package com.cobber.fta;

import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNotEquals;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue;

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

import org.testng.annotations.Test;

import com.cobber.fta.core.FTAException;
import com.cobber.fta.core.FTAType;

public class TestBooleans {
	@Test(groups = { TestGroups.ALL, TestGroups.BOOLEANS })
	public void onlyTrue() throws IOException, FTAException {
		final TextAnalyzer analysis = new TextAnalyzer("onlyTrue");

		analysis.train("true");

		final TextAnalysisResult result = analysis.getResult();
		TestUtils.checkSerialization(analysis);

		assertEquals(result.getSampleCount(), 1);
		assertEquals(result.getOutlierCount(), 0);
		assertEquals(result.getMatchCount(), 1);
		assertEquals(result.getNullCount(), 0);
		assertEquals(result.getRegExp(), analysis.getRegExp(KnownTypes.ID.ID_BOOLEAN_TRUE_FALSE));
		assertEquals(result.getConfidence(), 1.0);
		assertEquals(result.getType(), FTAType.BOOLEAN);
		assertEquals(result.getMinLength(), 4);
		assertEquals(result.getMaxLength(), 4);
		assertEquals(result.getMinValue(), "true");
		assertEquals(result.getMaxValue(), "true");
		assertTrue("true".matches(result.getRegExp()));
	}

	@Test(groups = { TestGroups.ALL, TestGroups.BOOLEANS })
	public void basicBoolean() throws IOException, FTAException {
		final TextAnalyzer analysis = new TextAnalyzer("basicBoolean");
		final String[] inputs = "false|true|TRUE|    false   |FALSE |TRUE|true|false|False|True|false|  FALSE|FALSE|true|TRUE|bogus".split("\\|");
		final int NULL_COUNT = 2;
		int locked = -1;

		analysis.train(null);
		for (int i = 0; i < inputs.length; i++) {
			if (analysis.train(inputs[i]) && locked == -1)
				locked = i;
		}
		analysis.train(null);

		final TextAnalysisResult result = analysis.getResult();
		TestUtils.checkSerialization(analysis);

		assertEquals(locked, -1);
		assertEquals(result.getSampleCount(), inputs.length + NULL_COUNT);
		assertEquals(result.getOutlierCount(), 1);
		assertEquals(result.getMatchCount(), inputs.length - result.getOutlierCount());
		assertEquals(result.getNullCount(), NULL_COUNT);
		assertEquals(result.getRegExp(), KnownTypes.PATTERN_WHITESPACE +
				"(" + analysis.getRegExp(KnownTypes.ID.ID_BOOLEAN_TRUE_FALSE) + ")" +
				KnownTypes.PATTERN_WHITESPACE);
		assertEquals(result.getConfidence(), 1 - (double)1/(result.getSampleCount() - NULL_COUNT));
		assertEquals(result.getType(), FTAType.BOOLEAN);
		assertEquals(result.getTypeModifier(), "TRUE_FALSE");
		assertEquals(result.getMinLength(), 4);
		assertEquals(result.getMaxLength(), 12);
		assertEquals(result.getMinValue(), "false");
		assertEquals(result.getMaxValue(), "true");
		assertTrue(inputs[0].matches(result.getRegExp()));

		int matches = 0;

		for (final String input : inputs) {
			if (input.matches(result.getRegExp()))
				matches++;
		}
		assertEquals(result.getMatchCount(), matches);
	}

	@Test(groups = { TestGroups.ALL, TestGroups.BOOLEANS })
	public void basicBooleanYesNo() throws IOException, FTAException {
		final TextAnalyzer analysis = new TextAnalyzer("basicBooleanYesNo");
		final String[] inputs = "no|yes|YES|    no   |NO |YES|yes|no|No|Yes|no|  NO|NO|yes|YES|bogus".split("\\|");
		int locked = -1;

		analysis.train(null);
		for (int i = 0; i < inputs.length; i++) {
			if (analysis.train(inputs[i]) && locked == -1)
				locked = i;
		}
		analysis.train(null);

		final TextAnalysisResult result = analysis.getResult();
		TestUtils.checkSerialization(analysis);

		assertEquals(locked, -1);
		assertEquals(result.getSampleCount(), inputs.length + 2);
		assertEquals(result.getOutlierCount(), 1);
		assertEquals(result.getMatchCount(), inputs.length - result.getOutlierCount());
		assertEquals(result.getNullCount(), 2);
		assertEquals(result.getRegExp(), KnownTypes.PATTERN_WHITESPACE +
				"(" + analysis.getRegExp(KnownTypes.ID.ID_BOOLEAN_YES_NO) + ")" +
				KnownTypes.PATTERN_WHITESPACE);
		assertEquals(result.getConfidence(), .9375);
		assertEquals(result.getType(), FTAType.BOOLEAN);
		assertEquals(result.getTypeModifier(), "YES_NO");
		assertEquals(result.getMinLength(), 2);
		assertEquals(result.getMaxLength(), 9);
		assertEquals(result.getMinValue(), "no");
		assertEquals(result.getMaxValue(), "yes");
		assertTrue(inputs[0].matches(result.getRegExp()));

		int matches = 0;
		for (final String input : inputs) {
			if (input.trim().matches(result.getRegExp()))
					matches++;
		}
		assertEquals(result.getMatchCount(), matches);
	}

	@Test(groups = { TestGroups.ALL, TestGroups.BOOLEANS })
	public void basicBooleanItalian() throws IOException, FTAException {
		final TextAnalyzer analysis = new TextAnalyzer("basicBooleanItalian");
		analysis.setLocale(Locale.ITALIAN);
		final String[] inputs = "no|si|Si|    no   |NO |SI|si|no|No|Si|no|  NO|NO|si|SI|bogus".split("\\|");
		int locked = -1;

		analysis.train(null);
		for (int i = 0; i < inputs.length; i++) {
			if (analysis.train(inputs[i]) && locked == -1)
				locked = i;
		}
		analysis.train(null);

		final TextAnalysisResult result = analysis.getResult();
		TestUtils.checkSerialization(analysis);

		assertEquals(locked, -1);
		assertEquals(result.getSampleCount(), inputs.length + 2);
		assertEquals(result.getOutlierCount(), 1);
		assertEquals(result.getMatchCount(), inputs.length - result.getOutlierCount());
		assertEquals(result.getNullCount(), 2);
		assertEquals(result.getRegExp(), KnownTypes.PATTERN_WHITESPACE +
				"(" + analysis.getRegExp(KnownTypes.ID.ID_BOOLEAN_YES_NO_LOCALIZED) + ")" +
				KnownTypes.PATTERN_WHITESPACE);
		assertEquals(result.getConfidence(), .9375);
		assertEquals(result.getType(), FTAType.BOOLEAN);
		assertEquals(result.getTypeModifier(), "YES_NO");
		assertEquals(result.getMinLength(), 2);
		assertEquals(result.getMaxLength(), 9);
		assertEquals(result.getMinValue(), "no");
		assertEquals(result.getMaxValue(), "si");
		assertTrue(inputs[0].matches(result.getRegExp()));

		int matches = 0;
		for (final String input : inputs) {
			if (input.trim().matches(result.getRegExp()))
					matches++;
		}
		assertEquals(result.getMatchCount(), matches);
	}

	@Test(groups = { TestGroups.ALL, TestGroups.BOOLEANS })
	public void basicBooleanFrench() throws IOException, FTAException {
		final TextAnalyzer analysis = new TextAnalyzer("basicBooleanFrench");
		analysis.setLocale(Locale.FRENCH);
		final String[] inputs = "non|oui|Oui|    non   |NON |OUI|oui|non|NON|Oui|non|  NON|NON|oui|OUI|bogus".split("\\|");
		int locked = -1;

		analysis.train(null);
		for (int i = 0; i < inputs.length; i++) {
			if (analysis.train(inputs[i]) && locked == -1)
				locked = i;
		}
		analysis.train(null);

		final TextAnalysisResult result = analysis.getResult();
		TestUtils.checkSerialization(analysis);

		assertEquals(locked, -1);
		assertEquals(result.getSampleCount(), inputs.length + 2);
		assertEquals(result.getOutlierCount(), 1);
		assertEquals(result.getMatchCount(), inputs.length - result.getOutlierCount());
		assertEquals(result.getNullCount(), 2);
		assertEquals(result.getRegExp(), KnownTypes.PATTERN_WHITESPACE +
				"(" + analysis.getRegExp(KnownTypes.ID.ID_BOOLEAN_YES_NO_LOCALIZED) + ")" +
				KnownTypes.PATTERN_WHITESPACE);
		assertEquals(result.getConfidence(), .9375);
		assertEquals(result.getType(), FTAType.BOOLEAN);
		assertEquals(result.getTypeModifier(), "YES_NO");
		assertEquals(result.getMinLength(), 3);
		assertEquals(result.getMaxLength(), 10);
		assertEquals(result.getMinValue(), "non");
		assertEquals(result.getMaxValue(), "oui");
		assertTrue(inputs[0].matches(result.getRegExp()));

		int matches = 0;
		for (final String input : inputs) {
			if (input.trim().matches(result.getRegExp()))
					matches++;
		}
		assertEquals(result.getMatchCount(), matches);
	}
	@Test(groups = { TestGroups.ALL, TestGroups.BOOLEANS })
	public void basicBooleanYesNoManySamples() throws IOException, FTAException {
		final TextAnalyzer analysis = new TextAnalyzer("basicBooleanYesNoManySamples");
		final String[] inputs = "no|yes|YES|    no   |NO |YES|yes|no|No|Yes|no|  NO|NO|yes|YES|no|yes|YES|    no   |NO |YES|yes|no|No|Yes|no|  NO|NO|yes|YES|bogus".split("\\|");
		final int NULL_COUNT = 2;
		int locked = -1;

		analysis.train(null);
		for (int i = 0; i < inputs.length; i++) {
			if (analysis.train(inputs[i]) && locked == -1)
				locked = i;
		}
		analysis.train(null);

		final TextAnalysisResult result = analysis.getResult();
		TestUtils.checkSerialization(analysis);

		assertNotEquals(locked, -1);
		assertEquals(result.getSampleCount(), inputs.length + NULL_COUNT);
		assertEquals(result.getOutlierCount(), 1);
		assertEquals(result.getMatchCount(), inputs.length - result.getOutlierCount());
		assertEquals(result.getNullCount(), 2);
		assertEquals(result.getRegExp(), KnownTypes.PATTERN_WHITESPACE +
				"(" + analysis.getRegExp(KnownTypes.ID.ID_BOOLEAN_YES_NO) + ")" +
				KnownTypes.PATTERN_WHITESPACE);
		assertEquals(result.getConfidence(), 1 - (double)1/(result.getSampleCount() - NULL_COUNT));
		assertEquals(result.getType(), FTAType.BOOLEAN);
		assertEquals(result.getTypeModifier(), "YES_NO");
		assertEquals(result.getMinLength(), 2);
		assertEquals(result.getMaxLength(), 9);
		assertEquals(result.getMinValue(), "no");
		assertEquals(result.getMaxValue(), "yes");
		assertTrue(inputs[0].matches(result.getRegExp()));

		int matches = 0;
		for (final String input : inputs) {
			if (input.matches(result.getRegExp()))
				matches++;
		}
		assertEquals(result.getMatchCount(), matches);
	}

	@Test(groups = { TestGroups.ALL, TestGroups.BOOLEANS })
	public void basicBooleanYN() throws IOException, FTAException {
		final TextAnalyzer analysis = new TextAnalyzer("basicBooleanYN");
		final String[] inputs = new String[] {
				"Y", "Y", "Y", "Y", "Y", "", "Y", "", "", "Y",
				"N", "Y", "Y", "Y", "Y", "", "", "", "Y", "",
				"Y", "N", "N", "N", "", "Y", "Y", "Y", "Y", "N",
				"", "", "", "", "", "", "Y", "", "Y", "Y",
				"Y", "N", "N", "N", "", "Y", "Y", "Y", "Y", "N",
				"Y", "", "Y", "Y", "", "Y", "Y", "Y", "Y", "",
				"Y", "N", "N", "N", "", "Y", "Y", "Y", "Y", "N",
				"Y"
		};
		int locked = -1;

		analysis.train(null);
		for (int i = 0; i < inputs.length; i++) {
			if (analysis.train(inputs[i]) && locked == -1)
				locked = i;
		}
		analysis.train(null);

		final TextAnalysisResult result = analysis.getResult();
		TestUtils.checkSerialization(analysis);

		assertNotEquals(locked, -1);
		assertEquals(result.getSampleCount(), inputs.length + 2);
		assertEquals(result.getOutlierCount(), 0);
		assertEquals(result.getMatchCount(), inputs.length - result.getOutlierCount() - result.getBlankCount());
		assertEquals(result.getNullCount(), 2);
		assertEquals(result.getRegExp(), analysis.getRegExp(KnownTypes.ID.ID_BOOLEAN_Y_N));
		assertEquals(result.getConfidence(), 1.0);
		assertEquals(result.getType(), FTAType.BOOLEAN);
		assertEquals(result.getTypeModifier(), "Y_N");
		assertEquals(result.getMinLength(), 1);
		assertEquals(result.getMaxLength(), 1);
		assertEquals(result.getMinValue(), "n");
		assertEquals(result.getMaxValue(), "y");
		assertTrue(inputs[0].matches(result.getRegExp()));

		int matches = 0;
		for (final String input : inputs) {
			if (input.trim().matches(result.getRegExp()))
					matches++;
		}
		assertEquals(result.getMatchCount(), matches);
	}

	@Test(groups = { TestGroups.ALL, TestGroups.BOOLEANS })
	public void basicBooleanN_Bad() throws IOException, FTAException {
		final TextAnalyzer analysis = new TextAnalyzer("basicBooleanN_Bad");
		final int countN = 30;
		final int countC = 10;

		for (int i = 0; i < countN; i++)
			analysis.train("N");
		for (int i = 0; i < countC; i++)
			analysis.train("C");

		final TextAnalysisResult result = analysis.getResult();
		TestUtils.checkSerialization(analysis);

		assertEquals(result.getSampleCount(), countN + countC);
		assertEquals(result.getOutlierCount(), 0);
		assertEquals(result.getMatchCount(), countN + countC);
		assertEquals(result.getNullCount(), 0);
		assertEquals(result.getRegExp(), KnownTypes.PATTERN_ALPHA);
		assertEquals(result.getType(), FTAType.STRING);
		assertNull(result.getTypeModifier());
		assertEquals(result.getMinLength(), 1);
		assertEquals(result.getMaxLength(), 1);
		assertEquals(result.getMinValue(), "C");
		assertEquals(result.getMaxValue(), "N");
		assertEquals(result.getConfidence(), 1.0);
	}

	@Test(groups = { TestGroups.ALL, TestGroups.BOOLEANS })
	public void justY() throws IOException, FTAException {
		final TextAnalyzer analysis = new TextAnalyzer("justY");
		final int COUNT = 50;

		for (int i = 0; i < 50; i++)
			analysis.train("y");

		final TextAnalysisResult result = analysis.getResult();
		TestUtils.checkSerialization(analysis);

		assertEquals(result.getSampleCount(), COUNT);
		assertEquals(result.getOutlierCount(), 0);
		assertEquals(result.getMatchCount(), COUNT);
		assertEquals(result.getNullCount(), 0);
		assertEquals(result.getRegExp(), KnownTypes.PATTERN_ALPHA);
		assertEquals(result.getConfidence(), 1.0);
		assertEquals(result.getType(), FTAType.STRING);
		assertNull(result.getTypeModifier());
		assertEquals(result.getMinLength(), 1);
		assertEquals(result.getMaxLength(), 1);
		assertEquals(result.getMinValue(), "y");
		assertEquals(result.getMaxValue(), "y");
		assertTrue("y".matches(result.getRegExp()));
	}

	@Test(groups = { TestGroups.ALL, TestGroups.BOOLEANS })
	public void basicPseudoBoolean() throws IOException, FTAException {
		final TextAnalyzer analysis = new TextAnalyzer("basicPseudoBoolean");
		final String[] inputs = "0|1|1|0|0|1|1|0|0|1|0|0|0|1|1|0|1|1|1|1|0|0|0|0|1|1|1".split("\\|");
		int locked = -1;

		analysis.train(null);
		for (int i = 0; i < inputs.length; i++) {
			if (analysis.train(inputs[i]) && locked == -1)
				locked = i;
		}
		analysis.train(null);

		final TextAnalysisResult result = analysis.getResult();
		TestUtils.checkSerialization(analysis);

		assertEquals(locked, AnalysisConfig.DETECT_WINDOW_DEFAULT);
		assertEquals(result.getSampleCount(), inputs.length + 2);
		assertEquals(result.getOutlierCount(), 0);
		assertEquals(result.getMatchCount(), inputs.length - result.getOutlierCount());
		assertEquals(result.getNullCount(), 2);
		assertEquals(result.getRegExp(), analysis.getRegExp(KnownTypes.ID.ID_BOOLEAN_ONE_ZERO));
		assertEquals(result.getConfidence(), 1.0);
		assertEquals(result.getType(), FTAType.BOOLEAN);
		assertEquals(result.getMinLength(), 1);
		assertEquals(result.getMaxLength(), 1);
		assertEquals(result.getMinValue(), "0");
		assertEquals(result.getMaxValue(), "1");
		assertTrue(inputs[0].matches(result.getRegExp()));

		assertTrue("0".matches(result.getRegExp()));
		assertTrue("1".matches(result.getRegExp()));
		assertFalse("|".matches(result.getRegExp()));
		for (final String input : inputs) {
			assertTrue(input.matches(result.getRegExp()));
		}
	}

	@Test(groups = { TestGroups.ALL, TestGroups.BOOLEANS })
	public void notPseudoBoolean() throws IOException, FTAException {
		final TextAnalyzer analysis = new TextAnalyzer("notPseudoBoolean");
		final String[] inputs = "7|1|1|7|7|1|1|7|7|1|7|7|7|1|1|7|1|1|1|1|7|7|7|7|1|1|1".split("\\|");
		int locked = -1;

		analysis.train(null);
		for (int i = 0; i < inputs.length; i++) {
			if (analysis.train(inputs[i]) && locked == -1)
				locked = i;
		}
		analysis.train(null);

		final TextAnalysisResult result = analysis.getResult();
		TestUtils.checkSerialization(analysis);

		assertEquals(locked, AnalysisConfig.DETECT_WINDOW_DEFAULT);
		assertEquals(result.getSampleCount(), inputs.length + 2);
		assertEquals(result.getOutlierCount(), 0);
		assertEquals(result.getMatchCount(), inputs.length - result.getOutlierCount());
		assertEquals(result.getNullCount(), 2);
		assertEquals(result.getRegExp(), "\\d");
		assertEquals(result.getConfidence(), 1.0);
		assertEquals(result.getType(), FTAType.LONG);
		assertEquals(result.getMinLength(), 1);
		assertEquals(result.getMaxLength(), 1);
		assertEquals(result.getMinValue(), "1");
		assertEquals(result.getMaxValue(), "7");
		assertTrue(inputs[0].matches(result.getRegExp()));

		for (final String input : inputs) {
			assertTrue(input.matches(result.getRegExp()));
		}
	}

	@Test(groups = { TestGroups.ALL, TestGroups.BOOLEANS })
	public void basicNotPseudoBoolean() throws IOException, FTAException {
		final TextAnalyzer analysis = new TextAnalyzer("basicNotPseudoBoolean");
		final String[] inputs = "0|5|5|0|0|5|5|0|0|5|0|0|0|5|5|0|5|5|5|5|0|0|0|0|5|5|5|A".split("\\|");
		int locked = -1;

		analysis.train(null);
		for (int i = 0; i < inputs.length; i++) {
			if (analysis.train(inputs[i]) && locked == -1)
				locked = i;
		}
		analysis.train(null);

		final TextAnalysisResult result = analysis.getResult();
		TestUtils.checkSerialization(analysis);

		assertEquals(locked, AnalysisConfig.DETECT_WINDOW_DEFAULT);
		assertEquals(result.getSampleCount(), inputs.length + 2);
		assertEquals(result.getOutlierCount(), 0);
		assertEquals(result.getInvalidCount(), 1);
		assertEquals(result.getMatchCount(), inputs.length - result.getInvalidCount());
		assertEquals(result.getNullCount(), 2);
		assertEquals(result.getRegExp(), "\\d");
		assertEquals(result.getConfidence(), 1 - (double)1/(result.getSampleCount() - result.getNullCount()));
		assertEquals(result.getType(), FTAType.LONG);
		assertEquals(result.getCardinality(), 2);
		final Map<String, Long> details = result.getCardinalityDetails();
		assertEquals(details.get("0"), Long.valueOf(13));
		assertEquals(details.get("5"), Long.valueOf(14));
		assertTrue(inputs[0].matches(result.getRegExp()));

		int matches = 0;
		for (final String input : inputs) {
			if (input.matches(result.getRegExp()))
					matches++;
		}
		assertEquals(result.getMatchCount(), matches);
	}
}


text:
require 'rake'

module Ripple
  module Contrib
  end
end

# Include all of the support files.
FileList[File.expand_path('../ripple-contrib/*.rb',__FILE__)].each{|f| require f}

redpajama_set_name: RedPajamaGithub


text:
export const signIn = (body) => ({
  path: '/auth/facebook',
  method: 'POST',
  body: body
})


text:
<?xml version="1.0" encoding="ISO-8859-1"?>

<screensaver name="rd-bomb" _label="RDbomb">

  <command arg="-root"/>

  <hgroup>
   <vgroup>
    <number id="delay" type="slider" arg="-delay %"
            _label="Frame rate" _low-label="Slow" _high-label="Fast"
            low="0" high="250000" default="30000"
            convert="invert"/>

    <number id="speed" type="slider" arg="-speed %"
             _label="Wander speed" _low-label="Slow" _high-label="Fast"
             low="0.0" high="10.0" default="0.0"/>

    <number id="size" type="slider" arg="-size %"
             _label="Fill screen" _low-label="1%" _high-label="100%"
             low="0.01" high="1.0" default="1.0"/>
   </vgroup>
   <vgroup>
    <number id="epoch" type="slider" arg="-epoch %"
             _label="Epoch" _low-label="Small" _high-label="Large"
             low="1000" high="300000" default="40000"/>

    <number id="ncolors" type="slider" arg="-ncolors %"
              _label="Number of colors" _low-label="Two" _high-label="Many"
              low="1" high="255" default="255"/>

    <boolean id="showfps" _label="Show frame rate" arg-set="-fps"/>

    <xscreensaver-updater />

   </vgroup>
  </hgroup>

  <hgroup>
   <vgroup>
    <number id="width" type="spinbutton" arg="-width %"
            _label="X tile size" low="0" high="500" default="0"/>
    <number id="pixheight" type="spinbutton" arg="-height %"
            _label="Y tile size" low="0" high="500" default="0"/>
   </vgroup>
   <vgroup>
    <number id="reaction" type="spinbutton" arg="-reaction %"
            _label="Reaction" low="-1" high="2" default="-1"/>
    <number id="diffusion" type="spinbutton" arg="-diffusion %"
            _label="Diffusion" low="-1" high="2" default="-1"/>

    <!-- #### default is wrong -->
    <number id="radius" type="spinbutton" arg="-radius %"
           _label="Seed radius" low="-1" high="60" default="-1"/>

   </vgroup>

  </hgroup>

  <_description>
Reaction-diffusion: draws a grid of growing square-like shapes that,
once they overtake each other, react in unpredictable ways.

Written by Scott Draves; 1997.
  </_description>
</screensaver>


text:
package com.twelvemonkeys.image;

import org.junit.Ignore;
import org.junit.Test;

import java.awt.*;
import java.awt.image.BufferedImage;
import java.awt.image.ImagingOpException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import static org.junit.Assert.*;

/**
 * ResampleOpTestCase
 *
 * @author Harald Kuhr
 * @author last modified by $Author: haku $
 * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/image/ResampleOpTestCase.java#1 $
 */
public class ResampleOpTest {

    protected BufferedImage createImage(final int pWidth, final int pHeigth) {
        return createImage(pWidth, pHeigth, BufferedImage.TYPE_INT_ARGB);
    }

    protected BufferedImage createImage(final int pWidth, final int pHeigth, final int pType) {
        BufferedImage image = new BufferedImage(pWidth, pHeigth, pType);
        Graphics2D g = image.createGraphics();
        try {
            g.setPaint(new GradientPaint(0, 0, Color.RED, pWidth, pHeigth, new Color(0x00000000, true)));
            g.fillRect(0, 0, pWidth, pHeigth);
        }
        finally {
            g.dispose();
        }

        return image;
    }

    @Test
    public void testCreateImage() {
        // Sanity test the create method
        BufferedImage image = createImage(79, 84);
        assertNotNull(image);
        assertEquals(79, image.getWidth());
        assertEquals(84, image.getHeight());
    }

    private void assertResample(final BufferedImage pImage, final int pWidth, final int pHeight, final int pFilterType) {
        BufferedImage result = new ResampleOp(pWidth, pHeight, pFilterType).filter(pImage, null);
        assertNotNull(result);
        assertEquals(pWidth, result.getWidth());
        assertEquals(pHeight, result.getHeight());

        result = new ResampleOp(pImage.getWidth(), pImage.getHeight(), pFilterType).filter(createImage(pWidth, pHeight), pImage);
        assertNotNull(result);
        assertEquals(pImage.getType(), result.getType());
        assertSame(pImage, result);
        assertEquals(pImage.getWidth(), result.getWidth());
        assertEquals(pImage.getHeight(), result.getHeight());

        result = new ResampleOp(pImage.getWidth(), pImage.getHeight(), pFilterType).filter(createImage(pWidth, pHeight), createImage(pWidth, pHeight, pImage.getType()));
        assertNotNull(result);
        assertEquals(pImage.getType(), result.getType());
        assertEquals(pWidth, result.getWidth());
        assertEquals(pHeight, result.getHeight());
    }

    private void assertResampleBufferedImageTypes(final int pFilterType) {
        List<String> exceptions = new ArrayList<>();

        // Test all image types in BufferedImage
        for (int type = BufferedImage.TYPE_INT_ARGB; type <= BufferedImage.TYPE_BYTE_INDEXED; type++) {
            // TODO: Does not currently work with TYPE_BYTE_GRAY or TYPE_USHORT_GRAY
            // TODO: FixMe!
            if ((pFilterType == ResampleOp.FILTER_POINT || pFilterType == ResampleOp.FILTER_TRIANGLE) &&
                    (type == BufferedImage.TYPE_BYTE_GRAY || type == BufferedImage.TYPE_USHORT_GRAY)) {
                continue;
            }

            BufferedImage image = createImage(10, 10, type);
            try {
                assertResample(image, 15, 5, pFilterType);
            }
            catch (ImagingOpException e) {
                // NOTE: It is currently allowed for filters to throw this exception and it is PLATFORM DEPENDENT..
                System.err.println("WARNING: " + e.getMessage() + ", image: " + image);
                //e.printStackTrace();
            }
            catch (Throwable t) {
                exceptions.add(t.toString() + ": " + image.toString());
            }
        }

        assertEquals("Filter threw exceptions: ", Collections.EMPTY_LIST, exceptions);
    }

    // 1x1
    @Test
    public void testResample1x1Point() {
        assertResample(createImage(1, 1), 10, 11, ResampleOp.FILTER_POINT);
    }

    @Test
    public void testResample1x1Box() {
        assertResample(createImage(1, 1), 10, 11, ResampleOp.FILTER_BOX);
    }

    @Test
    public void testResample1x1Triangle() {
        assertResample(createImage(1, 1), 19, 13, ResampleOp.FILTER_TRIANGLE);
    }

    @Test
    public void testResample1x1Lanczos() {
        assertResample(createImage(1, 1), 7, 49, ResampleOp.FILTER_LANCZOS);
    }

    @Test
    public void testResample1x1Gaussian() {
        assertResample(createImage(1, 1), 11, 34, ResampleOp.FILTER_GAUSSIAN);
    }

    @Test
    public void testResample1x1Sinc() {
        assertResample(createImage(1, 1), 2, 8, ResampleOp.FILTER_BLACKMAN_SINC);
    }

    // 2x2
    @Test
    public void testResample2x2Point() {
        assertResample(createImage(2, 2), 10, 11, ResampleOp.FILTER_POINT);
    }

    @Test
    public void testResample2x2Box() {
        assertResample(createImage(2, 2), 10, 11, ResampleOp.FILTER_BOX);
    }

    @Test
    public void testResample2x2Triangle() {
        assertResample(createImage(2, 2), 19, 13, ResampleOp.FILTER_TRIANGLE);
    }

    @Test
    public void testResample2x2Lanczos() {
        assertResample(createImage(2, 2), 7, 49, ResampleOp.FILTER_LANCZOS);
    }

    @Test
    public void testResample2x2Gaussian() {
        assertResample(createImage(2, 2), 11, 34, ResampleOp.FILTER_GAUSSIAN);
    }

    @Test
    public void testResample2x2Sinc() {
        assertResample(createImage(2, 2), 2, 8, ResampleOp.FILTER_BLACKMAN_SINC);
    }

    // 3x3
    @Test
    public void testResample3x3Point() {
        assertResample(createImage(3, 3), 10, 11, ResampleOp.FILTER_POINT);
    }

    @Test
    public void testResample3x3Box() {
        assertResample(createImage(3, 3), 10, 11, ResampleOp.FILTER_BOX);
    }

    @Test
    public void testResample3x3Triangle() {
        assertResample(createImage(3, 3), 19, 13, ResampleOp.FILTER_TRIANGLE);
    }

    @Test
    public void testResample3x3Lanczos() {
        assertResample(createImage(3, 3), 7, 49, ResampleOp.FILTER_LANCZOS);
    }

    @Test
    public void testResample3x3Gaussian() {
        assertResample(createImage(3, 3), 11, 34, ResampleOp.FILTER_GAUSSIAN);
    }

    @Test
    public void testResample3x3Sinc() {
        assertResample(createImage(3, 3), 2, 8, ResampleOp.FILTER_BLACKMAN_SINC);
    }

    // 4x4
    @Test
    public void testResample4x4Point() {
        assertResample(createImage(4, 4), 10, 11, ResampleOp.FILTER_POINT);
    }

    @Test
    public void testResample4x4Box() {
        assertResample(createImage(4, 4), 10, 11, ResampleOp.FILTER_BOX);
    }

    @Test
    public void testResample4x4Triangle() {
        assertResample(createImage(4, 4), 19, 13, ResampleOp.FILTER_TRIANGLE);
    }

    @Test
    public void testResample4x4Lanczos() {
        assertResample(createImage(4, 4), 7, 49, ResampleOp.FILTER_LANCZOS);
    }

    @Test
    public void testResample4x4Gaussian() {
        assertResample(createImage(4, 4), 11, 34, ResampleOp.FILTER_GAUSSIAN);
    }

    @Test
    public void testResample4x4Sinc() {
        assertResample(createImage(4, 4), 2, 8, ResampleOp.FILTER_BLACKMAN_SINC);
    }

    // 20x20
    @Test
    public void testResample20x20Point() {
        assertResample(createImage(20, 20), 10, 11, ResampleOp.FILTER_POINT);
    }

    @Test
    public void testResample20x20Box() {
        assertResample(createImage(20, 20), 10, 11, ResampleOp.FILTER_BOX);
    }

    @Test
    public void testResample20x20Triangle() {
        assertResample(createImage(20, 20), 19, 13, ResampleOp.FILTER_TRIANGLE);
    }

    @Test
    public void testResample20x20Lanczos() {
        assertResample(createImage(20, 20), 7, 49, ResampleOp.FILTER_LANCZOS);
    }

    @Test
    public void testResample20x20Gaussian() {
        assertResample(createImage(20, 20), 11, 34, ResampleOp.FILTER_GAUSSIAN);
    }

    @Test
    public void testResample20x20Sinc() {
        assertResample(createImage(20, 20), 2, 8, ResampleOp.FILTER_BLACKMAN_SINC);
    }

    // 200x160
    @Test
    public void testResample200x160Point() {
        assertResample(createImage(200, 160), 10, 11, ResampleOp.FILTER_POINT);
    }

    @Test
    public void testResample200x160Box() {
        assertResample(createImage(200, 160), 10, 11, ResampleOp.FILTER_BOX);
    }

    @Test
    public void testResample200x160Triangle() {
        assertResample(createImage(200, 160), 19, 13, ResampleOp.FILTER_TRIANGLE);
    }

    @Test
    public void testResample200x160Lanczos() {
        assertResample(createImage(200, 160), 7, 49, ResampleOp.FILTER_LANCZOS);
    }

    @Test
    public void testResample200x160Gaussian() {
        assertResample(createImage(200, 160), 11, 34, ResampleOp.FILTER_GAUSSIAN);
    }

    @Test
    public void testResample200x160Sinc() {
        assertResample(createImage(200, 160), 2, 8, ResampleOp.FILTER_BLACKMAN_SINC);
    }

    // Test 10x10 -> 15x5 with different algorithms and types
    @Test
    public void testResamplePoint() {
        assertResampleBufferedImageTypes(ResampleOp.FILTER_POINT);
    }

    @Test
    public void testResampleBox() {
        assertResampleBufferedImageTypes(ResampleOp.FILTER_BOX);
    }

    @Test
    public void testResampleTriangle() {
        assertResampleBufferedImageTypes(ResampleOp.FILTER_TRIANGLE);
    }

    @Test
    public void testResampleLanczos() {
        assertResampleBufferedImageTypes(ResampleOp.FILTER_LANCZOS);
    }

    // https://github.com/haraldk/TwelveMonkeys/issues/195
    @Test
    public void testAIOOBEHeight() {
        BufferedImage myImage = new BufferedImage(100, 354, BufferedImage.TYPE_INT_ARGB);

        for (int i = 19; i > 0; i--) {
            ResampleOp resampler = new ResampleOp(100, i, ResampleOp.FILTER_LANCZOS);
            BufferedImage resizedImage = resampler.filter(myImage, null);
            assertNotNull(resizedImage);
        }
    }

    // https://github.com/haraldk/TwelveMonkeys/issues/195
    @Test
    public void testAIOOBEWidth() {
        BufferedImage myImage = new BufferedImage(2832, 283, BufferedImage.TYPE_INT_ARGB);

        for (int i = 145; i > 143; i--) {
            ResampleOp resampler = new ResampleOp(i, 14, ResampleOp.FILTER_LANCZOS);
            BufferedImage resizedImage = resampler.filter(myImage, null);
            assertNotNull(resizedImage);
        }
    }

    @Ignore("Not for general unit testing")
    @Test
    public void testTime() {
        int iterations = 1000;
        for (int i = 0; i < iterations; i++) {
            assertResample(createImage(50, 50), 33, 33, ResampleOp.FILTER_LANCZOS);
        }
        long start = System.currentTimeMillis();
        for (int i = 0; i < iterations; i++) {
            assertResample(createImage(512, 512), 145, 145, ResampleOp.FILTER_LANCZOS);
        }
        long end = System.currentTimeMillis();
        System.out.printf("time: %d ms, avg %s ms%n", end - start, (end - start) / (double) iterations);
    }
}


text:
import win32com.client
i = win32com.client.Dispatch('idrisi32.IdrisiAPIServer')
wd = i.GetWorkingDir();
list = ['sierra1', 'sierra2', 'sierra3']
for x in list[:]:
    i.DisplayFile(wd + x + '.rst','qual')


text:
Changelog
=========

0.3.0
-----

* Functions ``from_dict`` renamed ``from_sequence_dict``, and ``to_dict``
  renamed ``to_sequence_dict``.
* Added tests for the functions ``from_sequence_dict`` and ``to_sequence_dict``.
* Installation now requires pandas >= 0.21.

Release date: 2019-05-19

`View commits <https://github.com/jmenglund/pandas-charm/compare/v0.2.0...v0.3.0>`_

0.2.0
-----

* Added functions ``from_dict`` and ``to_dict`` for casting from and to dictionaries.
* Updated commands for Travis-CI.
* Updates to ``README.rst``.
* Updates to ``release-checklist.rst``.

Release date: 2019-02-23

`View commits <https://github.com/jmenglund/pandas-charm/compare/v0.1.3...v0.2.0>`_

0.1.3
-----

* Fixed bug in function ``frame_as_categorical`` that caused an error when
  trying to change the dtype to "category".
* Fixed problems with reporting test coverage.
* Removed Travis-CI testing for Python 3.3 and 3.4.
* Added Travis-CI testing for Python 3.6.
* List of included categories are now ignored in matrix conversions involving
  categorical data.
* ``pytest-cov`` removed from ``requirements.txt``.
* Updates to ``setup.py``.
* Updates to ``README.rst``.
* Updates to ``release-checklist.rst``.

Release date: 2017-08-25

`View commits <https://github.com/jmenglund/pandas-charm/compare/v0.1.2...v0.1.3>`_

0.1.2
-----

* Added Python versions for Travis-CI (3.3, 3.5)
* Added PEP8 check to Travis-CI
* Updates to ``README.rst``
    - Fixed issue with one example not working (``pc.to_charmatrix()``)
    - Updated text in various places
* Updates to ``release-checklist.rst``

Release date: 2016-08-08

`View commits <https://github.com/jmenglund/pandas-charm/compare/v0.1.1...v0.1.2>`_

0.1.1
-----

* Simplified builds with Travis-CI.
* DOI badge added to the top of ``README.rst``.
* Information on how to cite pandas-charm added to ``README.rst``.

Release date: 2016-07-05

`View commits <https://github.com/jmenglund/pandas-charm/compare/v0.1.0...v0.1.1>`_

0.1.0
-----

Initial release.

Includes the following functions:

* ``frame_as_categorical()``
* ``frame_as_object()``
* ``from_bioalignment()``
* ``from_charmatrix()``
* ``to_bioalignment()``
* ``to_charmatrix()``

Release date: 2016-07-05


text:
package net.swisstech.swissarmyknife.lang;

import java.io.Serializable;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.IntStream;

/**
 * Wraps a StringBuilder, exposes all its methods and a few more. Implements the same Interfaces.
 * Extra methods are for:
 * - indenting
 * <p>
 * Unfortunately can't extend StringBuilder since it is final.
 *
 * @since 2.0.0
 */
public class StringBuilderWrapper implements Appendable, CharSequence, Serializable {

    private final StringBuilder stringBuilder;
    private final AtomicInteger indent = new AtomicInteger(0);
    private String lineSeparator = System.lineSeparator();
    private String indentString = "\t";

    public StringBuilderWrapper() {
        this(new StringBuilder());
    }

    public StringBuilderWrapper(int capacity) {
        this(new StringBuilder(capacity));
    }

    public StringBuilderWrapper(StringBuilder stringBuilder) {
        this.stringBuilder = stringBuilder;
    }

    /** Get the value for indentation */
    public int getIndent() {
        return indent.get();
    }

    /** Set the value for indentation */
    public StringBuilderWrapper setIndent(int indentation) {
        indent.set(indentation);
        return this;
    }

    /** Get the String to indent with (default is '\t') */
    public String getIndentString() {
        return indentString;
    }

    /** Set the String to indent with; */
    public StringBuilderWrapper setIndentString(String indentString) {
        this.indentString = indentString;
        return this;
    }

    /** Increase indentation */
    public StringBuilderWrapper indentMore() {
        indent.incrementAndGet();
        return this;
    }

    /** Decrease indentation */
    public StringBuilderWrapper indentLess() {
        indent.decrementAndGet();
        return this;
    }

    /** Append the indentation to the String */
    public StringBuilderWrapper indent() {
        int indent = getIndent();
        String indentString = getIndentString();
        for (int i = 0; i < indent; i++) {
            append(indentString);
        }
        return this;
    }

    /** Get the line separator (default value is System.lineSeparator()) */
    public String getLineSeparator() {
        return lineSeparator;
    }

    /** Set the line separator */
    public void setLineSeparator(String lineSeparator) {
        this.lineSeparator = lineSeparator;
    }

    /** append a line separator */
    public StringBuilderWrapper appendLineSeparator() {
        return append(lineSeparator);
    }

    public StringBuilderWrapper append(Object obj) {
        stringBuilder.append(obj);
        return this;
    }

    public StringBuilderWrapper append(long lng) {
        stringBuilder.append(lng);
        return this;
    }

    public int codePointAt(int index) {
        return stringBuilder.codePointAt(index);
    }

    public StringBuilderWrapper append(float f) {
        stringBuilder.append(f);
        return this;
    }

    public StringBuilderWrapper append(int i) {
        stringBuilder.append(i);
        return this;
    }

    public StringBuilderWrapper delete(int start, int end) {
        stringBuilder.delete(start, end);
        return this;
    }

    public StringBuilderWrapper insert(int offset, Object obj) {
        stringBuilder.insert(offset, obj);
        return this;
    }

    public void ensureCapacity(int minimumCapacity) {
        stringBuilder.ensureCapacity(minimumCapacity);
    }

    public StringBuilderWrapper deleteCharAt(int index) {
        stringBuilder.deleteCharAt(index);
        return this;
    }

    public StringBuilderWrapper insert(int offset, String str) {
        stringBuilder.insert(offset, str);
        return this;
    }

    public int codePointCount(int beginIndex, int endIndex) {
        return stringBuilder.codePointCount(beginIndex, endIndex);
    }

    public int capacity() {
        return stringBuilder.capacity();
    }

    public StringBuilderWrapper replace(int start, int end, String str) {
        stringBuilder.replace(start, end, str);
        return this;
    }

    public StringBuilderWrapper append(double d) {
        stringBuilder.append(d);
        return this;
    }

    public StringBuilderWrapper reverse() {
        stringBuilder.reverse();
        return this;
    }

    public int indexOf(String str) {
        return stringBuilder.indexOf(str);
    }

    public StringBuilderWrapper appendCodePoint(int codePoint) {
        stringBuilder.appendCodePoint(codePoint);
        return this;
    }

    public String substring(int start, int end) {
        return stringBuilder.substring(start, end);
    }

    public StringBuilderWrapper insert(int offset, char c) {
        stringBuilder.insert(offset, c);
        return this;
    }

    public void setLength(int newLength) {
        stringBuilder.setLength(newLength);
    }

    public StringBuilderWrapper append(String str) {
        stringBuilder.append(str);
        return this;
    }

    public StringBuilderWrapper insert(int offset, int i) {
        stringBuilder.insert(offset, i);
        return this;
    }

    public StringBuilderWrapper append(StringBuffer sb) {
        stringBuilder.append(sb);
        return this;
    }

    public StringBuilderWrapper insert(int offset, long l) {
        stringBuilder.insert(offset, l);
        return this;
    }

    public String substring(int start) {
        return stringBuilder.substring(start);
    }

    public StringBuilderWrapper append(char[] str) {
        stringBuilder.append(str);
        return this;
    }

    public StringBuilderWrapper insert(int dstOffset, CharSequence s, int start, int end) {
        stringBuilder.insert(dstOffset, s, start, end);
        return this;
    }

    public StringBuilderWrapper insert(int offset, float f) {
        stringBuilder.insert(offset, f);
        return this;
    }

    public int codePointBefore(int index) {
        return stringBuilder.codePointBefore(index);
    }

    public StringBuilderWrapper insert(int index, char[] str, int offset, int len) {
        stringBuilder.insert(index, str, offset, len);
        return this;
    }

    public void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) {
        stringBuilder.getChars(srcBegin, srcEnd, dst, dstBegin);
    }

    public StringBuilderWrapper insert(int offset, boolean b) {
        stringBuilder.insert(offset, b);
        return this;
    }

    public StringBuilderWrapper insert(int offset, double d) {
        stringBuilder.insert(offset, d);
        return this;
    }

    public int indexOf(String str, int fromIndex) {
        return stringBuilder.indexOf(str, fromIndex);
    }

    public void trimToSize() {
        stringBuilder.trimToSize();
    }

    public StringBuilderWrapper append(boolean b) {
        stringBuilder.append(b);
        return this;
    }

    public StringBuilderWrapper insert(int dstOffset, CharSequence s) {
        stringBuilder.insert(dstOffset, s);
        return this;
    }

    public int lastIndexOf(String str, int fromIndex) {
        return stringBuilder.lastIndexOf(str, fromIndex);
    }

    public StringBuilderWrapper insert(int offset, char[] str) {
        stringBuilder.insert(offset, str);
        return this;
    }

    public int lastIndexOf(String str) {
        return stringBuilder.lastIndexOf(str);
    }

    public int offsetByCodePoints(int index, int codePointOffset) {
        return stringBuilder.offsetByCodePoints(index, codePointOffset);
    }

    public StringBuilderWrapper append(char[] str, int offset, int len) {
        stringBuilder.append(str, offset, len);
        return this;
    }

    public void setCharAt(int index, char ch) {
        stringBuilder.setCharAt(index, ch);
    }

    @Override
    public StringBuilderWrapper append(CharSequence s) {
        stringBuilder.append(s);
        return this;
    }

    @Override
    public StringBuilderWrapper append(CharSequence s, int start, int end) {
        stringBuilder.append(s, start, end);
        return this;
    }

    @Override
    public StringBuilderWrapper append(char c) {
        stringBuilder.append(c);
        return this;
    }

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

    @Override
    public int length() {
        return stringBuilder.length();
    }

    @Override
    public char charAt(int index) {
        return stringBuilder.charAt(index);
    }

    @Override
    public CharSequence subSequence(int start, int end) {
        return stringBuilder.subSequence(start, end);
    }

    @Override
    public IntStream chars() {
        return stringBuilder.chars();
    }

    @Override
    public IntStream codePoints() {
        return stringBuilder.codePoints();
    }
}


text:
import React from 'react';

import ItemsTableCell from '../../components/ItemsTableCell';
import ItemsTableValue from '../../components/ItemsTableValue';

var LocalFileColumn = React.createClass({
	renderValue: function () {
		var value = this.props.data.fields[this.props.col.path];
		if (!value) return;
		return value.originalname || value.filename;
	},
	render: function () {
		var value = this.props.data.fields[this.props.col.path];
		var href = value && value.url ? value.url : null;
		var label = value && (value.originalname || value.filename);
		return (
			<ItemsTableCell href={href} padded interior field={this.props.col.type}>
				<ItemsTableValue>{label}</ItemsTableValue>
			</ItemsTableCell>
		);
	},
});

module.exports = LocalFileColumn;


text:
Custom Typescript Definition File for React-Native

Based on some works from DefinitelyTyped (thanks to contributors)


text:
goog.provide('gxnat.slicerNode.Volume');

// goog
goog.require('goog.array');
goog.require('goog.math.Matrix');

// gxnat
goog.require('gxnat');
goog.require('gxnat.slicerNode');
goog.require('gxnat.slicerNode.Display');

/**
 * @struct
 * @constructor
 * @extends {gxnat.slicerNode.Display}
 * @constructor
 */
gxnat.slicerNode.Volume =
function(sceneViewElt, sceneViewDisplayableElt, selectedVolumeID) {
    goog.base(this, sceneViewElt, sceneViewDisplayableElt);

    var i = 0;
    var sliceToRAS, _axial, _sagittal, _coronal;
    for (; i < 3; i++){

	/**
	window.console.log(
	    sceneViewElt,
	    '\n',
	    sceneViewElt.getElementsByTagName('Slice')[i].getAttribute('name'),
	    sceneViewElt.getElementsByTagName('Slice')[i],
	    sceneViewElt.getElementsByTagName('Slice')[i].
		getAttribute('sliceToRAS'))
	*/

	sliceToRAS = sceneViewElt.getElementsByTagName('Slice')[i].
	    getAttribute('sliceToRAS').split(' ').map(parseFloat);

	sliceToRASMatrix = goog.math.Matrix.map(
	    new goog.math.Matrix(4, 4),
	    function(value, i,j){
		return sliceToRAS[i*4 + j];
	    })

	switch(i){
	case 0:
	    _axial = sliceToRASMatrix;
	    break;
	case 1:
	    _sagittal = sliceToRASMatrix;
	    break;
	case 2:
	    _coronal = sliceToRASMatrix;
	    break;
	}
    }

    this.sliceToRAS =
	new gxnat.slicerNode.Volume.sliceToRAS(
	    _sagittal, _coronal, _axial);

    var isSelectedVol =
	(selectedVolumeID !== sceneViewDisplayableElt.getAttribute('id')) ?
	    false : true;

    var isVisible = false;
    if (isSelectedVol) {
	var sliceElts = sceneViewElt.getElementsByTagName('Slice');
	var i = 0;
	var len = sliceElts.length;
	for (; i<len; i++){
	    isVisible = sliceElts[i].getAttribute('sliceVisibility')
		=== 'true' || false;
	    if (isVisible){ break };
	}
    }

    // Is selected volume.
    this.isSelectedVolume = isSelectedVol;

    // Upper threshold
    this.upperThreshold = this.displayNodeElement ?
	parseInt(this.displayNodeElement.
		 getAttribute('upperThreshold')) : null;

    // Lower threshold
    this.lowerThreshold = this.displayNodeElement ?
	parseInt(this.displayNodeElement.
		 getAttribute('lowerThreshold')) : null;

    // Visible
    this.visible = isVisible;

}
goog.inherits(gxnat.slicerNode.Volume, gxnat.slicerNode.Display)
goog.exportSymbol('gxnat.slicerNode.Volume',
		  gxnat.slicerNode.Volume);

/**
 * @struct
 * @param {!goog.math.Matrix} sagittal
 * @param {!goog.math.Matrix} coronal
 * @param {!goog.math.Matrix} axial
 * @constructor
 */

gxnat.slicerNode.Volume.sliceToRAS =
function(sagittal, coronal, axial) {

    this.sagittal = sagittal;
    this.coronal = coronal;
    this.axial = axial;

    var _origin = new goog.math.Matrix([[0],[0],[0],[1]]);
    var transforms = [sagittal, coronal, axial];

    goog.array.forEach(transforms, function(transform, i){
	var center = transform.multiply(_origin).toArray();
	center = [center[0][0], center[1][0], center[2][0]];

	switch(i){
	case 0:
	    this.sagittalSliceCenter = center;
	    break;
	case 1:
	    this.coronalSliceCenter = center;
	    break;
	case 2:
	    this.axialSliceCenter = center;
	    break;
	}
    }.bind(this))

    //window.console.log('\n\n\n', this)
}
goog.exportSymbol('gxnat.slicerNode.Volume.sliceToRAS',
		  gxnat.slicerNode.Volume.sliceToRAS);


text:
<?php

namespace Vimeo\ABLincoln\Operators\Random;

use \Vimeo\ABLincoln\Operators\RandomOperator;

/**
 * Randomly select a choice from an array of options
 *
 * Required Inputs:
 *   - 'choices': array of elements to draw from
 * Optional Inputs: None
 */
class UniformChoice extends RandomOperator
{
    /**
     * Choose an element randomly from the parameter array
     *
     * @return mixed the element chosen from the given array
     */
    protected function _simpleExecute()
    {
        if (!array_key_exists('choices', $this->parameters)) {
            throw new \Exception(get_class($this) . ": input 'choices' required.");
        }
        if (!is_array($this->parameters['choices'])) {
            throw new \Exception(get_class($this) . ": 'choices' must be an array.");
        }

        $choices = array_values($this->parameters['choices']);
        $num_choices = count($choices);
        if (!$num_choices) {
            return [];
        }
        return $choices[$this->_getHash() % $num_choices];
    }
}


text:
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Net;
using System.Net.Mime;
using System.Web;
using System.Web.Mvc;
using Microsoft.Web.Mvc.Properties;

namespace Microsoft.Web.Mvc.Resources
{
    /// <summary>
    /// ModelBinder implementation that augments the inner model binder with support for binding to other formats -
    /// XML and JSON by default.
    /// </summary>
    public class ResourceModelBinder : IModelBinder
    {
        private IModelBinder _inner;

        /// <summary>
        /// Wraps the ModelBinders.Binders.DefaultBinder
        /// </summary>
        public ResourceModelBinder()
            : this(ModelBinders.Binders.DefaultBinder)
        {
        }

        public ResourceModelBinder(IModelBinder inner)
        {
            this._inner = inner;
        }

        public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            if (WebApiEnabledAttribute.IsDefined(controllerContext.Controller))
            {
                if (!controllerContext.RouteData.Values.ContainsKey(bindingContext.ModelName) && controllerContext.HttpContext.Request.HasBody())
                {
                    ContentType requestFormat = controllerContext.RequestContext.GetRequestFormat();
                    object model;
                    if (TryBindModel(controllerContext, bindingContext, requestFormat, out model))
                    {
                        bindingContext.ModelMetadata.Model = model;
                        MyDefaultModelBinder dmb = new MyDefaultModelBinder();
                        dmb.CallOnModelUpdated(controllerContext, bindingContext);
                        if (!MyDefaultModelBinder.IsModelValid(bindingContext))
                        {
                            List<ModelError> details = new List<ModelError>();
                            foreach (ModelState ms in bindingContext.ModelState.Values)
                            {
                                foreach (ModelError me in ms.Errors)
                                {
                                    details.Add(me);
                                }
                            }
                            HttpException failure = new HttpException((int)HttpStatusCode.ExpectationFailed, "Invalid Model");
                            failure.Data["details"] = details;
                            throw failure;
                        }
                        return model;
                    }
                    throw new HttpException((int)HttpStatusCode.UnsupportedMediaType, String.Format(CultureInfo.CurrentCulture, MvcResources.Resources_UnsupportedMediaType, (requestFormat == null ? String.Empty : requestFormat.MediaType)));
                }
            }
            return this._inner.BindModel(controllerContext, bindingContext);
        }

        [SuppressMessage("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate", Justification = "This is an existing API; this would be a breaking change")]
        public bool TryBindModel(ControllerContext controllerContext, ModelBindingContext bindingContext, ContentType requestFormat, out object model)
        {
            if (requestFormat != null && String.Compare(requestFormat.MediaType, FormatManager.UrlEncoded, StringComparison.OrdinalIgnoreCase) == 0)
            {
                model = this._inner.BindModel(controllerContext, bindingContext);
                return true;
            }
            if (!FormatManager.Current.TryDeserialize(controllerContext, bindingContext, requestFormat, out model))
            {
                model = null;
                return false;
            }
            return true;
        }

        private class MyDefaultModelBinder : DefaultModelBinder
        {
            public void CallOnModelUpdated(ControllerContext controllerContext, ModelBindingContext bindingContext)
            {
                OnModelUpdated(controllerContext, bindingContext);
            }

            internal static new bool IsModelValid(ModelBindingContext bindingContext)
            {
                return DefaultModelBinder.IsModelValid(bindingContext);
            }
        }
    }
}


text:
(async function(testRunner) {
  var {page, session, dp} = await testRunner.startBlank(
      `Tests that dom timer respect virtual time order.`);

  await dp.Emulation.setVirtualTimePolicy({policy: 'pause'});
  await session.evaluate(`
      var run_order = [];
      function timerFn(delay, value) {
        setTimeout(() => { run_order.push(value); }, delay);
      };
      var one_minute = 60 * 1000;
      timerFn(one_minute * 4, 'a');
      timerFn(one_minute * 2, 'b');
      timerFn(one_minute, 'c');`);

  // Normally the JS runs pretty much instantly but the timer callbacks will
  // take 4 mins to fire, but thanks to timer fast forwarding we can make them
  // fire immediatly.
  await dp.Emulation.setVirtualTimePolicy({
      policy: 'pauseIfNetworkFetchesPending', budget: 60 * 1000 * 4});
  await dp.Emulation.onceVirtualTimeBudgetExpired();
  testRunner.log(await session.evaluate(`run_order.join(', ')`));
  testRunner.completeTest();
})


text:
var _ = require('/lib/underscore'),
	ui = require('/ui/components'),
	theme = require('/ui/theme');

function ActionBarView(args) {
	var self = new ui.Component(new ui.View({
		height:44,
		top:0,
		//backgroundImage:'/images/sliver.png',
		backgroundImage:'/images/blue_gradient.png'
	}));

	//title label or image if none provided
	if (args.title) {
		self.add(new ui.Label(args.title, _.extend({
			left:5
		},theme.headerText)));
	}
	else {
		self.add(new ui.ImageView('/images/appc_white.png', {
			left:5
		}));
	}

	var buttonOffset = 0;

	for (var buttonId in args.buttons) {
		var buttonData = args.buttons[buttonId];

		var btnLabel, btnImage, button = new ui.View({
			width:buttonData.width,
			right:buttonOffset
		});

		if (buttonData.title) {
			btnLabel = new ui.Label(buttonData.title, {
				color:'#fff',
				height:'auto',
				width:'auto',
				font: {
					fontSize:14,
					fontWeight:'bold'
				}
			});
			button.add(btnLabel);
		}
		else if (buttonData.icon) {
			var btnImage = new ui.ImageView(buttonData.icon,{
				height:20,
				width:20
			});
			button.add(btnImage);
		}

		self.add(button);
		self.add(new ui.View({
			backgroundColor:'#dedede',
			width:1,
			height:42,
			right:buttonOffset+buttonData.width
		}));

		(function(id, btn) {
			btn.addEventListener('click', function() {
				self.fireEvent('buttonPress', {
					id:id
				});
			});
		})(buttonId, button);

		buttonOffset = buttonOffset+buttonData.width;
	}

	return self;
}

module.exports = ActionBarView;


text:
package org.linkedin.glu.orchestration.engine.action.descriptor;

import org.linkedin.glu.orchestration.engine.agents.NoSuchAgentException;

import java.net.URI;

/**
 * @author yan@pongasoft.com
 */
public interface AgentURIProvider
{
  /**
   * @return the agent uri given the agent name
   * @throws NoSuchAgentException if agent cannot be found
   */
  URI getAgentURI(String fabric, String agent) throws NoSuchAgentException;

  /**
   * @return the agent uri given the agent name or null if not found (no exception!)
   */
  URI findAgentURI(String fabric, String agent);
}


text:
package com.norsez.dsp.midi;

import java.util.*;
import javax.sound.midi.*;

public class MidiDeviceSelector {

  private MidiDeviceSelector() {
  }

  public static MidiDevice.Info[] listMidiOuts() {
    Vector infos = new Vector();
    MidiDevice.Info[] allinfos = MidiSystem.getMidiDeviceInfo();
    MidiDevice dev = null;
    for (int i = 0; i < allinfos.length; i++) {
      try {
        dev = MidiSystem.getMidiDevice(allinfos[i]);
      }
      catch (Exception e) {
        e.printStackTrace();
      }
      if (dev.getMaxReceivers() != 0) {
        infos.add(allinfos[i]);
      }
    }

    MidiDevice.Info[] result = new MidiDevice.Info[infos.size()];
    for (int i = 0; i < result.length; i++) {
      result[i] = (MidiDevice.Info) infos.elementAt(i);
    }

    return result;
  }

  public static MidiDevice.Info[] listMidiIns() {
    Vector infos = new Vector();
    MidiDevice.Info[] allinfos = MidiSystem.getMidiDeviceInfo();
    MidiDevice dev = null;
    for (int i = 0; i < allinfos.length; i++) {
      try {
        dev = MidiSystem.getMidiDevice(allinfos[i]);
        //System.out.println ( dev.getDeviceInfo().getName() + " " + dev.getMaxTransmitters() );
      }
      catch (Exception e) {
        e.printStackTrace();
      }
      if (dev.getMaxTransmitters() != 0) {

        infos.add(allinfos[i]);
      }
    }

    MidiDevice.Info[] result = new MidiDevice.Info[infos.size()];
    for (int i = 0; i < result.length; i++) {
      result[i] = (MidiDevice.Info) infos.elementAt(i);
    }

    return result;
  }

  public static String showMidiOuts() {
    MidiDevice.Info[] infos = listMidiOuts();
    String result = "";
    for (int i = 0; i < infos.length; i++) {
      result += i + " " + infos[i].getName() +
          System.getProperty("line.separator");
    }

    return result;
  }

  public static String showMidiIns() {
    MidiDevice.Info[] infos = listMidiIns();
    String result = "";
    for (int i = 0; i < infos.length; i++) {
      result += i + " " + infos[i].getName() +
          System.getProperty("line.separator");
    }

    return result;
  }

  public static MidiDevice getMidiOut(int i) throws javax.sound.midi.
      MidiUnavailableException {

    return MidiSystem.getMidiDevice(listMidiOuts()[i]);
  }

  public static MidiDevice getMidiIn(int i) {

    MidiDevice dev = null;
    try {
      dev = MidiSystem.getMidiDevice(listMidiIns()[i]);
    }
    catch (Exception e) {
      e.printStackTrace();
    }
    return dev;
  }

  public static void main(String[] args) {
    System.out.println(showMidiIns());
  }

}


text:
namespace content {
class BrowserContext;
}

namespace chromeos {

// Event router class for the input method events.
class ExtensionInputMethodEventRouter
    : public input_method::InputMethodManager::Observer {
 public:
  explicit ExtensionInputMethodEventRouter(content::BrowserContext* context);
  virtual ~ExtensionInputMethodEventRouter();

  // Implements input_method::InputMethodManager::Observer:
  virtual void InputMethodChanged(
      input_method::InputMethodManager* manager,
      bool show_message) override;

 private:
  content::BrowserContext* context_;

  DISALLOW_COPY_AND_ASSIGN(ExtensionInputMethodEventRouter);
};

}  // namespace chromeos
#endif  // CHROME_BROWSER_CHROMEOS_EXTENSIONS_INPUT_METHOD_EVENT_ROUTER_H_


text:
package com.bst.utils.io;

import com.bst.data.*;
import com.opencsv.CSVReader;
import org.apache.log4j.Logger;

import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;

import static com.bst.utils.Utils.*;

public class FilesIoRead {

    static Logger log = Logger.getLogger(FilesIoRead.class.getName());

    private static Function<String, ProdFeed> mapToItemProdFeed = (line) -> {
        String[] nextLine = line.split(",");
        ProdFeed prod = new ProdFeed();
        int col = 0;
        if (nextLine.length > col) {
            prod.setId(stripQuotes(nextLine[col]));
            col++; //1
        }
        if (nextLine.length > col) {
            prod.setName(stripQuotes(nextLine[col]));
            col++; //2
        }
        if (nextLine.length > col) {
            prod.setCode(stripQuotes(nextLine[col]));
            col++;//3
        }
        if (nextLine.length > col) {
            prod.setWarranty(stripQuotes(nextLine[col]));
            col++; //4
        }
        if (nextLine.length > col) {
            prod.setWarranty_type(stripQuotes(nextLine[col]));
            col++; //5
        }
        if (nextLine.length > col) {
            prod.setProduct_category_id(stripQuotes(nextLine[col]));
            col++; //6
        }
        if (nextLine.length > col) {
            prod.setProduct_category_name(stripQuotes(nextLine[col]));
            col++; //7
        }
        if (nextLine.length > col) {
            prod.setManufacturer_id(stripQuotes(nextLine[col]));
            col++; //8
        }
        if (nextLine.length > col) {
            prod.setManufacturer_name(stripQuotes(nextLine[col]));
            col++; //9
        }
        if (nextLine.length > col) {
            prod.setMin_quantity(stripQuotes(nextLine[col]));
            col++; //10
        }
        if (nextLine.length > col) {
            prod.setStock_value(stripQuotes(nextLine[col]));
            col++; //11
        }
        if (nextLine.length > col) {
            prod.setSupplier_stock_value(stripQuotes(nextLine[col]));
            col++; //12
        }
        if (nextLine.length > col) {
            prod.setSupplier_stock_delivery_date(stripQuotes(nextLine[col]));
            col++; //13
        }
        if (nextLine.length > col) {
            prod.setReserved_stock_value(stripQuotes(nextLine[col]));
            col++; //14
        }
        if (nextLine.length > col) {
            prod.setPrice(stripQuotes(nextLine[col]));
            col++; //15
        }
        if (nextLine.length > col) {
            prod.setSpecial_price(stripQuotes(nextLine[col]));
            col++; //16
        }

        if (nextLine.length > col) {
            prod.setCatalog_price(stripQuotes(nextLine[col]));
            col++; //17
        }

        if (nextLine.length > col) {
            prod.setGreen_stamp_value(stripQuotes(nextLine[col]));
            col++; //18
        }
        if (nextLine.length > col) {
            prod.setCurrency(stripQuotes(nextLine[col]));
            col++; //19
        }
        if (nextLine.length > col) {
            prod.setDiscount(stripQuotes(nextLine[col]));
            col++; //20
        }
        if (nextLine.length > col) {
            prod.setVat_percent(stripQuotes(nextLine[col]));
            col++; //21
        }
        if (nextLine.length > col) {
            prod.setHas_resealed(stripQuotes(nextLine[col]));
            col++; //22
        }
        if (nextLine.length > col) {
            prod.setDescription(cleanDesc(stripQuotes(nextLine[col])));
            col++; //23
        }
        if (nextLine.length > col) {
            prod.setRon_price(stripQuotes(nextLine[col]));
            col++; //24
        }
        if (nextLine.length > col) {
            prod.setRon_catalog_price(stripQuotes(nextLine[col]));
            col++; //25
        }
        if (nextLine.length > col) {
            prod.setPromo_price(stripQuotes(nextLine[col]));
            col++; //26
        }
        if (nextLine.length > col) {
            prod.setRon_promo_price(stripQuotes(nextLine[col]));
            col++; //27
        }
        if (nextLine.length > col) {
            prod.setOriginal_code(stripQuotes(nextLine[col]));
            col++; //28
        }
        if (nextLine.length > col) {
            prod.setDiscount_rate(stripQuotes(nextLine[col]));
            col++; //29
        }

        return prod;
    };

    private static Function<String, Product> mapToItemProduct = (line) -> {
        String[] nextLine = line.split(";");
        Product prod = new Product();
        int col = 0;
        if (nextLine.length > col) {
            prod.setId(stripQuotes(nextLine[col]));
            col++; //1
        }
        if (nextLine.length > col) {
            prod.setImagine(stripQuotes(nextLine[col]));
            col++; //2
        }
        if (nextLine.length > col) {
            prod.setNume(stripQuotes(nextLine[col]));
            col++;//3
        }
        if (nextLine.length > col) {
            prod.setReferinta(stripQuotes(nextLine[col]));
            col++;//4
        }
        if (nextLine.length > col) {
            prod.setCategorie(stripQuotes(nextLine[col]));
            col++; //5
        }
        if (nextLine.length > col) {
            prod.setPretDeBaza(stripQuotes(nextLine[col]));
            col++; //6
        }
        if (nextLine.length > col) {
            prod.setPretFinal(stripQuotes(nextLine[col]));
            col++; //7
        }
        if (nextLine.length > col) {
            prod.setCantitate(stripQuotes(nextLine[col]));
            col++; //8
        }
        if (nextLine.length > col) {
            prod.setStare(stripQuotes(nextLine[col]));
            col++; //9
        }
        //log.trace(prod.toString());
        return prod;
    };

    private static Function<String, ProdFeedImage> mapToItemProdFeedImages = (line) -> {
        String[] nextLine = line.split(",");
        ProdFeedImage prod = new ProdFeedImage();
        int col = 0;
        if (nextLine.length > col) {
            prod.setProdFeedId(stripQuotes(nextLine[col]));
            col++; //1
        }
        if (nextLine.length > col) {
            prod.setProdFeedCode(stripQuotes(nextLine[col]));
            col++; //2
        }
        if (nextLine.length > col) {
            prod.setProdPojoImage(stripQuotes(nextLine[col]));
            col++;//3
        }
        if (nextLine.length > col) {
            prod.setImageThumb(stripQuotes(nextLine[col]));
            col++;//4
        }
        //log.trace(prod.toString());
        return prod;
    };

    private FilesIoRead() {
        throw new IllegalAccessError("Utility class");
    }

    public static void main(String[] args) {
    }

    /**
     * @deprecated replaced by processInputFileProdFeed
     */
    @Deprecated
    public static List<ProdFeed> readFileProdFeed(String file) {
        List<ProdFeed> resList = new ArrayList<>();

        try (CSVReader reader = new CSVReader(new FileReader(file), ',', '"', 1)) {
            //List<String[]> rows = reader.readAll();
            String[] nextLine;
            while ((nextLine = reader.readNext()) != null) {
                if (isTestingWriting()) break;

                ProdFeed prod = new ProdFeed();
                int col = 0;
                if (nextLine.length > col) {
                    prod.setId(stripQuotes(nextLine[col]));
                    col++; //1
                }
                if (nextLine.length > col) {
                    prod.setName(stripQuotes(nextLine[col]));
                    col++; //2
                }
                if (nextLine.length > col) {
                    prod.setCode(stripQuotes(nextLine[col]));
                    col++;//3
                }
                if (nextLine.length > col) {
                    prod.setWarranty(stripQuotes(nextLine[col]));
                    col++; //4
                }
                if (nextLine.length > col) {
                    prod.setWarranty_type(stripQuotes(nextLine[col]));
                    col++; //5
                }
                if (nextLine.length > col) {
                    prod.setProduct_category_id(stripQuotes(nextLine[col]));
                    col++; //6
                }
                if (nextLine.length > col) {
                    prod.setProduct_category_name(stripQuotes(nextLine[col]));
                    col++; //7
                }
                if (nextLine.length > col) {
                    prod.setManufacturer_id(stripQuotes(nextLine[col]));
                    col++; //8
                }
                if (nextLine.length > col) {
                    prod.setManufacturer_name(stripQuotes(nextLine[col]));
                    col++; //9
                }
                if (nextLine.length > col) {
                    prod.setMin_quantity(stripQuotes(nextLine[col]));
                    col++; //10
                }
                if (nextLine.length > col) {
                    prod.setStock_value(stripQuotes(nextLine[col]));
                    col++; //11
                }
                if (nextLine.length > col) {
                    prod.setSupplier_stock_value(stripQuotes(nextLine[col]));
                    col++; //12
                }
                if (nextLine.length > col) {
                    prod.setSupplier_stock_delivery_date(stripQuotes(nextLine[col]));
                    col++; //13
                }
                if (nextLine.length > col) {
                    prod.setReserved_stock_value(stripQuotes(nextLine[col]));
                    col++; //14
                }
                if (nextLine.length > col) {
                    prod.setPrice(stripQuotes(nextLine[col]));
                    col++; //15
                }
                if (nextLine.length > col) {
                    prod.setSpecial_price(stripQuotes(nextLine[col]));
                    col++; //16
                }

                if (nextLine.length > col) {
                    prod.setCatalog_price(stripQuotes(nextLine[col]));
                    col++; //17
                }

                if (nextLine.length > col) {
                    prod.setGreen_stamp_value(stripQuotes(nextLine[col]));
                    col++; //18
                }
                if (nextLine.length > col) {
                    prod.setCurrency(stripQuotes(nextLine[col]));
                    col++; //19
                }
                if (nextLine.length > col) {
                    prod.setDiscount(stripQuotes(nextLine[col]));
                    col++; //20
                }
                if (nextLine.length > col) {
                    prod.setVat_percent(stripQuotes(nextLine[col]));
                    col++; //21
                }
                if (nextLine.length > col) {
                    prod.setHas_resealed(stripQuotes(nextLine[col]));
                    col++; //22
                }
                if (nextLine.length > col) {
                    prod.setDescription(cleanDesc(stripQuotes(nextLine[col])));
                    col++; //23
                }
                if (nextLine.length > col) {
                    prod.setRon_price(stripQuotes(nextLine[col]));
                    col++; //24
                }
                if (nextLine.length > col) {
                    prod.setRon_catalog_price(stripQuotes(nextLine[col]));
                    col++; //25
                }
                if (nextLine.length > col) {
                    prod.setPromo_price(stripQuotes(nextLine[col]));
                    col++; //26
                }
                if (nextLine.length > col) {
                    prod.setRon_promo_price(stripQuotes(nextLine[col]));
                    col++; //27
                }
                if (nextLine.length > col) {
                    prod.setOriginal_code(stripQuotes(nextLine[col]));
                    col++; //28
                }
                if (nextLine.length > col) {
                    prod.setDiscount_rate(stripQuotes(nextLine[col]));
                    col++; //29
                }
                //log.trace(prod.toString());
                resList.add(prod);
            }

        } catch (Exception e) {
            log.error("Error while reading file: " + file + " with error: " + e);
        }

        log.info(resList.size() + " ProdFeeds in file: " + file);
        return resList;
    }

    public static List<Manufacturer> readFileManufacturer(String file) {
        List<Manufacturer> resList = new ArrayList<>();

        try (CSVReader reader = new CSVReader(new FileReader(file), ';', '"', 1)) {
            String[] nextLine;
            while ((nextLine = reader.readNext()) != null) {
                if (isTestingWriting()) break;

                Manufacturer manu = new Manufacturer();
                int col = 0;
                if (nextLine.length > col) {
                    manu.setID(stripQuotes(nextLine[col]));
                    col++; //1
                }
                if (nextLine.length > col) {
                    manu.setLogo(stripQuotes(nextLine[col]));
                    col++; //2
                }
                if (nextLine.length > col) {
                    manu.setNume(stripQuotes(nextLine[col]));
                    col++;//3
                }
                if (nextLine.length > col) {
                    manu.setAdrese(stripQuotes(nextLine[col]));
                    col++; //4
                }
                if (nextLine.length > col) {
                    manu.setProduse(stripQuotes(nextLine[col]));
                    col++; //5
                }
                if (nextLine.length > col) {
                    manu.setActiv(stripQuotes(nextLine[col]));
                    col++; //6
                }
                //log.trace(manu.toString());
                resList.add(manu);
            }

        } catch (FileNotFoundException e) {
            log.info("Error while reading file: " + file + " with error: " + e);
        } catch (IOException e) {
            log.error(e);
        }

        log.info(resList.size() + " Manufacturers in file: " + file);
        return resList;
    }

    public static List readFileCategory(String file) {
        List<Category> resList = new ArrayList<>();

        try (CSVReader reader = new CSVReader(new FileReader(file), ';', '"', 1)) {
            String[] nextLine;
            while ((nextLine = reader.readNext()) != null) {
                if (isTestingWriting()) break;

                Category cat = new Category();
                int col = 0;
                if (nextLine.length > col) {
                    cat.setID(stripQuotes(nextLine[col]));
                    col++; //1
                }
                if (nextLine.length > col) {
                    cat.setNume(stripQuotes(nextLine[col]));
                    col++; //2
                }
                if (nextLine.length > col) {
                    cat.setDescriere(cleanDesc(stripQuotes(nextLine[col])));
                    col++;//3
                }
                if (nextLine.length > col) {
                    cat.setPozitie(stripQuotes(nextLine[col]));
                    col++; //4
                }
                if (nextLine.length > col) {
                    cat.setAfisat(stripQuotes(nextLine[col]));
                    col++; //5
                }
                //log.trace(cat.toString());
                resList.add(cat);
            }

        } catch (FileNotFoundException e) {
            log.info("Error while reading file: " + file + " with error: " + e);
        } catch (IOException e) {
            log.error(e);
        }

        log.info(resList.size() + " Categories in file: " + file);
        return resList;
    }

    /**
     * @deprecated
     */
    @Deprecated
    public static List readFileProduct(String file) {
        List resList = new ArrayList<>();

        try (CSVReader reader = new CSVReader(new FileReader(file), ',', '"', 1)) {
            String[] nextLine;
            while ((nextLine = reader.readNext()) != null) {
                if (isTestingWriting()) break;

                Product prod = new Product();
                int col = 0;
                if (nextLine.length > col) {
                    prod.setId(stripQuotes(nextLine[col]));
                    col++; //1
                }
                if (nextLine.length > col) {
                    prod.setImagine(stripQuotes(nextLine[col]));
                    col++; //2
                }
                if (nextLine.length > col) {
                    prod.setReferinta(stripQuotes(nextLine[col]));
                    col++;//3
                }
                if (nextLine.length > col) {
                    prod.setCategorie(stripQuotes(nextLine[col]));
                    col++; //4
                }
                if (nextLine.length > col) {
                    prod.setPretDeBaza(stripQuotes(nextLine[col]));
                    col++; //5
                }
                if (nextLine.length > col) {
                    prod.setPretFinal(stripQuotes(nextLine[col]));
                    col++; //6
                }
                if (nextLine.length > col) {
                    prod.setCantitate(stripQuotes(nextLine[col]));
                    col++; //7
                }
                if (nextLine.length > col) {
                    prod.setStare(stripQuotes(nextLine[col]));
                    col++; //8
                }
                //log.trace(prod.toString());
                resList.add(prod);
            }

        } catch (FileNotFoundException e) {
            log.info("Error while reading file: " + file + " with error: " + e);
        } catch (IOException e) {
            log.error(e);
        }

        log.info(resList.size() + " Products in file: " + file);
        return resList;
    }

    public static List processInputFileProdFeed(String inputFilePath) {
        return processInputFile(inputFilePath, 1, mapToItemProdFeed);
    }

    public static List processInputFileProduct(String inputFilePath) {
        return processInputFile(inputFilePath, 1, mapToItemProduct);
    }

    public static List processInputProdFeedImages(String inputFilePath) {
        return processInputFile(inputFilePath, 0, mapToItemProdFeedImages);
    }

    public static List processInputFile(String inputFilePath, int skipRow, Function<? super String, ?> mapToItem) {
        List inputList = new ArrayList<>();
        try {
            File inputF = new File(inputFilePath);
            InputStream inputFS = new FileInputStream(inputF);
            BufferedReader br = new BufferedReader(new InputStreamReader(inputFS));
            // skip the header of the csv
            inputList = br.lines().skip(skipRow).map(mapToItem).collect(Collectors.toList());
            br.close();
            inputFS.close();
        } catch (IOException e) {
            log.error(e);
        }
        log.trace(inputList.size() + " readed from " + inputFilePath);
        return inputList;
    }

}


text:
foam.CLASS({
  package: 'foam.u2.view',
  name: 'ReadManyToManyRelationshipPropertyView',
  extends: 'foam.u2.View',

  exports: [
    'click',
    'click as dblclick'
  ],

  imports: [
    'stack'
  ],

  documentation: 'A read-only view of a ManyToManyRelationshipProperty.',

  requires: [
    'foam.u2.view.ScrollTableView',
    'foam.comics.v2.DAOControllerConfig'
  ],

  property: [
    'config'
  ],

  methods: [
    function initE() {
      this.SUPER();

      this.config = this.DAOControllerConfig.create({ dao: this.data.dao.delegate });

      var view = foam.u2.ViewSpec.createView(this.ScrollTableView, {
        data: this.data.dao,
        enableDynamicTableHeight: false,
        config: this.config
      },
      this,
      this.__subContext__.createSubContext({ memento: null }));

      this.add(view);
    },
    function click(obj, id) {
      if ( ! this.stack ) return;

      this.stack.push({
        class: 'foam.comics.v2.DAOSummaryView',
        data: obj,
        config: this.config,
        idOfRecord: id,
        backLabel: 'Back'
      }, this.__subContext__.createSubContext({memento: null}));
    }
  ]
});


text:
import React = require('react');

interface ButtonProp {
    a: number,
    b: string,
    children: Button;
}

class Button extends React.Component<ButtonProp, any> {
    render() {
		let condition: boolean;
		if (condition) {
        	return <InnerButton {...this.props} />
		}
		else {
			return (<InnerButton {...this.props} >

Hello World

				</InnerButton>);
		}
    }
}

interface InnerButtonProp {
	a: number
}

class InnerButton extends React.Component<InnerButtonProp, any> {
	render() {
		return (<button>Hello</button>);
	}
}