text:
/*
Navicat MySQL Data Transfer

Source Server         : localhost
Source Server Version : 50527
Source Host           : localhost:3306
Source Database       : gaps

Target Server Type    : MYSQL
Target Server Version : 50527
File Encoding         : 65001

Date: 2015-05-11 23:22:22
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for `company`
-- ----------------------------
DROP TABLE IF EXISTS `company`;
CREATE TABLE `company` (
  `com_id` int(10) NOT NULL AUTO_INCREMENT,
  `com_code` varchar(30) NOT NULL DEFAULT '0',
  `com_domain` varchar(30) NOT NULL DEFAULT 'gapps.co.id',
  `com_name` varchar(50) DEFAULT NULL,
  `com_description` varchar(500) DEFAULT NULL,
  `com_ico` varchar(50) DEFAULT NULL,
  `com_logo` varchar(50) DEFAULT NULL,
  `com_img_header` varchar(50) DEFAULT NULL,
  `com_img_footer` varchar(50) DEFAULT NULL,
  `com_address` varchar(500) DEFAULT NULL,
  `com_tlp` varchar(20) DEFAULT NULL,
  `com_fax` varchar(20) DEFAULT NULL,
  `com_email` varchar(20) DEFAULT NULL,
  `com_url_wallet` varchar(200) DEFAULT NULL,
  `com_url_commerce` varchar(200) DEFAULT NULL,
  `com_tpl_path` varchar(200) DEFAULT NULL,
  `com_asset_path` varchar(200) DEFAULT NULL,
  `com_asset_url` varchar(200) DEFAULT NULL,
  `com_url_success` varchar(200) DEFAULT NULL,
  `com_url_failed` varchar(200) DEFAULT NULL,
  `create_at` datetime DEFAULT NULL,
  `modified_at` datetime DEFAULT NULL,
  PRIMARY KEY (`com_id`),
  UNIQUE KEY `com_id` (`com_id`) USING BTREE,
  KEY `com_code` (`com_code`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;

-- ----------------------------
-- Records of company
-- ----------------------------
INSERT INTO `company` VALUES ('1', '1015', 'garuda.code-paper.com', 'Garuda', null, 'cd6a2deb.png', '4d7f0556.jpg', 'b54d30ef.jpg', 'eea20004.jpg', 'Jalan semua', '123456', '654321', 'company@email.com', ' http://103.43.66.52:8080/', ' http://103.43.66.52:8080/', '/mainApp/sites/gaps/web/public/garuda', '/mainApp/sites/gaps/web/public/garuda/assets', null, 'http://garuda.code-peeper.com/home', 'http://garuda.code-peeper.com/home', '2015-04-26 18:07:26', null);
INSERT INTO `company` VALUES ('3', '1015', 'astra.code-peeper.com', 'Astra', null, 'b83baff4.gif', '46fed7fb.gif', '2053f03c.gif', 'eedc814e.gif', 'Jalan semua', '123456', '654321', 'company@email.com', ' http://103.43.66.52:8080/', ' http://103.43.66.52:8080/', '/mainApp/sites/gaps/web/public/template/astra', '/mainApp/sites/gaps/web/public/template/astra/assets', 'http://astra.code-peeper.com/template/astra/assets', 'http://astra.code-peeper.com/landing', 'http://astra.code-peeper.com/landing', '2015-05-03 16:49:29', '2015-05-03 18:01:51');

-- ----------------------------
-- Table structure for `company_param`
-- ----------------------------
DROP TABLE IF EXISTS `company_param`;
CREATE TABLE `company_param` (
  `com_id` int(10) DEFAULT NULL,
  `param` varchar(100) DEFAULT NULL,
  `values` varchar(100) DEFAULT NULL,
  `url` varchar(200) DEFAULT NULL,
  KEY `com_id` (`com_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- ----------------------------
-- Records of company_param
-- ----------------------------
INSERT INTO `company_param` VALUES (null, 'loginbox', '#0000ff', null);
INSERT INTO `company_param` VALUES (null, 'bg222', '#0a0a48', null);
INSERT INTO `company_param` VALUES (null, 'navigation', '#064606', null);
INSERT INTO `company_param` VALUES (null, 'headernav', '#052205', null);
INSERT INTO `company_param` VALUES (null, 'profile', '#090926', null);
INSERT INTO `company_param` VALUES ('3', 'loginbox', '', null);
INSERT INTO `company_param` VALUES ('3', 'bg222', '', null);
INSERT INTO `company_param` VALUES ('3', 'navigation', '', null);
INSERT INTO `company_param` VALUES ('3', 'headernav', '', null);
INSERT INTO `company_param` VALUES ('3', 'profile', '', null);

-- ----------------------------
-- Table structure for `controller`
-- ----------------------------
DROP TABLE IF EXISTS `controller`;
CREATE TABLE `controller` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `controller` varchar(255) DEFAULT NULL,
  `title` varchar(255) DEFAULT NULL,
  `is_menu` tinyint(1) NOT NULL DEFAULT '0',
  `group_id` int(11) NOT NULL DEFAULT '1',
  `order` int(11) DEFAULT NULL,
  `cssicon` varchar(20) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `idx` (`id`) USING BTREE,
  KEY `con` (`controller`,`title`,`group_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=latin1;

-- ----------------------------
-- Records of controller
-- ----------------------------
INSERT INTO `controller` VALUES ('1', 'user/index', 'User List', '1', '1', '99', 'fa-desktop');
INSERT INTO `controller` VALUES ('2', 'user/edit', 'Edit User', '0', '1', null, null);
INSERT INTO `controller` VALUES ('3', 'user/add', 'Add User', '0', '1', null, null);
INSERT INTO `controller` VALUES ('4', 'user/delete', 'Delete User', '0', '1', null, null);
INSERT INTO `controller` VALUES ('5', 'controller/index', 'Controller List', '1', '1', '98', 'fa-desktop');
INSERT INTO `controller` VALUES ('6', 'controller/add', 'Add Controller', '0', '1', null, null);
INSERT INTO `controller` VALUES ('7', 'controller/edit', 'Edit Controller', '0', '1', null, null);
INSERT INTO `controller` VALUES ('8', 'controller/delete', 'Delete Controller', '0', '1', null, null);
INSERT INTO `controller` VALUES ('9', 'user/access', 'User Access', '0', '1', '97', 'fa-desktop');
INSERT INTO `controller` VALUES ('10', 'access/add', 'Add Access', '0', '1', null, null);
INSERT INTO `controller` VALUES ('11', 'access/edit', 'Edit Access', '0', '1', null, null);
INSERT INTO `controller` VALUES ('12', 'access/delete', 'Delete Access', '0', '1', null, null);
INSERT INTO `controller` VALUES ('13', 'portal/index', 'List Portal', '1', '2', '1', 'fa-files-o');
INSERT INTO `controller` VALUES ('14', 'portal/add', 'Add Portal', '0', '2', null, null);
INSERT INTO `controller` VALUES ('15', 'portal/edit', 'Edit Portal', '0', '2', null, null);
INSERT INTO `controller` VALUES ('16', 'portal/delete', 'Delete Portal', '0', '2', null, null);
INSERT INTO `controller` VALUES ('17', 'user/access', 'User Access', '0', '1', null, null);
INSERT INTO `controller` VALUES ('19', 'transaksi/index', 'Transaksi', '1', '4', '2', 'fa-shopping-cart');
INSERT INTO `controller` VALUES ('20', 'transaksi/detail', 'Detail Transaksi', '0', '4', '3', '');
INSERT INTO `controller` VALUES ('21', 'transaksi/kirim', 'Aprrove Transaksi', '0', '4', '2', '');
INSERT INTO `controller` VALUES ('22', 'tracking/index', 'Tracking order', '1', '5', '3', 'fa-flag');
INSERT INTO `controller` VALUES ('23', 'tracking/addhistory', 'Add history', '0', '5', '3', '');
INSERT INTO `controller` VALUES ('24', 'tracking/detail', 'Detail Tracking', '0', '5', '3', '');
INSERT INTO `controller` VALUES ('25', 'transaksi/batal', 'Batalkan Transaksi', '0', '4', '2', '');
INSERT INTO `controller` VALUES ('26', 'report/index', 'Report Transaksi', '1', '6', '5', 'fa-file');

-- ----------------------------
-- Table structure for `order_delivery`
-- ----------------------------
DROP TABLE IF EXISTS `order_delivery`;
CREATE TABLE `order_delivery` (
  `delivery_id` int(10) NOT NULL AUTO_INCREMENT,
  `order_code` varchar(50) DEFAULT NULL,
  `user_id` varchar(50) DEFAULT NULL,
  `delivery_nama` varchar(100) DEFAULT NULL,
  `delivery_email` varchar(50) DEFAULT NULL,
  `delivery_tlp` varchar(20) DEFAULT NULL,
  `delivery_tipe` varchar(10) DEFAULT NULL,
  `delivery_kota` varchar(50) DEFAULT NULL,
  `delivery_alamat` varchar(500) DEFAULT NULL,
  `delivery_kodepos` varchar(10) DEFAULT NULL,
  `delivery_rt` varchar(20) DEFAULT NULL,
  `delivery_rw` varchar(20) DEFAULT NULL,
  `delivery_by` varchar(10) DEFAULT NULL,
  `delivery_ket` varchar(500) DEFAULT NULL,
  `create_at` datetime DEFAULT NULL,
  `modified_at` datetime DEFAULT NULL,
  PRIMARY KEY (`delivery_id`),
  UNIQUE KEY `delivery_id` (`delivery_id`) USING BTREE,
  KEY `order_code` (`order_code`) USING BTREE,
  KEY `user_id` (`user_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;

-- ----------------------------
-- Records of order_delivery
-- ----------------------------
INSERT INTO `order_delivery` VALUES ('1', 'ORD12345', '1015087782256719', 'noverda', 'noverda@gmail.com', '087782256719', 'rumah', null, 'jl swadaya 1 no 16', '12510', '10', '009', 'JNE', 'keterangan delivery', '2015-05-04 21:23:16', null);
INSERT INTO `order_delivery` VALUES ('2', 'ORD23456', '1015087782256719', 'noverda', 'noverda@gmail.com', '087782256719', 'rumah', null, 'jl swadaya 1 no 16', '12510', '10', '009', 'JNE', 'keterangan delivery', '2015-05-06 08:03:22', null);

-- ----------------------------
-- Table structure for `order_detail`
-- ----------------------------
DROP TABLE IF EXISTS `order_detail`;
CREATE TABLE `order_detail` (
  `detail_id` int(11) NOT NULL AUTO_INCREMENT,
  `order_code` varchar(50) DEFAULT NULL,
  `com_code` varchar(30) DEFAULT NULL,
  `item_id` int(10) DEFAULT NULL,
  `item_name` varchar(100) DEFAULT NULL,
  `item_price` double DEFAULT NULL,
  `item_desc` text,
  `item_img` varchar(100) DEFAULT NULL,
  `item_size` varchar(10) DEFAULT NULL,
  `item_color` varchar(10) DEFAULT NULL,
  `item_disc` int(5) DEFAULT NULL,
  `item_qty` int(5) DEFAULT NULL,
  `item_subtotal` double DEFAULT NULL,
  `create_at` datetime DEFAULT NULL,
  `modified_at` datetime DEFAULT NULL,
  PRIMARY KEY (`detail_id`),
  UNIQUE KEY `detail_id` (`detail_id`) USING BTREE,
  KEY `order_code` (`order_code`) USING BTREE,
  KEY `com_code` (`com_code`) USING BTREE,
  KEY `item_id` (`item_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;

-- ----------------------------
-- Records of order_detail
-- ----------------------------
INSERT INTO `order_detail` VALUES ('1', 'ORD12345', '1015', '4', 'baju', '50000', ' some describe', 'http://gaps.co.id/img/product.png', 'XL', 'Blue', '0', '1', '50000', '2015-05-04 21:23:16', null);
INSERT INTO `order_detail` VALUES ('2', 'ORD12345', '1015', '4', 'baju2', '50000', ' some describe', 'http://gaps.co.id/img/product.png', 'XL', 'Blue', '0', '1', '50000', '2015-05-04 21:23:16', null);
INSERT INTO `order_detail` VALUES ('3', 'ORD23456', '1015', '4', 'baju', '50000', ' some describe', 'http://gaps.co.id/img/product.png', 'XL', 'Blue', '0', '1', '50000', '2015-05-06 08:03:22', null);
INSERT INTO `order_detail` VALUES ('4', 'ORD23456', '1015', '4', 'baju2', '50000', ' some describe', 'http://gaps.co.id/img/product.png', 'XL', 'Blue', '0', '1', '50000', '2015-05-06 08:03:22', null);

-- ----------------------------
-- Table structure for `order_header`
-- ----------------------------
DROP TABLE IF EXISTS `order_header`;
CREATE TABLE `order_header` (
  `order_id` int(11) NOT NULL AUTO_INCREMENT,
  `order_code` varchar(50) DEFAULT NULL,
  `user_id` varchar(50) DEFAULT NULL,
  `order_total` double DEFAULT NULL,
  `order_date` datetime DEFAULT NULL,
  `order_status` tinyint(2) DEFAULT '0' COMMENT '{0=pending;1=dikirim;2=batal;}',
  `create_at` datetime DEFAULT NULL,
  `modified_at` datetime DEFAULT NULL,
  PRIMARY KEY (`order_id`),
  UNIQUE KEY `order_code` (`order_code`) USING BTREE,
  KEY `user_id` (`user_id`) USING BTREE,
  KEY `status` (`order_status`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;

-- ----------------------------
-- Records of order_header
-- ----------------------------
INSERT INTO `order_header` VALUES ('1', 'ORD12345', '1015087782256719', '50000', '2015-05-05 19:30:00', '1', '2015-05-04 21:23:16', '2015-05-08 10:56:07');
INSERT INTO `order_header` VALUES ('2', 'ORD23456', '1015087782256719', '50000', '2015-05-05 19:40:00', '2', '2015-05-06 08:03:22', '2015-05-08 10:58:55');

-- ----------------------------
-- Table structure for `order_history`
-- ----------------------------
DROP TABLE IF EXISTS `order_history`;
CREATE TABLE `order_history` (
  `history_id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` varchar(50) DEFAULT NULL,
  `order_code` varchar(50) DEFAULT NULL,
  `history_date` datetime DEFAULT NULL,
  `history_desc` text,
  `history_status` varchar(20) DEFAULT 'Pending',
  `create_at` datetime DEFAULT NULL,
  `modified_at` datetime DEFAULT NULL,
  `user_act` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`history_id`),
  KEY `order_code` (`order_code`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;

-- ----------------------------
-- Records of order_history
-- ----------------------------
INSERT INTO `order_history` VALUES ('1', '1015087782256719', 'ORD12345', '2015-05-05 19:30:00', 'Transaksi sedang di proses', 'Pending', '2015-05-04 21:23:16', null, null);
INSERT INTO `order_history` VALUES ('2', '1015087782256719', 'ORD23456', '2015-05-05 19:30:00', 'Transaksi dalam proses verifikasi', 'Pending', '2015-05-06 08:03:22', null, null);
INSERT INTO `order_history` VALUES ('3', '1015087782256719', 'ORD12345', '2015-05-08 10:55:45', 'Barang sedang dalam proses pengiriman', 'Sukses', '2015-05-08 10:55:45', null, 'admin');
INSERT INTO `order_history` VALUES ('4', '1015087782256719', 'ORD12345', '2015-05-08 10:56:07', 'Barang sedang dalam proses pengiriman', 'Sukses', '2015-05-08 10:56:07', null, 'admin');
INSERT INTO `order_history` VALUES ('5', '1015087782256719', 'ORD23456', '2015-05-08 10:58:55', 'Order telah di batalkan', 'Gagal', '2015-05-08 10:58:55', null, 'admin');
INSERT INTO `order_history` VALUES ('6', '1015087782256719', 'ORD12345', '2015-05-08 00:00:00', 'tambahan', 'Sukses', '2015-05-08 11:34:23', null, 'admin');

-- ----------------------------
-- Table structure for `slide`
-- ----------------------------
DROP TABLE IF EXISTS `slide`;
CREATE TABLE `slide` (
  `slide_id` int(10) NOT NULL AUTO_INCREMENT,
  `com_id` int(10) DEFAULT NULL,
  `slide_img` varchar(100) DEFAULT NULL,
  `slide_order` tinyint(1) DEFAULT NULL,
  `slide_active` tinyint(1) DEFAULT NULL,
  `create_at` datetime DEFAULT NULL,
  `modified_at` datetime DEFAULT NULL,
  PRIMARY KEY (`slide_id`),
  UNIQUE KEY `slide_id` (`slide_id`) USING BTREE,
  KEY `com_id` (`com_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- ----------------------------
-- Records of slide
-- ----------------------------

-- ----------------------------
-- Table structure for `ugroup`
-- ----------------------------
DROP TABLE IF EXISTS `ugroup`;
CREATE TABLE `ugroup` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `group_name` varchar(50) DEFAULT NULL,
  `merchant` int(3) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;

-- ----------------------------
-- Records of ugroup
-- ----------------------------
INSERT INTO `ugroup` VALUES ('1', 'ADMIN', null);
INSERT INTO `ugroup` VALUES ('2', 'PORTAL', null);
INSERT INTO `ugroup` VALUES ('3', 'LAYOUT', null);
INSERT INTO `ugroup` VALUES ('4', 'TRANSAKSI', null);
INSERT INTO `ugroup` VALUES ('5', 'TRACKING', null);
INSERT INTO `ugroup` VALUES ('6', 'REPORT', null);

-- ----------------------------
-- Table structure for `user`
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
  `uid` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(100) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `password` varchar(100) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `nama` varchar(100) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `email` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `telpon` varchar(100) NOT NULL,
  `aktif` tinyint(1) NOT NULL,
  PRIMARY KEY (`uid`),
  UNIQUE KEY `id` (`uid`) USING BTREE,
  KEY `username` (`username`),
  KEY `aktif` (`aktif`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of user
-- ----------------------------
INSERT INTO `user` VALUES ('1', 'admin', 'c93ccd78b2076528346216b3b2f701e6', 'admin', 'admin@gaps.co.id', '123456', '1');
INSERT INTO `user` VALUES ('3', 'noverda', 'e10adc3949ba59abbe56e057f20f883e', 'noverda', 'noverda@gmail.com', '123456', '1');

-- ----------------------------
-- Table structure for `user_access`
-- ----------------------------
DROP TABLE IF EXISTS `user_access`;
CREATE TABLE `user_access` (
  `uid` int(11) NOT NULL,
  `controller_id` int(11) NOT NULL,
  KEY `uid` (`uid`,`controller_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of user_access
-- ----------------------------
INSERT INTO `user_access` VALUES ('1', '1');
INSERT INTO `user_access` VALUES ('1', '2');
INSERT INTO `user_access` VALUES ('1', '3');
INSERT INTO `user_access` VALUES ('1', '4');
INSERT INTO `user_access` VALUES ('1', '5');
INSERT INTO `user_access` VALUES ('1', '6');
INSERT INTO `user_access` VALUES ('1', '7');
INSERT INTO `user_access` VALUES ('1', '8');
INSERT INTO `user_access` VALUES ('1', '9');
INSERT INTO `user_access` VALUES ('1', '10');
INSERT INTO `user_access` VALUES ('1', '11');
INSERT INTO `user_access` VALUES ('1', '12');
INSERT INTO `user_access` VALUES ('1', '13');
INSERT INTO `user_access` VALUES ('1', '14');
INSERT INTO `user_access` VALUES ('1', '15');
INSERT INTO `user_access` VALUES ('1', '16');
INSERT INTO `user_access` VALUES ('1', '17');
INSERT INTO `user_access` VALUES ('1', '19');
INSERT INTO `user_access` VALUES ('1', '20');
INSERT INTO `user_access` VALUES ('1', '21');
INSERT INTO `user_access` VALUES ('1', '22');
INSERT INTO `user_access` VALUES ('1', '23');
INSERT INTO `user_access` VALUES ('1', '24');
INSERT INTO `user_access` VALUES ('1', '25');
INSERT INTO `user_access` VALUES ('1', '26');
INSERT INTO `user_access` VALUES ('3', '1');
INSERT INTO `user_access` VALUES ('3', '2');
INSERT INTO `user_access` VALUES ('3', '3');
INSERT INTO `user_access` VALUES ('3', '4');
INSERT INTO `user_access` VALUES ('3', '13');
INSERT INTO `user_access` VALUES ('3', '14');
INSERT INTO `user_access` VALUES ('3', '15');
INSERT INTO `user_access` VALUES ('3', '16');

-- ----------------------------
-- Table structure for `user_group`
-- ----------------------------
DROP TABLE IF EXISTS `user_group`;
CREATE TABLE `user_group` (
  `uid` int(11) DEFAULT NULL,
  `group_id` int(11) DEFAULT NULL,
  KEY `uid` (`uid`,`group_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- ----------------------------
-- Records of user_group
-- ----------------------------
INSERT INTO `user_group` VALUES ('0', '1');
INSERT INTO `user_group` VALUES ('1', '1');
INSERT INTO `user_group` VALUES ('1', '2');
INSERT INTO `user_group` VALUES ('1', '3');
INSERT INTO `user_group` VALUES ('1', '4');
INSERT INTO `user_group` VALUES ('1', '5');
INSERT INTO `user_group` VALUES ('1', '6');


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.servicio.reparaciones.modelo.nosql;

import com.servicio.reparaciones.util.entity.BaseEntity;
import java.util.Objects;
import org.mongodb.morphia.annotations.Embedded;
import org.mongodb.morphia.annotations.Entity;
import org.mongodb.morphia.annotations.Field;
import org.mongodb.morphia.annotations.Index;
import org.mongodb.morphia.annotations.Indexes;

/**
 *
 * @author luis
 */
@Entity(value = "Usuario", noClassnameStored = true)
@Indexes({
    @Index(fields = @Field("codigo"))})
public class Usuario extends BaseEntity {

    private Integer codigo;
    private String username;
    private String password;
    private Boolean estado;
    private Boolean admin;
    private String userEnable;
    private Integer flag;

    @Embedded
    private InformacionPersonal datosPersonales;

    public Usuario() {
        this.estado = Boolean.FALSE;
        this.admin = Boolean.FALSE;
        this.datosPersonales = new InformacionPersonal();
    }

    public Usuario(String username, String password) {
        this.username = username;
        this.password = password;
    }

    public Integer getCodigo() {
        return codigo;
    }

    public void setCodigo(Integer codigo) {
        this.codigo = codigo;
    }

    public String getUsername() {
        return username;
    }

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

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Boolean getEstado() {
        return estado;
    }

    public void setEstado(Boolean estado) {
        this.estado = estado;
    }

    public Boolean getAdmin() {
        return admin;
    }

    public void setAdmin(Boolean admin) {
        this.admin = admin;
    }

    public String getUserEnable() {
        return userEnable;
    }

    public void setUserEnable(String userEnable) {
        this.userEnable = userEnable;
    }

    public Integer getFlag() {
        return flag;
    }

    public void setFlag(Integer flag) {
        this.flag = flag;
    }

    public InformacionPersonal getDatosPersonales() {
        return datosPersonales;
    }

    public void setDatosPersonales(InformacionPersonal datosPersonales) {
        this.datosPersonales = datosPersonales;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 79 * hash + Objects.hashCode(this.codigo);
        hash = 79 * hash + Objects.hashCode(this.username);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Usuario other = (Usuario) obj;
        if (!Objects.equals(this.username, other.username)) {
            return false;
        }
        if (!Objects.equals(this.codigo, other.codigo)) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Usuario{" + "codigo=" + codigo + ", username=" + username + ", password=" + password + ", estado=" + estado + ", admin=" + admin + ", userEnable=" + userEnable + ", flag=" + flag + ", datosPersonales=" + datosPersonales + '}';
    }
}

redpajama_set_name: RedPajamaGithub


text:
from __future__ import print_function
"""

    test_job_history_with_exceptions.py

        Make sure that when an exception is thrown only the current and following tasks fail

"""

workdir = 'tmp_test_job_history_with_exceptions'
#sub-1s resolution in system?
one_second_per_job = None
throw_exception = False

import os
import sys

# add grandparent to search path for testing
grandparent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
sys.path.insert(0, grandparent_dir)

# module name = script name without extension
module_name = os.path.splitext(os.path.basename(__file__))[0]

# funky code to import by file name
parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
ruffus_name = os.path.basename(parent_dir)
ruffus = __import__ (ruffus_name)
for attr in "pipeline_run", "pipeline_printout", "suffix", "transform", "split", "merge", "dbdict", "follows", "originate", "collate", "formatter", "Pipeline":
    globals()[attr] = getattr (ruffus, attr)
RethrownJobError =  ruffus.ruffus_exceptions.RethrownJobError
RUFFUS_HISTORY_FILE           = ruffus.ruffus_utility.RUFFUS_HISTORY_FILE
CHECKSUM_FILE_TIMESTAMPS      = ruffus.ruffus_utility.CHECKSUM_FILE_TIMESTAMPS
get_default_history_file_name = ruffus.ruffus_utility.get_default_history_file_name

#88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
#
#   imports
#88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888

import unittest
import shutil
try:
    from StringIO import StringIO
except:
    from io import StringIO
import re

#___________________________________________________________________________
#
#   generate_initial_files1
#___________________________________________________________________________
@originate([workdir +  "/" + prefix + "_name.tmp1" for prefix in "abcd"])
def generate_initial_files1(on):
    with open(on, 'w') as outfile:
        pass

#___________________________________________________________________________
#
#   generate_initial_files2
#___________________________________________________________________________
@originate([workdir +  "/e_name.tmp1", workdir +  "/f_name.tmp1"])
def generate_initial_files2(on):
    with open(on, 'w') as outfile:
        pass

#___________________________________________________________________________
#
#   generate_initial_files3
#___________________________________________________________________________
@originate([workdir +  "/g_name.tmp1", workdir +  "/h_name.tmp1"])
def generate_initial_files3(on):
    with open(on, 'w') as outfile:
        pass

#___________________________________________________________________________
#
#   generate_initial_files1
#___________________________________________________________________________
@originate(workdir +  "/i_name.tmp1")
def generate_initial_files4(on):
    with open(on, 'w') as outfile:
        pass

#___________________________________________________________________________
#
#   test_task2
#___________________________________________________________________________
@collate([generate_initial_files1, generate_initial_files2, generate_initial_files3,
            generate_initial_files4],
         formatter(),
         "{path[0]}/all.tmp2")
#@transform([generate_initial_files1, generate_initial_files2, generate_initial_files3,
#            generate_initial_files4],
#            formatter( ),
#            "{path[0]}/{basename[0]}.tmp2")
def test_task2( infiles, outfile):
    with open(outfile, "w") as p:
        pass
    #print >>sys.stderr, "8" * 80, "\n", "    task2 :%s %s " % (infiles, outfile)

#___________________________________________________________________________
#
#   test_task3
#___________________________________________________________________________
@transform(test_task2, suffix(".tmp2"), ".tmp3")
def test_task3( infile, outfile):
    global throw_exception
    if throw_exception != None:
        throw_exception = not throw_exception
    if throw_exception:
        #print >>sys.stderr, "Throw exception for ", infile, outfile
        raise Exception("oops")
    else:
        #print >>sys.stderr, "No throw exception for ", infile, outfile
        pass
    with open(outfile, "w") as p: pass
    #print >>sys.stderr, "8" * 80, "\n", "    task3 :%s %s " % (infile, outfile)

#___________________________________________________________________________
#
#   test_task4
#___________________________________________________________________________
@transform(test_task3, suffix(".tmp3"), ".tmp4")
def test_task4( infile, outfile):
    with open(outfile, "w") as p: pass
    #print >>sys.stderr, "8" * 80, "\n", "    task4 :%s %s " % (infile, outfile)

def cleanup_tmpdir():
    os.system('rm -f %s %s' % (os.path.join(workdir, '*'), RUFFUS_HISTORY_FILE))

VERBOSITY = 5
VERBOSITY = 11

cnt_pipelines = 0
class Test_job_history_with_exceptions(unittest.TestCase):
    def setUp(self):
        try:
            os.mkdir(workdir)
        except OSError:
            pass

    #___________________________________________________________________________
    #
    #   test product() pipeline_printout and pipeline_run
    #___________________________________________________________________________
    def test_job_history_with_exceptions(self):
        cleanup_tmpdir()
        s = StringIO()
        pipeline_printout(s, [test_task4], verbose=VERBOSITY, wrap_width = 10000, pipeline= "main")
        #print s.getvalue()

    def create_pipeline (self):
        #each pipeline has a different name
        global cnt_pipelines
        cnt_pipelines = cnt_pipelines + 1
        test_pipeline = Pipeline("test %d" % cnt_pipelines)

        test_pipeline.originate(task_func   = generate_initial_files1,
                                output      = [workdir +  "/" + prefix + "_name.tmp1" for prefix in "abcd"])

        test_pipeline.originate(task_func   = generate_initial_files2,
                                output      = [workdir +  "/e_name.tmp1", workdir +  "/f_name.tmp1"])

        test_pipeline.originate(task_func   = generate_initial_files3,
                                output      = [workdir +  "/g_name.tmp1", workdir +  "/h_name.tmp1"])

        test_pipeline.originate(task_func   = generate_initial_files4,
                                output      = workdir +  "/i_name.tmp1")

        test_pipeline.collate(  task_func   = test_task2,
                                input       = [generate_initial_files1,
                                               generate_initial_files2,
                                               generate_initial_files3,
                                               generate_initial_files4],
                                filter      = formatter(),
                                output      = "{path[0]}/all.tmp2")

        test_pipeline.transform(task_func   = test_task3,
                                input       = test_task2,
                                filter      = suffix(".tmp2"),
                                output      = ".tmp3")

        test_pipeline.transform(task_func   = test_task4,
                                input       = test_task3,
                                filter      = suffix(".tmp3"),
                                output      = ".tmp4")
        return test_pipeline

    def test_job_history_with_exceptions_run(self):
        """Run"""
        for i in range(1):
            cleanup_tmpdir()
            try:
                pipeline_run([test_task4], verbose = 0,
                             #multithread = 2,
                             one_second_per_job = one_second_per_job, pipeline= "main")
            except:
                pass
            s = StringIO()
            pipeline_printout(s, [test_task4], verbose=VERBOSITY, wrap_width = 10000, pipeline= "main")
            #
            # task 2 should be up to date because exception was throw in task 3
            #
            pipeline_printout_str = s.getvalue()
            correct_order = not re.search('Tasks which will be run:.*\n(.*\n)*Task = test_task2', pipeline_printout_str)
            if not correct_order:
                print(pipeline_printout_str)
            self.assertTrue(correct_order)
            sys.stderr.write(".")
        print()

    def test_newstyle_recreate_job_history(self):
        """Run"""
        test_pipeline = self.create_pipeline()
        global throw_exception
        throw_exception = None
        cleanup_tmpdir()

        #
        #      print "Initial run without creating sqlite file"
        #
        test_pipeline.run([test_task4], verbose = 0,
                     checksum_level = CHECKSUM_FILE_TIMESTAMPS,
                     multithread = 10,
                     one_second_per_job = one_second_per_job)

        #
        #   print "printout without sqlite"
        #
        s = StringIO()
        test_pipeline.printout(s, [test_task4], checksum_level = CHECKSUM_FILE_TIMESTAMPS)
        self.assertTrue(not re.search('Tasks which will be run:.*\n(.*\n)*Task = ', s.getvalue()))
        #
        # print "printout expecting sqlite file"
        #
        s = StringIO()
        test_pipeline.printout(s, [test_task4])
        self.assertTrue(re.search('Tasks which will be run:.*\n(.*\n)*Task = ', s.getvalue()))
        #
        #   print "Regenerate sqlite file"
        #
        test_pipeline.run([test_task4],
                     checksum_level = CHECKSUM_FILE_TIMESTAMPS,
                     history_file = get_default_history_file_name (),
                     multithread = 1,
                     verbose = 0,
                     touch_files_only = 2,
                     one_second_per_job = one_second_per_job)
        #
        # print "printout expecting sqlite file"
        #
        s = StringIO()
        test_pipeline.printout(s, [test_task4], verbose = VERBOSITY)
        succeed = not re.search('Tasks which will be run:.*\n(.*\n)*Task = ', s.getvalue())
        if not succeed:
            print(s.getvalue(), file=sys.stderr)
        self.assertTrue(succeed)

        throw_exception = False

    #
    def test_newstyle_job_history_with_exceptions_run(self):
        """Run"""
        test_pipeline = self.create_pipeline()
        for i in range(1):
            cleanup_tmpdir()
            try:
                test_pipeline.run([test_task4], verbose = 0,
                             #multithread = 2,
                             one_second_per_job = one_second_per_job)
            except:
                pass
            s = StringIO()
            test_pipeline.printout(s, [test_task4], verbose=VERBOSITY, wrap_width = 10000)
            #
            # task 2 should be up to date because exception was throw in task 3
            #
            pipeline_printout_str = s.getvalue()
            correct_order = not re.search('Tasks which will be run:.*\n(.*\n)*Task = test_task2', pipeline_printout_str)
            if not correct_order:
                print(pipeline_printout_str)
            self.assertTrue(correct_order)
            sys.stderr.write(".")
        print()

    def test_recreate_job_history(self):
        """Run"""
        global throw_exception
        throw_exception = None
        cleanup_tmpdir()

        #
        #      print "Initial run without creating sqlite file"
        #
        pipeline_run([test_task4], verbose = 0,
                     checksum_level = CHECKSUM_FILE_TIMESTAMPS,
                     multithread = 10,
                     one_second_per_job = one_second_per_job, pipeline= "main")

        #
        #   print "printout without sqlite"
        #
        s = StringIO()
        pipeline_printout(s, [test_task4], checksum_level = CHECKSUM_FILE_TIMESTAMPS, pipeline= "main")
        self.assertTrue(not re.search('Tasks which will be run:.*\n(.*\n)*Task = ', s.getvalue()))
        #
        # print "printout expecting sqlite file"
        #
        s = StringIO()
        pipeline_printout(s, [test_task4], pipeline= "main")
        self.assertTrue(re.search('Tasks which will be run:.*\n(.*\n)*Task = ', s.getvalue()))
        #
        #   print "Regenerate sqlite file"
        #
        pipeline_run([test_task4],
                     checksum_level = CHECKSUM_FILE_TIMESTAMPS,
                     history_file = get_default_history_file_name (),
                     multithread = 1,
                     verbose = 0,
                     touch_files_only = 2,
                     one_second_per_job = one_second_per_job, pipeline= "main")
        #
        # print "printout expecting sqlite file"
        #
        s = StringIO()
        pipeline_printout(s, [test_task4], verbose = VERBOSITY, pipeline= "main")
        succeed = not re.search('Tasks which will be run:.*\n(.*\n)*Task = ', s.getvalue())
        if not succeed:
            print(s.getvalue(), file=sys.stderr)
        self.assertTrue(succeed)

        throw_exception = False

    #___________________________________________________________________________
    #
    #   cleanup
    #___________________________________________________________________________
    def tearDown(self):
        shutil.rmtree(workdir)
        pass

#
#   Necessary to protect the "entry point" of the program under windows.
#       see: http://docs.python.org/library/multiprocessing.html#multiprocessing-programming
#
if __name__ == '__main__':
    #pipeline_printout(sys.stdout, [test_product_task], verbose = VERBOSITY, pipeline= "main")
    unittest.main()


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>statsmodels.tsa.vector_ar.dynamic.DynamicVAR — statsmodels 0.6.1 documentation</title>

    <link rel="stylesheet" href="../_static/nature.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />

    <link rel="shortcut icon" href="../_static/statsmodels_hybi_favico.ico"/>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="top" title="statsmodels 0.6.1 documentation" href="../index.html" />
    <link rel="up" title="Time Series analysis tsa" href="../tsa.html" />
    <link rel="next" title="statsmodels.tsa.vector_ar.dynamic.DynamicVAR.T" href="statsmodels.tsa.vector_ar.dynamic.DynamicVAR.T.html" />
    <link rel="prev" title="statsmodels.tsa.vector_ar.var_model.FEVD.summary" href="statsmodels.tsa.vector_ar.var_model.FEVD.summary.html" />
<link rel="stylesheet" href="../../_static/facebox.css" type="text/css" />
<link rel="stylesheet" href="../_static/examples.css" type="text/css" />

Navigation

          index

          next |

          previous |

Install
  |

Support
  |

Bugs
  |

Develop
  |

Examples
  |

FAQ
  |

Time Series analysis tsa |

statsmodels.tsa.vector_ar.dynamic.DynamicVAR¶

class statsmodels.tsa.vector_ar.dynamic.DynamicVAR(data, lag_order=1, window=None, window_type='expanding', trend='c', min_periods=None)[source]¶

Estimates time-varying vector autoregression (VAR(p)) using
equation-by-equation least squares

<col class="field-name" />
<col class="field-body" />

Parameters:
data : pandas.DataFrame

lag_order : int, default 1

window : int

window_type : {‘expanding’, ‘rolling’}

min_periods : int or None

Minimum number of observations to require in window, defaults to window
size if None specified

trend : {‘c’, ‘nc’, ‘ct’, ‘ctt’}

TODO

Returns:
Attributes:

coefs : WidePanel

items : coefficient names
major_axis : dates
minor_axis : VAR equation names

Methods

<colgroup>
<col width="10%" />
<col width="90%" />
</colgroup>

T()
Number of time periods in results

coefs()
Return dynamic regression coefficients as WidePanel

equations()

forecast([steps])
Produce dynamic forecast

plot_forecast([steps, figsize])
Plot h-step ahead forecasts against actual realizations of time series.

r2()
Returns the r-squared values.

resid()

Attributes

<colgroup>
<col width="10%" />
<col width="90%" />
</colgroup>

nobs

result_index

Previous topic

statsmodels.tsa.vector_ar.var_model.FEVD.summary

Next topic

statsmodels.tsa.vector_ar.dynamic.DynamicVAR.T

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

    Enter search terms or a module, class or function name.

        © Copyright 2009-2013, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers.
      Created using Sphinx 1.3.1.


text:
require 'spec_helper'

RSpec.describe Spree::CheckoutController, type: :controller do
	let!(:user) { create(:egift_user) }
	let(:egift_card) {FactoryGirl.create(:egift_card)}
	let(:order) { FactoryGirl.create(:order_for_egift) }

	before(:each) { @routes = Spree::Core::Engine.routes }

	before do
    allow(controller).to receive_messages try_spree_current_user: user
    allow(controller).to receive_messages spree_current_user: user
    allow(controller).to receive_messages current_order: order
  end

	context "update" do
		before do
			allow(controller).to receive_messages check_authorization: true
			allow(controller).to receive_messages ensure_sufficient_stock_lines: true
			allow(controller).to receive_messages ensure_checkout_allowed: true
			allow(controller).to receive_messages set_state_if_present: true
			allow(controller).to receive_messages ensure_valid_state: true
			allow(order).to receive_messages item_total: 30.0
		end

		it "apply gift card if code is correct" do
			put :update, state: 'payment', order: {gift_code: egift_card.code, pin: egift_card.pin}
			expect(assigns(:order).gift_code).to eq(egift_card.code)
			expect(assigns(:gift_card).code).to eq(egift_card.code)
			expect(egift_card.order_activatable?(assigns(:order))).to be true
			expect(assigns(:order).item_total).to eq(30.0)
			expect(egift_card.compute_amount(assigns(:order))).to eq(-30.0)
			expect(flash[:success]).to be_present
			expect(response.status).to eq(302)
		end

		it "doesn't apply gift card if currency mismatch" do
			egift_card.currency = 'FOO'
			egift_card.save
			put :update, state: 'payment', order: {gift_code: egift_card.code}
			expect(assigns(:order).gift_code).to eq(egift_card.code)
			expect(assigns(:gift_card).code).to eq(egift_card.code)
			expect(egift_card.order_activatable?(assigns(:order))).to be true
			expect(flash[:error]).to be_present
			expect(response.status).to eq(200)
		end

		it "doesn't apply gift card if region mismatch" do
			order.region = Spree::Region.create(code: 'TOTO')
			egift_card.save
			put :update, state: 'payment', order: {gift_code: egift_card.code}
			expect(assigns(:order).gift_code).to eq(egift_card.code)
			expect(assigns(:gift_card).code).to eq(egift_card.code)
			expect(egift_card.order_activatable?(assigns(:order))).to be true
			expect(flash[:error]).to be_present
			expect(response.status).to eq(200)
		end

		it "doesn't apply gift card if store mismatch" do
			order.store = Spree::Store.create(code: 'TOTO')
			egift_card.save
			put :update, state: 'payment', order: {gift_code: egift_card.code}
			expect(assigns(:order).gift_code).to eq(egift_card.code)
			expect(assigns(:gift_card).code).to eq(egift_card.code)
			expect(egift_card.order_activatable?(assigns(:order))).to be true
			expect(flash[:error]).to be_present
			expect(response.status).to eq(200)
		end

		it "doesn't apply gift if code is incorrect" do
			put :update, state: 'payment', order: {gift_code: 'WRONG'}
			expect(flash[:error]).to be_present
			expect(response.status).to eq(200)
		end
	end

end


text:
int pixmap_write_jpg(const struct pixmap* img, const char* filename);

#endif


text:
CKEDITOR.plugins.setLang( 'about', 'es', {
	copy: 'Copyright © $1. Todos los derechos reservados.',
	dlgTitle: 'Acerca de CKEditor',
	help: 'Lea la  $1 para resolver sus dudas.',
	moreInfo: 'Para información de licencia, por favor visite nuestro sitio web:',
	title: 'Acerca de CKEditor',
	userGuide: 'Guía de usuario de CKEditor'
});


text:
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using BatteryCommander.Web.Models;

namespace BatteryCommander.Web.Migrations
{
    [DbContext(typeof(Database))]
    [Migration("20170922140210_Vehicle-TowBarFuelCard")]
    partial class VehicleTowBarFuelCard
    {
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
            modelBuilder
                .HasAnnotation("ProductVersion", "1.1.1");

            modelBuilder.Entity("BatteryCommander.Web.Models.ABCP", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd();

                    b.Property<DateTime>("Date")
                        .HasColumnType("date");

                    b.Property<decimal>("Height");

                    b.Property<string>("MeasurementsJson");

                    b.Property<int>("SoldierId");

                    b.Property<int>("Weight");

                    b.HasKey("Id");

                    b.HasIndex("SoldierId");

                    b.ToTable("ABCPs");
                });

            modelBuilder.Entity("BatteryCommander.Web.Models.APFT", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd();

                    b.Property<byte>("AerobicEvent");

                    b.Property<DateTime>("Date")
                        .HasColumnType("date");

                    b.Property<int>("PushUps");

                    b.Property<int>("RunSeconds");

                    b.Property<int>("SitUps");

                    b.Property<int>("SoldierId");

                    b.HasKey("Id");

                    b.HasIndex("SoldierId");

                    b.ToTable("APFTs");
                });

            modelBuilder.Entity("BatteryCommander.Web.Models.Evaluation", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd();

                    b.Property<int?>("EvaluationId");

                    b.Property<int>("RateeId");

                    b.Property<int>("RaterId");

                    b.Property<int?>("ReviewerId");

                    b.Property<int>("SeniorRaterId");

                    b.Property<DateTime>("StartDate")
                        .HasColumnType("date");

                    b.Property<byte>("Status");

                    b.Property<DateTime>("ThruDate")
                        .HasColumnType("date");

                    b.Property<byte>("Type");

                    b.HasKey("Id");

                    b.HasIndex("RateeId");

                    b.HasIndex("RaterId");

                    b.HasIndex("ReviewerId");

                    b.HasIndex("SeniorRaterId");

                    b.ToTable("Evaluations");
                });

            modelBuilder.Entity("BatteryCommander.Web.Models.Evaluation+Event", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd();

                    b.Property<string>("Author");

                    b.Property<int>("EvaluationId");

                    b.Property<string>("Message");

                    b.Property<DateTimeOffset>("Timestamp");

                    b.HasKey("Id");

                    b.HasIndex("EvaluationId");

                    b.ToTable("Event");
                });

            modelBuilder.Entity("BatteryCommander.Web.Models.Soldier", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd();

                    b.Property<string>("CivilianEmail")
                        .HasMaxLength(50);

                    b.Property<DateTime>("DateOfBirth")
                        .HasColumnType("date");

                    b.Property<DateTime?>("DateOfRank")
                        .HasColumnType("date");

                    b.Property<string>("DoDId")
                        .HasMaxLength(12);

                    b.Property<DateTime?>("DscaQualificationDate");

                    b.Property<DateTime?>("ETSDate")
                        .HasColumnType("date");

                    b.Property<byte>("EducationLevel");

                    b.Property<string>("FirstName")
                        .IsRequired()
                        .HasMaxLength(50);

                    b.Property<byte>("Gender");

                    b.Property<DateTime?>("IwqQualificationDate");

                    b.Property<string>("LastName")
                        .IsRequired()
                        .HasMaxLength(50);

                    b.Property<string>("MiddleName")
                        .HasMaxLength(50);

                    b.Property<string>("MilitaryEmail")
                        .HasMaxLength(50);

                    b.Property<byte>("Rank");

                    b.Property<int?>("SupervisorId");

                    b.Property<int>("UnitId");

                    b.HasKey("Id");

                    b.HasIndex("DoDId")
                        .IsUnique();

                    b.HasIndex("SupervisorId");

                    b.HasIndex("UnitId");

                    b.HasIndex("FirstName", "MiddleName", "LastName")
                        .IsUnique();

                    b.ToTable("Soldiers");
                });

            modelBuilder.Entity("BatteryCommander.Web.Models.Soldier+SSDSnapshot", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd();

                    b.Property<DateTimeOffset>("AsOf");

                    b.Property<decimal?>("PerecentComplete");

                    b.Property<byte>("SSD");

                    b.Property<int?>("SoldierId");

                    b.HasKey("Id");

                    b.HasIndex("SoldierId");

                    b.ToTable("SSDSnapshot");
                });

            modelBuilder.Entity("BatteryCommander.Web.Models.Unit", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd();

                    b.Property<bool>("IgnoreForReports");

                    b.Property<string>("Name");

                    b.Property<string>("UIC");

                    b.HasKey("Id");

                    b.HasIndex("UIC")
                        .IsUnique();

                    b.ToTable("Units");
                });

            modelBuilder.Entity("BatteryCommander.Web.Models.Vehicle", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd();

                    b.Property<int?>("A_DriverId");

                    b.Property<string>("Bumper")
                        .IsRequired()
                        .HasMaxLength(10);

                    b.Property<int?>("DriverId");

                    b.Property<bool>("HasFuelCard");

                    b.Property<bool>("HasTowBar");

                    b.Property<string>("LIN")
                        .HasMaxLength(10);

                    b.Property<string>("Nomenclature")
                        .HasMaxLength(20);

                    b.Property<string>("Notes");

                    b.Property<string>("Registration")
                        .HasMaxLength(10);

                    b.Property<int>("Seats");

                    b.Property<string>("Serial")
                        .HasMaxLength(50);

                    b.Property<byte>("Status");

                    b.Property<byte>("Type");

                    b.Property<int>("UnitId");

                    b.HasKey("Id");

                    b.HasIndex("A_DriverId");

                    b.HasIndex("DriverId");

                    b.HasIndex("Registration")
                        .IsUnique();

                    b.HasIndex("Serial")
                        .IsUnique();

                    b.HasIndex("UnitId", "Bumper")
                        .IsUnique();

                    b.ToTable("Vehicles");
                });

            modelBuilder.Entity("BatteryCommander.Web.Models.ABCP", b =>
                {
                    b.HasOne("BatteryCommander.Web.Models.Soldier", "Soldier")
                        .WithMany("ABCPs")
                        .HasForeignKey("SoldierId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("BatteryCommander.Web.Models.APFT", b =>
                {
                    b.HasOne("BatteryCommander.Web.Models.Soldier", "Soldier")
                        .WithMany("APFTs")
                        .HasForeignKey("SoldierId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("BatteryCommander.Web.Models.Evaluation", b =>
                {
                    b.HasOne("BatteryCommander.Web.Models.Soldier", "Ratee")
                        .WithMany()
                        .HasForeignKey("RateeId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("BatteryCommander.Web.Models.Soldier", "Rater")
                        .WithMany()
                        .HasForeignKey("RaterId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("BatteryCommander.Web.Models.Soldier", "Reviewer")
                        .WithMany()
                        .HasForeignKey("ReviewerId");

                    b.HasOne("BatteryCommander.Web.Models.Soldier", "SeniorRater")
                        .WithMany()
                        .HasForeignKey("SeniorRaterId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("BatteryCommander.Web.Models.Evaluation+Event", b =>
                {
                    b.HasOne("BatteryCommander.Web.Models.Evaluation", "Evaluation")
                        .WithMany("Events")
                        .HasForeignKey("EvaluationId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("BatteryCommander.Web.Models.Soldier", b =>
                {
                    b.HasOne("BatteryCommander.Web.Models.Soldier", "Supervisor")
                        .WithMany()
                        .HasForeignKey("SupervisorId");

                    b.HasOne("BatteryCommander.Web.Models.Unit", "Unit")
                        .WithMany("Soldiers")
                        .HasForeignKey("UnitId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("BatteryCommander.Web.Models.Soldier+SSDSnapshot", b =>
                {
                    b.HasOne("BatteryCommander.Web.Models.Soldier")
                        .WithMany("SSDSnapshots")
                        .HasForeignKey("SoldierId");
                });

            modelBuilder.Entity("BatteryCommander.Web.Models.Vehicle", b =>
                {
                    b.HasOne("BatteryCommander.Web.Models.Soldier", "A_Driver")
                        .WithMany()
                        .HasForeignKey("A_DriverId");

                    b.HasOne("BatteryCommander.Web.Models.Soldier", "Driver")
                        .WithMany()
                        .HasForeignKey("DriverId");

                    b.HasOne("BatteryCommander.Web.Models.Unit", "Unit")
                        .WithMany("Vehicles")
                        .HasForeignKey("UnitId")
                        .OnDelete(DeleteBehavior.Cascade);
                });
        }
    }
}


text:
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.content.browser;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Path.Direction;
import android.graphics.PointF;
import android.graphics.PorterDuff.Mode;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Region.Op;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.SystemClock;
import android.util.Log;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
import android.view.animation.Interpolator;
import android.view.animation.OvershootInterpolator;

import org.chromium.content.R;

/**
 * PopupZoomer is used to show the on-demand link zooming popup. It handles manipulation of the
 * canvas and touch events to display the on-demand zoom magnifier.
 */
class PopupZoomer extends View {
    private static final String LOGTAG = "PopupZoomer";

    // The padding between the edges of the view and the popup. Note that there is a mirror
    // constant in content/renderer/render_view_impl.cc which should be kept in sync if
    // this is changed.
    private static final int ZOOM_BOUNDS_MARGIN = 25;
    // Time it takes for the animation to finish in ms.
    private static final long ANIMATION_DURATION = 300;

    /**
     * Interface to be implemented to listen for touch events inside the zoomed area.
     * The MotionEvent coordinates correspond to original unzoomed view.
     */
    public static interface OnTapListener {
        public boolean onSingleTap(View v, MotionEvent event);
        public boolean onLongPress(View v, MotionEvent event);
    }

    private OnTapListener mOnTapListener = null;

    /**
     * Interface to be implemented to add and remove PopupZoomer to/from the view hierarchy.
     */
    public static interface OnVisibilityChangedListener {
        public void onPopupZoomerShown(PopupZoomer zoomer);
        public void onPopupZoomerHidden(PopupZoomer zoomer);
    }

    private OnVisibilityChangedListener mOnVisibilityChangedListener = null;

    // Cached drawable used to frame the zooming popup.
    // TODO(tonyg): This should be marked purgeable so that if the system wants to recover this
    // memory, we can just reload it from the resource ID next time it is needed.
    // See android.graphics.BitmapFactory.Options#inPurgeable
    private static Drawable sOverlayDrawable;
    // The padding used for drawing the overlay around the content, instead of directly above it.
    private static Rect sOverlayPadding;
    // The radius of the overlay bubble, used for rounding the bitmap to draw underneath it.
    private static float sOverlayCornerRadius;

    private final Interpolator mShowInterpolator = new OvershootInterpolator();
    private final Interpolator mHideInterpolator = new ReverseInterpolator(mShowInterpolator);

    private boolean mAnimating = false;
    private boolean mShowing = false;
    private long mAnimationStartTime = 0;

    // The time that was left for the outwards animation to finish.
    // This is used in the case that the zoomer is cancelled while it is still animating outwards,
    // to avoid having it jump to full size then animate closed.
    private long mTimeLeft = 0;

    // initDimensions() needs to be called in onDraw().
    private boolean mNeedsToInitDimensions;

    // Available view area after accounting for ZOOM_BOUNDS_MARGIN.
    private RectF mViewClipRect;

    // The target rect to be zoomed.
    private Rect mTargetBounds;

    // The bitmap to hold the zoomed view.
    private Bitmap mZoomedBitmap;

    // How far to shift the canvas after all zooming is done, to keep it inside the bounds of the
    // view (including margin).
    private float mShiftX = 0, mShiftY = 0;
    // The magnification factor of the popup. It is recomputed once we have mTargetBounds and
    // mZoomedBitmap.
    private float mScale = 1.0f;
    // The bounds representing the actual zoomed popup.
    private RectF mClipRect;
    // The extrusion values are how far the zoomed area (mClipRect) extends from the touch point.
    // These values to used to animate the popup.
    private float mLeftExtrusion, mTopExtrusion, mRightExtrusion, mBottomExtrusion;
    // The last touch point, where the animation will start from.
    private final PointF mTouch = new PointF();

    // Since we sometimes overflow the bounds of the mViewClipRect, we need to allow scrolling.
    // Current scroll position.
    private float mPopupScrollX, mPopupScrollY;
    // Scroll bounds.
    private float mMinScrollX, mMaxScrollX;
    private float mMinScrollY, mMaxScrollY;

    private GestureDetector mGestureDetector;

    // These bounds are computed and valid for one execution of onDraw.
    // Extracted to a member variable to save unnecessary allocations on each invocation.
    private RectF mDrawRect;

    private static float getOverlayCornerRadius(Context context) {
        if (sOverlayCornerRadius == 0) {
            try {
                sOverlayCornerRadius = context.getResources().getDimension(
                        R.dimen.link_preview_overlay_radius);
            } catch (Resources.NotFoundException e) {
                Log.w(LOGTAG, "No corner radius resource for PopupZoomer overlay found.");
                sOverlayCornerRadius = 1.0f;
            }
        }
        return sOverlayCornerRadius;
    }

    /**
     * Gets the drawable that should be used to frame the zooming popup, loading
     * it from the resource bundle if not already cached.
     */
    private static Drawable getOverlayDrawable(Context context) {
        if (sOverlayDrawable == null) {
            try {
                sOverlayDrawable = context.getResources().getDrawable(
                        R.drawable.ondemand_overlay);
            } catch (Resources.NotFoundException e) {
                Log.w(LOGTAG, "No drawable resource for PopupZoomer overlay found.");
                sOverlayDrawable = new ColorDrawable();
            }
            sOverlayPadding = new Rect();
            sOverlayDrawable.getPadding(sOverlayPadding);
        }
        return sOverlayDrawable;
    }

    private static float constrain(float amount, float low, float high) {
        return amount < low ? low : (amount > high ? high : amount);
    }

    private static int constrain(int amount, int low, int high) {
        return amount < low ? low : (amount > high ? high : amount);
    }

    /**
     * Creates Popupzoomer.
     * @param context Context to be used.
     * @param overlayRadiusDimensoinResId Resource to be used to get overlay corner radius.
     */
    public PopupZoomer(Context context) {
        super(context);

        setVisibility(INVISIBLE);
        setFocusable(true);
        setFocusableInTouchMode(true);

        GestureDetector.SimpleOnGestureListener listener =
                new GestureDetector.SimpleOnGestureListener() {
                    @Override
                    public boolean onScroll(MotionEvent e1, MotionEvent e2,
                            float distanceX, float distanceY) {
                        if (mAnimating) return true;

                        if (isTouchOutsideArea(e1.getX(), e1.getY())) {
                            hide(true);
                        } else {
                            scroll(distanceX, distanceY);
                        }
                        return true;
                    }

                    @Override
                    public boolean onSingleTapUp(MotionEvent e) {
                        return handleTapOrPress(e, false);
                    }

                    @Override
                    public void onLongPress(MotionEvent e) {
                        handleTapOrPress(e, true);
                    }

                    private boolean handleTapOrPress(MotionEvent e, boolean isLongPress) {
                        if (mAnimating) return true;

                        float x = e.getX();
                        float y = e.getY();
                        if (isTouchOutsideArea(x, y)) {
                            // User clicked on area outside the popup.
                            hide(true);
                        } else if (mOnTapListener != null) {
                            PointF converted = convertTouchPoint(x, y);
                            MotionEvent event = MotionEvent.obtainNoHistory(e);
                            event.setLocation(converted.x, converted.y);
                            if (isLongPress) {
                                mOnTapListener.onLongPress(PopupZoomer.this, event);
                            } else {
                                mOnTapListener.onSingleTap(PopupZoomer.this, event);
                            }
                            hide(true);
                        }
                        return true;
                    }
                };
        mGestureDetector = new GestureDetector(context, listener);
    }

    /**
     * Sets the OnTapListener.
     */
    public void setOnTapListener(OnTapListener listener) {
        mOnTapListener = listener;
    }

    /**
     * Sets the OnVisibilityChangedListener.
     */
    public void setOnVisibilityChangedListener(OnVisibilityChangedListener listener) {
        mOnVisibilityChangedListener = listener;
    }

    /**
     * Sets the bitmap to be used for the zoomed view.
     */
    public void setBitmap(Bitmap bitmap) {
        if (mZoomedBitmap != null) {
            mZoomedBitmap.recycle();
            mZoomedBitmap = null;
        }
        mZoomedBitmap = bitmap;

        // Round the corners of the bitmap so it doesn't stick out around the overlay.
        Canvas canvas = new Canvas(mZoomedBitmap);
        Path path = new Path();
        RectF canvasRect = new RectF(0, 0, canvas.getWidth(), canvas.getHeight());
        float overlayCornerRadius = getOverlayCornerRadius(getContext());
        path.addRoundRect(canvasRect, overlayCornerRadius, overlayCornerRadius, Direction.CCW);
        canvas.clipPath(path, Op.XOR);
        Paint clearPaint = new Paint();
        clearPaint.setXfermode(new PorterDuffXfermode(Mode.SRC));
        clearPaint.setColor(Color.TRANSPARENT);
        canvas.drawPaint(clearPaint);
    }

    private void scroll(float x, float y) {
        mPopupScrollX = constrain(mPopupScrollX - x, mMinScrollX, mMaxScrollX);
        mPopupScrollY = constrain(mPopupScrollY - y, mMinScrollY, mMaxScrollY);
        invalidate();
    }

    private void startAnimation(boolean show) {
        mAnimating = true;
        mShowing = show;
        mTimeLeft = 0;
        if (show) {
            setVisibility(VISIBLE);
            mNeedsToInitDimensions = true;
            if (mOnVisibilityChangedListener != null) {
                mOnVisibilityChangedListener.onPopupZoomerShown(this);
            }
        } else {
            long endTime = mAnimationStartTime + ANIMATION_DURATION;
            mTimeLeft = endTime - SystemClock.uptimeMillis();
            if (mTimeLeft < 0) mTimeLeft = 0;
        }
        mAnimationStartTime = SystemClock.uptimeMillis();
        invalidate();
    }

    private void hideImmediately() {
        mAnimating = false;
        mShowing = false;
        mTimeLeft = 0;
        if (mOnVisibilityChangedListener != null) {
            mOnVisibilityChangedListener.onPopupZoomerHidden(this);
        }
        setVisibility(INVISIBLE);
        mZoomedBitmap.recycle();
        mZoomedBitmap = null;
    }

    /**
     * Returns true if the view is currently being shown (or is animating).
     */
    public boolean isShowing() {
        return mShowing || mAnimating;
    }

    /**
     * Sets the last touch point (on the unzoomed view).
     */
    public void setLastTouch(float x, float y) {
        mTouch.x = x;
        mTouch.y = y;
    }

    private void setTargetBounds(Rect rect) {
        mTargetBounds = rect;
    }

    private void initDimensions() {
        if (mTargetBounds == null || mTouch == null) return;

        // Compute the final zoom scale.
        mScale = (float) mZoomedBitmap.getWidth() / mTargetBounds.width();

        float l = mTouch.x - mScale * (mTouch.x - mTargetBounds.left);
        float t = mTouch.y - mScale * (mTouch.y - mTargetBounds.top);
        float r = l + mZoomedBitmap.getWidth();
        float b = t + mZoomedBitmap.getHeight();
        mClipRect = new RectF(l, t, r, b);
        int width = getWidth();
        int height = getHeight();

        mViewClipRect = new RectF(ZOOM_BOUNDS_MARGIN,
                ZOOM_BOUNDS_MARGIN,
                width - ZOOM_BOUNDS_MARGIN,
                height - ZOOM_BOUNDS_MARGIN);

        // Ensure it stays inside the bounds of the view.  First shift it around to see if it
        // can fully fit in the view, then clip it to the padding section of the view to
        // ensure no overflow.
        mShiftX = 0;
        mShiftY = 0;

        // Right now this has the happy coincidence of showing the leftmost portion
        // of a scaled up bitmap, which usually has the text in it.  When we want to support
        // RTL languages, we can conditionally switch the order of this check to push it
        // to the left instead of right.
        if (mClipRect.left < ZOOM_BOUNDS_MARGIN) {
            mShiftX = ZOOM_BOUNDS_MARGIN - mClipRect.left;
            mClipRect.left += mShiftX;
            mClipRect.right += mShiftX;
        } else if (mClipRect.right > width - ZOOM_BOUNDS_MARGIN) {
            mShiftX = (width - ZOOM_BOUNDS_MARGIN - mClipRect.right);
            mClipRect.right += mShiftX;
            mClipRect.left += mShiftX;
        }
        if (mClipRect.top < ZOOM_BOUNDS_MARGIN) {
            mShiftY = ZOOM_BOUNDS_MARGIN - mClipRect.top;
            mClipRect.top += mShiftY;
            mClipRect.bottom += mShiftY;
        } else if (mClipRect.bottom > height - ZOOM_BOUNDS_MARGIN) {
            mShiftY = height - ZOOM_BOUNDS_MARGIN - mClipRect.bottom;
            mClipRect.bottom += mShiftY;
            mClipRect.top += mShiftY;
        }

        // Allow enough scrolling to get to the entire bitmap that may be clipped inside the
        // bounds of the view.
        mMinScrollX = mMaxScrollX = mMinScrollY = mMaxScrollY = 0;
        if (mViewClipRect.right + mShiftX < mClipRect.right) {
            mMinScrollX = mViewClipRect.right - mClipRect.right;
        }
        if (mViewClipRect.left + mShiftX > mClipRect.left) {
            mMaxScrollX = mViewClipRect.left - mClipRect.left;
        }
        if (mViewClipRect.top + mShiftY > mClipRect.top) {
            mMaxScrollY = mViewClipRect.top - mClipRect.top;
        }
        if (mViewClipRect.bottom + mShiftY < mClipRect.bottom) {
            mMinScrollY = mViewClipRect.bottom - mClipRect.bottom;
        }
        // Now that we know how much we need to scroll, we can intersect with mViewClipRect.
        mClipRect.intersect(mViewClipRect);

        mLeftExtrusion = mTouch.x - mClipRect.left;
        mRightExtrusion = mClipRect.right - mTouch.x;
        mTopExtrusion = mTouch.y - mClipRect.top;
        mBottomExtrusion = mClipRect.bottom - mTouch.y;

        // Set an initial scroll position to take touch point into account.
        float percentX =
                (mTouch.x - mTargetBounds.centerX()) / (mTargetBounds.width() / 2.f) + .5f;
        float percentY =
                (mTouch.y - mTargetBounds.centerY()) / (mTargetBounds.height() / 2.f) + .5f;

        float scrollWidth = mMaxScrollX - mMinScrollX;
        float scrollHeight = mMaxScrollY - mMinScrollY;
        mPopupScrollX = scrollWidth * percentX * -1f;
        mPopupScrollY = scrollHeight * percentY * -1f;
        // Constrain initial scroll position within allowed bounds.
        mPopupScrollX = constrain(mPopupScrollX, mMinScrollX, mMaxScrollX);
        mPopupScrollY = constrain(mPopupScrollY, mMinScrollY, mMaxScrollY);

        // Compute the bounds in onDraw()
        mDrawRect = new RectF();
    }

    /*
     * Tests override it as the PopupZoomer is never attached to the view hierarchy.
     */
    protected boolean acceptZeroSizeView() {
        return false;
    }

    @Override
    protected void onDraw(Canvas canvas) {
        if (!isShowing() || mZoomedBitmap == null) return;
        if (!acceptZeroSizeView() && (getWidth() == 0 || getHeight() == 0)) return;

        if (mNeedsToInitDimensions) {
            mNeedsToInitDimensions = false;
            initDimensions();
        }

        canvas.save();
        // Calculate the elapsed fraction of animation.
        float time = (SystemClock.uptimeMillis() - mAnimationStartTime + mTimeLeft)
                / ((float) ANIMATION_DURATION);
        time = constrain(time, 0, 1);
        if (time >= 1) {
            mAnimating = false;
            if (!isShowing()) {
                hideImmediately();
                return;
            }
        } else {
            invalidate();
        }

        // Fraction of the animation to actally show.
        float fractionAnimation;
        if (mShowing) {
            fractionAnimation = mShowInterpolator.getInterpolation(time);
        } else {
            fractionAnimation = mHideInterpolator.getInterpolation(time);
        }

        // Draw a faded color over the entire view to fade out the original content, increasing
        // the alpha value as fractionAnimation increases.
        // TODO(nileshagrawal): We should use time here instead of fractionAnimation
        // as fractionAnimaton is interpolated and can go over 1.
        canvas.drawARGB((int) (80 * fractionAnimation), 0, 0, 0);
        canvas.save();

        // Since we want the content to appear directly above its counterpart we need to make
        // sure that it starts out at exactly the same size as it appears in the page,
        // i.e. scale grows from 1/mScale to 1. Note that extrusion values are already zoomed
        // with mScale.
        float scale = fractionAnimation * (mScale - 1.0f) / mScale + 1.0f / mScale;

        // Since we want the content to appear directly above its counterpart on the
        // page, we need to remove the mShiftX/Y effect at the beginning of the animation.
        // The unshifting decreases with the animation.
        float unshiftX = -mShiftX * (1.0f - fractionAnimation) / mScale;
        float unshiftY = -mShiftY * (1.0f - fractionAnimation) / mScale;

        // Compute the |mDrawRect| to show.
        mDrawRect.left = mTouch.x - mLeftExtrusion * scale + unshiftX;
        mDrawRect.top = mTouch.y - mTopExtrusion * scale + unshiftY;
        mDrawRect.right = mTouch.x + mRightExtrusion * scale + unshiftX;
        mDrawRect.bottom = mTouch.y + mBottomExtrusion * scale + unshiftY;
        canvas.clipRect(mDrawRect);

        // Since the canvas transform APIs all pre-concat the transformations, this is done in
        // reverse order. The canvas is first scaled up, then shifted the appropriate amount of
        // pixels.
        canvas.scale(scale, scale, mDrawRect.left, mDrawRect.top);
        canvas.translate(mPopupScrollX, mPopupScrollY);
        canvas.drawBitmap(mZoomedBitmap, mDrawRect.left, mDrawRect.top, null);
        canvas.restore();
        Drawable overlayNineTile = getOverlayDrawable(getContext());
        overlayNineTile.setBounds((int) mDrawRect.left - sOverlayPadding.left,
                (int) mDrawRect.top - sOverlayPadding.top,
                (int) mDrawRect.right + sOverlayPadding.right,
                (int) mDrawRect.bottom + sOverlayPadding.bottom);
        // TODO(nileshagrawal): We should use time here instead of fractionAnimation
        // as fractionAnimaton is interpolated and can go over 1.
        int alpha = constrain((int) (fractionAnimation * 255), 0, 255);
        overlayNineTile.setAlpha(alpha);
        overlayNineTile.draw(canvas);
        canvas.restore();
    }

    /**
     * Show the PopupZoomer view with given target bounds.
     */
    public void show(Rect rect) {
        if (mShowing || mZoomedBitmap == null) return;

        setTargetBounds(rect);
        startAnimation(true);
    }

    /**
     * Hide the PopupZoomer view.
     * @param animation true if hide with animation.
     */
    public void hide(boolean animation) {
        if (!mShowing) return;

        if (animation) {
            startAnimation(false);
        } else {
            hideImmediately();
        }
    }

    /**
     * Converts the coordinates to a point on the original un-zoomed view.
     */
    private PointF convertTouchPoint(float x, float y) {
        x -= mShiftX;
        y -= mShiftY;
        x = mTouch.x + (x - mTouch.x - mPopupScrollX) / mScale;
        y = mTouch.y + (y - mTouch.y - mPopupScrollY) / mScale;
        return new PointF(x, y);
    }

    /**
     * Returns true if the point is inside the final drawable area for this popup zoomer.
     */
    private boolean isTouchOutsideArea(float x, float y) {
        return !mClipRect.contains(x, y);
    }

    @SuppressLint("ClickableViewAccessibility")
    @Override
    public boolean onTouchEvent(MotionEvent event) {
        mGestureDetector.onTouchEvent(event);
        return true;
    }

    private static class ReverseInterpolator implements Interpolator {
        private final Interpolator mInterpolator;

        public ReverseInterpolator(Interpolator i) {
            mInterpolator = i;
        }

        @Override
        public float getInterpolation(float input) {
            input = 1.0f - input;
            if (mInterpolator == null) return input;
            return mInterpolator.getInterpolation(input);
        }
    }
}


text:
package org.compass.core.test.dynamicproperty.map.format;

import java.util.HashMap;

import org.compass.core.CompassSession;
import org.compass.core.test.AbstractTestCase;

/**
 * @author kimchy
 */
public class FormatMapDynamicPropertyTests extends AbstractTestCase {

    @Override
    protected String[] getMappings() {
        return new String[]{"dynamicproperty/map/format/mapping.cpm.xml"};
    }

    public void testFormatMapDynamicProperty() {
        CompassSession session = openSession();

        A a = new A();
        a.id = 1;
        a.values = new HashMap<Integer, Integer>();
        a.values.put(2, 4);

        session.save(a);

        assertEquals(1, session.find("002:0004").length());

        session.close();
    }
}


text:
import SonicScrewdriver as utils
import csv

rows, columns, table = utils.readtsv('/Volumes/TARDIS/work/metadata/MergedMonographs.tsv')

with open('anovaset.tsv', encoding = 'utf-8') as f:
    filelines = f.readlines()

anovaset = list()

for line in filelines:
    fields = line.split('\t')
    htid = utils.dirty_pairtree(fields[0])
    category = fields[1]
    if category == 'elite':
        category = 'reviewed'
    elif category == 'vulgar':
        category = 'random'

    if htid in rows:
        author = table['author'][htid]
        title = table['title'][htid]
        date = utils.simple_date(htid, table)
        imprint = table['imprint'][htid]
        enumcron = table['enumcron'][htid]
        anovaset.append([htid, category, date, enumcron, author, title, imprint])

with open('anovaset.csv', mode='w', encoding = 'utf-8') as f:
    writer = csv.writer(f)
    writer.writerow(['htid', 'category', 'date', 'enumcron', 'author', 'title', 'imprint'])
    for row in anovaset:
        writer.writerow(row)


text:
require_relative 'node_external_basecall.rb'
require_relative '../../shared/opcodes.rb'
require_relative '../processors/check_call_args_count.rb'
require_relative '../processors/check_call_args_types.rb'
require_relative '../processors/check_function_existence.rb'
require_relative '../processors/concreteify_call.rb'
require_relative '../processors/convert_call_to_syscall.rb'
require_relative '../processors/uncomplexify.rb'

class DabNodeCall < DabNodeExternalBasecall
  dirty_check_with CheckFunctionExistence
  dirty_check_with CheckCallArgsTypes
  dirty_check_with CheckCallArgsCount
  lower_with ConvertCallToSyscall
  lower_with Uncomplexify
  optimize_with ConcreteifyCall

  def initialize(identifier, args, block, block_capture = nil)
    super(args)
    pre_insert(block_capture || DabNodeLiteralNil.new)
    pre_insert(block || DabNodeLiteralNil.new)
    pre_insert(DabNodeSymbol.new(identifier))
  end

  def children_info
    {
      identifier => 'identifier',
      block => 'block',
      block_capture => 'block_capture',
    }
  end

  def identifier
    self[0]
  end

  def block
    self[1]
  end

  def block_capture
    self[2]
  end

  def real_identifier
    identifier.extra_value
  end

  def args
    self[3..-1]
  end

  def _compile(output, output_register)
    list = args.map(&:input_register).map { |arg| "R#{arg}" }
    list = nil if list.empty?

    if has_block?
      blockarg = "S#{block_symbol_index}"
      capture_arg = "R#{block_capture.input_register}"
    end

    args = [
      output_register.nil? ? 'RNIL' : "R#{output_register}",
      "S#{symbol_index}",
      blockarg,
      capture_arg,
      list,
    ].compact

    output.comment(self.real_identifier)
    output.printex(self, 'CALL' + (has_block? ? '_BLOCK' : ''), *args)
  end

  def compile_as_ssa(output, output_register)
    _compile(output, output_register)
  end

  def compile_top_level(output)
    _compile(output, nil)
  end

  def symbol_index
    identifier.symbol_index
  end

  def block_symbol_index
    block.identifier.symbol_index
  end

  def formatted_source(options)
    real_identifier + '(' + _formatted_arguments(options) + ')' + formatted_block(options)
  end

  def my_type
    return DabTypeObject.new if target_function == true || target_function == false

    target_function&.return_type
  end

  def uncomplexify_args
    list = args
    list += [block_capture] if has_block?
    list
  end

  def accepts?(arg)
    arg.register?
  end

  def extra_dump
    return '[??]' if target_function.nil?
    return '[builtin]' if target_function == true
    return '[builtin??]' if target_function == false

    target_function.concreteified? ? '[hardcall]' : ''
  end
end


text:
// Copyright 2012 Google Inc. All Rights Reserved.
// Author: jacobsa@google.com (Aaron Jacobs)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Attach a slice() method to ArrayBuffer, since our C++ implementation doesn't
// have one. A JS version is much easier to implement, though it won't be as
// fast.

// Don't attempt to replace an already-working slice method.
if (!('slice' in ArrayBuffer.prototype)) {
  /**
   * Slice an array buffer, as defined here:
   *
   *     http://www.khronos.org/registry/typedarray/specs/latest/
   *
   * @param {number} start
   *     The start index, inclusive. If negative, this is interpreted as an
   *     index from the end of the array.
   *
   * @param {number=} opt_end
   *     The end index, exclusive. If negative, this is interpreted as an index
   *     from the end of the array. If missing, this defaults to the length of
   *     the array.
   *
   * @return {!ArrayBuffer}
   *     A copy of the sliced data.
   *
   * @suppress {duplicate}
   */
  ArrayBuffer.prototype.slice = function(start, opt_end) {
    // Handle missing start arguments.
    if (start === undefined) {
      throw new Error('Not enough arguments.');
    }

    // Handle missing end arguments.
    var end = opt_end || this.byteLength;

    // Interpret negative values as indices from the end of the array. Convert
    // them to indices from the beginning.
    if (start < 0) { start = this.byteLength + start; }
    if (end < 0) { end = this.byteLength + end; }

    // Handle negative-length slices.
    if (end < start) {
      start = 0;
      end = 0;
    }

    // Clamp the range.
    if (start < 0) { start = 0; }
    if (end < 0) { end = 0; }

    if (start > this.byteLength) { start = this.byteLength; }
    if (end > this.byteLength) { end = this.byteLength; }

    // Create a new buffer, and copy data into it.
    var result = new ArrayBuffer(end - start);
    var inBytes = new Uint8Array(this);
    var outBytes = new Uint8Array(result);

    for (var inIndex = start, outIndex = 0;
         inIndex < end;
         ++inIndex, ++outIndex) {
      outBytes[outIndex] = inBytes[inIndex];
    }

    return result;
  };
}