text:
class Revista < Publicaciones

        attr_reader  :volumen, :numero, :pagina

        def initialize(autores,titulo,nombre,volumen,numero,pagina)
              super(autores,titulo,nombre)
              @volumen = volumen
              @numero = numero
              @pagina = pagina

        end

        def getVolumen
            return @volumen
        end

        def getNumero
            return @numero
        end
        def getPagina
            return @pagina
        end

        def to_s
            out = super.to_s + "#{@volumen}"  + ", "  + "#{@numero}"  + ", "  + "#{@pagina}"
            return out
        end

end


text:
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

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

 * Description:
 ********************************************************************************/

class Controller extends SugarBean {

	var $focus;
	var $type;  //defines id this is a new list order or existing, or delete
				// New, Save, Delete

	function Controller() {
		parent::SugarBean();

		$this->disable_row_level_security =true;

	}

	function init(& $seed_object, $type){

		$this->focus = & $seed_object;
		$this->type = $type;

	//end function Controller
	}

	function change_component_order($magnitude, $direction, $parent_id=""){

		if(!empty($this->type) && $this->type=="Save"){

			//safety check
			$wall_test = $this->check_wall($magnitude, $direction, $parent_id);

			if($wall_test==false){
				return;
			}

				if($direction=="Left"){
					if($this->focus->controller_def['list_x']=="Y"){
						$new_x = $this->focus->list_order_x -1;
						$affected_x = $this->focus->list_order_x;
					} else {
						$new_x = "";
						$affected_x = "";
					}
					if($this->focus->controller_def['list_y']=="Y"){

						$new_y = $this->focus->list_order_y;
						$affected_y = $this->focus->list_order_y;
					} else {
						$new_y = "";
						$affected_y = "";
					}

					$affected_id = $this->get_affected_id($parent_id, $new_x, $new_y);
				//end if direction Left
				}
				if($direction=="Right"){

					if($this->focus->controller_def['list_x']=="Y"){
						$new_x = $this->focus->list_order_x + 1;
						$affected_x = $this->focus->list_order_x;
					} else {
						$new_x = "";
						$affected_x = "";
					}
					if($this->focus->controller_def['list_y']=="Y"){
						$new_y = $this->focus->list_order_y;
						$affected_y = $this->focus->list_order_y;
					} else {
						$new_y = "";
						$affected_y = "";
					}
					$affected_id = $this->get_affected_id($parent_id, $new_x, $new_y);
				//end if direction Right
				}

				if($direction=="Up"){
					if($this->focus->controller_def['list_x']=="Y"){
						$new_x = $this->focus->list_order_x;
						$affected_x = $this->focus->list_order_x;
					} else {
						$new_x = "";
						$affected_x = "";
					}
					if($this->focus->controller_def['list_y']=="Y"){

					$new_y = $this->focus->list_order_y - 1;
					$affected_y = $this->focus->list_order_y;
					} else {
						$new_y = "";
						$affected_y = "";
					}

					$affected_id = $this->get_affected_id($parent_id, $new_x, $new_y);

				//end if direction Up
				}
				if($direction=="Down"){

					if($this->focus->controller_def['list_x']=="Y"){
						$new_x = $this->focus->list_order_x;
						$affected_x = $this->focus->list_order_x;
					} else {
						$new_x = "";
						$affected_x = "";
					}
					if($this->focus->controller_def['list_y']=="Y"){

						$new_y = $this->focus->list_order_y + 1;
						$affected_y = $this->focus->list_order_y;
					} else {
						$new_y = "";
						$affected_y = "";
					}
					$affected_id = $this->get_affected_id($parent_id, $new_x, $new_y);
				//end if direction Down
				}

			//This takes care of the component being pushed out of its position
			$this->update_affected_order($affected_id, $affected_x, $affected_y);

				//This takes care of the new positions for itself
			if($this->focus->controller_def['list_x']=="Y"){
				$this->focus->list_order_x = $new_x;
			}

			if($this->focus->controller_def['list_y']=="Y"){
				$this->focus->list_order_y = $new_y;
			}

		} else {
		//this is a new component, set the x or y value to the max + 1

				$query = "SELECT MAX(".$this->focus->controller_def['start_var'].") max_start from ".$this->focus->table_name."
						  WHERE ".$this->focus->controller_def['parent_var']."='$parent_id'
						  AND ".$this->focus->table_name.".deleted='0'
						 ";
				$result = $this->db->query($query,true," Error capturing max start order: ");
				$row = $this->db->fetchByAssoc($result);

			if(!is_null($row['max_start'])){

				if($this->focus->controller_def['start_axis']=="x")	{
					$this->focus->list_order_x = $row['max_start'] + 1;
					if($this->focus->controller_def['list_y']=="Y") $this->focus->list_order_y = 0;
				}

				if($this->focus->controller_def['start_axis']=="y")	{
					$this->focus->list_order_y = $row['max_start'] + 1;
					if($this->focus->controller_def['list_x']=="Y") $this->focus->list_order_x = 0;
				}

			} else {
				//first row
				if($this->focus->controller_def['list_x']=="Y") $this->focus->list_order_x = 0;
				if($this->focus->controller_def['list_y']=="Y") $this->focus->list_order_y = 0;

			//end if else to check if this is first entry
			}
		//end if else on whether this is a new entry
		}
	//end function change_component_order
	}

	function update_affected_order($affected_id, $affected_new_x="", $affected_new_y=""){

		$query = 	"UPDATE ".$this->focus->table_name." SET";

		if($this->focus->controller_def['list_x']=="Y"){
				$query .= 	"	 list_order_x='$affected_new_x'";
		}
		if($this->focus->controller_def['list_y']=="Y"){

			if($this->focus->controller_def['list_x']=="Y"){
				$query .= 	"	, ";
			}
			$query .= 	"	list_order_y='$affected_new_y'";
		}

		$query .=	"	WHERE id='$affected_id'";
		$query .=   "	AND ".$this->focus->table_name.".deleted='0'";
		$result = $this->db->query($query,true," Error updating affected order id: ");
	//end function update_affected_order
	}

	function get_affected_id($parent_id, $list_order_x="", $list_order_y=""){

		$query = "	SELECT id from ".$this->focus->table_name."
					WHERE ".$this->focus->controller_def['parent_var']."='$parent_id'
					AND ".$this->focus->table_name.".deleted='0'
					";

		if($this->focus->controller_def['list_x']=="Y"){
			$query .= "	AND list_order_x='$list_order_x' ";
		}

		if($this->focus->controller_def['list_y']=="Y"){
			$query .= "	AND list_order_y='$list_order_y' ";
		}

	//echo $query."<BR>";
		$result = $this->db->query($query,true," Error capturing affected id: ");
		$row = $this->db->fetchByAssoc($result);

		return $row['id'];

	//end function get_affected_id
	}

/////////////Wall Functions////////////////////

function check_wall($magnitude, $direction, $parent_id){

//TODO: jgreen - this is only single axis check_wall mechanism, will need to upgrade this to double axis
//This function determines if you can't move the direction you want, because you are at the edge

//If down or Right, then check max list_order value
	if($direction=="Down" || $direction =="Right"){

		$query = "SELECT MAX(".$this->focus->controller_def['start_var'].") max_start from ".$this->focus->table_name."
				  WHERE ".$this->focus->controller_def['parent_var']."='$parent_id'
				  AND ".$this->focus->table_name.".deleted='0'
						 ";
		$result = $this->db->query($query,true," Error capturing max start order: ");
		$row = $this->db->fetchByAssoc($result);

			if($this->focus->controller_def['start_axis']=="x")	{
				if($row['max_start'] == $this->focus->list_order_x){
					return false;
				}
			}
			if($this->focus->controller_def['start_axis']=="y")	{
				if($row['max_start'] == $this->focus->list_order_y){
					return false;
				}
			}
	//end if up or right
	}

//If up or left, then simply check the 0 value
	if($direction=="Up" || $direction =="Left"){
			if($this->focus->controller_def['start_axis']=="x")	{
				if($this->focus->list_order_x==0){
					return false;
				}
			}
			if($this->focus->controller_def['start_axis']=="y")	{
				if($this->focus->list_order_y==0){
					return false;
				}
			}

	//end if down or left
	}

	//If you get here, then you are not at the wall and can change order
	return true;

//end function check_wall
}

//End Wall Functions/////////////////////////

//Delete adjust functions////////////////////

function delete_adjust_order($parent_id){

	//Currently handles single axis motion only!!!!!!!!!
	//TODO: jgreen - Add dual axis motion

	//adjust along start_axis
	$variable_name = $this->focus->controller_def['start_var'];
	$current_position = $this->focus->$variable_name;

	$query =  "UPDATE ".$this->focus->table_name." ";
	$query .= "SET ".$this->focus->controller_def['start_var']." = ".$this->focus->controller_def['start_var']." - 1 ";
	$query .= "WHERE ".$this->focus->controller_def['start_var']." > ".$current_position." AND deleted=0 ";
	$query .= "AND ".$this->focus->controller_def['parent_var']." = '".$parent_id."'";

	$result = $this->db->query($query,true," Error updating the delete_adjust_order: ");
//end delete_adjust_order
}
//End Delete Functions/////////////////////////
//end class Controller
}

?>

redpajama_set_name: RedPajamaGithub


text:
package net.kiberion.audio;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;

public class AudioService {

    private static final Logger log = LogManager.getLogger();

    private static final String MUSIC_CHANNEL_ID = "music";
    private static final String SOUND_CHANNEL_ID = "sound";

    private Channel musicChannel;
    private Channel soundChannel;

    private Mixer mixer;

    @Autowired
    private SoundRegistry soundRegistry;

    @Autowired
    public void setMixer(Mixer mixer) {
        this.mixer = mixer;
        musicChannel = mixer.newChannel(MUSIC_CHANNEL_ID);
        soundChannel = mixer.newChannel(SOUND_CHANNEL_ID);
    }

    @EventListener
    public void playSound (PlaySoundEvent event) {
        log.info("Play sound");
        soundChannel.playSound(soundRegistry.getSoundEntries().get(event.getSoundId()));
    }

    @EventListener
    public void playMusic (PlayMusicEvent event) {
        log.info("Play music");
        musicChannel.playMusic(soundRegistry.getMusicEntries().get(event.getMusicId()));
    }

}


text:
import utils

sqlitedict = utils.import_module('sqlitedict', package='jirareports')

class Storage(object):

    def __init__(self, name, path):

        if not name:
            raise RuntimeError('Storage name does not specified, %s' % name)
        self._storage = sqlitedict.SqliteDict(path, tablename=name, autocommit=True)

    def put(self, issue_id, details):
        ''' put issue into storage
        '''
        self._storage[issue_id] = details

    def get(self, issue_id=None):
        ''' get issue details by the issue id
        '''
        if not issue_id:
            return self._storage.items()
        else:
            return self._storage[issue_id]

    def close(self):
        ''' close storage
        '''
        self._storage.close()


text:
package br.edu.ufabc.icarius.model.entities;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

@Entity
@Table(name = "USERS")
public class User {

    @Id
    private String cpf;
    private String name;
    private String username;
    @Column(columnDefinition = "BINARY(32)")
    private byte[] password;

    @Temporal(TemporalType.DATE)
    @Column(name = "birthdate")
    private Date birthDate;

    @OneToMany(mappedBy = "cpf")
    private List<Loan> loanBooks;

    @OneToMany(mappedBy = "cpf")
    private List<Reservation> reservations;

    public User() {
    }

    public String getCpf() {
        return cpf;
    }

    public void setCpf(String cpf) {
        this.cpf = cpf;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public byte[] getPassword() {
        return password;
    }

    public void setPassword(byte[] password) {
        this.password = password;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public Date getBirthDate() {
        return birthDate;
    }

    public void setBirthDate(Date birthDate) {
        this.birthDate = birthDate;
    }

    public List<Loan> getLoanBooks() {
        return loanBooks;
    }

    public void setLoanBooks(List<Loan> loanBooks) {
        this.loanBooks = loanBooks;
    }

    public List<Reservation> getReservations() {
        return reservations;
    }

    public void setReservations(List<Reservation> reservations) {
        this.reservations = reservations;
    }
}


text:
extern unsigned char serial[];
int fail = 0;

int main() {
    if (fail)
        printf("Sorry, but this serial number is not valid!\n");
    else
        printf("Success! The flag is: %s\n", serial);
    return 0;
}


text:
package org.apache.beam.sdk.extensions.euphoria.core.client.operator;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.beam.sdk.extensions.euphoria.core.client.type.TypePropagationAssert;
import org.apache.beam.sdk.extensions.euphoria.core.client.util.Sums;
import org.apache.beam.sdk.transforms.windowing.BoundedWindow;
import org.apache.beam.sdk.transforms.windowing.DefaultTrigger;
import org.apache.beam.sdk.transforms.windowing.FixedWindows;
import org.apache.beam.sdk.transforms.windowing.Window;
import org.apache.beam.sdk.transforms.windowing.WindowDesc;
import org.apache.beam.sdk.values.KV;
import org.apache.beam.sdk.values.PCollection;
import org.apache.beam.sdk.values.TypeDescriptor;
import org.apache.beam.sdk.values.TypeDescriptors;
import org.apache.beam.sdk.values.WindowingStrategy.AccumulationMode;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.Iterables;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.Lists;
import org.joda.time.Duration;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/** Test operator ReduceByKey. */
@RunWith(JUnit4.class)
@SuppressWarnings({
  "rawtypes", // TODO(https://github.com/apache/beam/issues/20447)
})
public class ReduceByKeyTest {

  @Test
  public void testBuild() {
    final PCollection<String> dataset = TestUtils.createMockDataset(TypeDescriptors.strings());
    final FixedWindows windowing = FixedWindows.of(org.joda.time.Duration.standardHours(1));
    final DefaultTrigger trigger = DefaultTrigger.of();
    final PCollection<KV<String, Long>> reduced =
        ReduceByKey.named("ReduceByKey1")
            .of(dataset)
            .keyBy(s -> s)
            .valueBy(s -> 1L)
            .combineBy(Sums.ofLongs())
            .windowBy(windowing)
            .triggeredBy(trigger)
            .discardingFiredPanes()
            .withAllowedLateness(Duration.standardSeconds(1000))
            .output();

    final ReduceByKey reduce = (ReduceByKey) TestUtils.getProducer(reduced);
    assertTrue(reduce.getName().isPresent());
    assertEquals("ReduceByKey1", reduce.getName().get());
    assertNotNull(reduce.getKeyExtractor());
    assertNotNull(reduce.getValueExtractor());
    assertTrue(reduce.isCombineFnStyle());
    assertNotNull(reduce.getAccumulatorFactory());
    assertNotNull(reduce.getAccumulate());
    assertNotNull(reduce.getAccumulatorType());
    assertNotNull(reduce.getMergeAccumulators());
    assertNotNull(reduce.getOutputFn());

    assertTrue(reduce.getWindow().isPresent());
    @SuppressWarnings("unchecked")
    final WindowDesc<?> windowDesc = WindowDesc.of((Window) reduce.getWindow().get());
    assertEquals(windowing, windowDesc.getWindowFn());
    assertEquals(trigger, windowDesc.getTrigger());
    assertEquals(AccumulationMode.DISCARDING_FIRED_PANES, windowDesc.getAccumulationMode());
    assertEquals(Duration.standardSeconds(1000), windowDesc.getAllowedLateness());
  }

  @Test
  public void testBuild_OutputValues() {
    final PCollection<String> dataset = TestUtils.createMockDataset(TypeDescriptors.strings());
    final PCollection<Long> reduced =
        ReduceByKey.named("ReduceByKeyValues")
            .of(dataset)
            .keyBy(s -> s)
            .valueBy(s -> 1L)
            .combineBy(Sums.ofLongs())
            .outputValues();

    final OutputValues outputValues = (OutputValues) TestUtils.getProducer(reduced);
    assertTrue(outputValues.getName().isPresent());
    assertEquals("ReduceByKeyValues", outputValues.getName().get());
  }

  @Test
  public void testBuild_ImplicitName() {
    final PCollection<String> dataset = TestUtils.createMockDataset(TypeDescriptors.strings());
    final PCollection<KV<String, Long>> reduced =
        ReduceByKey.of(dataset).keyBy(s -> s).valueBy(s -> 1L).combineBy(Sums.ofLongs()).output();
    final ReduceByKey reduce = (ReduceByKey) TestUtils.getProducer(reduced);
    assertFalse(reduce.getName().isPresent());
  }

  @Test
  public void testBuild_ReduceBy() {
    final PCollection<String> dataset = TestUtils.createMockDataset(TypeDescriptors.strings());
    final PCollection<KV<String, Long>> reduced =
        ReduceByKey.of(dataset)
            .keyBy(s -> s)
            .valueBy(s -> 1L)
            .reduceBy(s -> s.mapToLong(e -> e).sum())
            .output();
    final ReduceByKey reduce = (ReduceByKey) TestUtils.getProducer(reduced);
    assertNotNull(reduce.getReducer());
    assertFalse(reduce.isCombineFnStyle());
  }

  @Test
  public void testBuild_CombineByStream() {
    final PCollection<String> dataset = TestUtils.createMockDataset(TypeDescriptors.strings());
    final PCollection<KV<String, Long>> reduced =
        ReduceByKey.of(dataset)
            .keyBy(s -> s)
            .valueBy(s -> 1L)
            .combineBy(s -> s.mapToLong(e -> e).sum())
            .output();
    final ReduceByKey reduce = (ReduceByKey) TestUtils.getProducer(reduced);
    assertNotNull(reduce.getReducer());
    assertFalse(reduce.isCombineFnStyle());
  }

  @Test
  public void testBuild_CombineByFull() {
    final PCollection<String> dataset = TestUtils.createMockDataset(TypeDescriptors.strings());
    final PCollection<KV<String, Integer>> reduced =
        ReduceByKey.of(dataset)
            .keyBy(s -> s)
            .valueBy(s -> 1L)
            .combineBy(
                () -> new ArrayList<>(),
                (acc, e) -> {
                  acc.add(e);
                  return acc;
                },
                (l, r) -> Lists.newArrayList(Iterables.concat(l, r)),
                List::size,
                TypeDescriptors.lists(TypeDescriptors.longs()),
                TypeDescriptors.integers())
            .output();
    final ReduceByKey reduce = (ReduceByKey) TestUtils.getProducer(reduced);
    assertTrue(reduce.isCombineFnStyle());
    assertNotNull(reduce.getAccumulatorFactory());
    assertNotNull(reduce.getAccumulatorType());
    assertNotNull(reduce.getAccumulate());
    assertNotNull(reduce.getMergeAccumulators());
    assertNotNull(reduce.getOutputFn());
    assertTrue(reduce.getOutputType().isPresent());
  }

  @Test
  public void testBuild_CombineBy() {
    final PCollection<String> dataset = TestUtils.createMockDataset(TypeDescriptors.strings());
    final PCollection<KV<String, Long>> reduced =
        ReduceByKey.of(dataset)
            .keyBy(s -> s)
            .valueBy(s -> 1L)
            .combineBy(0L, (a, b) -> a + b)
            .output();
    final ReduceByKey reduce = (ReduceByKey) TestUtils.getProducer(reduced);
    assertTrue(reduce.isCombineFnStyle());
    assertNotNull(reduce.getAccumulatorFactory());
    assertNotNull(reduce.getAccumulate());
    assertNotNull(reduce.getMergeAccumulators());
    assertNotNull(reduce.getOutputFn());
    assertTrue(reduce.getOutputType().isPresent());
  }

  @Test
  public void testBuild_Windowing() {
    final PCollection<String> dataset = TestUtils.createMockDataset(TypeDescriptors.strings());
    final PCollection<KV<String, Long>> reduced =
        ReduceByKey.of(dataset)
            .keyBy(s -> s)
            .valueBy(s -> 1L)
            .combineBy(Sums.ofLongs())
            .windowBy(FixedWindows.of(Duration.standardHours(1)))
            .triggeredBy(DefaultTrigger.of())
            .accumulationMode(AccumulationMode.DISCARDING_FIRED_PANES)
            .output();

    final ReduceByKey reduce = (ReduceByKey) TestUtils.getProducer(reduced);

    assertTrue(reduce.getWindow().isPresent());
    @SuppressWarnings("unchecked")
    final Window<? extends BoundedWindow> window = (Window) reduce.getWindow().get();
    assertEquals(FixedWindows.of(org.joda.time.Duration.standardHours(1)), window.getWindowFn());
    assertEquals(DefaultTrigger.of(), WindowDesc.of(window).getTrigger());
    assertSame(
        AccumulationMode.DISCARDING_FIRED_PANES, WindowDesc.of(window).getAccumulationMode());
    assertFalse(reduce.getValueComparator().isPresent());
  }

  @Test
  public void testBuild_sortedValues() {
    final PCollection<String> dataset = TestUtils.createMockDataset(TypeDescriptors.strings());
    final PCollection<KV<String, List<Long>>> reduced =
        ReduceByKey.of(dataset)
            .keyBy(s -> s)
            .valueBy(s -> 1L)
            .reduceBy(s -> s.collect(Collectors.toList()))
            .withSortedValues(Long::compare)
            .windowBy(FixedWindows.of(Duration.standardHours(1)))
            .triggeredBy(DefaultTrigger.of())
            .accumulationMode(AccumulationMode.DISCARDING_FIRED_PANES)
            .output();
    final ReduceByKey reduce = (ReduceByKey) TestUtils.getProducer(reduced);
    assertTrue(reduce.getValueComparator().isPresent());
  }

  @Test
  public void testBuild_sortedValuesWithNoWindowing() {
    final PCollection<String> dataset = TestUtils.createMockDataset(TypeDescriptors.strings());
    final PCollection<KV<String, List<Long>>> reduced =
        ReduceByKey.of(dataset)
            .keyBy(s -> s)
            .valueBy(s -> 1L)
            .reduceBy(s -> s.collect(Collectors.toList()))
            .withSortedValues(Long::compare)
            .output();
    final ReduceByKey reduce = (ReduceByKey) TestUtils.getProducer(reduced);
    assertTrue(reduce.getValueComparator().isPresent());
  }

  @Test
  public void testWindow_applyIf() {
    final PCollection<String> dataset = TestUtils.createMockDataset(TypeDescriptors.strings());
    final PCollection<KV<String, Long>> reduced =
        ReduceByKey.of(dataset)
            .keyBy(s -> s)
            .valueBy(s -> 1L)
            .combineBy(Sums.ofLongs())
            .applyIf(
                true,
                b ->
                    b.windowBy(FixedWindows.of(Duration.standardHours(1)))
                        .triggeredBy(DefaultTrigger.of())
                        .accumulationMode(AccumulationMode.DISCARDING_FIRED_PANES))
            .output();
    final ReduceByKey reduce = (ReduceByKey) TestUtils.getProducer(reduced);
    assertTrue(reduce.getWindow().isPresent());
    @SuppressWarnings("unchecked")
    final Window<? extends BoundedWindow> window = (Window) reduce.getWindow().get();
    assertEquals(FixedWindows.of(org.joda.time.Duration.standardHours(1)), window.getWindowFn());
    assertEquals(DefaultTrigger.of(), WindowDesc.of(window).getTrigger());
    assertSame(
        AccumulationMode.DISCARDING_FIRED_PANES, WindowDesc.of(window).getAccumulationMode());
  }

  @Test
  public void testWindow_applyIfNot() {
    final PCollection<String> dataset = TestUtils.createMockDataset(TypeDescriptors.strings());
    final PCollection<KV<String, Long>> reduced =
        ReduceByKey.of(dataset)
            .keyBy(s -> s)
            .valueBy(s -> 1L)
            .combineBy(Sums.ofLongs())
            .applyIf(
                false,
                b ->
                    b.windowBy(FixedWindows.of(Duration.standardHours(1)))
                        .triggeredBy(DefaultTrigger.of())
                        .accumulationMode(AccumulationMode.DISCARDING_FIRED_PANES))
            .output();
    final ReduceByKey reduce = (ReduceByKey) TestUtils.getProducer(reduced);
    assertFalse(reduce.getWindow().isPresent());
  }

  @Test
  @SuppressWarnings("unchecked")
  public void testTypeHints_typePropagation() {
    final PCollection<String> dataset = TestUtils.createMockDataset(TypeDescriptors.strings());
    final TypeDescriptor<String> keyType = TypeDescriptors.strings();
    final TypeDescriptor<Long> valueType = TypeDescriptors.longs();
    final TypeDescriptor<Long> outputType = TypeDescriptors.longs();
    final PCollection<KV<String, Long>> reduced =
        ReduceByKey.of(dataset)
            .keyBy(s -> s, keyType)
            .valueBy(s -> 1L, valueType)
            .combineBy(Sums.ofLongs())
            .output();
    final ReduceByKey reduce = (ReduceByKey) TestUtils.getProducer(reduced);
    TypePropagationAssert.assertOperatorTypeAwareness(reduce, keyType, valueType, outputType);
  }
}


text:
void rcFilterLowHangingWalkableObstacles(rcContext* ctx, const int walkableClimb, rcHeightfield& solid)
{
	rcAssert(ctx);

	ctx->startTimer(RC_TIMER_FILTER_LOW_OBSTACLES);

	const int w = solid.width;
	const int h = solid.height;

	for (int y = 0; y < h; ++y)
	{
		for (int x = 0; x < w; ++x)
		{
			rcSpan* ps = 0;
			bool previousWalkable = false;
			unsigned char previousArea = RC_NULL_AREA;

			for (rcSpan* s = solid.spans[x + y*w]; s; ps = s, s = s->next)
			{
				const bool walkable = s->area != RC_NULL_AREA;
				// If current span is not walkable, but there is walkable
				// span just below it, mark the span above it walkable too.
				if (!walkable && previousWalkable)
				{
					if (rcAbs((int)s->smax - (int)ps->smax) <= walkableClimb)
						s->area = previousArea;
				}
				// Copy walkable flag so that it cannot propagate
				// past multiple non-walkable objects.
				previousWalkable = walkable;
				previousArea = s->area;
			}
		}
	}

	ctx->stopTimer(RC_TIMER_FILTER_LOW_OBSTACLES);
}

/// @par
///
/// A ledge is a span with one or more neighbors whose maximum is further away than @p walkableClimb
/// from the current span's maximum.
/// This method removes the impact of the overestimation of conservative voxelization
/// so the resulting mesh will not have regions hanging in the air over ledges.
///
/// A span is a ledge if: <tt>rcAbs(currentSpan.smax - neighborSpan.smax) > walkableClimb</tt>
///
/// @see rcHeightfield, rcConfig
void rcFilterLedgeSpans(rcContext* ctx, const int walkableHeight, const int walkableClimb,
						rcHeightfield& solid)
{
	rcAssert(ctx);

	ctx->startTimer(RC_TIMER_FILTER_BORDER);

	const int w = solid.width;
	const int h = solid.height;
	const int MAX_HEIGHT = 0xffff;

	// Mark border spans.
	for (int y = 0; y < h; ++y)
	{
		for (int x = 0; x < w; ++x)
		{
			for (rcSpan* s = solid.spans[x + y*w]; s; s = s->next)
			{
				// Skip non walkable spans.
				if (s->area == RC_NULL_AREA)
					continue;

				const int bot = (int)(s->smax);
				const int top = s->next ? (int)(s->next->smin) : MAX_HEIGHT;

				// Find neighbours minimum height.
				int minh = MAX_HEIGHT;

				// Min and max height of accessible neighbours.
				int asmin = s->smax;
				int asmax = s->smax;

				for (int dir = 0; dir < 4; ++dir)
				{
					int dx = x + rcGetDirOffsetX(dir);
					int dy = y + rcGetDirOffsetY(dir);
					// Skip neighbours which are out of bounds.
					if (dx < 0 || dy < 0 || dx >= w || dy >= h)
					{
						minh = rcMin(minh, -walkableClimb - bot);
						continue;
					}

					// From minus infinity to the first span.
					rcSpan* ns = solid.spans[dx + dy*w];
					int nbot = -walkableClimb;
					int ntop = ns ? (int)ns->smin : MAX_HEIGHT;
					// Skip neightbour if the gap between the spans is too small.
					if (rcMin(top,ntop) - rcMax(bot,nbot) > walkableHeight)
						minh = rcMin(minh, nbot - bot);

					// Rest of the spans.
					for (ns = solid.spans[dx + dy*w]; ns; ns = ns->next)
					{
						nbot = (int)ns->smax;
						ntop = ns->next ? (int)ns->next->smin : MAX_HEIGHT;
						// Skip neightbour if the gap between the spans is too small.
						if (rcMin(top,ntop) - rcMax(bot,nbot) > walkableHeight)
						{
							minh = rcMin(minh, nbot - bot);

							// Find min/max accessible neighbour height.
							if (rcAbs(nbot - bot) <= walkableClimb)
							{
								if (nbot < asmin) asmin = nbot;
								if (nbot > asmax) asmax = nbot;
							}

						}
					}
				}

				// The current span is close to a ledge if the drop to any
				// neighbour span is less than the walkableClimb.
				if (minh < -walkableClimb)
					s->area = RC_NULL_AREA;

				// If the difference between all neighbours is too large,
				// we are at steep slope, mark the span as ledge.
				if ((asmax - asmin) > walkableClimb)
				{
					s->area = RC_NULL_AREA;
				}
			}
		}
	}

	ctx->stopTimer(RC_TIMER_FILTER_BORDER);
}

/// @par
///
/// For this filter, the clearance above the span is the distance from the span's
/// maximum to the next higher span's minimum. (Same grid column.)
///
/// @see rcHeightfield, rcConfig
void rcFilterWalkableLowHeightSpans(rcContext* ctx, int walkableHeight, rcHeightfield& solid)
{
	rcAssert(ctx);

	ctx->startTimer(RC_TIMER_FILTER_WALKABLE);

	const int w = solid.width;
	const int h = solid.height;
	const int MAX_HEIGHT = 0xffff;

	// Remove walkable flag from spans which do not have enough
	// space above them for the agent to stand there.
	for (int y = 0; y < h; ++y)
	{
		for (int x = 0; x < w; ++x)
		{
			for (rcSpan* s = solid.spans[x + y*w]; s; s = s->next)
			{
				const int bot = (int)(s->smax);
				const int top = s->next ? (int)(s->next->smin) : MAX_HEIGHT;
				if ((top - bot) <= walkableHeight)
					s->area = RC_NULL_AREA;
			}
		}
	}

	ctx->stopTimer(RC_TIMER_FILTER_WALKABLE);
}


text:
/*
 * 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.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.clouderrorreporting.v1beta1.model;

/**
 * Contains a set of requested error events.
 *
 *
 This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the Stackdriver Error Reporting API. For a detailed
 * explanation see:
 * https://developers.google.com/api-client-library/java/google-http-java-client/json
 *

 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class ListEventsResponse extends com.google.api.client.json.GenericJson {

  /**
   * The error events which match the given request.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.util.List<ErrorEvent> errorEvents;

  static {
    // hack to force ProGuard to consider ErrorEvent used, since otherwise it would be stripped out
    // see https://github.com/google/google-api-java-client/issues/543
    com.google.api.client.util.Data.nullOf(ErrorEvent.class);
  }

  /**
   * If non-empty, more results are available. Pass this token, along with the same query parameters
   * as the first request, to view the next page of results.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String nextPageToken;

  /**
   * The timestamp specifies the start time to which the request was restricted.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private String timeRangeBegin;

  /**
   * The error events which match the given request.
   * @return value or {@code null} for none
   */
  public java.util.List<ErrorEvent> getErrorEvents() {
    return errorEvents;
  }

  /**
   * The error events which match the given request.
   * @param errorEvents errorEvents or {@code null} for none
   */
  public ListEventsResponse setErrorEvents(java.util.List<ErrorEvent> errorEvents) {
    this.errorEvents = errorEvents;
    return this;
  }

  /**
   * If non-empty, more results are available. Pass this token, along with the same query parameters
   * as the first request, to view the next page of results.
   * @return value or {@code null} for none
   */
  public java.lang.String getNextPageToken() {
    return nextPageToken;
  }

  /**
   * If non-empty, more results are available. Pass this token, along with the same query parameters
   * as the first request, to view the next page of results.
   * @param nextPageToken nextPageToken or {@code null} for none
   */
  public ListEventsResponse setNextPageToken(java.lang.String nextPageToken) {
    this.nextPageToken = nextPageToken;
    return this;
  }

  /**
   * The timestamp specifies the start time to which the request was restricted.
   * @return value or {@code null} for none
   */
  public String getTimeRangeBegin() {
    return timeRangeBegin;
  }

  /**
   * The timestamp specifies the start time to which the request was restricted.
   * @param timeRangeBegin timeRangeBegin or {@code null} for none
   */
  public ListEventsResponse setTimeRangeBegin(String timeRangeBegin) {
    this.timeRangeBegin = timeRangeBegin;
    return this;
  }

  @Override
  public ListEventsResponse set(String fieldName, Object value) {
    return (ListEventsResponse) super.set(fieldName, value);
  }

  @Override
  public ListEventsResponse clone() {
    return (ListEventsResponse) super.clone();
  }

}


text:
package org.lwjgl.cuda;

import javax.annotation.*;

import java.nio.*;

import org.lwjgl.*;
import org.lwjgl.system.*;

import static org.lwjgl.system.Checks.*;
import static org.lwjgl.system.MemoryUtil.*;
import static org.lwjgl.system.MemoryStack.*;

/**
 * CUDA array sparse properties.
 *
 *
Layout

 *
 *

 * struct CUDA_ARRAY_SPARSE_PROPERTIES {
 *     struct {
 *         unsigned int {@link #tileExtent_width width};
 *         unsigned int {@link #tileExtent_height height};
 *         unsigned int {@link #tileExtent_depth depth};
 *     } tileExtent;
 *     unsigned int {@link #miptailFirstLevel};
 *     unsigned long long {@link #miptailSize};
 *     unsigned int {@link #flags};
 *     unsigned int reserved[4];
 * }

 */
public class CUDA_ARRAY_SPARSE_PROPERTIES extends Struct implements NativeResource {

    /** The struct size in bytes. */
    public static final int SIZEOF;

    /** The struct alignment in bytes. */
    public static final int ALIGNOF;

    /** The struct member offsets. */
    public static final int
        TILEEXTENT,
            TILEEXTENT_WIDTH,
            TILEEXTENT_HEIGHT,
            TILEEXTENT_DEPTH,
        MIPTAILFIRSTLEVEL,
        MIPTAILSIZE,
        FLAGS,
        RESERVED;

    static {
        Layout layout = __struct(
            __struct(
                __member(4),
                __member(4),
                __member(4)
            ),
            __member(4),
            __member(8),
            __member(4),
            __array(4, 4)
        );

        SIZEOF = layout.getSize();
        ALIGNOF = layout.getAlignment();

        TILEEXTENT = layout.offsetof(0);
            TILEEXTENT_WIDTH = layout.offsetof(1);
            TILEEXTENT_HEIGHT = layout.offsetof(2);
            TILEEXTENT_DEPTH = layout.offsetof(3);
        MIPTAILFIRSTLEVEL = layout.offsetof(4);
        MIPTAILSIZE = layout.offsetof(5);
        FLAGS = layout.offsetof(6);
        RESERVED = layout.offsetof(7);
    }

    /**
     * Creates a {@code CUDA_ARRAY_SPARSE_PROPERTIES} instance at the current position of the specified {@link ByteBuffer} container. Changes to the buffer's content will be
     * visible to the struct instance and vice versa.
     *
     *
The created instance holds a strong reference to the container object.

     */
    public CUDA_ARRAY_SPARSE_PROPERTIES(ByteBuffer container) {
        super(memAddress(container), __checkContainer(container, SIZEOF));
    }

    @Override
    public int sizeof() { return SIZEOF; }

    /** width of sparse tile in elements */
    @NativeType("unsigned int")
    public int tileExtent_width() { return ntileExtent_width(address()); }
    /** height of sparse tile in elements */
    @NativeType("unsigned int")
    public int tileExtent_height() { return ntileExtent_height(address()); }
    /** depth of sparse tile in elements */
    @NativeType("unsigned int")
    public int tileExtent_depth() { return ntileExtent_depth(address()); }
    /** first mip level at which the mip tail begins */
    @NativeType("unsigned int")
    public int miptailFirstLevel() { return nmiptailFirstLevel(address()); }
    /** total size of the mip tail */
    @NativeType("unsigned long long")
    public long miptailSize() { return nmiptailSize(address()); }
    /** flags will either be zero or {@link CU#CU_ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAIL ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAIL} */
    @NativeType("unsigned int")
    public int flags() { return nflags(address()); }
    /** @return a {@link IntBuffer} view of the {@code reserved} field. */
    @NativeType("unsigned int[4]")
    public IntBuffer reserved() { return nreserved(address()); }
    /** @return the value at the specified index of the {@code reserved} field. */
    @NativeType("unsigned int")
    public int reserved(int index) { return nreserved(address(), index); }

    /** Sets the specified value to the {@link #tileExtent_width} field. */
    public CUDA_ARRAY_SPARSE_PROPERTIES tileExtent_width(@NativeType("unsigned int") int value) { ntileExtent_width(address(), value); return this; }
    /** Sets the specified value to the {@link #tileExtent_height} field. */
    public CUDA_ARRAY_SPARSE_PROPERTIES tileExtent_height(@NativeType("unsigned int") int value) { ntileExtent_height(address(), value); return this; }
    /** Sets the specified value to the {@link #tileExtent_depth} field. */
    public CUDA_ARRAY_SPARSE_PROPERTIES tileExtent_depth(@NativeType("unsigned int") int value) { ntileExtent_depth(address(), value); return this; }
    /** Sets the specified value to the {@link #miptailFirstLevel} field. */
    public CUDA_ARRAY_SPARSE_PROPERTIES miptailFirstLevel(@NativeType("unsigned int") int value) { nmiptailFirstLevel(address(), value); return this; }
    /** Sets the specified value to the {@link #miptailSize} field. */
    public CUDA_ARRAY_SPARSE_PROPERTIES miptailSize(@NativeType("unsigned long long") long value) { nmiptailSize(address(), value); return this; }
    /** Sets the specified value to the {@link #flags} field. */
    public CUDA_ARRAY_SPARSE_PROPERTIES flags(@NativeType("unsigned int") int value) { nflags(address(), value); return this; }
    /** Copies the specified {@link IntBuffer} to the {@code reserved} field. */
    public CUDA_ARRAY_SPARSE_PROPERTIES reserved(@NativeType("unsigned int[4]") IntBuffer value) { nreserved(address(), value); return this; }
    /** Sets the specified value at the specified index of the {@code reserved} field. */
    public CUDA_ARRAY_SPARSE_PROPERTIES reserved(int index, @NativeType("unsigned int") int value) { nreserved(address(), index, value); return this; }

    /** Initializes this struct with the specified values. */
    public CUDA_ARRAY_SPARSE_PROPERTIES set(
        int tileExtent_width,
        int tileExtent_height,
        int tileExtent_depth,
        int miptailFirstLevel,
        long miptailSize,
        int flags,
        IntBuffer reserved
    ) {
        tileExtent_width(tileExtent_width);
        tileExtent_height(tileExtent_height);
        tileExtent_depth(tileExtent_depth);
        miptailFirstLevel(miptailFirstLevel);
        miptailSize(miptailSize);
        flags(flags);
        reserved(reserved);

        return this;
    }

    /**
     * Copies the specified struct data to this struct.
     *
     * @param src the source struct
     *
     * @return this struct
     */
    public CUDA_ARRAY_SPARSE_PROPERTIES set(CUDA_ARRAY_SPARSE_PROPERTIES src) {
        memCopy(src.address(), address(), SIZEOF);
        return this;
    }

    // -----------------------------------

    /** Returns a new {@code CUDA_ARRAY_SPARSE_PROPERTIES} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed. */
    public static CUDA_ARRAY_SPARSE_PROPERTIES malloc() {
        return wrap(CUDA_ARRAY_SPARSE_PROPERTIES.class, nmemAllocChecked(SIZEOF));
    }

    /** Returns a new {@code CUDA_ARRAY_SPARSE_PROPERTIES} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed. */
    public static CUDA_ARRAY_SPARSE_PROPERTIES calloc() {
        return wrap(CUDA_ARRAY_SPARSE_PROPERTIES.class, nmemCallocChecked(1, SIZEOF));
    }

    /** Returns a new {@code CUDA_ARRAY_SPARSE_PROPERTIES} instance allocated with {@link BufferUtils}. */
    public static CUDA_ARRAY_SPARSE_PROPERTIES create() {
        ByteBuffer container = BufferUtils.createByteBuffer(SIZEOF);
        return wrap(CUDA_ARRAY_SPARSE_PROPERTIES.class, memAddress(container), container);
    }

    /** Returns a new {@code CUDA_ARRAY_SPARSE_PROPERTIES} instance for the specified memory address. */
    public static CUDA_ARRAY_SPARSE_PROPERTIES create(long address) {
        return wrap(CUDA_ARRAY_SPARSE_PROPERTIES.class, address);
    }

    /** Like {@link #create(long) create}, but returns {@code null} if {@code address} is {@code NULL}. */
    @Nullable
    public static CUDA_ARRAY_SPARSE_PROPERTIES createSafe(long address) {
        return address == NULL ? null : wrap(CUDA_ARRAY_SPARSE_PROPERTIES.class, address);
    }

    /**
     * Returns a new {@link CUDA_ARRAY_SPARSE_PROPERTIES.Buffer} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed.
     *
     * @param capacity the buffer capacity
     */
    public static CUDA_ARRAY_SPARSE_PROPERTIES.Buffer malloc(int capacity) {
        return wrap(Buffer.class, nmemAllocChecked(__checkMalloc(capacity, SIZEOF)), capacity);
    }

    /**
     * Returns a new {@link CUDA_ARRAY_SPARSE_PROPERTIES.Buffer} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed.
     *
     * @param capacity the buffer capacity
     */
    public static CUDA_ARRAY_SPARSE_PROPERTIES.Buffer calloc(int capacity) {
        return wrap(Buffer.class, nmemCallocChecked(capacity, SIZEOF), capacity);
    }

    /**
     * Returns a new {@link CUDA_ARRAY_SPARSE_PROPERTIES.Buffer} instance allocated with {@link BufferUtils}.
     *
     * @param capacity the buffer capacity
     */
    public static CUDA_ARRAY_SPARSE_PROPERTIES.Buffer create(int capacity) {
        ByteBuffer container = __create(capacity, SIZEOF);
        return wrap(Buffer.class, memAddress(container), capacity, container);
    }

    /**
     * Create a {@link CUDA_ARRAY_SPARSE_PROPERTIES.Buffer} instance at the specified memory.
     *
     * @param address  the memory address
     * @param capacity the buffer capacity
     */
    public static CUDA_ARRAY_SPARSE_PROPERTIES.Buffer create(long address, int capacity) {
        return wrap(Buffer.class, address, capacity);
    }

    /** Like {@link #create(long, int) create}, but returns {@code null} if {@code address} is {@code NULL}. */
    @Nullable
    public static CUDA_ARRAY_SPARSE_PROPERTIES.Buffer createSafe(long address, int capacity) {
        return address == NULL ? null : wrap(Buffer.class, address, capacity);
    }

    /**
     * Returns a new {@code CUDA_ARRAY_SPARSE_PROPERTIES} instance allocated on the specified {@link MemoryStack}.
     *
     * @param stack the stack from which to allocate
     */
    public static CUDA_ARRAY_SPARSE_PROPERTIES malloc(MemoryStack stack) {
        return wrap(CUDA_ARRAY_SPARSE_PROPERTIES.class, stack.nmalloc(ALIGNOF, SIZEOF));
    }

    /**
     * Returns a new {@code CUDA_ARRAY_SPARSE_PROPERTIES} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero.
     *
     * @param stack the stack from which to allocate
     */
    public static CUDA_ARRAY_SPARSE_PROPERTIES calloc(MemoryStack stack) {
        return wrap(CUDA_ARRAY_SPARSE_PROPERTIES.class, stack.ncalloc(ALIGNOF, 1, SIZEOF));
    }

    /**
     * Returns a new {@link CUDA_ARRAY_SPARSE_PROPERTIES.Buffer} instance allocated on the specified {@link MemoryStack}.
     *
     * @param stack    the stack from which to allocate
     * @param capacity the buffer capacity
     */
    public static CUDA_ARRAY_SPARSE_PROPERTIES.Buffer malloc(int capacity, MemoryStack stack) {
        return wrap(Buffer.class, stack.nmalloc(ALIGNOF, capacity * SIZEOF), capacity);
    }

    /**
     * Returns a new {@link CUDA_ARRAY_SPARSE_PROPERTIES.Buffer} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero.
     *
     * @param stack    the stack from which to allocate
     * @param capacity the buffer capacity
     */
    public static CUDA_ARRAY_SPARSE_PROPERTIES.Buffer calloc(int capacity, MemoryStack stack) {
        return wrap(Buffer.class, stack.ncalloc(ALIGNOF, capacity, SIZEOF), capacity);
    }

    // -----------------------------------

    /** Unsafe version of {@link #tileExtent_width}. */
    public static int ntileExtent_width(long struct) { return UNSAFE.getInt(null, struct + CUDA_ARRAY_SPARSE_PROPERTIES.TILEEXTENT_WIDTH); }
    /** Unsafe version of {@link #tileExtent_height}. */
    public static int ntileExtent_height(long struct) { return UNSAFE.getInt(null, struct + CUDA_ARRAY_SPARSE_PROPERTIES.TILEEXTENT_HEIGHT); }
    /** Unsafe version of {@link #tileExtent_depth}. */
    public static int ntileExtent_depth(long struct) { return UNSAFE.getInt(null, struct + CUDA_ARRAY_SPARSE_PROPERTIES.TILEEXTENT_DEPTH); }
    /** Unsafe version of {@link #miptailFirstLevel}. */
    public static int nmiptailFirstLevel(long struct) { return UNSAFE.getInt(null, struct + CUDA_ARRAY_SPARSE_PROPERTIES.MIPTAILFIRSTLEVEL); }
    /** Unsafe version of {@link #miptailSize}. */
    public static long nmiptailSize(long struct) { return UNSAFE.getLong(null, struct + CUDA_ARRAY_SPARSE_PROPERTIES.MIPTAILSIZE); }
    /** Unsafe version of {@link #flags}. */
    public static int nflags(long struct) { return UNSAFE.getInt(null, struct + CUDA_ARRAY_SPARSE_PROPERTIES.FLAGS); }
    /** Unsafe version of {@link #reserved}. */
    public static IntBuffer nreserved(long struct) { return memIntBuffer(struct + CUDA_ARRAY_SPARSE_PROPERTIES.RESERVED, 4); }
    /** Unsafe version of {@link #reserved(int) reserved}. */
    public static int nreserved(long struct, int index) {
        return UNSAFE.getInt(null, struct + CUDA_ARRAY_SPARSE_PROPERTIES.RESERVED + check(index, 4) * 4);
    }

    /** Unsafe version of {@link #tileExtent_width(int) tileExtent_width}. */
    public static void ntileExtent_width(long struct, int value) { UNSAFE.putInt(null, struct + CUDA_ARRAY_SPARSE_PROPERTIES.TILEEXTENT_WIDTH, value); }
    /** Unsafe version of {@link #tileExtent_height(int) tileExtent_height}. */
    public static void ntileExtent_height(long struct, int value) { UNSAFE.putInt(null, struct + CUDA_ARRAY_SPARSE_PROPERTIES.TILEEXTENT_HEIGHT, value); }
    /** Unsafe version of {@link #tileExtent_depth(int) tileExtent_depth}. */
    public static void ntileExtent_depth(long struct, int value) { UNSAFE.putInt(null, struct + CUDA_ARRAY_SPARSE_PROPERTIES.TILEEXTENT_DEPTH, value); }
    /** Unsafe version of {@link #miptailFirstLevel(int) miptailFirstLevel}. */
    public static void nmiptailFirstLevel(long struct, int value) { UNSAFE.putInt(null, struct + CUDA_ARRAY_SPARSE_PROPERTIES.MIPTAILFIRSTLEVEL, value); }
    /** Unsafe version of {@link #miptailSize(long) miptailSize}. */
    public static void nmiptailSize(long struct, long value) { UNSAFE.putLong(null, struct + CUDA_ARRAY_SPARSE_PROPERTIES.MIPTAILSIZE, value); }
    /** Unsafe version of {@link #flags(int) flags}. */
    public static void nflags(long struct, int value) { UNSAFE.putInt(null, struct + CUDA_ARRAY_SPARSE_PROPERTIES.FLAGS, value); }
    /** Unsafe version of {@link #reserved(IntBuffer) reserved}. */
    public static void nreserved(long struct, IntBuffer value) {
        if (CHECKS) { checkGT(value, 4); }
        memCopy(memAddress(value), struct + CUDA_ARRAY_SPARSE_PROPERTIES.RESERVED, value.remaining() * 4);
    }
    /** Unsafe version of {@link #reserved(int, int) reserved}. */
    public static void nreserved(long struct, int index, int value) {
        UNSAFE.putInt(null, struct + CUDA_ARRAY_SPARSE_PROPERTIES.RESERVED + check(index, 4) * 4, value);
    }

    // -----------------------------------

    /** An array of {@link CUDA_ARRAY_SPARSE_PROPERTIES} structs. */
    public static class Buffer extends StructBuffer<CUDA_ARRAY_SPARSE_PROPERTIES, Buffer> implements NativeResource {

        private static final CUDA_ARRAY_SPARSE_PROPERTIES ELEMENT_FACTORY = CUDA_ARRAY_SPARSE_PROPERTIES.create(-1L);

        /**
         * Creates a new {@code CUDA_ARRAY_SPARSE_PROPERTIES.Buffer} instance backed by the specified container.
         *
         * Changes to the container's content will be visible to the struct buffer instance and vice versa. The two buffers' position, limit, and mark values
         * will be independent. The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided
         * by {@link CUDA_ARRAY_SPARSE_PROPERTIES#SIZEOF}, and its mark will be undefined.
         *
         *
The created buffer instance holds a strong reference to the container object.

         */
        public Buffer(ByteBuffer container) {
            super(container, container.remaining() / SIZEOF);
        }

        public Buffer(long address, int cap) {
            super(address, null, -1, 0, cap, cap);
        }

        Buffer(long address, @Nullable ByteBuffer container, int mark, int pos, int lim, int cap) {
            super(address, container, mark, pos, lim, cap);
        }

        @Override
        protected Buffer self() {
            return this;
        }

        @Override
        protected CUDA_ARRAY_SPARSE_PROPERTIES getElementFactory() {
            return ELEMENT_FACTORY;
        }

        /** @return the value of the {@link CUDA_ARRAY_SPARSE_PROPERTIES#tileExtent_width} field. */
        @NativeType("unsigned int")
        public int tileExtent_width() { return CUDA_ARRAY_SPARSE_PROPERTIES.ntileExtent_width(address()); }
        /** @return the value of the {@link CUDA_ARRAY_SPARSE_PROPERTIES#tileExtent_height} field. */
        @NativeType("unsigned int")
        public int tileExtent_height() { return CUDA_ARRAY_SPARSE_PROPERTIES.ntileExtent_height(address()); }
        /** @return the value of the {@link CUDA_ARRAY_SPARSE_PROPERTIES#tileExtent_depth} field. */
        @NativeType("unsigned int")
        public int tileExtent_depth() { return CUDA_ARRAY_SPARSE_PROPERTIES.ntileExtent_depth(address()); }
        /** @return the value of the {@link CUDA_ARRAY_SPARSE_PROPERTIES#miptailFirstLevel} field. */
        @NativeType("unsigned int")
        public int miptailFirstLevel() { return CUDA_ARRAY_SPARSE_PROPERTIES.nmiptailFirstLevel(address()); }
        /** @return the value of the {@link CUDA_ARRAY_SPARSE_PROPERTIES#miptailSize} field. */
        @NativeType("unsigned long long")
        public long miptailSize() { return CUDA_ARRAY_SPARSE_PROPERTIES.nmiptailSize(address()); }
        /** @return the value of the {@link CUDA_ARRAY_SPARSE_PROPERTIES#flags} field. */
        @NativeType("unsigned int")
        public int flags() { return CUDA_ARRAY_SPARSE_PROPERTIES.nflags(address()); }
        /** @return a {@link IntBuffer} view of the {@code reserved} field. */
        @NativeType("unsigned int[4]")
        public IntBuffer reserved() { return CUDA_ARRAY_SPARSE_PROPERTIES.nreserved(address()); }
        /** @return the value at the specified index of the {@code reserved} field. */
        @NativeType("unsigned int")
        public int reserved(int index) { return CUDA_ARRAY_SPARSE_PROPERTIES.nreserved(address(), index); }

        /** Sets the specified value to the {@link CUDA_ARRAY_SPARSE_PROPERTIES#tileExtent_width} field. */
        public CUDA_ARRAY_SPARSE_PROPERTIES.Buffer tileExtent_width(@NativeType("unsigned int") int value) { CUDA_ARRAY_SPARSE_PROPERTIES.ntileExtent_width(address(), value); return this; }
        /** Sets the specified value to the {@link CUDA_ARRAY_SPARSE_PROPERTIES#tileExtent_height} field. */
        public CUDA_ARRAY_SPARSE_PROPERTIES.Buffer tileExtent_height(@NativeType("unsigned int") int value) { CUDA_ARRAY_SPARSE_PROPERTIES.ntileExtent_height(address(), value); return this; }
        /** Sets the specified value to the {@link CUDA_ARRAY_SPARSE_PROPERTIES#tileExtent_depth} field. */
        public CUDA_ARRAY_SPARSE_PROPERTIES.Buffer tileExtent_depth(@NativeType("unsigned int") int value) { CUDA_ARRAY_SPARSE_PROPERTIES.ntileExtent_depth(address(), value); return this; }
        /** Sets the specified value to the {@link CUDA_ARRAY_SPARSE_PROPERTIES#miptailFirstLevel} field. */
        public CUDA_ARRAY_SPARSE_PROPERTIES.Buffer miptailFirstLevel(@NativeType("unsigned int") int value) { CUDA_ARRAY_SPARSE_PROPERTIES.nmiptailFirstLevel(address(), value); return this; }
        /** Sets the specified value to the {@link CUDA_ARRAY_SPARSE_PROPERTIES#miptailSize} field. */
        public CUDA_ARRAY_SPARSE_PROPERTIES.Buffer miptailSize(@NativeType("unsigned long long") long value) { CUDA_ARRAY_SPARSE_PROPERTIES.nmiptailSize(address(), value); return this; }
        /** Sets the specified value to the {@link CUDA_ARRAY_SPARSE_PROPERTIES#flags} field. */
        public CUDA_ARRAY_SPARSE_PROPERTIES.Buffer flags(@NativeType("unsigned int") int value) { CUDA_ARRAY_SPARSE_PROPERTIES.nflags(address(), value); return this; }
        /** Copies the specified {@link IntBuffer} to the {@code reserved} field. */
        public CUDA_ARRAY_SPARSE_PROPERTIES.Buffer reserved(@NativeType("unsigned int[4]") IntBuffer value) { CUDA_ARRAY_SPARSE_PROPERTIES.nreserved(address(), value); return this; }
        /** Sets the specified value at the specified index of the {@code reserved} field. */
        public CUDA_ARRAY_SPARSE_PROPERTIES.Buffer reserved(int index, @NativeType("unsigned int") int value) { CUDA_ARRAY_SPARSE_PROPERTIES.nreserved(address(), index, value); return this; }

    }

}


text:
package org.tearne.crosser.plant

import org.tearne.crosser.cross.Locus
import org.tearne.crosser.util.AlleleCount
import org.scalatest.FreeSpec
import org.scalatest.mock.MockitoSugar

class TidTest extends FreeSpec with MockitoSugar{

	val linkGroupIrrelevant = 999
	val nameIrrelevant = "whatever"

	"Tid should" - {
		"give a count of donor alleles present" in new Setup {
			val testAlleles = IndexedSeq(p1, p1, p1, p2, p3)
			val instance = Tid(testAlleles)

			assertResult(AlleleCount(3,5))(instance.alleleCount(p1))
		}
		"store alleles" in new Setup {
			val testAlleles = IndexedSeq(p1, p1, p1, p2, p3)
			val instance = Tid(testAlleles)

			assertResult(testAlleles)(instance.alleles)
		}
		"have easy access to alleles size" in new Setup{
			val testAlleles = IndexedSeq(p1, p1, p1, p2, p3)
			assertResult(5)(Tid(testAlleles).size)
		}
		"have companion to build tid for root plants" in new Setup{
			val instance = Tid(5, p1)

			assertResult(1 to 5 map(i => p1))(instance.alleles)
		}
		"have value based hashcode and equals" in new Setup {
			val instance1a = Tid(IndexedSeq(p1, p2, p3))
			val instance1b = Tid(IndexedSeq(p1, p2, p3))
			val instance2 = Tid(IndexedSeq(p1, p1, p3))

			assertResult(instance1b)(instance1a)
			assertResult(instance1a.hashCode)(instance1b.hashCode)
			assert(instance1a != instance2)
			assert(instance1a.hashCode != instance2.hashCode)
		}
		"satisfies locus" in new Setup {
			val instance = Tid(IndexedSeq(p1, p2, p3))
			val locus = Locus(p2, linkGroupIrrelevant, 2, nameIrrelevant)

			assert(instance.satisfies(locus))
		}
		"doesn't satisfy locus" in new Setup {
			val instance = Tid(IndexedSeq(p1, p1, p3))
			val locus = Locus(p2, linkGroupIrrelevant, 2, nameIrrelevant)

			assert(!instance.satisfies(locus))
		}
	}

	trait Setup {
		val p1 = mock[RootPlant]
		val p2 = mock[RootPlant]
		val p3 = mock[RootPlant]
	}
}


text:
"""Support for monitoring an SABnzbd NZB client."""
import logging
from datetime import timedelta

import voluptuous as vol

import homeassistant.helpers.config_validation as cv
from homeassistant.components.discovery import SERVICE_SABNZBD
from homeassistant.const import (
    CONF_HOST,
    CONF_API_KEY,
    CONF_NAME,
    CONF_PATH,
    CONF_PORT,
    CONF_SENSORS,
    CONF_SSL,
)
from homeassistant.core import callback
from homeassistant.helpers import discovery
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.dispatcher import async_dispatcher_send
from homeassistant.helpers.event import async_track_time_interval
from homeassistant.util.json import load_json, save_json

_LOGGER = logging.getLogger(__name__)

DOMAIN = "sabnzbd"
DATA_SABNZBD = "sabznbd"

_CONFIGURING = {}

ATTR_SPEED = "speed"
BASE_URL_FORMAT = "{}://{}:{}/"
CONFIG_FILE = "sabnzbd.conf"
DEFAULT_HOST = "localhost"
DEFAULT_NAME = "SABnzbd"
DEFAULT_PORT = 8080
DEFAULT_SPEED_LIMIT = "100"
DEFAULT_SSL = False

UPDATE_INTERVAL = timedelta(seconds=30)

SERVICE_PAUSE = "pause"
SERVICE_RESUME = "resume"
SERVICE_SET_SPEED = "set_speed"

SIGNAL_SABNZBD_UPDATED = "sabnzbd_updated"

SENSOR_TYPES = {
    "current_status": ["Status", None, "status"],
    "speed": ["Speed", "MB/s", "kbpersec"],
    "queue_size": ["Queue", "MB", "mb"],
    "queue_remaining": ["Left", "MB", "mbleft"],
    "disk_size": ["Disk", "GB", "diskspacetotal1"],
    "disk_free": ["Disk Free", "GB", "diskspace1"],
    "queue_count": ["Queue Count", None, "noofslots_total"],
    "day_size": ["Daily Total", "GB", "day_size"],
    "week_size": ["Weekly Total", "GB", "week_size"],
    "month_size": ["Monthly Total", "GB", "month_size"],
    "total_size": ["Total", "GB", "total_size"],
}

SPEED_LIMIT_SCHEMA = vol.Schema(
    {vol.Optional(ATTR_SPEED, default=DEFAULT_SPEED_LIMIT): cv.string}
)

CONFIG_SCHEMA = vol.Schema(
    {
        DOMAIN: vol.Schema(
            {
                vol.Required(CONF_API_KEY): cv.string,
                vol.Optional(CONF_HOST, default=DEFAULT_HOST): cv.string,
                vol.Optional(CONF_PATH): cv.string,
                vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
                vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port,
                vol.Optional(CONF_SENSORS): vol.All(
                    cv.ensure_list, [vol.In(SENSOR_TYPES)]
                ),
                vol.Optional(CONF_SSL, default=DEFAULT_SSL): cv.boolean,
            }
        )
    },
    extra=vol.ALLOW_EXTRA,
)

async def async_check_sabnzbd(sab_api):
    """Check if we can reach SABnzbd."""
    from pysabnzbd import SabnzbdApiException

    try:
        await sab_api.check_available()
        return True
    except SabnzbdApiException:
        _LOGGER.error("Connection to SABnzbd API failed")
        return False

async def async_configure_sabnzbd(
    hass, config, use_ssl, name=DEFAULT_NAME, api_key=None
):
    """Try to configure Sabnzbd and request api key if configuration fails."""
    from pysabnzbd import SabnzbdApi

    host = config[CONF_HOST]
    port = config[CONF_PORT]
    web_root = config.get(CONF_PATH)
    uri_scheme = "https" if use_ssl else "http"
    base_url = BASE_URL_FORMAT.format(uri_scheme, host, port)
    if api_key is None:
        conf = await hass.async_add_job(load_json, hass.config.path(CONFIG_FILE))
        api_key = conf.get(base_url, {}).get(CONF_API_KEY, "")

    sab_api = SabnzbdApi(
        base_url, api_key, web_root=web_root, session=async_get_clientsession(hass)
    )
    if await async_check_sabnzbd(sab_api):
        async_setup_sabnzbd(hass, sab_api, config, name)
    else:
        async_request_configuration(hass, config, base_url, web_root)

async def async_setup(hass, config):
    """Set up the SABnzbd component."""

    async def sabnzbd_discovered(service, info):
        """Handle service discovery."""
        ssl = info.get("properties", {}).get("https", "0") == "1"
        await async_configure_sabnzbd(hass, info, ssl)

    discovery.async_listen(hass, SERVICE_SABNZBD, sabnzbd_discovered)

    conf = config.get(DOMAIN)
    if conf is not None:
        use_ssl = conf.get(CONF_SSL)
        name = conf.get(CONF_NAME)
        api_key = conf.get(CONF_API_KEY)
        await async_configure_sabnzbd(hass, conf, use_ssl, name, api_key)
    return True

@callback
def async_setup_sabnzbd(hass, sab_api, config, name):
    """Set up SABnzbd sensors and services."""
    sab_api_data = SabnzbdApiData(sab_api, name, config.get(CONF_SENSORS, {}))

    if config.get(CONF_SENSORS):
        hass.data[DATA_SABNZBD] = sab_api_data
        hass.async_create_task(
            discovery.async_load_platform(hass, "sensor", DOMAIN, {}, config)
        )

    async def async_service_handler(service):
        """Handle service calls."""
        if service.service == SERVICE_PAUSE:
            await sab_api_data.async_pause_queue()
        elif service.service == SERVICE_RESUME:
            await sab_api_data.async_resume_queue()
        elif service.service == SERVICE_SET_SPEED:
            speed = service.data.get(ATTR_SPEED)
            await sab_api_data.async_set_queue_speed(speed)

    hass.services.async_register(
        DOMAIN, SERVICE_PAUSE, async_service_handler, schema=vol.Schema({})
    )

    hass.services.async_register(
        DOMAIN, SERVICE_RESUME, async_service_handler, schema=vol.Schema({})
    )

    hass.services.async_register(
        DOMAIN, SERVICE_SET_SPEED, async_service_handler, schema=SPEED_LIMIT_SCHEMA
    )

    async def async_update_sabnzbd(now):
        """Refresh SABnzbd queue data."""
        from pysabnzbd import SabnzbdApiException

        try:
            await sab_api.refresh_data()
            async_dispatcher_send(hass, SIGNAL_SABNZBD_UPDATED, None)
        except SabnzbdApiException as err:
            _LOGGER.error(err)

    async_track_time_interval(hass, async_update_sabnzbd, UPDATE_INTERVAL)

@callback
def async_request_configuration(hass, config, host, web_root):
    """Request configuration steps from the user."""
    from pysabnzbd import SabnzbdApi

    configurator = hass.components.configurator
    # We got an error if this method is called while we are configuring
    if host in _CONFIGURING:
        configurator.async_notify_errors(
            _CONFIGURING[host], "Failed to register, please try again."
        )

        return

    async def async_configuration_callback(data):
        """Handle configuration changes."""
        api_key = data.get(CONF_API_KEY)
        sab_api = SabnzbdApi(
            host, api_key, web_root=web_root, session=async_get_clientsession(hass)
        )
        if not await async_check_sabnzbd(sab_api):
            return

        def success():
            """Signal successful setup."""
            conf = load_json(hass.config.path(CONFIG_FILE))
            conf[host] = {CONF_API_KEY: api_key}
            save_json(hass.config.path(CONFIG_FILE), conf)
            req_config = _CONFIGURING.pop(host)
            configurator.request_done(req_config)

        hass.async_add_job(success)
        async_setup_sabnzbd(hass, sab_api, config, config.get(CONF_NAME, DEFAULT_NAME))

    _CONFIGURING[host] = configurator.async_request_config(
        DEFAULT_NAME,
        async_configuration_callback,
        description="Enter the API Key",
        submit_caption="Confirm",
        fields=[{"id": CONF_API_KEY, "name": "API Key", "type": ""}],
    )

class SabnzbdApiData:
    """Class for storing/refreshing sabnzbd api queue data."""

    def __init__(self, sab_api, name, sensors):
        """Initialize component."""
        self.sab_api = sab_api
        self.name = name
        self.sensors = sensors

    async def async_pause_queue(self):
        """Pause Sabnzbd queue."""
        from pysabnzbd import SabnzbdApiException

        try:
            return await self.sab_api.pause_queue()
        except SabnzbdApiException as err:
            _LOGGER.error(err)
            return False

    async def async_resume_queue(self):
        """Resume Sabnzbd queue."""
        from pysabnzbd import SabnzbdApiException

        try:
            return await self.sab_api.resume_queue()
        except SabnzbdApiException as err:
            _LOGGER.error(err)
            return False

    async def async_set_queue_speed(self, limit):
        """Set speed limit for the Sabnzbd queue."""
        from pysabnzbd import SabnzbdApiException

        try:
            return await self.sab_api.set_speed_limit(limit)
        except SabnzbdApiException as err:
            _LOGGER.error(err)
            return False

    def get_queue_field(self, field):
        """Return the value for the given field from the Sabnzbd queue."""
        return self.sab_api.queue.get(field)