text:
package ezvcard.property;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;

import ezvcard.parameter.SoundType;

/**
 *

 * Defines a sound, such as the correct pronunciation of the person's name.
 *

 *
 *

 * Code sample (creating)
 *

 *
 *

 * VCard vcard = new VCard();
 *
 * //URL
 * Sound sound = new Sound("http://www.mywebsite.com/my-name.ogg", SoundType.OGG);
 * vcard.addSound(sound);
 *
 * //binary data
 * byte data[] = ...
 * sound = new Sound(data, SoundType.OGG);
 * vcard.addSound(sound);
 *

 *
 *

 * Code sample (retrieving)
 *

 *
 *

 * VCard vcard = ...
 * for (Sound sound : vcard.getSounds()){
 *   SoundType contentType = sound.getContentType(); //e.g. "audio/ogg"
 *
 *   String url = sound.getUrl();
 *   if (url != null){
 *     //property value is a URL
 *     continue;
 *   }
 *
 *   byte[] data = sound.getData();
 *   if (data != null){
 *     //property value is binary data
 *     continue;
 *   }
 * }
 *

 *
 *

 * Property name: {@code SOUND}
 *

 *

 * Supported versions: {@code 2.1, 3.0, 4.0}
 *

 * @author Michael Angstadt
 */
public class Sound extends BinaryProperty<SoundType> {
	/**
	 * Creates a sound property.
	 * @param url the URL to the sound file
	 * @param type the content type (e.g. OGG)
	 */
	public Sound(String url, SoundType type) {
		super(url, type);
	}

	/**
	 * Creates a sound property.
	 * @param data the binary data of the sound file
	 * @param type the content type (e.g. OGG)
	 */
	public Sound(byte[] data, SoundType type) {
		super(data, type);
	}

	/**
	 * Creates a sound property.
	 * @param in an input stream to the binary data (will be closed)
	 * @param type the content type (e.g. OGG)
	 * @throws IOException if there's a problem reading from the input stream
	 */
	public Sound(InputStream in, SoundType type) throws IOException {
		super(in, type);
	}

	/**
	 * Creates a sound property.
	 * @param file the sound file
	 * @param type the content type (e.g. OGG)
	 * @throws IOException if there's a problem reading from the file
	 */
	public Sound(File file, SoundType type) throws IOException {
		super(file, type);
	}

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

	@Override
	public void setLanguage(String language) {
		super.setLanguage(language);
	}
}


text:
namespace html5 {
namespace html {
namespace interface {

}}}

#endif //GUARD_HTML5_HTML_INTERFACE_OBJECT_HH_INCLUDED

redpajama_set_name: RedPajamaGithub


text:
var Spawn = function (location, role) {
    return Game.spawns[location].createCreep(role.parts, undefined, role.memory);
}

module.exports = Spawn;


text:
package org.apache.geode.redis.internal.commands.executor.hash;

import static org.assertj.core.api.Assertions.assertThat;

import java.util.HashMap;
import java.util.Map;
import java.util.function.Consumer;

import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.JedisCluster;

import org.apache.geode.redis.ConcurrentLoopingThreads;
import org.apache.geode.test.awaitility.GeodeAwaitility;
import org.apache.geode.test.dunit.rules.MemberVM;
import org.apache.geode.test.dunit.rules.RedisClusterStartupRule;

public class HMsetDUnitTest {

  @ClassRule
  public static RedisClusterStartupRule clusterStartUp = new RedisClusterStartupRule(4);

  private static final String LOCAL_HOST = "127.0.0.1";
  private static final int HASH_SIZE = 1000;
  private static final int JEDIS_TIMEOUT =
      Math.toIntExact(GeodeAwaitility.getTimeout().toMillis());
  private static JedisCluster jedis;

  private static MemberVM locator;
  private static MemberVM server1;
  private static MemberVM server2;
  private static MemberVM server3;

  @BeforeClass
  public static void classSetup() {
    locator = clusterStartUp.startLocatorVM(0);
    server1 = clusterStartUp.startRedisVM(1, locator.getPort());
    server2 = clusterStartUp.startRedisVM(2, locator.getPort());
    server3 = clusterStartUp.startRedisVM(3, locator.getPort());

    int redisServerPort = clusterStartUp.getRedisPort(1);
    jedis = new JedisCluster(new HostAndPort(LOCAL_HOST, redisServerPort), JEDIS_TIMEOUT);
  }

  @Before
  public void testSetup() {
    clusterStartUp.flushAll();
  }

  @AfterClass
  public static void tearDown() {
    jedis.close();
  }

  @Test
  public void shouldDistributeDataAmongCluster() {
    String key = "key";

    Map<String, String> testMap = makeHashMap(HASH_SIZE, "field-", "value-");

    jedis.hmset(key, testMap);

    Map<String, String> result = jedis.hgetAll(key);

    assertThat(result.keySet().toArray()).containsExactlyInAnyOrder(testMap.keySet().toArray());
    assertThat(result.values().toArray()).containsExactlyInAnyOrder(testMap.values().toArray());
  }

  @Test
  public void shouldDistributeDataAmongCluster_givenAddingDifferentDataToSameHashConcurrently() {

    String key = "key";

    Map<String, String> testMap1 = makeHashMap(HASH_SIZE, "field1-", "value1-");
    Map<String, String> testMap2 = makeHashMap(HASH_SIZE, "field2-", "value2-");

    Map<String, String> wholeMap = new HashMap<>();
    wholeMap.putAll(testMap1);
    wholeMap.putAll(testMap2);

    String[] testMap1Fields = testMap1.keySet().toArray(new String[] {});
    String[] testMap2Fields = testMap2.keySet().toArray(new String[] {});

    Consumer<Integer> consumer1 = makeHMSetConsumer(testMap1, testMap1Fields, key, jedis);
    Consumer<Integer> consumer2 = makeHMSetConsumer(testMap2, testMap2Fields, key, jedis);

    new ConcurrentLoopingThreads(HASH_SIZE, consumer1, consumer2).run();

    Map<String, String> results = jedis.hgetAll(key);

    assertThat(results.keySet().toArray()).containsExactlyInAnyOrder(wholeMap.keySet().toArray());
    assertThat(results.values().toArray()).containsExactlyInAnyOrder(wholeMap.values().toArray());
  }

  @Test
  public void shouldDistributeDataAmongCluster_givenAddingSameDataToSameHashConcurrently() {

    String key = "key";

    Map<String, String> testMap = makeHashMap(HASH_SIZE, "field-", "value-");

    String[] testMapFields = testMap.keySet().toArray(new String[] {});

    Consumer<Integer> consumer1 = makeHMSetConsumer(testMap, testMapFields, key, jedis);
    Consumer<Integer> consumer2 = makeHMSetConsumer(testMap, testMapFields, key, jedis);

    new ConcurrentLoopingThreads(HASH_SIZE, consumer1, consumer2).run();

    Map<String, String> results = jedis.hgetAll(key);

    assertThat(results.keySet().toArray()).containsExactlyInAnyOrder(testMap.keySet().toArray());
    assertThat(results.values().toArray()).containsExactlyInAnyOrder(testMap.values().toArray());
  }

  @Test
  public void shouldDistributeDataAmongCluster_givenAddingToDifferentHashesConcurrently() {

    String key1 = "key1";
    String key2 = "key2";

    Map<String, String> testMap1 = makeHashMap(HASH_SIZE, "field1-", "value1-");
    Map<String, String> testMap2 = makeHashMap(HASH_SIZE, "field2-", "value2-");

    String[] testMap1Fields = testMap1.keySet().toArray(new String[] {});
    String[] testMap2Fields = testMap2.keySet().toArray(new String[] {});

    Consumer<Integer> consumer1 = makeHMSetConsumer(testMap1, testMap1Fields, key1, jedis);
    Consumer<Integer> consumer2 = makeHMSetConsumer(testMap2, testMap2Fields, key2, jedis);

    new ConcurrentLoopingThreads(HASH_SIZE, consumer1, consumer2).run();

    Map<String, String> results1 = jedis.hgetAll(key1);
    Map<String, String> results2 = jedis.hgetAll(key2);

    assertThat(results1.keySet().toArray()).containsExactlyInAnyOrder(testMap1.keySet().toArray());
    assertThat(results1.values().toArray()).containsExactlyInAnyOrder(testMap1.values().toArray());
    assertThat(results2.values().toArray()).containsExactlyInAnyOrder(testMap2.values().toArray());
    assertThat(results2.values().toArray()).containsExactlyInAnyOrder(testMap2.values().toArray());
  }

  @Test
  public void shouldDistributeDataAmongCluster_givenMultipleThreadsAddingSameDataToSameSetConcurrently() {

    String key = "key";

    Map<String, String> testMap = makeHashMap(HASH_SIZE, "field1-", "value1-");

    String[] testMapFields = testMap.keySet().toArray(new String[] {});

    Consumer<Integer> consumer1 = makeHMSetConsumer(testMap, testMapFields, key, jedis);
    Consumer<Integer> consumer1B = makeHMSetConsumer(testMap, testMapFields, key, jedis);
    Consumer<Integer> consumer2 = makeHMSetConsumer(testMap, testMapFields, key, jedis);
    Consumer<Integer> consumer2B = makeHMSetConsumer(testMap, testMapFields, key, jedis);

    new ConcurrentLoopingThreads(HASH_SIZE, consumer1, consumer1B, consumer2, consumer2B).run();

    Map<String, String> results = jedis.hgetAll(key);

    assertThat(results.keySet().toArray()).containsExactlyInAnyOrder(testMap.keySet().toArray());
    assertThat(results.values().toArray()).containsExactlyInAnyOrder(testMap.values().toArray());
  }

  @Test
  public void shouldDistributeDataAmongCluster_givenMultipleThreadsAddingDifferentDataToSameSetConcurrently() {

    String key = "key1";

    Map<String, String> testMap1 = makeHashMap(HASH_SIZE, "field1-", "value1-");
    Map<String, String> testMap2 = makeHashMap(HASH_SIZE, "field2-", "value2-");

    Map<String, String> wholeMap = new HashMap<>();
    wholeMap.putAll(testMap1);
    wholeMap.putAll(testMap2);

    String[] testMap1Fields = testMap1.keySet().toArray(new String[] {});
    String[] testMap2Fields = testMap2.keySet().toArray(new String[] {});

    Consumer<Integer> consumer1 = makeHMSetConsumer(testMap1, testMap1Fields, key, jedis);
    Consumer<Integer> consumer1B = makeHMSetConsumer(testMap1, testMap1Fields, key, jedis);
    Consumer<Integer> consumer2 = makeHMSetConsumer(testMap2, testMap2Fields, key, jedis);
    Consumer<Integer> consumer2B = makeHMSetConsumer(testMap2, testMap2Fields, key, jedis);

    new ConcurrentLoopingThreads(HASH_SIZE, consumer1, consumer1B, consumer2, consumer2B).run();

    Map<String, String> results = jedis.hgetAll(key);

    assertThat(results.keySet().toArray()).containsExactlyInAnyOrder(wholeMap.keySet().toArray());
    assertThat(results.values().toArray()).containsExactlyInAnyOrder(wholeMap.values().toArray());
  }

  private Consumer<Integer> makeHMSetConsumer(Map<String, String> testMap, String[] fields,
      String hashKey, JedisCluster jedis) {
    Consumer<Integer> consumer = (i) -> {
      String field = fields[i];
      Map<String, String> mapToAdd = new HashMap<>();
      mapToAdd.put(field, testMap.get(field));
      jedis.hmset(hashKey, mapToAdd);
    };

    return consumer;
  }

  private Map<String, String> makeHashMap(int hashSize, String baseFieldName,
      String baseValueName) {
    Map<String, String> map = new HashMap<>();
    for (int i = 0; i < hashSize; i++) {
      map.put(baseFieldName + i, baseValueName + i);
    }
    return map;
  }
}


text:
package org.apache.servicemix.nmr.api;

import org.w3c.dom.Document;

/**
 * Represents an endpoint reference or a logical endpoint.
 * References are usually obtained from the {@link EndpointRegistry} and used
 * as targets for {@link Exchange}s using the {@link Exchange#setTarget(Reference)}
 * method.
 *
 * @version $Revision: $
 * @since 4.0
 */
public interface Reference {

    /**
     * Obtains an xml document describing this endpoint reference.
     *
     * @return
     */
    Document toXml();

}


text:
package pl.dziurdziak.pobrLogoRecognition.model.calculation;

import org.junit.Test;
import pl.dziurdziak.pobrLogoRecognition.model.image.Image;
import pl.dziurdziak.pobrLogoRecognition.model.image.Pixel;
import pl.dziurdziak.pobrLogoRecognition.model.segment.Segment;
import pl.dziurdziak.pobrLogoRecognition.util.SegmentUtils;

import java.util.List;

import static pl.dziurdziak.pobrLogoRecognition.model.image.Pixel.BLACK;
import static pl.dziurdziak.pobrLogoRecognition.model.image.Pixel.WHITE;

/**
 * @author Mateusz Dziurdziak
 */
public class SegmentCalculationsTest {

    @Test
    public void testNoErrors() {
        Pixel[][] pixels = new Pixel[][] {
                {BLACK, WHITE, BLACK},
                {BLACK, WHITE, BLACK},
                {BLACK, BLACK, WHITE}};
        Image image = new Image(pixels);
        List<Segment> segments = SegmentUtils.getSegments(image, null);
        segments.forEach(segment -> new SegmentCalculations(segment));
    }

}