text:
This repository is designed to mirror Binomial, LLC's
[basis\_universal](https://github.com/BinomialLLC/basis_universal) repo. Please
file all issues on, and make all contributions to, the upstream repo.

# basis_universal
Basis Universal Supercompressed GPU Texture Codec

(This software is available under a free and permissive license (Apache 2.0), but like many other large open source projects it needs financial support to sustain its continued security, bug fixes and improvements. In addition to maintenance and stability there are many desirable features and new interchange formats we would like to add. If your company is using Basis Universal in a product, please consider reaching out.)

Businesses: support continued development and maintenance via invoiced technical support, maintenance, or sponsoring contracts:

  _E-mail: info @ binomial dot info_ or contact us on [Twitter](https://twitter.com/_binomial)

Also see the [Sponsors](https://github.com/BinomialLLC/basis_universal/wiki/Sponsors-and-Supporters) wiki page.

----

[![Build status](https://ci.appveyor.com/api/projects/status/87eb0o96pjho4sh0?svg=true)](https://ci.appveyor.com/project/BinomialLLC/basis-universal)

Basis Universal is a ["supercompressed"](http://gamma.cs.unc.edu/GST/gst.pdf) GPU texture data interchange system that supports two highly compressed intermediate file formats (.basis or the [.KTX2 open standard from the Khronos Group](https://github.khronos.org/KTX-Specification/)) that can be quickly transcoded to a [very wide variety](https://github.com/BinomialLLC/basis_universal/wiki/OpenGL-texture-format-enums-table) of GPU compressed and uncompressed pixel formats: ASTC 4x4 L/LA/RGB/RGBA, PVRTC1 4bpp RGB/RGBA, PVRTC2 RGB/RGBA, BC7 mode 6 RGB, BC7 mode 5 RGB/RGBA, BC1-5 RGB/RGBA/X/XY, ETC1 RGB, ETC2 RGBA, ATC RGB/RGBA, ETC2 EAC R11 and RG11, FXT1 RGB, and uncompressed raster image formats 8888/565/4444.

The system now supports two modes: a high quality mode which is internally based off the [UASTC compressed texture format](https://richg42.blogspot.com/2020/01/uastc-block-format-encoding.html), and the original lower quality mode which is based off a subset of ETC1 called "ETC1S". UASTC is for extremely high quality (similar to BC7 quality) textures, and ETC1S is for very small files. The ETC1S system includes built-in data compression, while the UASTC system includes an optional Rate Distortion Optimization (RDO) post-process stage that conditions the encoded UASTC texture data in the .basis file so it can be more effectively LZ compressed by the end user. More technical details about UASTC integration are [here](https://github.com/BinomialLLC/basis_universal/wiki/UASTC-implementation-details).

Basis files support non-uniform texture arrays, so cubemaps, volume textures, texture arrays, mipmap levels, video sequences, or arbitrary texture "tiles" can be stored in a single file. The compressor is able to exploit color and pattern correlations across the entire file, so multiple images with mipmaps can be stored very efficiently in a single file.

The system's bitrate depends on the quality setting and image content, but common usable ETC1S bitrates are .3-1.25 bits/texel. ETC1S .basis files are typically 10-25% smaller than using RDO texture compression of the internal texture data stored in the .basis file followed by LZMA. For UASTC files, the bitrate is fixed at 8bpp, but with RDO post-processing and user-provided LZ compression on the .basis file the effective bitrate can be as low as 2bpp for video or for individual textures approximately 4-6bpp.

The .basis and .KTX2 transcoders have been fuzz tested using [zzuf](https://www.linux.com/news/fuzz-testing-zzuf).

So far, we've compiled the code using MSVC 2019, under Ubuntu 18.04 and 20 x64 using cmake with either clang 3.8 or gcc 5.4, and emscripten 1.35 to asm.js. (Be sure to use this version or later of emcc, as earlier versions fail with internal errors/exceptions during compilation.)

Basis Universal supports "skip blocks" in ETC1S compressed texture arrays, which makes it useful for basic [compressed texture video](http://gamma.cs.unc.edu/MPTC/) applications. Note that Basis Universal is still at heart a GPU texture compression system, not a dedicated video codec, so bitrates will be larger than even MPEG1.
1/10/21 release notes:

For v1.13, we've added numerous ETC1S encoder optimizations designed to greatly speed up single threaded encoding time, as well as greatly reducing overall CPU utilization when multithreading is enabled. For benchmarking, we're using "-q 128 -no_multithreading -mip_fast". The encoder now uses approximately 1/3rd as much total CPU time for the same PSNR. The encoder can now optionally utilize SSE 4.1 - see the "-no_sse" command line option.

[Release Notes](https://github.com/BinomialLLC/basis_universal/wiki/Release-Notes)

### The first texture (and possibly image/video) compression codec developed without "Lena"

We retired Lena years ago. No testing is done with this image:

https://www.losinglena.com/

### Quick Introduction

Probably the most important concept to understand about Basis Universal before using it: The system supports **two** very different universal texture modes: The original "ETC1S" mode is low/medium quality, but the resulting file sizes are very small because the system has built-in compression for ETC1S texture format files. This is the command line encoding tool's default mode. ETC1S textures work best on images, photos, map data, or albedo/specular/etc. textures, but don't work as well on normal maps.

There's the second "UASTC" mode, which is significantly higher quality (comparable to BC7 and highest quality LDR ASTC 4x4), and is usable on all texture types including complex normal maps. UASTC mode purposely does not have built-in file compression like ETC1S mode does, so the resulting files are quite large (8-bits/texel - same as BC7) compared to ETC1S mode. The UASTC encoder has an optional Rate Distortion Optimization (RDO) encoding mode (implemented as a post-process over the encoded UASTC texture data), which conditions the output texture data in a way that results in better lossless compression when UASTC .basis files are compressed with Deflate/Zstd, etc. In UASTC mode, you must losslessly compress .basis files yourself. .KTX2 files have built-in lossless compression support using [Zstandard](https://facebook.github.io/zstd/), which is used by default on UASTC textures.

Basis Universal is not an image compression codec, but a GPU texture compression codec. It can be used just like an image compression codec, but that's not the only use case. Here's a [good intro](http://renderingpipeline.com/2012/07/texture-compression/) to GPU texture compression. If you're looking to primarily use the system as an image compression codec on sRGB photographic content, use the default ETC1S mode, because it has built-in compression.

**The "-q X" option controls the output quality in ETC1S mode.** The default is quality level 128. "-q 255" will increase quality quite a bit. If you want even higher quality, try "-max_selectors 16128 -max_endpoints 16128" instead of -q. -q internally tries to set the codebook sizes (or the # of quantization intervals for endpoints/selectors) for you. You need to experiment with the quality level on your content.

For tangent space normal maps, you should separate X into RGB and Y into Alpha, and provide the compressor with 32-bit/pixel input images. Or use the "-separate_rg_to_color_alpha" command line option which does this for you. The internal texture format that Basis Universal uses (ETC1S) doesn't handle tangent space normal maps encoded into RGB well. You need to separate the channels and recover Z in the pixel shader using z=sqrt(1-x^2-y^2).

### License and 3rd party code dependencies

Detailed legal, license, and IP information is [here](https://github.com/BinomialLLC/basis_universal/wiki/Legal-IP-License-Information). Basis Universal itself uses the Apache 2.0 licenses, but it also utilizes some optional BSD code (Zstandard). The supported texture formats are [open Khronos Group standards](https://www.khronos.org/registry/DataFormat/specs/1.1/dataformat.1.1.html).

All C/C++ code dependencies are present inside the Basis Universal repo itself to simplify building.

The encoder optionally uses Zstandard's single source file compressor (in zstd/zstd.c) to support compressing supercompressed KTX2 files. The stand-alone transcoder (in the "transcoder" directory) is a single .cpp source file library which has no 3rd party code dependencies apart from zstd/zstddeclib.c, which is also technically optional. It's only used for decompressing UASTC KTX2 files that use Zstandard.

### Command Line Compression Tool

The command line tool used to create, validate, and transcode/unpack .basis/.KTX2 files is named "basisu". Run basisu without any parameters for help.

The library and command line tool have no other 3rd party dependencies (that are not already in the repo), so it's pretty easy to build.

To build basisu (without SSE 4.1 support - the default):

```
cmake CMakeLists.txt
make
```
To build with SSE 4.1 support on x86/x64 systems (encoding is roughly 15-30% faster):
```
cmake -D SSE=TRUE CMakeLists.txt
make
```

For Visual Studio 2019, you can now either use the CMakeLists.txt file or the included `basisu.sln` file. Earlier versions of Visual Studio (particularly 2017) should work but aren't actively tested. We develop with the most up to date version of 2019.

To compress a sRGB PNG/BMP/TGA/JPEG image to an ETC1S .KTX2 file:

`basisu -ktx2 x.png`

To compress a sRGB PNG/BMP/TGA/JPEG image to an UASTC .KTX2 file:

`basisu -ktx2 -uastc x.png`

To compress a sRGB PNG/BMP/TGA/JPEG image to an RDO UASTC .KTX2 file with mipmaps:

`basisu -ktx2 -uastc -uastc_rdo_l 1.0 -mipmap x.png`

To compress a sRGB PNG/BMP/TGA/JPEG image to an ETC1S .basis file:

`basisu x.png`

To compress a image to a higher quality UASTC .basis file:

`basisu -uastc -uastc_level 2 x.png`

To compress a image to a higher quality UASTC .basis file with RDO post processing, so the .basis file is more compressible:

`basisu -uastc -uastc_level 2 -uastc_rdo_l .75 x.png`

-uastc_level X ranges from 0-4 and controls the UASTC encoder's performance vs. quality tradeoff. Level 0 is very fast, but low quality, level 2 is the default quality, while level 3 is the highest practical quality. Level 4 is impractically slow, but highest quality.

-uastc_rdo_l X controls the rate distortion stage's quality setting. The lower this value, the higher the quality, but the larger the compressed file size. Good values to try are between .2-3.0. The default is 1.0. RDO post-processing is currently pretty slow, but we'll be optimizing it over time.

UASTC texture video is supported and has been tested. In RDO mode with 7zip LZMA, we've seen average bitrates between 1-2 bpp. ETC1S mode is recommended for texture video, which gets bitrates around .25-.3 bpp.

Note that basisu defaults to sRGB colorspace metrics. If the input is a normal map, or some other type of non-sRGB (non-photographic) texture content, be sure to use -linear to avoid extra unnecessary artifacts. (Note: Currently, UASTC mode always uses linear colorspace metrics. sRGB and angulate metrics are comming soon.)

To add automatically generated mipmaps to the .basis file, at a higher than default quality level (which ranges from [1,255]):

`basisu -mipmap -q 190 x.png`

There are several mipmap options that allow you to change the filter kernel, the filter colorspace for the RGB channels (linear vs. sRGB), the smallest mipmap dimension, etc. The tool also supports generating cubemap files, 2D/cubemap texture arrays, etc.

To create a slightly higher quality ETC1S .basis file (one with better codebooks) at the default quality level (128) - note this is much slower to encode:

`basisu -comp_level 2 x.png`

On some rare images (ones with blue sky gradients come to bind), you may need to increase the ETC1S `-comp_level` setting. This controls the amount of overall effort the encoder uses to optimize the ETC1S codebooks (palettes) and compressed data stream. Higher comp_level's are *significantly* slower, and shouldn't be used unless necessary:

`basisu -ktx2 x.png -comp_level 5 -q 255`

Or try:
`basisu -ktx2 x.png -comp_level 5 -max_endpoints 16128 -max_selectors 16128`

Note `-comp_level`'s 3-4 are almost as good as 5 and are a lot faster.

The compressor is multithreaded by default, but this can be disabled using the `-no_multithreading` command line option. The transcoder is currently single threaded although it supports multithreading decompression of multiple texture slices in parallel.

### Unpacking .basis/.KTX2 files to .PNG/.KTX files

You can either use the command line tool or [call the transcoder directly](https://github.com/BinomialLLC/basis_universal/wiki/How-to-Use-and-Configure-the-Transcoder) from JavaScript or C/C++ code to decompress .basis/.KTX2 files to GPU texture data or uncompressed images.

To use the command line tool to unpack a .basis or .KTX2 file to multiple .png/.ktx files:

`basisu x.basis`

Use the `-no_ktx`/`-ktx_only` and `-etc1_only`/`-format_only` options to unpack to less files. `-info` and `-validate` will just display file information and not output any files. The output .KTX1 files are currently in the KTX1 file format, not KTX2.

The mipmapped or cubemap .KTX files will be in a wide variety of compressed GPU texture formats (PVRTC1 4bpp, ETC1-2, BC1-5, BC7, etc.), and to my knowledge there is no single .KTX viewer tool that correctly and reliably supports every GPU texture format that we support. BC1-5 and BC7 files are viewable using AMD's Compressonator, ETC1/2 using Mali's Texture Compression Tool, and PVRTC1 using Imagination Tech's PVRTexTool. Links:

[Mali Texture Compression Tool](https://developer.arm.com/tools-and-software/graphics-and-gaming/graphics-development-tools/mali-texture-compression-tool)

[Compressonator](https://gpuopen.com/gaming-product/compressonator/)

[PVRTexTool](https://www.imgtec.com/developers/powervr-sdk-tools/pvrtextool/)

After compression, the compressor transcodes all slices in the output .basis file to validate that the file decompresses correctly. It also validates all header, compressed data, and slice data CRC16's.

For best quality, you must **supply basisu with original uncompressed source images**. Any other type of lossy compression applied before basisu (including ETC1/BC1-5, BC7, JPEG, etc.) will cause multi-generational artifacts to appear in the final output textures.

For the maximum possible achievable ETC1S mode quality with the current format and encoder (completely ignoring encoding speed!), use:

`basisu x.png -comp_level 5 -max_endpoints 16128 -max_selectors 16128 -no_selector_rdo -no_endpoint_rdo`

Level 5 is extremely slow, so unless you have a very powerful machine, levels 1-4 are recommended.

Note that "-no_selector_rdo -no_endpoint_rdo" are optional. Using them hurts rate distortion performance, but increases quality. An alternative is to use -selector_rdo_thresh X and -endpoint_rdo_thresh, with X ranging from [1,2] (higher=lower quality/better compression - see the tool's help text).

To compress small video sequences, say using tools like ffmpeg and VirtualDub:

`basisu -comp_level 2 -tex_type video -stats -debug -multifile_printf "pic%04u.png" -multifile_num 200 -multifile_first 1 -max_selectors 16128 -max_endpoints 16128 -endpoint_rdo_thresh 1.05 -selector_rdo_thresh 1.05`

For video, the more cores your machine has, the better. Basis is intended for smaller videos of a few dozen seconds or so. If you are very patient and have a Threadripper or Xeon workstation, you should be able to encode up to a few thousand 720P frames. The "webgl_videotest" directory contains a very simple video viewer.
For texture video, use -comp_level 2 or 3. The default is 1, which isn't quite good enough for texture video. Higher comp_level's result in reduced ETC1S artifacts.

The .basis file will contain multiple images (all using the same global codebooks), which you can retrieve using the transcoder's image API. The system now supports [conditional replenisment](https://en.wikipedia.org/wiki/MPEG-1) (CR, or "skip blocks"). CR can reduce the bitrate of some videos (highly dependent on how dynamic the content is) by over 50%. For videos using CR, the images must be requested from the transcoder in sequence from first to last, and random access is only allowed to I-Frames.

If you are doing rate distortion comparisons vs. other similar systems, be sure to experiment with increasing the endpoint RDO threshold (-endpoint_rdo_thresh X). This setting controls how aggressively the compressor's backend will combine together nearby blocks so they use the same block endpoint codebook vectors, for better coding efficiency. X defaults to a modest 1.5, which means the backend is allowed to increase the overall color distance by 1.5x while searching for merge candidates. The higher this setting, the better the compression, with the tradeoff of more block artifacts. Settings up to ~2.25 can work well, and make the codec more competitive. "-endpoint_rdo_thresh 1.75" is a good setting on many textures.

For video, level 1 should result in decent results on most clips. For less banding, level 2 can make a big difference. This is still an active area of development, and quality/encoding perf. will improve over time.

To control the ETC1S encoder's quality vs. encoding speed tradeoff, see [ETC1S Compression Effort Levels](https://github.com/BinomialLLC/basis_universal/wiki/ETC1S-Compression-Effort-Levels).

### More Examples

`basisu x.png`\
Compress sRGB image x.png to a ETC1S format x.basis file using default settings (multiple filenames OK). ETC1S format files are typically very small on disk (around .5-1.5 bits/texel).

`basisu -uastc x.png`\
Compress image x.png to a UASTC format x.basis file using default settings (multiple filenames OK). UASTC files are the same size as BC7 on disk (8-bpp). Be sure to compress UASTC .basis files yourself using Deflate, zstd, etc. To increase .basis file compressibility (trading off quality for smaller compressed files) use the "-uastc_rdo_q X" command line parameter.

`basisu -q 255 x.png`\
Compress sRGB image x.png to x.basis at max quality level achievable without  manually setting the codebook sizes (multiple filenames OK)

`basisu x.basis`\
Unpack x.basis to PNG/KTX files (multiple filenames OK)

`basisu -validate -file x.basis`\
Validate x.basis (check header, check file CRC's, attempt to transcode all slices)

`basisu -unpack -file x.basis`\
Validates, transcodes and unpacks x.basis to mipmapped .KTX and RGB/A .PNG files (transcodes to all supported GPU texture formats)

`basisu -q 255 -file x.png -mipmap -debug -stats`\
Compress sRGB x.png to x.basis at quality level 255 with compressor debug output/statistics

`basisu -linear -max_endpoints 16128 -max_selectors 16128 -file x.png`\
Compress non-sRGB x.png to x.basis using the largest supported manually specified codebook sizes

`basisu -linear -global_sel_pal -no_hybrid_sel_cb -file x.png`\
Compress a non-sRGB image, use virtual selector codebooks for improved compression (but slower encoding)

`basisu -linear -global_sel_pal -file x.png`\
Compress a non-sRGB image, use hybrid selector codebooks for slightly improved compression (but slower encoding)

`basisu -tex_type video -comp_level 2 -framerate 20 -multifile_printf "x%02u.png" -multifile_first 1 -multifile_count 20 -selector_rdo_thresh 1.05 -endpoint_rdo_thresh 1.05`\
Compress a 20 sRGB source image video sequence (x01.png, x02.png, x03.png, etc.) to x01.basis

`basisu -comp_level 2 -q 255 -file x.png -mipmap -y_flip`\
Compress a mipmapped x.basis file from an sRGB image named x.png, Y flip each source image, set encoder to level 2 for slightly higher quality (but slower encoding).

### WebGL test

The "WebGL" directory contains three simple WebGL demos that use the transcoder and compressor compiled to wasm with [emscripten](https://emscripten.org/). See more details [here](webgl/README.md).

![Screenshot of 'texture' example running in a browser.](webgl/texture/preview.png)
![Screenshot of 'gltf' example running in a browser.](webgl/gltf/preview.png)
![Screenshot of 'encode_test' example running in a browser.](webgl/encode_test/preview.png)

### Installation using the vcpkg dependency manager

You can download and install Basis Universal using the [vcpkg](https://github.com/Microsoft/vcpkg/) dependency manager:

    git clone https://github.com/Microsoft/vcpkg.git
    cd vcpkg
    ./bootstrap-vcpkg.sh
    ./vcpkg integrate install
    vcpkg install basisu

The Basis Universal port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.

### WebAssembly Support Using Emscripten

Both the transcoder and now the compressor (as of 12/17/2020) may be compiled using emscripten to WebAssembly and used on the web. Currently, multithreading is not supported by the compressor when compiled with emscripten. A simple Web compression demo is in webgl/encode_test. All compressor features, including texture video, are supported and fully exposed.

To enable compression support compile the JavaScript wrappers in `webgl/transcoding/basis_wrappers.cpp` with `BASISU_SUPPORT_ENCODING` set to 1. See the webgl/encoding directory.

### Low-level C++ encoder API

You can call the encoder directly, instead of using the command line tool. We'll be adding documentation and some examples by the end of the year. For now, some important notes:

First, ALWAYS call ```basisu::basisu_encoder_init()``` to initialize the library. Otherwise, you'll get undefined behavior or black textures.

Create a job pool, fill in the ```basis_compress_params``` struct, then call ```basisu::basis_compressor::init()```, then ```basisu::basis_compressor::process()```. Like this for UASTC:

```
bool test()
{
	basisu_encoder_init();

	image img;
	if (!load_image("test.png", img))
	{
		printf("Can't load image\n");
		return false;
	}

	basis_compressor_params basisCompressorParams;

	basisCompressorParams.m_source_images.push_back(img);
	basisCompressorParams.m_perceptual = false;
	basisCompressorParams.m_mip_srgb = false;

	basisCompressorParams.m_write_output_basis_files = true;
	basisCompressorParams.m_out_filename = "test.basis";

	basisCompressorParams.m_uastc = true;
	basisCompressorParams.m_rdo_uastc_multithreading = false;
	basisCompressorParams.m_multithreading = false;
	basisCompressorParams.m_debug = true;
	basisCompressorParams.m_status_output = true;
	basisCompressorParams.m_compute_stats = true;

	basisu::job_pool jpool(1);
	basisCompressorParams.m_pJob_pool = &jpool;

	basisu::basis_compressor basisCompressor;
	basisu::enable_debug_printf(true);

	bool ok = basisCompressor.init(basisCompressorParams);
	if (ok)
	{
		basisu::basis_compressor::error_code result = basisCompressor.process();

		if (result == basisu::basis_compressor::cECSuccess)
			printf("Success\n");
		else
		{
			printf("Failure\n");
			ok = false;
		}
	}
	else
		printf("Failure\n");
	return ok;
}
```

The command line tool uses this API too, so you can always look at that to see what it does given a set of command line options.

### Repository Licensing with REUSE

The repository has been updated to be compliant with the REUSE licenese
checking tool (https://reuse.software/). This was done by adding the complete
text of all licenses used under the LICENSES/ directory and adding the
.reuse/dep5 file which specifies licenses for files which don't contain
them in a form which can be automatically parse by the reuse tool. REUSE
does not alter copyrights or licenses, simply captures information about
licensing to ensure the entire repository has explicit licensing information.

To ensure continued REUSE compliance, run `reuse lint` at the root of
a clean, checked-out repository periodically, or run it during CI tests
before any build artifacts have been created.


text:
FROM buildpack-deps:stretch-scm

# labels
LABEL description="Debian with node8 & chrome" \
      maintainer="https://github.com/tw-devops" \
      display-name="Debian Node8 & Chrome" \
      tags="debian,node8,yarn"

# https://hub.docker.com/r/markadams/chromium-xvfb/~/dockerfile/
RUN apt-get update && apt-get install -y curl xvfb chromium

ADD xvfb-chromium /usr/bin/xvfb-chromium
RUN ln -s /usr/bin/xvfb-chromium /usr/bin/google-chrome
RUN ln -s /usr/bin/xvfb-chromium /usr/bin/chromium-browser

# install nodejs and yarnpkg
RUN apt-get install xz-utils
ENV NPM_CONFIG_LOGLEVEL info
ENV NODE_VERSION 8.6.0
ENV YARN_VERSION 1.1.0

RUN curl -SLO https://nodejs.org/dist/v8.6.0/node-v${NODE_VERSION}-linux-x64.tar.xz && \
    tar -Jxf node-v${NODE_VERSION}-linux-x64.tar.xz -C /usr/local/ --strip-components=1 && \
    rm node-v${NODE_VERSION}-linux-x64.tar.xz && \
    ln -s /usr/local/bin/node /usr/local/bin/nodejs

RUN npm install --global yarn@${YARN_VERSION}

CMD echo node=$(node -v), npm=$(npm -v), yarn=$(yarn -v)

redpajama_set_name: RedPajamaGithub


text:
      Posted on

      by

      Deleted User


text:
/* Keyboard config common to ECOS and zephyr */

#include "keyboard_raw.h"
#include "keyboard_scan.h"
#include "timer.h"

/* Keyboard scan setting */
__override struct keyboard_scan_config keyscan_config = {
	/* Increase from 50 us, because KSO_02 passes through the H1. */
	.output_settle_us = 80,
	/* Other values should be the same as the default configuration. */
	.debounce_down_us = 9 * MSEC,
	.debounce_up_us = 30 * MSEC,
	.scan_period_us = 3 * MSEC,
	.min_post_scan_delay_us = 1000,
	.poll_timeout_us = 100 * MSEC,
	.actual_key_mask = {
		0x14, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff,
		0xa4, 0xff, 0xfe, 0x55, 0xfa, 0xca  /* full set */
	},
};


text:
include_recipe "tomcat"

if node["webapp"]["remote_deploy"]
# remote deployment: get file from web site

remote_file node["tomcat"]["webapp_dir"]+"/"+node["webapp"]["webapp"]  do
    notifies :restart, resources(:service => "tomcat")
    source node["webapp"]["webserver"] + node["webapp"]["webapp"]
    owner "root"
    group "root"
    mode "0644"
end

else
  # local deployment by copying a file
  cookbook_file node["tomcat"]["webapp_dir"]+"/"+node["webapp"]["webapp"] do
    notifies :restart, resources(:service => "tomcat")
    source node["webapp"]["webapp"]
    owner "root"
    group "root"
    mode "0644"
  end
end


text:
from ..registry_tools import iso_register
from .core import UnitedStates

@iso_register('US-NH')
class NewHampshire(UnitedStates):
    """New Hampshire"""
    include_thanksgiving_friday = True
    martin_luther_king_label = "Martin Luther King, Jr. Civil Rights Day"


text:
package org.apache.accumulo.server.data;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

import org.apache.accumulo.core.data.ColumnUpdate;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.thrift.TMutation;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.WritableUtils;

/**
 * Mutation that holds system time as computed by the tablet server when not provided by the user.
 */
public class ServerMutation extends Mutation {
  private long systemTime = 0l;

  public ServerMutation(TMutation tmutation) {
    super(tmutation);
  }

  public ServerMutation(Text key) {
    super(key);
  }

  public ServerMutation() {
  }

  protected void droppingOldTimestamp(long ts) {
    this.systemTime = ts;
  }

  @Override
  public void readFields(DataInput in) throws IOException {
    super.readFields(in);
    // new format writes system time with the mutation
    if (getSerializedFormat() == SERIALIZED_FORMAT.VERSION2)
      systemTime = WritableUtils.readVLong(in);
  }

  @Override
  public void write(DataOutput out) throws IOException {
    super.write(out);
    WritableUtils.writeVLong(out, systemTime);
  }

  public void setSystemTimestamp(long v) {
    this.systemTime = v;
  }

  public long getSystemTimestamp() {
    return this.systemTime;
  }

  @Override
  protected ColumnUpdate newColumnUpdate(byte[] cf, byte[] cq, byte[] cv, boolean hasts, long ts, boolean deleted, byte[] val) {
    return new ServerColumnUpdate(cf, cq, cv, hasts, ts, deleted, val, this);
  }

  @Override
  public long estimatedMemoryUsed() {
    return super.estimatedMemoryUsed() + 8;
  }
}


text:
local Gamestate = require 'vendor/gamestate'
local anim8 = require 'vendor/anim8'
local window = require 'window'
local fonts = require 'fonts'
local timer = require 'vendor/timer'
local Prompt = require 'prompt'
local Dialog = require 'dialog'
local camera = require 'camera'
local state = Gamestate.new()
local sound = require 'vendor/TEsound'
local cardutils = require 'cardutils'

function state:init( )
    self.table = love.graphics.newImage( 'images/cards/card_table_blackjack.png' )

    self.cardSprite = love.graphics.newImage('images/cards/cards.png' )
    self.card_width = 38
    self.card_height = 55
    self.cardbacks = 6

    self.chipSprite = love.graphics.newImage('images/cards/chips.png' )
    self.chip_width = 13
    self.chip_height = 13
    self.chips = {
        -- black ( $100 )
        love.graphics.newQuad( self.chip_width, self.chip_height, self.chip_width, self.chip_height, self.chipSprite:getWidth(), self.chipSprite:getHeight() ),
        -- green ( $25 )
        love.graphics.newQuad( 0, self.chip_height * 2, self.chip_width, self.chip_height, self.chipSprite:getWidth(), self.chipSprite:getHeight() ),
        -- blue ( $10 )
        love.graphics.newQuad( 0, self.chip_height, self.chip_width, self.chip_height, self.chipSprite:getWidth(), self.chipSprite:getHeight() ),
        -- red ( $5 )
        love.graphics.newQuad( 0, 0, self.chip_width, self.chip_height, self.chipSprite:getWidth(), self.chipSprite:getHeight() ),
        -- white ( $1 )
        love.graphics.newQuad( self.chip_width, 0, self.chip_width, self.chip_height, self.chipSprite:getWidth(), self.chipSprite:getHeight() )
    }

    self.max_card_room = 227
    self.width_per_card = 45

    self.decks_to_use = 8

    self.card_speed = 0.5
    self.current_splits = 0
    self.activeHandNum = 1

    self.options_arrow = love.graphics.newImage( 'images/menu/tiny_arrow.png' )
    self.options = {
        { name = 'HIT', action = 'hit' },
        { name = 'STAND', action = 'stand' },
        { name = 'DOUBLE', action = 'double_down' },
        { name = 'SPLIT', action = 'split' },
        { name = 'DEAL', action = 'deal' },
        { name = 'BET +', action = 'bet_up' },
        { name = 'BET -', action = 'bet_down' },
        { name = 'QUIT', action = 'quit', active = true },
    }
    self.selection = 4

    self.player_bets={}
    self.player_bets[1] = 2

end

function state:enter(previous, player, screenshot)
    sound.playMusic( "tavern" )
    --lazy because i want to reset all position data
    fonts.set( 'big' )

    self.previous = previous
    self.screenshot = screenshot

    self:initTable()
    self:dealMenu()

    self.player = player

    self.cardback_idx = math.random( self.cardbacks ) - 1

    self.cardback = love.graphics.newQuad( self.cardback_idx * self.card_width, self.card_height * 4, self.card_width, self.card_height, self.cardSprite:getWidth(), self.cardSprite:getHeight() )

    self.chip_x = 168 + camera.x
    self.chip_y = 237 + camera.y

    self.center_x = ( window.width / 2 ) + camera.x
    self.center_y = ( window.height / 2 ) + camera.y
    self.dealer_stack_x = 386 + camera.x
    self.dealer_stack_y = 66 + camera.y

    self.dealer_result_pos_x = 346 + camera.x
    self.dealer_result_pos_y = 89 + camera.y

    self.outcome_pos_x = 225 + camera.x
    self.outcome_pos_y = 141 + camera.y

    self.options_x = 395 + camera.x
    self.options_y = 145 + camera.y
    self.selection = 4
    self.player_bets={}
    self.player_bets[1] = 2

end

function state:leave()
    fonts.reset()
    -- camera.x = self.camera_x
end

function state:keypressed( button, player )

        if button == 'JUMP' and self.selected == 'QUIT' then
            Prompt.new("Are you sure you want to exit?", function(result)
                if result == 'Yes' then
                    Gamestate.switch(self.previous)
                else
                    Prompt.currentDialog = nil
                end
            end )
        end

        if button == 'JUMP' then
            if self.selected == 'DEAL' then
                self:dealHand()
            elseif self.selected == 'HIT' then
                if not self.cards_moving then self:hit() end
            elseif self.selected == 'STAND' then
                if not self.cards_moving then self:stand() end
            elseif self.selected == 'DOUBLE' then
                if not self.cards_moving then self:double() end
            elseif self.selected == 'SPLIT' then
                if not self.cards_moving then self:split() end
            elseif self.selected == 'BET +' then
                if self.player_bets[1] < self.player.money then self.player_bets[1] = self.player_bets[1] + 1 end
            elseif self.selected == 'BET -' then
                if self.player_bets[1] > 1 then self.player_bets[1] = self.player_bets[1] - 1 end
            end
        end

        if button == 'UP' then
            repeat
                self.selection = (self.selection - 1) % #self.options
            until self.options[ self.selection + 1 ].active
        elseif button == 'DOWN' then
            repeat
                self.selection = (self.selection + 1) % #self.options
            until self.options[ self.selection + 1 ].active
        end

end

function state:gameMenu()
        -- fix the menu
        self.selection = 0                          -- hit
        self.options[ 1 ].active = true             -- hit
        self.options[ 2 ].active = true             -- stand
        if self.player_bets[1] < self.player.money then
            self.options[ 3 ].active = true         -- double
        else
            self.options[ 3 ].active = false        -- double
        end
        if self.player_bets[1] < self.player.money and
           self.current_splits < 1 and
           self.player_cards[self.activeHandNum][1].card==self.player_cards[self.activeHandNum][2].card then
               self.options[ 4 ].active = true      -- split
        else
            self.options[ 4 ].active = false        -- split
        end
        self.options[ 5 ].active = false            -- deal
        self.options[ 6 ].active = false            -- bet
        self.options[ 7 ].active = false            -- bet
end

function state:dealMenu()
        -- fix the menu
        self.selection = 4                          -- deal
        self.options[ 1 ].active = false            -- hit
        self.options[ 2 ].active = false            -- stand
        self.options[ 3 ].active = false            -- double
        self.options[ 4 ].active = false            -- split
        self.options[ 5 ].active = true             -- deal
        self.options[ 6 ].active = true             -- bet
        self.options[ 7 ].active = true             -- bet
end

function state:update(dt)
    self.cards_moving = self:update_cards( self.player_cards, self.dealer_cards, dt )
    self.selected = self.options[ self.selection + 1 ].name
end
--fix it
function state:update_cards( plyr, delr, dt )
    curPlyr = plyr[self.activeHandNum]
    if curPlyr and delr then
        max = math.max( #curPlyr, #delr )
        moved = false
        for i = 1, max, 1 do
            if not moved then
                if curPlyr[i] then
                    moved = self:move_card( curPlyr[i], dt )
                end
                if delr[i] and not moved then
                    moved = self:move_card( delr[i], dt )
                end
            end
        end
        if not moved and self.card_complete_callback then
            self.card_complete_callback()
        end
    end
    return moved
end

function state:move_card( card, dt )
    moved = false
    if card.move_idx < self.card_speed then
        moved = true
        card.move_idx = card.move_idx + dt
    else
        card.move_idx = self.card_speed
    end

    if card.face_up then
        if card.flip_idx < self.card_speed then
            moved = true
            card.flip_idx = card.flip_idx + dt
        else
            card.flip_idx = self.card_speed
        end
    end
    return moved
end

function state:initTable()
    -- clear everyones cards
    self.dealer_cards = {}
    self.player_cards = {} --multidimensional array of cards

    -- make a new deck
    self.deck = cardutils.newDeck( self.decks_to_use )

    -- no scores yet
    self.dealer_hand = nil
    self.player_hands = {}
    _myBet = self.player_bets[1]
    self.player_bets = {}
    self.player_bets[1] = _myBet

    self.player_done = false
    self.dealer_done = false

    self.outcome = nil
end

function state:dealHand()
    self:initTable()

    self.player_cards[1]={}
    self.original_bet = self.player_bets[1]
    -- deal first 4 cards
    self:dealCard( 'player' ,1)
    self:dealCard( 'dealer' ,0) --should always be zero
    self:dealCard( 'player' ,1)
    self:dealCard( 'dealer' ,0) --should always be zero

    self:gameMenu()

    if self.player_cards[self.activeHandNum][1].card==self.player_cards[self.activeHandNum][2].card then
       self.options[ 4 ].active = true     -- split
    else
       self.options[ 4 ].active = false     -- split
    end

    if self:bestScore( self.player_hands[1]) == 21 then
    --check for 21
        self:stand()
    end
end

--handNum indicates current hand in split
function state:dealCard( to)
    deal_card = table.remove( self.deck, 1 )

    x = 293 + camera.x
    face_up = true
    hand = self.player_cards[ self.activeHandNum ]

    y = 169 + ( self.activeHandNum - 1 ) * 9 + camera.y

    if to == 'dealer' then
        -- second card is not shown
        if #self.dealer_cards == 1 then
            face_up = false
            -- when drawing complete, peek at the card and check for blackjack
            self.card_complete_callback = function()
                self.card_complete_callback = nil
                if ( self.dealer_cards[1].card == 1 and self.dealer_cards[2].card >= 10 ) or
                   ( self.dealer_cards[1].card >= 10 and self.dealer_cards[2].card == 1 ) then
                    self:stand()
                end
            end
        end
        hand = self.dealer_cards
        y = 66 + camera.y
    end
    table.insert(
        hand,
        {
            card = deal_card.card,
            suit = deal_card.suit,
            x = x - ( self.width_per_card * #hand ),
            y = y,
            move_idx = 0,
            flip_idx = 0,
            face_up = face_up
        }
    )

    if to == 'dealer' then
        self:updateScore( self.dealer_cards)
    else
        self:updateScore( self.player_cards)
    end

    -- adjust widths when we've run out of room
    if #hand * self.width_per_card >= self.max_card_room then
        new_width = self.max_card_room / #hand
        for i,n in pairs( hand ) do
            -- no idea why I need this hocus pocus, but it seems to work
            n.x = x - math.floor( ( new_width - 2 ) * ( i - 1 ) )
        end
    end
end

function state:hit()
    if #self.player_cards[self.activeHandNum] > 1 then
        self.options[ 3 ].active = false     -- disable doubling
    end

    self.options[ 4 ].active = false     -- disable splitting

    -- throw a card
    self:dealCard( 'player' )
    -- bust or still alive?
    self.card_complete_callback =function()
        self.card_complete_callback = nil
        _alive = false
        if self:bestScore( self.player_hands[self.activeHandNum] ) < 21 then
            _alive = true
        end
        if not _alive then
            self:stand()
        end
    end
end

function state:double()
    -- double bet
    self.player_bets[ self.activeHandNum ] = self.player_bets[ self.activeHandNum ] * 2

    -- throw a card
    self:dealCard( 'player' )

    -- stand
    self.card_complete_callback =function()
        self.card_complete_callback = nil
        self:stand()
    end

end

function state:split()
    self.selection = 0 -- hit

    --split stub
    self.current_splits = self.current_splits + 1;

    --add a new hand
    newHandNum = self.current_splits + 1;

    --reallocate money
    self.player_bets[newHandNum] = self.player_bets[newHandNum-1]

    --move 2nd card to new row
    self.player_cards[newHandNum] = {}
    self.player_cards[newHandNum][1] = self.player_cards[1][newHandNum]
    self.player_cards[newHandNum][1].y = 169 + camera.y + ( newHandNum - 1 ) * 9
    self.player_cards[newHandNum][1].x = self.player_cards[1][1].x

    self.player_cards[1][2] = nil

    --deal cards
    self.activeHandNum=newHandNum-1
    self:hit();
end

function state:stand()
    if self.current_splits == self.activeHandNum then
        self.activeHandNum = self.activeHandNum + 1
        self:hit()
        return
    end

    self.player_done = true
    self.current_splits = 0
    self.activeHandNum = 1

    -- if not a bust or blackjack, play out the dealers hand
    doPlayDealer=false;
    for curHandNum=1,#self.player_bets do
        if self:bestScore( self.player_hands[curHandNum] ) < 21 then
            doPlayDealer = true
            break
        end
    end

    if doPlayDealer then
        while self:bestScore( self.dealer_hand ) < 17 do
            if not self.dealer_cards[ 2 ].face_up then
                self.dealer_cards[ 2 ].face_up = true
                self:updateScore( self.dealer_cards)
            else
                self:dealCard( 'dealer' )
            end
        end
    else
        --flip the dealer over and move on
        self.dealer_cards[ 2 ].face_up = true
        self:updateScore( self.dealer_cards, 0 )
    end

    self.card_complete_callback = function()
        self.card_complete_callback = nil
        self.dealer_done = true

        for curHandNum=1,#self.player_bets do

        -- determine win, loss, push
        -- allocate winnings accordingly
        if self:bestScore( self.player_hands[curHandNum] ) == 21 and #self.player_cards[curHandNum] == 2
            and self:bestScore( self.dealer_hand ) ~= 21 then
            -- player got blackjack!
            self.player.money = self.player.money + ( self.player_bets[curHandNum] * 2 )
            self.outcome = 'You have Blackjack!\nYou Win!'
        elseif self:bestScore( self.dealer_hand ) == 21 and #self.dealer_cards == 2
            and self:bestScore( self.player_hands[1] ) ~= 21 then
            -- dealer got blackjack!
            self.player.money = self.player.money - self.player_bets[curHandNum]
            self.outcome = 'Dealer has Blackjack.\nYou Lose.'
        elseif self:bestScore( self.dealer_hand ) == 22 then
            -- dealer bust, player wins
            self.player.money = self.player.money + self.player_bets[curHandNum]
            self.outcome = 'Dealer busted.\nYou Win!'
        elseif self:bestScore( self.player_hands[curHandNum] ) == 22 then
            -- player pust, player loses
            self.player.money = self.player.money - self.player_bets[curHandNum]
            self.outcome = 'Busted. You Lose.'
        elseif self:bestScore( self.dealer_hand ) == self:bestScore( self.player_hands[curHandNum] ) then
            -- push, no winner
            self.outcome = 'It\'s a push.'
        elseif self:bestScore( self.dealer_hand ) < self:bestScore( self.player_hands[curHandNum] ) then
            -- player beat dealer, player wins
            self.player.money = self.player.money + self.player_bets[curHandNum]
            self.outcome = 'You Win!'
        else
            -- player lost to dealer, player loses
            self.player.money = self.player.money - self.player_bets[curHandNum]
            self.outcome = 'You Lost.'
        end

    end
        if self.player.money == 0 then
            self:gameOver()
        end

        self.player_bets[1] = self.original_bet

        if self.player.money < self.player_bets[1] then
            self.player_bets[1] = self.player.money
        end

        self:dealMenu()

    end
end

function state:gameOver()
    Dialog.new("Game Over.", function(result)
        Gamestate.switch(self.previous)
    end )
end

function state:bestScore( tbl )
    -- scores should be sorted
    _best = 22
    for _,v in pairs( tbl ) do
        if v <= 21 then
            _best = v
        end
    end
    return _best
end

function state:scoreCounter(tbl)
    score = {}
    for i,n in pairs( tbl ) do
        if n.face_up then
            if n.card == 1 then -- ace
                points = { 1, 11 }
            elseif n.card > 10 then -- face
                points = { 10 }
            else
                points = { n.card }
            end
            score = self:addPointsToScore( points, score )
        end
    end
    return score
end

function state:updateScore( tbl )
    score = {}
    if tbl == self.dealer_cards then
        score = self:scoreCounter(tbl);
        self.dealer_hand = score
    else
        score = self:scoreCounter(tbl[self.activeHandNum]);
        self.player_hands[self.activeHandNum] = score
    end
end

function state:addPointsToScore( points, score )
    _new = {}
    if #score == 0 then
        _new = points
    else
        for i = 1, #score, 1 do
            for j = 1, #points, 1 do
                table.insert( _new, score[i] + points[j] )
            end
        end
    end
    table.sort( _new )
    _no_dup = {}
    last = nil
    for x = 1, #_new, 1 do
        if _new[x] ~= last then
            table.insert( _no_dup, _new[x] )
            last = _new[x]
        end
    end
    return _no_dup
end

function state:draw()
    if self.screenshot then
        love.graphics.draw( self.screenshot, camera.x, camera.y, 0, window.width / love.graphics:getWidth(), window.height / love.graphics:getHeight() )
    else
        love.graphics.setColor( 0, 0, 0, 255 )
        love.graphics.rectangle( 'fill', 0, 0, love.graphics:getWidth(), love.graphics:getHeight() )
        love.graphics.setColor( 255, 255, 255, 255 )
    end

    love.graphics.draw( self.table, self.center_x - ( self.table:getWidth() / 2 ), self.center_y - ( self.table:getHeight() / 2 ) )

    --dealer stack
    love.graphics.drawq( self.cardSprite, self.cardback, self.dealer_stack_x, self.dealer_stack_y )

    if self.dealer_cards then
        for i,n in pairs( self.dealer_cards ) do
            self:drawCard(
                n.card, n.suit,                                                    -- card / suit
                map( n.flip_idx, 0, self.card_speed, 0, 100 ),                     -- flip
                map( n.move_idx, 0, self.card_speed, self.dealer_stack_x, n.x ),   -- x
                map( n.move_idx, 0, self.card_speed, self.dealer_stack_y, n.y )    -- y
            )
        end
    end

    for idx = 1, #self.player_cards do
    if self.player_cards[idx] then
        for i,n in pairs( self.player_cards[idx] ) do
            self:drawCard(
                n.card, n.suit,                                                    -- card / suit
                map( n.flip_idx, 0, self.card_speed, 0, 100 ),                     -- flip
                map( n.move_idx, 0, self.card_speed, self.dealer_stack_x, n.x ),   -- x
                map( n.move_idx, 0, self.card_speed, self.dealer_stack_y, n.y ),   -- y
                idx ~= self.activeHandNum and not self.player_done
            )
        end
    end
    end
    for i,n in pairs( self.options ) do
        local x = self.options_x
        local y = self.options_y + ( i * 15 )
        co = 0 -- color offset
        if not n.active then co = 180 end
        if i == self.selection + 1 then
            love.graphics.setColor( 255, 255, 255, 255 )
            love.graphics.draw( self.options_arrow, x - 5, y + 4 )
            co = 255
        end
        love.graphics.setColor( 255 - co, 255 - co, 255 - co )
        love.graphics.print( n.name, x + 3, y + 3, 0, 0.5 )
    end
    love.graphics.setColor( 255, 255, 255, 255 )

    cx = 0 -- chip offset x
    for color,count in pairs( cardutils.getChipCounts( self.player.money ) ) do
        cy = 0 -- chip offset y ( start at top )
        -- draw full stacks first
        for s = 1, math.floor( count / 5 ), 1 do
            for i = 0, 4, 1 do
                love.graphics.drawq( self.chipSprite, self.chips[ color ], self.chip_x + cx - i, self.chip_y + cy - i )
            end
            -- change the coords
            if s % 2 == 0 then --even
                cy = 0 --top
                cx = cx + self.chip_width --shift over
            else --odd
                cy = self.chip_height --bottom
            end
        end
        for i = 0, count % 5 - 1, 1 do
             love.graphics.drawq( self.chipSprite, self.chips[ color ], self.chip_x + cx - i, self.chip_y + cy - i )
        end
        -- shift the drawpoint left for the next stack
        if count > 0 then -- something was actually drawn
            if count % 5 == 0 and cy == 0 then
                cx = cx + 4
            else
                cx = cx + self.chip_width + 4
            end
        end
    end

    if self.dealer_done then
        _score = self:bestScore( self.dealer_hand )
        if _score == 22 then
            love.graphics.print( "BUST", self.dealer_result_pos_x, self.dealer_result_pos_y, 0, 0.5 )
        else
            love.graphics.print( _score, self.dealer_result_pos_x + 7, self.dealer_result_pos_y, 0, 0.5 )
        end
    end

    --fix
    if self.player_done then
      for i=1,#self.player_hands do
        _score = self:bestScore( self.player_hands[i] )
        if _score == 22 then
            love.graphics.print( "BUST", self.dealer_result_pos_x, self.dealer_result_pos_y +101+(i-1)*14, 0, 0.5 )
        else
            love.graphics.print( _score, self.dealer_result_pos_x + 7, self.dealer_result_pos_y +101+(i-1)*14, 0, 0.5 )
        end
      end
    end

    if self.outcome then
        love.graphics.print( self.outcome, self.outcome_pos_x, self.outcome_pos_y, 0, 0.5 )
    end

    love.graphics.print( 'On Hand\n $ ' .. self.player.money, 110+camera.x, 244+camera.y, 0, 0.5 )

    love.graphics.print( 'Bet $ ' .. self.player_bets[1], 361+camera.x, 141+camera.y, 0, 0.5 )

    love.graphics.setColor( 255, 255, 255, 255 )
end

function state:drawCard( card, suit, flip, x, y, overlay )
    -- flip is a number from 0 to 100, where 0 is completely face down, and 100 is completely face up
    local w = self.card_width   -- card width
    local h = self.card_height  -- card height
    local st = 0.2              -- stretched top
    local sh = h * ( 1 + st )   -- stretched height
    local limit
    if flip > 50 then
        limit = 100
        _card = love.graphics.newQuad( ( card - 1 ) * w, ( suit - 1 ) * h, w, h, self.cardSprite:getWidth(), self.cardSprite:getHeight() )
    else
        limit = 0
        _card = self.cardback
    end
    darkness = map( flip, 50, limit, 100, 255 )
    if(overlay) then
        darkness = 150
    end
    love.graphics.setColor( darkness, darkness, darkness )
    love.graphics.drawq(
        self.cardSprite, _card,                             -- image, quad
        x + map( flip, 50, limit, w / 2, 0 ),               -- offset for flip
        map( flip, 50, limit, y - ( ( sh - h ) / 2 ), y ),  -- height offset
        0,                                                  -- no rotation
        map( flip, 50, limit, 0, 1 ),                       -- scale width for flip
        map( flip, 50, limit , 1 + st, 1 )                  -- scale height for flip
    )

    love.graphics.setColor( 255, 255, 255, 255 )
end

return state


text:
package jp.scriptkidie.datacopy.sql.model.cosmos;

import java.math.BigDecimal;

public class Gasmtr {
    private Integer syabanNo;

    private Short syabanSeqNo;

    private Integer gmtTritukeYmd;

    private Integer gmtTrihazsYmd;

    private String gmtKataKigCd;

    private BigDecimal gmtGoSu;

    private String mcnContSezNo;

    private Short sjisuHjKetSu;

    private Integer sjisuKkhntSu;

    private Integer kenteiYukoYm;

    private String kojiGaisyaCd;

    private String syuriCd;

    private String gmtTrtJiyCd;

    private String gmtTrkRiyCd;

    private String gmtTrhJiyCd;

    private String mcnRoeiKhCd;

    private String mcnKzkSydnCd;

    private String mcnKutTrokCd;

    private String mcnKanSydnCd;

    private String mcnAtuSydnCd;

    private String mcnKbtSydnCd;

    private String mcnKeiSydnCd;

    private Integer mcnSttHnkYmd;

    private String hoseiSoutiCd;

    private BigDecimal sijisSaisyoSu;

    private String gibRendkSbCd;

    private Long trtkGmtSetNo;

    private Integer recRegYmd;

    private Integer recUpdYmd;

    private Short recUpdJnjNo;

    public Integer getSyabanNo() {
        return syabanNo;
    }

    public void setSyabanNo(Integer syabanNo) {
        this.syabanNo = syabanNo;
    }

    public Short getSyabanSeqNo() {
        return syabanSeqNo;
    }

    public void setSyabanSeqNo(Short syabanSeqNo) {
        this.syabanSeqNo = syabanSeqNo;
    }

    public Integer getGmtTritukeYmd() {
        return gmtTritukeYmd;
    }

    public void setGmtTritukeYmd(Integer gmtTritukeYmd) {
        this.gmtTritukeYmd = gmtTritukeYmd;
    }

    public Integer getGmtTrihazsYmd() {
        return gmtTrihazsYmd;
    }

    public void setGmtTrihazsYmd(Integer gmtTrihazsYmd) {
        this.gmtTrihazsYmd = gmtTrihazsYmd;
    }

    public String getGmtKataKigCd() {
        return gmtKataKigCd;
    }

    public void setGmtKataKigCd(String gmtKataKigCd) {
        this.gmtKataKigCd = gmtKataKigCd == null ? null : gmtKataKigCd.trim();
    }

    public BigDecimal getGmtGoSu() {
        return gmtGoSu;
    }

    public void setGmtGoSu(BigDecimal gmtGoSu) {
        this.gmtGoSu = gmtGoSu;
    }

    public String getMcnContSezNo() {
        return mcnContSezNo;
    }

    public void setMcnContSezNo(String mcnContSezNo) {
        this.mcnContSezNo = mcnContSezNo == null ? null : mcnContSezNo.trim();
    }

    public Short getSjisuHjKetSu() {
        return sjisuHjKetSu;
    }

    public void setSjisuHjKetSu(Short sjisuHjKetSu) {
        this.sjisuHjKetSu = sjisuHjKetSu;
    }

    public Integer getSjisuKkhntSu() {
        return sjisuKkhntSu;
    }

    public void setSjisuKkhntSu(Integer sjisuKkhntSu) {
        this.sjisuKkhntSu = sjisuKkhntSu;
    }

    public Integer getKenteiYukoYm() {
        return kenteiYukoYm;
    }

    public void setKenteiYukoYm(Integer kenteiYukoYm) {
        this.kenteiYukoYm = kenteiYukoYm;
    }

    public String getKojiGaisyaCd() {
        return kojiGaisyaCd;
    }

    public void setKojiGaisyaCd(String kojiGaisyaCd) {
        this.kojiGaisyaCd = kojiGaisyaCd == null ? null : kojiGaisyaCd.trim();
    }

    public String getSyuriCd() {
        return syuriCd;
    }

    public void setSyuriCd(String syuriCd) {
        this.syuriCd = syuriCd == null ? null : syuriCd.trim();
    }

    public String getGmtTrtJiyCd() {
        return gmtTrtJiyCd;
    }

    public void setGmtTrtJiyCd(String gmtTrtJiyCd) {
        this.gmtTrtJiyCd = gmtTrtJiyCd == null ? null : gmtTrtJiyCd.trim();
    }

    public String getGmtTrkRiyCd() {
        return gmtTrkRiyCd;
    }

    public void setGmtTrkRiyCd(String gmtTrkRiyCd) {
        this.gmtTrkRiyCd = gmtTrkRiyCd == null ? null : gmtTrkRiyCd.trim();
    }

    public String getGmtTrhJiyCd() {
        return gmtTrhJiyCd;
    }

    public void setGmtTrhJiyCd(String gmtTrhJiyCd) {
        this.gmtTrhJiyCd = gmtTrhJiyCd == null ? null : gmtTrhJiyCd.trim();
    }

    public String getMcnRoeiKhCd() {
        return mcnRoeiKhCd;
    }

    public void setMcnRoeiKhCd(String mcnRoeiKhCd) {
        this.mcnRoeiKhCd = mcnRoeiKhCd == null ? null : mcnRoeiKhCd.trim();
    }

    public String getMcnKzkSydnCd() {
        return mcnKzkSydnCd;
    }

    public void setMcnKzkSydnCd(String mcnKzkSydnCd) {
        this.mcnKzkSydnCd = mcnKzkSydnCd == null ? null : mcnKzkSydnCd.trim();
    }

    public String getMcnKutTrokCd() {
        return mcnKutTrokCd;
    }

    public void setMcnKutTrokCd(String mcnKutTrokCd) {
        this.mcnKutTrokCd = mcnKutTrokCd == null ? null : mcnKutTrokCd.trim();
    }

    public String getMcnKanSydnCd() {
        return mcnKanSydnCd;
    }

    public void setMcnKanSydnCd(String mcnKanSydnCd) {
        this.mcnKanSydnCd = mcnKanSydnCd == null ? null : mcnKanSydnCd.trim();
    }

    public String getMcnAtuSydnCd() {
        return mcnAtuSydnCd;
    }

    public void setMcnAtuSydnCd(String mcnAtuSydnCd) {
        this.mcnAtuSydnCd = mcnAtuSydnCd == null ? null : mcnAtuSydnCd.trim();
    }

    public String getMcnKbtSydnCd() {
        return mcnKbtSydnCd;
    }

    public void setMcnKbtSydnCd(String mcnKbtSydnCd) {
        this.mcnKbtSydnCd = mcnKbtSydnCd == null ? null : mcnKbtSydnCd.trim();
    }

    public String getMcnKeiSydnCd() {
        return mcnKeiSydnCd;
    }

    public void setMcnKeiSydnCd(String mcnKeiSydnCd) {
        this.mcnKeiSydnCd = mcnKeiSydnCd == null ? null : mcnKeiSydnCd.trim();
    }

    public Integer getMcnSttHnkYmd() {
        return mcnSttHnkYmd;
    }

    public void setMcnSttHnkYmd(Integer mcnSttHnkYmd) {
        this.mcnSttHnkYmd = mcnSttHnkYmd;
    }

    public String getHoseiSoutiCd() {
        return hoseiSoutiCd;
    }

    public void setHoseiSoutiCd(String hoseiSoutiCd) {
        this.hoseiSoutiCd = hoseiSoutiCd == null ? null : hoseiSoutiCd.trim();
    }

    public BigDecimal getSijisSaisyoSu() {
        return sijisSaisyoSu;
    }

    public void setSijisSaisyoSu(BigDecimal sijisSaisyoSu) {
        this.sijisSaisyoSu = sijisSaisyoSu;
    }

    public String getGibRendkSbCd() {
        return gibRendkSbCd;
    }

    public void setGibRendkSbCd(String gibRendkSbCd) {
        this.gibRendkSbCd = gibRendkSbCd == null ? null : gibRendkSbCd.trim();
    }

    public Long getTrtkGmtSetNo() {
        return trtkGmtSetNo;
    }

    public void setTrtkGmtSetNo(Long trtkGmtSetNo) {
        this.trtkGmtSetNo = trtkGmtSetNo;
    }

    public Integer getRecRegYmd() {
        return recRegYmd;
    }

    public void setRecRegYmd(Integer recRegYmd) {
        this.recRegYmd = recRegYmd;
    }

    public Integer getRecUpdYmd() {
        return recUpdYmd;
    }

    public void setRecUpdYmd(Integer recUpdYmd) {
        this.recUpdYmd = recUpdYmd;
    }

    public Short getRecUpdJnjNo() {
        return recUpdJnjNo;
    }

    public void setRecUpdJnjNo(Short recUpdJnjNo) {
        this.recUpdJnjNo = recUpdJnjNo;
    }
}