text:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Insight Poster Template v0.3.2
%
% https://github.com/igorbrigadir/insight-templates
%
% Based on beamerposter class
% http://www.ctan.org/pkg/beamerposter
% http://www-i6.informatik.rwth-aachen.de/~dreuw/latexbeamerposter.php
%
% Needs up to date TeX (Tested with TeX 2014)
%
% To install ubuntu fonts in LaTeX:
% https://github.com/tzwenn/ubuntu-latex-fonts

% Required Packages - Do not edit these:
\documentclass[final,hyperref={pdfpagelabels=false}]{beamer}
\mode<presentation>{\usetheme{Insight}}
\usepackage[utf8]{inputenc}
\PassOptionsToPackage{cmyk}{xcolor}
\usepackage{ubuntu}

% Set Size of poster with size= property: a0, a1, a2, a3. Default is A0
\usepackage[orientation=portrait,size=a0,scale=1.4,debug]{beamerposter}

% Required Packages - Do not edit these:
\usepackage[english]{babel}
\usepackage{tikz}
\usepackage{calc}
\usepackage{tcolorbox}
\usepackage{graphics}
\usepackage[percent]{overpic}
\usepackage{ragged2e}
\usepackage{amsmath,amsthm, amssymb, latexsym}
\boldmath
\tcbuselibrary{skins}
\usetikzlibrary{shadings}
\graphicspath{{figures/}} % Settings
\addtobeamertemplate{block begin}{}{\justifying} % Justify text
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Add any other Optional Packages Here:
%\usepackage{epstopdf} % \includegraphics converts eps to pdf
\usepackage{blindtext} % Used for Example Text

% If you have a really long title, uncomment this next line:
\setbeamerfont*{title in headline}{size=\veryHuge,family=\fontUbuntuLight}

% A really long title example:
\title{A Something something: Really really unnecessarily long title of your poster just because you can}

% If you have a long title and or lots of authors, uncomment this next line:
\setbeamerfont*{author in headline}{size=\large,family=\fontUbuntuMedium}

% Use \\ if First and Second names get split between lines. Example:
\author{Author One, Author Two, Reallylongfirstname Reallyreallylongsecondname, \\ Another Author, Someone Else, Another Person}

% If you need to change the default Acknowledgement, uncomment & edit one of these lines:

% Default:
%\renewcommand{\acknowledgements}{The Insight Centre for Data Analytics is supported by Science Foundation Ireland under Grant Number SFI/12/RC/2289}

% Alternative Acknowledgement:
%\renewcommand{\acknowledgements}{This publication has emanated from research conducted with the financial support of Science Foundation Ireland (SFI) under Grant Number SFI/12/RC/2289}

% SFI & Some other funding:
%\renewcommand{\acknowledgements}{This publication has emanated from research supported in part by a research grant from Science Foundation Ireland (SFI) under Grant Number SFI/12/RC/2289}

\begin{document}
\begin{frame}{}

\begin{columns}[T] % 2 Column Layout
\begin{column}{.43\paperwidth} % Left Column
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% LEFT COLUMN BLOCKS:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{block}{Large Headings typeset in Ubuntu Regular, at 18 point on 21 point line spacing}
Text Here \dots

\blocksubtitle{Subheading in u block test}
More Text \blindtext
\blocksubtitle{Subhead block b54}
List Items \blinditemize
\end{block}

\begin{block}{Second Large Heading Large Heading Large Heading}
Text Here \blinddescription
\blocksubtitle{Subheading in block test}
More Text \blindtext
\end{block}

\begin{block}{Large Heading colour is C100 M0 Y0 K48}
Math example \blindmathtrue
More Text \blindtext
\end{block}

\end{column}
\begin{column}{.43\paperwidth} % Right Column
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% RIGHT COLUMN BLOCKS:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{block}{Introduction}
	\begin{itemize}
		\item some items and $\alpha=\beta,\gamma_{i}$
		\item some items
		\item some items
		\item some items
	\end{itemize}

	$$\Delta M_i^{-1} = - \alpha \sum_{n=1}^N D_i \left[ n \right] \left[ \sum_{j \in C \left[ i \right]}^{} F_{ji} \left[ n-1 \right] + Fext_i \left[ n^{-1} \right] \right]$$
\end{block}

\begin{block}{Text sizes}
\centering
	{\tiny tiny}\par
	{\scriptsize scriptsize}\par
	{\footnotesize footnotesize}\par
	{\normalsize normalsize}\par
	{\large large}\par
	{\Large Large}\par
	{\LARGE LARGE}\par
	{\veryHuge veryHuge}\par
	{\VeryHuge VeryHuge}\par
	{\VERYHuge VERYHuge}\par
\end{block}

\begin{block}{Graphics}
\includegraphics[width=\textwidth]{insightlogo.pdf} \\
Text Here \blindtext
\blocksubtitle{Subheading in u block test}
More Text \blindtext
\end{block}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{column}
\end{columns}
\end{frame}
\end{document}


text:
// @formatter:off

// @formatter:on

package org.tensorics.core.iterable.lang;

import org.tensorics.core.iterable.operations.IterableAverage;
import org.tensorics.core.iterable.operations.IterableRms;
import org.tensorics.core.iterable.operations.IterableSize;
import org.tensorics.core.iterable.operations.IterableStd;
import org.tensorics.core.iterable.operations.IterableSum;
import org.tensorics.core.iterable.operations.IterableSumOfSquares;
import org.tensorics.core.iterable.operations.IterableVar;
import org.tensorics.core.math.ExtendedField;

/**
 * Contains instances of operations on iterables, based on a field. The main purpose is to be able to re-use the
 * instances of the operations, in order to avoid to have to re-create them all the time.
 *
 * @author kfuchsbe
 * @param <V> the type of the elements of the field on which the operations are based.
 */
public class IterableOperationRepository<V> {

    private final IterableAverage<V> iterableAverage;
    private final IterableSize<V> iterableSize;
    private final IterableSum<V> iterableSum;
    private final IterableRms<V> iterableRms;
    private final IterableSumOfSquares<V> iterableSumOfSquares;
    private final IterableVar<V> iterableVar;
    private final IterableStd<V> iterableStd;

    public IterableOperationRepository(ExtendedField<V> field) {
        iterableAverage = new IterableAverage<>(field);
        iterableSize = new IterableSize<>(field);
        iterableSum = new IterableSum<>(field);
        iterableRms = new IterableRms<>(field);
        iterableSumOfSquares = new IterableSumOfSquares<>(field);
        iterableVar = new IterableVar<>(field);
        iterableStd = new IterableStd<>(field);
    }

    public IterableAverage<V> average() {
        return iterableAverage;
    }

    public IterableSize<V> size() {
        return iterableSize;
    }

    public IterableSum<V> sum() {
        return iterableSum;
    }

    public IterableRms<V> rms() {
        return iterableRms;
    }

    public IterableSumOfSquares<V> sumOfSquares() {
        return iterableSumOfSquares;
    }

    public IterableVar<V> var() {
        return iterableVar;
    }

    public IterableStd<V> std() {
        return iterableStd;
    }
}

redpajama_set_name: RedPajamaGithub


text:
class VoiceSearchAvailability;

// A custom bar button item that disables itself when voice search is
// unavailable.
@interface VoiceSearchKeyboardBarButtonItem : UIBarButtonItem

// Initializer for an item that disables itself when `availability` returns
// false for IsVoiceSearchAvailable().
- (instancetype)initWithImage:(UIImage*)image
                        style:(UIBarButtonItemStyle)style
                       target:(id)target
                       action:(SEL)action
      voiceSearchAvailability:
          (std::unique_ptr<VoiceSearchAvailability>)availability
    NS_DESIGNATED_INITIALIZER;
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithCoder:(NSCoder*)coder NS_UNAVAILABLE;

@end

#endif  // IOS_CHROME_BROWSER_UI_OMNIBOX_KEYBOARD_ASSIST_VOICE_SEARCH_KEYBOARD_BAR_BUTTON_ITEM_H_


text:
package org.apache.beam.sdk.io.gcp.spanner;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableList;
import com.google.common.io.BaseEncoding;
import com.google.common.primitives.Bytes;
import com.google.common.primitives.UnsignedBytes;
import com.google.common.primitives.UnsignedInteger;
import java.util.Arrays;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/** A set of unit tests to verify {@link OrderedCode}. */
@RunWith(JUnit4.class)
public class OrderedCodeTest {
  /** Data for a generic coding test case with known encoded outputs. */
  abstract static class CodingTestCase<T> {
    /** The test value. */
    abstract T value();

    /** Test value's encoding in increasing order (obtained from the C++ implementation). */
    abstract String increasingBytes();

    /** Test value's encoding in dencreasing order (obtained from the C++ implementation). */
    abstract String decreasingBytes();

    // Helper methods to implement in concrete classes.

    abstract byte[] encodeIncreasing();

    abstract byte[] encodeDecreasing();

    T decodeIncreasing() {
      return decodeIncreasing(new OrderedCode(bytesFromHexString(increasingBytes())));
    }

    T decodeDecreasing() {
      return decodeDecreasing(new OrderedCode(bytesFromHexString(decreasingBytes())));
    }

    abstract T decodeIncreasing(OrderedCode orderedCode);

    abstract T decodeDecreasing(OrderedCode orderedCode);
  }

  @AutoValue
  abstract static class UnsignedNumber extends CodingTestCase<Long> {
    @Override
    byte[] encodeIncreasing() {
      OrderedCode orderedCode = new OrderedCode();
      orderedCode.writeNumIncreasing(value());
      return orderedCode.getEncodedBytes();
    }

    @Override
    byte[] encodeDecreasing() {
      OrderedCode orderedCode = new OrderedCode();
      orderedCode.writeNumDecreasing(value());
      return orderedCode.getEncodedBytes();
    }

    @Override
    Long decodeIncreasing(OrderedCode orderedCode) {
      return orderedCode.readNumIncreasing();
    }

    @Override
    Long decodeDecreasing(OrderedCode orderedCode) {
      return orderedCode.readNumDecreasing();
    }

    private static UnsignedNumber testCase(
        long value, String increasingBytes, String decreasingBytes) {
      return new AutoValue_OrderedCodeTest_UnsignedNumber(value, increasingBytes, decreasingBytes);
    }

    /** Test cases for unsigned numbers, in increasing (unsigned) order by value. */
    private static final ImmutableList<UnsignedNumber> TEST_CASES =
        ImmutableList.of(
            testCase(0, "00", "ff"),
            testCase(1, "0101", "fefe"),
            testCase(33, "0121", "fede"),
            testCase(55000, "02d6d8", "fd2927"),
            testCase(Integer.MAX_VALUE, "047fffffff", "fb80000000"),
            testCase(Long.MAX_VALUE, "087fffffffffffffff", "f78000000000000000"),
            testCase(Long.MIN_VALUE, "088000000000000000", "f77fffffffffffffff"),
            testCase(-100, "08ffffffffffffff9c", "f70000000000000063"),
            testCase(-1, "08ffffffffffffffff", "f70000000000000000"));
  }

  @AutoValue
  abstract static class BytesTest extends CodingTestCase<String> {
    @Override
    byte[] encodeIncreasing() {
      OrderedCode orderedCode = new OrderedCode();
      orderedCode.writeBytes(bytesFromHexString(value()));
      return orderedCode.getEncodedBytes();
    }

    @Override
    byte[] encodeDecreasing() {
      OrderedCode orderedCode = new OrderedCode();
      orderedCode.writeBytesDecreasing(bytesFromHexString(value()));
      return orderedCode.getEncodedBytes();
    }

    @Override
    String decodeIncreasing(OrderedCode orderedCode) {
      return bytesToHexString(orderedCode.readBytes());
    }

    @Override
    String decodeDecreasing(OrderedCode orderedCode) {
      return bytesToHexString(orderedCode.readBytesDecreasing());
    }

    private static BytesTest testCase(
        String value, String increasingBytes, String decreasingBytes) {
      return new AutoValue_OrderedCodeTest_BytesTest(value, increasingBytes, decreasingBytes);
    }

    /** Test cases for byte arrays, in increasing order by value. */
    private static final ImmutableList<BytesTest> TEST_CASES =
        ImmutableList.of(
            testCase("", "0001", "fffe"),
            testCase("00", "00ff0001", "ff00fffe"),
            testCase("0000", "00ff00ff0001", "ff00ff00fffe"),
            testCase("0001", "00ff010001", "ff00fefffe"),
            testCase("0041", "00ff410001", "ff00befffe"),
            testCase("00ff", "00ffff000001", "ff0000fffffe"),
            testCase("01", "010001", "fefffe"),
            testCase("0100", "0100ff0001", "feff00fffe"),
            testCase("6f776c", "6f776c0001", "908893fffe"),
            testCase("ff", "ff000001", "00fffffe"),
            testCase("ff00", "ff0000ff0001", "00ffff00fffe"),
            testCase("ff01", "ff00010001", "00fffefffe"),
            testCase("ffff", "ff00ff000001", "00ff00fffffe"),
            testCase("ffffff", "ff00ff00ff000001", "00ff00ff00fffffe"));
  }

  @Test
  public void testUnsignedEncoding() {
    testEncoding(UnsignedNumber.TEST_CASES);
  }

  @Test
  public void testUnsignedDecoding() {
    testDecoding(UnsignedNumber.TEST_CASES);
  }

  @Test
  public void testUnsignedOrdering() {
    testOrdering(UnsignedNumber.TEST_CASES);
  }

  @Test
  public void testBytesEncoding() {
    testEncoding(BytesTest.TEST_CASES);
  }

  @Test
  public void testBytesDecoding() {
    testDecoding(BytesTest.TEST_CASES);
  }

  @Test
  public void testBytesOrdering() {
    testOrdering(BytesTest.TEST_CASES);
  }

  private void testEncoding(List<? extends CodingTestCase<?>> testCases) {
    for (CodingTestCase<?> testCase : testCases) {
      byte[] actualIncreasing = testCase.encodeIncreasing();
      byte[] expectedIncreasing = bytesFromHexString(testCase.increasingBytes());
      assertEquals(0, compare(actualIncreasing, expectedIncreasing));

      byte[] actualDecreasing = testCase.encodeDecreasing();
      byte[] expectedDecreasing = bytesFromHexString(testCase.decreasingBytes());
      assertEquals(0, compare(actualDecreasing, expectedDecreasing));
    }
  }

  private void testDecoding(List<? extends CodingTestCase<?>> testCases) {
    for (CodingTestCase<?> testCase : testCases) {
      assertEquals(testCase.value(), testCase.decodeIncreasing());
      assertEquals(testCase.value(), testCase.decodeDecreasing());
    }
  }

  private void testOrdering(List<? extends CodingTestCase<?>> testCases) {
    // This is verifiable by inspection of the C++ encodings, but it seems
    // worth checking explicitly
    for (int caseIndex = 0; caseIndex < testCases.size() - 1; caseIndex++) {
      byte[] encodedValue = testCases.get(caseIndex).encodeIncreasing();
      byte[] nextEncodedValue = testCases.get(caseIndex + 1).encodeIncreasing();
      assertTrue(compare(encodedValue, nextEncodedValue) < 0);

      encodedValue = testCases.get(caseIndex).encodeDecreasing();
      nextEncodedValue = testCases.get(caseIndex + 1).encodeDecreasing();
      assertTrue(compare(encodedValue, nextEncodedValue) > 0);
    }
  }

  @Test
  public void testWriteInfinity() {
    OrderedCode orderedCode = new OrderedCode();
    try {
      orderedCode.readInfinity();
      fail("Expected IllegalArgumentException.");
    } catch (IllegalArgumentException e) {
      // expected
    }
    orderedCode.writeInfinity();
    assertTrue(orderedCode.readInfinity());
    try {
      orderedCode.readInfinity();
      fail("Expected IllegalArgumentException.");
    } catch (IllegalArgumentException e) {
      // expected
    }
  }

  @Test
  public void testWriteInfinityDecreasing() {
    OrderedCode orderedCode = new OrderedCode();
    try {
      orderedCode.readInfinityDecreasing();
      fail("Expected IllegalArgumentException.");
    } catch (IllegalArgumentException e) {
      // expected
    }
    orderedCode.writeInfinityDecreasing();
    assertTrue(orderedCode.readInfinityDecreasing());
    try {
      orderedCode.readInfinityDecreasing();
      fail("Expected IllegalArgumentException.");
    } catch (IllegalArgumentException e) {
      // expected
    }
  }

  @Test
  public void testWriteBytes() {
    byte[] first = {'a', 'b', 'c'};
    byte[] second = {'d', 'e', 'f'};
    byte[] last = {'x', 'y', 'z'};
    OrderedCode orderedCode = new OrderedCode();
    orderedCode.writeBytes(first);
    byte[] firstEncoded = orderedCode.getEncodedBytes();
    assertTrue(Arrays.equals(orderedCode.readBytes(), first));

    orderedCode.writeBytes(first);
    orderedCode.writeBytes(second);
    orderedCode.writeBytes(last);
    byte[] allEncoded = orderedCode.getEncodedBytes();
    assertTrue(Arrays.equals(orderedCode.readBytes(), first));
    assertTrue(Arrays.equals(orderedCode.readBytes(), second));
    assertTrue(Arrays.equals(orderedCode.readBytes(), last));

    orderedCode = new OrderedCode(firstEncoded);
    orderedCode.writeBytes(second);
    orderedCode.writeBytes(last);
    assertTrue(Arrays.equals(orderedCode.getEncodedBytes(), allEncoded));
    assertTrue(Arrays.equals(orderedCode.readBytes(), first));
    assertTrue(Arrays.equals(orderedCode.readBytes(), second));
    assertTrue(Arrays.equals(orderedCode.readBytes(), last));

    orderedCode = new OrderedCode(allEncoded);
    assertTrue(Arrays.equals(orderedCode.readBytes(), first));
    assertTrue(Arrays.equals(orderedCode.readBytes(), second));
    assertTrue(Arrays.equals(orderedCode.readBytes(), last));
  }

  @Test
  public void testWriteBytesDecreasing() {
    byte[] first = {'a', 'b', 'c'};
    byte[] second = {'d', 'e', 'f'};
    byte[] last = {'x', 'y', 'z'};
    OrderedCode orderedCode = new OrderedCode();
    orderedCode.writeBytesDecreasing(first);
    byte[] firstEncoded = orderedCode.getEncodedBytes();
    assertTrue(Arrays.equals(orderedCode.readBytesDecreasing(), first));

    orderedCode.writeBytesDecreasing(first);
    orderedCode.writeBytesDecreasing(second);
    orderedCode.writeBytesDecreasing(last);
    byte[] allEncoded = orderedCode.getEncodedBytes();
    assertTrue(Arrays.equals(orderedCode.readBytesDecreasing(), first));
    assertTrue(Arrays.equals(orderedCode.readBytesDecreasing(), second));
    assertTrue(Arrays.equals(orderedCode.readBytesDecreasing(), last));

    orderedCode = new OrderedCode(firstEncoded);
    orderedCode.writeBytesDecreasing(second);
    orderedCode.writeBytesDecreasing(last);
    assertTrue(Arrays.equals(orderedCode.getEncodedBytes(), allEncoded));
    assertTrue(Arrays.equals(orderedCode.readBytesDecreasing(), first));
    assertTrue(Arrays.equals(orderedCode.readBytesDecreasing(), second));
    assertTrue(Arrays.equals(orderedCode.readBytesDecreasing(), last));

    orderedCode = new OrderedCode(allEncoded);
    assertTrue(Arrays.equals(orderedCode.readBytesDecreasing(), first));
    assertTrue(Arrays.equals(orderedCode.readBytesDecreasing(), second));
    assertTrue(Arrays.equals(orderedCode.readBytesDecreasing(), last));
  }

  @Test
  public void testWriteNumIncreasing() {
    OrderedCode orderedCode = new OrderedCode();
    orderedCode.writeNumIncreasing(0);
    orderedCode.writeNumIncreasing(1);
    orderedCode.writeNumIncreasing(Long.MIN_VALUE);
    orderedCode.writeNumIncreasing(Long.MAX_VALUE);
    assertEquals(0, orderedCode.readNumIncreasing());
    assertEquals(1, orderedCode.readNumIncreasing());
    assertEquals(Long.MIN_VALUE, orderedCode.readNumIncreasing());
    assertEquals(Long.MAX_VALUE, orderedCode.readNumIncreasing());
  }

  @Test
  public void testWriteNumIncreasing_unsignedInt() {
    OrderedCode orderedCode = new OrderedCode();
    orderedCode.writeNumIncreasing(UnsignedInteger.fromIntBits(0));
    orderedCode.writeNumIncreasing(UnsignedInteger.fromIntBits(1));
    orderedCode.writeNumIncreasing(UnsignedInteger.fromIntBits(Integer.MIN_VALUE));
    orderedCode.writeNumIncreasing(UnsignedInteger.fromIntBits(Integer.MAX_VALUE));
    assertEquals(0, orderedCode.readNumIncreasing());
    assertEquals(1, orderedCode.readNumIncreasing());
    assertEquals((long) Integer.MAX_VALUE + 1L, orderedCode.readNumIncreasing());
    assertEquals(Integer.MAX_VALUE, orderedCode.readNumIncreasing());
  }

  @Test
  public void testWriteNumDecreasing() {
    OrderedCode orderedCode = new OrderedCode();
    orderedCode.writeNumDecreasing(0);
    orderedCode.writeNumDecreasing(1);
    orderedCode.writeNumDecreasing(Long.MIN_VALUE);
    orderedCode.writeNumDecreasing(Long.MAX_VALUE);
    assertEquals(0, orderedCode.readNumDecreasing());
    assertEquals(1, orderedCode.readNumDecreasing());
    assertEquals(Long.MIN_VALUE, orderedCode.readNumDecreasing());
    assertEquals(Long.MAX_VALUE, orderedCode.readNumDecreasing());
  }

  @Test
  public void testWriteNumDecreasing_unsignedInt() {
    OrderedCode orderedCode = new OrderedCode();
    orderedCode.writeNumDecreasing(UnsignedInteger.fromIntBits(0));
    orderedCode.writeNumDecreasing(UnsignedInteger.fromIntBits(1));
    orderedCode.writeNumDecreasing(UnsignedInteger.fromIntBits(Integer.MIN_VALUE));
    orderedCode.writeNumDecreasing(UnsignedInteger.fromIntBits(Integer.MAX_VALUE));
    assertEquals(0, orderedCode.readNumDecreasing());
    assertEquals(1, orderedCode.readNumDecreasing());
    assertEquals((long) Integer.MAX_VALUE + 1L, orderedCode.readNumDecreasing());
    assertEquals(Integer.MAX_VALUE, orderedCode.readNumDecreasing());
  }

  /**
   * Assert that encoding the specified long via {@link OrderedCode#writeSignedNumIncreasing(long)}
   * results in the bytes represented by the specified string of hex digits. E.g.
   * assertSignedNumIncreasingEncodingEquals("3fbf", -65) asserts that -65 is encoded as { (byte)
   * 0x3f, (byte) 0xbf }.
   */
  private static void assertSignedNumIncreasingEncodingEquals(
      String expectedHexEncoding, long num) {
    OrderedCode orderedCode = new OrderedCode();
    orderedCode.writeSignedNumIncreasing(num);
    assertEquals(
        "Unexpected encoding for " + num,
        expectedHexEncoding,
        bytesToHexString(orderedCode.getEncodedBytes()));
  }

  /**
   * Assert that encoding various long values via {@link OrderedCode#writeSignedNumIncreasing(long)}
   * produces the expected bytes. Expected byte sequences were generated via the c++ (authoritative)
   * implementation of OrderedCode::WriteSignedNumIncreasing.
   */
  @Test
  public void testSignedNumIncreasing_write() {
    assertSignedNumIncreasingEncodingEquals("003f8000000000000000", Long.MIN_VALUE);
    assertSignedNumIncreasingEncodingEquals("003f8000000000000001", Long.MIN_VALUE + 1);
    assertSignedNumIncreasingEncodingEquals("077fffffff", Integer.MIN_VALUE - 1L);
    assertSignedNumIncreasingEncodingEquals("0780000000", Integer.MIN_VALUE);
    assertSignedNumIncreasingEncodingEquals("0780000001", Integer.MIN_VALUE + 1);
    assertSignedNumIncreasingEncodingEquals("3fbf", -65);
    assertSignedNumIncreasingEncodingEquals("40", -64);
    assertSignedNumIncreasingEncodingEquals("41", -63);
    assertSignedNumIncreasingEncodingEquals("7d", -3);
    assertSignedNumIncreasingEncodingEquals("7e", -2);
    assertSignedNumIncreasingEncodingEquals("7f", -1);
    assertSignedNumIncreasingEncodingEquals("80", 0);
    assertSignedNumIncreasingEncodingEquals("81", 1);
    assertSignedNumIncreasingEncodingEquals("82", 2);
    assertSignedNumIncreasingEncodingEquals("83", 3);
    assertSignedNumIncreasingEncodingEquals("bf", 63);
    assertSignedNumIncreasingEncodingEquals("c040", 64);
    assertSignedNumIncreasingEncodingEquals("c041", 65);
    assertSignedNumIncreasingEncodingEquals("f87ffffffe", Integer.MAX_VALUE - 1);
    assertSignedNumIncreasingEncodingEquals("f87fffffff", Integer.MAX_VALUE);
    assertSignedNumIncreasingEncodingEquals("f880000000", Integer.MAX_VALUE + 1L);
    assertSignedNumIncreasingEncodingEquals("ffc07ffffffffffffffe", Long.MAX_VALUE - 1);
    assertSignedNumIncreasingEncodingEquals("ffc07fffffffffffffff", Long.MAX_VALUE);
  }

  /**
   * Convert a string of hex digits (e.g. "3fbf") to a byte[] (e.g. { (byte) 0x3f, (byte) 0xbf }).
   */
  private static byte[] bytesFromHexString(String hexDigits) {
    return BaseEncoding.base16().lowerCase().decode(hexDigits);
  }

  /**
   * Convert a byte[] (e.g. { (byte) 0x3f, (byte) 0xbf }) to a string of hex digits (e.g. "3fbf").
   */
  private static String bytesToHexString(byte[] bytes) {
    return BaseEncoding.base16().lowerCase().encode(bytes);
  }

  /**
   * Assert that decoding (via {@link OrderedCode#readSignedNumIncreasing()}) the bytes represented
   * by the specified string of hex digits results in the expected long value. E.g.
   * assertDecodedSignedNumIncreasingEquals(-65, "3fbf") asserts that the byte array { (byte) 0x3f,
   * (byte) 0xbf } is decoded as -65.
   */
  private static void assertDecodedSignedNumIncreasingEquals(
      long expectedNum, String encodedHexString) {
    OrderedCode orderedCode = new OrderedCode(bytesFromHexString(encodedHexString));
    assertEquals(
        "Unexpected value when decoding 0x" + encodedHexString,
        expectedNum,
        orderedCode.readSignedNumIncreasing());
    assertFalse(
        "Unexpected encoded bytes remain after decoding 0x" + encodedHexString,
        orderedCode.hasRemainingEncodedBytes());
  }

  /**
   * Assert that decoding various sequences of bytes via {@link
   * OrderedCode#readSignedNumIncreasing()} produces the expected long value. Input byte sequences
   * were generated via the c++ (authoritative) implementation of
   * OrderedCode::WriteSignedNumIncreasing.
   */
  @Test
  public void testSignedNumIncreasing_read() {
    assertDecodedSignedNumIncreasingEquals(Long.MIN_VALUE, "003f8000000000000000");
    assertDecodedSignedNumIncreasingEquals(Long.MIN_VALUE + 1, "003f8000000000000001");
    assertDecodedSignedNumIncreasingEquals(Integer.MIN_VALUE - 1L, "077fffffff");
    assertDecodedSignedNumIncreasingEquals(Integer.MIN_VALUE, "0780000000");
    assertDecodedSignedNumIncreasingEquals(Integer.MIN_VALUE + 1, "0780000001");
    assertDecodedSignedNumIncreasingEquals(-65, "3fbf");
    assertDecodedSignedNumIncreasingEquals(-64, "40");
    assertDecodedSignedNumIncreasingEquals(-63, "41");
    assertDecodedSignedNumIncreasingEquals(-3, "7d");
    assertDecodedSignedNumIncreasingEquals(-2, "7e");
    assertDecodedSignedNumIncreasingEquals(-1, "7f");
    assertDecodedSignedNumIncreasingEquals(0, "80");
    assertDecodedSignedNumIncreasingEquals(1, "81");
    assertDecodedSignedNumIncreasingEquals(2, "82");
    assertDecodedSignedNumIncreasingEquals(3, "83");
    assertDecodedSignedNumIncreasingEquals(63, "bf");
    assertDecodedSignedNumIncreasingEquals(64, "c040");
    assertDecodedSignedNumIncreasingEquals(65, "c041");
    assertDecodedSignedNumIncreasingEquals(Integer.MAX_VALUE - 1, "f87ffffffe");
    assertDecodedSignedNumIncreasingEquals(Integer.MAX_VALUE, "f87fffffff");
    assertDecodedSignedNumIncreasingEquals(Integer.MAX_VALUE + 1L, "f880000000");
    assertDecodedSignedNumIncreasingEquals(Long.MAX_VALUE - 1, "ffc07ffffffffffffffe");
    assertDecodedSignedNumIncreasingEquals(Long.MAX_VALUE, "ffc07fffffffffffffff");
  }

  /**
   * Assert that encoding (via {@link OrderedCode#writeSignedNumIncreasing(long)}) the specified
   * long value and then decoding (via {@link OrderedCode#readSignedNumIncreasing()}) results in the
   * original value.
   */
  private static void assertSignedNumIncreasingWriteAndReadIsLossless(long num) {
    OrderedCode orderedCode = new OrderedCode();
    orderedCode.writeSignedNumIncreasing(num);
    assertEquals(
        "Unexpected result when decoding writeSignedNumIncreasing(" + num + ")",
        num,
        orderedCode.readSignedNumIncreasing());
    assertFalse(
        "Unexpected remaining encoded bytes after decoding " + num,
        orderedCode.hasRemainingEncodedBytes());
  }

  /**
   * Assert that for various long values, encoding (via {@link
   * OrderedCode#writeSignedNumIncreasing(long)}) and then decoding (via {@link
   * OrderedCode#readSignedNumIncreasing()}) results in the original value.
   */
  @Test
  public void testSignedNumIncreasing_writeAndRead() {
    assertSignedNumIncreasingWriteAndReadIsLossless(Long.MIN_VALUE);
    assertSignedNumIncreasingWriteAndReadIsLossless(Long.MIN_VALUE + 1);
    assertSignedNumIncreasingWriteAndReadIsLossless(Integer.MIN_VALUE - 1L);
    assertSignedNumIncreasingWriteAndReadIsLossless(Integer.MIN_VALUE);
    assertSignedNumIncreasingWriteAndReadIsLossless(Integer.MIN_VALUE + 1);
    assertSignedNumIncreasingWriteAndReadIsLossless(-65);
    assertSignedNumIncreasingWriteAndReadIsLossless(-64);
    assertSignedNumIncreasingWriteAndReadIsLossless(-63);
    assertSignedNumIncreasingWriteAndReadIsLossless(-3);
    assertSignedNumIncreasingWriteAndReadIsLossless(-2);
    assertSignedNumIncreasingWriteAndReadIsLossless(-1);
    assertSignedNumIncreasingWriteAndReadIsLossless(0);
    assertSignedNumIncreasingWriteAndReadIsLossless(1);
    assertSignedNumIncreasingWriteAndReadIsLossless(2);
    assertSignedNumIncreasingWriteAndReadIsLossless(3);
    assertSignedNumIncreasingWriteAndReadIsLossless(63);
    assertSignedNumIncreasingWriteAndReadIsLossless(64);
    assertSignedNumIncreasingWriteAndReadIsLossless(65);
    assertSignedNumIncreasingWriteAndReadIsLossless(Integer.MAX_VALUE - 1);
    assertSignedNumIncreasingWriteAndReadIsLossless(Integer.MAX_VALUE);
    assertSignedNumIncreasingWriteAndReadIsLossless(Integer.MAX_VALUE + 1L);
    assertSignedNumIncreasingWriteAndReadIsLossless(Long.MAX_VALUE - 1);
    assertSignedNumIncreasingWriteAndReadIsLossless(Long.MAX_VALUE);
  }

  /**
   * Assert that encoding (via {@link OrderedCode#writeSignedNumDecreasing(long)}) the specified
   * long value and then decoding (via {@link OrderedCode#readSignedNumDecreasing()}) results in the
   * original value.
   */
  private static void assertSignedNumDecreasingWriteAndReadIsLossless(long num) {
    OrderedCode orderedCode = new OrderedCode();
    orderedCode.writeSignedNumDecreasing(num);
    assertEquals(
        "Unexpected result when decoding writeSignedNumDecreasing(" + num + ")",
        num,
        orderedCode.readSignedNumDecreasing());
    assertFalse(
        "Unexpected remaining encoded bytes after decoding " + num,
        orderedCode.hasRemainingEncodedBytes());
  }

  /**
   * Assert that for various long values, encoding (via {@link
   * OrderedCode#writeSignedNumDecreasing(long)}) and then decoding (via {@link
   * OrderedCode#readSignedNumDecreasing()}) results in the original value.
   */
  @Test
  public void testSignedNumDecreasing_writeAndRead() {
    assertSignedNumDecreasingWriteAndReadIsLossless(Long.MIN_VALUE);
    assertSignedNumDecreasingWriteAndReadIsLossless(Long.MIN_VALUE + 1);
    assertSignedNumDecreasingWriteAndReadIsLossless(Integer.MIN_VALUE - 1L);
    assertSignedNumDecreasingWriteAndReadIsLossless(Integer.MIN_VALUE);
    assertSignedNumDecreasingWriteAndReadIsLossless(Integer.MIN_VALUE + 1);
    assertSignedNumDecreasingWriteAndReadIsLossless(-65);
    assertSignedNumDecreasingWriteAndReadIsLossless(-64);
    assertSignedNumDecreasingWriteAndReadIsLossless(-63);
    assertSignedNumDecreasingWriteAndReadIsLossless(-3);
    assertSignedNumDecreasingWriteAndReadIsLossless(-2);
    assertSignedNumDecreasingWriteAndReadIsLossless(-1);
    assertSignedNumDecreasingWriteAndReadIsLossless(0);
    assertSignedNumDecreasingWriteAndReadIsLossless(1);
    assertSignedNumDecreasingWriteAndReadIsLossless(2);
    assertSignedNumDecreasingWriteAndReadIsLossless(3);
    assertSignedNumDecreasingWriteAndReadIsLossless(63);
    assertSignedNumDecreasingWriteAndReadIsLossless(64);
    assertSignedNumDecreasingWriteAndReadIsLossless(65);
    assertSignedNumDecreasingWriteAndReadIsLossless(Integer.MAX_VALUE - 1);
    assertSignedNumDecreasingWriteAndReadIsLossless(Integer.MAX_VALUE);
    assertSignedNumDecreasingWriteAndReadIsLossless(Integer.MAX_VALUE + 1L);
    assertSignedNumDecreasingWriteAndReadIsLossless(Long.MAX_VALUE - 1);
    assertSignedNumDecreasingWriteAndReadIsLossless(Long.MAX_VALUE);
  }

  /** Ensures that numbers encoded as "decreasing" do indeed sort in reverse order. */
  @Test
  public void testDecreasing() {
    OrderedCode orderedCode = new OrderedCode();
    orderedCode.writeSignedNumDecreasing(10L);
    byte[] ten = orderedCode.getEncodedBytes();
    orderedCode = new OrderedCode();
    orderedCode.writeSignedNumDecreasing(20L);
    byte[] twenty = orderedCode.getEncodedBytes();
    // In decreasing order, twenty preceeds ten.
    assertTrue(compare(twenty, ten) < 0);
  }

  @Test
  public void testLog2Floor_Positive() {
    OrderedCode orderedCode = new OrderedCode();
    assertEquals(0, orderedCode.log2Floor(1));
    assertEquals(1, orderedCode.log2Floor(2));
    assertEquals(1, orderedCode.log2Floor(3));
    assertEquals(2, orderedCode.log2Floor(4));
    assertEquals(5, orderedCode.log2Floor(63));
    assertEquals(6, orderedCode.log2Floor(64));
    assertEquals(62, orderedCode.log2Floor(Long.MAX_VALUE));
  }

  /**
   * OrderedCode.log2Floor(long) is defined to return -1 given an input of zero (because that's what
   * Bits::Log2Floor64(uint64) does).
   */
  @Test
  public void testLog2Floor_zero() {
    OrderedCode orderedCode = new OrderedCode();
    assertEquals(-1, orderedCode.log2Floor(0));
  }

  @Test
  public void testLog2Floor_negative() {
    OrderedCode orderedCode = new OrderedCode();
    try {
      orderedCode.log2Floor(-1);
      fail("Expected an IllegalArgumentException.");
    } catch (IllegalArgumentException expected) {
      // Expected!
    }
  }

  @Test
  public void testGetSignedEncodingLength() {
    OrderedCode orderedCode = new OrderedCode();
    assertEquals(10, orderedCode.getSignedEncodingLength(Long.MIN_VALUE));
    assertEquals(10, orderedCode.getSignedEncodingLength(~(1L << 62)));
    assertEquals(9, orderedCode.getSignedEncodingLength(~(1L << 62) + 1));
    assertEquals(3, orderedCode.getSignedEncodingLength(-8193));
    assertEquals(2, orderedCode.getSignedEncodingLength(-8192));
    assertEquals(2, orderedCode.getSignedEncodingLength(-65));
    assertEquals(1, orderedCode.getSignedEncodingLength(-64));
    assertEquals(1, orderedCode.getSignedEncodingLength(-2));
    assertEquals(1, orderedCode.getSignedEncodingLength(-1));
    assertEquals(1, orderedCode.getSignedEncodingLength(0));
    assertEquals(1, orderedCode.getSignedEncodingLength(1));
    assertEquals(1, orderedCode.getSignedEncodingLength(63));
    assertEquals(2, orderedCode.getSignedEncodingLength(64));
    assertEquals(2, orderedCode.getSignedEncodingLength(8191));
    assertEquals(3, orderedCode.getSignedEncodingLength(8192));
    assertEquals(9, orderedCode.getSignedEncodingLength((1L << 62)) - 1);
    assertEquals(10, orderedCode.getSignedEncodingLength(1L << 62));
    assertEquals(10, orderedCode.getSignedEncodingLength(Long.MAX_VALUE));
  }

  @Test
  public void testWriteTrailingBytes() {
    byte[] escapeChars =
        new byte[] {
          OrderedCode.ESCAPE1,
          OrderedCode.NULL_CHARACTER,
          OrderedCode.SEPARATOR,
          OrderedCode.ESCAPE2,
          OrderedCode.INFINITY,
          OrderedCode.FF_CHARACTER
        };
    byte[] anotherArray = new byte[] {'a', 'b', 'c', 'd', 'e'};

    OrderedCode orderedCode = new OrderedCode();
    orderedCode.writeTrailingBytes(escapeChars);
    assertTrue(Arrays.equals(orderedCode.getEncodedBytes(), escapeChars));
    assertTrue(Arrays.equals(orderedCode.readTrailingBytes(), escapeChars));
    try {
      orderedCode.readInfinity();
      fail("Expected IllegalArgumentException.");
    } catch (IllegalArgumentException e) {
      // expected
    }

    orderedCode = new OrderedCode();
    orderedCode.writeTrailingBytes(anotherArray);
    assertTrue(Arrays.equals(orderedCode.getEncodedBytes(), anotherArray));
    assertTrue(Arrays.equals(orderedCode.readTrailingBytes(), anotherArray));
  }

  @Test
  public void testMixedWrite() {
    byte[] first = {'a', 'b', 'c'};
    byte[] second = {'d', 'e', 'f'};
    byte[] last = {'x', 'y', 'z'};
    byte[] escapeChars =
        new byte[] {
          OrderedCode.ESCAPE1,
          OrderedCode.NULL_CHARACTER,
          OrderedCode.SEPARATOR,
          OrderedCode.ESCAPE2,
          OrderedCode.INFINITY,
          OrderedCode.FF_CHARACTER
        };

    OrderedCode orderedCode = new OrderedCode();
    orderedCode.writeBytes(first);
    orderedCode.writeBytes(second);
    orderedCode.writeBytes(last);
    orderedCode.writeInfinity();
    orderedCode.writeNumIncreasing(0);
    orderedCode.writeNumIncreasing(1);
    orderedCode.writeNumIncreasing(Long.MIN_VALUE);
    orderedCode.writeNumIncreasing(Long.MAX_VALUE);
    orderedCode.writeSignedNumIncreasing(0);
    orderedCode.writeSignedNumIncreasing(1);
    orderedCode.writeSignedNumIncreasing(Long.MIN_VALUE);
    orderedCode.writeSignedNumIncreasing(Long.MAX_VALUE);
    orderedCode.writeTrailingBytes(escapeChars);
    byte[] allEncoded = orderedCode.getEncodedBytes();
    assertTrue(Arrays.equals(orderedCode.readBytes(), first));
    assertTrue(Arrays.equals(orderedCode.readBytes(), second));
    assertFalse(orderedCode.readInfinity());
    assertTrue(Arrays.equals(orderedCode.readBytes(), last));
    assertTrue(orderedCode.readInfinity());
    assertEquals(0, orderedCode.readNumIncreasing());
    assertEquals(1, orderedCode.readNumIncreasing());
    assertFalse(orderedCode.readInfinity());
    assertEquals(Long.MIN_VALUE, orderedCode.readNumIncreasing());
    assertEquals(Long.MAX_VALUE, orderedCode.readNumIncreasing());
    assertEquals(0, orderedCode.readSignedNumIncreasing());
    assertEquals(1, orderedCode.readSignedNumIncreasing());
    assertFalse(orderedCode.readInfinity());
    assertEquals(Long.MIN_VALUE, orderedCode.readSignedNumIncreasing());
    assertEquals(Long.MAX_VALUE, orderedCode.readSignedNumIncreasing());
    assertTrue(Arrays.equals(orderedCode.getEncodedBytes(), escapeChars));
    assertTrue(Arrays.equals(orderedCode.readTrailingBytes(), escapeChars));

    orderedCode = new OrderedCode(allEncoded);
    assertTrue(Arrays.equals(orderedCode.readBytes(), first));
    assertTrue(Arrays.equals(orderedCode.readBytes(), second));
    assertFalse(orderedCode.readInfinity());
    assertTrue(Arrays.equals(orderedCode.readBytes(), last));
    assertTrue(orderedCode.readInfinity());
    assertEquals(0, orderedCode.readNumIncreasing());
    assertEquals(1, orderedCode.readNumIncreasing());
    assertFalse(orderedCode.readInfinity());
    assertEquals(Long.MIN_VALUE, orderedCode.readNumIncreasing());
    assertEquals(Long.MAX_VALUE, orderedCode.readNumIncreasing());
    assertEquals(0, orderedCode.readSignedNumIncreasing());
    assertEquals(1, orderedCode.readSignedNumIncreasing());
    assertFalse(orderedCode.readInfinity());
    assertEquals(Long.MIN_VALUE, orderedCode.readSignedNumIncreasing());
    assertEquals(Long.MAX_VALUE, orderedCode.readSignedNumIncreasing());
    assertTrue(Arrays.equals(orderedCode.getEncodedBytes(), escapeChars));
    assertTrue(Arrays.equals(orderedCode.readTrailingBytes(), escapeChars));
  }

  @Test
  public void testEdgeCases() {
    byte[] ffChar = {OrderedCode.FF_CHARACTER};
    byte[] nullChar = {OrderedCode.NULL_CHARACTER};

    byte[] separatorEncoded = {OrderedCode.ESCAPE1, OrderedCode.SEPARATOR};
    byte[] ffCharEncoded = {OrderedCode.ESCAPE1, OrderedCode.NULL_CHARACTER};
    byte[] nullCharEncoded = {OrderedCode.ESCAPE2, OrderedCode.FF_CHARACTER};
    byte[] infinityEncoded = {OrderedCode.ESCAPE2, OrderedCode.INFINITY};

    OrderedCode orderedCode = new OrderedCode();
    orderedCode.writeBytes(ffChar);
    orderedCode.writeBytes(nullChar);
    orderedCode.writeInfinity();
    assertTrue(
        Arrays.equals(
            orderedCode.getEncodedBytes(),
            Bytes.concat(
                ffCharEncoded,
                separatorEncoded,
                nullCharEncoded,
                separatorEncoded,
                infinityEncoded)));
    assertTrue(Arrays.equals(orderedCode.readBytes(), ffChar));
    assertTrue(Arrays.equals(orderedCode.readBytes(), nullChar));
    assertTrue(orderedCode.readInfinity());

    orderedCode = new OrderedCode(Bytes.concat(ffCharEncoded, separatorEncoded));
    assertTrue(Arrays.equals(orderedCode.readBytes(), ffChar));

    orderedCode = new OrderedCode(Bytes.concat(nullCharEncoded, separatorEncoded));
    assertTrue(Arrays.equals(orderedCode.readBytes(), nullChar));

    byte[] invalidEncodingForRead = {
      OrderedCode.ESCAPE2, OrderedCode.ESCAPE2, OrderedCode.ESCAPE1, OrderedCode.SEPARATOR
    };
    orderedCode = new OrderedCode(invalidEncodingForRead);
    try {
      orderedCode.readBytes();
      fail("Should have failed.");
    } catch (Exception e) {
      // Expected
    }
    assertTrue(orderedCode.hasRemainingEncodedBytes());
  }

  @Test
  public void testHasRemainingEncodedBytes() {
    byte[] bytes = {'a', 'b', 'c'};
    long number = 12345;

    // Empty
    OrderedCode orderedCode = new OrderedCode();
    assertFalse(orderedCode.hasRemainingEncodedBytes());

    // First and only field of each type.
    orderedCode.writeBytes(bytes);
    assertTrue(orderedCode.hasRemainingEncodedBytes());
    assertTrue(Arrays.equals(orderedCode.readBytes(), bytes));
    assertFalse(orderedCode.hasRemainingEncodedBytes());

    orderedCode.writeNumIncreasing(number);
    assertTrue(orderedCode.hasRemainingEncodedBytes());
    assertEquals(orderedCode.readNumIncreasing(), number);
    assertFalse(orderedCode.hasRemainingEncodedBytes());

    orderedCode.writeSignedNumIncreasing(number);
    assertTrue(orderedCode.hasRemainingEncodedBytes());
    assertEquals(orderedCode.readSignedNumIncreasing(), number);
    assertFalse(orderedCode.hasRemainingEncodedBytes());

    orderedCode.writeInfinity();
    assertTrue(orderedCode.hasRemainingEncodedBytes());
    assertTrue(orderedCode.readInfinity());
    assertFalse(orderedCode.hasRemainingEncodedBytes());

    orderedCode.writeTrailingBytes(bytes);
    assertTrue(orderedCode.hasRemainingEncodedBytes());
    assertTrue(Arrays.equals(orderedCode.readTrailingBytes(), bytes));
    assertFalse(orderedCode.hasRemainingEncodedBytes());

    // Two fields of same type.
    orderedCode.writeBytes(bytes);
    orderedCode.writeBytes(bytes);
    assertTrue(orderedCode.hasRemainingEncodedBytes());
    assertTrue(Arrays.equals(orderedCode.readBytes(), bytes));
    assertTrue(Arrays.equals(orderedCode.readBytes(), bytes));
    assertFalse(orderedCode.hasRemainingEncodedBytes());
  }

  @Test
  public void testOrderingInfinity() {
    OrderedCode inf = new OrderedCode();
    inf.writeInfinity();

    OrderedCode negInf = new OrderedCode();
    negInf.writeInfinityDecreasing();

    OrderedCode longValue = new OrderedCode();
    longValue.writeSignedNumIncreasing(1);

    assertTrue(compare(inf.getEncodedBytes(), negInf.getEncodedBytes()) > 0);
    assertTrue(compare(longValue.getEncodedBytes(), negInf.getEncodedBytes()) > 0);
    assertTrue(compare(inf.getEncodedBytes(), longValue.getEncodedBytes()) > 0);
  }

  private int compare(byte[] bytes1, byte[] bytes2) {
    return UnsignedBytes.lexicographicalComparator().compare(bytes1, bytes2);
  }
}


text:
package edu.upenn.cis.ppod.dto;

import static com.google.common.base.Preconditions.checkNotNull;

import java.util.Set;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;

import com.google.common.collect.ImmutableSet;

import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.Nullable;

@XmlAccessorType(XmlAccessType.FIELD)
final public class PPodDnaSequence {

	private String sequence;

	@XmlAttribute
	@CheckForNull
	private String name;

	@XmlAttribute
	@CheckForNull
	private String description;

	@XmlAttribute
	@CheckForNull
	private String accession;

	public final static Set<java.lang.Character> LEGAL_CHARS =
			ImmutableSet.of(
					'A', 'a',
					'C', 'c',
					'G', 'g',
					'T', 't',
					'R',
					'Y',
					'K',
					'M',
					'S',
					'W',
					'B',
					'D',
					'H',
					'V',
					'N',
					'-');

	/** For JAXB. */
	PPodDnaSequence() {}

	public PPodDnaSequence(
			final String sequence,
			@CheckForNull final String name,
			@CheckForNull final String description,
			@CheckForNull final String accession) {
		this.sequence = sequence;
		this.name = name;
		this.description = description;
		this.accession = accession;
	}

	@Nullable
	public String getAccession() {
		return accession;
	}

	@Nullable
	public String getDescription() {
		return description;
	}

	@Nullable
	public String getName() {
		return name;
	}

	public String getSequence() {
		return sequence;
	}

	public void setSequence(final String sequence) {
		checkNotNull(sequence);
		this.sequence = sequence;
	}
}


text:
using kmlbase::Attributes;
using kmldom::DocumentPtr;
using kmldom::GxTourPtr;
using kmldom::KmlFactory;

namespace kmlengine {

// If either or both args to FindXmlNamespaces() is NULL nothing happens and
// there is no crash.
TEST(FindXmlNamepacesTest, TestNull) {
  FindXmlNamespaces(NULL, NULL);
  Attributes xmlns_attributes;
  FindXmlNamespaces(NULL, &xmlns_attributes);
  FindXmlNamespaces(KmlFactory::GetFactory()->CreateDocument(), NULL);
}

TEST(FindXmlNamepacesTest, TestNoNamespaces) {
  kmldom::DocumentPtr document = KmlFactory::GetFactory()->CreateDocument();
  Attributes xmlns_attributes;
  FindXmlNamespaces(document, &xmlns_attributes);
  ASSERT_EQ(static_cast<size_t>(1), xmlns_attributes.GetSize());
}

TEST(FindXmlNamepacesTest, TestOneGx) {
  KmlFactory* factory = KmlFactory::GetFactory();
  kmldom::DocumentPtr document = factory->CreateDocument();
  document->add_feature(factory->CreateGxTour());
  Attributes xmlns_attributes;
  FindXmlNamespaces(document, &xmlns_attributes);
  ASSERT_EQ(static_cast<size_t>(2), xmlns_attributes.GetSize());
  string xml_namespace;
  ASSERT_TRUE(xmlns_attributes.GetValue("gx", &xml_namespace));
}

TEST(FindXmlNamepacesTest, TestOneGxAndOneAtom) {
  KmlFactory* factory = KmlFactory::GetFactory();
  kmldom::DocumentPtr document = factory->CreateDocument();
  document->add_feature(factory->CreateGxTour());
  document->set_atomauthor(factory->CreateAtomAuthor());
  Attributes xmlns_attributes;
  FindXmlNamespaces(document, &xmlns_attributes);
  ASSERT_EQ(static_cast<size_t>(3), xmlns_attributes.GetSize());
  string xml_namespace;
  ASSERT_TRUE(xmlns_attributes.GetValue("gx", &xml_namespace));
  ASSERT_TRUE(xmlns_attributes.GetValue("atom", &xml_namespace));
}

TEST(FindXmlNamepacesTest, TestOneGxAndOneAtomAndOneXal) {
  KmlFactory* factory = KmlFactory::GetFactory();
  kmldom::DocumentPtr document = factory->CreateDocument();
  document->add_feature(factory->CreateGxTour());
  document->set_atomauthor(factory->CreateAtomAuthor());
  document->set_xaladdressdetails(factory->CreateXalAddressDetails());
  Attributes xmlns_attributes;
  FindXmlNamespaces(document, &xmlns_attributes);
  ASSERT_EQ(static_cast<size_t>(4), xmlns_attributes.GetSize());
  string xml_namespace;
  ASSERT_TRUE(xmlns_attributes.GetValue("gx", &xml_namespace));
  ASSERT_TRUE(xmlns_attributes.GetValue("atom", &xml_namespace));
  ASSERT_TRUE(xmlns_attributes.GetValue("xal", &xml_namespace));
}

TEST(FindXmlNamepacesTest, TestRootGx) {
  KmlFactory* factory = KmlFactory::GetFactory();
  GxTourPtr tour = factory->CreateGxTour();
  Attributes xmlns_attributes;
  FindXmlNamespaces(tour, &xmlns_attributes);
  ASSERT_EQ(static_cast<size_t>(1), xmlns_attributes.GetSize());
  string xml_namespace;
  ASSERT_TRUE(xmlns_attributes.GetValue("gx", &xml_namespace));
}

TEST(FindXmlNamepacesTest, TestBasicFindAndInsertXmlNamespaces) {
  KmlFactory* factory = KmlFactory::GetFactory();
  GxTourPtr tour = factory->CreateGxTour();
  FindAndInsertXmlNamespaces(tour);
  Attributes xmlns_attributes;
  AsElement(tour)->SerializeAttributes(&xmlns_attributes);
  ASSERT_EQ(static_cast<size_t>(1), xmlns_attributes.GetSize());
}

// TODO: every KML 2.2 element should do set_xmlns(XMLNS_KML22) which should
// really be an arg to the Element ctor...
#if 0
TEST(FindXmlNamepacesTest, TestBasicFindAndInsertXmlNamespaces) {
  KmlFactory* factory = KmlFactory::GetFactory();
  DocumentPtr document = factory->CreateDocument();
  FindAndInsertXmlNamespaces(docment);
  Attributes xmlns_attributes;
  AsElement(document)->SerializeAttributes(&xmlns_attributes);
  // TODO: this fails at present due to Document not setting its namespace.
  // We could consider XMLNS_NONE == XMLNS_KML22, but that's hacky...
  ASSERT_EQ(static_cast<size_t>(1), xmlns_attributes.GetSize());
}
#endif

}  // end namespace kmlengine


text:
package org.apache.struts2.views.jsp.iterator;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.components.Component;
import org.apache.struts2.components.MergeIterator;
import org.apache.struts2.views.jsp.ContextBeanTag;

import com.opensymphony.xwork2.util.ValueStack;

/**
 * Append a list of iterators. The values of the iterators will be merged
 * into one iterator.
 *
 * @see MergeIterator
 * @see org.apache.struts2.util.MergeIteratorFilter
 */
public class MergeIteratorTag extends ContextBeanTag {

    private static final long serialVersionUID = 4999729472466011218L;

    public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
        return new MergeIterator(stack);
    }

}


text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.Text.RegularExpressions;
using System.IO;

using Mono.Cecil;
using Mono.Security.Cryptography;
using System.Security.Cryptography;

namespace Obfuscar
{
	class Project : IEnumerable<AssemblyInfo>
	{
		private const string SPECIALVAR_PROJECTFILEDIRECTORY = "ProjectFileDirectory";
		private readonly List<AssemblyInfo> assemblyList = new List<AssemblyInfo> ();

		public List<AssemblyInfo> CopyAssemblyList {
			get {
				return copyAssemblyList;
			}
		}

		private readonly List<AssemblyInfo> copyAssemblyList = new List<AssemblyInfo> ();
		private readonly Dictionary<string, AssemblyInfo> assemblyMap = new Dictionary<string, AssemblyInfo> ();
		private readonly Variables vars = new Variables ();
		InheritMap inheritMap;
		Settings settings;
		// FIXME: Figure out why this exists if it is never used.
		private RSA keyvalue;

		// don't create.  call FromXml.
		private Project ()
		{
		}

		public string [] ExtraPaths {
			get {
				return vars.GetValue ("ExtraFrameworkFolders", "").Split (new char [] { Path.PathSeparator }, StringSplitOptions.RemoveEmptyEntries);
			}
		}

		public string KeyContainerName = null;

		public RSA KeyValue {
			get {
				if (keyvalue != null)
					return keyvalue;

				var lKeyFileName = vars.GetValue ("KeyFile", null);
				var lKeyContainerName = vars.GetValue ("KeyContainer", null);

				if (lKeyFileName == null && lKeyContainerName == null)
					return null;
				if (lKeyFileName != null && lKeyContainerName != null)
					throw new Exception ("'Key file' and 'Key container' properties cann't be setted together.");

				if (vars.GetValue ("KeyContainer", null) != null) {
					KeyContainerName = vars.GetValue ("KeyContainer", null);
					return RSA.Create ();
					//if (Type.GetType("System.MonoType") != null)
					//    throw new Exception("Key containers are not supported for Mono.");

					//try
					//{
					//    CspParameters cp = new CspParameters();
					//    cp.KeyContainerName = vars.GetValue("KeyContainer", null);
					//    cp.Flags = CspProviderFlags.UseMachineKeyStore | CspProviderFlags.UseExistingKey;
					//    cp.KeyNumber = 1;

					//    RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(cp);
					//    keyvalue = CryptoConvert.FromCapiKeyBlob(rsa.ExportCspBlob(false));
					//}
					//catch (Exception CryptEx)
					////catch (System.Security.Cryptography.CryptographicException CryptEx)
					//{
					//    try
					//    {
					//        CspParameters cp = new CspParameters();
					//        cp.KeyContainerName = vars.GetValue("KeyContainer", null);
					//        cp.Flags = CspProviderFlags.UseExistingKey;
					//        cp.KeyNumber = 1;

					//        RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(cp);
					//        keyvalue = CryptoConvert.FromCapiKeyBlob(rsa.ExportCspBlob(false));
					//    }
					//    catch
					//    {
					//        throw new ApplicationException(String.Format("Failure loading key from container - \"{0}\"", vars.GetValue("KeyContainer", null)), CryptEx);
					//    }
					//}
				} else {
					try {
						keyvalue = CryptoConvert.FromCapiKeyBlob (File.ReadAllBytes (vars.GetValue ("KeyFile", null)));
					} catch (Exception ex) {
						throw new ApplicationException (String.Format ("Failure loading key file \"{0}\"", vars.GetValue ("KeyFile", null)), ex);
					}
				}
				return keyvalue;
			}
		}

        AssemblyCache m_cache;

        internal AssemblyCache Cache
        {
            get
            {
                if (m_cache == null)
                {
                    m_cache = new AssemblyCache(this);
                }

                return m_cache;
            }
        }

		public static Project FromXml (XmlReader reader, string projectFileDirectory)
		{
			Project project = new Project ();

			project.vars.Add (SPECIALVAR_PROJECTFILEDIRECTORY, string.IsNullOrEmpty (projectFileDirectory) ? "." : projectFileDirectory);

			while (reader.Read()) {
				if (reader.NodeType == XmlNodeType.Element) {
					switch (reader.Name) {
					case "Var":
						{
							string name = Helper.GetAttribute (reader, "name");
							if (name.Length > 0) {
								string value = Helper.GetAttribute (reader, "value");
								if (value.Length > 0)
									project.vars.Add (name, value);
								else
									project.vars.Remove (name);
							}
							break;
						}
					case "Module":
						AssemblyInfo info = AssemblyInfo.FromXml (project, reader, project.vars);
						if (info.Exclude) {
							project.copyAssemblyList.Add (info);
							break;
						}
						Console.WriteLine ("Processing assembly: " + info.Definition.Name.FullName);
						project.assemblyList.Add (info);
						project.assemblyMap [info.Name] = info;
						break;
					}
				}
			}

			return project;
		}

		/// <summary>
		/// Looks through the settings, trys to make sure everything looks ok.
		/// </summary>
		public void CheckSettings ()
		{
			if (!Directory.Exists (Settings.InPath))
				throw new ApplicationException ("Path specified by InPath variable must exist:" + Settings.InPath);

			if (!Directory.Exists (Settings.OutPath)) {
				try {
					Directory.CreateDirectory (Settings.OutPath);
				} catch (IOException e) {
					throw new ApplicationException ("Could not create path specified by OutPath:  " + Settings.OutPath, e);
				}
			}
		}

		internal InheritMap InheritMap {
			get { return inheritMap; }
		}

		internal Settings Settings {
			get {
				if (settings == null)
					settings = new Settings (vars);

				return settings;
			}
		}

		public void LoadAssemblies ()
		{
			// build reference tree
			foreach (AssemblyInfo info in assemblyList) {
				// add self reference...makes things easier later, when
				// we need to go through the member references
				info.ReferencedBy.Add (info);

				// try to get each assembly referenced by this one.  if it's in
				// the map (and therefore in the project), set up the mappings
				foreach (AssemblyNameReference nameRef in info.Definition.MainModule.AssemblyReferences) {
					AssemblyInfo reference;
					if (assemblyMap.TryGetValue (nameRef.Name, out reference)) {
						info.References.Add (reference);
						reference.ReferencedBy.Add (info);
					}
				}
			}

			// make each assembly's list of member refs
			foreach (AssemblyInfo info in assemblyList) {
				info.Init ();
			}

			// build inheritance map
			inheritMap = new InheritMap (this);
		}

		/// <summary>
		/// Returns whether the project contains a given type.
		/// </summary>
		public bool Contains (TypeReference type)
		{
			string name = Helper.GetScopeName (type);

			return assemblyMap.ContainsKey (name);
		}

		/// <summary>
		/// Returns whether the project contains a given type.
		/// </summary>
		internal bool Contains (TypeKey type)
		{
			return assemblyMap.ContainsKey (type.Scope);
		}

		public TypeDefinition GetTypeDefinition (TypeReference type)
		{
			if (type == null)
				return null;

			TypeDefinition typeDef = type as TypeDefinition;
			if (typeDef == null) {
				string name = Helper.GetScopeName (type);

				AssemblyInfo info;
				if (assemblyMap.TryGetValue (name, out info)) {
					string fullName = type.Namespace + "." + type.Name;
					typeDef = info.Definition.MainModule.GetType (fullName);
				}
			}

			return typeDef;
		}

		IEnumerator IEnumerable.GetEnumerator ()
		{
			return assemblyList.GetEnumerator ();
		}

		public IEnumerator<AssemblyInfo> GetEnumerator ()
		{
			return assemblyList.GetEnumerator ();
		}
	}
}


text:
declare module 'execa' {

  declare type StdIoOption =
    | 'pipe'
    | 'ipc'
    | 'ignore'
    | 'inherit'
    | stream$Stream
    | number;

  declare type CommonOptions = {|
    argv0?: string,
    cleanup?: boolean,
    cwd?: string,
    detached?: boolean,
    encoding?: string,
    env?: { [string]: string, ... },
    extendEnv?: boolean,
    gid?: number,
    killSignal?: string | number,
    localDir?: string,
    maxBuffer?: number,
    preferLocal?: boolean,
    reject?: boolean,
    shell?: boolean | string,
    stderr?: ?StdIoOption,
    stdin?: ?StdIoOption,
    stdio?: 'pipe' | 'ignore' | 'inherit' | $ReadOnlyArray<?StdIoOption>,
    stdout?: ?StdIoOption,
    stripEof?: boolean,
    timeout?: number,
    uid?: number,
    windowsVerbatimArguments?: boolean,
  |};

  declare type SyncOptions = {|
    ...CommonOptions,
    input?: string | Buffer,
  |};

  declare type Options = {|
    ...CommonOptions,
    input?: string | Buffer | stream$Readable,
  |};

  declare type SyncResult = {|
    stdout: string,
    stderr: string,
    code: number,
    failed: boolean,
    signal: ?string,
    cmd: string,
    timedOut: boolean,
  |};

  declare type Result = {|
    ...SyncResult,
    killed: boolean,
  |};

  declare interface ThenableChildProcess extends child_process$ChildProcess {
    then<R, E>(
      onfulfilled?: ?((value: Result) => R | Promise<R>),
      onrejected?: ?((reason: ExecaError) => E | Promise<E>),
    ): Promise<R | E>;

    catch<E>(
      onrejected?: ?((reason: ExecaError) => E | Promise<E>)
    ): Promise<Result | E>;
  }

  declare interface ExecaError extends ErrnoError {
    stdout: string;
    stderr: string;
    failed: boolean;
    signal: ?string;
    cmd: string;
    timedOut: boolean;
  }

  declare interface Execa {
    (file: string, args?: $ReadOnlyArray<string>, options?: $ReadOnly<Options>): ThenableChildProcess;
    (file: string, options?: $ReadOnly<Options>): ThenableChildProcess;

    stdout(file: string, args?: $ReadOnlyArray<string>, options?: $ReadOnly<Options>): Promise<string>;
    stdout(file: string, options?: $ReadOnly<Options>): Promise<string>;

    stderr(file: string, args?: $ReadOnlyArray<string>, options?: $ReadOnly<Options>): Promise<string>;
    stderr(file: string, options?: $ReadOnly<Options>): Promise<string>;

    shell(command: string, options?: $ReadOnly<Options>): ThenableChildProcess;

    sync(file: string, args?: $ReadOnlyArray<string>, options?: $ReadOnly<SyncOptions>): SyncResult;
    sync(file: string, options?: $ReadOnly<SyncOptions>): SyncResult;

    shellSync(command: string, options?: $ReadOnly<Options>): SyncResult;
  }

  declare module.exports: Execa;
}


text:
package com.tenable.io.api.exclusions.models;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.tenable.io.api.scans.models.Schedule;

public class Exclusion {
    private int id;
    private String name;
    private String description;
    private String members;
    private int creationDate;
    private int lastModificationDate;
    private Schedule schedule;

    /**
     * Gets the unique id of the exclusion.
     *
     * @return the unique id of the exclusion.
     */
    public int getId() {
        return id;
    }

    /**
     * Sets the unique id of the exclusion.
     *
     * @param id the unique id of the exclusion.
     */
    public void setId( int id ) {
        this.id = id;
    }

    /**
     * Gets the name of the exclusion.
     *
     * @return the name of the exclusion.
     */
    public String getName() {
        return name;
    }

    /**
     * Sets the name of the exclusion.
     *
     * @param name the name of the exclusion.
     */
    public void setName( String name ) {
        this.name = name;
    }

    /**
     * Gets the description of the exclusion.
     *
     * @return the description of the exclusion.
     */
    public String getDescription() {
        return description;
    }

    /**
     * Sets the description of the exclusion.
     *
     * @param description the description of the exclusion.
     */
    public void setDescription( String description ) {
        this.description = description;
    }

    /**
     * Gets the members of the exclusion.
     *
     * @return the members of the exclusion.
     */
    public String getMembers() {
        return members;
    }

    /**
     * Sets the members of the exclusion.
     *
     * @param members the members of the exclusion.
     */
    public void setMembers( String members ) {
        this.members = members;
    }

    /**
     * Gets the creation date of the exclusion in unixtime.
     *
     * @return the creation date of the exclusion in unixtime.
     */
    @JsonProperty( "creation_date" )
    public int getCreationDate() {
        return creationDate;
    }

    /**
     * Sets the creation date of the exclusion in unixtime.
     *
     * @param creationDate the creation date of the exclusion in unixtime.
     */
    @JsonProperty( "creation_date" )
    public void setCreationDate( int creationDate ) {
        this.creationDate = creationDate;
    }

    /**
     * Gets the last modification date for the exclusion in unixtime.
     *
     * @return the last modification date for the exclusion in unixtime.
     */
    @JsonProperty( "last_modification_date" )
    public int getLastModificationDate() {
        return lastModificationDate;
    }

    /**
     * Sets the last modification date for the exclusion in unixtime.
     *
     * @param lastModificationDate the last modification date for the exclusion in unixtime.
     */
    @JsonProperty( "last_modification_date" )
    public void setLastModificationDate( int lastModificationDate ) {
        this.lastModificationDate = lastModificationDate;
    }

    /**
     * Gets a time window to limit the exclusion.
     *
     * @return the time window to limit the exclusion.
     */
    public Schedule getSchedule() {
        return schedule;
    }

    /**
     * Sets a time window to limit the exclusion.
     *
     * @param schedule a time window to limit the exclusion.
     */
    public void setSchedule( Schedule schedule ) {
        this.schedule = schedule;
    }
}


text:
package main

import (
	"bytes"
	"encoding/json"
	"errors"
	"fmt"
	"io"
	"os"
	"time"

	"github.com/spf13/cobra"
	apierrors "k8s.io/apimachinery/pkg/api/errors"
	"k8s.io/client-go/kubernetes"

	"k8s.io/apimachinery/pkg/util/yaml"
	"k8s.io/helm/cmd/helm/installer"
	"k8s.io/helm/pkg/helm"
	"k8s.io/helm/pkg/helm/helmpath"
	"k8s.io/helm/pkg/helm/portforwarder"
	"k8s.io/helm/pkg/version"
)

const initDesc = `
This command installs Tiller (the Helm server-side component) onto your
Kubernetes Cluster and sets up local configuration in $HELM_HOME (default ~/.helm/).

As with the rest of the Helm commands, 'helm init' discovers Kubernetes clusters
by reading $KUBECONFIG (default '~/.kube/config') and using the default context.

To set up just a local environment, use '--client-only'. That will configure
$HELM_HOME, but not attempt to connect to a Kubernetes cluster and install the Tiller
deployment.

When installing Tiller, 'helm init' will attempt to install the latest released
version. You can specify an alternative image with '--tiller-image'. For those
frequently working on the latest code, the flag '--canary-image' will install
the latest pre-release version of Tiller (e.g. the HEAD commit in the GitHub
repository on the master branch).

To dump a manifest containing the Tiller deployment YAML, combine the
'--dry-run' and '--debug' flags.
`

var (
	stableRepositoryURL = "https://kubernetes-charts.storage.googleapis.com"
	// This is the IPv4 loopback, not localhost, because we have to force IPv4
	// for Dockerized Helm: https://github.com/kubernetes/helm/issues/1410
	localRepositoryURL = "http://127.0.0.1:8879/charts"
	tlsServerName      string // overrides the server name used to verify the hostname on the returned certificates from the server.
	tlsCaCertFile      string // path to TLS CA certificate file
	tlsCertFile        string // path to TLS certificate file
	tlsKeyFile         string // path to TLS key file
	tlsVerify          bool   // enable TLS and verify remote certificates
	tlsEnable          bool   // enable TLS
)

type initCmd struct {
	image          string
	clientOnly     bool
	canary         bool
	upgrade        bool
	namespace      string
	dryRun         bool
	forceUpgrade   bool
	skipRefresh    bool
	out            io.Writer
	client         helm.Interface
	home           helmpath.Home
	opts           installer.Options
	kubeClient     kubernetes.Interface
	serviceAccount string
	maxHistory     int
	replicas       int
	wait           bool
}

func newInitCmd(out io.Writer) *cobra.Command {
	i := &initCmd{out: out}

	cmd := &cobra.Command{
		Use:   "init",
		Short: "Initialize Helm on both client and server",
		Long:  initDesc,
		RunE: func(cmd *cobra.Command, args []string) error {
			if len(args) != 0 {
				return errors.New("This command does not accept arguments")
			}
			i.namespace = settings.TillerNamespace
			i.home = settings.Home
			i.client = ensureHelmClient(i.client)

			return i.run()
		},
	}

	f := cmd.Flags()
	f.StringVarP(&i.image, "tiller-image", "i", "", "Override Tiller image")
	f.BoolVar(&i.canary, "canary-image", false, "Use the canary Tiller image")
	f.BoolVar(&i.upgrade, "upgrade", false, "Upgrade if Tiller is already installed")
	f.BoolVar(&i.forceUpgrade, "force-upgrade", false, "Force upgrade of Tiller to the current helm version")
	f.BoolVarP(&i.clientOnly, "client-only", "c", false, "If set does not install Tiller")
	f.BoolVar(&i.dryRun, "dry-run", false, "Do not install local or remote")
	f.BoolVar(&i.skipRefresh, "skip-refresh", false, "Do not refresh (download) the local repository cache")
	f.BoolVar(&i.wait, "wait", false, "Block until Tiller is running and ready to receive requests")

	// TODO: replace TLS flags with pkg/helm/environment.AddFlagsTLS() in Helm 3
	//
	// NOTE (bacongobbler): we can't do this in Helm 2 because the flag names differ, and `helm init --tls-ca-cert`
	// doesn't conform with the rest of the TLS flag names (should be --tiller-tls-ca-cert in Helm 3)
	f.BoolVar(&tlsEnable, "tiller-tls", false, "Install Tiller with TLS enabled")
	f.BoolVar(&tlsVerify, "tiller-tls-verify", false, "Install Tiller with TLS enabled and to verify remote certificates")
	f.StringVar(&tlsKeyFile, "tiller-tls-key", "", "Path to TLS key file to install with Tiller")
	f.StringVar(&tlsCertFile, "tiller-tls-cert", "", "Path to TLS certificate file to install with Tiller")
	f.StringVar(&tlsCaCertFile, "tls-ca-cert", "", "Path to CA root certificate")
	f.StringVar(&tlsServerName, "tiller-tls-hostname", settings.TillerHost, "The server name used to verify the hostname on the returned certificates from Tiller")

	f.StringVar(&stableRepositoryURL, "stable-repo-url", stableRepositoryURL, "URL for stable repository")
	f.StringVar(&localRepositoryURL, "local-repo-url", localRepositoryURL, "URL for local repository")

	f.BoolVar(&i.opts.EnableHostNetwork, "net-host", false, "Install Tiller with net=host")
	f.StringVar(&i.serviceAccount, "service-account", "", "Name of service account")
	f.IntVar(&i.maxHistory, "history-max", 0, "Limit the maximum number of revisions saved per release. Use 0 for no limit.")
	f.IntVar(&i.replicas, "replicas", 1, "Amount of tiller instances to run on the cluster")

	f.StringVar(&i.opts.NodeSelectors, "node-selectors", "", "Labels to specify the node on which Tiller is installed (app=tiller,helm=rocks)")
	f.VarP(&i.opts.Output, "output", "o", "Skip installation and output Tiller's manifest in specified format (json or yaml)")
	f.StringArrayVar(&i.opts.Values, "override", []string{}, "Override values for the Tiller Deployment manifest (can specify multiple or separate values with commas: key1=val1,key2=val2)")
	f.BoolVar(&i.opts.AutoMountServiceAccountToken, "automount-service-account-token", true, "Auto-mount the given service account to tiller")

	return cmd
}

// tlsOptions sanitizes the tls flags as well as checks for the existence of required
// tls files indicated by those flags, if any.
func (i *initCmd) tlsOptions() error {
	i.opts.EnableTLS = tlsEnable || tlsVerify
	i.opts.VerifyTLS = tlsVerify

	if i.opts.EnableTLS {
		missing := func(file string) bool {
			_, err := os.Stat(file)
			return os.IsNotExist(err)
		}
		if i.opts.TLSKeyFile = tlsKeyFile; i.opts.TLSKeyFile == "" || missing(i.opts.TLSKeyFile) {
			return errors.New("missing required TLS key file")
		}
		if i.opts.TLSCertFile = tlsCertFile; i.opts.TLSCertFile == "" || missing(i.opts.TLSCertFile) {
			return errors.New("missing required TLS certificate file")
		}
		if i.opts.VerifyTLS {
			if i.opts.TLSCaCertFile = tlsCaCertFile; i.opts.TLSCaCertFile == "" || missing(i.opts.TLSCaCertFile) {
				return errors.New("missing required TLS CA file")
			}
		}

		// FIXME: remove once we use pkg/helm/environment.AddFlagsTLS() in Helm 3
		settings.TLSEnable = tlsEnable
		settings.TLSVerify = tlsVerify
		settings.TLSServerName = tlsServerName
		settings.TLSCaCertFile = tlsCaCertFile
		settings.TLSCertFile = tlsCertFile
		settings.TLSKeyFile = tlsKeyFile
	}
	return nil
}

// run initializes local config and installs Tiller to Kubernetes cluster.
func (i *initCmd) run() error {
	if err := i.tlsOptions(); err != nil {
		return err
	}
	i.opts.Namespace = i.namespace
	i.opts.UseCanary = i.canary
	i.opts.ImageSpec = i.image
	i.opts.ForceUpgrade = i.forceUpgrade
	i.opts.ServiceAccount = i.serviceAccount
	i.opts.MaxHistory = i.maxHistory
	i.opts.Replicas = i.replicas

	writeYAMLManifests := func(manifests []string) error {
		w := i.out
		for _, manifest := range manifests {
			if _, err := fmt.Fprintln(w, "---"); err != nil {
				return err
			}

			if _, err := fmt.Fprintln(w, manifest); err != nil {
				return err
			}
		}

		// YAML ending document boundary marker
		_, err := fmt.Fprintln(w, "...")
		return err
	}
	if len(i.opts.Output) > 0 {
		var manifests []string
		var err error
		if manifests, err = installer.TillerManifests(&i.opts); err != nil {
			return err
		}
		switch i.opts.Output.String() {
		case "json":
			for _, manifest := range manifests {
				var out bytes.Buffer
				jsonb, err := yaml.ToJSON([]byte(manifest))
				if err != nil {
					return err
				}
				buf := bytes.NewBuffer(jsonb)
				if err := json.Indent(&out, buf.Bytes(), "", "    "); err != nil {
					return err
				}
				if _, err = i.out.Write(out.Bytes()); err != nil {
					return err
				}
				fmt.Fprint(i.out, "\n")
			}
			return nil
		case "yaml":
			return writeYAMLManifests(manifests)
		default:
			return fmt.Errorf("unknown output format: %q", i.opts.Output)
		}
	}
	if settings.Debug {
		var manifests []string
		var err error

		// write Tiller manifests
		if manifests, err = installer.TillerManifests(&i.opts); err != nil {
			return err
		}

		if err = writeYAMLManifests(manifests); err != nil {
			return err
		}
	}

	if i.dryRun {
		return nil
	}

	if err := installer.Initialize(i.home, i.out, i.skipRefresh, settings, stableRepositoryURL, localRepositoryURL); err != nil {
		return fmt.Errorf("error initializing: %s", err)
	}
	fmt.Fprintf(i.out, "$HELM_HOME has been configured at %s.\n", settings.Home)

	if !i.clientOnly {
		if i.kubeClient == nil {
			_, c, err := getKubeClient(settings.KubeContext, settings.KubeConfig)
			if err != nil {
				return fmt.Errorf("could not get kubernetes client: %s", err)
			}
			i.kubeClient = c
		}
		if err := installer.Install(i.kubeClient, &i.opts); err != nil {
			if !apierrors.IsAlreadyExists(err) {
				return fmt.Errorf("error installing: %s", err)
			}
			if i.upgrade {
				if err := installer.Upgrade(i.kubeClient, &i.opts); err != nil {
					return fmt.Errorf("error when upgrading: %s", err)
				}
				if err := i.ping(i.opts.SelectImage()); err != nil {
					return err
				}
				fmt.Fprintln(i.out, "\nTiller (the Helm server-side component) has been updated to", i.opts.SelectImage(), ".")
			} else {
				debug("The error received while trying to init: %s", err)
				fmt.Fprintln(i.out, "Warning: Tiller is already installed in the cluster.\n"+
					"(Use --client-only to suppress this message, or --upgrade to upgrade Tiller to the current version.)")
			}
		} else {
			fmt.Fprintln(i.out, "\nTiller (the Helm server-side component) has been installed into your Kubernetes Cluster.")
			if !tlsVerify {
				fmt.Fprintln(i.out, "\nPlease note: by default, Tiller is deployed with an insecure 'allow unauthenticated users' policy.\n"+
					"To prevent this, run `helm init` with the --tiller-tls-verify flag.\n"+
					"For more information on securing your installation see: https://docs.helm.sh/using_helm/#securing-your-helm-installation")
			}
		}
		if err := i.ping(i.opts.SelectImage()); err != nil {
			return err
		}
	} else {
		fmt.Fprintln(i.out, "Not installing Tiller due to 'client-only' flag having been set")
	}

	needsDefaultImage := !i.clientOnly && !i.opts.UseCanary && len(i.opts.ImageSpec) == 0 && version.BuildMetadata == "unreleased"
	if needsDefaultImage {
		fmt.Fprintf(i.out, "\nWarning: You appear to be using an unreleased version of Helm. Please either use the\n"+
			"--canary-image flag, or specify your desired tiller version with --tiller-image.\n\n"+
			"Ex:\n"+
			"$ helm init --tiller-image gcr.io/kubernetes-helm/tiller:v2.8.2\n\n")
	}

	return nil
}

func (i *initCmd) ping(image string) error {
	if i.wait {
		_, kubeClient, err := getKubeClient(settings.KubeContext, settings.KubeConfig)
		if err != nil {
			return err
		}
		if !watchTillerUntilReady(settings.TillerNamespace, kubeClient, settings.TillerConnectionTimeout, image) {
			return fmt.Errorf("tiller was not found. polling deadline exceeded")
		}

		// establish a connection to Tiller now that we've effectively guaranteed it's available
		if err := setupConnection(); err != nil {
			return err
		}
		i.client = newClient()
		if err := i.client.PingTiller(); err != nil {
			return fmt.Errorf("could not ping Tiller: %s", err)
		}
	}

	return nil
}

// watchTillerUntilReady waits for the tiller pod to become available. This is useful in situations where we
// want to wait before we call New().
//
// Returns true if it exists. If the timeout was reached and it could not find the pod, it returns false.
func watchTillerUntilReady(namespace string, client kubernetes.Interface, timeout int64, newImage string) bool {
	deadlinePollingChan := time.NewTimer(time.Duration(timeout) * time.Second).C
	checkTillerPodTicker := time.NewTicker(500 * time.Millisecond)
	doneChan := make(chan bool)

	defer checkTillerPodTicker.Stop()

	go func() {
		for range checkTillerPodTicker.C {
			image, err := portforwarder.GetTillerPodImage(client.CoreV1(), namespace)
			if err == nil && image == newImage {
				doneChan <- true
				break
			}
		}
	}()

	for {
		select {
		case <-deadlinePollingChan:
			return false
		case <-doneChan:
			return true
		}
	}
}


text:
///<reference path="jquery-1.3.2-vsdoc2.js" />

(function($) {
    var isLoaded;
    var isClosed;

    $.fn.Ribbon = function(ribbonSettings) {
        var settings = $.extend({ theme: 'windows7' }, ribbonSettings || {});

        $('.ribbon a').each(function() {
            if ($(this).attr('accesskey')) {
                $(this).append('
' + $(this).attr('accesskey') + '
');
            }
        });

        $('head').append('<link href="ribbon/themes/' + settings.theme + '/ribbon.css" rel="stylesheet" type="text/css" />" />');

        if (!isLoaded) {
            SetupMenu(settings);
        }

        $(document).keydown(function(e) { ShowAccessKeys(e); });
        $(document).keyup(function(e) { HideAccessKeys(e); });

        function SetupMenu(settings) {
            $('.menu li a:first').addClass('active');
            $('.menu li ul').hide();
            $('.menu li a:first').parent().children('ul:first').show();
            $('.menu li a:first').parent().children('ul:first').addClass('submenu');
            $('.menu li > a').click(function() { ShowSubMenu(this); });
            $('.orb').click(function() { ShowMenu(); });
            $('.orb ul').hide();
            $('.orb ul ul').hide();
            $('.orb li ul li ul').show();
            $('.orb li li ul').each(function() { $(this).prepend('
' + $(this).parent().children('a:first').text() + '
'); });
            $('.orb li li a').each(function() { if ($(this).parent().children('ul').length > 0) { $(this).addClass('arrow') } });

            //$('.ribbon-list div').each(function() { $(this).parent().width($(this).parent().width()); });

            $('.ribbon-list div').click(function(e) {
                var elwidth = $(this).parent().width();
                var insideX = e.pageX > $(this).offset().left && e.pageX < $(this).offset().left + $(this).width();
                var insideY = e.pageY > $(this).offset().top && e.pageY < $(this).offset().top + $(this).height();

                $('.ribbon-list div ul').fadeOut('fast');

                if (insideX && insideY) {
                    $(this).attr('style', 'background-image: ' + $(this).css('background-image'));

                    $(this).parent().width(elwidth);

                    $(this).children('ul').width(elwidth - 4);
                    $(this).children('ul').fadeIn('fast');
                }
            });

            $('.ribbon-list div').parents().click(function (e) {

                var offset = $('.ribbon-list div ul:visible').parent().offset();

                if (offset) {

                    var outsideX = e.pageX < $('.ribbon-list div ul:visible').parent().offset().left || e.pageX > $('.ribbon-list div ul:visible').parent().offset().left + $('.ribbon-list div ul:visible').parent().width();
                    var outsideY = e.pageY < $('.ribbon-list div ul:visible').parent().offset().top || e.pageY > $('.ribbon-list div ul:visible').parent().offset().top + $('.ribbon-list div ul:visible').parent().height();

                    if (outsideX || outsideY) {
                        $('.ribbon-list div ul:visible').each(function () {
                            $(this).fadeOut('fast');
                        });
                        $('.ribbon-list div').css('background-image', '');
                    }
                }
            });

            $('.orb li li a').mouseover(function() { ShowOrbChildren(this); });

            $('.menu li > a').dblclick(function() {
                $('ul .submenu').animate({ height: "hide" });
                $('body').animate({ paddingTop: $(this).parent().parent().parent().parent().height() });
                isClosed = true;
            });
        }

        $('.ribbon').parents().click(function(e) {
            var outsideX = e.pageX < $('.orb ul:first').offset().left || e.pageX > $('.orb ul:first').offset().left + $('.orb ul:first').width();
            var outsideY = e.pageY < $('.orb ul:first img:first').offset().top || e.pageY > $('.orb ul:first').offset().top + $('.orb ul:first').height();

            if (outsideX || outsideY)
                $('.orb ul').fadeOut('fast');
        });

        if (isLoaded) {
            $('.orb li:first ul:first img:first').remove();
            $('.orb li:first ul:first img:last').remove();
            $('.ribbon-list div img[src*="/images/arrow_down.png"]').remove();
        }

        $('.orb li:first ul:first').prepend('');
        $('.orb li:first ul:first').append('');

        $('.ribbon-list div').each(function() { if ($(this).children('ul').length > 0) { $(this).append('') } });

        //Hack for IE 7.
        if (navigator.appVersion.indexOf('MSIE 6.0') > -1 || navigator.appVersion.indexOf('MSIE 7.0') > -1) {
            $('ul.menu li li div').css('width', '90px');
            $('ul.menu').css('width', '500px');
            $('ul.menu').css('float', 'left');
            $('ul.menu .submenu li div.ribbon-list').css('width', '100px');
            $('ul.menu .submenu li div.ribbon-list div').css('width', '100px');
        }

        $('a[href=' + window.location.hash + ']').click();

        isLoaded = true;

        function ResetSubMenu() {
            $('.menu li a').removeClass('active');
            $('.menu ul').removeClass('submenu');
            $('.menu li ul').hide();
        }

        function ShowSubMenu(e) {
            var isActive = $(e).next().css('display') == 'block';
            ResetSubMenu();

            $(e).addClass('active');
            $(e).parent().children('ul:first').addClass('submenu');

            $(e).parent().children('ul:first').show();
            $('body').css('padding-top', '120px');

            isClosed = false;
        }

        function ShowOrbChildren(e) {
            if (($(e).parent().children('ul').css('display') == 'none' || $(e).parent().children('ul').length == 0) && $(e).parent().parent().parent().parent().hasClass('orb')) {
                $('.orb li li ul').fadeOut('fast');
                $(e).parent().children('ul').fadeIn('fast');
            }
        }

        function ShowMenu() {
            $('.orb ul').animate({ opacity: 'toggle' }, 'fast');
        }

        function ShowAccessKeys(e) {
            if (e.altKey) {
                $('div[rel="accesskeyhelper"]').each(function() { $(this).css('top', $(this).parent().offset().top).css('left', $(this).parent().offset().left - 20 + $(this).parent().width()); $(this).show(); });
            }
        }

        function HideAccessKeys(e) {
            $('div[rel="accesskeyhelper"]').hide();
        }
    }
})(jQuery);


text:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent" android:layout_height="match_parent">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        tools:src="@mipmap/ic_launcher"
        android:id="@+id/ivMovieImage"
        android:adjustViewBounds="true"
        android:scaleType="fitXY" />

    <ImageView
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:id="@+id/ivPlayButtonOverlay"
        android:src="@drawable/play_circle_outline"
        android:tint="@color/colorAccent"
        android:padding="50dp" />

</FrameLayout>


text:
using System;
using System.Collections.Generic;
using System.ComponentModel.Design.Serialization;
using System.Runtime.InteropServices;
using System.Text;

namespace Trees
{
    class Tree
    {
        public Node root;

        public Tree(Node data)
        {
            root = data;
        }

    }
}


text:
import "babel-polyfill"

import React from 'react'
import ReactDOM from 'react-dom'
import { createStore, applyMiddleware, compose } from 'redux'
import createSagaMiddleware from 'redux-saga'
// import sagaMonitor from './sagaMonitor'

import Counter from './components/Counter'
import reducer from './reducers'
import rootSaga from './sagas'

const sagaMiddleware = createSagaMiddleware(/* {sagaMonitor} */)
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ &&
  window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({ trace: true, traceLimit: 25 }) || compose;
const store = createStore(
  reducer,
  composeEnhancers(applyMiddleware(sagaMiddleware))
)
sagaMiddleware.run(rootSaga)

const action = type => store.dispatch({type})

function render() {
  ReactDOM.render(
    <Counter
      value={store.getState()}
      onIncrement={() => action('INCREMENT')}
      onDecrement={() => action('DECREMENT')}
      onIncrementIfOdd={() => action('INCREMENT_IF_ODD')}
      onIncrementAsync={() => action('INCREMENT_ASYNC')} />,
    document.getElementById('root')
  )
}

render()
store.subscribe(render)


text:
namespace UI
{
	/// @brief Removes the part from the composite
	/// @note NOP if invoked during signal propagation
	void Part::Remove (void)
	{
		State * state = GetOwner()->mState;

		if (eSignalTesting == state->mMode) return;
		if (eIssuingEvents == state->mMode) return;

		// Remove if active in the state.
		if (state->GetEntered() == this) state->mEntered = 0;
		if (state->GetGrabbed() == this) state->mGrabbed = 0;

		// Destroy the part.
		delete this;
	}
}


text:
<?php
defined('C5_EXECUTE') or die("Access Denied.");
$th = Loader::helper('text');
$dh = Loader::helper('form/date_time');
$al = Loader::helper('concrete/asset_library');
$bf = null;
?>

<?php if($pID): ?>
<?php echo Loader::helper('concrete/dashboard')->getDashboardPaneHeaderWrapper(t('Edit Produs'), false, false, false);?>
<?php else: ?>
<?php echo Loader::helper('concrete/dashboard')->getDashboardPaneHeaderWrapper(t('Add Produs'), false, false, false);?>
<?php endif ?>

<form method="post" enctype="multipart/form-data" id="ccm-produs-form" action="<?php echo $this->url('/dashboard/shop/add')?>">

                <?php echo t('Produs Information')?>

                <?php echo t('Title')?> *
                <?php echo t('Description')?> *

                <input type="text" name="title" autocomplete="off" value="<?php echo $th->entities($product->getTitle())?>" style="width: 95%">
                <input type="text" autocomplete="off" name="description" value="<?php echo $th->entities($product->getDescription())?>" style="width: 95%">

                <?php echo t('Price')?>
                <input type="text" name="price" autocomplete="off" value="<?php echo $th->entities($product->getPrice())?>" style="width: 95%">

                 <?php echo t('Image')?>
                <?php echo $al->image('ccm-b-image', 'fID', t('Choose Image'), $bf);?>

            <?php if($pID): ?>
            <input type="hidden" name="pID" value="<?php echo $pID ?>" />
            <?php endif ?>
            <input type="hidden" name="save" value="1" />
            <?php  print $ih->submit(t('Save Product'), 'ccm-product-form', 'right', 'primary'); ?>
            <?php  print $ih->submit(t('Save & Add Another'), 'ccm-product-add-another', 'right', 'primary'); ?>
            <?php if($product->getID()): ?>
            <?php  print $ih->submit(t('Delete Product'), 'ccm-product-delete', 'left', 'danger'); ?>
            <?php endif ?>

</form>

<?php echo Loader::helper('concrete/dashboard')->getDashboardPaneFooterWrapper(false);


text:
<?php

namespace Amp\Test;

use Amp\Promisor;
use Amp\Test\PromisorPrivateImpl;

class PromisorPrivateTest extends PromisorTest {
    protected function getPromisor() {
        return new PromisorPrivateImpl;
    }
}


text:
package resourcequota

import (
	"reflect"
	"testing"

	"github.com/kubernetes/dashboard/src/app/backend/api"
	"k8s.io/apimachinery/pkg/api/resource"
	metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/client-go/pkg/api/v1"
)

func TestGetResourceQuotaDetail(t *testing.T) {

	testMemoryQuantity, _ := resource.ParseQuantity("6G")

	cases := []struct {
		resourceQuotas *v1.ResourceQuota
		expected       *ResourceQuotaDetail
	}{
		{
			&v1.ResourceQuota{
				ObjectMeta: metaV1.ObjectMeta{Name: "foo"},
				Spec: v1.ResourceQuotaSpec{
					Hard: map[v1.ResourceName]resource.Quantity{
						v1.ResourceMemory: testMemoryQuantity,
					},
					Scopes: []v1.ResourceQuotaScope{
						v1.ResourceQuotaScopeBestEffort,
					},
				},
				Status: v1.ResourceQuotaStatus{
					Hard: map[v1.ResourceName]resource.Quantity{
						v1.ResourceMemory: testMemoryQuantity,
					},
					Used: map[v1.ResourceName]resource.Quantity{
						v1.ResourceMemory: testMemoryQuantity,
					},
				},
			},
			&ResourceQuotaDetail{
				TypeMeta:   api.TypeMeta{Kind: "resourcequota"},
				ObjectMeta: api.ObjectMeta{Name: "foo"},
				Scopes: []v1.ResourceQuotaScope{
					v1.ResourceQuotaScopeBestEffort,
				},
				StatusList: map[v1.ResourceName]ResourceStatus{
					v1.ResourceMemory: {
						Hard: testMemoryQuantity.String(),
						Used: testMemoryQuantity.String(),
					},
				},
			},
		},
	}
	for _, c := range cases {
		actual := ToResourceQuotaDetail(c.resourceQuotas)
		if !reflect.DeepEqual(actual, c.expected) {
			t.Errorf("getResourceQuotaDetail(%#v) == \n%#v\nexpected \n%#v\n",
				c.resourceQuotas, actual, c.expected)
		}
	}
}


text:
package net.glowstone.io.entity;

import java.util.UUID;
import java.util.stream.Collectors;
import net.glowstone.entity.GlowAreaEffectCloud;
import net.glowstone.i18n.ConsoleMessages;
import net.glowstone.inventory.GlowMetaPotion;
import net.glowstone.util.nbt.CompoundTag;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.Particle;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.potion.PotionData;
import org.bukkit.projectiles.ProjectileSource;

class AreaEffectCloudStore extends EntityStore<GlowAreaEffectCloud> {

    private static final String DURATION = "Duration";
    private static final String COLOR = "Color";
    private static final String REAPPLICATION_DELAY = "ReapplicationDelay";
    private static final String WAIT_TIME = "WaitTime";
    private static final String OWNER_UUID_LEAST = "OwnerUUIDLeast";
    private static final String OWNER_UUID_MOST = "OwnerUUIDMost";
    private static final String DURATION_ON_USE = "DurationOnUse";
    private static final String RADIUS = "Radius";
    private static final String RADIUS_ON_USE = "RadiusOnUse";
    private static final String RADIUS_PER_TICK = "RadiusPerTick";
    private static final String PARTICLE = "Particle";
    private static final String POTION = "Potion";
    private static final String EFFECTS = "Effects";

    public AreaEffectCloudStore() {
        super(GlowAreaEffectCloud.class, EntityType.AREA_EFFECT_CLOUD);
    }

    @Override
    public void load(GlowAreaEffectCloud entity, CompoundTag tag) {
        super.load(entity, tag);
        tag.readInt(COLOR, rgb -> entity.setColor(Color.fromRGB(rgb)));
        tag.readInt(DURATION, entity::setDuration);
        tag.readInt(REAPPLICATION_DELAY, entity::setReapplicationDelay);
        tag.readInt(WAIT_TIME, entity::setWaitTime);
        // TODO: OWNER_UUID_LEAST, OWNER_UUID_MOST
        tag.readInt(DURATION_ON_USE, entity::setDurationOnUse);
        tag.readFloat(RADIUS, entity::setRadius);
        tag.readFloat(RADIUS_ON_USE, entity::setRadiusOnUse);
        tag.readFloat(RADIUS_PER_TICK, entity::setRadiusPerTick);
        tag.readString(PARTICLE, particle -> {
            try {
                entity.setParticle(Particle.valueOf(particle));
            } catch (IllegalArgumentException e) {
                ConsoleMessages.Warn.Entity.PARTICLE_INVALID.log(particle, tag);
            }
        });
        // TODO: Potion
        tag.readCompoundList(EFFECTS, effects -> effects
            .stream()
            .map(GlowMetaPotion::fromNbt)
            .forEach(effect -> entity.addCustomEffect(effect, false)));
    }

    @Override
    public void save(GlowAreaEffectCloud entity, CompoundTag tag) {
        super.save(entity, tag);
        tag.putInt("Age", entity.getTicksLived());
        Color color = entity.getColor();
        if (color != null) {
            tag.putInt(COLOR, color.asRGB());
        }
        tag.putInt(DURATION, entity.getDuration());
        tag.putInt(REAPPLICATION_DELAY, entity.getReapplicationDelay());
        tag.putInt(WAIT_TIME, entity.getWaitTime());
        ProjectileSource source = entity.getSource();
        if (source instanceof Entity) {
            UUID uuid = ((Entity) source).getUniqueId();
            tag.putLong(OWNER_UUID_LEAST, uuid.getLeastSignificantBits());
            tag.putLong(OWNER_UUID_MOST, uuid.getMostSignificantBits());
        }
        tag.putInt(DURATION_ON_USE, entity.getDurationOnUse());
        tag.putFloat(RADIUS, entity.getRadius());
        tag.putFloat(RADIUS_ON_USE, entity.getRadiusOnUse());
        tag.putFloat(RADIUS_PER_TICK, entity.getRadiusPerTick());
        Particle particle = entity.getParticle();
        if (particle != null) {
            tag.putString(PARTICLE, particle.toString());
        }
        PotionData potion = entity.getBasePotionData();
        if (potion != null) {
            tag.putString(POTION, GlowMetaPotion.dataToString(potion));
        }
        tag.putCompoundList(EFFECTS, entity
                .getCustomEffects()
                .stream()
                .map(GlowMetaPotion::toNbt)
                .collect(Collectors.toList()));
        // TODO: Are ParticleParam1 and ParticleParam2 unused?
    }

    @Override
    public GlowAreaEffectCloud createEntity(Location location, CompoundTag compound) {
        GlowAreaEffectCloud cloud = new GlowAreaEffectCloud(location);
        load(cloud, compound);
        return cloud;
    }
}