id
int32
0
12.9k
code
sequencelengths
2
264k
800
[ "<s>", "package", "org", ".", "sqlproc", ".", "sample", ".", "catalog", ".", "db", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "InputStream", ";", "import", "java", ".", "sql", ".", "Connection", ";", "import", "java", ".", "sql", ".", "Statement", ";", "import", "java", ".", "util", ".", "Properties", ";", "import", "org", ".", "springframework", ".", "beans", ".", "BeansException", ";", "import", "org", ".", "springframework", ".", "beans", ".", "factory", ".", "InitializingBean", ";", "import", "org", ".", "springframework", ".", "context", ".", "ApplicationContext", ";", "import", "org", ".", "springframework", ".", "context", ".", "ApplicationContextAware", ";", "import", "org", ".", "springframework", ".", "core", ".", "io", ".", "DefaultResourceLoader", ";", "import", "org", ".", "springframework", ".", "core", ".", "io", ".", "Resource", ";", "import", "org", ".", "springframework", ".", "core", ".", "io", ".", "ResourceLoader", ";", "import", "org", ".", "springframework", ".", "jdbc", ".", "core", ".", "JdbcTemplate", ";", "import", "org", ".", "sqlproc", ".", "sample", ".", "catalog", ".", "model", ".", "Item", ";", "import", "org", ".", "sqlproc", ".", "sample", ".", "catalog", ".", "service", ".", "ItemService", ";", "public", "final", "class", "TestDataInitializer", "implements", "InitializingBean", ",", "ApplicationContextAware", "{", "private", "JdbcTemplate", "jdbcTemplate", ";", "private", "ItemService", "itemService", ";", "private", "boolean", "initData", ";", "private", "Properties", "catalog", ";", "private", "ApplicationContext", "context", ";", "public", "TestDataInitializer", "(", ")", "{", "}", "public", "void", "afterPropertiesSet", "(", ")", "throws", "Exception", "{", "if", "(", "initData", ")", "{", "Connection", "connection", "=", "null", ";", "Statement", "stmt", "=", "null", ";", "try", "{", "connection", "=", "jdbcTemplate", ".", "getDataSource", "(", ")", ".", "getConnection", "(", ")", ";", "stmt", "=", "connection", ".", "createStatement", "(", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<=", "50", ";", "i", "++", ")", "{", "String", "ddl", "=", "catalog", ".", "getProperty", "(", "\"s\"", "+", "i", ")", ";", "if", "(", "ddl", "==", "null", ")", "continue", ";", "System", ".", "out", ".", "println", "(", "ddl", ")", ";", "stmt", ".", "addBatch", "(", "ddl", ")", ";", "}", "stmt", ".", "executeBatch", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "finally", "{", "if", "(", "connection", "!=", "null", ")", "connection", ".", "close", "(", ")", ";", "}", "try", "{", "DefaultResourceLoader", "loader", "=", "new", "DefaultResourceLoader", "(", ")", ";", "Item", "item", ";", "item", "=", "new", "Item", "(", "1", ",", "\"feline01\"", ",", "\"Friendly", "Cat\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "307.10", ")", ";", "loadImages", "(", "item", ",", "loader", ")", ";", "itemService", ".", "create", "(", "item", ")", ";", "item", "=", "new", "Item", "(", "2", ",", "\"feline01\"", ",", "\"Fluffy", "Cat\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "307", ")", ";", "loadImages", "(", "item", ",", "loader", ")", ";", "itemService", ".", "create", "(", "item", ")", ";", "item", "=", "new", "Item", "(", "3", ",", "\"feline02\"", ",", "\"Sneaky", "Cat\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "307.20", ")", ";", "loadImages", "(", "item", ",", "loader", ")", ";", "itemService", ".", "create", "(", "item", ")", ";", "item", "=", "new", "Item", "(", "4", ",", "\"feline02\"", ",", "\"Lazy", "Cat\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "307.30", ")", ";", "loadImages", "(", "item", ",", "loader", ")", ";", "itemService", ".", "create", "(", "item", ")", ";", "item", "=", "new", "Item", "(", "5", ",", "\"feline01\"", ",", "\"Old", "Cat\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "307", ")", ";", "loadImages", "(", "item", ",", "loader", ")", ";", "itemService", ".", "create", "(", "item", ")", ";", "item", "=", "new", "Item", "(", "6", ",", "\"feline02\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "307.40", ")", ";", "loadImages", "(", "item", ",", "loader", ")", ";", "itemService", ".", "create", "(", "item", ")", ";", "item", "=", "new", "Item", "(", "7", ",", "\"feline01\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "307", ")", ";", "loadImages", "(", "item", ",", "loader", ")", ";", "itemService", ".", "create", "(", "item", ")", ";", "item", "=", "new", "Item", "(", "8", ",", "\"feline01\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "307.50", ")", ";", "loadImages", "(", "item", ",", "loader", ")", ";", "itemService", ".", "create", "(", "item", ")", ";", "item", "=", "new", "Item", "(", "9", ",", "\"feline02\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "307", ")", ";", "loadImages", "(", "item", ",", "loader", ")", ";", "itemService", ".", "create", "(", "item", ")", ";", "item", "=", "new", "Item", "(", "10", ",", "\"feline02\"", ",", "\"Alley", "Cat\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "307.60", ")", ";", "loadImages", "(", "item", ",", "loader", ")", ";", "itemService", ".", "create", "(", "item", ")", ";", "item", "=", "new", "Item", "(", "11", ",", "\"feline02\"", ",", "\"Speedy", "Cat\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "307", ")", ";", "loadImages", "(", "item", ",", "loader", ")", ";", "itemService", ".", "create", "(", "item", ")", ";", "item", "=", "new", "Item", "(", "12", ",", "\"feline01\"", ",", "\"Stylish", "Cat\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "307.70", ")", ";", "loadImages", "(", "item", ",", "loader", ")", ";", "itemService", ".", "create", "(", "item", ")", ";", "item", "=", "new", "Item", "(", "13", ",", "\"feline01\"", ",", "\"Smelly", "Cat\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "307.80", ")", ";", "loadImages", "(", "item", ",", "loader", ")", ";", "itemService", ".", "create", "(", "item", ")", ";", "item", "=", "new", "Item", "(", "14", ",", "\"feline01\"", ",", "\"Saber", "Cat\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "307.90", ")", ";", "loadImages", "(", "item", ",", "loader", ")", ";", "itemService", ".", "create", "(", "item", ")", ";", "item", "=", "new", "Item", "(", "15", ",", "\"feline01\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "307", ")", ";", "loadImages", "(", "item", ",", "loader", ")", ";", "itemService", ".", "create", "(", "item", ")", ";", "item", "=", "new", "Item", "(", "16", ",", "\"feline01\"", ",", "\"Princess", "cat\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "307", ")", ";", "loadImages", "(", "item", ",", "loader", ")", ";", "itemService", ".", "create", "(", "item", ")", ";", "item", "=", "new", "Item", "(", "17", ",", "\"feline02\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "307", ")", ";", "loadImages", "(", "item", ",", "loader", ")", ";", "itemService", ".", "create", "(", "item", ")", ";", "item", "=", "new", "Item", "(", "18", ",", "\"feline02\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "307", ")", ";", "loadImages", "(", "item", ",", "loader", ")", ";", "itemService", ".", "create", "(", "item", ")", ";", "item", "=", "new", "Item", "(", "19", ",", "\"feline01\"", ",", "\"Lazy", "cat\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "307", ")", ";", "loadImages", "(", "item", ",", "loader", ")", ";", "itemService", ".", "create", "(", "item", ")", ";", "item", "=", "new", "Item", "(", "20", ",", "\"feline01\"", ",", "\"Older", "Cat\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "200", ")", ";", "loadImages", "(", "item", ",", "loader", ")", ";", "itemService", ".", "create", "(", "item", ")", ";", "item", "=", "new", "Item", "(", "21", ",", "\"feline01\"", ",", "\"Young", "Cat\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "350", ")", ";", "loadImages", "(", "item", ",", "loader", ")", ";", "itemService", ".", "create", "(", "item", ")", ";", "item", "=", "new", "Item", "(", "22", ",", "\"feline01\"", ",", "\"Scrappy", "Cat\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "417", ")", ";", "loadImages", "(", "item", ",", "loader", ")", ";", "itemService", ".", "create", "(", "item", ")", ";", "item", "=", "new", "Item", "(", "23", ",", "\"feline01\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "307", ")", ";", "loadImages", "(", "item", ",", "loader", ")", ";", "itemService", ".", "create", "(", "item", ")", ";", "item", "=", "new", "Item", "(", "24", ",", "\"feline02\"", ",", "\"Playful", "Cat\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "190", ")", ";", "loadImages", "(", "item", ",", "loader", ")", ";", "itemService", ".", "create", "(", "item", ")", ";", "item", "=", "new", "Item", "(", "25", ",", "\"feline02\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "199", ")", ";", "loadImages", "(", "item", ",", "loader", ")", ";", "itemService", ".", "create", "(", "item", ")", ";", "item", "=", "new", "Item", "(", "26", ",", "\"feline02\"", ",", "\"Fresh", "Cat\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "303", ")", ";", "loadImages", "(", "item", ",", "loader", ")", ";", "itemService", ".", "create", "(", "item", ")", ";", "item", "=", "new", "Item", "(", "27", ",", "\"feline02\"", ",", "\"Wild", "Cat\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "527", ")", ";", "loadImages", "(", "item", ",", "loader", ")", ";", "itemService", ".", "create", "(", "item", ")", ";", "item", "=", "new", "Item", "(", "28", ",", "\"feline02\"", ",", "\"\"", ",", "\"Buy", "me\"", ",", "\"\"", ",", "\"\"", ",", "237", ")", ";", "loadImages", "(", "item", ",", "loader", ")", ";", "itemService", ".", "create", "(", "item", ")", ";", "item", "=", "new", "Item", "(", "29", ",", "\"feline02\"", ",", "\"Snappy", "Cat\"", ",", "\"Buy", "Me.\"", ",", "\"\"", ",", "\"\"", ",", "337", ")", ";", "loadImages", "(", "item", ",", "loader", ")", ";", "itemService", ".", "create", "(", "item", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}", "}", "private", "void", "loadImages", "(", "Item", "item", ",", "ResourceLoader", "loader", ")", "{", "try", "{", "if", "(", "item", ".", "getImageurl", "(", ")", "!=", "null", ")", "{", "Resource", "res", "=", "loader", ".", "getResource", "(", "\"classpath:\"", "+", "item", ".", "getImageurl", "(", ")", ")", ";", "if", "(", "res", ".", "exists", "(", ")", "&&", "res", ".", "isReadable", "(", ")", ")", "{", "item", ".", "setImage", "(", "copy", "(", "res", ".", "getInputStream", "(", ")", ",", "4096", ")", ")", ";", "}", "}", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "try", "{", "if", "(", "item", ".", "getImagethumburl", "(", ")", "!=", "null", ")", "{", "Resource", "res", "=", "loader", ".", "getResource", "(", "\"classpath:\"", "+", "item", ".", "getImagethumburl", "(", ")", ")", ";", "if", "(", "res", ".", "exists", "(", ")", "&&", "res", ".", "isReadable", "(", ")", ")", "{", "item", ".", "setImagethumb", "(", "copy", "(", "res", ".", "getInputStream", "(", ")", ",", "4096", ")", ")", ";", "}", "}", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "private", "byte", "[", "]", "copy", "(", "InputStream", "ins", ",", "int", "bufSize", ")", "throws", "IOException", "{", "byte", "[", "]", "result", "=", "new", "byte", "[", "0", "]", ";", "final", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "bufSize", "]", ";", "int", "bytesCopied", "=", "0", ";", "while", "(", "true", ")", "{", "int", "byteCount", "=", "ins", ".", "read", "(", "buffer", ",", "0", ",", "buffer", ".", "length", ")", ";", "if", "(", "byteCount", "<=", "0", ")", "{", "break", ";", "}", "byte", "[", "]", "result2", "=", "new", "byte", "[", "result", ".", "length", "+", "byteCount", "]", ";", "System", ".", "arraycopy", "(", "result", ",", "0", ",", "result2", ",", "0", ",", "result", ".", "length", ")", ";", "System", ".", "arraycopy", "(", "buffer", ",", "0", ",", "result2", ",", "result", ".", "length", ",", "byteCount", ")", ";", "result", "=", "result2", ";", "}", "return", "result", ";", "}", "public", "void", "setJdbcTemplate", "(", "JdbcTemplate", "jdbcTemplate", ")", "{", "this", ".", "jdbcTemplate", "=", "jdbcTemplate", ";", "}", "public", "void", "setItemService", "(", "ItemService", "itemService", ")", "{", "this", ".", "itemService", "=", "itemService", ";", "}", "public", "void", "setInitData", "(", "boolean", "initData", ")", "{", "this", ".", "initData", "=", "initData", ";", "}", "public", "void", "setCatalog", "(", "Properties", "catalog", ")", "{", "this", ".", "catalog", "=", "catalog", ";", "}", "public", "void", "setApplicationContext", "(", "ApplicationContext", "applicationContext", ")", "throws", "BeansException", "{", "this", ".", "context", "=", "applicationContext", ";", "}", "}", "</s>" ]
801
[ "<s>", "package", "org", ".", "sqlproc", ".", "sample", ".", "catalog", ".", "service", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "springframework", ".", "beans", ".", "factory", ".", "annotation", ".", "Autowired", ";", "import", "org", ".", "springframework", ".", "transaction", ".", "annotation", ".", "Transactional", ";", "import", "org", ".", "sqlproc", ".", "sample", ".", "catalog", ".", "dao", ".", "ItemDao", ";", "import", "org", ".", "sqlproc", ".", "sample", ".", "catalog", ".", "form", ".", "ItemForm", ";", "import", "org", ".", "sqlproc", ".", "sample", ".", "catalog", ".", "model", ".", "Item", ";", "import", "org", ".", "sqlproc", ".", "sample", ".", "catalog", ".", "to", ".", "ItemTO", ";", "public", "class", "ItemService", "{", "@", "Autowired", "private", "ItemDao", "itemDao", ";", "@", "Transactional", "(", "readOnly", "=", "true", ")", "public", "Item", "findById", "(", "Long", "itemId", ")", "{", "return", "(", "Item", ")", "itemDao", ".", "findById", "(", "itemId", ")", ";", "}", "@", "Transactional", "public", "Long", "create", "(", "Item", "item", ")", "{", "return", "itemDao", ".", "create", "(", "item", ")", ".", "getItemid", "(", ")", ";", "}", "@", "Transactional", "public", "Long", "update", "(", "Item", "item", ")", "{", "return", "itemDao", ".", "update", "(", "item", ")", ".", "getItemid", "(", ")", ";", "}", "@", "Transactional", "public", "void", "delete", "(", "Long", "itemId", ")", "{", "itemDao", ".", "delete", "(", "itemId", ")", ";", "}", "@", "Transactional", "(", "readOnly", "=", "true", ")", "public", "List", "<", "ItemTO", ">", "find", "(", "ItemForm", "criteria", ")", "{", "return", "itemDao", ".", "find", "(", "criteria", ")", ";", "}", "@", "Transactional", "(", "readOnly", "=", "true", ")", "public", "int", "findCount", "(", "ItemForm", "criteria", ")", "{", "return", "itemDao", ".", "findCount", "(", "criteria", ")", ";", "}", "}", "</s>" ]
802
[ "<s>", "package", "org", ".", "sqlproc", ".", "sample", ".", "catalog", ".", "to", ";", "import", "java", ".", "io", ".", "Serializable", ";", "import", "java", ".", "math", ".", "BigDecimal", ";", "public", "class", "ItemTO", "implements", "Serializable", "{", "private", "Long", "itemid", ";", "private", "String", "productid", ";", "private", "String", "name", ";", "private", "String", "description", ";", "private", "String", "imageurl", ";", "private", "String", "imagethumburl", ";", "private", "byte", "[", "]", "image", ";", "private", "byte", "[", "]", "imagethumb", ";", "private", "BigDecimal", "price", ";", "public", "ItemTO", "(", ")", "{", "}", "public", "Long", "getItemid", "(", ")", "{", "return", "itemid", ";", "}", "public", "void", "setItemid", "(", "Long", "itemid", ")", "{", "this", ".", "itemid", "=", "itemid", ";", "}", "public", "String", "getProductid", "(", ")", "{", "return", "productid", ";", "}", "public", "void", "setProductid", "(", "String", "productid", ")", "{", "this", ".", "productid", "=", "productid", ";", "}", "public", "String", "getName", "(", ")", "{", "return", "name", ";", "}", "public", "void", "setName", "(", "String", "name", ")", "{", "this", ".", "name", "=", "name", ";", "}", "public", "String", "getDescription", "(", ")", "{", "return", "description", ";", "}", "public", "void", "setDescription", "(", "String", "description", ")", "{", "this", ".", "description", "=", "description", ";", "}", "public", "String", "getImageurl", "(", ")", "{", "return", "imageurl", ";", "}", "public", "void", "setImageurl", "(", "String", "imageurl", ")", "{", "this", ".", "imageurl", "=", "imageurl", ";", "}", "public", "String", "getImagethumburl", "(", ")", "{", "return", "imagethumburl", ";", "}", "public", "void", "setImagethumburl", "(", "String", "imagethumburl", ")", "{", "this", ".", "imagethumburl", "=", "imagethumburl", ";", "}", "public", "byte", "[", "]", "getImage", "(", ")", "{", "return", "image", ";", "}", "public", "void", "setImage", "(", "byte", "[", "]", "image", ")", "{", "this", ".", "image", "=", "image", ";", "}", "public", "byte", "[", "]", "getImagethumb", "(", ")", "{", "return", "imagethumb", ";", "}", "public", "void", "setImagethumb", "(", "byte", "[", "]", "imagethumb", ")", "{", "this", ".", "imagethumb", "=", "imagethumb", ";", "}", "public", "BigDecimal", "getPrice", "(", ")", "{", "return", "price", ";", "}", "public", "void", "setPrice", "(", "BigDecimal", "price", ")", "{", "this", ".", "price", "=", "price", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "name", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
803
[ "<s>", "package", "org", ".", "sqlproc", ".", "sample", ".", "catalog", ".", "dao", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "slf4j", ".", "Logger", ";", "import", "org", ".", "slf4j", ".", "LoggerFactory", ";", "import", "org", ".", "springframework", ".", "cache", ".", "annotation", ".", "CacheEvict", ";", "import", "org", ".", "springframework", ".", "cache", ".", "annotation", ".", "Cacheable", ";", "import", "org", ".", "springframework", ".", "jdbc", ".", "core", ".", "JdbcTemplate", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "SqlCrudEngine", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "SqlEngineFactory", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "SqlOrder", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "SqlQueryEngine", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "SqlSession", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "spring", ".", "SpringSimpleSession", ";", "import", "org", ".", "sqlproc", ".", "sample", ".", "catalog", ".", "form", ".", "ItemForm", ";", "import", "org", ".", "sqlproc", ".", "sample", ".", "catalog", ".", "model", ".", "Item", ";", "import", "org", ".", "sqlproc", ".", "sample", ".", "catalog", ".", "to", ".", "ItemTO", ";", "public", "class", "ItemDao", "{", "protected", "final", "Logger", "logger", "=", "LoggerFactory", ".", "getLogger", "(", "getClass", "(", ")", ")", ";", "protected", "JdbcTemplate", "jdbcTemplate", ";", "protected", "SqlEngineFactory", "sqlFactory", ";", "private", "SqlSession", "getSqlSession", "(", ")", "{", "SqlSession", "session", "=", "new", "SpringSimpleSession", "(", "jdbcTemplate", ")", ";", "return", "session", ";", "}", "@", "Cacheable", "(", "value", "=", "\"itemCache\"", ",", "key", "=", "\"#id\"", ")", "public", "Item", "findById", "(", "Long", "id", ")", "{", "SqlSession", "session", "=", "getSqlSession", "(", ")", ";", "Item", "item", "=", "getCrudEngine", "(", "\"GET_ITEM\"", ")", ".", "get", "(", "session", ",", "Item", ".", "class", ",", "new", "Item", "(", "id", ")", ")", ";", "logger", ".", "info", "(", "\"findById:", "\"", "+", "item", ".", "toDebugString", "(", ")", ")", ";", "return", "item", ";", "}", "@", "CacheEvict", "(", "value", "=", "\"itemCache\"", ",", "key", "=", "\"#item.itemid\"", ")", "public", "Item", "create", "(", "Item", "item", ")", "{", "SqlSession", "session", "=", "getSqlSession", "(", ")", ";", "logger", ".", "info", "(", "\"create:", "\"", "+", "item", ".", "toDebugString", "(", ")", ")", ";", "getCrudEngine", "(", "\"INSERT_ITEM\"", ")", ".", "insert", "(", "session", ",", "item", ")", ";", "logger", ".", "info", "(", "\"create:", "\"", "+", "item", ".", "toDebugString", "(", ")", ")", ";", "return", "item", ";", "}", "@", "CacheEvict", "(", "value", "=", "\"itemCache\"", ",", "key", "=", "\"#item.itemid\"", ")", "public", "Item", "update", "(", "Item", "item", ")", "{", "SqlSession", "session", "=", "getSqlSession", "(", ")", ";", "logger", ".", "info", "(", "\"update:", "\"", "+", "item", ".", "toDebugString", "(", ")", ")", ";", "getCrudEngine", "(", "\"UPDATE_ITEM\"", ")", ".", "update", "(", "session", ",", "item", ")", ";", "logger", ".", "info", "(", "\"update:", "\"", "+", "item", ".", "toDebugString", "(", ")", ")", ";", "return", "item", ";", "}", "@", "CacheEvict", "(", "value", "=", "\"itemCache\"", ",", "key", "=", "\"#id\"", ")", "public", "void", "delete", "(", "Long", "id", ")", "{", "SqlSession", "session", "=", "getSqlSession", "(", ")", ";", "logger", ".", "info", "(", "\"delete:", "\"", "+", "id", ")", ";", "getCrudEngine", "(", "\"DELETE_ITEM\"", ")", ".", "delete", "(", "session", ",", "new", "Item", "(", "id", ")", ")", ";", "}", "public", "List", "<", "ItemTO", ">", "find", "(", "ItemForm", "criteria", ")", "{", "SqlSession", "session", "=", "getSqlSession", "(", ")", ";", "logger", ".", "info", "(", "\"find:", "\"", "+", "criteria", ")", ";", "return", "getQueryEngine", "(", "\"ITEMS\"", ")", ".", "query", "(", "session", ",", "ItemTO", ".", "class", ",", "criteria", ",", "null", ",", "SqlOrder", ".", "getOrder", "(", "criteria", ".", "getOrder", "(", ")", ")", ",", "0", ",", "criteria", ".", "getCount", "(", ")", ",", "criteria", ".", "getFirst", "(", ")", ")", ";", "}", "public", "int", "findCount", "(", "ItemForm", "criteria", ")", "{", "SqlSession", "session", "=", "getSqlSession", "(", ")", ";", "logger", ".", "info", "(", "\"findCount:", "\"", "+", "criteria", ")", ";", "return", "getQueryEngine", "(", "\"ITEMS\"", ")", ".", "queryCount", "(", "session", ",", "criteria", ")", ";", "}", "public", "SqlCrudEngine", "getCrudEngine", "(", "String", "name", ")", "{", "SqlCrudEngine", "queryEngine", "=", "sqlFactory", ".", "getCrudEngine", "(", "name", ")", ";", "if", "(", "queryEngine", "==", "null", ")", "throw", "new", "RuntimeException", "(", "\"\"", "+", "name", ")", ";", "return", "queryEngine", ";", "}", "public", "SqlQueryEngine", "getQueryEngine", "(", "String", "name", ")", "{", "SqlQueryEngine", "queryEngine", "=", "sqlFactory", ".", "getQueryEngine", "(", "name", ")", ";", "if", "(", "queryEngine", "==", "null", ")", "throw", "new", "RuntimeException", "(", "\"\"", "+", "name", ")", ";", "return", "queryEngine", ";", "}", "public", "void", "setJdbcTemplate", "(", "JdbcTemplate", "jdbcTemplate", ")", "{", "this", ".", "jdbcTemplate", "=", "jdbcTemplate", ";", "}", "public", "void", "setSqlFactory", "(", "SqlEngineFactory", "sqlFactory", ")", "{", "this", ".", "sqlFactory", "=", "sqlFactory", ";", "}", "}", "</s>" ]
804
[ "<s>", "package", "org", ".", "sqlproc", ".", "sample", ".", "catalog", ".", "model", ";", "import", "java", ".", "io", ".", "Serializable", ";", "import", "java", ".", "math", ".", "BigDecimal", ";", "import", "java", ".", "math", ".", "BigInteger", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "annotation", ".", "Pojo", ";", "@", "Pojo", "public", "class", "Item", "implements", "Serializable", "{", "private", "Long", "itemid", ";", "private", "String", "productid", ";", "private", "String", "name", ";", "private", "String", "description", ";", "private", "String", "imageurl", ";", "private", "String", "imagethumburl", ";", "private", "byte", "[", "]", "image", ";", "private", "byte", "[", "]", "imagethumb", ";", "private", "BigDecimal", "price", ";", "public", "Item", "(", ")", "{", "}", "public", "Item", "(", "Long", "itemid", ")", "{", "this", ".", "itemid", "=", "itemid", ";", "}", "public", "Item", "(", "Long", "itemid", ",", "String", "productid", ",", "String", "name", ",", "String", "description", ",", "String", "imageurl", ",", "String", "imagethumburl", ",", "BigDecimal", "price", ")", "{", "this", ".", "itemid", "=", "itemid", ";", "this", ".", "productid", "=", "productid", ";", "this", ".", "name", "=", "name", ";", "this", ".", "description", "=", "description", ";", "this", ".", "imageurl", "=", "imageurl", ";", "this", ".", "imagethumburl", "=", "imagethumburl", ";", "this", ".", "price", "=", "price", ";", "}", "public", "Item", "(", "int", "itemid", ",", "String", "productid", ",", "String", "name", ",", "String", "description", ",", "String", "imageurl", ",", "String", "imagethumburl", ",", "double", "price", ")", "{", "this", ".", "itemid", "=", "new", "Long", "(", "itemid", ")", ";", "this", ".", "productid", "=", "productid", ";", "this", ".", "name", "=", "name", ";", "this", ".", "description", "=", "description", ";", "this", ".", "imageurl", "=", "imageurl", ";", "this", ".", "imagethumburl", "=", "imagethumburl", ";", "this", ".", "price", "=", "new", "BigDecimal", "(", "price", ")", ";", "}", "public", "Long", "getItemid", "(", ")", "{", "return", "itemid", ";", "}", "public", "void", "setItemid", "(", "Long", "itemid", ")", "{", "this", ".", "itemid", "=", "itemid", ";", "}", "public", "void", "setItemid", "(", "BigInteger", "itemid", ")", "{", "if", "(", "itemid", "!=", "null", ")", "this", ".", "itemid", "=", "itemid", ".", "longValue", "(", ")", ";", "else", "this", ".", "itemid", "=", "null", ";", "}", "public", "String", "getProductid", "(", ")", "{", "return", "productid", ";", "}", "public", "void", "setProductid", "(", "String", "productid", ")", "{", "this", ".", "productid", "=", "productid", ";", "}", "public", "String", "getName", "(", ")", "{", "return", "name", ";", "}", "public", "void", "setName", "(", "String", "name", ")", "{", "this", ".", "name", "=", "name", ";", "}", "public", "String", "getDescription", "(", ")", "{", "return", "description", ";", "}", "public", "void", "setDescription", "(", "String", "description", ")", "{", "this", ".", "description", "=", "description", ";", "}", "public", "String", "getImageurl", "(", ")", "{", "return", "imageurl", ";", "}", "public", "void", "setImageurl", "(", "String", "imageurl", ")", "{", "this", ".", "imageurl", "=", "imageurl", ";", "}", "public", "String", "getImagethumburl", "(", ")", "{", "return", "imagethumburl", ";", "}", "public", "void", "setImagethumburl", "(", "String", "imagethumburl", ")", "{", "this", ".", "imagethumburl", "=", "imagethumburl", ";", "}", "public", "byte", "[", "]", "getImage", "(", ")", "{", "return", "image", ";", "}", "public", "void", "setImage", "(", "byte", "[", "]", "image", ")", "{", "this", ".", "image", "=", "image", ";", "}", "public", "byte", "[", "]", "getImagethumb", "(", ")", "{", "return", "imagethumb", ";", "}", "public", "void", "setImagethumb", "(", "byte", "[", "]", "imagethumb", ")", "{", "this", ".", "imagethumb", "=", "imagethumb", ";", "}", "public", "BigDecimal", "getPrice", "(", ")", "{", "return", "price", ";", "}", "public", "void", "setPrice", "(", "BigDecimal", "price", ")", "{", "this", ".", "price", "=", "price", ";", "}", "@", "Override", "public", "int", "hashCode", "(", ")", "{", "int", "hash", "=", "0", ";", "hash", "+=", "(", "itemid", "!=", "null", "?", "itemid", ".", "hashCode", "(", ")", ":", "0", ")", ";", "return", "hash", ";", "}", "@", "Override", "public", "boolean", "equals", "(", "Object", "object", ")", "{", "if", "(", "!", "(", "object", "instanceof", "Item", ")", ")", "{", "return", "false", ";", "}", "Item", "other", "=", "(", "Item", ")", "object", ";", "if", "(", "(", "this", ".", "itemid", "==", "null", "&&", "other", ".", "itemid", "!=", "null", ")", "||", "(", "this", ".", "itemid", "!=", "null", "&&", "!", "this", ".", "itemid", ".", "equals", "(", "other", ".", "itemid", ")", ")", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}", "public", "String", "toDebugString", "(", ")", "{", "return", "\"\"", "+", "itemid", "+", "\",", "productid=\"", "+", "productid", "+", "\",", "name=\"", "+", "name", "+", "\"\"", "+", "description", "+", "\",", "imageurl=\"", "+", "imageurl", "+", "\"\"", "+", "imagethumburl", "+", "\",", "image=\"", "+", "image", "+", "\"\"", "+", "imagethumb", "+", "\",", "price=\"", "+", "price", "+", "\"]\"", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "name", ";", "}", "}", "</s>" ]
805
[ "<s>", "package", "org", ".", "sqlproc", ".", "sample", ".", "catalog", ".", "form", ";", "import", "java", ".", "io", ".", "Serializable", ";", "import", "java", ".", "math", ".", "BigDecimal", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "annotation", ".", "Pojo", ";", "@", "Pojo", "public", "class", "ItemForm", "implements", "Serializable", "{", "private", "Long", "itemid", ";", "private", "String", "name", ";", "private", "String", "description", ";", "private", "BigDecimal", "priceFrom", ";", "private", "BigDecimal", "priceTo", ";", "public", "ItemForm", "(", ")", "{", "}", "public", "Long", "getItemid", "(", ")", "{", "return", "itemid", ";", "}", "public", "void", "setItemid", "(", "Long", "itemid", ")", "{", "this", ".", "itemid", "=", "itemid", ";", "}", "public", "String", "getName", "(", ")", "{", "return", "name", ";", "}", "public", "void", "setName", "(", "String", "name", ")", "{", "this", ".", "name", "=", "name", ";", "}", "public", "String", "getDescription", "(", ")", "{", "return", "description", ";", "}", "public", "void", "setDescription", "(", "String", "description", ")", "{", "this", ".", "description", "=", "description", ";", "}", "public", "BigDecimal", "getPriceFrom", "(", ")", "{", "return", "priceFrom", ";", "}", "public", "void", "setPriceFrom", "(", "BigDecimal", "priceFrom", ")", "{", "this", ".", "priceFrom", "=", "priceFrom", ";", "}", "public", "BigDecimal", "getPriceTo", "(", ")", "{", "return", "priceTo", ";", "}", "public", "void", "setPriceTo", "(", "BigDecimal", "priceTo", ")", "{", "this", ".", "priceTo", "=", "priceTo", ";", "}", "int", "first", ";", "int", "count", ";", "int", "order", ";", "public", "int", "getFirst", "(", ")", "{", "return", "first", ";", "}", "public", "void", "setFirst", "(", "int", "first", ")", "{", "this", ".", "first", "=", "first", ";", "}", "public", "int", "getCount", "(", ")", "{", "return", "count", ";", "}", "public", "void", "setCount", "(", "int", "count", ")", "{", "this", ".", "count", "=", "count", ";", "}", "public", "int", "getOrder", "(", ")", "{", "return", "order", ";", "}", "public", "void", "setOrder", "(", "int", "order", ")", "{", "this", ".", "order", "=", "order", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "\"\"", "+", "name", "+", "\"\"", "+", "description", "+", "\",", "priceFrom=\"", "+", "priceFrom", "+", "\",", "priceTo=\"", "+", "priceTo", "+", "\",", "first=\"", "+", "first", "+", "\",", "count=\"", "+", "count", "+", "\",", "order=\"", "+", "order", "+", "\"]\"", ";", "}", "}", "</s>" ]
806
[ "<s>", "package", "org", ".", "sqlproc", ".", "sample", ".", "catalog", ".", "wicket", ";", "import", "java", ".", "awt", ".", "image", ".", "BufferedImage", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "image", ".", "resource", ".", "DynamicImageResource", ";", "public", "class", "ImageResource", "extends", "DynamicImageResource", "{", "private", "byte", "[", "]", "image", ";", "public", "ImageResource", "(", "byte", "[", "]", "image", ",", "String", "format", ")", "{", "this", ".", "image", "=", "image", ";", "setFormat", "(", "format", ")", ";", "}", "public", "ImageResource", "(", "BufferedImage", "image", ")", "{", "this", ".", "image", "=", "toImageData", "(", "image", ")", ";", "}", "@", "Override", "protected", "byte", "[", "]", "getImageData", "(", ")", "{", "if", "(", "image", "!=", "null", ")", "{", "return", "image", ";", "}", "else", "{", "return", "new", "byte", "[", "0", "]", ";", "}", "}", "@", "Override", "protected", "int", "getCacheDuration", "(", ")", "{", "return", "3600", "*", "24", ";", "}", "}", "</s>" ]
807
[ "<s>", "package", "org", ".", "sqlproc", ".", "sample", ".", "catalog", ".", "wicket", ";", "import", "org", ".", "apache", ".", "wicket", ".", "PageParameters", ";", "import", "org", ".", "apache", ".", "wicket", ".", "ResourceReference", ";", "import", "org", ".", "apache", ".", "wicket", ".", "behavior", ".", "SimpleAttributeModifier", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "basic", ".", "Label", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "form", ".", "Button", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "form", ".", "Form", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "image", ".", "Image", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "image", ".", "NonCachingImage", ";", "import", "org", ".", "apache", ".", "wicket", ".", "model", ".", "AbstractReadOnlyModel", ";", "import", "org", ".", "apache", ".", "wicket", ".", "model", ".", "CompoundPropertyModel", ";", "import", "org", ".", "apache", ".", "wicket", ".", "spring", ".", "injection", ".", "annot", ".", "SpringBean", ";", "import", "org", ".", "sqlproc", ".", "sample", ".", "catalog", ".", "model", ".", "Item", ";", "import", "org", ".", "sqlproc", ".", "sample", ".", "catalog", ".", "service", ".", "ItemService", ";", "public", "class", "ItemDetails", "extends", "BasePage", "{", "@", "SpringBean", "(", "name", "=", "\"itemService\"", ")", "ItemService", "itemService", ";", "public", "ItemDetails", "(", ")", "{", "createPage", "(", "new", "Item", "(", ")", ")", ";", "}", "public", "ItemDetails", "(", "PageParameters", "params", ")", "{", "Item", "item", "=", "itemService", ".", "findById", "(", "params", ".", "getLong", "(", "\"itemid\"", ")", ")", ";", "createPage", "(", "item", ")", ";", "}", "private", "void", "createPage", "(", "final", "Item", "item", ")", "{", "add", "(", "new", "Label", "(", "\"name\"", ",", "item", ".", "getName", "(", ")", ")", ")", ";", "add", "(", "new", "Label", "(", "\"description\"", ",", "item", ".", "getDescription", "(", ")", ")", ")", ";", "if", "(", "item", ".", "getImage", "(", ")", "!=", "null", "&&", "item", ".", "getImage", "(", ")", ".", "length", ">", "0", ")", "{", "add", "(", "new", "NonCachingImage", "(", "\"image\"", ",", "new", "AbstractReadOnlyModel", "(", ")", "{", "@", "Override", "public", "Object", "getObject", "(", ")", "{", "return", "new", "ImageResource", "(", "item", ".", "getImage", "(", ")", ",", "\"jpg\"", ")", ";", "}", "}", ")", ")", ";", "}", "else", "{", "add", "(", "new", "Image", "(", "\"image\"", ",", "new", "ResourceReference", "(", "this", ".", "getClass", "(", ")", ",", "\"\"", ")", ")", ")", ";", "}", "final", "Form", "<", "Item", ">", "form", "=", "new", "Form", "<", "Item", ">", "(", "\"detailsForm\"", ",", "new", "CompoundPropertyModel", "<", "Item", ">", "(", "item", ")", ")", ";", "add", "(", "form", ")", ";", "form", ".", "add", "(", "new", "Button", "(", "\"doEdit\"", ")", "{", "@", "Override", "public", "void", "onSubmit", "(", ")", "{", "Item", "item", "=", "form", ".", "getModelObject", "(", ")", ";", "setResponsePage", "(", "new", "ItemEdit", "(", "item", ".", "getItemid", "(", ")", ",", "null", ")", ")", ";", "}", "}", ")", ";", "form", ".", "add", "(", "new", "Button", "(", "\"doDelete\"", ")", "{", "@", "Override", "public", "void", "onSubmit", "(", ")", "{", "Item", "item", "=", "form", ".", "getModelObject", "(", ")", ";", "itemService", ".", "delete", "(", "item", ".", "getItemid", "(", ")", ")", ";", "setResponsePage", "(", "ItemList", ".", "class", ")", ";", "}", "}", ".", "add", "(", "new", "SimpleAttributeModifier", "(", "\"onclick\"", ",", "\"\"", ")", ")", ")", ";", "form", ".", "add", "(", "new", "Button", "(", "\"doList\"", ")", "{", "@", "Override", "public", "void", "onSubmit", "(", ")", "{", "setResponsePage", "(", "ItemList", ".", "class", ")", ";", "}", "}", ")", ";", "form", ".", "add", "(", "new", "Button", "(", "\"doSearch\"", ")", "{", "@", "Override", "public", "void", "onSubmit", "(", ")", "{", "setResponsePage", "(", "ItemSearch", ".", "class", ")", ";", "}", "}", ")", ";", "}", "}", "</s>" ]
808
[ "<s>", "package", "org", ".", "sqlproc", ".", "sample", ".", "catalog", ".", "wicket", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "WebPage", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "resources", ".", "StyleSheetReference", ";", "import", "org", ".", "apache", ".", "wicket", ".", "model", ".", "IModel", ";", "import", "org", ".", "apache", ".", "wicket", ".", "util", ".", "string", ".", "Strings", ";", "public", "class", "BasePage", "extends", "WebPage", "{", "public", "BasePage", "(", ")", "{", "this", "(", "null", ")", ";", "}", "public", "BasePage", "(", "IModel", "<", "?", ">", "model", ")", "{", "super", "(", "model", ")", ";", "final", "String", "packageName", "=", "getClass", "(", ")", ".", "getPackage", "(", ")", ".", "getName", "(", ")", ";", "add", "(", "new", "HeaderPanel", "(", "\"\"", ",", "Strings", ".", "afterLast", "(", "packageName", ",", "'.'", ")", ")", ")", ";", "add", "(", "new", "StyleSheetReference", "(", "\"stylesheet\"", ",", "BasePage", ".", "class", ",", "\"style.css\"", ")", ")", ";", "}", "}", "</s>" ]
809
[ "<s>", "package", "org", ".", "sqlproc", ".", "sample", ".", "catalog", ".", "wicket", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "org", ".", "apache", ".", "wicket", ".", "PageParameters", ";", "import", "org", ".", "apache", ".", "wicket", ".", "ResourceReference", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "basic", ".", "Label", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "form", ".", "Button", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "form", ".", "Form", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "image", ".", "Image", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "image", ".", "NonCachingImage", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "link", ".", "BookmarkablePageLink", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "navigation", ".", "paging", ".", "PagingNavigator", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "repeater", ".", "Item", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "repeater", ".", "data", ".", "DataView", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "repeater", ".", "data", ".", "IDataProvider", ";", "import", "org", ".", "apache", ".", "wicket", ".", "model", ".", "AbstractReadOnlyModel", ";", "import", "org", ".", "apache", ".", "wicket", ".", "model", ".", "CompoundPropertyModel", ";", "import", "org", ".", "apache", ".", "wicket", ".", "model", ".", "IModel", ";", "import", "org", ".", "apache", ".", "wicket", ".", "model", ".", "LoadableDetachableModel", ";", "import", "org", ".", "apache", ".", "wicket", ".", "model", ".", "Model", ";", "import", "org", ".", "apache", ".", "wicket", ".", "spring", ".", "injection", ".", "annot", ".", "SpringBean", ";", "import", "org", ".", "sqlproc", ".", "sample", ".", "catalog", ".", "form", ".", "ItemForm", ";", "import", "org", ".", "sqlproc", ".", "sample", ".", "catalog", ".", "service", ".", "ItemService", ";", "import", "org", ".", "sqlproc", ".", "sample", ".", "catalog", ".", "to", ".", "ItemTO", ";", "public", "class", "ItemList", "extends", "BasePage", "{", "private", "static", "final", "int", "ROWS_PER_PAGE", "=", "5", ";", "@", "SpringBean", "(", "name", "=", "\"itemService\"", ")", "ItemService", "itemService", ";", "public", "ItemList", "(", "final", "ItemForm", "searchForm", ")", "{", "createPage", "(", "searchForm", ")", ";", "}", "public", "ItemList", "(", "final", "PageParameters", "parameters", ")", "{", "createPage", "(", "new", "ItemForm", "(", ")", ")", ";", "}", "private", "void", "createPage", "(", "final", "ItemForm", "searchForm", ")", "{", "IDataProvider", "<", "ItemTO", ">", "itemDataProvider", "=", "new", "IDataProvider", "<", "ItemTO", ">", "(", ")", "{", "@", "Override", "public", "Iterator", "<", "ItemTO", ">", "iterator", "(", "int", "first", ",", "int", "count", ")", "{", "searchForm", ".", "setFirst", "(", "first", ")", ";", "searchForm", ".", "setCount", "(", "count", ")", ";", "searchForm", ".", "setOrder", "(", "1", ")", ";", "return", "itemService", ".", "find", "(", "searchForm", ")", ".", "iterator", "(", ")", ";", "}", "@", "Override", "public", "int", "size", "(", ")", "{", "return", "itemService", ".", "findCount", "(", "searchForm", ")", ";", "}", "@", "Override", "public", "IModel", "<", "ItemTO", ">", "model", "(", "final", "ItemTO", "object", ")", "{", "return", "new", "LoadableDetachableModel", "<", "ItemTO", ">", "(", ")", "{", "@", "Override", "protected", "ItemTO", "load", "(", ")", "{", "return", "object", ";", "}", "}", ";", "}", "@", "Override", "public", "void", "detach", "(", ")", "{", "}", "}", ";", "DataView", "<", "ItemTO", ">", "dataView", "=", "new", "DataView", "<", "ItemTO", ">", "(", "\"rows\"", ",", "itemDataProvider", ",", "ROWS_PER_PAGE", ")", "{", "@", "Override", "protected", "void", "populateItem", "(", "Item", "<", "ItemTO", ">", "repItem", ")", "{", "final", "ItemTO", "item", "=", "repItem", ".", "getModelObject", "(", ")", ";", "repItem", ".", "setModel", "(", "new", "CompoundPropertyModel", "<", "ItemTO", ">", "(", "item", ")", ")", ";", "repItem", ".", "add", "(", "link", "(", "\"details\"", ",", "item", ")", ")", ";", "if", "(", "item", ".", "getImagethumb", "(", ")", "!=", "null", "&&", "item", ".", "getImagethumb", "(", ")", ".", "length", ">", "0", ")", "{", "repItem", ".", "add", "(", "new", "NonCachingImage", "(", "\"imagethumb\"", ",", "new", "AbstractReadOnlyModel", "(", ")", "{", "@", "Override", "public", "Object", "getObject", "(", ")", "{", "return", "new", "ImageResource", "(", "item", ".", "getImagethumb", "(", ")", ",", "\"jpg\"", ")", ";", "}", "}", ")", ")", ";", "}", "else", "{", "repItem", ".", "add", "(", "new", "Image", "(", "\"imagethumb\"", ",", "new", "ResourceReference", "(", "this", ".", "getClass", "(", ")", ",", "\"\"", ")", ")", ")", ";", "}", "repItem", ".", "add", "(", "new", "Label", "(", "\"price\"", ")", ")", ";", "}", "}", ";", "add", "(", "dataView", ")", ";", "PagingNavigator", "pager", "=", "new", "PagingNavigator", "(", "\"pager\"", ",", "dataView", ")", ";", "add", "(", "pager", ")", ";", "final", "Form", "<", "Item", ">", "form", "=", "new", "Form", "<", "Item", ">", "(", "\"listForm\"", ")", ";", "add", "(", "form", ")", ";", "form", ".", "add", "(", "new", "Button", "(", "\"doNew\"", ")", "{", "@", "Override", "public", "void", "onSubmit", "(", ")", "{", "setResponsePage", "(", "new", "ItemEdit", "(", "null", ",", "ItemList", ".", "this", ")", ")", ";", "}", "}", ")", ";", "form", ".", "add", "(", "new", "Button", "(", "\"doSearch\"", ")", "{", "@", "Override", "public", "void", "onSubmit", "(", ")", "{", "setResponsePage", "(", "ItemSearch", ".", "class", ")", ";", "}", "}", ")", ";", "}", "public", "static", "BookmarkablePageLink", "<", "Void", ">", "link", "(", "final", "String", "name", ",", "final", "ItemTO", "item", ")", "{", "final", "BookmarkablePageLink", "<", "Void", ">", "link", "=", "new", "BookmarkablePageLink", "<", "Void", ">", "(", "name", ",", "ItemDetails", ".", "class", ")", ";", "if", "(", "item", "!=", "null", ")", "{", "link", ".", "setParameter", "(", "\"itemid\"", ",", "item", ".", "getItemid", "(", ")", ")", ";", "link", ".", "add", "(", "new", "Label", "(", "\"name\"", ",", "new", "Model", "<", "ItemTO", ">", "(", "item", ")", ")", ")", ";", "}", "return", "link", ";", "}", "}", "</s>" ]
810
[ "<s>", "package", "org", ".", "sqlproc", ".", "sample", ".", "catalog", ".", "wicket", ";", "import", "org", ".", "apache", ".", "wicket", ".", "PageParameters", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "form", ".", "Button", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "form", ".", "Form", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "form", ".", "StatelessForm", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "form", ".", "TextField", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "link", ".", "Link", ";", "import", "org", ".", "apache", ".", "wicket", ".", "model", ".", "CompoundPropertyModel", ";", "import", "org", ".", "sqlproc", ".", "sample", ".", "catalog", ".", "form", ".", "ItemForm", ";", "public", "class", "ItemSearch", "extends", "BasePage", "{", "public", "ItemSearch", "(", "PageParameters", "params", ")", "{", "final", "ItemForm", "searchForm", "=", "new", "ItemForm", "(", ")", ";", "final", "Form", "form", "=", "new", "StatelessForm", "(", "\"searchForm\"", ",", "new", "CompoundPropertyModel", "(", "searchForm", ")", ")", ";", "add", "(", "form", ")", ";", "form", ".", "add", "(", "new", "TextField", "(", "\"name\"", ")", ")", ";", "form", ".", "add", "(", "new", "TextField", "(", "\"description\"", ")", ")", ";", "form", ".", "add", "(", "new", "TextField", "(", "\"priceFrom\"", ")", ")", ";", "form", ".", "add", "(", "new", "TextField", "(", "\"priceTo\"", ")", ")", ";", "form", ".", "add", "(", "new", "Button", "(", "\"findItems\"", ")", "{", "@", "Override", "public", "void", "onSubmit", "(", ")", "{", "setResponsePage", "(", "new", "ItemList", "(", "searchForm", ")", ")", ";", "}", "}", ")", ";", "form", ".", "add", "(", "new", "Link", "(", "\"doNew\"", ")", "{", "@", "Override", "public", "void", "onClick", "(", ")", "{", "setResponsePage", "(", "new", "ItemEdit", "(", "null", ",", "ItemSearch", ".", "this", ")", ")", ";", "}", "}", ")", ";", "}", "}", "</s>" ]
811
[ "<s>", "package", "org", ".", "sqlproc", ".", "sample", ".", "catalog", ".", "wicket", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "panel", ".", "Panel", ";", "public", "class", "HeaderPanel", "extends", "Panel", "{", "public", "HeaderPanel", "(", "String", "componentName", ",", "String", "exampleTitle", ")", "{", "super", "(", "componentName", ")", ";", "}", "}", "</s>" ]
812
[ "<s>", "package", "org", ".", "sqlproc", ".", "sample", ".", "catalog", ".", "wicket", ";", "import", "org", ".", "apache", ".", "wicket", ".", "protocol", ".", "http", ".", "WebApplication", ";", "import", "org", ".", "apache", ".", "wicket", ".", "spring", ".", "injection", ".", "annot", ".", "SpringComponentInjector", ";", "import", "org", ".", "apache", ".", "wicket", ".", "util", ".", "time", ".", "Duration", ";", "public", "class", "Application", "extends", "WebApplication", "{", "public", "Application", "(", ")", "{", "}", "public", "Class", "getHomePage", "(", ")", "{", "return", "ItemSearch", ".", "class", ";", "}", "@", "Override", "protected", "void", "init", "(", ")", "{", "super", ".", "init", "(", ")", ";", "addComponentInstantiationListener", "(", "new", "SpringComponentInjector", "(", "this", ")", ")", ";", "if", "(", "Application", ".", "DEPLOYMENT", ".", "equals", "(", "getConfigurationType", "(", ")", ")", ")", "{", "getMarkupSettings", "(", ")", ".", "setStripWicketTags", "(", "true", ")", ";", "getMarkupSettings", "(", ")", ".", "setCompressWhitespace", "(", "true", ")", ";", "}", "else", "{", "getResourceSettings", "(", ")", ".", "setResourcePollFrequency", "(", "Duration", ".", "ONE_SECOND", ")", ";", "}", "getMarkupSettings", "(", ")", ".", "setDefaultAfterDisabledLink", "(", "\"\"", ")", ";", "}", "}", "</s>" ]
813
[ "<s>", "package", "org", ".", "sqlproc", ".", "sample", ".", "catalog", ".", "wicket", ";", "import", "org", ".", "apache", ".", "wicket", ".", "PageParameters", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "WebPage", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "basic", ".", "Label", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "form", ".", "Button", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "form", ".", "Form", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "form", ".", "StatelessForm", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "form", ".", "TextArea", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "form", ".", "TextField", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "form", ".", "upload", ".", "FileUpload", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "form", ".", "upload", ".", "FileUploadField", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "link", ".", "Link", ";", "import", "org", ".", "apache", ".", "wicket", ".", "markup", ".", "html", ".", "panel", ".", "FeedbackPanel", ";", "import", "org", ".", "apache", ".", "wicket", ".", "model", ".", "CompoundPropertyModel", ";", "import", "org", ".", "apache", ".", "wicket", ".", "model", ".", "IModel", ";", "import", "org", ".", "apache", ".", "wicket", ".", "spring", ".", "injection", ".", "annot", ".", "SpringBean", ";", "import", "org", ".", "sqlproc", ".", "sample", ".", "catalog", ".", "model", ".", "Item", ";", "import", "org", ".", "sqlproc", ".", "sample", ".", "catalog", ".", "service", ".", "ItemService", ";", "public", "class", "ItemEdit", "extends", "BasePage", "{", "@", "SpringBean", "(", "name", "=", "\"itemService\"", ")", "ItemService", "itemService", ";", "final", "WebPage", "previousPage", ";", "FileUploadField", "imageUploadField", ";", "FileUploadField", "imagethumbUploadField", ";", "public", "ItemEdit", "(", "Long", "itemid", ",", "WebPage", "previousPage", ")", "{", "this", ".", "previousPage", "=", "previousPage", ";", "final", "Item", "item", "=", "(", "itemid", "!=", "null", ")", "?", "itemService", ".", "findById", "(", "itemid", ")", ":", "new", "Item", "(", ")", ";", "final", "Form", "<", "Item", ">", "form", "=", "new", "StatelessForm", "<", "Item", ">", "(", "\"editForm\"", ",", "new", "CompoundPropertyModel", "<", "Item", ">", "(", "item", ")", ")", ";", "form", ".", "setMultiPart", "(", "true", ")", ";", "add", "(", "form", ")", ";", "form", ".", "add", "(", "new", "FeedbackPanel", "(", "\"feedback\"", ")", ")", ";", "form", ".", "add", "(", "new", "TextField", "(", "\"productid\"", ")", ".", "setRequired", "(", "true", ")", ")", ";", "form", ".", "add", "(", "new", "TextField", "(", "\"name\"", ")", ".", "setRequired", "(", "true", ")", ")", ";", "form", ".", "add", "(", "new", "TextArea", "(", "\"description\"", ")", ".", "setRequired", "(", "true", ")", ")", ";", "form", ".", "add", "(", "new", "FileUploadField", "(", "\"image\"", ",", "new", "IModel", "<", "FileUpload", ">", "(", ")", "{", "@", "Override", "public", "void", "detach", "(", ")", "{", "}", "@", "Override", "public", "FileUpload", "getObject", "(", ")", "{", "return", "null", ";", "}", "@", "Override", "public", "void", "setObject", "(", "FileUpload", "imageUpload", ")", "{", "if", "(", "imageUpload", "!=", "null", ")", "{", "item", ".", "setImageurl", "(", "imageUpload", ".", "getClientFileName", "(", ")", ")", ";", "item", ".", "setImage", "(", "imageUpload", ".", "getBytes", "(", ")", ")", ";", "}", "}", "}", ")", ")", ";", "form", ".", "add", "(", "new", "Label", "(", "\"imageurl\"", ",", "item", ".", "getImageurl", "(", ")", ")", ")", ";", "form", ".", "add", "(", "new", "FileUploadField", "(", "\"imagethumb\"", ",", "new", "IModel", "<", "FileUpload", ">", "(", ")", "{", "@", "Override", "public", "void", "detach", "(", ")", "{", "}", "@", "Override", "public", "FileUpload", "getObject", "(", ")", "{", "return", "null", ";", "}", "@", "Override", "public", "void", "setObject", "(", "FileUpload", "imagethumbUpload", ")", "{", "if", "(", "imagethumbUpload", "!=", "null", ")", "{", "item", ".", "setImagethumburl", "(", "imagethumbUpload", ".", "getClientFileName", "(", ")", ")", ";", "item", ".", "setImagethumb", "(", "imagethumbUpload", ".", "getBytes", "(", ")", ")", ";", "}", "}", "}", ")", ")", ";", "form", ".", "add", "(", "new", "Label", "(", "\"\"", ",", "item", ".", "getImagethumburl", "(", ")", ")", ")", ";", "form", ".", "add", "(", "new", "TextField", "(", "\"price\"", ")", ".", "setRequired", "(", "true", ")", ")", ";", "form", ".", "add", "(", "new", "Button", "(", "\"doSave\"", ")", "{", "@", "Override", "public", "void", "onSubmit", "(", ")", "{", "Item", "item", "=", "form", ".", "getModelObject", "(", ")", ";", "Long", "itemid", "=", "(", "item", ".", "getItemid", "(", ")", "!=", "null", ")", "?", "itemService", ".", "update", "(", "item", ")", ":", "itemService", ".", "create", "(", "item", ")", ";", "PageParameters", "pp", "=", "new", "PageParameters", "(", ")", ";", "pp", ".", "put", "(", "\"itemid\"", ",", "itemid", ")", ";", "setResponsePage", "(", "ItemDetails", ".", "class", ",", "pp", ")", ";", "}", "}", ")", ";", "form", ".", "add", "(", "new", "Button", "(", "\"\"", ")", "{", "@", "Override", "public", "void", "onSubmit", "(", ")", "{", "Item", "item", "=", "form", ".", "getModelObject", "(", ")", ";", "item", ".", "setImage", "(", "null", ")", ";", "item", ".", "setImageurl", "(", "null", ")", ";", "itemService", ".", "update", "(", "item", ")", ";", "PageParameters", "pp", "=", "new", "PageParameters", "(", ")", ";", "pp", ".", "put", "(", "\"itemid\"", ",", "item", ".", "getItemid", "(", ")", ")", ";", "setResponsePage", "(", "ItemDetails", ".", "class", ",", "pp", ")", ";", "}", "}", ".", "setVisibilityAllowed", "(", "item", ".", "getItemid", "(", ")", "!=", "null", ")", ")", ";", "form", ".", "add", "(", "new", "Button", "(", "\"\"", ")", "{", "@", "Override", "public", "void", "onSubmit", "(", ")", "{", "Item", "item", "=", "form", ".", "getModelObject", "(", ")", ";", "item", ".", "setImagethumb", "(", "null", ")", ";", "item", ".", "setImagethumburl", "(", "null", ")", ";", "itemService", ".", "update", "(", "item", ")", ";", "PageParameters", "pp", "=", "new", "PageParameters", "(", ")", ";", "pp", ".", "put", "(", "\"itemid\"", ",", "item", ".", "getItemid", "(", ")", ")", ";", "setResponsePage", "(", "ItemDetails", ".", "class", ",", "pp", ")", ";", "}", "}", ".", "setVisibilityAllowed", "(", "item", ".", "getItemid", "(", ")", "!=", "null", ")", ")", ";", "form", ".", "add", "(", "new", "Link", "(", "\"doCancel\"", ")", "{", "@", "Override", "public", "void", "onClick", "(", ")", "{", "Item", "item", "=", "form", ".", "getModelObject", "(", ")", ";", "if", "(", "item", ".", "getItemid", "(", ")", "==", "null", ")", "{", "if", "(", "ItemEdit", ".", "this", ".", "previousPage", "!=", "null", ")", "setResponsePage", "(", "ItemEdit", ".", "this", ".", "previousPage", ")", ";", "else", "setResponsePage", "(", "ItemList", ".", "class", ")", ";", "}", "else", "{", "PageParameters", "pp", "=", "new", "PageParameters", "(", ")", ";", "pp", ".", "put", "(", "\"itemid\"", ",", "item", ".", "getItemid", "(", ")", ")", ";", "setResponsePage", "(", "ItemDetails", ".", "class", ",", "pp", ")", ";", "}", "}", "}", ")", ";", "}", "}", "</s>" ]
814
[ "<s>", "package", "org", ".", "sqlproc", ".", "sample", ".", "simple", ".", "model", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "annotation", ".", "Pojo", ";", "@", "Pojo", "public", "class", "CreditCard", "extends", "BillingDetails", "{", "private", "Long", "number", ";", "public", "CreditCard", "(", ")", "{", "}", "public", "CreditCard", "(", "Long", "number", ",", "Subscriber", "subscriber", ")", "{", "super", "(", "\"CC\"", ",", "subscriber", ")", ";", "this", ".", "number", "=", "number", ";", "}", "public", "Long", "getNumber", "(", ")", "{", "return", "number", ";", "}", "public", "void", "setNumber", "(", "Long", "number", ")", "{", "this", ".", "number", "=", "number", ";", "}", "}", "</s>" ]
815
[ "<s>", "package", "org", ".", "sqlproc", ".", "sample", ".", "simple", ".", "model", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "annotation", ".", "Pojo", ";", "@", "Pojo", "public", "abstract", "class", "BillingDetails", "{", "private", "Long", "id", ";", "private", "String", "type", ";", "private", "Subscriber", "subscriber", ";", "public", "BillingDetails", "(", ")", "{", "}", "public", "BillingDetails", "(", "String", "type", ",", "Subscriber", "subscriber", ")", "{", "this", ".", "type", "=", "type", ";", "this", ".", "subscriber", "=", "subscriber", ";", "}", "public", "Long", "getId", "(", ")", "{", "return", "id", ";", "}", "public", "void", "setId", "(", "Long", "id", ")", "{", "this", ".", "id", "=", "id", ";", "}", "public", "String", "getType", "(", ")", "{", "return", "type", ";", "}", "public", "void", "setType", "(", "String", "type", ")", "{", "this", ".", "type", "=", "type", ";", "}", "public", "Subscriber", "getSubscriber", "(", ")", "{", "return", "subscriber", ";", "}", "public", "void", "setSubscriber", "(", "Subscriber", "subscriber", ")", "{", "this", ".", "subscriber", "=", "subscriber", ";", "}", "}", "</s>" ]
816
[ "<s>", "package", "org", ".", "sqlproc", ".", "sample", ".", "simple", ".", "model", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "annotation", ".", "Pojo", ";", "@", "Pojo", "public", "class", "Person", "{", "private", "Long", "id", ";", "private", "String", "name", ";", "private", "List", "<", "Contact", ">", "contacts", ";", "private", "List", "<", "Media", ">", "library", ";", "public", "Person", "(", ")", "{", "}", "public", "Person", "(", "String", "name", ")", "{", "this", ".", "name", "=", "name", ";", "}", "public", "Long", "getId", "(", ")", "{", "return", "id", ";", "}", "public", "void", "setId", "(", "Long", "id", ")", "{", "this", ".", "id", "=", "id", ";", "}", "public", "String", "getName", "(", ")", "{", "return", "name", ";", "}", "public", "void", "setName", "(", "String", "name", ")", "{", "this", ".", "name", "=", "name", ";", "}", "public", "List", "<", "Contact", ">", "getContacts", "(", ")", "{", "return", "contacts", ";", "}", "public", "void", "setContacts", "(", "List", "<", "Contact", ">", "contacts", ")", "{", "this", ".", "contacts", "=", "contacts", ";", "}", "public", "List", "<", "Media", ">", "getLibrary", "(", ")", "{", "return", "library", ";", "}", "public", "void", "setLibrary", "(", "List", "<", "Media", ">", "library", ")", "{", "this", ".", "library", "=", "library", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "\"Person", "[id=\"", "+", "id", "+", "\",", "name=\"", "+", "name", "+", "\",", "contacts=\"", "+", "contacts", "+", "\",", "library=\"", "+", "library", "+", "\"]\"", ";", "}", "}", "</s>" ]
817
[ "<s>", "package", "org", ".", "sqlproc", ".", "sample", ".", "simple", ".", "model", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "annotation", ".", "Pojo", ";", "@", "Pojo", "public", "class", "BankAccount", "extends", "BillingDetails", "{", "private", "String", "account", ";", "public", "BankAccount", "(", ")", "{", "}", "public", "BankAccount", "(", "String", "account", ",", "Subscriber", "subscriber", ")", "{", "super", "(", "\"BA\"", ",", "subscriber", ")", ";", "this", ".", "account", "=", "account", ";", "}", "public", "String", "getAccount", "(", ")", "{", "return", "account", ";", "}", "public", "void", "setAccount", "(", "String", "account", ")", "{", "this", ".", "account", "=", "account", ";", "}", "}", "</s>" ]
818
[ "<s>", "package", "org", ".", "sqlproc", ".", "sample", ".", "simple", ".", "model", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "annotation", ".", "Pojo", ";", "@", "Pojo", "public", "class", "Library", "{", "private", "Long", "id", ";", "private", "String", "name", ";", "public", "Library", "(", ")", "{", "}", "public", "Library", "(", "String", "name", ")", "{", "this", ".", "name", "=", "name", ";", "}", "public", "Long", "getId", "(", ")", "{", "return", "id", ";", "}", "public", "void", "setId", "(", "Long", "id", ")", "{", "this", ".", "id", "=", "id", ";", "}", "public", "String", "getName", "(", ")", "{", "return", "name", ";", "}", "public", "void", "setName", "(", "String", "name", ")", "{", "this", ".", "name", "=", "name", ";", "}", "}", "</s>" ]
819
[ "<s>", "package", "org", ".", "sqlproc", ".", "sample", ".", "simple", ".", "model", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "annotation", ".", "Pojo", ";", "@", "Pojo", "public", "class", "PersonLibrary", "{", "private", "Long", "id", ";", "private", "Long", "personId", ";", "private", "Long", "mediaId", ";", "public", "PersonLibrary", "(", "Long", "personId", ",", "Long", "mediaId", ")", "{", "this", ".", "personId", "=", "personId", ";", "this", ".", "mediaId", "=", "mediaId", ";", "}", "public", "Long", "getId", "(", ")", "{", "return", "id", ";", "}", "public", "void", "setId", "(", "Long", "id", ")", "{", "this", ".", "id", "=", "id", ";", "}", "public", "Long", "getPersonId", "(", ")", "{", "return", "personId", ";", "}", "public", "void", "setPersonId", "(", "Long", "personId", ")", "{", "this", ".", "personId", "=", "personId", ";", "}", "public", "Long", "getMediaId", "(", ")", "{", "return", "mediaId", ";", "}", "public", "void", "setMediaId", "(", "Long", "mediaId", ")", "{", "this", ".", "mediaId", "=", "mediaId", ";", "}", "}", "</s>" ]
820
[ "<s>", "package", "org", ".", "sqlproc", ".", "sample", ".", "simple", ".", "model", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "annotation", ".", "Pojo", ";", "@", "Pojo", "public", "class", "Contact", "{", "private", "Long", "id", ";", "private", "Long", "personId", ";", "private", "String", "address", ";", "private", "PhoneNumber", "homePhone", ";", "public", "Contact", "(", ")", "{", "}", "public", "Contact", "(", "String", "address", ")", "{", "this", ".", "address", "=", "address", ";", "}", "public", "Contact", "(", "String", "address", ",", "PhoneNumber", "homePhone", ")", "{", "this", ".", "address", "=", "address", ";", "this", ".", "homePhone", "=", "homePhone", ";", "}", "public", "Long", "getId", "(", ")", "{", "return", "id", ";", "}", "public", "void", "setId", "(", "Long", "id", ")", "{", "this", ".", "id", "=", "id", ";", "}", "public", "Long", "getPersonId", "(", ")", "{", "return", "personId", ";", "}", "public", "void", "setPersonId", "(", "Long", "personId", ")", "{", "this", ".", "personId", "=", "personId", ";", "}", "public", "String", "getAddress", "(", ")", "{", "return", "address", ";", "}", "public", "void", "setAddress", "(", "String", "address", ")", "{", "this", ".", "address", "=", "address", ";", "}", "public", "PhoneNumber", "getHomePhone", "(", ")", "{", "return", "homePhone", ";", "}", "public", "void", "setHomePhone", "(", "PhoneNumber", "homePhone", ")", "{", "this", ".", "homePhone", "=", "homePhone", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "\"Contact", "[id=\"", "+", "id", "+", "\",", "personId=\"", "+", "personId", "+", "\",", "address=\"", "+", "address", "+", "\",", "homePhone=\"", "+", "homePhone", "+", "\"]\"", ";", "}", "}", "</s>" ]
821
[ "<s>", "package", "org", ".", "sqlproc", ".", "sample", ".", "simple", ".", "model", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "annotation", ".", "Pojo", ";", "@", "Pojo", "public", "class", "Book", "extends", "Media", "{", "private", "String", "isbn", ";", "public", "Book", "(", ")", "{", "}", "public", "Book", "(", "String", "title", ",", "String", "isbn", ")", "{", "super", "(", "title", ")", ";", "this", ".", "isbn", "=", "isbn", ";", "}", "public", "String", "getIsbn", "(", ")", "{", "return", "isbn", ";", "}", "public", "void", "setIsbn", "(", "String", "isbn", ")", "{", "this", ".", "isbn", "=", "isbn", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "\"Book", "[isbn=\"", "+", "isbn", "+", "\",", "getId()=\"", "+", "getId", "(", ")", "+", "\"\"", "+", "getTitle", "(", ")", "+", "\"]\"", ";", "}", "}", "</s>" ]
822
[ "<s>", "package", "org", ".", "sqlproc", ".", "sample", ".", "simple", ".", "model", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "annotation", ".", "Pojo", ";", "@", "Pojo", "public", "abstract", "class", "Media", "{", "private", "Long", "id", ";", "private", "String", "title", ";", "public", "Media", "(", ")", "{", "}", "public", "Media", "(", "String", "title", ")", "{", "this", ".", "title", "=", "title", ";", "}", "public", "Long", "getId", "(", ")", "{", "return", "id", ";", "}", "public", "void", "setId", "(", "Long", "id", ")", "{", "this", ".", "id", "=", "id", ";", "}", "public", "String", "getTitle", "(", ")", "{", "return", "title", ";", "}", "public", "void", "setTitle", "(", "String", "title", ")", "{", "this", ".", "title", "=", "title", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "\"Media", "[id=\"", "+", "id", "+", "\",", "title=\"", "+", "title", "+", "\"]\"", ";", "}", "}", "</s>" ]
823
[ "<s>", "package", "org", ".", "sqlproc", ".", "sample", ".", "simple", ".", "model", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "annotation", ".", "Pojo", ";", "@", "Pojo", "public", "final", "class", "PhoneNumber", "{", "private", "final", "int", "area", ";", "private", "final", "int", "exch", ";", "private", "final", "int", "ext", ";", "public", "PhoneNumber", "(", "int", "area", ",", "int", "exch", ",", "int", "ext", ")", "{", "this", ".", "area", "=", "area", ";", "this", ".", "exch", "=", "exch", ";", "this", ".", "ext", "=", "ext", ";", "}", "public", "int", "getArea", "(", ")", "{", "return", "area", ";", "}", "public", "int", "getExch", "(", ")", "{", "return", "exch", ";", "}", "public", "int", "getExt", "(", ")", "{", "return", "ext", ";", "}", "public", "boolean", "equals", "(", "Object", "y", ")", "{", "if", "(", "y", "==", "this", ")", "{", "return", "true", ";", "}", "if", "(", "y", "==", "null", ")", "{", "return", "false", ";", "}", "if", "(", "y", ".", "getClass", "(", ")", "!=", "this", ".", "getClass", "(", ")", ")", "{", "return", "false", ";", "}", "PhoneNumber", "a", "=", "this", ";", "PhoneNumber", "b", "=", "(", "PhoneNumber", ")", "y", ";", "return", "(", "a", ".", "area", "==", "b", ".", "area", ")", "&&", "(", "a", ".", "exch", "==", "b", ".", "exch", ")", "&&", "(", "a", ".", "ext", "==", "b", ".", "ext", ")", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "String", ".", "format", "(", "\"\"", ",", "area", ",", "exch", ",", "ext", ")", ";", "}", "public", "int", "hashCode", "(", ")", "{", "return", "10007", "*", "(", "area", "+", "1009", "*", "exch", ")", "+", "ext", ";", "}", "}", "</s>" ]
824
[ "<s>", "package", "org", ".", "sqlproc", ".", "sample", ".", "simple", ".", "model", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "annotation", ".", "Pojo", ";", "@", "Pojo", "public", "class", "Movie", "extends", "Media", "{", "private", "String", "urlIMDB", ";", "private", "Integer", "playLength", ";", "public", "Movie", "(", ")", "{", "}", "public", "Movie", "(", "String", "title", ",", "String", "urlIMDB", ",", "Integer", "playLength", ")", "{", "super", "(", "title", ")", ";", "this", ".", "urlIMDB", "=", "urlIMDB", ";", "this", ".", "playLength", "=", "playLength", ";", "}", "public", "String", "getUrlIMDB", "(", ")", "{", "return", "urlIMDB", ";", "}", "public", "void", "setUrlIMDB", "(", "String", "urlIMDB", ")", "{", "this", ".", "urlIMDB", "=", "urlIMDB", ";", "}", "public", "Integer", "getPlayLength", "(", ")", "{", "return", "playLength", ";", "}", "public", "void", "setPlayLength", "(", "Integer", "playLength", ")", "{", "this", ".", "playLength", "=", "playLength", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "\"\"", "+", "urlIMDB", "+", "\"\"", "+", "playLength", "+", "\",", "getId()=\"", "+", "getId", "(", ")", "+", "\"\"", "+", "getTitle", "(", ")", "+", "\"]\"", ";", "}", "}", "</s>" ]
825
[ "<s>", "package", "org", ".", "sqlproc", ".", "sample", ".", "simple", ".", "model", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "annotation", ".", "Pojo", ";", "@", "Pojo", "public", "class", "Subscriber", "{", "private", "Long", "id", ";", "private", "String", "name", ";", "private", "Contact", "contact", ";", "private", "Library", "library", ";", "private", "List", "<", "BillingDetails", ">", "billingDetails", ";", "public", "Subscriber", "(", ")", "{", "}", "public", "Subscriber", "(", "String", "name", ",", "Library", "library", ")", "{", "this", ".", "name", "=", "name", ";", "this", ".", "library", "=", "library", ";", "}", "public", "Long", "getId", "(", ")", "{", "return", "id", ";", "}", "public", "void", "setId", "(", "Long", "id", ")", "{", "this", ".", "id", "=", "id", ";", "}", "public", "String", "getName", "(", ")", "{", "return", "name", ";", "}", "public", "void", "setName", "(", "String", "name", ")", "{", "this", ".", "name", "=", "name", ";", "}", "public", "Contact", "getContact", "(", ")", "{", "return", "contact", ";", "}", "public", "void", "setContact", "(", "Contact", "contact", ")", "{", "this", ".", "contact", "=", "contact", ";", "}", "public", "Library", "getLibrary", "(", ")", "{", "return", "library", ";", "}", "public", "void", "setLibrary", "(", "Library", "library", ")", "{", "this", ".", "library", "=", "library", ";", "}", "public", "List", "<", "BillingDetails", ">", "getBillingDetails", "(", ")", "{", "return", "billingDetails", ";", "}", "public", "void", "setBillingDetails", "(", "List", "<", "BillingDetails", ">", "billingDetails", ")", "{", "this", ".", "billingDetails", "=", "billingDetails", ";", "}", "}", "</s>" ]
826
[ "<s>", "package", "org", ".", "sqlproc", ".", "sample", ".", "simple", ".", "type", ";", "import", "java", ".", "lang", ".", "reflect", ".", "Method", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Collection", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "regex", ".", "Matcher", ";", "import", "java", ".", "util", ".", "regex", ".", "Pattern", ";", "import", "org", ".", "hibernate", ".", "type", ".", "StringType", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "SqlQuery", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "SqlRuntimeException", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "impl", ".", "BeanUtils", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "type", ".", "SqlInternalType", ";", "import", "org", ".", "sqlproc", ".", "sample", ".", "simple", ".", "model", ".", "PhoneNumber", ";", "public", "class", "PhoneNumberType", "extends", "SqlInternalType", "{", "static", "Pattern", "pattern", "=", "Pattern", ".", "compile", "(", "\"\"", ")", ";", "@", "Override", "public", "Class", "<", "?", ">", "[", "]", "getClassTypes", "(", ")", "{", "return", "new", "Class", "[", "]", "{", "PhoneNumber", ".", "class", "}", ";", "}", "@", "Override", "public", "String", "[", "]", "getMetaTypes", "(", ")", "{", "return", "new", "String", "[", "]", "{", "\"phone\"", "}", ";", "}", "public", "void", "addScalar", "(", "SqlQuery", "query", ",", "String", "dbName", ",", "Class", "<", "?", ">", "attributeType", ")", "{", "query", ".", "addScalar", "(", "dbName", ",", "StringType", ".", "INSTANCE", ")", ";", "}", "@", "Override", "public", "void", "setResult", "(", "Object", "resultInstance", ",", "String", "attributeName", ",", "Object", "resultValue", ",", "boolean", "ingoreError", ")", "throws", "SqlRuntimeException", "{", "Method", "m", "=", "BeanUtils", ".", "getSetter", "(", "resultInstance", ",", "attributeName", ",", "PhoneNumber", ".", "class", ")", ";", "if", "(", "m", "==", "null", ")", "{", "if", "(", "ingoreError", ")", "{", "logger", ".", "error", "(", "\"\"", "+", "attributeName", "+", "\"", "in", "\"", "+", "resultInstance", "+", "\"\"", ")", ";", "return", ";", "}", "else", "{", "throw", "new", "SqlRuntimeException", "(", "\"\"", "+", "attributeName", "+", "\"", "in", "\"", "+", "resultInstance", "+", "\"\"", ")", ";", "}", "}", "if", "(", "resultValue", "==", "null", ")", "{", "BeanUtils", ".", "simpleInvokeMethod", "(", "m", ",", "resultInstance", ",", "null", ")", ";", "return", ";", "}", "if", "(", "!", "(", "resultValue", "instanceof", "String", ")", ")", "{", "if", "(", "ingoreError", ")", "{", "logger", ".", "error", "(", "\"\"", "+", "resultValue", "+", "\"\"", ")", ";", "return", ";", "}", "else", "{", "throw", "new", "SqlRuntimeException", "(", "\"\"", "+", "resultValue", "+", "\"\"", ")", ";", "}", "}", "String", "sPhoneNumber", "=", "(", "String", ")", "resultValue", ";", "Matcher", "matcher", "=", "pattern", ".", "matcher", "(", "sPhoneNumber", ")", ";", "if", "(", "!", "matcher", ".", "matches", "(", ")", ")", "{", "if", "(", "ingoreError", ")", "{", "logger", ".", "error", "(", "\"\"", "+", "sPhoneNumber", "+", "\"'\"", ")", ";", "return", ";", "}", "else", "{", "throw", "new", "SqlRuntimeException", "(", "\"\"", "+", "sPhoneNumber", "+", "\"'\"", ")", ";", "}", "}", "int", "area", "=", "Integer", ".", "parseInt", "(", "matcher", ".", "group", "(", "1", ")", ")", ";", "int", "exch", "=", "Integer", ".", "parseInt", "(", "matcher", ".", "group", "(", "2", ")", ")", ";", "int", "ext", "=", "Integer", ".", "parseInt", "(", "matcher", ".", "group", "(", "3", ")", ")", ";", "BeanUtils", ".", "simpleInvokeMethod", "(", "m", ",", "resultInstance", ",", "new", "PhoneNumber", "(", "area", ",", "exch", ",", "ext", ")", ")", ";", "}", "@", "Override", "public", "void", "setParameter", "(", "SqlQuery", "query", ",", "String", "paramName", ",", "Object", "inputValue", ",", "Class", "<", "?", ">", "inputType", ",", "boolean", "ingoreError", ")", "throws", "SqlRuntimeException", "{", "if", "(", "inputValue", "==", "null", ")", "{", "query", ".", "setParameter", "(", "paramName", ",", "inputValue", ",", "StringType", ".", "INSTANCE", ")", ";", "}", "else", "{", "if", "(", "inputValue", "instanceof", "Collection", ")", "{", "List", "<", "String", ">", "phoneNumbers", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "Iterator", "iter", "=", "(", "(", "Collection", ")", "inputValue", ")", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "Object", "o", "=", "iter", ".", "next", "(", ")", ";", "if", "(", "o", "!=", "null", ")", "{", "if", "(", "!", "(", "o", "instanceof", "PhoneNumber", ")", ")", "{", "if", "(", "ingoreError", ")", "{", "logger", ".", "error", "(", "\"\"", "+", "o", "+", "\"\"", ")", ";", "continue", ";", "}", "else", "{", "throw", "new", "SqlRuntimeException", "(", "\"\"", "+", "o", "+", "\"\"", ")", ";", "}", "}", "String", "sPhoneNumber", "=", "(", "(", "PhoneNumber", ")", "o", ")", ".", "toString", "(", ")", ";", "}", "}", "query", ".", "setParameterList", "(", "paramName", ",", "phoneNumbers", ".", "toArray", "(", ")", ",", "StringType", ".", "INSTANCE", ")", ";", "}", "else", "{", "if", "(", "!", "(", "inputValue", "instanceof", "PhoneNumber", ")", ")", "{", "if", "(", "ingoreError", ")", "{", "logger", ".", "error", "(", "\"\"", "+", "inputValue", "+", "\"\"", ")", ";", "return", ";", "}", "else", "{", "throw", "new", "SqlRuntimeException", "(", "\"\"", "+", "inputValue", "+", "\"\"", ")", ";", "}", "}", "PhoneNumber", "phoneNumber", "=", "(", "PhoneNumber", ")", "inputValue", ";", "String", "sPhoneNumber", "=", "String", ".", "format", "(", "\"\"", ",", "phoneNumber", ".", "getArea", "(", ")", ",", "phoneNumber", ".", "getExch", "(", ")", ",", "phoneNumber", ".", "getExt", "(", ")", ")", ";", "query", ".", "setParameter", "(", "paramName", ",", "sPhoneNumber", ",", "StringType", ".", "INSTANCE", ")", ";", "}", "}", "}", "}", "</s>" ]
827
[ "<s>", "package", "org", ".", "sqlproc", ".", "sample", ".", "simple", ";", "import", "java", ".", "sql", ".", "Connection", ";", "import", "java", ".", "sql", ".", "SQLException", ";", "import", "java", ".", "sql", ".", "Statement", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "Properties", ";", "import", "org", ".", "hibernate", ".", "Session", ";", "import", "org", ".", "hibernate", ".", "SessionFactory", ";", "import", "org", ".", "hibernate", ".", "cfg", ".", "Configuration", ";", "import", "org", ".", "hibernate", ".", "jdbc", ".", "Work", ";", "import", "org", ".", "junit", ".", "Assert", ";", "import", "org", ".", "slf4j", ".", "Logger", ";", "import", "org", ".", "slf4j", ".", "LoggerFactory", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "SqlCrudEngine", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "SqlEngineFactory", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "SqlOrder", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "SqlPropertiesLoader", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "SqlQueryEngine", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "SqlSession", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "hibernate", ".", "HibernateEngineFactory", ";", "import", "org", ".", "sqlproc", ".", "engine", ".", "hibernate", ".", "HibernateSession", ";", "import", "org", ".", "sqlproc", ".", "sample", ".", "simple", ".", "model", ".", "BankAccount", ";", "import", "org", ".", "sqlproc", ".", "sample", ".", "simple", ".", "model", ".", "Book", ";", "import", "org", ".", "sqlproc", ".", "sample", ".", "simple", ".", "model", ".", "Contact", ";", "import", "org", ".", "sqlproc", ".", "sample", ".", "simple", ".", "model", ".", "CreditCard", ";", "import", "org", ".", "sqlproc", ".", "sample", ".", "simple", ".", "model", ".", "Library", ";", "import", "org", ".", "sqlproc", ".", "sample", ".", "simple", ".", "model", ".", "Media", ";", "import", "org", ".", "sqlproc", ".", "sample", ".", "simple", ".", "model", ".", "Movie", ";", "import", "org", ".", "sqlproc", ".", "sample", ".", "simple", ".", "model", ".", "Person", ";", "import", "org", ".", "sqlproc", ".", "sample", ".", "simple", ".", "model", ".", "PersonLibrary", ";", "import", "org", ".", "sqlproc", ".", "sample", ".", "simple", ".", "model", ".", "PhoneNumber", ";", "import", "org", ".", "sqlproc", ".", "sample", ".", "simple", ".", "model", ".", "Subscriber", ";", "import", "org", ".", "sqlproc", ".", "sample", ".", "simple", ".", "type", ".", "PhoneNumberType", ";", "public", "class", "Main", "{", "private", "final", "Logger", "logger", "=", "LoggerFactory", ".", "getLogger", "(", "getClass", "(", ")", ")", ";", "private", "SessionFactory", "sessionFactory", ";", "private", "SqlEngineFactory", "sqlFactory", ";", "private", "Properties", "catalog", ";", "public", "Main", "(", ")", "{", "HibernateEngineFactory", "factory", "=", "new", "HibernateEngineFactory", "(", ")", ";", "factory", ".", "setMetaFilesNames", "(", "\"\"", ")", ";", "factory", ".", "addCustomType", "(", "new", "PhoneNumberType", "(", ")", ")", ";", "sqlFactory", "=", "factory", ";", "SqlPropertiesLoader", "catalogLoader", "=", "new", "SqlPropertiesLoader", "(", "\"\"", ",", "this", ".", "getClass", "(", ")", ")", ";", "catalog", "=", "catalogLoader", ".", "getProperties", "(", ")", ";", "Configuration", "configuration", "=", "new", "Configuration", "(", ")", ".", "configure", "(", "\"\"", ")", ";", "sessionFactory", "=", "configuration", ".", "buildSessionFactory", "(", ")", ";", "}", "public", "void", "setupDb", "(", ")", "throws", "Exception", "{", "Session", "session", "=", "null", ";", "try", "{", "session", "=", "sessionFactory", ".", "openSession", "(", ")", ";", "session", ".", "doWork", "(", "new", "Work", "(", ")", "{", "@", "Override", "public", "void", "execute", "(", "Connection", "connection", ")", "throws", "SQLException", "{", "Statement", "stmt", "=", "null", ";", "try", "{", "stmt", "=", "connection", ".", "createStatement", "(", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<=", "50", ";", "i", "++", ")", "{", "String", "ddl", "=", "catalog", ".", "getProperty", "(", "\"s\"", "+", "i", ")", ";", "if", "(", "ddl", "==", "null", ")", "continue", ";", "System", ".", "out", ".", "println", "(", "ddl", ")", ";", "stmt", ".", "addBatch", "(", "ddl", ")", ";", "}", "stmt", ".", "executeBatch", "(", ")", ";", "}", "catch", "(", "SQLException", "ex", ")", "{", "if", "(", "stmt", "!=", "null", ")", "stmt", ".", "close", "(", ")", ";", "throw", "ex", ";", "}", "}", "}", ")", ";", "}", "finally", "{", "if", "(", "session", "!=", "null", ")", "session", ".", "close", "(", ")", ";", "}", "}", "public", "List", "<", "Person", ">", "listAll", "(", ")", "{", "SqlQueryEngine", "sqlEngine", "=", "sqlFactory", ".", "getQueryEngine", "(", "\"ALL_PEOPLE\"", ")", ";", "SqlSession", "session", "=", "null", ";", "try", "{", "session", "=", "HibernateSession", ".", "generateProxy", "(", "sessionFactory", ".", "openSession", "(", ")", ")", ";", "List", "<", "Person", ">", "list", "=", "sqlEngine", ".", "query", "(", "session", ",", "Person", ".", "class", ")", ";", "logger", ".", "info", "(", "\"\"", "+", "list", ".", "size", "(", ")", ")", ";", "return", "list", ";", "}", "finally", "{", "if", "(", "session", "!=", "null", ")", "(", "(", "Session", ")", "session", ")", ".", "close", "(", ")", ";", "}", "}", "public", "List", "<", "Person", ">", "listSome", "(", "Person", "person", ")", "{", "SqlQueryEngine", "sqlEngine", "=", "sqlFactory", ".", "getQueryEngine", "(", "\"ALL_PEOPLE\"", ")", ";", "SqlSession", "session", "=", "null", ";", "try", "{", "session", "=", "HibernateSession", ".", "generateProxy", "(", "sessionFactory", ".", "openSession", "(", ")", ")", ";", "List", "<", "Person", ">", "list", "=", "sqlEngine", ".", "query", "(", "session", ",", "Person", ".", "class", ",", "person", ",", "SqlOrder", ".", "getDescOrder", "(", "2", ")", ")", ";", "logger", ".", "info", "(", "\"\"", "+", "list", ".", "size", "(", ")", ")", ";", "return", "list", ";", "}", "finally", "{", "if", "(", "session", "!=", "null", ")", "(", "(", "Session", ")", "session", ")", ".", "close", "(", ")", ";", "}", "}", "public", "List", "<", "Person", ">", "listLike", "(", "Person", "person", ")", "{", "SqlQueryEngine", "sqlEngine", "=", "sqlFactory", ".", "getQueryEngine", "(", "\"LIKE_PEOPLE\"", ")", ";", "SqlSession", "session", "=", "null", ";", "try", "{", "session", "=", "HibernateSession", ".", "generateProxy", "(", "sessionFactory", ".", "openSession", "(", ")", ")", ";", "List", "<", "Person", ">", "list", "=", "sqlEngine", ".", "query", "(", "session", ",", "Person", ".", "class", ",", "person", ",", "SqlOrder", ".", "getDescOrder", "(", "2", ")", ")", ";", "logger", ".", "info", "(", "\"\"", "+", "list", ".", "size", "(", ")", ")", ";", "return", "list", ";", "}", "finally", "{", "if", "(", "session", "!=", "null", ")", "(", "(", "Session", ")", "session", ")", ".", "close", "(", ")", ";", "}", "}", "public", "Person", "insert", "(", "Person", "person", ",", "Contact", "...", "contacts", ")", "{", "SqlCrudEngine", "sqlInsertPerson", "=", "sqlFactory", ".", "getCrudEngine", "(", "\"\"", ")", ";", "SqlCrudEngine", "sqlInsertContact", "=", "sqlFactory", ".", "getCrudEngine", "(", "\"\"", ")", ";", "SqlSession", "session", "=", "null", ";", "try", "{", "session", "=", "HibernateSession", ".", "generateProxy", "(", "sessionFactory", ".", "openSession", "(", ")", ")", ";", "int", "count", "=", "sqlInsertPerson", ".", "insert", "(", "session", ",", "person", ")", ";", "logger", ".", "info", "(", "\"insert:", "\"", "+", "count", ")", ";", "logger", ".", "info", "(", "\"insert:", "\"", "+", "person", ")", ";", "if", "(", "contacts", "!=", "null", "&&", "count", ">", "0", ")", "{", "for", "(", "Contact", "contact", ":", "contacts", ")", "{", "contact", ".", "setPersonId", "(", "person", ".", "getId", "(", ")", ")", ";", "sqlInsertContact", ".", "insert", "(", "session", ",", "contact", ")", ";", "}", "}", "return", "(", "count", ">", "0", ")", "?", "person", ":", "null", ";", "}", "finally", "{", "if", "(", "session", "!=", "null", ")", "(", "(", "Session", ")", "session", ")", ".", "close", "(", ")", ";", "}", "}", "public", "Person", "get", "(", "Person", "person", ")", "{", "SqlCrudEngine", "sqlEngine", "=", "sqlFactory", ".", "getCrudEngine", "(", "\"GET_PERSON\"", ")", ";", "SqlSession", "session", "=", "null", ";", "try", "{", "session", "=", "HibernateSession", ".", "generateProxy", "(", "sessionFactory", ".", "openSession", "(", ")", ")", ";", "Person", "p", "=", "sqlEngine", ".", "get", "(", "session", ",", "Person", ".", "class", ",", "person", ")", ";", "logger", ".", "info", "(", "\"get:", "\"", "+", "p", ")", ";", "return", "p", ";", "}", "finally", "{", "if", "(", "session", "!=", "null", ")", "(", "(", "Session", ")", "session", ")", ".", "close", "(", ")", ";", "}", "}", "public", "Person", "update", "(", "Person", "person", ")", "{", "SqlCrudEngine", "sqlEngine", "=", "sqlFactory", ".", "getCrudEngine", "(", "\"\"", ")", ";", "SqlSession", "session", "=", "null", ";", "try", "{", "session", "=", "HibernateSession", ".", "generateProxy", "(", "sessionFactory", ".", "openSession", "(", ")", ")", ";", "int", "count", "=", "sqlEngine", ".", "update", "(", "session", ",", "person", ")", ";", "logger", ".", "info", "(", "\"update:", "\"", "+", "count", ")", ";", "return", "(", "count", ">", "0", ")", "?", "person", ":", "null", ";", "}", "finally", "{", "if", "(", "session", "!=", "null", ")", "(", "(", "Session", ")", "session", ")", ".", "close", "(", ")", ";", "}", "}", "public", "boolean", "delete", "(", "Person", "person", ")", "{", "SqlCrudEngine", "sqlEngine", "=", "sqlFactory", ".", "getCrudEngine", "(", "\"\"", ")", ";", "SqlSession", "session", "=", "null", ";", "try", "{", "session", "=", "HibernateSession", ".", "generateProxy", "(", "sessionFactory", ".", "openSession", "(", ")", ")", ";", "int", "count", "=", "sqlEngine", ".", "delete", "(", "session", ",", "person", ")", ";", "logger", ".", "info", "(", "\"delete:", "\"", "+", "count", ")", ";", "return", "(", "count", ">", "0", ")", ";", "}", "finally", "{", "if", "(", "session", "!=", "null", ")", "(", "(", "Session", ")", "session", ")", ".", "close", "(", ")", ";", "}", "}", "public", "List", "<", "Person", ">", "listPeopleAndContacts", "(", "Person", "person", ")", "{", "SqlQueryEngine", "sqlEngine", "=", "sqlFactory", ".", "getQueryEngine", "(", "\"\"", ")", ";", "SqlSession", "session", "=", "null", ";", "try", "{", "session", "=", "HibernateSession", ".", "generateProxy", "(", "sessionFactory", ".", "openSession", "(", ")", ")", ";", "List", "<", "Person", ">", "list", "=", "sqlEngine", ".", "query", "(", "session", ",", "Person", ".", "class", ",", "person", ",", "SqlQueryEngine", ".", "ASC_ORDER", ")", ";", "logger", ".", "info", "(", "\"\"", "+", "list", ".", "size", "(", ")", ")", ";", "return", "list", ";", "}", "finally", "{", "if", "(", "session", "!=", "null", ")", "(", "(", "Session", ")", "session", ")", ".", "close", "(", ")", ";", "}", "}", "public", "Movie", "insertMovie", "(", "Movie", "movie", ")", "{", "SqlCrudEngine", "sqlInsertMedia", "=", "sqlFactory", ".", "getCrudEngine", "(", "\"INSERT_MEDIA\"", ")", ";", "SqlCrudEngine", "sqlInsertMovie", "=", "sqlFactory", ".", "getCrudEngine", "(", "\"INSERT_MOVIE\"", ")", ";", "SqlSession", "session", "=", "null", ";", "try", "{", "session", "=", "HibernateSession", ".", "generateProxy", "(", "sessionFactory", ".", "openSession", "(", ")", ")", ";", "int", "count", "=", "sqlInsertMedia", ".", "insert", "(", "session", ",", "movie", ")", ";", "if", "(", "count", ">", "0", ")", "{", "sqlInsertMovie", ".", "insert", "(", "session", ",", "movie", ")", ";", "}", "return", "(", "count", ">", "0", ")", "?", "movie", ":", "null", ";", "}", "finally", "{", "if", "(", "session", "!=", "null", ")", "(", "(", "Session", ")", "session", ")", ".", "close", "(", ")", ";", "}", "}", "public", "Book", "insertBook", "(", "Book", "book", ")", "{", "SqlCrudEngine", "sqlInsertMedia", "=", "sqlFactory", ".", "getCrudEngine", "(", "\"INSERT_MEDIA\"", ")", ";", "SqlCrudEngine", "sqlInsertBook", "=", "sqlFactory", ".", "getCrudEngine", "(", "\"INSERT_BOOK\"", ")", ";", "SqlSession", "session", "=", "null", ";", "try", "{", "session", "=", "HibernateSession", ".", "generateProxy", "(", "sessionFactory", ".", "openSession", "(", ")", ")", ";", "int", "count", "=", "sqlInsertMedia", ".", "insert", "(", "session", ",", "book", ")", ";", "if", "(", "count", ">", "0", ")", "{", "sqlInsertBook", ".", "insert", "(", "session", ",", "book", ")", ";", "}", "return", "(", "count", ">", "0", ")", "?", "book", ":", "null", ";", "}", "finally", "{", "if", "(", "session", "!=", "null", ")", "(", "(", "Session", ")", "session", ")", ".", "close", "(", ")", ";", "}", "}", "public", "void", "createPersonLibrary", "(", "Person", "person", ",", "Media", "...", "media", ")", "{", "SqlCrudEngine", "sqlCreateLibrary", "=", "sqlFactory", ".", "getCrudEngine", "(", "\"\"", ")", ";", "if", "(", "media", "==", "null", "||", "media", ".", "length", "==", "0", ")", "return", ";", "SqlSession", "session", "=", "null", ";", "try", "{", "session", "=", "HibernateSession", ".", "generateProxy", "(", "sessionFactory", ".", "openSession", "(", ")", ")", ";", "for", "(", "Media", "media1", ":", "media", ")", "{", "PersonLibrary", "library", "=", "new", "PersonLibrary", "(", "person", ".", "getId", "(", ")", ",", "media1", ".", "getId", "(", ")", ")", ";", "sqlCreateLibrary", ".", "insert", "(", "session", ",", "library", ")", ";", "}", "}", "finally", "{", "if", "(", "session", "!=", "null", ")", "(", "(", "Session", ")", "session", ")", ".", "close", "(", ")", ";", "}", "}", "public", "List", "<", "Person", ">", "listPeopleLibrary", "(", "Person", "person", ")", "{", "SqlQueryEngine", "sqlEngine", "=", "sqlFactory", ".", "getQueryEngine", "(", "\"\"", ")", ";", "SqlSession", "session", "=", "null", ";", "try", "{", "session", "=", "HibernateSession", ".", "generateProxy", "(", "sessionFactory", ".", "openSession", "(", ")", ")", ";", "Map", "<", "String", ",", "Class", "<", "?", ">", ">", "moreResultClasses", "=", "new", "HashMap", "<", "String", ",", "Class", "<", "?", ">", ">", "(", ")", ";", "moreResultClasses", ".", "put", "(", "\"movie\"", ",", "Movie", ".", "class", ")", ";", "moreResultClasses", ".", "put", "(", "\"book\"", ",", "Book", ".", "class", ")", ";", "List", "<", "Person", ">", "list", "=", "sqlEngine", ".", "query", "(", "session", ",", "Person", ".", "class", ",", "null", ",", "null", ",", "SqlQueryEngine", ".", "ASC_ORDER", ",", "moreResultClasses", ")", ";", "logger", ".", "info", "(", "\"\"", "+", "list", ".", "size", "(", ")", ")", ";", "return", "list", ";", "}", "finally", "{", "if", "(", "session", "!=", "null", ")", "(", "(", "Session", ")", "session", ")", ".", "close", "(", ")", ";", "}", "}", "public", "Person", "insertCustom", "(", "Person", "person", ",", "Contact", "...", "contacts", ")", "{", "SqlCrudEngine", "sqlInsertPerson", "=", "sqlFactory", ".", "getCrudEngine", "(", "\"\"", ")", ";", "SqlCrudEngine", "sqlInsertContact", "=", "sqlFactory", ".", "getCrudEngine", "(", "\"\"", ")", ";", "SqlSession", "session", "=", "null", ";", "try", "{", "session", "=", "HibernateSession", ".", "generateProxy", "(", "sessionFactory", ".", "openSession", "(", ")", ")", ";", "int", "count", "=", "sqlInsertPerson", ".", "insert", "(", "session", ",", "person", ")", ";", "logger", ".", "info", "(", "\"insert:", "\"", "+", "count", ")", ";", "logger", ".", "info", "(", "\"insert:", "\"", "+", "person", ")", ";", "if", "(", "contacts", "!=", "null", "&&", "count", ">", "0", ")", "{", "for", "(", "Contact", "contact", ":", "contacts", ")", "{", "contact", ".", "setPersonId", "(", "person", ".", "getId", "(", ")", ")", ";", "sqlInsertContact", ".", "insert", "(", "session", ",", "contact", ")", ";", "}", "}", "return", "(", "count", ">", "0", ")", "?", "person", ":", "null", ";", "}", "finally", "{", "if", "(", "session", "!=", "null", ")", "(", "(", "Session", ")", "session", ")", ".", "close", "(", ")", ";", "}", "}", "public", "List", "<", "Person", ">", "listCustom", "(", "Contact", "contact", ")", "{", "SqlQueryEngine", "sqlEngine", "=", "sqlFactory", ".", "getQueryEngine", "(", "\"\"", ")", ";", "SqlSession", "session", "=", "null", ";", "try", "{", "session", "=", "HibernateSession", ".", "generateProxy", "(", "sessionFactory", ".", "openSession", "(", ")", ")", ";", "List", "<", "Person", ">", "list", "=", "sqlEngine", ".", "query", "(", "session", ",", "Person", ".", "class", ",", "contact", ",", "SqlQueryEngine", ".", "ASC_ORDER", ")", ";", "logger", ".", "info", "(", "\"\"", "+", "list", ".", "size", "(", ")", ")", ";", "return", "list", ";", "}", "finally", "{", "if", "(", "session", "!=", "null", ")", "(", "(", "Session", ")", "session", ")", ".", "close", "(", ")", ";", "}", "}", "public", "Library", "insertLibrary", "(", "Library", "library", ")", "{", "SqlCrudEngine", "sqlInsertLibrary", "=", "sqlFactory", ".", "getCrudEngine", "(", "\"\"", ")", ";", "SqlSession", "session", "=", "null", ";", "try", "{", "session", "=", "HibernateSession", ".", "generateProxy", "(", "sessionFactory", ".", "openSession", "(", ")", ")", ";", "int", "count", "=", "sqlInsertLibrary", ".", "insert", "(", "session", ",", "library", ")", ";", "return", "(", "count", ">", "0", ")", "?", "library", ":", "null", ";", "}", "finally", "{", "if", "(", "session", "!=", "null", ")", "(", "(", "Session", ")", "session", ")", ".", "close", "(", ")", ";", "}", "}", "public", "Subscriber", "insertSubscriber", "(", "Subscriber", "subscriber", ")", "{", "SqlCrudEngine", "sqlInsertSubscriber", "=", "sqlFactory", ".", "getCrudEngine", "(", "\"\"", ")", ";", "SqlSession", "session", "=", "null", ";", "try", "{", "session", "=", "HibernateSession", ".", "generateProxy", "(", "sessionFactory", ".", "openSession", "(", ")", ")", ";", "int", "count", "=", "sqlInsertSubscriber", ".", "insert", "(", "session", ",", "subscriber", ")", ";", "return", "(", "count", ">", "0", ")", "?", "subscriber", ":", "null", ";", "}", "finally", "{", "if", "(", "session", "!=", "null", ")", "(", "(", "Session", ")", "session", ")", ".", "close", "(", ")", ";", "}", "}", "public", "BankAccount", "insertBankAccount", "(", "BankAccount", "bankAccount", ")", "{", "SqlCrudEngine", "sqlInsertBankAccount", "=", "sqlFactory", ".", "getCrudEngine", "(", "\"\"", ")", ";", "SqlSession", "session", "=", "null", ";", "try", "{", "session", "=", "HibernateSession", ".", "generateProxy", "(", "sessionFactory", ".", "openSession", "(", ")", ")", ";", "int", "count", "=", "sqlInsertBankAccount", ".", "insert", "(", "session", ",", "bankAccount", ")", ";", "return", "(", "count", ">", "0", ")", "?", "bankAccount", ":", "null", ";", "}", "finally", "{", "if", "(", "session", "!=", "null", ")", "(", "(", "Session", ")", "session", ")", ".", "close", "(", ")", ";", "}", "}", "public", "CreditCard", "insertCreditCard", "(", "CreditCard", "creditCard", ")", "{", "SqlCrudEngine", "sqlInsertCreditCard", "=", "sqlFactory", ".", "getCrudEngine", "(", "\"\"", ")", ";", "SqlSession", "session", "=", "null", ";", "try", "{", "session", "=", "HibernateSession", ".", "generateProxy", "(", "sessionFactory", ".", "openSession", "(", ")", ")", ";", "int", "count", "=", "sqlInsertCreditCard", ".", "insert", "(", "session", ",", "creditCard", ")", ";", "return", "(", "count", ">", "0", ")", "?", "creditCard", ":", "null", ";", "}", "finally", "{", "if", "(", "session", "!=", "null", ")", "(", "(", "Session", ")", "session", ")", ".", "close", "(", ")", ";", "}", "}", "public", "List", "<", "Subscriber", ">", "listAllSubsribersWithBillingDetails", "(", ")", "{", "SqlQueryEngine", "sqlEngine", "=", "sqlFactory", ".", "getQueryEngine", "(", "\"\"", ")", ";", "SqlSession", "session", "=", "null", ";", "try", "{", "session", "=", "HibernateSession", ".", "generateProxy", "(", "sessionFactory", ".", "openSession", "(", ")", ")", ";", "Map", "<", "String", ",", "Class", "<", "?", ">", ">", "moreResultClasses", "=", "new", "HashMap", "<", "String", ",", "Class", "<", "?", ">", ">", "(", ")", ";", "moreResultClasses", ".", "put", "(", "\"BA\"", ",", "BankAccount", ".", "class", ")", ";", "moreResultClasses", ".", "put", "(", "\"CC\"", ",", "CreditCard", ".", "class", ")", ";", "List", "<", "Subscriber", ">", "list", "=", "sqlEngine", ".", "query", "(", "session", ",", "Subscriber", ".", "class", ",", "null", ",", "null", ",", "SqlQueryEngine", ".", "ASC_ORDER", ",", "moreResultClasses", ")", ";", "logger", ".", "info", "(", "\"\"", "+", "list", ".", "size", "(", ")", ")", ";", "return", "list", ";", "}", "finally", "{", "if", "(", "session", "!=", "null", ")", "(", "(", "Session", ")", "session", ")", ".", "close", "(", ")", ";", "}", "}", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "Exception", "{", "Person", "person", ",", "p", ";", "List", "<", "Person", ">", "list", ";", "boolean", "deleted", ";", "Main", "main", "=", "new", "Main", "(", ")", ";", "main", ".", "setupDb", "(", ")", ";", "Person", "jan", "=", "main", ".", "insert", "(", "new", "Person", "(", "\"Jan\"", ")", ",", "new", "Contact", "(", "\"\"", ")", ")", ";", "Person", "janik", "=", "main", ".", "insert", "(", "new", "Person", "(", "\"Janik\"", ")", ",", "new", "Contact", "(", "\"\"", ")", ")", ";", "Person", "honza", "=", "main", ".", "insert", "(", "new", "Person", "(", "\"Honza\"", ")", ",", "new", "Contact", "(", "\"\"", ")", ",", "new", "Contact", "(", "\"\"", ")", ")", ";", "Person", "honzik", "=", "main", ".", "insert", "(", "new", "Person", "(", "\"Honzik\"", ")", ")", ";", "Person", "andrej", "=", "main", ".", "insert", "(", "new", "Person", "(", "\"Andrej\"", ")", ",", "new", "Contact", "(", "\"\"", ")", ")", ";", "Book", "book1", "=", "main", ".", "insertBook", "(", "new", "Book", "(", "\"\"", ",", "\"\"", ")", ")", ";", "Book", "book2", "=", "main", ".", "insertBook", "(", "new", "Book", "(", "\"\"", ",", "\"\"", ")", ")", ";", "Movie", "movie1", "=", "main", ".", "insertMovie", "(", "new", "Movie", "(", "\"\"", ",", "\"abc\"", ",", "82", ")", ")", ";", "Movie", "movie2", "=", "main", ".", "insertMovie", "(", "new", "Movie", "(", "\"\"", ",", "\"def\"", ",", "95", ")", ")", ";", "main", ".", "createPersonLibrary", "(", "jan", ",", "book1", ",", "movie1", ")", ";", "main", ".", "createPersonLibrary", "(", "honza", ",", "book2", ",", "movie2", ")", ";", "main", ".", "createPersonLibrary", "(", "andrej", ",", "book1", ",", "book2", ",", "movie2", ")", ";", "Library", "lib", "=", "main", ".", "insertLibrary", "(", "new", "Library", "(", "\"\"", ")", ")", ";", "Subscriber", "arnost", "=", "main", ".", "insertSubscriber", "(", "new", "Subscriber", "(", "\"Arno-UNK-t\"", ",", "lib", ")", ")", ";", "Subscriber", "maria", "=", "main", ".", "insertSubscriber", "(", "new", "Subscriber", "(", "\"M-UNK-ria\"", ",", "lib", ")", ")", ";", "main", ".", "insertBankAccount", "(", "new", "BankAccount", "(", "\"account", "1\"", ",", "arnost", ")", ")", ";", "main", ".", "insertBankAccount", "(", "new", "BankAccount", "(", "\"account", "2\"", ",", "maria", ")", ")", ";", "main", ".", "insertCreditCard", "(", "new", "CreditCard", "(", "123L", ",", "arnost", ")", ")", ";", "main", ".", "insertCreditCard", "(", "new", "CreditCard", "(", "456L", ",", "maria", ")", ")", ";", "list", "=", "main", ".", "listAll", "(", ")", ";", "Assert", ".", "assertEquals", "(", "5", ",", "list", ".", "size", "(", ")", ")", ";", "person", "=", "new", "Person", "(", ")", ";", "person", ".", "setName", "(", "\"Jan\"", ")", ";", "list", "=", "main", ".", "listSome", "(", "person", ")", ";", "Assert", ".", "assertEquals", "(", "1", ",", "list", ".", "size", "(", ")", ")", ";", "person", "=", "new", "Person", "(", ")", ";", "person", ".", "setName", "(", "\"an\"", ")", ";", "list", "=", "main", ".", "listLike", "(", "person", ")", ";", "Assert", ".", "assertEquals", "(", "3", ",", "list", ".", "size", "(", ")", ")", ";", "person", "=", "new", "Person", "(", ")", ";", "person", ".", "setName", "(", "\"Honza\"", ")", ";", "list", "=", "main", ".", "listPeopleAndContacts", "(", "person", ")", ";", "Assert", ".", "assertEquals", "(", "1", ",", "list", ".", "size", "(", ")", ")", ";", "Assert", ".", "assertEquals", "(", "\"Honza\"", ",", "list", ".", "get", "(", "0", ")", ".", "getName", "(", ")", ")", ";", "Assert", ".", "assertEquals", "(", "2", ",", "list", ".", "get", "(", "0", ")", ".", "getContacts", "(", ")", ".", "size", "(", ")", ")", ";", "Assert", ".", "assertEquals", "(", "\"\"", ",", "list", ".", "get", "(", "0", ")", ".", "getContacts", "(", ")", ".", "get", "(", "0", ")", ".", "getAddress", "(", ")", ")", ";", "Assert", ".", "assertEquals", "(", "\"\"", ",", "list", ".", "get", "(", "0", ")", ".", "getContacts", "(", ")", ".", "get", "(", "1", ")", ".", "getAddress", "(", ")", ")", ";", "list", "=", "main", ".", "listPeopleLibrary", "(", "null", ")", ";", "Assert", ".", "assertEquals", "(", "5", ",", "list", ".", "size", "(", ")", ")", ";", "Assert", ".", "assertEquals", "(", "\"Andrej\"", ",", "list", ".", "get", "(", "0", ")", ".", "getName", "(", ")", ")", ";", "Assert", ".", "assertEquals", "(", "3", ",", "list", ".", "get", "(", "0", ")", ".", "getLibrary", "(", ")", ".", "size", "(", ")", ")", ";", "Assert", ".", "assertEquals", "(", "\"\"", ",", "list", ".", "get", "(", "0", ")", ".", "getLibrary", "(", ")", ".", "get", "(", "0", ")", ".", "getTitle", "(", ")", ")", ";", "Assert", ".", "assertTrue", "(", "list", ".", "get", "(", "0", ")", ".", "getLibrary", "(", ")", ".", "get", "(", "0", ")", "instanceof", "Movie", ")", ";", "Assert", ".", "assertEquals", "(", "\"def\"", ",", "(", "(", "Movie", ")", "list", ".", "get", "(", "0", ")", ".", "getLibrary", "(", ")", ".", "get", "(", "0", ")", ")", ".", "getUrlIMDB", "(", ")", ")", ";", "Assert", ".", "assertEquals", "(", "new", "Integer", "(", "95", ")", ",", "(", "(", "Movie", ")", "list", ".", "get", "(", "0", ")", ".", "getLibrary", "(", ")", ".", "get", "(", "0", ")", ")", ".", "getPlayLength", "(", ")", ")", ";", "Assert", ".", "assertEquals", "(", "\"\"", ",", "list", ".", "get", "(", "0", ")", ".", "getLibrary", "(", ")", ".", "get", "(", "1", ")", ".", "getTitle", "(", ")", ")", ";", "Assert", ".", "assertTrue", "(", "list", ".", "get", "(", "0", ")", ".", "getLibrary", "(", ")", ".", "get", "(", "1", ")", "instanceof", "Book", ")", ";", "Assert", ".", "assertEquals", "(", "\"\"", ",", "(", "(", "Book", ")", "list", ".", "get", "(", "0", ")", ".", "getLibrary", "(", ")", ".", "get", "(", "1", ")", ")", ".", "getIsbn", "(", ")", ")", ";", "Assert", ".", "assertEquals", "(", "\"\"", ",", "list", ".", "get", "(", "0", ")", ".", "getLibrary", "(", ")", ".", "get", "(", "2", ")", ".", "getTitle", "(", ")", ")", ";", "Assert", ".", "assertTrue", "(", "list", ".", "get", "(", "0", ")", ".", "getLibrary", "(", ")", ".", "get", "(", "2", ")", "instanceof", "Book", ")", ";", "Assert", ".", "assertEquals", "(", "\"\"", ",", "(", "(", "Book", ")", "list", ".", "get", "(", "0", ")", ".", "getLibrary", "(", ")", ".", "get", "(", "2", ")", ")", ".", "getIsbn", "(", ")", ")", ";", "person", "=", "new", "Person", "(", ")", ";", "person", ".", "setId", "(", "andrej", ".", "getId", "(", ")", ")", ";", "p", "=", "main", ".", "get", "(", "person", ")", ";", "Assert", ".", "assertNotNull", "(", "p", ")", ";", "Assert", ".", "assertEquals", "(", "\"Andrej\"", ",", "p", ".", "getName", "(", ")", ")", ";", "person", "=", "new", "Person", "(", ")", ";", "person", ".", "setId", "(", "janik", ".", "getId", "(", ")", ")", ";", "person", ".", "setName", "(", "\"Bozena\"", ")", ";", "p", "=", "main", ".", "update", "(", "person", ")", ";", "Assert", ".", "assertNotNull", "(", "p", ")", ";", "Assert", ".", "assertEquals", "(", "\"Bozena\"", ",", "p", ".", "getName", "(", ")", ")", ";", "person", "=", "new", "Person", "(", ")", ";", "person", ".", "setId", "(", "jan", ".", "getId", "(", ")", ")", ";", "deleted", "=", "main", ".", "delete", "(", "person", ")", ";", "Assert", ".", "assertTrue", "(", "deleted", ")", ";", "list", "=", "main", ".", "listAll", "(", ")", ";", "Assert", ".", "assertEquals", "(", "4", ",", "list", ".", "size", "(", ")", ")", ";", "try", "{", "deleted", "=", "main", ".", "delete", "(", "null", ")", ";", "Assert", ".", "fail", "(", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "}", "list", "=", "main", ".", "listAll", "(", ")", ";", "Assert", ".", "assertEquals", "(", "4", ",", "list", ".", "size", "(", ")", ")", ";", "Person", "pepa", "=", "main", ".", "insertCustom", "(", "new", "Person", "(", "\"Pepa\"", ")", ",", "new", "Contact", "(", "\"\"", ",", "new", "PhoneNumber", "(", "111", ",", "222", ",", "3333", ")", ")", ")", ";", "Contact", "contact", "=", "new", "Contact", "(", ")", ";", "contact", ".", "setHomePhone", "(", "new", "PhoneNumber", "(", "111", ",", "222", ",", "3333", ")", ")", ";", "list", "=", "main", ".", "listCustom", "(", "contact", ")", ";", "Assert", ".", "assertEquals", "(", "1", ",", "list", ".", "size", "(", ")", ")", ";", "Assert", ".", "assertEquals", "(", "\"111-222-3333\"", ",", "list", ".", "get", "(", "0", ")", ".", "getContacts", "(", ")", ".", "get", "(", "0", ")", ".", "getHomePhone", "(", ")", ".", "toString", "(", ")", ")", ";", "List", "<", "Subscriber", ">", "subscribers", "=", "main", ".", "listAllSubsribersWithBillingDetails", "(", ")", ";", "Assert", ".", "assertEquals", "(", "2", ",", "subscribers", ".", "size", "(", ")", ")", ";", "}", "}", "</s>" ]
828
[ "<s>", "package", "com", ".", "Backside", ".", "BacksideUpdater", ";", "import", "java", ".", "io", ".", "BufferedReader", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileInputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "InputStreamReader", ";", "import", "org", ".", "apache", ".", "http", ".", "HttpResponse", ";", "import", "org", ".", "apache", ".", "http", ".", "client", ".", "HttpClient", ";", "import", "org", ".", "apache", ".", "http", ".", "client", ".", "methods", ".", "HttpGet", ";", "import", "org", ".", "apache", ".", "http", ".", "impl", ".", "client", ".", "DefaultHttpClient", ";", "import", "android", ".", "app", ".", "Activity", ";", "import", "android", ".", "app", ".", "AlertDialog", ";", "import", "android", ".", "app", ".", "ProgressDialog", ";", "import", "android", ".", "content", ".", "Context", ";", "import", "android", ".", "content", ".", "DialogInterface", ";", "import", "android", ".", "content", ".", "DialogInterface", ".", "OnDismissListener", ";", "import", "android", ".", "content", ".", "Intent", ";", "import", "android", ".", "content", ".", "pm", ".", "ActivityInfo", ";", "import", "android", ".", "content", ".", "res", ".", "Configuration", ";", "import", "android", ".", "net", ".", "ConnectivityManager", ";", "import", "android", ".", "net", ".", "NetworkInfo", ";", "import", "android", ".", "net", ".", "Uri", ";", "import", "android", ".", "os", ".", "Build", ";", "import", "android", ".", "os", ".", "Bundle", ";", "import", "android", ".", "os", ".", "Handler", ";", "import", "android", ".", "os", ".", "Message", ";", "import", "android", ".", "os", ".", "PowerManager", ";", "import", "android", ".", "provider", ".", "Settings", ";", "import", "android", ".", "text", ".", "method", ".", "LinkMovementMethod", ";", "import", "android", ".", "view", ".", "GestureDetector", ";", "import", "android", ".", "view", ".", "Gravity", ";", "import", "android", ".", "view", ".", "Menu", ";", "import", "android", ".", "view", ".", "MenuItem", ";", "import", "android", ".", "view", ".", "MotionEvent", ";", "import", "android", ".", "view", ".", "View", ";", "import", "android", ".", "widget", ".", "ImageView", ";", "import", "android", ".", "widget", ".", "LinearLayout", ";", "import", "android", ".", "widget", ".", "TextView", ";", "import", "android", ".", "widget", ".", "Toast", ";", "public", "class", "BacksideUpdaterActivity", "extends", "Activity", "{", "private", "static", "Context", "theView", ";", "private", "static", "TextView", "textView", ";", "private", "static", "TextView", "buttonTextView", ";", "private", "static", "String", "manifestURL", "=", "\"\"", ";", "private", "static", "final", "String", "BUILD_VERSION", "=", "Build", ".", "VERSION", ".", "INCREMENTAL", ";", "private", "static", "final", "String", "[", "]", "SEPARATED_DATE", "=", "BUILD_VERSION", ".", "split", "(", "\"\\\\.\"", ")", ";", "private", "static", "final", "int", "BUILD_DATE", "=", "Integer", ".", "parseInt", "(", "SEPARATED_DATE", "[", "2", "]", ")", ";", "private", "static", "int", "ALREADY_CHECKED", "=", "0", ";", "private", "String", "theDate", ";", "private", "int", "choosenDate", "=", "0", ";", "private", "static", "String", "theUrl", ";", "private", "String", "theChangeLog", "=", "\"\"", ";", "private", "String", "romName", ";", "private", "static", "String", "line", ";", "private", "static", "String", "localFileName", ";", "private", "static", "String", "theFileSize", ";", "private", "static", "Long", "fileSize", ";", "private", "static", "String", "theMD5", ";", "private", "static", "String", "downloadMD5", ";", "private", "static", "String", "md5FileName", ";", "private", "static", "Boolean", "goodMD5", ";", "private", "Boolean", "upToDate", ";", "private", "Boolean", "alreadyDownloaded", ";", "private", "static", "String", "recoveryName", ";", "private", "static", "String", "recoveryMessage", ";", "private", "static", "String", "lastRecoveryMessage", ";", "private", "static", "int", "recoveryStepCount", "=", "0", ";", "private", "static", "final", "int", "REQUEST_CODE_PICK_FILE", "=", "999", ";", "private", "static", "final", "int", "REQUEST_CODE_PICK_RECOVERY", "=", "1000", ";", "private", "static", "final", "int", "REQUEST_CODE_PICK_OTHER", "=", "1001", ";", "GestureDetector", "gd", ";", "@", "Override", "public", "void", "onCreate", "(", "Bundle", "savedInstanceState", ")", "{", "super", ".", "onCreate", "(", "savedInstanceState", ")", ";", "setRequestedOrientation", "(", "ActivityInfo", ".", "SCREEN_ORIENTATION_PORTRAIT", ")", ";", "setContentView", "(", "R", ".", "layout", ".", "main", ")", ";", "theView", "=", "this", ";", "manifestURL", "=", "theView", ".", "getString", "(", "R", ".", "string", ".", "manifest_url", ")", ";", "textView", "=", "(", "TextView", ")", "findViewById", "(", "R", ".", "id", ".", "pagetext", ")", ";", "textView", ".", "setMovementMethod", "(", "LinkMovementMethod", ".", "getInstance", "(", ")", ")", ";", "textView", ".", "setText", "(", "\"\"", ")", ";", "buttonTextView", "=", "(", "TextView", ")", "findViewById", "(", "R", ".", "id", ".", "BacksideUpdaterButton", ")", ";", "buttonTextView", ".", "setVisibility", "(", "4", ")", ";", "try", "{", "Runtime", ".", "getRuntime", "(", ")", ".", "exec", "(", "\"su\"", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "showCustomToast", "(", "e", ".", "toString", "(", ")", ")", ";", "}", "alreadyDownloaded", "=", "false", ";", "checkManifest", "(", ")", ";", "gd", "=", "new", "GestureDetector", "(", "getBaseContext", "(", ")", ",", "sogl", ")", ";", "}", "@", "Override", "public", "void", "onConfigurationChanged", "(", "Configuration", "newConfig", ")", "{", "super", ".", "onConfigurationChanged", "(", "newConfig", ")", ";", "setRequestedOrientation", "(", "ActivityInfo", ".", "SCREEN_ORIENTATION_PORTRAIT", ")", ";", "}", "@", "Override", "public", "boolean", "onTouchEvent", "(", "MotionEvent", "event", ")", "{", "return", "gd", ".", "onTouchEvent", "(", "event", ")", ";", "}", "GestureDetector", ".", "SimpleOnGestureListener", "sogl", "=", "new", "GestureDetector", ".", "SimpleOnGestureListener", "(", ")", "{", "public", "boolean", "onDown", "(", "MotionEvent", "event", ")", "{", "return", "true", ";", "}", "public", "void", "onLongPress", "(", "MotionEvent", "event", ")", "{", "String", "bband", "=", "null", ";", "BufferedReader", "reader", "=", "null", ";", "try", "{", "reader", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "new", "FileInputStream", "(", "\"\"", ")", ")", ")", ";", "bband", "=", "reader", ".", "readLine", "(", ")", ";", "}", "catch", "(", "IOException", "io", ")", "{", "io", ".", "printStackTrace", "(", ")", ";", "bband", "=", "\"error\"", ";", "}", "finally", "{", "try", "{", "reader", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "}", "reader", "=", "null", ";", "}", "String", "basebandMessage", "=", "\"\"", "+", "bband", ";", "showCustomToast", "(", "basebandMessage", ")", ";", "}", "}", ";", "@", "Override", "public", "boolean", "onCreateOptionsMenu", "(", "Menu", "menu", ")", "{", "menu", ".", "add", "(", "1", ",", "1", ",", "1", ",", "\"\"", ")", ";", "menu", ".", "add", "(", "1", ",", "2", ",", "2", ",", "\"\"", ")", ";", "menu", ".", "add", "(", "1", ",", "3", ",", "3", ",", "\"\"", ")", ";", "menu", ".", "add", "(", "1", ",", "4", ",", "4", ",", "\"\"", ")", ";", "menu", ".", "add", "(", "1", ",", "5", ",", "5", ",", "\"\"", ")", ";", "menu", ".", "add", "(", "1", ",", "6", ",", "6", ",", "\"\"", ")", ";", "menu", ".", "add", "(", "1", ",", "7", ",", "7", ",", "\"Exit\"", ")", ";", "return", "true", ";", "}", "@", "Override", "public", "boolean", "onOptionsItemSelected", "(", "MenuItem", "item", ")", "{", "switch", "(", "item", ".", "getItemId", "(", ")", ")", "{", "case", "1", ":", "textView", ".", "setText", "(", "\"\"", ")", ";", "alreadyDownloadedHandler", "(", ")", ";", "return", "true", ";", "case", "2", ":", "textView", ".", "setGravity", "(", "3", ")", ";", "textView", ".", "setText", "(", "\"Changelog", "\"", "+", "romName", "+", "\":nn\"", "+", "theChangeLog", ")", ";", "return", "true", ";", "case", "3", ":", "textView", ".", "setText", "(", "\"\"", ")", ";", "backupRestoreDialog", "(", ")", ";", "return", "true", ";", "case", "4", ":", "textView", ".", "setText", "(", "\"\"", ")", ";", "showExtendedManifest", "(", ")", ";", "return", "true", ";", "case", "5", ":", "buttonTextView", ".", "setVisibility", "(", "4", ")", ";", "textView", ".", "setText", "(", "\"\"", ")", ";", "textView", ".", "setGravity", "(", "Gravity", ".", "CENTER", ")", ";", "TextView", "myMsg", "=", "new", "TextView", "(", "theView", ")", ";", "myMsg", ".", "setText", "(", "\"\"", ")", ";", "myMsg", ".", "setGravity", "(", "Gravity", ".", "CENTER_HORIZONTAL", ")", ";", "new", "AlertDialog", ".", "Builder", "(", "theView", ")", ".", "setTitle", "(", "\"\"", ")", ".", "setView", "(", "myMsg", ")", ".", "setPositiveButton", "(", "\"\"", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "whichButton", ")", "{", "recoveryName", "=", "\"recovery.img\"", ";", "Intent", "intent", "=", "new", "Intent", "(", "Intent", ".", "ACTION_GET_CONTENT", ")", ";", "intent", ".", "setDataAndType", "(", "Uri", ".", "fromFile", "(", "new", "File", "(", "\"\"", ")", ")", ",", "\"file/*\"", ")", ";", "startActivityForResult", "(", "intent", ",", "REQUEST_CODE_PICK_RECOVERY", ")", ";", "}", "}", ")", ".", "setNegativeButton", "(", "\"Cancel\"", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "whichButton", ")", "{", "}", "}", ")", ".", "show", "(", ")", ";", "return", "true", ";", "case", "6", ":", "Intent", "intent", "=", "new", "Intent", "(", "Intent", ".", "ACTION_GET_CONTENT", ")", ";", "intent", ".", "setDataAndType", "(", "Uri", ".", "fromFile", "(", "new", "File", "(", "\"\"", ")", ")", ",", "\"file/*\"", ")", ";", "startActivityForResult", "(", "intent", ",", "REQUEST_CODE_PICK_OTHER", ")", ";", "return", "true", ";", "case", "7", ":", "System", ".", "exit", "(", "0", ")", ";", "return", "true", ";", "}", "return", "super", ".", "onOptionsItemSelected", "(", "item", ")", ";", "}", "public", "void", "myClickHandler", "(", "View", "view", ")", "{", "textView", ".", "setGravity", "(", "17", ")", ";", "switch", "(", "view", ".", "getId", "(", ")", ")", "{", "case", "R", ".", "id", ".", "BacksideUpdaterButton", ":", "try", "{", "if", "(", "ALREADY_CHECKED", "==", "0", ")", "{", "ALREADY_CHECKED", "=", "1", ";", "textView", ".", "setText", "(", "\"\"", ")", ";", "checkStatus", "(", ")", ";", "}", "else", "{", "if", "(", "ALREADY_CHECKED", "==", "1", ")", "{", "if", "(", "upToDate", "&&", "!", "alreadyDownloaded", ")", "{", "System", ".", "exit", "(", "0", ")", ";", "}", "else", "{", "ALREADY_CHECKED", "=", "2", ";", "downloadUpdateNow", "(", ")", ";", "}", "}", "else", "{", "if", "(", "!", "checkFileSize", "(", "romName", ")", ")", "{", "textView", ".", "setText", "(", "\"Checking", "MD5\"", ")", ";", "checkMD5", "(", "localFileName", ",", "false", ")", ";", "}", "else", "{", "ALREADY_CHECKED", "=", "2", ";", "String", "tempFile", "=", "\"/sdcard\"", "+", "localFileName", ";", "final", "String", "badFileName", "=", "localFileName", ".", "substring", "(", "0", ",", "localFileName", ".", "length", "(", ")", "-", "3", ")", "+", "\"txt\"", ";", "final", "String", "badFile", "=", "(", "badFileName", ".", "indexOf", "(", "\"/dcard\"", ")", ">=", "0", ")", "?", "badFileName", ":", "\"/sdcard\"", "+", "badFileName", ";", "final", "File", "fBad", "=", "new", "File", "(", "badFile", ")", ";", "if", "(", "fBad", ".", "exists", "(", ")", ")", "{", "tempFile", "=", "badFile", ";", "}", "final", "String", "file", "=", "tempFile", ";", "final", "File", "f", "=", "new", "File", "(", "file", ")", ";", "if", "(", "f", ".", "exists", "(", ")", ")", "{", "final", "ProgressDialog", "downloadDialog", "=", "new", "ProgressDialog", "(", "theView", ")", ";", "downloadDialog", ".", "setCancelable", "(", "false", ")", ";", "downloadDialog", ".", "setProgressStyle", "(", "ProgressDialog", ".", "STYLE_HORIZONTAL", ")", ";", "downloadDialog", ".", "setProgress", "(", "0", ")", ";", "downloadDialog", ".", "setMax", "(", "100", ")", ";", "downloadDialog", ".", "setMessage", "(", "\"Downloadingn\"", "+", "romName", "+", "\"\"", ")", ";", "downloadDialog", ".", "setOnDismissListener", "(", "new", "OnDismissListener", "(", ")", "{", "public", "void", "onDismiss", "(", "DialogInterface", "dialog", ")", "{", "final", "File", "fProgress", "=", "new", "File", "(", "file", ")", ";", "final", "int", "progressFileSize", "=", "(", "int", ")", "(", "fProgress", ".", "length", "(", ")", ")", "/", "1024", "/", "1024", ";", "int", "percentageDownloaded", "=", "(", "progressFileSize", "*", "100", "/", "Integer", ".", "parseInt", "(", "theFileSize", ")", ")", ";", "if", "(", "percentageDownloaded", ">=", "100", ")", "{", "try", "{", "textView", ".", "setText", "(", "\"Checking", "MD5\"", ")", ";", "checkMD5", "(", "file", ",", "false", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "}", "}", ")", ";", "final", "Handler", "downloadProgressHandler", "=", "new", "Handler", "(", ")", "{", "public", "void", "handleMessage", "(", "Message", "msg", ")", "{", "final", "File", "fProgress", "=", "new", "File", "(", "file", ")", ";", "final", "int", "progressFileSize", "=", "(", "int", ")", "(", "fProgress", ".", "length", "(", ")", ")", "/", "1024", "/", "1024", ";", "int", "percentageDownloaded", "=", "(", "progressFileSize", "*", "100", "/", "Integer", ".", "parseInt", "(", "theFileSize", ")", ")", ";", "downloadDialog", ".", "setProgress", "(", "percentageDownloaded", ")", ";", "}", "}", ";", "downloadDialog", ".", "show", "(", ")", ";", "Thread", "downloadProgress", "=", "new", "Thread", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "try", "{", "while", "(", "downloadDialog", ".", "getProgress", "(", ")", "<", "downloadDialog", ".", "getMax", "(", ")", ")", "{", "Thread", ".", "sleep", "(", "500", ")", ";", "downloadProgressHandler", ".", "sendMessage", "(", "downloadProgressHandler", ".", "obtainMessage", "(", ")", ")", ";", "}", "Thread", ".", "sleep", "(", "500", ")", ";", "}", "catch", "(", "java", ".", "lang", ".", "InterruptedException", "e", ")", "{", "showCustomToast", "(", "e", ".", "toString", "(", ")", ")", ";", "}", "downloadDialog", ".", "dismiss", "(", ")", ";", "}", "}", ")", ";", "downloadProgress", ".", "start", "(", ")", ";", "textView", ".", "setText", "(", "\"\"", ")", ";", "}", "else", "{", "ALREADY_CHECKED", "=", "1", ";", "showCustomToast", "(", "\"\"", ")", ";", "textView", ".", "setText", "(", "\"\"", ")", ";", "buttonTextView", ".", "setText", "(", "\"Download", "Now\"", ")", ";", "}", "}", "}", "}", "}", "catch", "(", "Exception", "e", ")", "{", "textView", ".", "setText", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}", "break", ";", "}", "}", "private", "boolean", "isNetworkAvailable", "(", ")", "{", "ConnectivityManager", "connectivityManager", "=", "(", "ConnectivityManager", ")", "getSystemService", "(", "Context", ".", "CONNECTIVITY_SERVICE", ")", ";", "NetworkInfo", "activeNetworkInfo", "=", "connectivityManager", ".", "getActiveNetworkInfo", "(", ")", ";", "return", "activeNetworkInfo", "!=", "null", ";", "}", "public", "void", "checkManifest", "(", ")", "{", "if", "(", "isNetworkAvailable", "(", ")", ")", "{", "final", "ProgressDialog", "manifestDialog", "=", "ProgressDialog", ".", "show", "(", "this", ",", "\"\"", ",", "\"\"", ",", "true", ")", ";", "if", "(", "!", "alreadyDownloaded", ")", "{", "manifestDialog", ".", "setOnDismissListener", "(", "new", "OnDismissListener", "(", ")", "{", "public", "void", "onDismiss", "(", "DialogInterface", "dialog", ")", "{", "if", "(", "line", "!=", "null", ")", "{", "checkStatus", "(", ")", ";", "}", "else", "{", "checkManifest", "(", ")", ";", "}", "}", "}", ")", ";", "}", "new", "Thread", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "BufferedReader", "rd", "=", "null", ";", "try", "{", "String", "lines", "=", "\"\"", ";", "line", "=", "\"\"", ";", "HttpClient", "client", "=", "new", "DefaultHttpClient", "(", ")", ";", "HttpGet", "request", "=", "new", "HttpGet", "(", "manifestURL", ")", ";", "HttpResponse", "response", "=", "client", ".", "execute", "(", "request", ")", ";", "rd", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "response", ".", "getEntity", "(", ")", ".", "getContent", "(", ")", ")", ")", ";", "while", "(", "(", "lines", "=", "rd", ".", "readLine", "(", ")", ")", "!=", "null", ")", "{", "line", "=", "line", "+", "lines", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "textView", ".", "setText", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}", "finally", "{", "try", "{", "rd", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "}", "rd", "=", "null", ";", "}", "manifestDialog", ".", "dismiss", "(", ")", ";", "return", ";", "}", "}", ")", ".", "start", "(", ")", ";", "buttonTextView", ".", "setText", "(", "\"Checking...\"", ")", ";", "}", "else", "{", "TextView", "myMsg", "=", "new", "TextView", "(", "theView", ")", ";", "myMsg", ".", "setText", "(", "\"\"", ")", ";", "myMsg", ".", "setGravity", "(", "Gravity", ".", "CENTER_HORIZONTAL", ")", ";", "new", "AlertDialog", ".", "Builder", "(", "theView", ")", ".", "setTitle", "(", "\"\"", ")", ".", "setIcon", "(", "R", ".", "drawable", ".", "md5_error", ")", ".", "setView", "(", "myMsg", ")", ".", "setPositiveButton", "(", "\"\"", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "whichButton", ")", "{", "startActivity", "(", "new", "Intent", "(", "Settings", ".", "ACTION_WIRELESS_SETTINGS", ")", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "}", ")", ".", "setNegativeButton", "(", "\"\"", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "whichButton", ")", "{", "System", ".", "exit", "(", "0", ")", ";", "}", "}", ")", ".", "show", "(", ")", ";", "}", "}", "private", "void", "showExtendedManifest", "(", ")", "{", "final", "String", "[", "]", "oldManifest", "=", "line", ".", "split", "(", "\"~\"", ")", ";", "final", "int", "versionLength", "=", "oldManifest", ".", "length", ";", "final", "String", "[", "]", "oldVersion", "=", "new", "String", "[", "versionLength", "]", ";", "int", "cntr", "=", "0", ";", "for", "(", "String", "i", ":", "oldManifest", ")", "{", "String", "[", "]", "nextVersion", "=", "i", ".", "split", "(", "\",\"", ")", ";", "String", "thisRomDate", "=", "nextVersion", "[", "0", "]", ".", "substring", "(", "4", ",", "8", ")", "+", "nextVersion", "[", "0", "]", ".", "substring", "(", "0", ",", "4", ")", ";", "if", "(", "cntr", "==", "0", ")", "{", "oldVersion", "[", "cntr", "]", "=", "thisRomDate", "+", "\"", "(newest)\"", ";", "}", "else", "if", "(", "(", "cntr", "==", "versionLength", "-", "1", ")", "&&", "(", "nextVersion", "[", "4", "]", ".", "indexOf", "(", "\"CWM\"", ")", ">=", "0", ")", ")", "{", "oldVersion", "[", "cntr", "]", "=", "thisRomDate", "+", "\"\"", ";", "}", "else", "{", "oldVersion", "[", "cntr", "]", "=", "thisRomDate", ";", "}", "cntr", "++", ";", "}", "new", "AlertDialog", ".", "Builder", "(", "theView", ")", ".", "setTitle", "(", "\"\"", ")", ".", "setItems", "(", "oldVersion", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "item", ")", "{", "choosenDate", "=", "item", ";", "checkStatus", "(", ")", ";", "}", "}", ")", ".", "show", "(", ")", ";", "}", "private", "void", "checkStatus", "(", ")", "{", "ALREADY_CHECKED", "=", "1", ";", "textView", ".", "setText", "(", "\"\"", ")", ";", "String", "[", "]", "romVersions", "=", "line", ".", "split", "(", "\"~\"", ")", ";", "String", "[", "]", "separated", "=", "romVersions", "[", "choosenDate", "]", ".", "split", "(", "\",\"", ")", ";", "theDate", "=", "separated", "[", "0", "]", ";", "theUrl", "=", "separated", "[", "1", "]", ";", "theChangeLog", "=", "separated", "[", "2", "]", ".", "replace", "(", "\"--\"", ",", "\"nn\"", ")", ";", "theMD5", "=", "separated", "[", "3", "]", ";", "romName", "=", "separated", "[", "4", "]", ";", "localFileName", "=", "\"/download/\"", "+", "romName", ";", "theFileSize", "=", "separated", "[", "5", "]", ";", "upToDate", "=", "(", "BUILD_DATE", ">=", "Integer", ".", "parseInt", "(", "theDate", ")", "&&", "choosenDate", "==", "0", ")", ";", "if", "(", "upToDate", ")", "{", "buttonTextView", ".", "setVisibility", "(", "4", ")", ";", "}", "else", "{", "buttonTextView", ".", "setVisibility", "(", "0", ")", ";", "}", "String", "file", "=", "(", "localFileName", ".", "indexOf", "(", "\"/sdcard\"", ")", ">=", "0", ")", "?", "localFileName", ":", "\"/sdcard\"", "+", "localFileName", ";", "String", "badFile", "=", "file", ".", "substring", "(", "0", ",", "file", ".", "length", "(", ")", "-", "3", ")", "+", "\"txt\"", ";", "File", "fBad", "=", "new", "File", "(", "badFile", ")", ";", "if", "(", "fBad", ".", "exists", "(", ")", ")", "{", "try", "{", "Runtime", ".", "getRuntime", "(", ")", ".", "exec", "(", "\"mv", "\"", "+", "badFile", "+", "\"", "\"", "+", "file", ")", ";", "Thread", ".", "sleep", "(", "10", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "showCustomToast", "(", "\"\"", "+", "e", ".", "toString", "(", ")", ")", ";", "}", "catch", "(", "InterruptedException", "ee", ")", "{", "showCustomToast", "(", "\"\"", "+", "ee", ".", "toString", "(", ")", ")", ";", "}", "}", "final", "File", "f", "=", "new", "File", "(", "file", ")", ";", "if", "(", "!", "upToDate", ")", "{", "if", "(", "f", ".", "exists", "(", ")", ")", "{", "if", "(", "!", "checkFileSize", "(", "romName", ")", ")", "{", "showCustomToast", "(", "\"\"", ")", ";", "textView", ".", "setText", "(", "\"\"", ")", ";", "buttonTextView", ".", "setText", "(", "\"\"", ")", ";", "ALREADY_CHECKED", "=", "2", ";", "}", "else", "{", "showCustomToast", "(", "\"\"", ")", ";", "textView", ".", "setText", "(", "\"\"", ")", ";", "buttonTextView", ".", "setText", "(", "\"\"", ")", ";", "ALREADY_CHECKED", "=", "2", ";", "}", "}", "else", "{", "textView", ".", "setGravity", "(", "3", ")", ";", "textView", ".", "setText", "(", "\"Changelog", "\"", "+", "romName", "+", "\":nn\"", "+", "theChangeLog", ")", ";", "if", "(", "choosenDate", "==", "0", ")", "{", "showCustomToast", "(", "\"\"", "+", "romName", ")", ";", "}", "else", "if", "(", "(", "choosenDate", "==", "(", "romVersions", ".", "length", "-", "1", ")", ")", "&&", "(", "romName", ".", "indexOf", "(", "\"CWM\"", ")", ">=", "0", ")", ")", "{", "showCustomToast", "(", "\"\"", "+", "theDate", ")", ";", "}", "else", "{", "showCustomToast", "(", "\"\"", "+", "romName", ")", ";", "}", "buttonTextView", ".", "setText", "(", "\"Download", "Now\"", ")", ";", "}", "}", "else", "{", "textView", ".", "setText", "(", "\"\"", "+", "BUILD_DATE", "+", "\"\"", "+", "theDate", "+", "\"\"", ")", ";", "buttonTextView", ".", "setText", "(", "\"\"", ")", ";", "}", "}", "public", "void", "alreadyDownloadedHandler", "(", ")", "{", "textView", ".", "setGravity", "(", "17", ")", ";", "try", "{", "alreadyDownloaded", "=", "true", ";", "ALREADY_CHECKED", "=", "2", ";", "String", "[", "]", "romVersions", "=", "line", ".", "split", "(", "\"~\"", ")", ";", "String", "[", "]", "separated", "=", "romVersions", "[", "choosenDate", "]", ".", "split", "(", "\",\"", ")", ";", "theDate", "=", "separated", "[", "0", "]", ";", "theUrl", "=", "separated", "[", "1", "]", ";", "theChangeLog", "=", "separated", "[", "2", "]", ".", "replace", "(", "\"--\"", ",", "\"nn\"", ")", ";", "theMD5", "=", "separated", "[", "3", "]", ";", "romName", "=", "separated", "[", "4", "]", ";", "theFileSize", "=", "separated", "[", "5", "]", ";", "upToDate", "=", "(", "BUILD_DATE", ">=", "Integer", ".", "parseInt", "(", "theDate", ")", ")", ";", "Intent", "intent", "=", "new", "Intent", "(", "Intent", ".", "ACTION_GET_CONTENT", ")", ";", "intent", ".", "setDataAndType", "(", "Uri", ".", "fromFile", "(", "new", "File", "(", "\"\"", ")", ")", ",", "\"file/*\"", ")", ";", "startActivityForResult", "(", "intent", ",", "REQUEST_CODE_PICK_FILE", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "textView", ".", "setText", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "public", "static", "void", "downloadUpdateNow", "(", ")", "{", "Intent", "downloadUpdate", "=", "new", "Intent", "(", "Intent", ".", "ACTION_VIEW", ")", ";", "downloadUpdate", ".", "setData", "(", "Uri", ".", "parse", "(", "theUrl", ")", ")", ";", "theView", ".", "startActivity", "(", "downloadUpdate", ")", ";", "textView", ".", "setText", "(", "\"\"", ")", ";", "buttonTextView", ".", "setText", "(", "\"\"", ")", ";", "}", "private", "static", "void", "md5Dialog", "(", "final", "String", "fileName", ",", "final", "Boolean", "downloaded", ")", "{", "if", "(", "goodMD5", ")", "{", "TextView", "myMsg", "=", "new", "TextView", "(", "theView", ")", ";", "myMsg", ".", "setText", "(", "\"\"", ")", ";", "myMsg", ".", "setGravity", "(", "Gravity", ".", "CENTER_HORIZONTAL", ")", ";", "new", "AlertDialog", ".", "Builder", "(", "theView", ")", ".", "setTitle", "(", "\"MD5\"", ")", ".", "setIcon", "(", "R", ".", "drawable", ".", "download_complete_icon", ")", ".", "setView", "(", "myMsg", ")", ".", "setPositiveButton", "(", "\"\"", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "whichButton", ")", "{", "textView", ".", "setText", "(", "\"\"", ")", ";", "RebootList", "(", "fileName", ")", ";", "}", "}", ")", ".", "setNegativeButton", "(", "\"\"", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "whichButton", ")", "{", "textView", ".", "setText", "(", "\"\"", ")", ";", "}", "}", ")", ".", "show", "(", ")", ";", "}", "else", "{", "buttonTextView", ".", "setVisibility", "(", "0", ")", ";", "TextView", "myMsg", "=", "new", "TextView", "(", "theView", ")", ";", "myMsg", ".", "setText", "(", "\"\"", "+", "downloadMD5", "+", "\"\"", "+", "theMD5", "+", "\"\"", ")", ";", "myMsg", ".", "setGravity", "(", "Gravity", ".", "CENTER_HORIZONTAL", ")", ";", "new", "AlertDialog", ".", "Builder", "(", "theView", ")", ".", "setTitle", "(", "\"\"", ")", ".", "setIcon", "(", "R", ".", "drawable", ".", "md5_error", ")", ".", "setView", "(", "myMsg", ")", ".", "setPositiveButton", "(", "\"\"", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "whichButton", ")", "{", "ALREADY_CHECKED", "=", "2", ";", "textView", ".", "setText", "(", "\"\"", ")", ";", "buttonTextView", ".", "setText", "(", "\"Download", "Now\"", ")", ";", "File", "f", "=", "new", "File", "(", "fileName", ")", ";", "f", ".", "delete", "(", ")", ";", "downloadUpdateNow", "(", ")", ";", "}", "}", ")", ".", "setNegativeButton", "(", "\"\"", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "whichButton", ")", "{", "textView", ".", "setText", "(", "\"\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "}", ")", ".", "show", "(", ")", ";", "}", "}", "public", "static", "String", "checkMD5", "(", "final", "String", "fileName", ",", "Boolean", "downloaded", ")", "throws", "IOException", "{", "String", "tempFileName", "=", "\"\"", ";", "if", "(", "fileName", ".", "indexOf", "(", "\"txt\"", ")", ">=", "0", ")", "{", "tempFileName", "=", "fileName", ".", "substring", "(", "0", ",", "fileName", ".", "length", "(", ")", "-", "3", ")", "+", "\"img\"", ";", "Runtime", ".", "getRuntime", "(", ")", ".", "exec", "(", "\"mv", "\"", "+", "fileName", "+", "\"", "\"", "+", "tempFileName", ")", ";", "}", "else", "{", "tempFileName", "=", "fileName", ";", "}", "final", "String", "thisFileName", "=", "tempFileName", ";", "if", "(", "thisFileName", ".", "substring", "(", "thisFileName", ".", "length", "(", ")", "-", "3", ")", ".", "equalsIgnoreCase", "(", "\"zip\"", ")", "||", "thisFileName", ".", "substring", "(", "thisFileName", ".", "length", "(", ")", "-", "3", ")", ".", "equalsIgnoreCase", "(", "\"img\"", ")", ")", "{", "md5FileName", "=", "(", "thisFileName", ".", "indexOf", "(", "\"/sdcard\"", ")", ">=", "0", ")", "?", "thisFileName", ":", "\"/sdcard\"", "+", "thisFileName", ";", "buttonTextView", ".", "setVisibility", "(", "4", ")", ";", "textView", ".", "setText", "(", "\"Checking", "MD5\"", ")", ";", "final", "ProgressDialog", "md5Dialog", "=", "ProgressDialog", ".", "show", "(", "theView", ",", "\"\"", ",", "\"\"", ",", "true", ")", ";", "md5Dialog", ".", "setOnDismissListener", "(", "new", "OnDismissListener", "(", ")", "{", "public", "void", "onDismiss", "(", "DialogInterface", "dialog", ")", "{", "if", "(", "thisFileName", ".", "substring", "(", "thisFileName", ".", "length", "(", ")", "-", "3", ")", ".", "equalsIgnoreCase", "(", "\"zip\"", ")", ")", "{", "md5Dialog", "(", "thisFileName", ",", "true", ")", ";", "}", "else", "if", "(", "thisFileName", ".", "substring", "(", "thisFileName", ".", "length", "(", ")", "-", "3", ")", ".", "equalsIgnoreCase", "(", "\"img\"", ")", ")", "{", "installRecovery", "(", "thisFileName", ")", ";", "}", "}", "}", ")", ";", "new", "Thread", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "try", "{", "String", "calculatedDigest", "=", "calculateMD5", "(", "md5FileName", ")", ";", "if", "(", "calculatedDigest", "==", "null", ")", "{", "goodMD5", "=", "false", ";", "textView", ".", "setText", "(", "\"\"", ")", ";", "}", "goodMD5", "=", "calculatedDigest", ".", "equalsIgnoreCase", "(", "theMD5", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "showCustomToast", "(", "e", ".", "getMessage", "(", ")", ")", ";", "textView", ".", "setText", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}", "catch", "(", "NullPointerException", "e2", ")", "{", "showCustomToast", "(", "e2", ".", "getMessage", "(", ")", ")", ";", "}", "md5Dialog", ".", "dismiss", "(", ")", ";", "return", ";", "}", "}", ")", ".", "start", "(", ")", ";", "}", "else", "{", "badFilePath", "(", "0", ")", ";", "}", "return", "\"done\"", ";", "}", "public", "static", "String", "calculateMD5", "(", "String", "fileName", ")", "throws", "IOException", "{", "downloadMD5", "=", "\"\"", ";", "if", "(", "fileName", "!=", "null", "&&", "!", "fileName", ".", "toString", "(", ")", ".", "equals", "(", "\"\"", ")", ")", "{", "java", ".", "lang", ".", "Process", "process", "=", "Runtime", ".", "getRuntime", "(", ")", ".", "exec", "(", "\"md5sum", "\"", "+", "fileName", ")", ";", "BufferedReader", "bufferedReader", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "process", ".", "getInputStream", "(", ")", ")", ")", ";", "String", "[", "]", "results", "=", "bufferedReader", ".", "readLine", "(", ")", ".", "split", "(", "\"", "\"", ")", ";", "try", "{", "bufferedReader", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "}", "bufferedReader", "=", "null", ";", "downloadMD5", "=", "results", "[", "0", "]", ";", "}", "return", "downloadMD5", ";", "}", "public", "static", "void", "RebootRecovery", "(", ")", "{", "TextView", "myMsg", "=", "new", "TextView", "(", "theView", ")", ";", "myMsg", ".", "setText", "(", "\"\"", ")", ";", "myMsg", ".", "setGravity", "(", "Gravity", ".", "CENTER_HORIZONTAL", ")", ";", "new", "AlertDialog", ".", "Builder", "(", "theView", ")", ".", "setTitle", "(", "\"\"", ")", ".", "setView", "(", "myMsg", ")", ".", "setPositiveButton", "(", "\"\"", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "whichButton", ")", "{", "textView", ".", "setText", "(", "\"\"", ")", ";", "PowerManager", "pm", "=", "(", "PowerManager", ")", "theView", ".", "getSystemService", "(", "Context", ".", "POWER_SERVICE", ")", ";", "pm", ".", "reboot", "(", "\"recovery\"", ")", ";", "}", "}", ")", ".", "setNegativeButton", "(", "\"Later\"", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "whichButton", ")", "{", "textView", ".", "setText", "(", "\"\"", ")", ";", "}", "}", ")", ".", "show", "(", ")", ";", "}", "public", "static", "void", "RebootList", "(", "String", "theFileName", ")", "{", "showCustomToast", "(", "\"\"", ")", ";", "final", "String", "rebootFileName", "=", "theFileName", ";", "final", "String", "[", "]", "rebootOptions", "=", "{", "\"\"", ",", "\"\"", ",", "\"\"", "}", ";", "new", "AlertDialog", ".", "Builder", "(", "theView", ")", ".", "setTitle", "(", "\"\"", ")", ".", "setNegativeButton", "(", "\"\"", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "whichButton", ")", "{", "textView", ".", "setText", "(", "\"\"", ")", ";", "}", "}", ")", ".", "setItems", "(", "rebootOptions", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "item", ")", "{", "RebootCmd", "(", "rebootFileName", ",", "item", ")", ";", "}", "}", ")", ".", "show", "(", ")", ";", "}", "public", "static", "void", "RebootCmd", "(", "String", "theFileName", ",", "int", "rebootMethod", ")", "{", "String", "updateFileName", "=", "\"\"", ";", "if", "(", "theFileName", ".", "indexOf", "(", "\"sdcard\"", ")", "<", "0", ")", "{", "updateFileName", "=", "\"/sdcard\"", "+", "theFileName", ";", "}", "else", "{", "updateFileName", "=", "theFileName", ";", "}", "if", "(", "theFileName", ".", "indexOf", "(", "\"mnt\"", ")", ">=", "0", ")", "{", "String", "[", "]", "fixFileName", "=", "theFileName", ".", "split", "(", "\"/mnt\"", ")", ";", "updateFileName", "=", "fixFileName", "[", "fixFileName", ".", "length", "-", "1", "]", ";", "}", "else", "{", "updateFileName", "=", "theFileName", ";", "}", "String", "theUpdateFileName", "=", "updateFileName", ";", "String", "recoveryUpdateString", "=", "\"\"", ";", "if", "(", "rebootMethod", "==", "1", ")", "{", "recoveryUpdateString", "=", "\"\"", "+", "theUpdateFileName", "+", "\"\"", ";", "textView", ".", "setText", "(", "\"\"", ")", ";", "}", "if", "(", "rebootMethod", "==", "2", ")", "{", "recoveryUpdateString", "=", "\"\"", "+", "theUpdateFileName", "+", "\"\"", ";", "textView", ".", "setText", "(", "\"\"", ")", ";", "}", "if", "(", "rebootMethod", "==", "3", ")", "{", "recoveryUpdateString", "=", "\"\"", ";", "textView", ".", "setText", "(", "\"\"", ")", ";", "}", "if", "(", "rebootMethod", "==", "4", ")", "{", "recoveryUpdateString", "=", "\"\"", "+", "theUpdateFileName", "+", "\"\"", ";", "textView", ".", "setText", "(", "\"\"", "+", "theUpdateFileName", "+", "\"...\"", ")", ";", "}", "BufferedReader", "bufferedReader", "=", "null", ";", "String", "results", "=", "\"\"", ";", "if", "(", "rebootMethod", "==", "0", ")", "{", "textView", ".", "setText", "(", "\"\"", ")", ";", "PowerManager", "pm", "=", "(", "PowerManager", ")", "theView", ".", "getSystemService", "(", "Context", ".", "POWER_SERVICE", ")", ";", "pm", ".", "reboot", "(", "\"recovery\"", ")", ";", "}", "else", "{", "try", "{", "String", "[", "]", "str1", "=", "{", "\"su\"", ",", "\"-c\"", ",", "recoveryUpdateString", "}", ";", "java", ".", "lang", ".", "Process", "process", "=", "Runtime", ".", "getRuntime", "(", ")", ".", "exec", "(", "str1", ")", ";", "bufferedReader", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "process", ".", "getInputStream", "(", ")", ")", ")", ";", "results", "=", "bufferedReader", ".", "readLine", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "showCustomToast", "(", "e", ".", "toString", "(", ")", "+", "\"", "\"", "+", "results", ")", ";", "}", "finally", "{", "if", "(", "results", "==", "null", ")", "{", "Handler", "handler", "=", "new", "Handler", "(", ")", ";", "handler", ".", "postDelayed", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "File", "testFile", "=", "new", "File", "(", "\"\"", ")", ";", "if", "(", "testFile", ".", "exists", "(", ")", ")", "{", "PowerManager", "pm", "=", "(", "PowerManager", ")", "theView", ".", "getSystemService", "(", "Context", ".", "POWER_SERVICE", ")", ";", "pm", ".", "reboot", "(", "\"recovery\"", ")", ";", "}", "else", "{", "textView", ".", "setText", "(", "\"\"", ")", ";", "showCustomToast", "(", "\"\"", ")", ";", "}", "}", "}", ",", "5000", ")", ";", "}", "else", "{", "showCustomToast", "(", "results", ")", ";", "}", "try", "{", "bufferedReader", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "}", "bufferedReader", "=", "null", ";", "}", "}", "}", "public", "static", "boolean", "checkFileSize", "(", "String", "fileName", ")", "{", "String", "testFileName", "=", "fileName", ";", "if", "(", "fileName", ".", "indexOf", "(", "\"sdcard\"", ")", "==", "-", "1", ")", "{", "testFileName", "=", "\"/sdcard\"", "+", "localFileName", ";", "}", "try", "{", "File", "file", "=", "new", "File", "(", "testFileName", ")", ";", "fileSize", "=", "file", ".", "length", "(", ")", "/", "1024", "/", "1024", ";", "return", "(", "fileSize", "<", "Long", ".", "valueOf", "(", "theFileSize", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "showCustomToast", "(", "e", ".", "toString", "(", ")", ")", ";", "return", "false", ";", "}", "}", "private", "static", "String", "badFilePath", "(", "int", "whichFileType", ")", "{", "if", "(", "whichFileType", "==", "0", ")", "{", "textView", ".", "setText", "(", "\"\"", ")", ";", "}", "else", "{", "textView", ".", "setText", "(", "\"\"", ")", ";", "}", "return", "\"bad\"", ";", "}", "public", "static", "void", "showCustomToast", "(", "String", "str", ")", "{", "Toast", "toast", "=", "Toast", ".", "makeText", "(", "theView", ",", "str", ",", "Toast", ".", "LENGTH_LONG", ")", ";", "toast", ".", "setGravity", "(", "Gravity", ".", "CENTER", ",", "0", ",", "0", ")", ";", "LinearLayout", "toastView", "=", "(", "LinearLayout", ")", "toast", ".", "getView", "(", ")", ";", "ImageView", "customIcon", "=", "new", "ImageView", "(", "theView", ")", ";", "customIcon", ".", "setImageResource", "(", "R", ".", "drawable", ".", "custom_update_dialog_icon", ")", ";", "toastView", ".", "addView", "(", "customIcon", ",", "0", ")", ";", "toast", ".", "show", "(", ")", ";", "}", "public", "static", "void", "recoveryFinishedDialog", "(", ")", "{", "String", "[", "]", "rmsg", "=", "lastRecoveryMessage", ".", "split", "(", "\"", "\"", ")", ";", "if", "(", "rmsg", "[", "0", "]", ".", "equals", "(", "\"flashing\"", ")", "&&", "recoveryStepCount", ">", "20", ")", "{", "TextView", "myMsg", "=", "new", "TextView", "(", "theView", ")", ";", "myMsg", ".", "setText", "(", "\"\"", "+", "recoveryName", "+", "\"\"", ")", ";", "myMsg", ".", "setGravity", "(", "Gravity", ".", "CENTER_HORIZONTAL", ")", ";", "new", "AlertDialog", ".", "Builder", "(", "theView", ")", ".", "setTitle", "(", "\"\"", ")", ".", "setIcon", "(", "R", ".", "drawable", ".", "icon_installing", ")", ".", "setView", "(", "myMsg", ")", ".", "setPositiveButton", "(", "\"\"", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "whichButton", ")", "{", "textView", ".", "setText", "(", "\"\"", ")", ";", "RebootRecovery", "(", ")", ";", "}", "}", ")", ".", "setNegativeButton", "(", "\"Reboot", "Later\"", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "whichButton", ")", "{", "textView", ".", "setText", "(", "\"\"", ")", ";", "}", "}", ")", ".", "show", "(", ")", ";", "}", "else", "{", "TextView", "myMsg", "=", "new", "TextView", "(", "theView", ")", ";", "myMsg", ".", "setText", "(", "\"\"", "+", "recoveryName", "+", "\"\"", ")", ";", "myMsg", ".", "setGravity", "(", "Gravity", ".", "CENTER_HORIZONTAL", ")", ";", "new", "AlertDialog", ".", "Builder", "(", "theView", ")", ".", "setTitle", "(", "\"\"", ")", ".", "setIcon", "(", "R", ".", "drawable", ".", "md5_error", ")", ".", "setView", "(", "myMsg", ")", ".", "setPositiveButton", "(", "\"Try", "Again\"", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "whichButton", ")", "{", "textView", ".", "setText", "(", "\"\"", ")", ";", "}", "}", ")", ".", "setNegativeButton", "(", "\"Exit\"", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "whichButton", ")", "{", "System", ".", "exit", "(", "0", ")", ";", "}", "}", ")", ".", "show", "(", ")", ";", "}", "}", "public", "static", "String", "installRecovery", "(", "final", "String", "recoveryFile", ")", "{", "String", "theFileName", "=", "\"\"", ";", "if", "(", "recoveryFile", ".", "indexOf", "(", "\"/sdcard\"", ")", "<", "0", ")", "{", "theFileName", "=", "\"/sdcard\"", "+", "recoveryFile", ";", "}", "else", "{", "theFileName", "=", "recoveryFile", ";", "}", "final", "String", "thisFileName", "=", "theFileName", ";", "if", "(", "thisFileName", ".", "substring", "(", "thisFileName", ".", "length", "(", ")", "-", "3", ")", ".", "equalsIgnoreCase", "(", "\"img\"", ")", ")", "{", "TextView", "myMsg", "=", "new", "TextView", "(", "theView", ")", ";", "myMsg", ".", "setText", "(", "\"\"", "+", "recoveryFile", "+", "\"n\"", ")", ";", "myMsg", ".", "setGravity", "(", "Gravity", ".", "CENTER_HORIZONTAL", ")", ";", "new", "AlertDialog", ".", "Builder", "(", "theView", ")", ".", "setTitle", "(", "\"\"", ")", ".", "setView", "(", "myMsg", ")", ".", "setPositiveButton", "(", "\"Install", "Now\"", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "whichButton", ")", "{", "doInstallRecovery", "(", "thisFileName", ")", ";", "}", "}", ")", ".", "setNegativeButton", "(", "\"Cancel\"", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "whichButton", ")", "{", "textView", ".", "setGravity", "(", "Gravity", ".", "CENTER", ")", ";", "textView", ".", "setText", "(", "\"\"", ")", ";", "}", "}", ")", ".", "show", "(", ")", ";", "}", "else", "{", "badFilePath", "(", "1", ")", ";", "}", "return", "\"done\"", ";", "}", "public", "static", "String", "doInstallRecovery", "(", "final", "String", "recoveryFile", ")", "{", "recoveryName", "=", "recoveryFile", ";", "final", "ProgressDialog", "recoveryDialog", "=", "ProgressDialog", ".", "show", "(", "theView", ",", "\"\"", ",", "\"Installing", "\"", "+", "recoveryName", "+", "\"...\"", ",", "true", ")", ";", "recoveryDialog", ".", "setOnDismissListener", "(", "new", "OnDismissListener", "(", ")", "{", "public", "void", "onDismiss", "(", "DialogInterface", "dialog", ")", "{", "recoveryFinishedDialog", "(", ")", ";", "}", "}", ")", ";", "final", "Handler", "progressHandler", "=", "new", "Handler", "(", ")", "{", "public", "void", "handleMessage", "(", "Message", "msg", ")", "{", "textView", ".", "setGravity", "(", "80", ")", ";", "textView", ".", "setText", "(", "recoveryMessage", ")", ";", "}", "}", ";", "new", "Thread", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "String", "[", "]", "str", "=", "{", "\"su\"", ",", "\"-c\"", ",", "\"\"", "+", "recoveryName", "}", ";", "StringBuffer", "outputStr", "=", "new", "StringBuffer", "(", ")", ";", "String", "readInput", ";", "String", "readOutput", ";", "try", "{", "java", ".", "lang", ".", "Process", "process", "=", "Runtime", ".", "getRuntime", "(", ")", ".", "exec", "(", "str", ")", ";", "BufferedReader", "outputReader", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "process", ".", "getErrorStream", "(", ")", ")", ")", ";", "while", "(", "(", "readOutput", "=", "outputReader", ".", "readLine", "(", ")", ")", "!=", "null", ")", "{", "outputStr", ".", "append", "(", "readOutput", ".", "toString", "(", ")", "+", "\"n\"", ")", ";", "progressHandler", ".", "sendMessage", "(", "progressHandler", ".", "obtainMessage", "(", ")", ")", ";", "recoveryStepCount", "++", ";", "recoveryMessage", "=", "outputStr", ".", "toString", "(", ")", ";", "lastRecoveryMessage", "=", "readOutput", ".", "toString", "(", ")", ";", "}", "BufferedReader", "bufferedReader", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "process", ".", "getInputStream", "(", ")", ")", ")", ";", "while", "(", "(", "readInput", "=", "bufferedReader", ".", "readLine", "(", ")", ")", "!=", "null", ")", "{", "outputStr", ".", "append", "(", "readInput", ".", "toString", "(", ")", "+", "\"n\"", ")", ";", "progressHandler", ".", "sendMessage", "(", "progressHandler", ".", "obtainMessage", "(", ")", ")", ";", "recoveryMessage", "=", "outputStr", ".", "toString", "(", ")", ";", "lastRecoveryMessage", "=", "readInput", ".", "toString", "(", ")", ";", "}", "bufferedReader", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "System", ".", "err", ".", "print", "(", "e", ")", ";", "recoveryMessage", "=", "outputStr", ".", "toString", "(", ")", "+", "\"", "\"", "+", "e", ".", "getMessage", "(", ")", ";", "}", "recoveryDialog", ".", "dismiss", "(", ")", ";", "return", ";", "}", "}", ")", ".", "start", "(", ")", ";", "return", "\"done\"", ";", "}", "public", "void", "backupRestoreDialog", "(", ")", "{", "showCustomToast", "(", "\"\"", ")", ";", "TextView", "myMsg", "=", "new", "TextView", "(", "theView", ")", ";", "myMsg", ".", "setText", "(", "\"\"", ")", ";", "myMsg", ".", "setGravity", "(", "Gravity", ".", "CENTER_HORIZONTAL", ")", ";", "new", "AlertDialog", ".", "Builder", "(", "theView", ")", ".", "setTitle", "(", "\"\"", ")", ".", "setView", "(", "myMsg", ")", ".", "setPositiveButton", "(", "\"Backup\"", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "whichButton", ")", "{", "RebootCmd", "(", "\"\"", ",", "3", ")", ";", "}", "}", ")", ".", "setNeutralButton", "(", "\"Restore\"", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "whichButton", ")", "{", "showRestoreList", "(", ")", ";", "}", "}", ")", ".", "setNegativeButton", "(", "\"Cancel\"", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "whichButton", ")", "{", "textView", ".", "setGravity", "(", "Gravity", ".", "CENTER", ")", ";", "textView", ".", "setText", "(", "\"\"", ")", ";", "}", "}", ")", ".", "show", "(", ")", ";", "}", "public", "static", "String", "showRestoreList", "(", ")", "{", "File", "f", "=", "new", "File", "(", "\"\"", ")", ";", "final", "String", "[", "]", "files", "=", "f", ".", "list", "(", ")", ";", "if", "(", "files", "==", "null", ")", "{", "showCustomToast", "(", "\"\"", ")", ";", "}", "else", "{", "new", "AlertDialog", ".", "Builder", "(", "theView", ")", ".", "setTitle", "(", "\"\"", ")", ".", "setNegativeButton", "(", "\"\"", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "whichButton", ")", "{", "textView", ".", "setText", "(", "\"\"", ")", ";", "}", "}", ")", ".", "setItems", "(", "files", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "item", ")", "{", "restoreBackup", "(", "(", "\"\"", "+", "files", "[", "item", "]", ")", ",", "4", ")", ";", "}", "}", ")", ".", "show", "(", ")", ";", "}", "return", "\"\"", ";", "}", "public", "static", "String", "restoreBackup", "(", "String", "theFileName", ",", "int", "recoverytype", ")", "{", "final", "String", "restoreFile", "=", "theFileName", ";", "final", "int", "recoveryFlag", "=", "recoverytype", ";", "TextView", "myMsg", "=", "new", "TextView", "(", "theView", ")", ";", "myMsg", ".", "setText", "(", "\"\"", "+", "theFileName", "+", "\"\"", ")", ";", "myMsg", ".", "setGravity", "(", "Gravity", ".", "CENTER_HORIZONTAL", ")", ";", "new", "AlertDialog", ".", "Builder", "(", "theView", ")", ".", "setTitle", "(", "\"\"", ")", ".", "setView", "(", "myMsg", ")", ".", "setPositiveButton", "(", "\"Restore", "Now\"", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "whichButton", ")", "{", "RebootCmd", "(", "restoreFile", ",", "recoveryFlag", ")", ";", "}", "}", ")", ".", "setNegativeButton", "(", "\"Cancel\"", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "whichButton", ")", "{", "textView", ".", "setGravity", "(", "Gravity", ".", "CENTER", ")", ";", "textView", ".", "setText", "(", "\"\"", ")", ";", "}", "}", ")", ".", "show", "(", ")", ";", "return", "\"\"", ";", "}", "public", "static", "String", "installOtherROM", "(", "String", "theFileName", ")", "{", "RebootList", "(", "theFileName", ")", ";", "return", "\"\"", ";", "}", "@", "Override", "protected", "void", "onActivityResult", "(", "int", "requestCode", ",", "int", "resultCode", ",", "Intent", "data", ")", "{", "super", ".", "onActivityResult", "(", "requestCode", ",", "resultCode", ",", "data", ")", ";", "if", "(", "resultCode", "==", "RESULT_OK", ")", "{", "if", "(", "requestCode", "==", "999", "||", "requestCode", "==", "1000", "||", "requestCode", "==", "1001", ")", "{", "if", "(", "data", "!=", "null", ")", "{", "try", "{", "Uri", "fileUri", "=", "data", ".", "getData", "(", ")", ";", "if", "(", "fileUri", "!=", "null", "&&", "!", "fileUri", ".", "toString", "(", ")", ".", "equals", "(", "\"\"", ")", ")", "{", "String", "filePath", "=", "fileUri", ".", "getPath", "(", ")", ";", "if", "(", "filePath", "!=", "null", ")", "{", "Intent", "checkDownloadedMD5", "=", "new", "Intent", "(", ")", ";", "try", "{", "if", "(", "requestCode", "==", "999", ")", "{", "checkDownloadedMD5", ".", "setAction", "(", "com", ".", "Backside", ".", "BacksideUpdater", ".", "BacksideUpdaterActivity", ".", "checkMD5", "(", "filePath", ",", "true", ")", ")", ";", "}", "else", "if", "(", "requestCode", "==", "1000", ")", "{", "buttonTextView", ".", "setVisibility", "(", "4", ")", ";", "checkDownloadedMD5", ".", "setAction", "(", "com", ".", "Backside", ".", "BacksideUpdater", ".", "BacksideUpdaterActivity", ".", "installRecovery", "(", "filePath", ")", ")", ";", "}", "else", "if", "(", "requestCode", "==", "1001", ")", "{", "buttonTextView", ".", "setVisibility", "(", "4", ")", ";", "checkDownloadedMD5", ".", "setAction", "(", "com", ".", "Backside", ".", "BacksideUpdater", ".", "BacksideUpdaterActivity", ".", "installOtherROM", "(", "filePath", ")", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "checkDownloadedMD5", ".", "setAction", "(", "com", ".", "Backside", ".", "BacksideUpdater", ".", "BacksideUpdaterActivity", ".", "badFilePath", "(", "0", ")", ")", ";", "}", "sendBroadcast", "(", "checkDownloadedMD5", ")", ";", "}", "}", "}", "catch", "(", "Exception", "e", ")", "{", "textView", ".", "setText", "(", "\"Error:nn\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "else", "{", "badFilePath", "(", "0", ")", ";", "}", "}", "}", "}", "}", "</s>" ]
829
[ "<s>", "package", "com", ";", "import", "java", ".", "text", ".", "ParseException", ";", "import", "java", ".", "util", ".", "Calendar", ";", "import", "java", ".", "util", ".", "Date", ";", "public", "class", "CompareDate", "{", "public", "static", "String", "compareYMD", "(", "Date", "src", ",", "Date", "dst", ")", "{", "Calendar", "srcCal", "=", "Calendar", ".", "getInstance", "(", ")", ";", "srcCal", ".", "setTime", "(", "src", ")", ";", "Calendar", "dstCal", "=", "Calendar", ".", "getInstance", "(", ")", ";", "dstCal", ".", "setTime", "(", "dst", ")", ";", "int", "year", "=", "dstCal", ".", "get", "(", "Calendar", ".", "YEAR", ")", "-", "srcCal", ".", "get", "(", "Calendar", ".", "YEAR", ")", ";", "int", "month", "=", "dstCal", ".", "get", "(", "Calendar", ".", "MONTH", ")", "-", "srcCal", ".", "get", "(", "Calendar", ".", "MONTH", ")", ";", "int", "day", "=", "dstCal", ".", "get", "(", "Calendar", ".", "DAY_OF_MONTH", ")", "-", "srcCal", ".", "get", "(", "Calendar", ".", "DAY_OF_MONTH", ")", ";", "year", "=", "year", "-", "(", "(", "month", ">", "0", ")", "?", "0", ":", "(", "(", "month", "<", "0", ")", "?", "1", ":", "(", "(", "day", ">=", "0", "?", "0", ":", "1", ")", ")", ")", ")", ";", "month", "=", "(", "month", "<=", "0", ")", "?", "(", "day", ">", "0", "?", "12", "+", "month", ":", "12", "+", "month", "-", "1", ")", ":", "(", "day", ">=", "0", "?", "month", ":", "month", "-", "1", ")", ";", "dstCal", ".", "add", "(", "Calendar", ".", "MONTH", ",", "-", "1", ")", ";", "day", "=", "(", "day", "<=", "0", ")", "?", "(", "perMonthDays", "(", "dstCal", ")", ")", "+", "day", ":", "day", ";", "String", "ages", "=", "year", "+", "\"\"", "+", "month", "+", "\"\"", "+", "day", "+", "\"\"", ";", "return", "ages", ";", "}", "public", "static", "int", "perMonthDays", "(", "Calendar", "cal", ")", "{", "int", "maxDays", "=", "0", ";", "int", "month", "=", "cal", ".", "get", "(", "Calendar", ".", "MONTH", ")", ";", "switch", "(", "month", ")", "{", "case", "Calendar", ".", "JANUARY", ":", "case", "Calendar", ".", "MARCH", ":", "case", "Calendar", ".", "MAY", ":", "case", "Calendar", ".", "JULY", ":", "case", "Calendar", ".", "AUGUST", ":", "case", "Calendar", ".", "OCTOBER", ":", "case", "Calendar", ".", "DECEMBER", ":", "maxDays", "=", "31", ";", "break", ";", "case", "Calendar", ".", "APRIL", ":", "case", "Calendar", ".", "JUNE", ":", "case", "Calendar", ".", "SEPTEMBER", ":", "case", "Calendar", ".", "NOVEMBER", ":", "maxDays", "=", "30", ";", "break", ";", "case", "Calendar", ".", "FEBRUARY", ":", "if", "(", "isLeap", "(", "cal", ".", "get", "(", "Calendar", ".", "YEAR", ")", ")", ")", "{", "maxDays", "=", "29", ";", "}", "else", "{", "maxDays", "=", "28", ";", "}", "break", ";", "}", "return", "maxDays", ";", "}", "public", "static", "boolean", "isLeap", "(", "int", "year", ")", "{", "boolean", "leap", "=", "false", ";", "if", "(", "(", "year", "%", "4", "==", "0", "&&", "year", "%", "100", "!=", "0", ")", "||", "(", "year", "%", "400", "==", "0", ")", ")", "{", "leap", "=", "true", ";", "}", "return", "leap", ";", "}", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "ParseException", "{", "Date", "now", "=", "new", "Date", "(", ")", ";", "Date", "birthdy", "=", "new", "Date", "(", "2012", "-", "1900", ",", "2", "-", "1", ",", "18", ",", "8", ",", "14", ")", ";", "String", "ages", "=", "compareYMD", "(", "birthdy", ",", "now", ")", ";", "System", ".", "out", ".", "println", "(", "ages", ")", ";", "}", "}", "</s>" ]
830
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ";", "import", "bsh", ".", "EvalError", ";", "import", "bsh", ".", "Interpreter", ";", "import", "bsh", ".", "util", ".", "NameCompletionTable", ";", "import", "java", ".", "awt", ".", "Color", ";", "import", "java", ".", "awt", ".", "Font", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileNotFoundException", ";", "import", "java", ".", "io", ".", "FileReader", ";", "import", "java", ".", "io", ".", "Reader", ";", "import", "javax", ".", "swing", ".", "JOptionPane", ";", "import", "javax", ".", "swing", ".", "tree", ".", "DefaultMutableTreeNode", ";", "import", "javax", ".", "swing", ".", "tree", ".", "DefaultTreeModel", ";", "public", "class", "MinecraftProxyFrame", "extends", "javax", ".", "swing", ".", "JFrame", "{", "private", "static", "final", "long", "serialVersionUID", "=", "242573591431681904L", ";", "private", "MinecraftProxyServerClient", "client", ";", "private", "DefaultTreeModel", "statsTreeModel", ";", "private", "DefaultMutableTreeNode", "statsRoot", ";", "private", "Font", "consoleFont", "=", "new", "Font", "(", "\"Courier", "New\"", ",", "Font", ".", "PLAIN", ",", "11", ")", ";", "private", "Interpreter", "interpreter", ";", "public", "MinecraftProxyFrame", "(", "MinecraftProxyServerClient", "client", ")", "{", "this", ".", "client", "=", "client", ";", "initStatsTree", "(", ")", ";", "initComponents", "(", ")", ";", "console", ".", "setFont", "(", "consoleFont", ")", ";", "logDisplay", ".", "setFont", "(", "consoleFont", ")", ";", "setDefaultCloseOperation", "(", "DISPOSE_ON_CLOSE", ")", ";", "statsTree", ".", "expandRow", "(", "0", ")", ";", "initConsole", "(", ")", ";", "}", "private", "void", "initStatsTree", "(", ")", "{", "statsRoot", "=", "new", "DefaultMutableTreeNode", "(", "\"Statistics\"", ")", ";", "statsTreeModel", "=", "new", "DefaultTreeModel", "(", "statsRoot", ")", ";", "DefaultMutableTreeNode", "node", "=", "new", "DefaultMutableTreeNode", "(", "\"Address:", "\"", "+", "client", ".", "getLoggerId", "(", ")", ")", ";", "statsRoot", ".", "add", "(", "node", ")", ";", "}", "private", "void", "initConsole", "(", ")", "{", "interpreter", "=", "new", "Interpreter", "(", "console", ")", ";", "NameCompletionTable", "nct", "=", "new", "NameCompletionTable", "(", ")", ";", "nct", ".", "add", "(", "interpreter", ".", "getNameSpace", "(", ")", ")", ";", "console", ".", "setNameCompletion", "(", "nct", ")", ";", "new", "Thread", "(", "interpreter", ")", ".", "start", "(", ")", ";", "try", "{", "interpreter", ".", "set", "(", "\"client\"", ",", "client", ")", ";", "}", "catch", "(", "EvalError", "e", ")", "{", "log", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}", "try", "{", "interpreter", ".", "eval", "(", "\"\"", ")", ";", "interpreter", ".", "eval", "(", "\"\"", ")", ";", "interpreter", ".", "eval", "(", "\"\"", ")", ";", "}", "catch", "(", "EvalError", "ex", ")", "{", "}", "}", "public", "void", "log", "(", "String", "text", ")", "{", "logDisplay", ".", "append", "(", "text", "+", "\"rn\"", ")", ";", "logDisplay", ".", "setCaretPosition", "(", "logDisplay", ".", "getText", "(", ")", ".", "length", "(", ")", "-", "1", ")", ";", "}", "public", "void", "handleEndedConnection", "(", ")", "{", "miClose", ".", "setEnabled", "(", "false", ")", ";", "}", "public", "void", "addStatistic", "(", "String", "label", ",", "String", "text", ")", "{", "DefaultMutableTreeNode", "seedNode", "=", "new", "DefaultMutableTreeNode", "(", "label", "+", "\":", "\"", "+", "text", ")", ";", "statsTreeModel", ".", "insertNodeInto", "(", "seedNode", ",", "statsRoot", ",", "statsRoot", ".", "getChildCount", "(", ")", ")", ";", "}", "private", "void", "initComponents", "(", ")", "{", "jSplitPane1", "=", "new", "javax", ".", "swing", ".", "JSplitPane", "(", ")", ";", "jScrollPane1", "=", "new", "javax", ".", "swing", ".", "JScrollPane", "(", ")", ";", "logDisplay", "=", "new", "javax", ".", "swing", ".", "JTextArea", "(", ")", ";", "jTabbedPane1", "=", "new", "javax", ".", "swing", ".", "JTabbedPane", "(", ")", ";", "console", "=", "new", "bsh", ".", "util", ".", "JConsole", "(", ")", ";", "jScrollPane2", "=", "new", "javax", ".", "swing", ".", "JScrollPane", "(", ")", ";", "statsTree", "=", "new", "javax", ".", "swing", ".", "JTree", "(", ")", ";", "jMenuBar1", "=", "new", "javax", ".", "swing", ".", "JMenuBar", "(", ")", ";", "jMenu1", "=", "new", "javax", ".", "swing", ".", "JMenu", "(", ")", ";", "miClose", "=", "new", "javax", ".", "swing", ".", "JMenuItem", "(", ")", ";", "jMenu2", "=", "new", "javax", ".", "swing", ".", "JMenu", "(", ")", ";", "miEvalBSH", "=", "new", "javax", ".", "swing", ".", "JMenuItem", "(", ")", ";", "setDefaultCloseOperation", "(", "javax", ".", "swing", ".", "WindowConstants", ".", "EXIT_ON_CLOSE", ")", ";", "jSplitPane1", ".", "setDividerLocation", "(", "300", ")", ";", "jSplitPane1", ".", "setDividerSize", "(", "2", ")", ";", "jSplitPane1", ".", "setOrientation", "(", "javax", ".", "swing", ".", "JSplitPane", ".", "VERTICAL_SPLIT", ")", ";", "logDisplay", ".", "setColumns", "(", "20", ")", ";", "logDisplay", ".", "setEditable", "(", "false", ")", ";", "logDisplay", ".", "setFont", "(", "new", "java", ".", "awt", ".", "Font", "(", "\"Monospaced\"", ",", "0", ",", "11", ")", ")", ";", "logDisplay", ".", "setRows", "(", "5", ")", ";", "logDisplay", ".", "setTabSize", "(", "4", ")", ";", "jScrollPane1", ".", "setViewportView", "(", "logDisplay", ")", ";", "jSplitPane1", ".", "setBottomComponent", "(", "jScrollPane1", ")", ";", "console", ".", "setWaitFeedback", "(", "true", ")", ";", "jTabbedPane1", ".", "addTab", "(", "\"Console\"", ",", "console", ")", ";", "statsTree", ".", "setModel", "(", "statsTreeModel", ")", ";", "statsTree", ".", "setShowsRootHandles", "(", "true", ")", ";", "jScrollPane2", ".", "setViewportView", "(", "statsTree", ")", ";", "jTabbedPane1", ".", "addTab", "(", "\"Statistics\"", ",", "jScrollPane2", ")", ";", "jSplitPane1", ".", "setLeftComponent", "(", "jTabbedPane1", ")", ";", "jMenu1", ".", "setText", "(", "\"Connection\"", ")", ";", "miClose", ".", "setAccelerator", "(", "javax", ".", "swing", ".", "KeyStroke", ".", "getKeyStroke", "(", "java", ".", "awt", ".", "event", ".", "KeyEvent", ".", "VK_C", ",", "java", ".", "awt", ".", "event", ".", "InputEvent", ".", "CTRL_MASK", ")", ")", ";", "miClose", ".", "setText", "(", "\"Close\"", ")", ";", "miClose", ".", "addActionListener", "(", "new", "java", ".", "awt", ".", "event", ".", "ActionListener", "(", ")", "{", "public", "void", "actionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "miCloseActionPerformed", "(", "evt", ")", ";", "}", "}", ")", ";", "jMenu1", ".", "add", "(", "miClose", ")", ";", "jMenuBar1", ".", "add", "(", "jMenu1", ")", ";", "jMenu2", ".", "setText", "(", "\"Scripting\"", ")", ";", "miEvalBSH", ".", "setAccelerator", "(", "javax", ".", "swing", ".", "KeyStroke", ".", "getKeyStroke", "(", "java", ".", "awt", ".", "event", ".", "KeyEvent", ".", "VK_B", ",", "java", ".", "awt", ".", "event", ".", "InputEvent", ".", "CTRL_MASK", ")", ")", ";", "miEvalBSH", ".", "setText", "(", "\"\"", ")", ";", "miEvalBSH", ".", "addActionListener", "(", "new", "java", ".", "awt", ".", "event", ".", "ActionListener", "(", ")", "{", "public", "void", "actionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "miEvalBSHActionPerformed", "(", "evt", ")", ";", "}", "}", ")", ";", "jMenu2", ".", "add", "(", "miEvalBSH", ")", ";", "jMenuBar1", ".", "add", "(", "jMenu2", ")", ";", "setJMenuBar", "(", "jMenuBar1", ")", ";", "javax", ".", "swing", ".", "GroupLayout", "layout", "=", "new", "javax", ".", "swing", ".", "GroupLayout", "(", "getContentPane", "(", ")", ")", ";", "getContentPane", "(", ")", ".", "setLayout", "(", "layout", ")", ";", "layout", ".", "setHorizontalGroup", "(", "layout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addComponent", "(", "jSplitPane1", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "TRAILING", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "600", ",", "Short", ".", "MAX_VALUE", ")", ")", ";", "layout", ".", "setVerticalGroup", "(", "layout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addComponent", "(", "jSplitPane1", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "480", ",", "Short", ".", "MAX_VALUE", ")", ")", ";", "pack", "(", ")", ";", "}", "private", "void", "miCloseActionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "client", ".", "stop", "(", ")", ";", "}", "private", "void", "miEvalBSHActionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "String", "script", "=", "(", "String", ")", "JOptionPane", ".", "showInputDialog", "(", "this", ",", "\"\"", ",", "\"\"", ",", "JOptionPane", ".", "PLAIN_MESSAGE", ")", ";", "if", "(", "script", "!=", "null", "&&", "script", ".", "length", "(", ")", "!=", "0", ")", "{", "try", "{", "File", "f", "=", "new", "File", "(", "\"scripts\"", ",", "script", ")", ";", "Reader", "reader", ";", "try", "{", "reader", "=", "new", "FileReader", "(", "f", ")", ";", "}", "catch", "(", "FileNotFoundException", "e", ")", "{", "f", "=", "new", "File", "(", "\"scripts\"", ",", "script", "+", "\".bsh\"", ")", ";", "reader", "=", "new", "FileReader", "(", "f", ")", ";", "}", "console", ".", "println", "(", ")", ";", "console", ".", "print", "(", "\"Evaluating", "\"", "+", "f", ".", "getAbsoluteFile", "(", ")", "+", "\"...\"", ",", "Color", ".", "BLUE", ")", ";", "interpreter", ".", "eval", "(", "reader", ")", ";", "}", "catch", "(", "EvalError", "e", ")", "{", "console", ".", "println", "(", ")", ";", "console", ".", "print", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ",", "Color", ".", "RED", ")", ";", "}", "catch", "(", "FileNotFoundException", "e", ")", "{", "console", ".", "println", "(", ")", ";", "console", ".", "print", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ",", "Color", ".", "RED", ")", ";", "}", "}", "}", "private", "bsh", ".", "util", ".", "JConsole", "console", ";", "private", "javax", ".", "swing", ".", "JMenu", "jMenu1", ";", "private", "javax", ".", "swing", ".", "JMenu", "jMenu2", ";", "private", "javax", ".", "swing", ".", "JMenuBar", "jMenuBar1", ";", "private", "javax", ".", "swing", ".", "JScrollPane", "jScrollPane1", ";", "private", "javax", ".", "swing", ".", "JScrollPane", "jScrollPane2", ";", "private", "javax", ".", "swing", ".", "JSplitPane", "jSplitPane1", ";", "private", "javax", ".", "swing", ".", "JTabbedPane", "jTabbedPane1", ";", "private", "javax", ".", "swing", ".", "JTextArea", "logDisplay", ";", "private", "javax", ".", "swing", ".", "JMenuItem", "miClose", ";", "private", "javax", ".", "swing", ".", "JMenuItem", "miEvalBSH", ";", "private", "javax", ".", "swing", ".", "JTree", "statsTree", ";", "}", "</s>" ]
831
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ";", "import", "java", ".", "text", ".", "SimpleDateFormat", ";", "import", "java", ".", "util", ".", "Date", ";", "import", "java", ".", "util", ".", "logging", ".", "*", ";", "public", "class", "SimpleLoggerFormatter", "extends", "Formatter", "{", "private", "SimpleDateFormat", "dateFormatter", "=", "new", "SimpleDateFormat", "(", "\"\"", ")", ";", "@", "Override", "public", "String", "format", "(", "LogRecord", "rec", ")", "{", "StringBuilder", "buffer", "=", "new", "StringBuilder", "(", ")", ";", "buffer", ".", "append", "(", "dateFormatter", ".", "format", "(", "new", "Date", "(", ")", ")", ")", ";", "buffer", ".", "append", "(", "\"", "[\"", ")", ";", "buffer", ".", "append", "(", "rec", ".", "getLevel", "(", ")", ".", "getName", "(", ")", ")", ";", "buffer", ".", "append", "(", "\"]", "\"", ")", ";", "buffer", ".", "append", "(", "rec", ".", "getMessage", "(", ")", ")", ";", "buffer", ".", "append", "(", "\"rn\"", ")", ";", "Throwable", "throwable", "=", "rec", ".", "getThrown", "(", ")", ";", "if", "(", "throwable", "!=", "null", ")", "{", "buffer", ".", "append", "(", "throwable", ".", "toString", "(", ")", ")", ";", "buffer", ".", "append", "(", "\"rn\"", ")", ";", "for", "(", "StackTraceElement", "element", ":", "throwable", ".", "getStackTrace", "(", ")", ")", "{", "buffer", ".", "append", "(", "\"t\"", ")", ";", "buffer", ".", "append", "(", "element", ")", ";", "buffer", ".", "append", "(", "\"rn\"", ")", ";", "}", "}", "return", "buffer", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
832
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "EOFException", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "net", ".", "InetAddress", ";", "import", "java", ".", "net", ".", "Socket", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ".", "Packet", ";", "import", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ".", "PacketManager", ";", "import", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ".", "PacketManager", ".", "UnknownPacketException", ";", "class", "MinecraftClientConnection", "implements", "Runnable", "{", "private", "MinecraftProxyServerClient", "parent", ";", "private", "InetAddress", "host", ";", "private", "int", "port", ";", "private", "boolean", "running", "=", "true", ";", "private", "Socket", "sock", ";", "private", "DataOutputStream", "out", ";", "private", "DataInputStream", "in", ";", "private", "MinecraftProxyServerClient", "that", ";", "private", "static", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "MinecraftProxyServerClient", ".", "class", ".", "getName", "(", ")", ")", ";", "public", "MinecraftClientConnection", "(", "MinecraftProxyServerClient", "parent", ",", "InetAddress", "host", ",", "int", "port", ",", "MinecraftProxyServerClient", "minecraftProxyServerClient", ")", "{", "this", ".", "parent", "=", "parent", ";", "this", ".", "host", "=", "host", ";", "this", ".", "port", "=", "port", ";", "this", ".", "that", "=", "minecraftProxyServerClient", ";", "}", "public", "String", "getLoggerId", "(", ")", "{", "return", "sock", ".", "getInetAddress", "(", ")", ".", "getHostAddress", "(", ")", "+", "\":\"", "+", "sock", ".", "getPort", "(", ")", ";", "}", "protected", "void", "log", "(", "Level", "level", ",", "final", "String", "msg", ")", "{", "logger", ".", "log", "(", "level", ",", "\"(\"", "+", "getLoggerId", "(", ")", "+", "\")", "\"", "+", "msg", ")", ";", "}", "protected", "void", "log", "(", "Level", "level", ",", "final", "String", "msg", ",", "Throwable", "t", ")", "{", "logger", ".", "log", "(", "level", ",", "\"(\"", "+", "getLoggerId", "(", ")", "+", "\")", "\"", "+", "msg", ",", "t", ")", ";", "}", "public", "void", "connect", "(", ")", "throws", "IOException", "{", "sock", "=", "new", "Socket", "(", "host", ",", "port", ")", ";", "sock", ".", "setTcpNoDelay", "(", "true", ")", ";", "out", "=", "new", "DataOutputStream", "(", "sock", ".", "getOutputStream", "(", ")", ")", ";", "in", "=", "new", "DataInputStream", "(", "sock", ".", "getInputStream", "(", ")", ")", ";", "}", "public", "void", "run", "(", ")", "{", "try", "{", "while", "(", "running", ")", "{", "byte", "id", "=", "in", ".", "readByte", "(", ")", ";", "Packet", "packet", ";", "try", "{", "if", "(", "!", "(", "PacketManager", ".", "containsID", "(", "id", ")", ")", ")", "{", "Logger", ".", "getLogger", "(", "MinecraftProxyServerClient", ".", "class", ".", "getName", "(", ")", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "\"Packet", "\"", "+", "id", "+", "\"\"", ")", ";", "continue", ";", "}", "packet", "=", "PacketManager", ".", "read", "(", "id", ",", "in", ")", ";", "packet", ".", "toServer", "=", "false", ";", "String", "name", "=", "packet", ".", "toString", "(", ")", ";", "that", ".", "log", "(", "Level", ".", "INFO", ",", "\"\"", "+", "name", ")", ";", "}", "catch", "(", "UnknownPacketException", "ex", ")", "{", "Logger", ".", "getLogger", "(", "MinecraftProxyServerClient", ".", "class", ".", "getName", "(", ")", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "null", ",", "ex", ")", ";", "sock", ".", "close", "(", ")", ";", "break", ";", "}", "parent", ".", "handleIncoming", "(", "packet", ")", ";", "}", "}", "catch", "(", "EOFException", "e", ")", "{", "}", "catch", "(", "IOException", "e", ")", "{", "}", "}", "public", "void", "send", "(", "Packet", "packet", ")", "throws", "IOException", "{", "out", ".", "write", "(", "packet", ".", "getId", "(", ")", ")", ";", "packet", ".", "write", "(", "out", ")", ";", "out", ".", "flush", "(", ")", ";", "}", "public", "void", "stop", "(", ")", "{", "running", "=", "false", ";", "try", "{", "sock", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "}", "}", "}", "</s>" ]
833
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "util", ";", "public", "class", "ItemStack", "{", "private", "int", "id", ";", "private", "int", "count", ";", "private", "int", "data", ";", "public", "ItemStack", "(", "int", "id", ",", "int", "count", ",", "int", "data", ")", "{", "this", ".", "id", "=", "id", ";", "this", ".", "count", "=", "count", ";", "this", ".", "data", "=", "data", ";", "}", "public", "int", "getId", "(", ")", "{", "return", "id", ";", "}", "public", "void", "setId", "(", "int", "id", ")", "{", "this", ".", "id", "=", "id", ";", "}", "public", "int", "getCount", "(", ")", "{", "return", "count", ";", "}", "public", "void", "setCount", "(", "int", "count", ")", "{", "this", ".", "count", "=", "count", ";", "}", "public", "int", "getDamage", "(", ")", "{", "return", "data", ";", "}", "public", "void", "setData", "(", "int", "data", ")", "{", "this", ".", "data", "=", "data", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"ID:", "\"", "+", "id", "+", "\"", "Count:", "\"", "+", "count", "+", "\"", "Data:", "\"", "+", "data", ";", "}", "}", "</s>" ]
834
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "util", ";", "public", "class", "BlockPosition", "{", "private", "int", "x", ";", "private", "int", "y", ";", "private", "int", "z", ";", "public", "BlockPosition", "(", "int", "x", ",", "int", "y", ",", "int", "z", ")", "{", "this", ".", "x", "=", "x", ";", "this", ".", "y", "=", "y", ";", "this", ".", "z", "=", "z", ";", "}", "public", "int", "getX", "(", ")", "{", "return", "x", ";", "}", "public", "void", "setX", "(", "int", "x", ")", "{", "this", ".", "x", "=", "x", ";", "}", "public", "int", "getY", "(", ")", "{", "return", "y", ";", "}", "public", "void", "setY", "(", "int", "y", ")", "{", "this", ".", "y", "=", "y", ";", "}", "public", "int", "getZ", "(", ")", "{", "return", "z", ";", "}", "public", "void", "setZ", "(", "int", "z", ")", "{", "this", ".", "z", "=", "z", ";", "}", "}", "</s>" ]
835
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ";", "import", "java", ".", "io", ".", "*", ";", "import", "java", ".", "net", ".", "*", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "javax", ".", "swing", ".", "SwingUtilities", ";", "import", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ".", "Packet1Login", ";", "import", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ".", "Packet", ";", "import", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ".", "PacketManager", ";", "import", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ".", "PacketManager", ".", "UnknownPacketException", ";", "public", "class", "MinecraftProxyServerClient", "implements", "Runnable", "{", "public", "final", "Object", "outgoingLock", "=", "new", "Object", "(", ")", ";", "public", "final", "Object", "incomingLock", "=", "new", "Object", "(", ")", ";", "private", "static", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "MinecraftProxyServerClient", ".", "class", ".", "getName", "(", ")", ")", ";", "private", "boolean", "running", "=", "true", ";", "private", "MinecraftProxyFrame", "frame", ";", "private", "MinecraftProxyServer", "server", ";", "private", "Socket", "sock", ";", "private", "DataOutputStream", "out", ";", "private", "DataInputStream", "in", ";", "private", "MinecraftClientConnection", "client", ";", "public", "MinecraftProxyServerClient", "(", "MinecraftProxyServer", "server", ",", "Socket", "sock", ")", "throws", "IOException", "{", "this", ".", "server", "=", "server", ";", "this", ".", "sock", "=", "sock", ";", "out", "=", "new", "DataOutputStream", "(", "sock", ".", "getOutputStream", "(", ")", ")", ";", "in", "=", "new", "DataInputStream", "(", "sock", ".", "getInputStream", "(", ")", ")", ";", "}", "public", "MinecraftProxyServer", "getServer", "(", ")", "{", "return", "server", ";", "}", "public", "String", "getLoggerId", "(", ")", "{", "return", "sock", ".", "getInetAddress", "(", ")", ".", "getHostAddress", "(", ")", "+", "\":\"", "+", "sock", ".", "getPort", "(", ")", ";", "}", "protected", "void", "log", "(", "Level", "level", ",", "final", "String", "msg", ")", "{", "logger", ".", "log", "(", "level", ",", "\"(\"", "+", "getLoggerId", "(", ")", "+", "\")", "\"", "+", "msg", ")", ";", "SwingUtilities", ".", "invokeLater", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "frame", ".", "log", "(", "msg", ")", ";", "}", "}", ")", ";", "}", "protected", "void", "log", "(", "Level", "level", ",", "final", "String", "msg", ",", "Throwable", "t", ")", "{", "logger", ".", "log", "(", "level", ",", "\"(\"", "+", "getLoggerId", "(", ")", "+", "\")", "\"", "+", "msg", ",", "t", ")", ";", "SwingUtilities", ".", "invokeLater", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "frame", ".", "log", "(", "msg", ")", ";", "}", "}", ")", ";", "}", "public", "void", "run", "(", ")", "{", "client", "=", "new", "MinecraftClientConnection", "(", "this", ",", "server", ".", "getTargetHost", "(", ")", ",", "server", ".", "getTargetPort", "(", ")", ",", "this", ")", ";", "frame", "=", "new", "MinecraftProxyFrame", "(", "this", ")", ";", "SwingUtilities", ".", "invokeLater", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "frame", ".", "setVisible", "(", "true", ")", ";", "frame", ".", "setTitle", "(", "\"\"", "+", "getLoggerId", "(", ")", ")", ";", "}", "}", ")", ";", "try", "{", "log", "(", "Level", ".", "INFO", ",", "\"\"", "+", "server", ".", "getTargetHost", "(", ")", "+", "\"...\"", ")", ";", "client", ".", "connect", "(", ")", ";", "Thread", "thread", "=", "new", "Thread", "(", "client", ")", ";", "thread", ".", "start", "(", ")", ";", "log", "(", "Level", ".", "INFO", ",", "\"\"", ")", ";", "while", "(", "running", ")", "{", "byte", "id", "=", "in", ".", "readByte", "(", ")", ";", "Packet", "packet", ";", "try", "{", "if", "(", "!", "(", "PacketManager", ".", "containsID", "(", "id", ")", ")", ")", "{", "Logger", ".", "getLogger", "(", "MinecraftProxyServerClient", ".", "class", ".", "getName", "(", ")", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "\"\"", ")", ";", "Logger", ".", "getLogger", "(", "MinecraftProxyServerClient", ".", "class", ".", "getName", "(", ")", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "\"Packet", "\"", "+", "id", "+", "\"\"", ")", ";", "Logger", ".", "getLogger", "(", "MinecraftProxyServerClient", ".", "class", ".", "getName", "(", ")", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "\"\"", ")", ";", "continue", ";", "}", "packet", "=", "PacketManager", ".", "read", "(", "id", ",", "in", ")", ";", "packet", ".", "toServer", "=", "true", ";", "}", "catch", "(", "UnknownPacketException", "ex", ")", "{", "Logger", ".", "getLogger", "(", "MinecraftProxyServerClient", ".", "class", ".", "getName", "(", ")", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "null", ",", "ex", ")", ";", "sock", ".", "close", "(", ")", ";", "break", ";", "}", "String", "name", "=", "packet", ".", "toString", "(", ")", ";", "log", "(", "Level", ".", "INFO", ",", "\"\"", "+", "name", ")", ";", "try", "{", "synchronized", "(", "outgoingLock", ")", "{", "client", ".", "send", "(", "packet", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "sock", ".", "close", "(", ")", ";", "log", "(", "Level", ".", "INFO", ",", "\"\"", ",", "e", ")", ";", "}", "}", "}", "catch", "(", "EOFException", "ex", ")", "{", "}", "catch", "(", "IOException", "ex", ")", "{", "}", "client", ".", "stop", "(", ")", ";", "log", "(", "Level", ".", "INFO", ",", "\"\"", ")", ";", "SwingUtilities", ".", "invokeLater", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "frame", ".", "handleEndedConnection", "(", ")", ";", "}", "}", ")", ";", "}", "public", "void", "send", "(", "Packet", "packet", ")", "throws", "IOException", "{", "synchronized", "(", "outgoingLock", ")", "{", "client", ".", "send", "(", "packet", ")", ";", "}", "}", "public", "void", "receive", "(", "Packet", "packet", ")", "throws", "IOException", "{", "handleIncoming", "(", "packet", ")", ";", "}", "public", "void", "handleIncoming", "(", "Packet", "packet", ")", "throws", "IOException", "{", "if", "(", "packet", "instanceof", "Packet1Login", ")", "{", "final", "Packet1Login", "loginPacket", "=", "(", "Packet1Login", ")", "packet", ";", "SwingUtilities", ".", "invokeLater", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "frame", ".", "addStatistic", "(", "\"World", "seed\"", ",", "String", ".", "valueOf", "(", "loginPacket", ".", "mapSeed", ")", ")", ";", "frame", ".", "addStatistic", "(", "\"\"", ",", "String", ".", "valueOf", "(", "loginPacket", ".", "dimension", ")", ")", ";", "frame", ".", "addStatistic", "(", "\"\"", ",", "String", ".", "valueOf", "(", "loginPacket", ".", "version", ")", ")", ";", "}", "}", ")", ";", "}", "synchronized", "(", "incomingLock", ")", "{", "out", ".", "write", "(", "packet", ".", "getId", "(", ")", ")", ";", "packet", ".", "write", "(", "out", ")", ";", "}", "}", "public", "void", "stop", "(", ")", "{", "running", "=", "false", ";", "try", "{", "sock", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "}", "}", "}", "</s>" ]
836
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet101CloseWindow", "extends", "Packet", "{", "public", "byte", "id", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "id", "=", "stream", ".", "readByte", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeByte", "(", "this", ".", "id", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "1", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "101", ";", "}", "}", "</s>" ]
837
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet102WindowClick", "extends", "Packet", "{", "public", "byte", "id", ";", "public", "short", "slot", ";", "public", "byte", "rightClick", ";", "public", "short", "actionNum", ";", "public", "short", "itemId", ";", "public", "byte", "itemCount", ";", "public", "short", "itemUses", ";", "public", "boolean", "f", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "id", "=", "stream", ".", "readByte", "(", ")", ";", "this", ".", "slot", "=", "stream", ".", "readShort", "(", ")", ";", "this", ".", "rightClick", "=", "stream", ".", "readByte", "(", ")", ";", "this", ".", "actionNum", "=", "stream", ".", "readShort", "(", ")", ";", "this", ".", "f", "=", "stream", ".", "readBoolean", "(", ")", ";", "this", ".", "itemId", "=", "stream", ".", "readShort", "(", ")", ";", "if", "(", "itemId", ">=", "0", ")", "{", "itemCount", "=", "stream", ".", "readByte", "(", ")", ";", "itemUses", "=", "stream", ".", "readShort", "(", ")", ";", "}", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeByte", "(", "this", ".", "id", ")", ";", "stream", ".", "writeShort", "(", "this", ".", "slot", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "rightClick", ")", ";", "stream", ".", "writeShort", "(", "this", ".", "actionNum", ")", ";", "stream", ".", "writeBoolean", "(", "this", ".", "f", ")", ";", "stream", ".", "writeShort", "(", "this", ".", "itemId", ")", ";", "if", "(", "itemId", ">=", "0", ")", "{", "stream", ".", "writeByte", "(", "itemCount", ")", ";", "stream", ".", "writeShort", "(", "itemUses", ")", ";", "}", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "11", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "102", ";", "}", "}", "</s>" ]
838
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet19EntityAction", "extends", "Packet", "{", "public", "int", "eid", ";", "public", "byte", "action", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "eid", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "action", "=", "stream", ".", "readByte", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeInt", "(", "this", ".", "eid", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "action", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "5", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "19", ";", "}", "}", "</s>" ]
839
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "List", ";", "import", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ".", "MetadataParser", ".", "MetadataObject", ";", "public", "class", "Packet40EntityMetadata", "extends", "Packet", "{", "public", "int", "eid", ";", "private", "List", "<", "MetadataObject", ">", "metadata", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "eid", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "metadata", "=", "MetadataParser", ".", "read", "(", "stream", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeInt", "(", "this", ".", "eid", ")", ";", "MetadataParser", ".", "write", "(", "metadata", ",", "stream", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "5", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "40", ";", "}", "}", "</s>" ]
840
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet52MultiBlockChange", "extends", "Packet", "{", "public", "int", "chunkX", ";", "public", "int", "chunkY", ";", "public", "short", "[", "]", "coordinateArray", ";", "public", "byte", "[", "]", "typeArray", ";", "public", "byte", "[", "]", "metadataArray", ";", "public", "int", "arraySize", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "chunkX", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "chunkY", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "arraySize", "=", "stream", ".", "readShort", "(", ")", "&", "'-UNK-'", ";", "this", ".", "coordinateArray", "=", "new", "short", "[", "this", ".", "arraySize", "]", ";", "this", ".", "typeArray", "=", "new", "byte", "[", "this", ".", "arraySize", "]", ";", "this", ".", "metadataArray", "=", "new", "byte", "[", "this", ".", "arraySize", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "arraySize", ";", "++", "i", ")", "{", "this", ".", "coordinateArray", "[", "i", "]", "=", "stream", ".", "readShort", "(", ")", ";", "}", "stream", ".", "readFully", "(", "this", ".", "typeArray", ")", ";", "stream", ".", "readFully", "(", "this", ".", "metadataArray", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeInt", "(", "this", ".", "chunkX", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "chunkY", ")", ";", "stream", ".", "writeShort", "(", "(", "short", ")", "this", ".", "arraySize", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "arraySize", ";", "++", "i", ")", "{", "stream", ".", "writeShort", "(", "this", ".", "coordinateArray", "[", "i", "]", ")", ";", "}", "stream", ".", "write", "(", "this", ".", "typeArray", ")", ";", "stream", ".", "write", "(", "this", ".", "metadataArray", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "10", "+", "this", ".", "arraySize", "*", "4", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "52", ";", "}", "}", "</s>" ]
841
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet130UpdateSign", "extends", "Packet", "{", "public", "int", "x", ";", "public", "short", "y", ";", "public", "int", "z", ";", "public", "String", "[", "]", "lines", ";", "public", "String", "toString", "(", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "result", ".", "append", "(", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\"", "->", "\"", ")", ";", "result", ".", "append", "(", "\"X:", "\"", ")", ";", "result", ".", "append", "(", "x", ")", ";", "result", ".", "append", "(", "\"", "Y:", "\"", ")", ";", "result", ".", "append", "(", "y", ")", ";", "result", ".", "append", "(", "\"", "Z:", "\"", ")", ";", "result", ".", "append", "(", "z", ")", ";", "result", ".", "append", "(", "\"", "Lines:", "\"", ")", ";", "result", ".", "append", "(", "lines", ".", "toString", "(", ")", ")", ";", "return", "result", ".", "toString", "(", ")", ";", "}", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "x", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "y", "=", "stream", ".", "readShort", "(", ")", ";", "this", ".", "z", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "lines", "=", "new", "String", "[", "4", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "4", ";", "++", "i", ")", "{", "this", ".", "lines", "[", "i", "]", "=", "read", "(", "stream", ",", "15", ")", ";", "}", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeInt", "(", "this", ".", "x", ")", ";", "stream", ".", "writeShort", "(", "this", ".", "y", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "z", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "4", ";", "++", "i", ")", "{", "write", "(", "this", ".", "lines", "[", "i", "]", ",", "stream", ")", ";", "}", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "int", "i", "=", "0", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "4", ";", "++", "j", ")", "{", "i", "+=", "this", ".", "lines", "[", "j", "]", ".", "length", "(", ")", ";", "}", "return", "i", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "(", "byte", ")", "130", ";", "}", "}", "</s>" ]
842
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet32EntityLook", "extends", "Packet30Entity", "{", "public", "byte", "dx", ";", "public", "byte", "dy", ";", "public", "byte", "dz", ";", "public", "byte", "yaw", ";", "public", "byte", "pitch", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "super", ".", "read", "(", "stream", ")", ";", "this", ".", "yaw", "=", "stream", ".", "readByte", "(", ")", ";", "this", ".", "pitch", "=", "stream", ".", "readByte", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "super", ".", "write", "(", "stream", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "yaw", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "pitch", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "6", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "32", ";", "}", "}", "</s>" ]
843
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet31RelativeEntityMove", "extends", "Packet30Entity", "{", "public", "byte", "dx", ";", "public", "byte", "dy", ";", "public", "byte", "dz", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "super", ".", "read", "(", "stream", ")", ";", "this", ".", "dx", "=", "stream", ".", "readByte", "(", ")", ";", "this", ".", "dy", "=", "stream", ".", "readByte", "(", ")", ";", "this", ".", "dz", "=", "stream", ".", "readByte", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "super", ".", "write", "(", "stream", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "dx", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "dy", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "dz", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "7", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "31", ";", "}", "}", "</s>" ]
844
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet103SetSlot", "extends", "Packet", "{", "public", "byte", "id", ";", "public", "short", "slot", ";", "public", "short", "itemId", ";", "public", "byte", "itemCount", ";", "public", "short", "itemUses", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "id", "=", "stream", ".", "readByte", "(", ")", ";", "this", ".", "slot", "=", "stream", ".", "readShort", "(", ")", ";", "this", ".", "itemId", "=", "stream", ".", "readShort", "(", ")", ";", "if", "(", "itemId", ">=", "0", ")", "{", "this", ".", "itemCount", "=", "stream", ".", "readByte", "(", ")", ";", "this", ".", "itemUses", "=", "stream", ".", "readShort", "(", ")", ";", "}", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeByte", "(", "this", ".", "id", ")", ";", "stream", ".", "writeShort", "(", "this", ".", "slot", ")", ";", "stream", ".", "writeShort", "(", "this", ".", "itemId", ")", ";", "if", "(", "itemId", ">=", "0", ")", "{", "stream", ".", "writeByte", "(", "this", ".", "itemCount", ")", ";", "stream", ".", "writeShort", "(", "this", ".", "itemUses", ")", ";", "}", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "8", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "103", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "result", ".", "append", "(", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\"", "->", "\"", ")", ";", "result", ".", "append", "(", "\"", "ID:", "\"", ")", ";", "result", ".", "append", "(", "id", ")", ";", "result", ".", "append", "(", "\"", "Slot:", "\"", ")", ";", "result", ".", "append", "(", "slot", ")", ";", "result", ".", "append", "(", "\"", "ItemCount:", "\"", ")", ";", "result", ".", "append", "(", "itemCount", ")", ";", "result", ".", "append", "(", "\"", "ItemID:", "\"", ")", ";", "result", ".", "append", "(", "itemId", ")", ";", "result", ".", "append", "(", "\"", "ItemUses:\"", ")", ";", "result", ".", "append", "(", "itemUses", ")", ";", "return", "result", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
845
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet12PlayerLook", "extends", "Packet10Flying", "{", "public", "float", "yaw", ";", "public", "float", "pitch", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "yaw", "=", "stream", ".", "readFloat", "(", ")", ";", "this", ".", "pitch", "=", "stream", ".", "readFloat", "(", ")", ";", "super", ".", "read", "(", "stream", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeFloat", "(", "this", ".", "yaw", ")", ";", "stream", ".", "writeFloat", "(", "this", ".", "pitch", ")", ";", "super", ".", "write", "(", "stream", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "9", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "12", ";", "}", "}", "</s>" ]
846
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "com", ".", "sk89q", ".", "minerhat", ".", "util", ".", "ItemStack", ";", "public", "class", "Packet21PickupSpawn", "extends", "Packet", "{", "public", "int", "eid", ";", "public", "int", "x", ";", "public", "int", "y", ";", "public", "int", "z", ";", "public", "byte", "rotation", ";", "public", "byte", "pitch", ";", "public", "byte", "roll", ";", "public", "ItemStack", "item", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "eid", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "item", "=", "new", "ItemStack", "(", "stream", ".", "readShort", "(", ")", ",", "stream", ".", "readByte", "(", ")", ",", "stream", ".", "readShort", "(", ")", ")", ";", "this", ".", "x", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "y", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "z", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "rotation", "=", "stream", ".", "readByte", "(", ")", ";", "this", ".", "pitch", "=", "stream", ".", "readByte", "(", ")", ";", "this", ".", "roll", "=", "stream", ".", "readByte", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeInt", "(", "this", ".", "eid", ")", ";", "stream", ".", "writeShort", "(", "this", ".", "item", ".", "getId", "(", ")", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "item", ".", "getCount", "(", ")", ")", ";", "stream", ".", "writeShort", "(", "this", ".", "item", ".", "getDamage", "(", ")", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "x", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "y", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "z", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "rotation", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "pitch", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "roll", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "24", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "21", ";", "}", "}", "</s>" ]
847
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet2Handshake", "extends", "Packet", "{", "public", "String", "username", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "username", "=", "read", "(", "stream", ",", "32", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "write", "(", "this", ".", "username", ",", "stream", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "4", "+", "this", ".", "username", ".", "length", "(", ")", "+", "4", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "2", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "result", ".", "append", "(", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\"", "->", "\"", ")", ";", "result", ".", "append", "(", "\"String:", "\"", ")", ";", "result", ".", "append", "(", "username", ")", ";", "return", "result", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
848
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet70Bed", "extends", "Packet", "{", "public", "int", "b", ";", "public", "Packet70Bed", "(", ")", "{", "}", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "b", "=", "stream", ".", "readByte", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeByte", "(", "this", ".", "b", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "1", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "70", ";", "}", "}", "</s>" ]
849
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet18ArmAnimation", "extends", "Packet", "{", "public", "int", "eid", ";", "public", "int", "animation", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "eid", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "animation", "=", "stream", ".", "readByte", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeInt", "(", "this", ".", "eid", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "animation", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "5", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "18", ";", "}", "}", "</s>" ]
850
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet61DoorChange", "extends", "Packet", "{", "public", "int", "a", ";", "public", "int", "b", ";", "public", "int", "c", ";", "public", "int", "d", ";", "public", "int", "e", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "a", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "c", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "d", "=", "stream", ".", "readByte", "(", ")", ";", "this", ".", "e", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "b", "=", "stream", ".", "readInt", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeInt", "(", "this", ".", "a", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "c", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "d", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "e", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "b", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "20", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "61", ";", "}", "}", "</s>" ]
851
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet9Respawn", "extends", "Packet", "{", "public", "byte", "dimension", ";", "public", "Packet9Respawn", "(", ")", "{", "}", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "dimension", "=", "stream", ".", "readByte", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeByte", "(", "this", ".", "dimension", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "1", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "9", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "result", ".", "append", "(", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\"", "->", "\"", ")", ";", "result", ".", "append", "(", "\"", "Dimension:", "\"", ")", ";", "result", ".", "append", "(", "dimension", ")", ";", "return", "result", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
852
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet38EntityStatus", "extends", "Packet", "{", "public", "int", "eid", ";", "public", "byte", "status", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "eid", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "status", "=", "stream", ".", "readByte", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeInt", "(", "this", ".", "eid", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "status", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "5", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "38", ";", "}", "}", "</s>" ]
853
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet7UseEntity", "extends", "Packet", "{", "public", "int", "user", ";", "public", "int", "target", ";", "public", "byte", "leftClick", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "user", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "target", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "leftClick", "=", "stream", ".", "readByte", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeInt", "(", "this", ".", "user", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "target", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "leftClick", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "9", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "7", ";", "}", "}", "</s>" ]
854
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet51MapChunk", "extends", "Packet", "{", "public", "int", "x", ";", "public", "int", "y", ";", "public", "int", "z", ";", "public", "int", "sizeX", ";", "public", "int", "sizeY", ";", "public", "int", "sizeZ", ";", "public", "byte", "[", "]", "rawData", ";", "private", "int", "compressedSize", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "x", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "y", "=", "stream", ".", "readShort", "(", ")", ";", "this", ".", "z", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "sizeX", "=", "stream", ".", "read", "(", ")", "+", "1", ";", "this", ".", "sizeY", "=", "stream", ".", "read", "(", ")", "+", "1", ";", "this", ".", "sizeZ", "=", "stream", ".", "read", "(", ")", "+", "1", ";", "this", ".", "compressedSize", "=", "stream", ".", "readInt", "(", ")", ";", "rawData", "=", "new", "byte", "[", "this", ".", "compressedSize", "]", ";", "stream", ".", "readFully", "(", "rawData", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeInt", "(", "this", ".", "x", ")", ";", "stream", ".", "writeShort", "(", "this", ".", "y", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "z", ")", ";", "stream", ".", "write", "(", "this", ".", "sizeX", "-", "1", ")", ";", "stream", ".", "write", "(", "this", ".", "sizeY", "-", "1", ")", ";", "stream", ".", "write", "(", "this", ".", "sizeZ", "-", "1", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "compressedSize", ")", ";", "stream", ".", "write", "(", "this", ".", "rawData", ",", "0", ",", "this", ".", "compressedSize", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "17", "+", "this", ".", "compressedSize", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "51", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "result", ".", "append", "(", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\"", "->", "\"", ")", ";", "result", ".", "append", "(", "\"X:", "\"", ")", ";", "result", ".", "append", "(", "x", ")", ";", "result", ".", "append", "(", "\"", "Y:", "\"", ")", ";", "result", ".", "append", "(", "y", ")", ";", "result", ".", "append", "(", "\"", "Z:", "\"", ")", ";", "result", ".", "append", "(", "z", ")", ";", "result", ".", "append", "(", "\"", "SizeX:", "\"", ")", ";", "result", ".", "append", "(", "sizeX", ")", ";", "result", ".", "append", "(", "\"", "SizeY:", "\"", ")", ";", "result", ".", "append", "(", "sizeY", ")", ";", "result", ".", "append", "(", "\"", "SizeZ:", "\"", ")", ";", "result", ".", "append", "(", "sizeZ", ")", ";", "return", "result", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
855
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet17UseBed", "extends", "Packet", "{", "public", "int", "id", ";", "public", "byte", "inBed", ";", "public", "int", "x", ";", "public", "byte", "y", ";", "public", "int", "z", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "id", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "inBed", "=", "stream", ".", "readByte", "(", ")", ";", "this", ".", "x", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "y", "=", "stream", ".", "readByte", "(", ")", ";", "this", ".", "z", "=", "stream", ".", "readInt", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeInt", "(", "this", ".", "id", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "inBed", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "x", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "y", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "z", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "14", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "17", ";", "}", "}", "</s>" ]
856
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet22Collect", "extends", "Packet", "{", "public", "int", "collectedEID", ";", "public", "int", "collectorEID", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "collectedEID", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "collectorEID", "=", "stream", ".", "readInt", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeInt", "(", "this", ".", "collectedEID", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "collectorEID", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "8", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "22", ";", "}", "}", "</s>" ]
857
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "public", "class", "Packet0KeepAlive", "extends", "Packet", "{", "public", "Packet0KeepAlive", "(", ")", "{", "}", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "{", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "{", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "0", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "0", ";", "}", "}", "</s>" ]
858
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet106Transaction", "extends", "Packet", "{", "public", "int", "id", ";", "public", "short", "action", ";", "public", "boolean", "accepted", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "id", "=", "stream", ".", "readByte", "(", ")", ";", "this", ".", "action", "=", "stream", ".", "readShort", "(", ")", ";", "this", ".", "accepted", "=", "stream", ".", "readByte", "(", ")", "!=", "0", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeByte", "(", "this", ".", "id", ")", ";", "stream", ".", "writeShort", "(", "this", ".", "action", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "accepted", "?", "1", ":", "0", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "4", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "106", ";", "}", "}", "</s>" ]
859
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "com", ".", "sk89q", ".", "minerhat", ".", "util", ".", "BlockPosition", ";", "import", "com", ".", "sk89q", ".", "minerhat", ".", "util", ".", "ItemStack", ";", "public", "class", "MetadataParser", "{", "public", "static", "List", "<", "MetadataObject", ">", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "ArrayList", "<", "MetadataObject", ">", "data", "=", "null", ";", "for", "(", "byte", "id", "=", "stream", ".", "readByte", "(", ")", ";", "id", "!=", "127", ";", "id", "=", "stream", ".", "readByte", "(", ")", ")", "{", "if", "(", "data", "==", "null", ")", "{", "data", "=", "new", "ArrayList", "<", "MetadataObject", ">", "(", ")", ";", "}", "MetadataObject", "entry", "=", "null", ";", "int", "type", "=", "(", "id", "&", "0xE1", ")", ">>", "5", ";", "int", "mask", "=", "id", "&", "0x1F", ";", "switch", "(", "type", ")", "{", "case", "0", ":", "entry", "=", "new", "MetadataObject", "(", "type", ",", "mask", ",", "Byte", ".", "valueOf", "(", "stream", ".", "readByte", "(", ")", ")", ")", ";", "break", ";", "case", "1", ":", "entry", "=", "new", "MetadataObject", "(", "type", ",", "mask", ",", "Short", ".", "valueOf", "(", "stream", ".", "readShort", "(", ")", ")", ")", ";", "break", ";", "case", "2", ":", "entry", "=", "new", "MetadataObject", "(", "type", ",", "mask", ",", "Integer", ".", "valueOf", "(", "stream", ".", "readInt", "(", ")", ")", ")", ";", "break", ";", "case", "3", ":", "entry", "=", "new", "MetadataObject", "(", "type", ",", "mask", ",", "Float", ".", "valueOf", "(", "stream", ".", "readFloat", "(", ")", ")", ")", ";", "break", ";", "case", "4", ":", "entry", "=", "new", "MetadataObject", "(", "type", ",", "mask", ",", "stream", ".", "readUTF", "(", ")", ")", ";", "break", ";", "case", "5", ":", "short", "itemType", "=", "stream", ".", "readShort", "(", ")", ";", "byte", "itemCount", "=", "stream", ".", "readByte", "(", ")", ";", "short", "itemDamage", "=", "stream", ".", "readShort", "(", ")", ";", "entry", "=", "new", "MetadataObject", "(", "type", ",", "mask", ",", "new", "ItemStack", "(", "itemType", ",", "itemCount", ",", "itemDamage", ")", ")", ";", "case", "6", ":", "int", "x", "=", "stream", ".", "readInt", "(", ")", ";", "int", "y", "=", "stream", ".", "readInt", "(", ")", ";", "int", "z", "=", "stream", ".", "readInt", "(", ")", ";", "entry", "=", "new", "MetadataObject", "(", "type", ",", "mask", ",", "new", "BlockPosition", "(", "x", ",", "y", ",", "z", ")", ")", ";", "default", ":", "throw", "new", "UnsupportedOperationException", "(", "\"\"", "+", "type", ")", ";", "}", "data", ".", "add", "(", "entry", ")", ";", "}", "return", "data", ";", "}", "public", "static", "void", "write", "(", "List", "<", "MetadataObject", ">", "entries", ",", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "if", "(", "entries", "==", "null", ")", "{", "stream", ".", "writeByte", "(", "127", ")", ";", "return", ";", "}", "for", "(", "MetadataObject", "entry", ":", "entries", ")", "{", "write", "(", "entry", ",", "stream", ")", ";", "}", "stream", ".", "writeByte", "(", "127", ")", ";", "}", "public", "static", "void", "write", "(", "MetadataObject", "entry", ",", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "int", "id", "=", "(", "entry", ".", "getType", "(", ")", "<<", "5", "|", "entry", ".", "getMask", "(", ")", "&", "0x1F", ")", "&", "0xFF", ";", "stream", ".", "writeByte", "(", "id", ")", ";", "switch", "(", "entry", ".", "getType", "(", ")", ")", "{", "case", "0", ":", "stream", ".", "writeByte", "(", "(", "Byte", ")", "entry", ".", "getData", "(", ")", ")", ";", "break", ";", "case", "1", ":", "stream", ".", "writeShort", "(", "(", "Short", ")", "entry", ".", "getData", "(", ")", ")", ";", "break", ";", "case", "2", ":", "stream", ".", "writeInt", "(", "(", "Integer", ")", "entry", ".", "getData", "(", ")", ")", ";", "break", ";", "case", "3", ":", "stream", ".", "writeFloat", "(", "(", "Float", ")", "entry", ".", "getData", "(", ")", ")", ";", "break", ";", "case", "4", ":", "stream", ".", "writeUTF", "(", "(", "String", ")", "entry", ".", "getData", "(", ")", ")", ";", "break", ";", "case", "5", ":", "ItemStack", "itemstack", "=", "(", "ItemStack", ")", "entry", ".", "getData", "(", ")", ";", "stream", ".", "writeShort", "(", "itemstack", ".", "getId", "(", ")", ")", ";", "stream", ".", "writeByte", "(", "itemstack", ".", "getCount", "(", ")", ")", ";", "stream", ".", "writeShort", "(", "itemstack", ".", "getDamage", "(", ")", ")", ";", "case", "6", ":", "BlockPosition", "pos", "=", "(", "BlockPosition", ")", "entry", ".", "getData", "(", ")", ";", "stream", ".", "writeInt", "(", "pos", ".", "getX", "(", ")", ")", ";", "stream", ".", "writeInt", "(", "pos", ".", "getY", "(", ")", ")", ";", "stream", ".", "writeInt", "(", "pos", ".", "getZ", "(", ")", ")", ";", "default", ":", "throw", "new", "UnsupportedOperationException", "(", "\"\"", "+", "entry", ".", "getType", "(", ")", ")", ";", "}", "}", "public", "static", "class", "MetadataObject", "{", "private", "int", "type", ";", "private", "int", "mask", ";", "private", "Object", "data", ";", "public", "MetadataObject", "(", "int", "type", ",", "int", "mask", ",", "Object", "data", ")", "{", "this", ".", "type", "=", "type", ";", "this", ".", "mask", "=", "mask", ";", "this", ".", "data", "=", "data", ";", "}", "public", "int", "getType", "(", ")", "{", "return", "type", ";", "}", "public", "void", "setType", "(", "int", "type", ")", "{", "this", ".", "type", "=", "type", ";", "}", "public", "int", "getMask", "(", ")", "{", "return", "mask", ";", "}", "public", "void", "setMask", "(", "int", "mask", ")", "{", "this", ".", "mask", "=", "mask", ";", "}", "public", "Object", "getData", "(", ")", "{", "return", "data", ";", "}", "public", "void", "setData", "(", "Object", "data", ")", "{", "this", ".", "data", "=", "data", ";", "}", "}", "}", "</s>" ]
860
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet30Entity", "extends", "Packet", "{", "public", "int", "eid", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "eid", "=", "stream", ".", "readInt", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeInt", "(", "this", ".", "eid", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "4", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "30", ";", "}", "}", "</s>" ]
861
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet1Login", "extends", "Packet", "{", "public", "int", "version", ";", "public", "String", "username", ";", "public", "long", "mapSeed", ";", "public", "byte", "dimension", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "version", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "username", "=", "read", "(", "stream", ",", "16", ")", ";", "this", ".", "mapSeed", "=", "stream", ".", "readLong", "(", ")", ";", "this", ".", "dimension", "=", "stream", ".", "readByte", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeInt", "(", "this", ".", "version", ")", ";", "write", "(", "this", ".", "username", ",", "stream", ")", ";", "stream", ".", "writeLong", "(", "this", ".", "mapSeed", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "dimension", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "4", "+", "this", ".", "username", ".", "length", "(", ")", "+", "4", "+", "5", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "1", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "result", ".", "append", "(", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\"", "->", "\"", ")", ";", "result", ".", "append", "(", "\"Username:", "\"", ")", ";", "result", ".", "append", "(", "username", ")", ";", "result", ".", "append", "(", "\"", "Version:", "\"", ")", ";", "result", ".", "append", "(", "version", ")", ";", "result", ".", "append", "(", "\"", "MapSeed:", "\"", ")", ";", "result", ".", "append", "(", "mapSeed", ")", ";", "result", ".", "append", "(", "\"", "Dimension:", "\"", ")", ";", "result", ".", "append", "(", "dimension", ")", ";", "return", "result", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
862
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet50PreChunk", "extends", "Packet", "{", "public", "int", "x", ";", "public", "int", "y", ";", "public", "boolean", "initialize", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "x", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "y", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "initialize", "=", "stream", ".", "read", "(", ")", "!=", "0", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeInt", "(", "this", ".", "x", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "y", ")", ";", "stream", ".", "write", "(", "this", ".", "initialize", "?", "1", ":", "0", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "9", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "50", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\"", "->", "\"", "+", "\"X:", "\"", "+", "x", "+", "\"", "Y:", "\"", "+", "y", "+", "\"\"", "+", "initialize", ";", "}", "}", "</s>" ]
863
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet33RelativeEntityMoveLook", "extends", "Packet30Entity", "{", "public", "byte", "dx", ";", "public", "byte", "dy", ";", "public", "byte", "dz", ";", "public", "byte", "yaw", ";", "public", "byte", "pitch", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "super", ".", "read", "(", "stream", ")", ";", "this", ".", "dx", "=", "stream", ".", "readByte", "(", ")", ";", "this", ".", "dy", "=", "stream", ".", "readByte", "(", ")", ";", "this", ".", "dz", "=", "stream", ".", "readByte", "(", ")", ";", "this", ".", "yaw", "=", "stream", ".", "readByte", "(", ")", ";", "this", ".", "pitch", "=", "stream", ".", "readByte", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "super", ".", "write", "(", "stream", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "dx", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "dy", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "dz", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "yaw", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "pitch", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "9", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "33", ";", "}", "}", "</s>" ]
864
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet71Weather", "extends", "Packet", "{", "public", "int", "a", ";", "public", "int", "b", ";", "public", "int", "c", ";", "public", "int", "d", ";", "public", "int", "e", ";", "public", "void", "read", "(", "DataInputStream", "datainputstream", ")", "throws", "IOException", "{", "this", ".", "a", "=", "datainputstream", ".", "readInt", "(", ")", ";", "this", ".", "e", "=", "datainputstream", ".", "readByte", "(", ")", ";", "this", ".", "b", "=", "datainputstream", ".", "readInt", "(", ")", ";", "this", ".", "c", "=", "datainputstream", ".", "readInt", "(", ")", ";", "this", ".", "d", "=", "datainputstream", ".", "readInt", "(", ")", ";", "}", "public", "void", "write", "(", "DataOutputStream", "dataoutputstream", ")", "throws", "IOException", "{", "dataoutputstream", ".", "writeInt", "(", "this", ".", "a", ")", ";", "dataoutputstream", ".", "writeByte", "(", "this", ".", "e", ")", ";", "dataoutputstream", ".", "writeInt", "(", "this", ".", "b", ")", ";", "dataoutputstream", ".", "writeInt", "(", "this", ".", "c", ")", ";", "dataoutputstream", ".", "writeInt", "(", "this", ".", "d", ")", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "17", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "0", ";", "}", "}", "</s>" ]
865
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet5EntityEquipment", "extends", "Packet", "{", "public", "int", "eid", ";", "public", "int", "slot", ";", "public", "int", "itemId", ";", "public", "int", "d", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "eid", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "slot", "=", "stream", ".", "readShort", "(", ")", ";", "this", ".", "itemId", "=", "stream", ".", "readShort", "(", ")", ";", "this", ".", "d", "=", "stream", ".", "readShort", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeInt", "(", "this", ".", "eid", ")", ";", "stream", ".", "writeShort", "(", "this", ".", "slot", ")", ";", "stream", ".", "writeShort", "(", "this", ".", "itemId", ")", ";", "stream", ".", "writeShort", "(", "this", ".", "d", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "8", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "5", ";", "}", "}", "</s>" ]
866
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet23VehicleSpawn", "extends", "Packet", "{", "public", "int", "eid", ";", "public", "int", "x", ";", "public", "int", "y", ";", "public", "int", "z", ";", "public", "int", "type", ";", "public", "int", "i", ";", "public", "short", "e", ";", "public", "short", "f", ";", "public", "short", "g", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "eid", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "type", "=", "stream", ".", "readByte", "(", ")", ";", "this", ".", "x", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "y", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "z", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "i", "=", "stream", ".", "readInt", "(", ")", ";", "if", "(", "this", ".", "i", ">", "0", ")", "{", "this", ".", "e", "=", "stream", ".", "readShort", "(", ")", ";", "this", ".", "f", "=", "stream", ".", "readShort", "(", ")", ";", "this", ".", "g", "=", "stream", ".", "readShort", "(", ")", ";", "}", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeInt", "(", "this", ".", "eid", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "type", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "x", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "y", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "z", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "i", ")", ";", "if", "(", "this", ".", "i", ">", "0", ")", "{", "stream", ".", "writeShort", "(", "this", ".", "e", ")", ";", "stream", ".", "writeShort", "(", "this", ".", "f", ")", ";", "stream", ".", "writeShort", "(", "this", ".", "g", ")", ";", "}", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "21", "+", "this", ".", "i", ">", "0", "?", "6", ":", "0", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "23", ";", "}", "}", "</s>" ]
867
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "com", ".", "sk89q", ".", "minerhat", ".", "util", ".", "ItemStack", ";", "public", "class", "Packet15Place", "extends", "Packet", "{", "public", "int", "x", ";", "public", "byte", "y", ";", "public", "int", "z", ";", "public", "byte", "direction", ";", "public", "ItemStack", "item", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "x", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "y", "=", "stream", ".", "readByte", "(", ")", ";", "this", ".", "z", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "direction", "=", "stream", ".", "readByte", "(", ")", ";", "short", "id", "=", "stream", ".", "readShort", "(", ")", ";", "if", "(", "id", ">=", "0", ")", "{", "byte", "amount", "=", "stream", ".", "readByte", "(", ")", ";", "short", "damage", "=", "stream", ".", "readShort", "(", ")", ";", "this", ".", "item", "=", "new", "ItemStack", "(", "id", ",", "amount", ",", "damage", ")", ";", "}", "else", "{", "this", ".", "item", "=", "null", ";", "}", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeInt", "(", "this", ".", "x", ")", ";", "stream", ".", "write", "(", "this", ".", "y", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "z", ")", ";", "stream", ".", "write", "(", "this", ".", "direction", ")", ";", "if", "(", "this", ".", "item", "==", "null", ")", "{", "stream", ".", "writeShort", "(", "-", "1", ")", ";", "}", "else", "{", "stream", ".", "writeShort", "(", "this", ".", "item", ".", "getId", "(", ")", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "item", ".", "getCount", "(", ")", ")", ";", "stream", ".", "writeShort", "(", "this", ".", "item", ".", "getDamage", "(", ")", ")", ";", "}", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "15", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "15", ";", "}", "}", "</s>" ]
868
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet34EntityTeleport", "extends", "Packet30Entity", "{", "public", "int", "x", ";", "public", "int", "y", ";", "public", "int", "z", ";", "public", "byte", "yaw", ";", "public", "byte", "pitch", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "super", ".", "read", "(", "stream", ")", ";", "this", ".", "x", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "y", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "z", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "yaw", "=", "(", "byte", ")", "stream", ".", "read", "(", ")", ";", "this", ".", "pitch", "=", "(", "byte", ")", "stream", ".", "read", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "super", ".", "write", "(", "stream", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "x", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "y", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "z", ")", ";", "stream", ".", "write", "(", "this", ".", "yaw", ")", ";", "stream", ".", "write", "(", "this", ".", "pitch", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "34", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "34", ";", "}", "}", "</s>" ]
869
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet131", "extends", "Packet", "{", "public", "short", "a", ";", "public", "short", "b", ";", "public", "byte", "[", "]", "c", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "a", "=", "stream", ".", "readShort", "(", ")", ";", "this", ".", "b", "=", "stream", ".", "readShort", "(", ")", ";", "this", ".", "c", "=", "new", "byte", "[", "stream", ".", "readByte", "(", ")", "&", "0xFF", "]", ";", "stream", ".", "readFully", "(", "this", ".", "c", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeShort", "(", "this", ".", "a", ")", ";", "stream", ".", "writeShort", "(", "this", ".", "b", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "c", ".", "length", ")", ";", "stream", ".", "write", "(", "this", ".", "c", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "4", "+", "this", ".", "c", ".", "length", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "(", "byte", ")", "131", ";", "}", "}", "</s>" ]
870
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet105CraftProgressBar", "extends", "Packet", "{", "public", "byte", "id", ";", "public", "short", "progress", ";", "public", "short", "value", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "id", "=", "stream", ".", "readByte", "(", ")", ";", "this", ".", "progress", "=", "stream", ".", "readShort", "(", ")", ";", "this", ".", "value", "=", "stream", ".", "readShort", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeByte", "(", "this", ".", "id", ")", ";", "stream", ".", "writeShort", "(", "this", ".", "progress", ")", ";", "stream", ".", "writeShort", "(", "this", ".", "value", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "5", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "105", ";", "}", "}", "</s>" ]
871
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet200Statistic", "extends", "Packet", "{", "int", "id", ";", "byte", "amount", ";", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "(", "byte", ")", "200", ";", "}", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "id", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "amount", "=", "stream", ".", "readByte", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeInt", "(", "this", ".", "id", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "amount", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "6", ";", "}", "}", "</s>" ]
872
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet16BlockItemSwitch", "extends", "Packet", "{", "public", "int", "slot", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "slot", "=", "stream", ".", "readShort", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeShort", "(", "this", ".", "slot", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "2", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "16", ";", "}", "}", "</s>" ]
873
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet131MapData", "extends", "Packet", "{", "public", "short", "a", ";", "public", "short", "b", ";", "public", "byte", "[", "]", "c", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "a", "=", "stream", ".", "readShort", "(", ")", ";", "this", ".", "b", "=", "stream", ".", "readShort", "(", ")", ";", "this", ".", "c", "=", "new", "byte", "[", "stream", ".", "readByte", "(", ")", "&", "0xFF", "]", ";", "stream", ".", "readFully", "(", "this", ".", "c", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeShort", "(", "this", ".", "a", ")", ";", "stream", ".", "writeShort", "(", "this", ".", "b", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "c", ".", "length", ")", ";", "stream", ".", "write", "(", "this", ".", "c", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "4", "+", "this", ".", "c", ".", "length", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "(", "byte", ")", "131", ";", "}", "}", "</s>" ]
874
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet8UpdateHealth", "extends", "Packet", "{", "public", "int", "health", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "health", "=", "stream", ".", "readShort", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeShort", "(", "this", ".", "health", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "2", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "8", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "result", ".", "append", "(", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\"", "->", "\"", ")", ";", "result", ".", "append", "(", "\"Health:", "\"", ")", ";", "result", ".", "append", "(", "health", ")", ";", "return", "result", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
875
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet53BlockChange", "extends", "Packet", "{", "public", "int", "x", ";", "public", "byte", "y", ";", "public", "int", "z", ";", "public", "byte", "type", ";", "public", "byte", "data", ";", "public", "Packet53BlockChange", "(", ")", "{", "}", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "x", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "y", "=", "stream", ".", "readByte", "(", ")", ";", "this", ".", "z", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "type", "=", "stream", ".", "readByte", "(", ")", ";", "this", ".", "data", "=", "stream", ".", "readByte", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeInt", "(", "this", ".", "x", ")", ";", "stream", ".", "write", "(", "this", ".", "y", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "z", ")", ";", "stream", ".", "write", "(", "this", ".", "type", ")", ";", "stream", ".", "write", "(", "this", ".", "data", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "11", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "53", ";", "}", "}", "</s>" ]
876
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "com", ".", "sk89q", ".", "minerhat", ".", "util", ".", "BlockPosition", ";", "public", "class", "Packet60Explosion", "extends", "Packet", "{", "public", "double", "x", ";", "public", "double", "y", ";", "public", "double", "z", ";", "public", "float", "radius", ";", "public", "List", "<", "BlockPosition", ">", "blocks", "=", "new", "ArrayList", "<", "BlockPosition", ">", "(", ")", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "x", "=", "stream", ".", "readDouble", "(", ")", ";", "this", ".", "y", "=", "stream", ".", "readDouble", "(", ")", ";", "this", ".", "z", "=", "stream", ".", "readDouble", "(", ")", ";", "this", ".", "radius", "=", "stream", ".", "readFloat", "(", ")", ";", "int", "count", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "blocks", "=", "new", "ArrayList", "<", "BlockPosition", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "++", "i", ")", "{", "int", "blockX", "=", "(", "int", ")", "(", "stream", ".", "readByte", "(", ")", "+", "x", ")", ";", "int", "blockY", "=", "(", "int", ")", "(", "stream", ".", "readByte", "(", ")", "+", "y", ")", ";", "int", "blockZ", "=", "(", "int", ")", "(", "stream", ".", "readByte", "(", ")", "+", "z", ")", ";", "this", ".", "blocks", ".", "add", "(", "new", "BlockPosition", "(", "blockX", ",", "blockY", ",", "blockZ", ")", ")", ";", "}", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeDouble", "(", "this", ".", "x", ")", ";", "stream", ".", "writeDouble", "(", "this", ".", "y", ")", ";", "stream", ".", "writeDouble", "(", "this", ".", "z", ")", ";", "stream", ".", "writeFloat", "(", "this", ".", "radius", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "blocks", ".", "size", "(", ")", ")", ";", "for", "(", "BlockPosition", "pos", ":", "blocks", ")", "{", "stream", ".", "writeByte", "(", "pos", ".", "getX", "(", ")", ")", ";", "stream", ".", "writeByte", "(", "pos", ".", "getY", "(", ")", ")", ";", "stream", ".", "writeByte", "(", "pos", ".", "getZ", "(", ")", ")", ";", "}", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "32", "+", "this", ".", "blocks", ".", "size", "(", ")", "*", "3", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "60", ";", "}", "}", "</s>" ]
877
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet28EntityVelocity", "extends", "Packet", "{", "public", "int", "a", ";", "public", "int", "b", ";", "public", "int", "c", ";", "public", "int", "d", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "a", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "b", "=", "stream", ".", "readShort", "(", ")", ";", "this", ".", "c", "=", "stream", ".", "readShort", "(", ")", ";", "this", ".", "d", "=", "stream", ".", "readShort", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeInt", "(", "this", ".", "a", ")", ";", "stream", ".", "writeShort", "(", "this", ".", "b", ")", ";", "stream", ".", "writeShort", "(", "this", ".", "c", ")", ";", "stream", ".", "writeShort", "(", "this", ".", "d", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "10", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "28", ";", "}", "}", "</s>" ]
878
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet14BlockDig", "extends", "Packet", "{", "public", "byte", "status", ";", "public", "int", "x", ";", "public", "byte", "y", ";", "public", "int", "z", ";", "public", "byte", "face", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "status", "=", "stream", ".", "readByte", "(", ")", ";", "this", ".", "x", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "y", "=", "stream", ".", "readByte", "(", ")", ";", "this", ".", "z", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "face", "=", "stream", ".", "readByte", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeByte", "(", "this", ".", "status", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "x", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "y", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "z", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "face", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "11", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "14", ";", "}", "}", "</s>" ]
879
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet27", "extends", "Packet", "{", "private", "float", "a", ";", "private", "float", "b", ";", "private", "boolean", "c", ";", "private", "boolean", "d", ";", "private", "float", "e", ";", "private", "float", "f", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "a", "=", "stream", ".", "readFloat", "(", ")", ";", "this", ".", "b", "=", "stream", ".", "readFloat", "(", ")", ";", "this", ".", "e", "=", "stream", ".", "readFloat", "(", ")", ";", "this", ".", "f", "=", "stream", ".", "readFloat", "(", ")", ";", "this", ".", "c", "=", "stream", ".", "readBoolean", "(", ")", ";", "this", ".", "d", "=", "stream", ".", "readBoolean", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeFloat", "(", "this", ".", "a", ")", ";", "stream", ".", "writeFloat", "(", "this", ".", "b", ")", ";", "stream", ".", "writeFloat", "(", "this", ".", "e", ")", ";", "stream", ".", "writeFloat", "(", "this", ".", "f", ")", ";", "stream", ".", "writeBoolean", "(", "this", ".", "c", ")", ";", "stream", ".", "writeBoolean", "(", "this", ".", "d", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "18", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "27", ";", "}", "}", "</s>" ]
880
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet255KickDisconnect", "extends", "Packet", "{", "public", "String", "message", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "message", "=", "read", "(", "stream", ",", "100", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "write", "(", "this", ".", "message", ",", "stream", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "this", ".", "message", ".", "length", "(", ")", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "(", "byte", ")", "255", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "result", ".", "append", "(", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\"", "->", "\"", ")", ";", "result", ".", "append", "(", "\"Message:", "\"", ")", ";", "result", ".", "append", "(", "message", ")", ";", "return", "result", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
881
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet25EntityPainting", "extends", "Packet", "{", "public", "int", "eid", ";", "public", "int", "x", ";", "public", "int", "y", ";", "public", "int", "z", ";", "public", "int", "direction", ";", "public", "String", "title", ";", "public", "Packet25EntityPainting", "(", ")", "{", "}", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "eid", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "title", "=", "read", "(", "stream", ",", "\"\"", ".", "length", "(", ")", ")", ";", "this", ".", "x", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "y", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "z", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "direction", "=", "stream", ".", "readInt", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeInt", "(", "this", ".", "eid", ")", ";", "write", "(", "this", ".", "title", ",", "stream", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "x", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "y", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "z", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "direction", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "24", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "25", ";", "}", "}", "</s>" ]
882
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet10Flying", "extends", "Packet", "{", "public", "boolean", "onGround", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "onGround", "=", "stream", ".", "read", "(", ")", "!=", "0", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "write", "(", "this", ".", "onGround", "?", "1", ":", "0", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "1", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "10", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "result", ".", "append", "(", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\"", "->", "\"", ")", ";", "result", ".", "append", "(", "\"OnGround:", "\"", ")", ";", "result", ".", "append", "(", "onGround", ")", ";", "return", "result", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
883
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "abstract", "class", "Packet", "{", "public", "abstract", "byte", "getId", "(", ")", ";", "public", "abstract", "void", "read", "(", "DataInputStream", "datainputstream", ")", "throws", "IOException", ";", "public", "abstract", "void", "write", "(", "DataOutputStream", "dataoutputstream", ")", "throws", "IOException", ";", "public", "abstract", "int", "length", "(", ")", ";", "public", "boolean", "toServer", ";", "public", "static", "String", "read", "(", "DataInputStream", "datainputstream", ",", "int", "i", ")", "throws", "IOException", "{", "short", "short1", "=", "datainputstream", ".", "readShort", "(", ")", ";", "if", "(", "short1", ">", "i", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "short1", "+", "\"", ">", "\"", "+", "i", "+", "\")\"", ")", ";", "}", "else", "if", "(", "short1", "<", "0", ")", "{", "throw", "new", "IOException", "(", "\"\"", ")", ";", "}", "else", "{", "StringBuilder", "stringbuilder", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "short1", ";", "++", "j", ")", "{", "stringbuilder", ".", "append", "(", "datainputstream", ".", "readChar", "(", ")", ")", ";", "}", "return", "stringbuilder", ".", "toString", "(", ")", ";", "}", "}", "public", "static", "void", "write", "(", "String", "s", ",", "DataOutputStream", "dataoutputstream", ")", "throws", "IOException", "{", "if", "(", "s", ".", "length", "(", ")", ">", "32767", ")", "{", "throw", "new", "IOException", "(", "\"\"", ")", ";", "}", "else", "{", "dataoutputstream", ".", "writeShort", "(", "s", ".", "length", "(", ")", ")", ";", "dataoutputstream", ".", "writeChars", "(", "s", ")", ";", "}", "}", "}", "</s>" ]
884
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet100OpenWindow", "extends", "Packet", "{", "public", "byte", "id", ";", "public", "byte", "type", ";", "public", "String", "title", ";", "public", "byte", "slotCount", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "id", "=", "stream", ".", "readByte", "(", ")", ";", "this", ".", "type", "=", "stream", ".", "readByte", "(", ")", ";", "this", ".", "title", "=", "stream", ".", "readUTF", "(", ")", ";", "this", ".", "slotCount", "=", "stream", ".", "readByte", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeByte", "(", "this", ".", "id", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "type", ")", ";", "stream", ".", "writeUTF", "(", "this", ".", "title", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "slotCount", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "3", "+", "this", ".", "title", ".", "length", "(", ")", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "100", ";", "}", "}", "</s>" ]
885
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet4UpdateTime", "extends", "Packet", "{", "public", "long", "time", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "time", "=", "stream", ".", "readLong", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeLong", "(", "this", ".", "time", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "8", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "4", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\"", "->", "\"", "+", "Long", ".", "toString", "(", "time", ")", ";", "}", "}", "</s>" ]
886
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "List", ";", "import", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ".", "MetadataParser", ".", "MetadataObject", ";", "public", "class", "Packet24MobSpawn", "extends", "Packet", "{", "public", "int", "eid", ";", "public", "byte", "type", ";", "public", "int", "x", ";", "public", "int", "y", ";", "public", "int", "z", ";", "public", "byte", "yaw", ";", "public", "byte", "pitch", ";", "private", "List", "<", "MetadataObject", ">", "metadata", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "eid", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "type", "=", "stream", ".", "readByte", "(", ")", ";", "this", ".", "x", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "y", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "z", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "yaw", "=", "stream", ".", "readByte", "(", ")", ";", "this", ".", "pitch", "=", "stream", ".", "readByte", "(", ")", ";", "this", ".", "metadata", "=", "MetadataParser", ".", "read", "(", "stream", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeInt", "(", "this", ".", "eid", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "type", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "x", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "y", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "z", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "yaw", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "pitch", ")", ";", "MetadataParser", ".", "write", "(", "metadata", ",", "stream", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "20", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "24", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "result", ".", "append", "(", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\"", "->", "\"", ")", ";", "result", ".", "append", "(", "\"", "EntityID:", "\"", ")", ";", "result", ".", "append", "(", "eid", ")", ";", "result", ".", "append", "(", "\"", "Type:", "\"", ")", ";", "result", ".", "append", "(", "type", ")", ";", "result", ".", "append", "(", "\"X:", "\"", ")", ";", "result", ".", "append", "(", "x", ")", ";", "result", ".", "append", "(", "\"", "Y:", "\"", ")", ";", "result", ".", "append", "(", "y", ")", ";", "result", ".", "append", "(", "\"", "Z:", "\"", ")", ";", "result", ".", "append", "(", "z", ")", ";", "return", "result", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
887
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet61", "extends", "Packet", "{", "public", "int", "a", ";", "public", "int", "b", ";", "public", "int", "c", ";", "public", "int", "d", ";", "public", "int", "e", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "a", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "c", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "d", "=", "stream", ".", "readByte", "(", ")", ";", "this", ".", "e", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "b", "=", "stream", ".", "readInt", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeInt", "(", "this", ".", "a", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "c", ")", ";", "stream", ".", "writeByte", "(", "this", ".", "d", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "e", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "b", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "20", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "61", ";", "}", "}", "</s>" ]
888
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet11PlayerPosition", "extends", "Packet10Flying", "{", "public", "double", "x", ";", "public", "double", "y", ";", "public", "double", "stance", ";", "public", "double", "z", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "x", "=", "stream", ".", "readDouble", "(", ")", ";", "this", ".", "y", "=", "stream", ".", "readDouble", "(", ")", ";", "this", ".", "stance", "=", "stream", ".", "readDouble", "(", ")", ";", "this", ".", "z", "=", "stream", ".", "readDouble", "(", ")", ";", "super", ".", "read", "(", "stream", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeDouble", "(", "this", ".", "x", ")", ";", "stream", ".", "writeDouble", "(", "this", ".", "y", ")", ";", "stream", ".", "writeDouble", "(", "this", ".", "stance", ")", ";", "stream", ".", "writeDouble", "(", "this", ".", "z", ")", ";", "super", ".", "write", "(", "stream", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "33", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "11", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "result", ".", "append", "(", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\"", "->", "\"", ")", ";", "result", ".", "append", "(", "\"", "X:", "\"", ")", ";", "result", ".", "append", "(", "x", ")", ";", "result", ".", "append", "(", "\"", "Y:", "\"", ")", ";", "result", ".", "append", "(", "y", ")", ";", "result", ".", "append", "(", "\"", "Z:", "\"", ")", ";", "result", ".", "append", "(", "z", ")", ";", "result", ".", "append", "(", "\"", "Stance:", "\"", ")", ";", "result", ".", "append", "(", "stance", ")", ";", "return", "result", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
889
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet39AttachEntity", "extends", "Packet", "{", "public", "int", "eid", ";", "public", "int", "vehicleId", ";", "public", "Packet39AttachEntity", "(", ")", "{", "}", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "eid", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "vehicleId", "=", "stream", ".", "readInt", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeInt", "(", "this", ".", "eid", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "vehicleId", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "8", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "39", ";", "}", "}", "</s>" ]
890
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet13PlayerLookMove", "extends", "Packet10Flying", "{", "public", "double", "x", ";", "public", "double", "a", ";", "public", "double", "b", ";", "public", "double", "z", ";", "public", "float", "yaw", ";", "public", "float", "pitch", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "x", "=", "stream", ".", "readDouble", "(", ")", ";", "this", ".", "a", "=", "stream", ".", "readDouble", "(", ")", ";", "this", ".", "b", "=", "stream", ".", "readDouble", "(", ")", ";", "this", ".", "z", "=", "stream", ".", "readDouble", "(", ")", ";", "this", ".", "yaw", "=", "stream", ".", "readFloat", "(", ")", ";", "this", ".", "pitch", "=", "stream", ".", "readFloat", "(", ")", ";", "super", ".", "read", "(", "stream", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeDouble", "(", "this", ".", "x", ")", ";", "stream", ".", "writeDouble", "(", "this", ".", "a", ")", ";", "stream", ".", "writeDouble", "(", "this", ".", "b", ")", ";", "stream", ".", "writeDouble", "(", "this", ".", "z", ")", ";", "stream", ".", "writeFloat", "(", "this", ".", "yaw", ")", ";", "stream", ".", "writeFloat", "(", "this", ".", "pitch", ")", ";", "super", ".", "write", "(", "stream", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "13", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "13", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "result", ".", "append", "(", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\"", "->", "\"", ")", ";", "result", ".", "append", "(", "\"X:", "\"", ")", ";", "result", ".", "append", "(", "this", ".", "x", ")", ";", "result", ".", "append", "(", "\"", "Y:", "\"", ")", ";", "if", "(", "this", ".", "toServer", ")", "{", "result", ".", "append", "(", "this", ".", "a", ")", ";", "}", "else", "{", "result", ".", "append", "(", "this", ".", "b", ")", ";", "}", "result", ".", "append", "(", "\"", "Z:", "\"", ")", ";", "result", ".", "append", "(", "z", ")", ";", "result", ".", "append", "(", "\"", "Yaw:", "\"", ")", ";", "result", ".", "append", "(", "yaw", ")", ";", "result", ".", "append", "(", "\"", "Pitch:", "\"", ")", ";", "result", ".", "append", "(", "pitch", ")", ";", "result", ".", "append", "(", "\"", "Stance:", "\"", ")", ";", "if", "(", "this", ".", "toServer", ")", "{", "result", ".", "append", "(", "this", ".", "b", ")", ";", "}", "else", "{", "result", ".", "append", "(", "this", ".", "a", ")", ";", "}", "return", "result", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
891
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet54PlayNoteBlock", "extends", "Packet", "{", "public", "int", "x", ";", "public", "short", "y", ";", "public", "int", "z", ";", "public", "byte", "instrument", ";", "public", "byte", "pitch", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "x", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "y", "=", "stream", ".", "readShort", "(", ")", ";", "this", ".", "z", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "instrument", "=", "stream", ".", "readByte", "(", ")", ";", "this", ".", "pitch", "=", "stream", ".", "readByte", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeInt", "(", "this", ".", "x", ")", ";", "stream", ".", "writeShort", "(", "this", ".", "y", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "z", ")", ";", "stream", ".", "write", "(", "this", ".", "instrument", ")", ";", "stream", ".", "write", "(", "this", ".", "pitch", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "12", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "54", ";", "}", "}", "</s>" ]
892
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet20NamedEntitySpawn", "extends", "Packet", "{", "public", "int", "eid", ";", "public", "String", "name", ";", "public", "int", "x", ";", "public", "int", "y", ";", "public", "int", "z", ";", "public", "byte", "rotation", ";", "public", "byte", "pitch", ";", "public", "short", "currentItem", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "datainputstream", ")", "throws", "IOException", "{", "this", ".", "eid", "=", "datainputstream", ".", "readInt", "(", ")", ";", "this", ".", "name", "=", "read", "(", "datainputstream", ",", "16", ")", ";", "this", ".", "x", "=", "datainputstream", ".", "readInt", "(", ")", ";", "this", ".", "y", "=", "datainputstream", ".", "readInt", "(", ")", ";", "this", ".", "z", "=", "datainputstream", ".", "readInt", "(", ")", ";", "this", ".", "rotation", "=", "datainputstream", ".", "readByte", "(", ")", ";", "this", ".", "pitch", "=", "datainputstream", ".", "readByte", "(", ")", ";", "this", ".", "currentItem", "=", "datainputstream", ".", "readShort", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "dataoutputstream", ")", "throws", "IOException", "{", "dataoutputstream", ".", "writeInt", "(", "this", ".", "eid", ")", ";", "write", "(", "this", ".", "name", ",", "dataoutputstream", ")", ";", "dataoutputstream", ".", "writeInt", "(", "this", ".", "x", ")", ";", "dataoutputstream", ".", "writeInt", "(", "this", ".", "y", ")", ";", "dataoutputstream", ".", "writeInt", "(", "this", ".", "z", ")", ";", "dataoutputstream", ".", "writeByte", "(", "this", ".", "rotation", ")", ";", "dataoutputstream", ".", "writeByte", "(", "this", ".", "pitch", ")", ";", "dataoutputstream", ".", "writeShort", "(", "this", ".", "currentItem", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "28", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "20", ";", "}", "}", "</s>" ]
893
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet3Chat", "extends", "Packet", "{", "public", "String", "message", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "message", "=", "read", "(", "stream", ",", "119", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "write", "(", "this", ".", "message", ",", "stream", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "this", ".", "message", ".", "length", "(", ")", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "3", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\"", "->", "\"", "+", "message", ";", "}", "}", "</s>" ]
894
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Map", ";", "public", "class", "PacketManager", "{", "private", "static", "final", "Map", "<", "Byte", ",", "Class", "<", "?", "extends", "Packet", ">", ">", "packets", "=", "new", "HashMap", "<", "Byte", ",", "Class", "<", "?", "extends", "Packet", ">", ">", "(", ")", ";", "static", "{", "packets", ".", "put", "(", "(", "byte", ")", "0", ",", "Packet0KeepAlive", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "1", ",", "Packet1Login", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "2", ",", "Packet2Handshake", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "3", ",", "Packet3Chat", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "4", ",", "Packet4UpdateTime", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "5", ",", "Packet5EntityEquipment", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "6", ",", "Packet6SpawnPosition", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "7", ",", "Packet7UseEntity", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "8", ",", "Packet8UpdateHealth", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "9", ",", "Packet9Respawn", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "10", ",", "Packet10Flying", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "11", ",", "Packet11PlayerPosition", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "12", ",", "Packet12PlayerLook", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "13", ",", "Packet13PlayerLookMove", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "14", ",", "Packet14BlockDig", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "15", ",", "Packet15Place", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "16", ",", "Packet16BlockItemSwitch", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "17", ",", "Packet17UseBed", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "18", ",", "Packet18ArmAnimation", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "19", ",", "Packet19EntityAction", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "20", ",", "Packet20NamedEntitySpawn", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "21", ",", "Packet21PickupSpawn", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "22", ",", "Packet22Collect", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "23", ",", "Packet23VehicleSpawn", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "24", ",", "Packet24MobSpawn", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "25", ",", "Packet25EntityPainting", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "27", ",", "Packet27", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "28", ",", "Packet28EntityVelocity", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "29", ",", "Packet29DestroyEntity", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "30", ",", "Packet30Entity", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "31", ",", "Packet31RelativeEntityMove", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "32", ",", "Packet32EntityLook", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "33", ",", "Packet33RelativeEntityMoveLook", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "34", ",", "Packet34EntityTeleport", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "38", ",", "Packet38EntityStatus", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "39", ",", "Packet39AttachEntity", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "40", ",", "Packet40EntityMetadata", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "50", ",", "Packet50PreChunk", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "51", ",", "Packet51MapChunk", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "52", ",", "Packet52MultiBlockChange", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "53", ",", "Packet53BlockChange", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "54", ",", "Packet54PlayNoteBlock", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "60", ",", "Packet60Explosion", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "61", ",", "Packet61DoorChange", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "70", ",", "Packet70Bed", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "71", ",", "Packet71Weather", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "100", ",", "Packet100OpenWindow", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "101", ",", "Packet101CloseWindow", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "102", ",", "Packet102WindowClick", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "103", ",", "Packet103SetSlot", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "104", ",", "Packet104WindowItems", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "105", ",", "Packet105CraftProgressBar", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "106", ",", "Packet106Transaction", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "130", ",", "Packet130UpdateSign", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "131", ",", "Packet131MapData", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "200", ",", "Packet200Statistic", ".", "class", ")", ";", "packets", ".", "put", "(", "(", "byte", ")", "255", ",", "Packet255KickDisconnect", ".", "class", ")", ";", "}", "public", "static", "boolean", "containsID", "(", "byte", "id", ")", "{", "if", "(", "packets", ".", "containsKey", "(", "id", ")", ")", "{", "return", "true", ";", "}", "else", "{", "return", "false", ";", "}", "}", "public", "static", "Class", "<", "?", "extends", "Packet", ">", "get", "(", "byte", "id", ")", "throws", "UnknownPacketException", "{", "Class", "<", "?", "extends", "Packet", ">", "cls", "=", "packets", ".", "get", "(", "id", ")", ";", "if", "(", "cls", "==", "null", ")", "{", "throw", "new", "UnknownPacketException", "(", ")", ";", "}", "return", "cls", ";", "}", "public", "static", "Packet", "construct", "(", "byte", "id", ")", "throws", "UnknownPacketException", "{", "Class", "<", "?", "extends", "Packet", ">", "cls", "=", "get", "(", "id", ")", ";", "Packet", "packet", ";", "try", "{", "packet", "=", "(", "Packet", ")", "cls", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "InstantiationException", "e", ")", "{", "throw", "new", "UnknownPacketException", "(", "e", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "throw", "new", "UnknownPacketException", "(", "e", ")", ";", "}", "if", "(", "id", "!=", "packet", ".", "getId", "(", ")", ")", "{", "throw", "new", "RuntimeException", "(", "\"\"", "+", "packet", ".", "getClass", "(", ")", ".", "getCanonicalName", "(", ")", "+", "\"\"", "+", "packet", ".", "getId", "(", ")", "+", "\";", "actual", "is", "\"", "+", "id", ")", ";", "}", "return", "packet", ";", "}", "public", "static", "Packet", "read", "(", "byte", "id", ",", "DataInputStream", "stream", ")", "throws", "UnknownPacketException", ",", "IOException", "{", "Packet", "packet", "=", "construct", "(", "id", ")", ";", "packet", ".", "read", "(", "stream", ")", ";", "return", "packet", ";", "}", "public", "static", "class", "UnknownPacketException", "extends", "Exception", "{", "private", "static", "final", "long", "serialVersionUID", "=", "-", "8815444824778417409L", ";", "public", "UnknownPacketException", "(", ")", "{", "super", "(", ")", ";", "}", "public", "UnknownPacketException", "(", "Throwable", "t", ")", "{", "super", "(", "t", ")", ";", "}", "}", "}", "</s>" ]
895
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "com", ".", "sk89q", ".", "minerhat", ".", "util", ".", "ItemStack", ";", "public", "class", "Packet104WindowItems", "extends", "Packet", "{", "public", "byte", "id", ";", "public", "ItemStack", "[", "]", "items", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "id", "=", "stream", ".", "readByte", "(", ")", ";", "short", "count", "=", "stream", ".", "readShort", "(", ")", ";", "this", ".", "items", "=", "new", "ItemStack", "[", "count", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "++", "i", ")", "{", "short", "short2", "=", "stream", ".", "readShort", "(", ")", ";", "if", "(", "short2", ">=", "0", ")", "{", "byte", "b0", "=", "stream", ".", "readByte", "(", ")", ";", "short", "short3", "=", "stream", ".", "readShort", "(", ")", ";", "this", ".", "items", "[", "i", "]", "=", "new", "ItemStack", "(", "short2", ",", "b0", ",", "short3", ")", ";", "}", "}", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeByte", "(", "this", ".", "id", ")", ";", "stream", ".", "writeShort", "(", "this", ".", "items", ".", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "items", ".", "length", ";", "++", "i", ")", "{", "if", "(", "this", ".", "items", "[", "i", "]", "==", "null", ")", "{", "stream", ".", "writeShort", "(", "-", "1", ")", ";", "}", "else", "{", "stream", ".", "writeShort", "(", "(", "short", ")", "this", ".", "items", "[", "i", "]", ".", "getId", "(", ")", ")", ";", "stream", ".", "writeByte", "(", "(", "byte", ")", "this", ".", "items", "[", "i", "]", ".", "getCount", "(", ")", ")", ";", "stream", ".", "writeShort", "(", "(", "short", ")", "this", ".", "items", "[", "i", "]", ".", "getDamage", "(", ")", ")", ";", "}", "}", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "3", "+", "this", ".", "items", ".", "length", "*", "5", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "104", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "result", ".", "append", "(", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\"", "->", "\"", ")", ";", "result", ".", "append", "(", "\"", "ID:", "\"", ")", ";", "result", ".", "append", "(", "id", ")", ";", "result", ".", "append", "(", "\"", "Items:", "\"", ")", ";", "result", ".", "append", "(", "items", ".", "toString", "(", ")", ")", ";", "return", "result", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
896
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet6SpawnPosition", "extends", "Packet", "{", "private", "int", "x", ";", "private", "int", "y", ";", "private", "int", "z", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "x", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "y", "=", "stream", ".", "readInt", "(", ")", ";", "this", ".", "z", "=", "stream", ".", "readInt", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeInt", "(", "this", ".", "x", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "y", ")", ";", "stream", ".", "writeInt", "(", "this", ".", "z", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "12", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "6", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "result", ".", "append", "(", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\"", "->", "\"", ")", ";", "result", ".", "append", "(", "\"X:", "\"", ")", ";", "result", ".", "append", "(", "x", ")", ";", "result", ".", "append", "(", "\"", "Y:", "\"", ")", ";", "result", ".", "append", "(", "y", ")", ";", "result", ".", "append", "(", "\"", "Z:", "\"", ")", ";", "result", ".", "append", "(", "z", ")", ";", "return", "result", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
897
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ".", "packets", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Packet29DestroyEntity", "extends", "Packet", "{", "public", "int", "eid", ";", "@", "Override", "public", "void", "read", "(", "DataInputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "eid", "=", "stream", ".", "readInt", "(", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "DataOutputStream", "stream", ")", "throws", "IOException", "{", "stream", ".", "writeInt", "(", "this", ".", "eid", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "4", ";", "}", "@", "Override", "public", "byte", "getId", "(", ")", "{", "return", "29", ";", "}", "}", "</s>" ]
898
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ";", "import", "java", ".", "io", ".", "*", ";", "import", "java", ".", "net", ".", "*", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "public", "class", "MinecraftProxyServer", "implements", "Runnable", "{", "private", "static", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "MinecraftProxyServer", ".", "class", ".", "getName", "(", ")", ")", ";", "private", "int", "port", ";", "private", "InetAddress", "targetHost", ";", "private", "int", "targetPort", ";", "public", "MinecraftProxyServer", "(", "int", "port", ",", "InetAddress", "targetHost", ",", "int", "targetPort", ")", "{", "this", ".", "port", "=", "port", ";", "this", ".", "targetHost", "=", "targetHost", ";", "this", ".", "targetPort", "=", "targetPort", ";", "}", "public", "void", "listen", "(", ")", "throws", "IOException", "{", "ServerSocket", "serverSocket", "=", "new", "ServerSocket", "(", "getPort", "(", ")", ")", ";", "logger", ".", "info", "(", "\"\"", ")", ";", "while", "(", "!", "serverSocket", ".", "isClosed", "(", ")", ")", "{", "Socket", "clientSocket", "=", "serverSocket", ".", "accept", "(", ")", ";", "clientSocket", ".", "setTcpNoDelay", "(", "true", ")", ";", "logger", ".", "info", "(", "\"\"", "+", "clientSocket", ".", "toString", "(", ")", ")", ";", "MinecraftProxyServerClient", "client", "=", "new", "MinecraftProxyServerClient", "(", "this", ",", "clientSocket", ")", ";", "Thread", "thread", "=", "new", "Thread", "(", "client", ")", ";", "thread", ".", "start", "(", ")", ";", "}", "}", "public", "int", "getPort", "(", ")", "{", "return", "port", ";", "}", "public", "InetAddress", "getTargetHost", "(", ")", "{", "return", "targetHost", ";", "}", "public", "int", "getTargetPort", "(", ")", "{", "return", "targetPort", ";", "}", "public", "void", "setTargetHost", "(", "InetAddress", "targetHost", ")", "{", "this", ".", "targetHost", "=", "targetHost", ";", "}", "public", "void", "setTargetPort", "(", "int", "targetPort", ")", "{", "this", ".", "targetPort", "=", "targetPort", ";", "}", "public", "void", "run", "(", ")", "{", "try", "{", "listen", "(", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "Logger", ".", "getLogger", "(", "MinecraftProxyServer", ".", "class", ".", "getName", "(", ")", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "null", ",", "ex", ")", ";", "}", "}", "}", "</s>" ]
899
[ "<s>", "package", "com", ".", "sk89q", ".", "minerhat", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "net", ".", "InetAddress", ";", "import", "java", ".", "net", ".", "UnknownHostException", ";", "import", "java", ".", "util", ".", "logging", ".", "Formatter", ";", "import", "java", ".", "util", ".", "logging", ".", "Handler", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "javax", ".", "swing", ".", "UIManager", ";", "import", "javax", ".", "swing", ".", "UnsupportedLookAndFeelException", ";", "import", "jline", ".", "ConsoleReader", ";", "public", "class", "MinerHat", "{", "private", "static", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "MinerHat", ".", "class", ".", "getName", "(", ")", ")", ";", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "IOException", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", ")", ";", "Logger", "rootLogger", "=", "Logger", ".", "getLogger", "(", "\"\"", ")", ";", "Formatter", "formatter", "=", "new", "SimpleLoggerFormatter", "(", ")", ";", "for", "(", "Handler", "handler", ":", "rootLogger", ".", "getHandlers", "(", ")", ")", "{", "handler", ".", "setFormatter", "(", "formatter", ")", ";", "}", "try", "{", "UIManager", ".", "setLookAndFeel", "(", "UIManager", ".", "getSystemLookAndFeelClassName", "(", ")", ")", ";", "}", "catch", "(", "ClassNotFoundException", "ex", ")", "{", "}", "catch", "(", "InstantiationException", "ex", ")", "{", "}", "catch", "(", "IllegalAccessException", "ex", ")", "{", "}", "catch", "(", "UnsupportedLookAndFeelException", "ex", ")", "{", "}", "MinecraftProxyServer", "server", "=", "null", ";", "try", "{", "server", "=", "new", "MinecraftProxyServer", "(", "1111", ",", "InetAddress", ".", "getLocalHost", "(", ")", ",", "25565", ")", ";", "}", "catch", "(", "UnknownHostException", "ex", ")", "{", "logger", ".", "severe", "(", "\"\"", ")", ";", "System", ".", "exit", "(", "1", ")", ";", "return", ";", "}", "(", "new", "Thread", "(", "server", ")", ")", ".", "start", "(", ")", ";", "ConsoleReader", "reader", "=", "new", "ConsoleReader", "(", ")", ";", "String", "line", ";", "while", "(", "(", "line", "=", "reader", ".", "readLine", "(", "\">", "\"", ")", ")", "!=", "null", ")", "{", "String", "[", "]", "parts", "=", "line", ".", "split", "(", "\"", "\"", ")", ";", "if", "(", "parts", "[", "0", "]", ".", "equalsIgnoreCase", "(", "\"host\"", ")", ")", "{", "if", "(", "parts", ".", "length", "==", "2", ")", "{", "try", "{", "server", ".", "setTargetHost", "(", "InetAddress", ".", "getByName", "(", "parts", "[", "1", "]", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\"Host", "set", "to", "\"", "+", "parts", "[", "1", "]", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "parts", "[", "1", "]", ")", ";", "}", "}", "else", "{", "System", ".", "out", ".", "println", "(", "\"host", "<host>\"", ")", ";", "}", "}", "else", "if", "(", "parts", "[", "0", "]", ".", "equalsIgnoreCase", "(", "\"port\"", ")", ")", "{", "if", "(", "parts", ".", "length", "==", "2", ")", "{", "try", "{", "server", ".", "setTargetPort", "(", "Integer", ".", "parseInt", "(", "parts", "[", "1", "]", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\"Port", "set", "to", "\"", "+", "parts", "[", "1", "]", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "parts", "[", "1", "]", ")", ";", "}", "}", "else", "{", "System", ".", "out", ".", "println", "(", "\"port", "<port>\"", ")", ";", "}", "}", "else", "if", "(", "parts", "[", "0", "]", ".", "equalsIgnoreCase", "(", "\"quit\"", ")", ")", "{", "System", ".", "exit", "(", "0", ")", ";", "}", "else", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "}", "}", "}", "</s>" ]