blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
39f6aec6d297aef24e06b19342b1a475c81896f6 | b1262013febdaad2395fac8d230e7f8d6fd6eea0 | /stream-cursor/cursor-store/src/main/java/com/backbase/stream/cursor/configuration/CursorStoreConfiguration.java | 2b45cc166a8949a381df1a967197282822127f10 | [] | no_license | sgkale/stream-services-2.0 | c037cc51b61878f8a308df8004aad538ea0b0f90 | 88ad2b5ca2ecdbb082dcdc07ea4b330617976c46 | refs/heads/master | 2023-07-13T10:25:05.060866 | 2021-08-12T08:21:16 | 2021-08-12T08:21:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 318 | java | package com.backbase.stream.cursor.configuration;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.r2dbc.repository.config.EnableR2dbcRepositories;
/**
* Cursor Source Configuration.
*/
@Configuration
@EnableR2dbcRepositories
public class CursorStoreConfiguration {
}
| [
"bartv@backbase.com"
] | bartv@backbase.com |
f516e124b29af385089d0cb256c53aea4261e8b8 | 4c24b8da0d96c021c6e0c55fa97cb58c1bd7e8f4 | /src.archive.2/search/TheShuttles.java | d7e22b17707a7b02c6b53693cae43cda453227b7 | [] | no_license | TankaiHub/topc | ee80fa1c5fd85372a0b2cf65a0c22096ec19a5ad | bdac19df8df6847e9fcb6e138ad9ac5d9d77ae5e | refs/heads/master | 2023-03-15T22:00:06.612099 | 2016-03-30T06:15:05 | 2016-03-30T06:15:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 982 | java | package topc.search;
import java.util.*;
import java.io.*;
// SRM 600 Division II Level One - 250
// simple search, iteration
// statement: http://community.topcoder.com/stat?c=problem_statement&pm=12824&rd=15712
// editorial: http://apps.topcoder.com/wiki/display/tc/SRM+600
public class TheShuttles {
public int getLeastCost(int[] cnt, int baseCost, int seatCost) {
int best = Integer.MAX_VALUE;
for (int seats = 1; seats < 200; seats++) {
best = Math.min(best, cost(cnt, baseCost, seatCost, seats));
}
return best;
}
private int cost(int[] cnt, int base, int seat, int seats) {
int sum = 0;
int sh = base + seats * seat;
for (int i = 0; i < cnt.length; i++) {
int x = cnt[i] / seats + (cnt[i] % seats == 0 ? 0 : 1);
sum += x * sh;
}
return sum;
}
private void debug(Object... os) {
System.out.println(Arrays.deepToString(os));
}
}
| [
"gabesoft@gmail.com"
] | gabesoft@gmail.com |
9308c89936bf615f307913e6dd5c57194b9d9e7a | 40fa0d75404cc3fc79193dd5c97bedd5e2acef4b | /CodeChef June Long 2020/PRICECON.java | 4ab440961efaed7d832c264e71f7197e0ba4b03e | [] | no_license | johhnsnoow/CodeChef | 745f78706bb2c81e6d2cf1d8079be7f7f317cf4e | 133eea9e8d526118fdf57426c28b1a509506a2cb | refs/heads/master | 2022-11-07T12:07:35.850394 | 2020-06-24T09:13:33 | 2020-06-24T09:13:33 | 274,624,717 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,897 | java | import java.util.*;
import java.io.*;
import java.lang.*;
class Codechef
{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new
InputStreamReader(System.in));
}
String next()
{
while (st == null || !st.hasMoreElements())
{
try
{
st = new StringTokenizer(br.readLine());
}
catch (IOException e)
{
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt()
{
return Integer.parseInt(next());
}
long nextLong()
{
return Long.parseLong(next());
}
double nextDouble()
{
return Double.parseDouble(next());
}
String nextLine()
{
String str = "";
try
{
str = br.readLine();
}
catch (IOException e)
{
e.printStackTrace();
}
return str;
}
}
public static void main(String args[])
{
FastReader sc=new FastReader();
PrintWriter pr= new PrintWriter(System.out);
int t = sc.nextInt();
while(t-->0)
{
int n = sc.nextInt();
long k = sc.nextLong();
long count = 0;
for(int i=0;i<n;i++)
{
long temp = sc.nextLong();
if(temp>k)
{
count=count+(temp-k);
}
}
pr.println(count);
}
pr.flush();
}
}
| [
"johhnsnoow@gmail.com"
] | johhnsnoow@gmail.com |
942ee8eb58c2f80a0875bd2b4233e5f6a1bc7257 | 25ed3721842a67d8a84b989b1b52159a851bdde9 | /src/main/java/com/bupt/smbms/dao/user/UserDaoImpl.java | 9a5055175a4562c2f6bcb1ca526d8e64c3f525f4 | [] | no_license | henuliulei/smbms_javaweb | 4644c84fd2861b812373f25648192c69193749f2 | fe31f8ede9d5727bdbba7079706655579574a911 | refs/heads/master | 2023-03-24T22:18:54.574877 | 2021-03-25T15:34:06 | 2021-03-25T15:34:06 | 351,475,566 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,780 | java | package com.bupt.smbms.dao.user;
import com.bupt.smbms.dao.BaseDao;
import com.bupt.smbms.pojo.User;
import com.mysql.cj.util.StringUtils;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
public class UserDaoImpl implements UserDao{
@Override
public User getLoginUser(Connection connection, String userCode) {
PreparedStatement pstm = null;
ResultSet rs = null;
User user = null;
if(connection != null){
String sql = "select * from smbms_user where userCode=?";
Object[] params = {userCode};
rs = BaseDao.execute(connection, pstm, sql, rs, params);
try {
while (rs.next()){
user = new User();
user.setId(rs.getInt("id"));
user.setUserCode(rs.getString("userCode"));
user.setUserName(rs.getString("userName"));
user.setUserPassword(rs.getString("userPassword"));
user.setGender(rs.getInt("gender"));
user.setBirthday(rs.getDate("birthday"));
user.setPhone(rs.getString("phone"));
user.setAddress(rs.getString("address"));
user.setUserRole(rs.getInt("userRole"));
user.setCreatedBy(rs.getInt("createdBy"));
user.setCreationDate(rs.getTimestamp("creationDate"));
user.setModifyBy(rs.getInt("modifyBy"));
user.setModifyDate(rs.getTimestamp("modifyDate"));
}
BaseDao.closeResource(connection,pstm,rs);
} catch (SQLException throwables) {
throwables.printStackTrace();
}
}
return user;
}
@Override
public int updatePwd(Connection connection, int id, String pwd) {
int flag = 0;
PreparedStatement pstm = null;
if(connection != null){
Object[] params = {pwd,id};
String sql = "update smbms_user set userPassword = ? where id = ?";
flag = BaseDao.execute(connection,pstm,sql,params);
BaseDao.closeResource(connection,pstm,null);
}
return flag;
}
@Override
public int modify(Connection connection, User user) throws Exception {
int flag = 0;
PreparedStatement pstm = null;
if (null != connection) {
String sql = "update smbms_user set userName=?," +
"gender=?,birthday=?,phone=?,address=?,userRole=?,modifyBy=?,modifyDate=? where id = ? ";
Object[] params = {user.getUserName(), user.getGender(), user.getBirthday(),
user.getPhone(), user.getAddress(), user.getUserRole(), user.getModifyBy(),
user.getModifyDate(), user.getId()};
flag = BaseDao.execute(connection, pstm, sql, params);
BaseDao.closeResource(null, pstm, null);
}
return flag;
}
@Override
public User getUserById(Connection connection, String id) throws Exception {
User user = null;
PreparedStatement pstm = null;
ResultSet rs = null;
if (null != connection) {
String sql = "select u.*,r.roleName as userRoleName from smbms_user u,smbms_role r where u.id=? and u.userRole = r.id";
Object[] params = {id};
rs = BaseDao.execute(connection, pstm, sql, rs,params);
if (rs.next()) {
user = new User();
user.setId(rs.getInt("id"));
user.setUserCode(rs.getString("userCode"));
user.setUserName(rs.getString("userName"));
user.setUserPassword(rs.getString("userPassword"));
user.setGender(rs.getInt("gender"));
user.setBirthday(rs.getDate("birthday"));
user.setPhone(rs.getString("phone"));
user.setAddress(rs.getString("address"));
user.setUserRole(rs.getInt("userRole"));
user.setCreatedBy(rs.getInt("createdBy"));
user.setCreationDate(rs.getTimestamp("creationDate"));
user.setModifyBy(rs.getInt("modifyBy"));
user.setModifyDate(rs.getTimestamp("modifyDate"));
user.setUserRoleName(rs.getString("userRoleName"));
}
BaseDao.closeResource(null, pstm, rs);
}
System.out.println(user);
return user;
}
@Override
public int deleteUserById(Connection connection, Integer delId) throws Exception {
PreparedStatement pstm = null;
int flag = 0;
if (null != connection) {
String sql = "delete from smbms_user where id=?";
Object[] params = {delId};
flag = BaseDao.execute(connection, pstm, sql, params);
BaseDao.closeResource(null, pstm, null);
}
return flag;
}
@Override
public int add(Connection connection, User user) {
PreparedStatement pstm = null;
int updateRows = 0;
if (null != connection) {
String sql = "insert into smbms_user (userCode,userName,userPassword," +
"userRole,gender,birthday,phone,address,creationDate,createdBy) " +
"values(?,?,?,?,?,?,?,?,?,?)";
Object[] params = {user.getUserCode(), user.getUserName(), user.getUserPassword(),
user.getUserRole(), user.getGender(), user.getBirthday(),
user.getPhone(), user.getAddress(), user.getCreationDate(), user.getCreatedBy()};
updateRows = BaseDao.execute(connection, pstm, sql, params);
BaseDao.closeResource(null, pstm, null);
}
return updateRows;
}
//查询用户总数
@Override
public int getUserCount(Connection connection, String username, int userRole) throws Exception {
PreparedStatement pstm = null;
ResultSet rs = null;
int count = 0;
if(connection != null){
StringBuffer sb = new StringBuffer();
sb.append("select count(1) as count from smbms_user u,smbms_role r where u.userRole = r.id");
List<Object> list = new ArrayList<>();
if(!StringUtils.isNullOrEmpty(username)){
sb.append(" and u.userName like ?");
list.add("%" +username+ "%");
}
if(userRole > 0){
sb.append(" and u.userRole = ?");
list.add(userRole);
}
Object[] params = list.toArray();
rs= BaseDao.execute(connection, pstm,sb.toString(),rs,params);
if(rs.next()){
count = rs.getInt("count");
}
BaseDao.closeResource(null,pstm,rs);
}
return count;
}
@Override
public List<User> getUserList(Connection connection, String userName, int userRole, int currentPageNo, int pageSize) throws SQLException {
PreparedStatement pstm= null;
ResultSet rs = null;
List<User> userlist = new ArrayList<>();
if(connection != null){
StringBuffer sql = new StringBuffer();
sql.append("select u.*,r.roleName as userRoleName from smbms_user u,smbms_role r where u.userRole = r.id");
List<Object> list = new ArrayList<>();
if(!StringUtils.isNullOrEmpty(userName)){
sql.append(" and u.username like ?");
list.add("%" +userName+ "%");
}
if(userRole > 0){
sql.append(" and u.userRole = ?");
list.add(userRole);
}
sql.append(" order by creationDate DESC limit ?,?");
currentPageNo = (currentPageNo - 1)*pageSize;
list.add(currentPageNo);
list.add(pageSize);
Object[] params = list.toArray();
rs = BaseDao.execute(connection, pstm,sql.toString(), rs, params);
while (rs.next()){
User _user = new User();
_user.setId(rs.getInt("id"));
_user.setUserCode(rs.getString("userCode"));
_user.setUserName(rs.getString("userName"));
_user.setGender(rs.getInt("gender"));
_user.setBirthday(rs.getDate("birthday"));
_user.setPhone(rs.getString("phone"));
_user.setUserRole(rs.getInt("userRole"));
_user.setUserRoleName(rs.getString("userRoleName"));
userlist.add(_user);
}
BaseDao.closeResource(null,pstm,rs);
}
return userlist;
}
}
| [
"1957598452@qq.com"
] | 1957598452@qq.com |
f0e92c226586b6f891a88ee9d0613cb08c2e3bfb | a611272f782de861091deca4ddabf0d7817f1c65 | /src/test/java/com/bankaccount/demo/MyBankAppTests.java | 4eb5da6f0820257c531e07a6052a79516525d9be | [] | no_license | LukaszP12/Bankaccount | 1eb0876606dbfa57e21df73be8555e369a5a75d1 | 3183b080cbdf8ca343a9b6c3dc4c9e23745e46bc | refs/heads/master | 2022-08-19T10:26:57.685705 | 2020-05-23T17:28:14 | 2020-05-23T17:28:14 | 266,386,015 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 204 | java | package com.bankaccount.demo;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class MyBankAppTests {
@Test
void contextLoads() {
}
}
| [
"lukaszp4@onet.eu"
] | lukaszp4@onet.eu |
43738ea7fb9a0a21d359773bc8f80b60fb69c4bb | 457421b32ac6bd265d3b410b95f6797565a65030 | /app/src/main/java/app/com/worldofwealth/utils/Config.java | 4f4c246c6e1f68ffc213ca557f42e9e0c61e76df | [] | no_license | Lion-India/myvoice | 138538c6cfd1a0f4f9532c6de0087137d714c63c | 40c963eb7d0c1cda93249edb41d6dc3afadfac96 | refs/heads/master | 2022-12-28T11:12:52.459227 | 2020-10-14T07:45:14 | 2020-10-14T07:45:14 | 295,475,433 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 820 | java | package app.com.worldofwealth.utils;
import android.content.Context;
/**
* Created by Mahi on 11/5/2016.
*/
public final class Config {
// global topic to receive app wide push notifications
public static void setContext(Context applicationContext) {
}
// global topic to receive app wide push notifications
public static final String TOPIC_GLOBAL = "global";
// broadcast receiver intent filters
public static final String REGISTRATION_COMPLETE = "registrationComplete";
public static final String PUSH_NOTIFICATION = "pushNotification";
// id to handle the notification in the notification tray
public static final int NOTIFICATION_ID = 100;
public static final int NOTIFICATION_ID_BIG_IMAGE = 101;
public static final String SHARED_PREF = "ah_firebase";
}
| [
"sathish@naberly.com"
] | sathish@naberly.com |
9b9308951f84b41e774fa3fd0c453940a33bc964 | a0a60959890c194e08840a985575f71fb4787816 | /src/model/command/turtle/PenCommandNode.java | a2b08caa83a14baf3f2652bacb4d6b6d1d717148 | [] | no_license | rosspcahoon/slogo | 453f260584cfd6e45520b5651e21aa802d3d9134 | 7530b59918d8a0debb2a72a7d3d21e57a5136a4c | refs/heads/master | 2020-04-17T08:30:28.422261 | 2013-03-28T07:37:56 | 2013-03-28T07:37:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,235 | java | package model.command.turtle;
import model.Room;
import model.command.CommandConstants;
import model.command.CommandNode;
/**
* Node representing a penup, pendown, or penstatus query command (default penstatus)
* @author james
*
*/
public class PenCommandNode extends CommandNode {
public PenCommandNode() {
super();
super.setMyExpectedArgs(CommandConstants.COMMAND_EXPECTED_ARGS_ZERO);
}
@Override
public CommandNode getCopyOfInstance () {
return new PenCommandNode();
}
@Override
public int resolve () throws Exception {
Room room = getMyRoom();
if (getMyString().equals(CommandConstants.COMMAND_NAME_PENDOWN)) {
room.getTurtle().setPenStatus(true);
return CommandConstants.COMMAND_RETURN_TRUE;
} else if (getMyString().equals(CommandConstants.COMMAND_NAME_PENUP)) {
room.getTurtle().setPenStatus(false);
return CommandConstants.COMMAND_RETURN_FALSE;
} else {
if (room.getTurtle().getPenStatus()) {
return CommandConstants.COMMAND_RETURN_TRUE;
} else {
return CommandConstants.COMMAND_RETURN_FALSE;
}
}
}
}
| [
"james@LAZNMACHINE.(none)"
] | james@LAZNMACHINE.(none) |
513356b28d2e7b49db2bfd1c11bd40082b1b764f | a4b3a95a5cd12cb1ec8bfca7b4b3ff954ada6ec5 | /TeamCode/src/main/java/org/firstinspires/ftc/teamcode/ServoTeleop.java | 0cf24a1939c72456a7cd10ae7d97f877caee20ec | [
"BSD-3-Clause"
] | permissive | FTC12030-BrainStorm/ftc_app | dc20edf30ae27f8d97f155fb4aaeab222a123840 | d34cdf5dae2cfba0cd0dc1c65b015b1f7a6381aa | refs/heads/master | 2021-01-11T06:53:07.330209 | 2017-12-10T09:26:01 | 2017-12-10T09:26:01 | 72,377,088 | 0 | 0 | null | 2016-10-30T21:38:13 | 2016-10-30T21:38:13 | null | UTF-8 | Java | false | false | 6,617 | java | /*
Copyright (c) 2016 Robert Atkinson
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted (subject to the limitations in the disclaimer below) provided that
the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
Neither the name of Robert Atkinson nor the names of his contributors may be used to
endorse or promote products derived from this software without specific prior
written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS
LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESSFOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.Servo;
import com.qualcomm.robotcore.util.ElapsedTime;
/**
* This file contains an example of an iterative (Non-Linear) "OpMode".
* An OpMode is a 'program' that runs in either the autonomous or the teleop period of an FTC match.
* The names of OpModes appear on the menu of the FTC Driver Station.
* When an selection is made from the menu, the corresponding OpMode
* class is instantiated on the RobotOther Controller and executed.
*
* This particular OpMode just executes a basic Tank Drive Teleop for a PushBot
* It includes all the skeletal structure that all iterative OpModes contain.
*
* Use Android Studios to Copy this Class, and Paste it into your team's code folder with a new name.
* Remove or comment out the @Disabled line to add this opmode to the Driver Station OpMode list
*/
@TeleOp(name="ServoTeleOp", group="Iterative Opmode") // @Autonomous(...) is the other common choice
public class ServoTeleop extends OpMode
{
/* Declare OpMode members. */
private ElapsedTime runtime = new ElapsedTime();
// private DcMotor leftMotor = null;
// private DcMotor rightMotor = null;
// DcMotor shooterMotor = null;
/*
* Code to run ONCE when the driver hits INIT
*/
@Override
public void init() {
telemetry.addData("Status", "Initialized");
/* eg: Initialize the hardware variables. Note that the strings used here as parameters
* to 'get' must correspond to the names assigned during the robot configuration
* step (using the FTC RobotOther Controller app on the phone).
*/
// leftMotor = hardwareMap.dcMotor.get("left_drive");
// rightMotor = hardwareMap.dcMotor.get("right_drive");
// RobotOther.leftDriveMotor = hardwareMap.dcMotor.get("left_drive");
// RobotOther.rightDriveMotor = hardwareMap.dcMotor.get("right_drive");
//
// RobotOther.leftDriveMotor.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
// RobotOther.rightDriveMotor.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
RobotOther.catapultServo = hardwareMap.servo.get("catapult_servo");
// shooterMotor = hardwareMap.dcMotor.get("shooter_motor");
// eg: Set the drive motor directions:
// Reverse the motor that runs backwards when connected directly to the battery
// leftMotor.setDirection(DcMotor.Direction.FORWARD); // Set to REVERSE if using AndyMark motors
// rightMotor.setDirection(DcMotor.Direction.REVERSE);// Set to FORWARD if using AndyMark motors
// telemetry.addData("Status", "Initialized");
}
/*
* Code to run REPEATEDLY after the driver hits INIT, but before they hit PLAY
*/
@Override
public void init_loop() {
}
/*
* Code to run ONCE when the driver hits PLAY
*/
@Override
public void start() {
runtime.reset();
}
/*
* Code to run REPEATEDLY after the driver hits PLAY but before they hit STOP
*/
@Override
public void loop() {
// telemetry.addData("Status", "Running: " + runtime.toString());
// telemetry.addData("Gamepad 1 Status Data", gamepad1.toString());
// telemetry.addData("Gamepad 2 Status Data", gamepad2.toString());
// telemetry.addData("Left Drive Motor getController", RobotOther.leftDriveMotor.getController());
// telemetry.addData("Left Drive Motor getPower", RobotOther.leftDriveMotor.getPower());
// telemetry.addData("Right Drive Motor getController", RobotOther.rightDriveMotor.getController());
// telemetry.addData("Right Drive Motor getPower", RobotOther.rightDriveMotor.getPower());
// eg: Run wheels in tank mode (note: The joystick goes negative when pushed forwards)
// leftMotor.setPower(-gamepad1.left_stick_y);
// rightMotor.setPower(-gamepad1.right_stick_y);
// RobotOther.leftDriveMotor.setPower(gamepad1.left_stick_y);
// RobotOther.rightDriveMotor.setPower(-gamepad1.right_stick_y);
RobotOther.catapultServo.setDirection(Servo.Direction.valueOf("FORWARD"));
if (gamepad1.dpad_right) {
RobotOther.catapultServo.setPosition(0);
} else if (gamepad1.dpad_up) {
RobotOther.catapultServo.setPosition(.25);
} else if (gamepad1.dpad_left) {
RobotOther.catapultServo.setPosition(.50);
} else if (gamepad1.dpad_down) {
RobotOther.catapultServo.setPosition(.75);
}
/* if (gamepad2.dpad_down) {
shooterMotor.setPower(.5);
}
if (gamepad2.dpad_up) {
shooterMotor.setPower(1.0);
}*/
}
/*
* Code to run ONCE after the driver hits STOP
*/
@Override
public void stop() {
}
}
| [
"HurricaneRoboticsFTC@gmail.com"
] | HurricaneRoboticsFTC@gmail.com |
1fa3f34a70bc7eb068144d380bc0c3267f75ecac | ce342d8c0f302211415d8efdece536a09aca905b | /MobileClickersDroid/src/gr/academic/city/msc/industrial/mobileclickers/AnswerQuestionActivity.java | 6b55aa67b7542397f5047314d194c75ddff31afb | [] | no_license | Tamarkeks/mobileclickers | 83e9fd062b57792770a99039e9ba2b3ccda0bd75 | b0683e61c11e096a1cbc4798cfba798df3cf1f38 | refs/heads/master | 2021-01-01T03:47:31.299649 | 2012-02-03T11:39:58 | 2012-02-03T11:39:58 | 57,590,423 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,422 | java | package gr.academic.city.msc.industrial.mobileclickers;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.RadioButton;
import android.widget.RadioGroup;
public class AnswerQuestionActivity extends Activity {
public static final String NUMBER_OF_ANSWERS_EXTRAS = "number_of_answers";
public static final String QUESTION_CODE = "question_code";
private String questionCode;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.answer_question);
handleIntent(getIntent());
}
private void handleIntent(Intent intent) {
int numberOfAnswers = intent.getExtras().getInt(NUMBER_OF_ANSWERS_EXTRAS);
questionCode = intent.getExtras().getString(QUESTION_CODE);
RadioGroup radioGroup = (RadioGroup) findViewById(R.id.answers_radio_button_group);
char c = 'A';
for (int i = 0; i < numberOfAnswers; i++) {
RadioButton radioButton = new RadioButton(getApplicationContext());
radioButton.setId(c);
radioButton.setText(c++);
radioButton.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
radioGroup.addView(radioButton);
}
}
public void submitAnswer(View v) {
//submit answer
}
}
| [
"finger.k4@gmail.com"
] | finger.k4@gmail.com |
7a0e29f9f5d9ba207d98db67926353e605d418e0 | 75bad44778ecc8fd5e4e7487fd2198cfb852a221 | /app/src/main/java/com/example/windows/debcart/Cart.java | 3f975afaa9693e67d6e5657ccdc77f2dcbe307db | [] | no_license | dips25/CentrosKart | e5ceb4e7429f8a12f13170ebfed2e75130048bae | 017ea94757c036d77c4a1be3bff88efc9135c757 | refs/heads/master | 2021-01-20T12:41:45.243519 | 2017-05-05T16:04:29 | 2017-05-05T16:04:29 | 90,393,696 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,248 | java | package com.example.windows.debcart;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
/**
* A representation of shopping cart.
* <p/>
* A shopping cart has a map of {@link Saleable} products to their corresponding quantities.
*/
public class Cart implements Serializable {
private static final long serialVersionUID = 42L;
private Map<Saleable, Integer> cartItemMap = new HashMap<Saleable, Integer>();
private BigDecimal totalPrice = BigDecimal.ZERO;
private int totalQuantity = 0;
/**
* Add a quantity of a certain {@link Saleable} product to this shopping cart
*
* @param sellable the product will be added to this shopping cart
* @param quantity the amount to be added
*/
public void add(final Saleable sellable, int quantity) {
if (cartItemMap.containsKey(sellable)) {
cartItemMap.put(sellable, cartItemMap.get(sellable) + quantity);
} else {
cartItemMap.put(sellable, quantity);
}
totalPrice = totalPrice.add(sellable.getPrice().multiply(BigDecimal.valueOf(quantity)));
totalQuantity += quantity;
}
/**
* Set new quantity for a {@link Saleable} product in this shopping cart
*
* @param sellable the product which quantity will be updated
* @param quantity the new quantity will be assigned for the product
* @throws ProductNotFoundException if the product is not found in this shopping cart.
* @throws QuantityOutOfRangeException if the quantity is negative
*/
public void update(final Saleable sellable, int quantity) throws ProductNotFoundException, QuantityOutOfRangeException {
if (!cartItemMap.containsKey(sellable)) throw new ProductNotFoundException();
if (quantity < 0)
throw new QuantityOutOfRangeException(quantity + " is not a valid quantity. It must be non-negative.");
int productQuantity = cartItemMap.get(sellable);
BigDecimal productPrice = sellable.getPrice().multiply(BigDecimal.valueOf(productQuantity));
cartItemMap.put(sellable, quantity);
totalQuantity = totalQuantity - productQuantity + quantity;
totalPrice = totalPrice.subtract(productPrice).add(sellable.getPrice().multiply(BigDecimal.valueOf(quantity)));
}
/**
* Remove a certain quantity of a {@link Saleable} product from this shopping cart
*
* @param sellable the product which will be removed
* @param quantity the quantity of product which will be removed
* @throws ProductNotFoundException if the product is not found in this shopping cart
* @throws QuantityOutOfRangeException if the quantity is negative or more than the existing quantity of the product in this shopping cart
*/
public void remove(final Saleable sellable, int quantity) throws ProductNotFoundException, QuantityOutOfRangeException {
if (!cartItemMap.containsKey(sellable)) throw new ProductNotFoundException();
int productQuantity = cartItemMap.get(sellable);
if (quantity < 0 || quantity > productQuantity)
throw new QuantityOutOfRangeException(quantity + " is not a valid quantity. It must be non-negative and less than the current quantity of the product in the shopping cart.");
if (productQuantity == quantity) {
cartItemMap.remove(sellable);
} else {
cartItemMap.put(sellable, productQuantity - quantity);
}
totalPrice = totalPrice.subtract(sellable.getPrice().multiply(BigDecimal.valueOf(quantity)));
totalQuantity -= quantity;
}
/**
* Remove a {@link Saleable} product from this shopping cart totally
*
* @param sellable the product to be removed
* @throws ProductNotFoundException if the product is not found in this shopping cart
*/
public void remove(final Saleable sellable) throws ProductNotFoundException {
if (!cartItemMap.containsKey(sellable)) throw new ProductNotFoundException();
int quantity = cartItemMap.get(sellable);
cartItemMap.remove(sellable);
totalPrice = totalPrice.subtract(sellable.getPrice().multiply(BigDecimal.valueOf(quantity)));
totalQuantity -= quantity;
}
/**
* Remove all products from this shopping cart
*/
public void clear() {
cartItemMap.clear();
totalPrice = BigDecimal.ZERO;
totalQuantity = 0;
}
/**
* Get quantity of a {@link Saleable} product in this shopping cart
*
* @param sellable the product of interest which this method will return the quantity
* @return The product quantity in this shopping cart
* @throws ProductNotFoundException if the product is not found in this shopping cart
*/
public int getQuantity(final Saleable sellable) throws ProductNotFoundException {
if (!cartItemMap.containsKey(sellable)) throw new ProductNotFoundException();
return cartItemMap.get(sellable);
}
/**
* Get total cost of a {@link Saleable} product in this shopping cart
*
* @param sellable the product of interest which this method will return the total cost
* @return Total cost of the product
* @throws ProductNotFoundException if the product is not found in this shopping cart
*/
public BigDecimal getCost(final Saleable sellable) throws ProductNotFoundException {
if (!cartItemMap.containsKey(sellable)) throw new ProductNotFoundException();
return sellable.getPrice().multiply(BigDecimal.valueOf(cartItemMap.get(sellable)));
}
/**
* Get total price of all products in this shopping cart
*
* @return Total price of all products in this shopping cart
*/
public BigDecimal getTotalPrice() {
return totalPrice;
}
/**
* Get total quantity of all products in this shopping cart
*
* @return Total quantity of all products in this shopping cart
*/
public int getTotalQuantity() {
return totalQuantity;
}
/**
* Get set of products in this shopping cart
*
* @return Set of {@link Saleable} products in this shopping cart
*/
public Set<Saleable> getProducts() {
return cartItemMap.keySet();
}
/**
* Get a map of products to their quantities in the shopping cart
*
* @return A map from product to its quantity in this shopping cart
*/
public Map<Saleable, Integer> getItemWithQuantity() {
Map<Saleable, Integer> cartItemMap = new HashMap<Saleable, Integer>();
cartItemMap.putAll(this.cartItemMap);
return cartItemMap;
}
@Override
public String toString() {
StringBuilder strBuilder = new StringBuilder();
for (Entry<Saleable, Integer> entry : cartItemMap.entrySet()) {
strBuilder.append(String.format("Product: %s, Unit Price: %f, Quantity: %d%n", entry.getKey().getName(), entry.getKey().getPrice(), entry.getValue()));
}
strBuilder.append(String.format("Total Quantity: %d, Total Price: %f", totalQuantity, totalPrice));
return strBuilder.toString();
}
}
| [
"Dipanjan Biswas"
] | Dipanjan Biswas |
8415c8fa33587d63cfb9a6d881668e0a19ec40b6 | 1ef34c12c9672582fe470185c58400b784c925a9 | /app/build/generated/source/r/debug/com/google/android/gms/R.java | cf2d2eed09d8962e2e8dc43f4b3618a9fd1814c5 | [] | no_license | edyedy123/Fit-Friends-App | 33e2f08803f01fe5cf39d915a6b487739bee52cf | ec96528dbe7a5217fc4aabd707a81f0399c76f80 | refs/heads/master | 2021-04-09T15:26:50.837190 | 2018-03-16T23:36:16 | 2018-03-16T23:36:16 | 125,580,396 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,646 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package com.google.android.gms;
public final class R {
public static final class attr {
public static final int buttonSize = 0x7f040042;
public static final int circleCrop = 0x7f04004a;
public static final int colorScheme = 0x7f04005f;
public static final int imageAspectRatio = 0x7f0400a8;
public static final int imageAspectRatioAdjust = 0x7f0400a9;
public static final int scopeUris = 0x7f04011e;
}
public static final class color {
public static final int common_google_signin_btn_text_dark = 0x7f06002a;
public static final int common_google_signin_btn_text_dark_default = 0x7f06002b;
public static final int common_google_signin_btn_text_dark_disabled = 0x7f06002c;
public static final int common_google_signin_btn_text_dark_focused = 0x7f06002d;
public static final int common_google_signin_btn_text_dark_pressed = 0x7f06002e;
public static final int common_google_signin_btn_text_light = 0x7f06002f;
public static final int common_google_signin_btn_text_light_default = 0x7f060030;
public static final int common_google_signin_btn_text_light_disabled = 0x7f060031;
public static final int common_google_signin_btn_text_light_focused = 0x7f060032;
public static final int common_google_signin_btn_text_light_pressed = 0x7f060033;
}
public static final class drawable {
public static final int common_full_open_on_phone = 0x7f08005d;
public static final int common_google_signin_btn_icon_dark = 0x7f08005e;
public static final int common_google_signin_btn_icon_dark_disabled = 0x7f08005f;
public static final int common_google_signin_btn_icon_dark_focused = 0x7f080060;
public static final int common_google_signin_btn_icon_dark_normal = 0x7f080061;
public static final int common_google_signin_btn_icon_dark_pressed = 0x7f080062;
public static final int common_google_signin_btn_icon_light = 0x7f080063;
public static final int common_google_signin_btn_icon_light_disabled = 0x7f080064;
public static final int common_google_signin_btn_icon_light_focused = 0x7f080065;
public static final int common_google_signin_btn_icon_light_normal = 0x7f080066;
public static final int common_google_signin_btn_icon_light_pressed = 0x7f080067;
public static final int common_google_signin_btn_text_dark = 0x7f080068;
public static final int common_google_signin_btn_text_dark_disabled = 0x7f080069;
public static final int common_google_signin_btn_text_dark_focused = 0x7f08006a;
public static final int common_google_signin_btn_text_dark_normal = 0x7f08006b;
public static final int common_google_signin_btn_text_dark_pressed = 0x7f08006c;
public static final int common_google_signin_btn_text_light = 0x7f08006d;
public static final int common_google_signin_btn_text_light_disabled = 0x7f08006e;
public static final int common_google_signin_btn_text_light_focused = 0x7f08006f;
public static final int common_google_signin_btn_text_light_normal = 0x7f080070;
public static final int common_google_signin_btn_text_light_pressed = 0x7f080071;
}
public static final class id {
public static final int adjust_height = 0x7f09001e;
public static final int adjust_width = 0x7f09001f;
public static final int auto = 0x7f090026;
public static final int center = 0x7f090032;
public static final int dark = 0x7f090041;
public static final int email = 0x7f090050;
public static final int icon_only = 0x7f09006c;
public static final int light = 0x7f09007d;
public static final int none = 0x7f090091;
public static final int normal = 0x7f090092;
public static final int radio = 0x7f0900a3;
public static final int standard = 0x7f0900d1;
public static final int text = 0x7f0900d7;
public static final int text2 = 0x7f0900d8;
public static final int toolbar = 0x7f0900e5;
public static final int wide = 0x7f0900f4;
public static final int wrap_content = 0x7f0900f8;
}
public static final class integer {
public static final int google_play_services_version = 0x7f0a0006;
}
public static final class string {
public static final int common_google_play_services_enable_button = 0x7f0e0024;
public static final int common_google_play_services_enable_text = 0x7f0e0025;
public static final int common_google_play_services_enable_title = 0x7f0e0026;
public static final int common_google_play_services_install_button = 0x7f0e0027;
public static final int common_google_play_services_install_text = 0x7f0e0028;
public static final int common_google_play_services_install_title = 0x7f0e0029;
public static final int common_google_play_services_notification_ticker = 0x7f0e002a;
public static final int common_google_play_services_unknown_issue = 0x7f0e002b;
public static final int common_google_play_services_unsupported_text = 0x7f0e002c;
public static final int common_google_play_services_update_button = 0x7f0e002d;
public static final int common_google_play_services_update_text = 0x7f0e002e;
public static final int common_google_play_services_update_title = 0x7f0e002f;
public static final int common_google_play_services_updating_text = 0x7f0e0030;
public static final int common_google_play_services_wear_update_text = 0x7f0e0031;
public static final int common_open_on_phone = 0x7f0e0032;
public static final int common_signin_button_text = 0x7f0e0033;
public static final int common_signin_button_text_long = 0x7f0e0034;
}
public static final class styleable {
public static final int[] LoadingImageView = { 0x7f04004a, 0x7f0400a8, 0x7f0400a9 };
public static final int LoadingImageView_circleCrop = 0;
public static final int LoadingImageView_imageAspectRatio = 1;
public static final int LoadingImageView_imageAspectRatioAdjust = 2;
public static final int[] SignInButton = { 0x7f040042, 0x7f04005f, 0x7f04011e };
public static final int SignInButton_buttonSize = 0;
public static final int SignInButton_colorScheme = 1;
public static final int SignInButton_scopeUris = 2;
}
}
| [
"easorozabal@myseneca.ca"
] | easorozabal@myseneca.ca |
f5e33c93bdf67304dd63e6dfbe7ca1732ba6fd69 | cc69ae4e6042c0ae18e07298768f37f3fce9c8df | /Tinsta_Shared/src/main/java/ir/sharif/math/ap99_2/tinsta_shared/communication_related/model/Communication.java | 86251fc8c11c822dbe2f8452f81ff6a7d1f1306e | [] | no_license | MrSalahshour/Tinsta | e66f2a6e9f5c56bfa0f98c9af2ee3b291b1a6137 | c72e948c14987b92beac16a04e6cc3fab7e0b570 | refs/heads/main | 2023-07-15T18:40:14.052321 | 2021-08-28T11:54:49 | 2021-08-28T11:54:49 | 400,775,914 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,860 | java | package ir.sharif.math.ap99_2.tinsta_shared.communication_related.model;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.voodoodyne.jackson.jsog.JSOGGenerator;
import ir.sharif.math.ap99_2.tinsta_shared.user_info.model.UserName;
import ir.sharif.math.ap99_2.tinsta_shared.user_related.model.User;
import java.io.Serializable;
import java.util.HashMap;
import java.util.LinkedList;
@JsonIdentityInfo(generator = JSOGGenerator.class,
property = "id", scope = Communication.class)
public class Communication implements Serializable {
private Integer userId;
private LinkedList<Integer> followersId;
private LinkedList<Integer> followingsId;
private LinkedList<Integer> blockedUsersId;
private LinkedList<Integer> mutedUsersId;
private HashMap<String, LinkedList<Integer>> userManagement;
public Communication(Integer userId) {
this.userId = userId;
this.followersId = new LinkedList<>();
this.followingsId = new LinkedList<>();
this.blockedUsersId = new LinkedList<>();
this.mutedUsersId = new LinkedList<>();
this.userManagement = new HashMap<>();
}
public Communication() {
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public void setFollowersId(LinkedList<Integer> followersId) {
this.followersId = followersId;
}
public void setFollowingsId(LinkedList<Integer> followingsId) {
this.followingsId = followingsId;
}
public void setBlockedUsersId(LinkedList<Integer> blockedUsersId) {
this.blockedUsersId = blockedUsersId;
}
public void setMutedUsersId(LinkedList<Integer> mutedUsersId) {
this.mutedUsersId = mutedUsersId;
}
public void setUserManagement(HashMap<String, LinkedList<Integer>> userManagement) {
this.userManagement = userManagement;
}
public HashMap<String, LinkedList<Integer>> getUserManagement() {
return userManagement;
}
public Integer getUserId() {
return userId;
}
public LinkedList<Integer> getFollowersId() {
return followersId;
}
public LinkedList<Integer> getFollowingsId() {
return followingsId;
}
public LinkedList<Integer> getBlockedUsersId() {
return blockedUsersId;
}
public LinkedList<Integer> getMutedUsersId() {
return mutedUsersId;
}
public boolean isFollower(User user) {
return this.getFollowersId().contains(user.getId());
}
public boolean isFollowing(User user) {
return this.getFollowingsId().contains(user.getId());
}
public void mute(User user) {
getMutedUsersId().add(user.getId());
}
public void unMute(User user) {
Integer userId = user.getId();
getMutedUsersId().remove(userId);
}
public void createUsersFolder(String usersFolder) {
getUserManagement().put(usersFolder, new LinkedList<>());
}
public void addToFolder(User user, String userFolder) {
Integer userId = user.getId();
if (canAddToFolder(user) && haveUserFolder(userFolder))
getUserManagement().get(userFolder).add(userId);
}
public boolean canAddToFolder(User user) {
for (Integer following : followingsId) {
if (following.equals(user.getId())) {
return true;
}
}
return false;
}
public boolean removeFromFolder(User user, String userFolder) {
Integer userId = user.getId();
if (getUserManagement().get(userFolder).contains(userId)){
getUserManagement().get(userFolder).remove(userId);
return true;
}
return false;
}
public boolean haveUserFolder(String userFolder) {
return userManagement.containsKey(userFolder);
}
}
| [
"salahshour80mahdi@gmail.com"
] | salahshour80mahdi@gmail.com |
9e017f42a530376813b24bbf70855a1ce2a0c3a3 | ffbab2d79f6afd8ca1af36e6ba19ebc661abb2b8 | /com/miui/analytics/internal/policy/l.java | c1b0ed90bd2645a36d8b92016d46b8ebff829504 | [] | no_license | amirzaidi/MIUIAnalytics | a682c69fbd49f2f11711bfe1e44390a9fb304f25 | 950fd3c0fb835cf07c01893e5ce8ce40d7f88edb | refs/heads/master | 2020-03-19T05:33:21.968687 | 2018-06-03T21:49:38 | 2018-06-03T21:49:38 | 135,943,390 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 658 | java | package com.miui.analytics.internal.policy;
import com.miui.analytics.internal.b.h;
import com.miui.analytics.internal.util.o;
import java.util.ArrayList;
import java.util.List;
public class l implements k {
private static final String a = "TriggerPolicy";
private List<k> b = new ArrayList();
public l(List<k> list) {
if (list != null) {
this.b = list;
}
}
public boolean a(h hVar, int i) {
for (k kVar : this.b) {
if (kVar.a(hVar, i)) {
o.a(a, "trigger:" + kVar.getClass().getName());
return true;
}
}
return false;
}
}
| [
"azaidi@live.nl"
] | azaidi@live.nl |
32822509d092408122d7de031b63dd44a2d536d1 | dc856b32d7f01c160fc09c2bb2badbd94c3f9916 | /tests/TestClienteDoBanco.java | d165f613e60d7f7661f63665238bf354cb906fc9 | [] | no_license | luisfrvilela/SistemaBancario | ba5128b5e47b14e29a5878980512bf5b4205f6d0 | 1e0292a1823a9c0587862dc6fe9b6554ade89e90 | refs/heads/master | 2016-09-08T01:29:52.215237 | 2013-10-25T12:21:28 | 2013-10-25T12:21:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,400 | java | package tests;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import modelosDeClasses.ClienteDoBanco;
public class TestClienteDoBanco {
ClienteDoBanco clienteDoBanco;
@Before
public void setUp() throws Exception {
//ClienteDoBanco
clienteDoBanco = new ClienteDoBanco("Cliente", "012.345.678-96" , "1.234.567" , "Possui");
clienteDoBanco.setDeposito(100.0);
clienteDoBanco.setRetirada(20.0);
clienteDoBanco.setSaldo(0.0);
}
//Tests do ClienteDoBanco
@Test
public void testGetNome() {
assertEquals("Cliente",clienteDoBanco.getNome());
}
@Test
public void testGetCpf() {
assertEquals("012.345.678-96",clienteDoBanco.getCpf());
}
@Test
public void testGetRg() {
assertEquals("1.234.567",clienteDoBanco.getRg());
}
@Test
public void testGetComprovanteDeResidencia() {
assertEquals("Possui",clienteDoBanco.getComprovanteDeResidencia());
}
@Test
public void testGetTelefone() {
clienteDoBanco.setTelefone("5555-5555");
assertEquals("5555-5555",clienteDoBanco.getTelefone());
}
@Test
public void testGetDeposito() {
assertEquals(100.0,clienteDoBanco.getDeposito(),0.01);
}
@Test
public void testGetRetirada() {
assertEquals(20.0,clienteDoBanco.getRetirada(),0.01);
}
@Test
public void testSaldoAtual() {
clienteDoBanco.saldoAtual();
assertEquals(80.0,clienteDoBanco.getSaldo(),0.01);
}
}
| [
"luisfrvilela@gmail.com"
] | luisfrvilela@gmail.com |
aed0e46456980d1162c68d16ef0a8d67ac63c43e | bf2966abae57885c29e70852243a22abc8ba8eb0 | /aws-java-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/ListVocabulariesRequest.java | 4e86e944509cca72bf8f87fe9a013b8856f27ea8 | [
"Apache-2.0"
] | permissive | kmbotts/aws-sdk-java | ae20b3244131d52b9687eb026b9c620da8b49935 | 388f6427e00fb1c2f211abda5bad3a75d29eef62 | refs/heads/master | 2021-12-23T14:39:26.369661 | 2021-07-26T20:09:07 | 2021-07-26T20:09:07 | 246,296,939 | 0 | 0 | Apache-2.0 | 2020-03-10T12:37:34 | 2020-03-10T12:37:33 | null | UTF-8 | Java | false | false | 12,740 | java | /*
* Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.transcribe.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.AmazonWebServiceRequest;
/**
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/transcribe-2017-10-26/ListVocabularies" target="_top">AWS API
* Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ListVocabulariesRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {
/**
* <p>
* If the result of the previous request to <code>ListVocabularies</code> was truncated, include the
* <code>NextToken</code> to fetch the next set of jobs.
* </p>
*/
private String nextToken;
/**
* <p>
* The maximum number of vocabularies to return in the response. If there are fewer results in the list, this
* response contains only the actual results.
* </p>
*/
private Integer maxResults;
/**
* <p>
* When specified, only returns vocabularies with the <code>VocabularyState</code> field equal to the specified
* state.
* </p>
*/
private String stateEquals;
/**
* <p>
* When specified, the vocabularies returned in the list are limited to vocabularies whose name contains the
* specified string. The search is not case sensitive, <code>ListVocabularies</code> returns both "vocabularyname"
* and "VocabularyName" in the response list.
* </p>
*/
private String nameContains;
/**
* <p>
* If the result of the previous request to <code>ListVocabularies</code> was truncated, include the
* <code>NextToken</code> to fetch the next set of jobs.
* </p>
*
* @param nextToken
* If the result of the previous request to <code>ListVocabularies</code> was truncated, include the
* <code>NextToken</code> to fetch the next set of jobs.
*/
public void setNextToken(String nextToken) {
this.nextToken = nextToken;
}
/**
* <p>
* If the result of the previous request to <code>ListVocabularies</code> was truncated, include the
* <code>NextToken</code> to fetch the next set of jobs.
* </p>
*
* @return If the result of the previous request to <code>ListVocabularies</code> was truncated, include the
* <code>NextToken</code> to fetch the next set of jobs.
*/
public String getNextToken() {
return this.nextToken;
}
/**
* <p>
* If the result of the previous request to <code>ListVocabularies</code> was truncated, include the
* <code>NextToken</code> to fetch the next set of jobs.
* </p>
*
* @param nextToken
* If the result of the previous request to <code>ListVocabularies</code> was truncated, include the
* <code>NextToken</code> to fetch the next set of jobs.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ListVocabulariesRequest withNextToken(String nextToken) {
setNextToken(nextToken);
return this;
}
/**
* <p>
* The maximum number of vocabularies to return in the response. If there are fewer results in the list, this
* response contains only the actual results.
* </p>
*
* @param maxResults
* The maximum number of vocabularies to return in the response. If there are fewer results in the list, this
* response contains only the actual results.
*/
public void setMaxResults(Integer maxResults) {
this.maxResults = maxResults;
}
/**
* <p>
* The maximum number of vocabularies to return in the response. If there are fewer results in the list, this
* response contains only the actual results.
* </p>
*
* @return The maximum number of vocabularies to return in the response. If there are fewer results in the list,
* this response contains only the actual results.
*/
public Integer getMaxResults() {
return this.maxResults;
}
/**
* <p>
* The maximum number of vocabularies to return in the response. If there are fewer results in the list, this
* response contains only the actual results.
* </p>
*
* @param maxResults
* The maximum number of vocabularies to return in the response. If there are fewer results in the list, this
* response contains only the actual results.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ListVocabulariesRequest withMaxResults(Integer maxResults) {
setMaxResults(maxResults);
return this;
}
/**
* <p>
* When specified, only returns vocabularies with the <code>VocabularyState</code> field equal to the specified
* state.
* </p>
*
* @param stateEquals
* When specified, only returns vocabularies with the <code>VocabularyState</code> field equal to the
* specified state.
* @see VocabularyState
*/
public void setStateEquals(String stateEquals) {
this.stateEquals = stateEquals;
}
/**
* <p>
* When specified, only returns vocabularies with the <code>VocabularyState</code> field equal to the specified
* state.
* </p>
*
* @return When specified, only returns vocabularies with the <code>VocabularyState</code> field equal to the
* specified state.
* @see VocabularyState
*/
public String getStateEquals() {
return this.stateEquals;
}
/**
* <p>
* When specified, only returns vocabularies with the <code>VocabularyState</code> field equal to the specified
* state.
* </p>
*
* @param stateEquals
* When specified, only returns vocabularies with the <code>VocabularyState</code> field equal to the
* specified state.
* @return Returns a reference to this object so that method calls can be chained together.
* @see VocabularyState
*/
public ListVocabulariesRequest withStateEquals(String stateEquals) {
setStateEquals(stateEquals);
return this;
}
/**
* <p>
* When specified, only returns vocabularies with the <code>VocabularyState</code> field equal to the specified
* state.
* </p>
*
* @param stateEquals
* When specified, only returns vocabularies with the <code>VocabularyState</code> field equal to the
* specified state.
* @return Returns a reference to this object so that method calls can be chained together.
* @see VocabularyState
*/
public ListVocabulariesRequest withStateEquals(VocabularyState stateEquals) {
this.stateEquals = stateEquals.toString();
return this;
}
/**
* <p>
* When specified, the vocabularies returned in the list are limited to vocabularies whose name contains the
* specified string. The search is not case sensitive, <code>ListVocabularies</code> returns both "vocabularyname"
* and "VocabularyName" in the response list.
* </p>
*
* @param nameContains
* When specified, the vocabularies returned in the list are limited to vocabularies whose name contains the
* specified string. The search is not case sensitive, <code>ListVocabularies</code> returns both
* "vocabularyname" and "VocabularyName" in the response list.
*/
public void setNameContains(String nameContains) {
this.nameContains = nameContains;
}
/**
* <p>
* When specified, the vocabularies returned in the list are limited to vocabularies whose name contains the
* specified string. The search is not case sensitive, <code>ListVocabularies</code> returns both "vocabularyname"
* and "VocabularyName" in the response list.
* </p>
*
* @return When specified, the vocabularies returned in the list are limited to vocabularies whose name contains the
* specified string. The search is not case sensitive, <code>ListVocabularies</code> returns both
* "vocabularyname" and "VocabularyName" in the response list.
*/
public String getNameContains() {
return this.nameContains;
}
/**
* <p>
* When specified, the vocabularies returned in the list are limited to vocabularies whose name contains the
* specified string. The search is not case sensitive, <code>ListVocabularies</code> returns both "vocabularyname"
* and "VocabularyName" in the response list.
* </p>
*
* @param nameContains
* When specified, the vocabularies returned in the list are limited to vocabularies whose name contains the
* specified string. The search is not case sensitive, <code>ListVocabularies</code> returns both
* "vocabularyname" and "VocabularyName" in the response list.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ListVocabulariesRequest withNameContains(String nameContains) {
setNameContains(nameContains);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getNextToken() != null)
sb.append("NextToken: ").append(getNextToken()).append(",");
if (getMaxResults() != null)
sb.append("MaxResults: ").append(getMaxResults()).append(",");
if (getStateEquals() != null)
sb.append("StateEquals: ").append(getStateEquals()).append(",");
if (getNameContains() != null)
sb.append("NameContains: ").append(getNameContains());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ListVocabulariesRequest == false)
return false;
ListVocabulariesRequest other = (ListVocabulariesRequest) obj;
if (other.getNextToken() == null ^ this.getNextToken() == null)
return false;
if (other.getNextToken() != null && other.getNextToken().equals(this.getNextToken()) == false)
return false;
if (other.getMaxResults() == null ^ this.getMaxResults() == null)
return false;
if (other.getMaxResults() != null && other.getMaxResults().equals(this.getMaxResults()) == false)
return false;
if (other.getStateEquals() == null ^ this.getStateEquals() == null)
return false;
if (other.getStateEquals() != null && other.getStateEquals().equals(this.getStateEquals()) == false)
return false;
if (other.getNameContains() == null ^ this.getNameContains() == null)
return false;
if (other.getNameContains() != null && other.getNameContains().equals(this.getNameContains()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode());
hashCode = prime * hashCode + ((getMaxResults() == null) ? 0 : getMaxResults().hashCode());
hashCode = prime * hashCode + ((getStateEquals() == null) ? 0 : getStateEquals().hashCode());
hashCode = prime * hashCode + ((getNameContains() == null) ? 0 : getNameContains().hashCode());
return hashCode;
}
@Override
public ListVocabulariesRequest clone() {
return (ListVocabulariesRequest) super.clone();
}
}
| [
""
] | |
516bb66fee78c4bb0de14f52125a0ff9b549820a | 647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4 | /com.tencent.mm/classes.jar/com/google/android/gms/internal/wearable/zze.java | 8e967a6b2a9b3f5952ce9c733ad5824e0c5b5722 | [] | no_license | tsuzcx/qq_apk | 0d5e792c3c7351ab781957bac465c55c505caf61 | afe46ef5640d0ba6850cdefd3c11badbd725a3f6 | refs/heads/main | 2022-07-02T10:32:11.651957 | 2022-02-01T12:41:38 | 2022-02-01T12:41:38 | 453,860,108 | 36 | 9 | null | 2022-01-31T09:46:26 | 2022-01-31T02:43:22 | Java | UTF-8 | Java | false | false | 13,698 | java | package com.google.android.gms.internal.wearable;
import com.google.android.gms.wearable.Asset;
import com.google.android.gms.wearable.DataMap;
import com.tencent.matrix.trace.core.AppMethodBeat;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.TreeSet;
public final class zze
{
public static zzf zza(DataMap paramDataMap)
{
AppMethodBeat.i(100657);
zzg localzzg = new zzg();
ArrayList localArrayList = new ArrayList();
Object localObject1 = new TreeSet(paramDataMap.keySet());
zzh[] arrayOfzzh = new zzh[((TreeSet)localObject1).size()];
localObject1 = ((TreeSet)localObject1).iterator();
int i = 0;
while (((Iterator)localObject1).hasNext())
{
String str = (String)((Iterator)localObject1).next();
Object localObject2 = paramDataMap.get(str);
arrayOfzzh[i] = new zzh();
arrayOfzzh[i].name = str;
arrayOfzzh[i].zzga = zza(localArrayList, localObject2);
i += 1;
}
localzzg.zzfy = arrayOfzzh;
paramDataMap = new zzf(localzzg, localArrayList);
AppMethodBeat.o(100657);
return paramDataMap;
}
private static zzi zza(List<Asset> paramList, Object paramObject)
{
AppMethodBeat.i(100659);
zzi localzzi1 = new zzi();
if (paramObject == null)
{
localzzi1.type = 14;
AppMethodBeat.o(100659);
return localzzi1;
}
localzzi1.zzgc = new zzj();
if ((paramObject instanceof String))
{
localzzi1.type = 2;
localzzi1.zzgc.zzge = ((String)paramObject);
}
Object localObject1;
Object localObject2;
int i;
Object localObject3;
for (;;)
{
AppMethodBeat.o(100659);
return localzzi1;
if ((paramObject instanceof Integer))
{
localzzi1.type = 6;
localzzi1.zzgc.zzgi = ((Integer)paramObject).intValue();
}
else if ((paramObject instanceof Long))
{
localzzi1.type = 5;
localzzi1.zzgc.zzgh = ((Long)paramObject).longValue();
}
else if ((paramObject instanceof Double))
{
localzzi1.type = 3;
localzzi1.zzgc.zzgf = ((Double)paramObject).doubleValue();
}
else if ((paramObject instanceof Float))
{
localzzi1.type = 4;
localzzi1.zzgc.zzgg = ((Float)paramObject).floatValue();
}
else if ((paramObject instanceof Boolean))
{
localzzi1.type = 8;
localzzi1.zzgc.zzgk = ((Boolean)paramObject).booleanValue();
}
else if ((paramObject instanceof Byte))
{
localzzi1.type = 7;
localzzi1.zzgc.zzgj = ((Byte)paramObject).byteValue();
}
else if ((paramObject instanceof byte[]))
{
localzzi1.type = 1;
localzzi1.zzgc.zzgd = ((byte[])paramObject);
}
else if ((paramObject instanceof String[]))
{
localzzi1.type = 11;
localzzi1.zzgc.zzgn = ((String[])paramObject);
}
else if ((paramObject instanceof long[]))
{
localzzi1.type = 12;
localzzi1.zzgc.zzgo = ((long[])paramObject);
}
else if ((paramObject instanceof float[]))
{
localzzi1.type = 15;
localzzi1.zzgc.zzgp = ((float[])paramObject);
}
else if ((paramObject instanceof Asset))
{
localzzi1.type = 13;
localObject1 = localzzi1.zzgc;
paramList.add((Asset)paramObject);
((zzj)localObject1).zzgq = (paramList.size() - 1);
}
else
{
if (!(paramObject instanceof DataMap)) {
break;
}
localzzi1.type = 9;
paramObject = (DataMap)paramObject;
localObject2 = new TreeSet(paramObject.keySet());
localObject1 = new zzh[((TreeSet)localObject2).size()];
localObject2 = ((TreeSet)localObject2).iterator();
i = 0;
while (((Iterator)localObject2).hasNext())
{
localObject3 = (String)((Iterator)localObject2).next();
localObject1[i] = new zzh();
localObject1[i].name = ((String)localObject3);
localObject1[i].zzga = zza(paramList, paramObject.get((String)localObject3));
i += 1;
}
localzzi1.zzgc.zzgl = ((zzh[])localObject1);
}
}
int j;
label605:
zzi localzzi2;
if ((paramObject instanceof ArrayList))
{
localzzi1.type = 10;
localObject2 = (ArrayList)paramObject;
localObject3 = new zzi[((ArrayList)localObject2).size()];
paramObject = null;
int k = ((ArrayList)localObject2).size();
i = 0;
j = 14;
if (i < k)
{
localObject1 = ((ArrayList)localObject2).get(i);
localzzi2 = zza(paramList, localObject1);
if ((localzzi2.type != 14) && (localzzi2.type != 2) && (localzzi2.type != 6) && (localzzi2.type != 9))
{
paramList = String.valueOf(localObject1.getClass());
paramList = new IllegalArgumentException(String.valueOf(paramList).length() + 130 + "The only ArrayList element types supported by DataBundleUtil are String, Integer, Bundle, and null, but this ArrayList contains a " + paramList);
AppMethodBeat.o(100659);
throw paramList;
}
if ((j == 14) && (localzzi2.type != 14))
{
j = localzzi2.type;
paramObject = localObject1;
}
}
}
for (;;)
{
localObject3[i] = localzzi2;
i += 1;
break label605;
if (localzzi2.type != j)
{
paramList = String.valueOf(paramObject.getClass());
paramObject = String.valueOf(localObject1.getClass());
paramList = new IllegalArgumentException(String.valueOf(paramList).length() + 80 + String.valueOf(paramObject).length() + "ArrayList elements must all be of the sameclass, but this one contains a " + paramList + " and a " + paramObject);
AppMethodBeat.o(100659);
throw paramList;
localzzi1.zzgc.zzgm = ((zzi[])localObject3);
break;
paramList = String.valueOf(paramObject.getClass().getSimpleName());
if (paramList.length() != 0) {}
for (paramList = "newFieldValueFromValue: unexpected value ".concat(paramList);; paramList = new String("newFieldValueFromValue: unexpected value "))
{
paramList = new RuntimeException(paramList);
AppMethodBeat.o(100659);
throw paramList;
}
}
}
}
public static DataMap zza(zzf paramzzf)
{
AppMethodBeat.i(100658);
DataMap localDataMap = new DataMap();
zzh[] arrayOfzzh = paramzzf.zzfw.zzfy;
int j = arrayOfzzh.length;
int i = 0;
while (i < j)
{
zzh localzzh = arrayOfzzh[i];
zza(paramzzf.zzfx, localDataMap, localzzh.name, localzzh.zzga);
i += 1;
}
AppMethodBeat.o(100658);
return localDataMap;
}
private static void zza(List<Asset> paramList, DataMap paramDataMap, String paramString, zzi paramzzi)
{
AppMethodBeat.i(100660);
int i = paramzzi.type;
if (i == 14)
{
paramDataMap.putString(paramString, null);
AppMethodBeat.o(100660);
return;
}
Object localObject = paramzzi.zzgc;
if (i == 1)
{
paramDataMap.putByteArray(paramString, ((zzj)localObject).zzgd);
AppMethodBeat.o(100660);
return;
}
if (i == 11)
{
paramDataMap.putStringArray(paramString, ((zzj)localObject).zzgn);
AppMethodBeat.o(100660);
return;
}
if (i == 12)
{
paramDataMap.putLongArray(paramString, ((zzj)localObject).zzgo);
AppMethodBeat.o(100660);
return;
}
if (i == 15)
{
paramDataMap.putFloatArray(paramString, ((zzj)localObject).zzgp);
AppMethodBeat.o(100660);
return;
}
if (i == 2)
{
paramDataMap.putString(paramString, ((zzj)localObject).zzge);
AppMethodBeat.o(100660);
return;
}
if (i == 3)
{
paramDataMap.putDouble(paramString, ((zzj)localObject).zzgf);
AppMethodBeat.o(100660);
return;
}
if (i == 4)
{
paramDataMap.putFloat(paramString, ((zzj)localObject).zzgg);
AppMethodBeat.o(100660);
return;
}
if (i == 5)
{
paramDataMap.putLong(paramString, ((zzj)localObject).zzgh);
AppMethodBeat.o(100660);
return;
}
if (i == 6)
{
paramDataMap.putInt(paramString, ((zzj)localObject).zzgi);
AppMethodBeat.o(100660);
return;
}
if (i == 7)
{
paramDataMap.putByte(paramString, (byte)((zzj)localObject).zzgj);
AppMethodBeat.o(100660);
return;
}
if (i == 8)
{
paramDataMap.putBoolean(paramString, ((zzj)localObject).zzgk);
AppMethodBeat.o(100660);
return;
}
if (i == 13)
{
if (paramList == null)
{
paramList = String.valueOf(paramString);
if (paramList.length() != 0) {}
for (paramList = "populateBundle: unexpected type for: ".concat(paramList);; paramList = new String("populateBundle: unexpected type for: "))
{
paramList = new RuntimeException(paramList);
AppMethodBeat.o(100660);
throw paramList;
}
}
paramDataMap.putAsset(paramString, (Asset)paramList.get((int)((zzj)localObject).zzgq));
AppMethodBeat.o(100660);
return;
}
int j;
DataMap localDataMap;
if (i == 9)
{
paramzzi = new DataMap();
localObject = ((zzj)localObject).zzgl;
j = localObject.length;
i = 0;
while (i < j)
{
localDataMap = localObject[i];
zza(paramList, paramzzi, localDataMap.name, localDataMap.zzga);
i += 1;
}
paramDataMap.putDataMap(paramString, paramzzi);
AppMethodBeat.o(100660);
return;
}
if (i == 10)
{
paramzzi = ((zzj)localObject).zzgm;
i = 14;
int m = paramzzi.length;
j = 0;
int k;
if (j < m)
{
localDataMap = paramzzi[j];
if (i == 14) {
if ((localDataMap.type == 9) || (localDataMap.type == 2) || (localDataMap.type == 6)) {
k = localDataMap.type;
}
}
do
{
do
{
j += 1;
i = k;
break;
k = i;
} while (localDataMap.type == 14);
i = localDataMap.type;
paramList = new IllegalArgumentException(String.valueOf(paramString).length() + 48 + "Unexpected TypedValue type: " + i + " for key " + paramString);
AppMethodBeat.o(100660);
throw paramList;
k = i;
} while (localDataMap.type == i);
j = localDataMap.type;
paramList = new IllegalArgumentException(String.valueOf(paramString).length() + 126 + "The ArrayList elements should all be the same type, but ArrayList with key " + paramString + " contains items of type " + i + " and " + j);
AppMethodBeat.o(100660);
throw paramList;
}
paramzzi = new ArrayList(((zzj)localObject).zzgm.length);
localObject = ((zzj)localObject).zzgm;
m = localObject.length;
j = 0;
if (j < m)
{
zzh[] arrayOfzzh = localObject[j];
if (arrayOfzzh.type == 14) {
paramzzi.add(null);
}
for (;;)
{
j += 1;
break;
if (i == 9)
{
localDataMap = new DataMap();
arrayOfzzh = arrayOfzzh.zzgc.zzgl;
int n = arrayOfzzh.length;
k = 0;
while (k < n)
{
zzh localzzh = arrayOfzzh[k];
zza(paramList, localDataMap, localzzh.name, localzzh.zzga);
k += 1;
}
paramzzi.add(localDataMap);
}
else if (i == 2)
{
paramzzi.add(arrayOfzzh.zzgc.zzge);
}
else
{
if (i != 6) {
break label927;
}
paramzzi.add(Integer.valueOf(arrayOfzzh.zzgc.zzgi));
}
}
label927:
paramList = new IllegalArgumentException(39 + "Unexpected typeOfArrayList: " + i);
AppMethodBeat.o(100660);
throw paramList;
}
if (i == 14)
{
paramDataMap.putStringArrayList(paramString, paramzzi);
AppMethodBeat.o(100660);
return;
}
if (i == 9)
{
paramDataMap.putDataMapArrayList(paramString, paramzzi);
AppMethodBeat.o(100660);
return;
}
if (i == 2)
{
paramDataMap.putStringArrayList(paramString, paramzzi);
AppMethodBeat.o(100660);
return;
}
if (i == 6)
{
paramDataMap.putIntegerArrayList(paramString, paramzzi);
AppMethodBeat.o(100660);
return;
}
paramList = new IllegalStateException(39 + "Unexpected typeOfArrayList: " + i);
AppMethodBeat.o(100660);
throw paramList;
}
paramList = new RuntimeException(43 + "populateBundle: unexpected type " + i);
AppMethodBeat.o(100660);
throw paramList;
}
}
/* Location: L:\local\mybackup\temp\qq_apk\com.tencent.mm\classes7.jar
* Qualified Name: com.google.android.gms.internal.wearable.zze
* JD-Core Version: 0.7.0.1
*/ | [
"98632993+tsuzcx@users.noreply.github.com"
] | 98632993+tsuzcx@users.noreply.github.com |
24aec7f60f431683090991a7946da262a975038b | e63f0a3f7a6bd3e6a767807cf2387a1d21d1e357 | /src/com/geekoder/solid/d/OracleDatabase.java | dbbf3233b330cd41a0eaabe74486716e071517e2 | [] | no_license | GeeKoders/DesignPattern | 9d67070f8b2a7cd7def25af3fafbf59c09f90a1f | 5d1e3a49cb747837135b3a7403be86a9dbec5e00 | refs/heads/master | 2021-02-10T11:28:52.046339 | 2020-03-14T11:05:45 | 2020-03-14T11:05:45 | 244,378,119 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 273 | java | package com.geekoder.solid.d;
public class OracleDatabase implements Database {
public void connect(){
System.out.println("Connecting to Oracle database...");
}
@Override
public void disconnect() {
System.out.println("Disconnection Oracle database...");
}
}
| [
"iloveitone@gmail.com"
] | iloveitone@gmail.com |
793ccabb1d2954441934c7018ec50ef932030acb | d1bafd0047107fc3bf27377b206d84697c7a639e | /src/kz/bitlab/group27/servlets/ProfileServlet.java | 2942d2f1f678bba4addb74782a911e7e19903968 | [] | no_license | ilyasgalacticos/group27_javaee | 5f7af41fd8c33e108658af96d1283ef124f9555c | 6ab7ea5ded17cc61f5f3bcac5937ea40753b4424 | refs/heads/master | 2022-12-31T13:01:31.803844 | 2020-10-24T12:13:04 | 2020-10-24T12:13:04 | 302,917,708 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 912 | java | package kz.bitlab.group27.servlets;
import kz.bitlab.group27.db.Users;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet(value = "/profile")
public class ProfileServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Users user = (Users)request.getSession().getAttribute("USER");
if(user!=null){
request.getRequestDispatcher("/profile.jsp").forward(request, response);
}else{
response.sendRedirect("/login");
}
}
}
| [
"halamadrid_1902"
] | halamadrid_1902 |
33a098fca3be53e522dbba17d63a837567842258 | a5c2b75dc1358fbc1d11784ce5f135f625a5fd82 | /src/main/java/com/software_engineering_professor/engine/PieceGenerator.java | 0f46dbd29ec8b795994be8eee6b54ec9d170f9ec | [] | no_license | f41thful/tetris | 1cb8fe181f9b6445fd4806f5c9575592b83f7289 | a56cc261150a4d1c63de272863c1354227cce548 | refs/heads/master | 2022-12-08T23:39:32.581486 | 2020-09-13T15:26:20 | 2020-09-13T15:26:20 | 293,033,720 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 882 | java | package com.software_engineering_professor.engine;
import com.software_engineering_professor.geom.Point;
import com.software_engineering_professor.piece.Piece;
import com.software_engineering_professor.piece.PieceStore;
import java.util.Objects;
import java.util.Random;
public class PieceGenerator {
private PieceStore pieceStore;
private Random random;
private Point origin;
public PieceGenerator(PieceStore pieceStore, Random random, Point origin) {
Objects.requireNonNull(pieceStore);
Objects.requireNonNull(random);
Objects.requireNonNull(origin);
this.pieceStore = pieceStore;
this.random = random;
this.origin = origin;
}
public Piece next() {
Piece p = pieceStore.getPiece(random.nextInt(pieceStore.getNumberOfPieces()));
p.setPosition(origin.clone());
return p;
}
}
| [
"javier.mediavilla.vegas@code2run.net"
] | javier.mediavilla.vegas@code2run.net |
ba4f255b6086ae6cdbcf4cccb2e2cbbb16bdd767 | 11032c246f477a8e01a6d405093fa9f1f01a3333 | /src/LongestSubstringWithoutRepeatingCharacters.java | e6a8480dd900ccdae3eb6862b9f5c01b79427979 | [] | no_license | jy-zheng/LeetCode | 841a0b6c1a122ceb59372ae90b3e2f065e804a6f | 8375796e94f970c91db0694a4cf1a31a8b956314 | refs/heads/master | 2023-04-19T07:28:45.488760 | 2021-04-29T21:45:01 | 2021-04-29T21:45:01 | 362,954,767 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 884 | java | import java.util.*;
public class LongestSubstringWithoutRepeatingCharacters {
public static void main(String[] args) {
String s = "pwwkew123";
int longestLength = 0;
Map<Character,Integer> map = new HashMap<>();
for (int i = 0; i < s.length(); i++){
System.out.println(s.charAt(i));
if (!map.containsKey(s.charAt(i))){
map.put(s.charAt(i),i);
}else{
System.out.println(map.toString());
i = map.get(s.charAt(i));
System.out.println(i);
if (map.size() > longestLength){
longestLength = map.size();
}
map.clear();
}
}
if (map.size() > longestLength){
longestLength = map.size();
}
System.out.println(longestLength);
}
}
| [
"zouyi.zheng@gmail.com"
] | zouyi.zheng@gmail.com |
5e2603fc6f3a5207362c2ff2db353b28c64bde31 | 07065052f66303a2be155eac26c45cc7893a5e7d | /LeetCodecom/src/main/java/com/j2core/sts/leetcode/com/selfDividingNumbers/Solution.java | a1c1c07b7c1b6d5b933be61d765f54261cd85e9b | [] | no_license | tsotnyk/CodeTasks | 77e297535804319ca2cd38ccb2691d9fd5a39bd9 | ef9700b88c18e976c5af32f0a934b36462d81dfc | refs/heads/master | 2023-08-16T04:56:04.116083 | 2023-08-11T02:19:25 | 2023-08-11T02:19:25 | 121,688,831 | 1 | 2 | null | 2023-05-09T19:00:20 | 2018-02-15T22:09:21 | Java | UTF-8 | Java | false | false | 1,327 | java | package com.j2core.sts.leetcode.com.selfDividingNumbers;
import java.util.LinkedList;
import java.util.List;
public class Solution {
public List<Integer> selfDividingNumbers(int left, int right) {
List<Integer> result = new LinkedList<>();
if (left < 10){
int tmpRight = 10;
if (right < 10){
tmpRight = right;
}
for (int i = left; i < tmpRight; i++){
result.add(i);
}
}
if (right <= 10) return result;
int tmpLeft = 11;
if (left > tmpLeft) tmpLeft = left;
for (int j = tmpLeft; j <= right; j++){
if (j%10 != 0){
String tmpNum = Integer.toString(j);
int[] tmpArray = new int[tmpNum.length()];
for (int k = 0; k < tmpNum.length(); k++){
tmpArray[k] = Integer.parseInt(String.valueOf(tmpNum.charAt(k)));
}
boolean flag = true;
for (int num : tmpArray){
if (num == 0 || j%num != 0){
flag = false;
break;
}
}
if (flag){
result.add(j);
}
}
}
return result;
}
}
| [
"sotnykts@gmail.com"
] | sotnykts@gmail.com |
4c2716351e2cf49f59a789ba76899cbe2e975d1f | fc261e9743c07245316f0bf70262a25be5eb0a88 | /src/main/java/cn/wanda/dataserv/split/Splitter.java | 14ff874bd4207e12feba7823700b341893352644 | [] | no_license | zeliu/Dhorse-new | b011bd03b56d3eda6c3bb738869759fbe0057f51 | 0cc3835df40bad4a4579bbebfc3147eabaf12ba5 | refs/heads/master | 2021-01-10T01:42:42.739679 | 2016-02-29T03:45:29 | 2016-02-29T03:45:29 | 52,761,907 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 64 | java | package cn.wanda.dataserv.split;
public interface Splitter {
} | [
"42269615@qq.com"
] | 42269615@qq.com |
7845cb209ec5e24321275c14f04dbba17f232f86 | e7d85071207c0e3f8bffb28e678161c35bf3b71a | /Puc/src/programacaoorientada/trabalho4/Mensagem.java | 4ab1ec88cfb1940e911d9a94cb4a734c17617a06 | [] | no_license | PedroKmiecik/Puc | e32b6d10121d39c77a398749f2b101fa12e6db17 | ac557b34cde3b6068636cb220de44ba06eefcdd8 | refs/heads/master | 2020-08-03T11:05:23.093002 | 2019-10-08T14:17:13 | 2019-10-08T14:17:13 | 211,729,171 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 663 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package programacaoorientada.trabalho4;
/**
*
* @author Pedro
*/
public class Mensagem {
private String texto;
private String status = "Recebido";
public String getTexto(){
return texto;
}
public void mudaStatus(){
status = "Visualizado";
}
public Mensagem(String texto){
this.texto = texto;
}
public String getStatus(){
return status;
}
}
| [
"pedro.kmiecik@gmail.com"
] | pedro.kmiecik@gmail.com |
bb422608ce3a3e4419c1e3af0daad7bf1aca45fa | 349f314c07582402b790f64229a3f40231ba269f | /hemesh/wblut/geom/WB_Point4d.java | 8e529ea284a31498f2fbdc6367420df23b1f5098 | [] | no_license | blvkoblsk/Meshia | 33b645194b7c0e9ad1ad3f56531365a084ff2e28 | c92764a4069ac00669923c17e9d0bf5d3875f6d8 | refs/heads/master | 2021-01-19T20:55:59.629816 | 2015-06-16T19:50:59 | 2015-06-16T19:50:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,960 | java | /**
*
*/
package wblut.geom;
import wblut.WB_Epsilon;
// TODO: Auto-generated Javadoc
/**
* The Class WB_Point4d.
*
* @author Frederik Vanhoutte, W:Blut
*/
public class WB_Point4d implements Comparable<WB_Point4d> {
/** The Constant ZERO. */
public static final WB_Point4d ZERO = new WB_Point4d(0, 0, 0, 1);
/** Coordinates. */
public double x, y, z, w;
/**
* Instantiates a new WB_XYZW.
*/
public WB_Point4d() {
x = y = z = w = 0;
}
/**
* Instantiates a new WB_XYZW.
*
* @param x the x
* @param y the y
* @param z the z
* @param w the w
*/
public WB_Point4d(final double x, final double y, final double z,
final double w) {
this.x = x;
this.y = y;
this.z = z;
this.w = w;
}
/**
* Instantiates a new WB_XYZW.
*
* @param v the v
*/
public WB_Point4d(final WB_Point4d v) {
x = v.x;
y = v.y;
z = v.z;
w = v.w;
}
/**
* Instantiates a new WB_XYZW.
*
* @param v the v
* @param w the w
*/
public WB_Point4d(final WB_Point3d v, final double w) {
x = v.x;
y = v.y;
z = v.z;
this.w = w;
}
/**
* Set coordinates.
*
* @param x the x
* @param y the y
* @param z the z
* @param w the w
*/
public void set(final double x, final double y, final double z,
final double w) {
this.x = x;
this.y = y;
this.z = z;
this.w = w;
}
/**
* Set coordinates.
*
* @param v the v
* @param w the w
*/
public void set(final WB_Point3d v, final double w) {
x = v.x;
y = v.y;
z = v.z;
this.w = w;
}
/**
* Get squared magnitude.
*
* @return squared magnitude
*/
public double mag2() {
return x * x + y * y + z * z + w * w;
}
/**
* Get magnitude.
*
* @return magnitude
*/
public double mag() {
return Math.sqrt(x * x + y * y + z * z + w * w);
}
/**
* Checks if vector is zero-vector.
*
* @return true, if zero
*/
public boolean isZero() {
return (mag2() < WB_Epsilon.SQEPSILON);
}
/*
* (non-Javadoc)
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
public int compareTo(final WB_Point4d otherXYZW) {
int _tmp = WB_Epsilon.compareAbs(x, otherXYZW.x);
if (_tmp != 0) {
return _tmp;
}
_tmp = WB_Epsilon.compareAbs(y, otherXYZW.y);
if (_tmp != 0) {
return _tmp;
}
_tmp = WB_Epsilon.compareAbs(z, otherXYZW.z);
if (_tmp != 0) {
return _tmp;
}
_tmp = WB_Epsilon.compareAbs(w, otherXYZW.w);
return _tmp;
}
/*
* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "XYZW [x=" + x + ", y=" + y + ", z=" + z + ", w=" + w + "]";
}
/**
* Get coordinate from index value.
*
* @param i 0,1,2,3
* @return x-, y-, z- or w-coordinate
*/
public double get(final int i) {
if (i == 0) {
return x;
}
if (i == 1) {
return y;
}
if (i == 2) {
return z;
}
if (i == 3) {
return w;
}
return Double.NaN;
}
/**
* Set coordinate with index value.
*
* @param i 0,1,2,3
* @param v x-, y-, z- or w-coordinate
*/
public void set(final int i, final double v) {
if (i == 0) {
x = v;
} else if (i == 1) {
y = v;
} else if (i == 2) {
z = v;
} else if (i == 3) {
w = v;
}
}
/**
* Get x-coordinate as float.
*
* @return x
*/
public float xf() {
return (float) x;
}
/**
* Get y-coordinate as float.
*
* @return y
*/
public float yf() {
return (float) y;
}
/**
* Get z-coordinate as float.
*
* @return z
*/
public float zf() {
return (float) z;
}
/**
* Get w-coordinate as float.
*
* @return w
*/
public float wf() {
return (float) w;
}
/**
* return copy.
*
* @return copy
*/
public WB_Point4d get() {
return new WB_Point4d(x, y, z, w);
}
/**
* Move to position.
*
* @param x the x
* @param y the y
* @param z the z
* @return self
*/
public WB_Point4d moveTo(final double x, final double y, final double z) {
this.x = x;
this.y = y;
this.z = z;
return this;
}
/**
* Move to position.
*
* @param p point, vector or normal
* @return self
*/
public WB_Point4d moveTo(final WB_Point3d p) {
x = p.x;
y = p.y;
z = p.z;
return this;
}
/**
* Move by vector.
*
* @param x the x
* @param y the y
* @param z the z
* @return self
*/
public WB_Point4d moveBy(final double x, final double y, final double z) {
this.x += x;
this.y += y;
this.z += z;
return this;
}
/**
* Move by vector.
*
* @param v point, vector or normal
* @return self
*/
public WB_Point4d moveBy(final WB_Point3d v) {
x += v.x;
y += v.y;
z += v.z;
return this;
}
/**
* Move by vector.
*
* @param x the x
* @param y the y
* @param z the z
* @param result WB_XYZW to store result
*/
public void moveByInto(final double x, final double y, final double z,
final WB_Point4d result) {
result.x = this.x + x;
result.y = this.y + y;
result.z = this.z + z;
result.w = w;
}
/**
* Move by vector.
*
* @param v point, vector or normal
* @param result WB_XYZW to store result
*/
public void moveByInto(final WB_Point3d v, final WB_Point4d result) {
result.x = x + v.x;
result.y = y + v.y;
result.z = z + v.z;
result.w = w;
}
/**
* Move by vector.
*
* @param x the x
* @param y the y
* @param z the z
* @return new WB_XYZW
*/
public WB_Point4d moveByAndCopy(final double x, final double y,
final double z) {
return new WB_Point4d(this.x + x, this.y + y, this.z + z, w);
}
/**
* Move by vector.
*
* @param v point, vector or normal
* @return new WB_XYZW
*/
public WB_Point4d moveByAndCopy(final WB_Point3d v) {
return new WB_Point4d(x + v.x, y + v.y, z + v.z, w);
}
/**
* Invert.
*
* @return self
*/
public WB_Point4d invert() {
x *= -1;
y *= -1;
z *= -1;
w *= -1;
return this;
}
/**
* Normalize.
*
* @return the double
*/
public double normalize() {
final double d = mag();
if (WB_Epsilon.isZero(d)) {
set(0, 0, 0, 0);
} else {
set(x / d, y / d, z / d, w / d);
}
return d;
}
/**
* Trim.
*
* @param d the d
*/
public void trim(final double d) {
if (mag2() > d * d) {
normalize();
mult(d);
}
}
/**
* Scale.
*
* @param f scale factor
* @return self
*/
public WB_Point4d scale(final double f) {
x *= f;
y *= f;
z *= f;
w *= f;
return this;
}
/**
* Scale .
*
* @param f scale factor
* @param result WB_XYZW to store result
*/
public void scaleInto(final double f, final WB_Point4d result) {
result.x = x * f;
result.y = y * f;
result.z = z * f;
result.w = w * f;
}
/**
* Adds the.
*
* @param x the x
* @param y the y
* @param z the z
* @param w the w
* @return self
*/
public WB_Point4d add(final double x, final double y, final double z,
final double w) {
this.x += x;
this.y += y;
this.z += z;
this.w += w;
return this;
}
/**
* Adds the.
*
* @param x the x
* @param y the y
* @param z the z
* @param w the w
* @param f the f
* @return self
*/
public WB_Point4d add(final double x, final double y, final double z,
final double w, final double f) {
this.x += f * x;
this.y += f * y;
this.z += f * z;
this.w += f * w;
return this;
}
/**
* Adds the.
*
* @param p the p
* @return self
*/
public WB_Point4d add(final WB_Point4d p) {
x += p.x;
y += p.y;
z += p.z;
w += p.w;
return this;
}
/**
* Adds the.
*
* @param p the p
* @param f the f
* @return self
*/
public WB_Point4d add(final WB_Point4d p, final double f) {
x += f * p.x;
y += f * p.y;
z += f * p.z;
w += f * p.w;
return this;
}
/**
* Adds the into.
*
* @param x the x
* @param y the y
* @param z the z
* @param w the w
* @param result the result
*/
public void addInto(final double x, final double y, final double z,
final double w, final WB_Point4d result) {
result.x = (this.x + x);
result.y = (this.y + y);
result.z = (this.z + z);
result.w = this.w + w;
}
/**
* Adds the into.
*
* @param p the p
* @param result the result
*/
public void addInto(final WB_Point4d p, final WB_Point4d result) {
result.x = x + p.x;
result.y = y + p.y;
result.z = z + p.z;
result.w = w + p.w;
}
/**
* Adds the and copy.
*
* @param x the x
* @param y the y
* @param z the z
* @param w the w
* @return new WB_XYZW
*/
public WB_Point4d addAndCopy(final double x, final double y,
final double z, final double w) {
return new WB_Point4d(this.x + x, this.y + y, this.z + z, this.w + w);
}
/**
* Adds the and copy.
*
* @param x the x
* @param y the y
* @param z the z
* @param w the w
* @param f the f
* @return new WB_XYZW
*/
public WB_Point4d addAndCopy(final double x, final double y,
final double z, final double w, final double f) {
return new WB_Point4d(this.x + f * x, this.y + f * y, this.z + f * z,
this.w + f * w);
}
/**
* Adds the and copy.
*
* @param p the p
* @return new WB_XYZW
*/
public WB_Point4d addAndCopy(final WB_Point4d p) {
return new WB_Point4d(x + p.x, y + p.y, z + p.z, w + p.w);
}
/**
* Sub.
*
* @param x the x
* @param y the y
* @param z the z
* @param w the w
* @return self
*/
public WB_Point4d sub(final double x, final double y, final double z,
final double w) {
this.x -= x;
this.y -= y;
this.z -= z;
this.w -= w;
return this;
}
/**
* Sub.
*
* @param v the v
* @return self
*/
public WB_Point4d sub(final WB_Point4d v) {
x -= v.x;
y -= v.y;
z -= v.z;
w -= v.w;
return this;
}
/**
* Sub into.
*
* @param x the x
* @param y the y
* @param z the z
* @param w the w
* @param result the result
*/
public void subInto(final double x, final double y, final double z,
final double w, final WB_Point4d result) {
result.x = (this.x - x);
result.y = (this.y - y);
result.z = (this.z - z);
result.w = this.w - w;
}
/**
* Sub into.
*
* @param p the p
* @param result the result
*/
public void subInto(final WB_Point4d p, final WB_Point4d result) {
result.x = x - p.x;
result.y = y - p.y;
result.z = z - p.z;
result.w = w - p.w;
}
/**
* Sub and copy.
*
* @param x the x
* @param y the y
* @param z the z
* @param w the w
* @return new WB_XYZW
*/
public WB_Point4d subAndCopy(final double x, final double y,
final double z, final double w) {
return new WB_Point4d(this.x - x, this.y - y, this.z - z, this.w - w);
}
/**
* Sub and copy.
*
* @param p the p
* @return new WB_XYZW
*/
public WB_Point4d subAndCopy(final WB_Point4d p) {
return new WB_Point4d(x - p.x, y - p.y, z - p.z, w - p.w);
}
/**
* Mult.
*
* @param f the f
* @return self
*/
public WB_Point4d mult(final double f) {
scale(f);
return this;
}
/**
* Mult into.
*
* @param f the f
* @param result the result
*/
public void multInto(final double f, final WB_Point4d result) {
scaleInto(f, result);
}
/**
* Mult and copy.
*
* @param f the f
* @return new WB_XYZW
*/
public WB_Point4d multAndCopy(final double f) {
return new WB_Point4d(x * f, y * f, z * f, w * f);
}
/**
* Div.
*
* @param f the f
* @return self
*/
public WB_Point4d div(final double f) {
return mult(1.0 / f);
}
/**
* Div into.
*
* @param f the f
* @param result the result
*/
public void divInto(final double f, final WB_Point4d result) {
multInto(1.0 / f, result);
}
/**
* Div and copy.
*
* @param f the f
* @return new WB_XYZW
*/
public WB_Point4d divAndCopy(final double f) {
return multAndCopy(1.0 / f);
}
/**
* Interpolate.
*
* @param p0 the p0
* @param p1 the p1
* @param t the t
* @return the w b_ point
*/
public static WB_Point4d interpolate(final WB_Point4d p0,
final WB_Point4d p1, final double t) {
return new WB_Point4d(p0.x + t * (p1.x - p0.x), p0.y + t
* (p1.y - p0.y), p0.z + t * (p1.z - p0.z), p0.w + t
* (p1.w - p0.w));
}
}
| [
"mikaelhc@gmail.com"
] | mikaelhc@gmail.com |
7528ca3d63809206c70f770b6ad310fd4c3a1d43 | f4bd11a28df4aaa303438f6833129226ca8ef7b9 | /ChuongTrinh_DaoThiHang_1041060269_KHMT4_K10/Server/ShareFood/src/main/java/com/sharefood/ShareFood/model/Category.java | cef7cdff137679e8d1db9bd37cd560377dad0726 | [] | no_license | daothihang/demoCommandGit | b86c1cbba3eb277b5099c6d75962604e1fdb100d | 4b40d6cf9c147bdba1d3598c8877237aefcecba1 | refs/heads/master | 2020-05-24T08:46:38.922865 | 2019-05-17T09:59:59 | 2019-05-17T09:59:59 | 187,190,656 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 560 | java | package com.sharefood.ShareFood.model;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.persistence.*;
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "tbl_categories")
public class Category extends AbstractModel {
@Id
@Column(name = "id_category")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id_category;
@Column(name = "name")
private String name;
@Column(name = "image")
private String image;
}
| [
"="
] | = |
fc763fb8cc757730973e4fb8d2ebc73cf312c91d | 0f69c976fb27d5be82281c94271df75ef131342a | /app/src/main/java/com/example/campussystem/adminpanel/AdminJobActivity.java | d7d41f8d0995a4d8ed35e162bccd5803eb245606 | [] | no_license | mshayanabbasi/campus-management-system-Android | 95bb9a6914fa2cbb69539212cfca4fd623eb2d66 | 0c05180f4117ae9c9994a191068a982c4afd0b0e | refs/heads/master | 2020-12-01T17:37:32.429539 | 2019-12-29T06:42:46 | 2019-12-29T06:42:46 | 230,713,410 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,081 | java | package com.example.campussystem.adminpanel;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.content.Intent;
import android.os.Bundle;
import com.example.campussystem.CompanyPanel.CompanyMain.JobActivity;
import com.example.campussystem.R;
import com.example.campussystem.adminpanel.adminadapters.AdminJobAdapter;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.ChildEventListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import java.util.ArrayList;
import java.util.List;
public class AdminJobActivity extends AppCompatActivity {
private RecyclerView myRecyclerViews;
private List<JobActivity> jobDetail;
AdminJobAdapter adapter;
DatabaseReference ref;
FirebaseAuth mAuth;
RecyclerView.LayoutManager manager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_admin_job);
myRecyclerViews=(RecyclerView)findViewById(R.id.jobRecyclerViews);
jobDetail=new ArrayList<>();
Intent intent = getIntent();
final String id = intent.getStringExtra("Id");
adapter=new AdminJobAdapter(AdminJobActivity.this,jobDetail);
myRecyclerViews.setAdapter(adapter);
manager=new LinearLayoutManager(this, LinearLayoutManager.VERTICAL,false);
myRecyclerViews.setLayoutManager(manager);
ref= FirebaseDatabase.getInstance().getReference().child("All post").child("users").child(id).child("job");
ref.addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(@NonNull DataSnapshot dataSnapshot, @Nullable String s) {
JobActivity activity = dataSnapshot.getValue(JobActivity.class);
jobDetail.add(activity);
adapter.notifyDataSetChanged();
}
@Override
public void onChildChanged(@NonNull DataSnapshot dataSnapshot, @Nullable String s) {
}
@Override
public void onChildRemoved(@NonNull DataSnapshot dataSnapshot) {
String key = dataSnapshot.getKey();
for (JobActivity aq:jobDetail) {
if (key.equals(aq.getjId())) {
jobDetail.remove(aq);
adapter.notifyDataSetChanged();
break;
}
}
}
@Override
public void onChildMoved(@NonNull DataSnapshot dataSnapshot, @Nullable String s) {
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
}
| [
"mshayanabbasi98@gmail.com"
] | mshayanabbasi98@gmail.com |
ae151723c1e5308fb2ef6d4b29b7c6ff9527085e | 903e788ab2ce1fba2ed54447db313d04877e5bd0 | /learn-shop-core-seckill/src/main/java/com/billow/seckill/config/RabbitMqConfig.java | 6961b834ce84433627d0f5de2e7678d85dff3f2a | [
"Apache-2.0"
] | permissive | jhon-qiu/learn | d5bb29dab618f3a4a69245b6e77696db9858510c | 4f5a3bb293e073e117149070da124d6ad53f5196 | refs/heads/master | 2023-06-13T02:02:46.491501 | 2021-02-03T08:43:09 | 2021-02-03T08:43:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,663 | java | package com.billow.seckill.config;
import com.billow.cloud.common.properties.ConfigCommonProperties;
import com.billow.cloud.common.properties.MqProperties;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
/**
* @author liuyongtao
* @create 2018-06-26 16:02
*/
@Configuration
public class RabbitMqConfig {
@Autowired
private ConfigCommonProperties configCommonProperties;
public MqProperties getMq() {
return configCommonProperties.getMq();
}
@Bean
public ConnectionFactory connectionFactory() {
MqProperties mq = this.getMq();
CachingConnectionFactory connectionFactory = new CachingConnectionFactory(mq.getHost(), mq.getPort());
connectionFactory.setUsername(mq.getUsername());
connectionFactory.setPassword(mq.getPassword());
connectionFactory.setVirtualHost(mq.getVirtualHost());
connectionFactory.setPublisherConfirms(true);
return connectionFactory;
}
@Bean
//必须是prototype类型
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public RabbitTemplate rabbitTemplate() {
RabbitTemplate template = new RabbitTemplate(connectionFactory());
return template;
}
}
| [
"lyongtao123@126.com"
] | lyongtao123@126.com |
01dd4bf41f26a9cc0bab0002c318fbc146a8f2ac | cacd87f8831b02e254d65c5e86d48264c7493d78 | /pc/backstage/src/com/manji/backstage/vo/content/ActAdvertVo.java | 83dbebd5dad9a1ea50daa4ef404f798cc437d9cf | [] | no_license | lichaoqian1992/beautifulDay | 1a5a30947db08d170968611068673d2f0b626eb2 | 44e000ecd47099dc5342ab8a208edea73602760b | refs/heads/master | 2021-07-24T22:48:33.067359 | 2017-11-03T09:06:15 | 2017-11-03T09:06:15 | 108,791,908 | 0 | 3 | null | null | null | null | UTF-8 | Java | false | false | 290 | java | package com.manji.backstage.vo.content;
import com.manji.backstage.model.content.ActAdvert;
public class ActAdvertVo extends ActAdvert{
int index;
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
}
| [
"1015598423@qq.com"
] | 1015598423@qq.com |
4c667b6ad1b159ec377541c65e9ef6ff50064e6b | 102d2465bb8202d6f769e3fdbb4dec32676ee610 | /common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackClone.java | b092b2e90d090a7d891d32f863374e93f4f703c7 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | MakerTim/LuckPerms | 57f2bc346447da7bff0b628b50fa43b679777663 | a661a5b368a0de1be49cad6733d4159b9b31c8bb | refs/heads/master | 2021-01-11T00:45:27.688559 | 2016-10-10T19:50:35 | 2016-10-10T19:50:35 | 70,522,641 | 1 | 0 | null | 2016-10-10T19:45:12 | 2016-10-10T19:45:12 | null | UTF-8 | Java | false | false | 3,047 | java | /*
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package me.lucko.luckperms.commands.track.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
import me.lucko.luckperms.tracks.Track;
import me.lucko.luckperms.utils.ArgumentChecker;
import java.util.List;
public class TrackClone extends SubCommand<Track> {
public TrackClone() {
super("clone", "Clone the track", Permission.TRACK_CLONE, Predicate.not(1),
Arg.list(Arg.create("name", true, "the name of the clone"))
);
}
@Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Track track, List<String> args, String label) {
String newTrackName = args.get(0).toLowerCase();
if (ArgumentChecker.checkName(newTrackName)) {
Message.TRACK_INVALID_ENTRY.send(sender);
return CommandResult.INVALID_ARGS;
}
if (plugin.getDatastore().loadTrack(newTrackName)) {
Message.TRACK_ALREADY_EXISTS.send(sender);
return CommandResult.INVALID_ARGS;
}
if (!plugin.getDatastore().createAndLoadTrack(newTrackName)) {
Message.CREATE_TRACK_ERROR.send(sender);
return CommandResult.FAILURE;
}
Track newTrack = plugin.getTrackManager().get(newTrackName);
if (newTrack == null) {
Message.TRACK_LOAD_ERROR.send(sender);
return CommandResult.LOADING_ERROR;
}
newTrack.setGroups(track.getGroups());
Message.CLONE_SUCCESS.send(sender, track.getName(), newTrack.getName());
LogEntry.build().actor(sender).acted(track).action("clone " + newTrack.getName()).build().submit(plugin, sender);
save(newTrack, sender, plugin);
return CommandResult.SUCCESS;
}
}
| [
"git@lucko.me"
] | git@lucko.me |
74087449503dc5c4b86c10142d75c24727dec1b0 | 3769bbd9240219417c3d805188fa3473c842e9d4 | /src/Interface/InterfaceExample1.java | 098784194b4fd76b1e5709f8036cd52bfa0e23ea | [] | no_license | DanialAsyraf/Exercise4 | 75032c584a0e7c9baa238e708f363bf9f431fd09 | 07660b85db33a1273688909dc7d37a490cd13e4f | refs/heads/master | 2023-01-28T20:46:32.293984 | 2020-12-09T05:18:51 | 2020-12-09T05:18:51 | 319,850,168 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 286 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Interface;
/**
*
* @author user
*/
public class InterfaceExample1 {
}
| [
"user@DESKTOP-M1MB2DE"
] | user@DESKTOP-M1MB2DE |
dd5d153c97aa2893283bf0381b980ffe9252ce4f | 8393fe697be0848ad92e4026b842d826a81ddf4f | /src/main/java/com/erp/qy/service/UserserviceImpl.java | 839cbb61f8693b64f313bae5a87ca3ba2209f84d | [] | no_license | erpbygong/erp | 24c085c87f100a470d074f086bc0d6d90ee72fe5 | f5f0ef971874ac6cf541f4ec041b3144789986e3 | refs/heads/master | 2020-05-04T08:44:09.764379 | 2019-04-14T04:03:20 | 2019-04-14T04:03:20 | 179,052,704 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 948 | java | package com.erp.qy.service;
import com.erp.qy.dao.Userdao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class UserserviceImpl implements Userservice {
@Autowired
private Userdao userdao;
@Override
public Map getUserInfo() {
List<Map> userInfo = userdao.getUserList();
Map map = new HashMap();
map.put("userInfo",userInfo);
return map;
}
@Override
public int addUser(Map map) {
return userdao.addCar(map);
}
@Override
public List<Map> getDeptListBy(Map map) {
return userdao.getDeptListBy(map);
}
@Override
public int updateUser(Map map) {
return userdao.updateUser(map);
}
@Override
public int deleteUser(Integer ID) {
return userdao.deleteUser(ID);
}
}
| [
"aluruihua@163.com"
] | aluruihua@163.com |
09271c0c07072a333c339b6d85df51970820b9b9 | ff47bdddc5c37c1433f9c24ab591e429b4322861 | /tictactoe/GameDriver.java | f6d252cea47ccb1142c4263d80b93bdac261c076 | [] | no_license | ch00226855/CMP168Summer2021 | 5f5b32c2bef332bef3137cce583bc6c23f60557b | 3e16bf1f62d4c03982c6f3ebc596c9fbc7b9ef82 | refs/heads/main | 2023-07-17T13:17:39.301288 | 2021-08-12T01:13:38 | 2021-08-12T01:13:38 | 387,307,590 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 342 | java | package tictactoe;
import javax.swing.JFrame;
public class GameDriver {
public static void main(String[] args) {
TicTacToeFrame window = new TicTacToeFrame();
window.setTitle("Tic Tac Toe");
window.setSize(750, 600);
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setVisible(true);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
7ecdb12891a606a4b3d4aca0e12e036a8138d5aa | 44c56ac58bf885575c39b80d003b7fdbee4bdd72 | /src/Item.java | c9b0843655924c7a62e7fd81801aacf73fb0859c | [] | no_license | yuberalberto/SpaceChallenge1 | 9ac66349ec4f5ff197a976e0f33824e3f4c55a72 | 9afc2a542e150e93bde5fec05acac614aea5e614 | refs/heads/master | 2020-04-23T10:14:59.035813 | 2019-02-22T01:27:53 | 2019-02-22T01:27:53 | 171,097,717 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 337 | java | public class Item {
private String name;
private int weight;
public String getName() {
return name;
}
public int getWeight() {
return weight;
}
public void setName(String name) {
this.name = name;
}
public void setWeight(int weight) {
this.weight = weight;
}
}
| [
"yuberalberto@gmail.com"
] | yuberalberto@gmail.com |
c3e91fdcc48e4e0e4ac6e08d559dfcf01548b580 | 249a9281e8684f6661ff82dce9f3ecd49701f3de | /src/manageruser/dao/DeleteUser.java | 853f04f1f025336fc4aed6051bf3622d3682a2e4 | [] | no_license | tuan1412/JavaWeb_Rikkeisoft | 94dc606f43e6111bd2ae8b784d619196246f1845 | ab0b1d6606c5922ff3b026b8aea7888206b0b820 | refs/heads/master | 2021-05-15T15:10:34.668655 | 2017-10-30T16:10:22 | 2017-10-30T16:10:22 | 107,284,639 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 146 | java | package manageruser.dao;
/**
* Ket noi co so du lieu, delete user
* @author Chu lun Kute
*
*/
public interface DeleteUser {
void delete();
}
| [
"tuannguyenanh1412@gmail.com"
] | tuannguyenanh1412@gmail.com |
ca9fbbc88f9a000a3bb1f7936ca3e234f33bd783 | adedf18a22dd3ed91d85639a9bf4704a90b30732 | /tutorials/src/main/java/com/tutorial/glsltutorials/tutorials/Tutorials/Tut_TextureSphere.java | 8682fc4c5b6c8d790f168a5d3e8dc9c66504177f | [] | no_license | j1s1e1/GlslAndroidExamples | ae7b4a948cebd98c07b008b8d57fbd7181406bb7 | e4b0f5cf8133776742b7167924c4a7dfaab2bdec | refs/heads/master | 2021-01-20T06:59:23.231951 | 2016-09-01T16:38:24 | 2016-09-01T16:38:26 | 23,824,976 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,222 | java | package com.tutorial.glsltutorials.tutorials.Tutorials;
import android.opengl.GLES20;
import com.tutorial.glsltutorials.tutorials.GLES_Helpers.FragmentShaders;
import com.tutorial.glsltutorials.tutorials.GLES_Helpers.Shader;
import com.tutorial.glsltutorials.tutorials.GLES_Helpers.Textures;
import com.tutorial.glsltutorials.tutorials.GLES_Helpers.VertexShaders;
import com.tutorial.glsltutorials.tutorials.R;
import com.tutorial.glsltutorials.tutorials.Shapes.Icosahedron;
/**
* Created by jamie on 11/23/14.
*/
public class Tut_TextureSphere extends TutorialBase {
private int current_texture;
class ProgramData
{
public int theProgram;
public int position;
public int texCoord;
};
static ProgramData simpleTextureProgram;
static int sampler = 0;
static int texUnit = 0;
static int g_colorTexUnit = 0;
static float[] vertexData;
static float[] textureCoordinates;
static float[] vertexDataWithTextureCoordinates;
private static int vertexCount;
private static int texCoordOffset;
ProgramData LoadProgram(String strVertexShader, String strFragmentShader)
{
ProgramData data = new ProgramData();
int vertex_shader = Shader.compileShader(GLES20.GL_VERTEX_SHADER, strVertexShader);
int fragment_shader = Shader.compileShader(GLES20.GL_FRAGMENT_SHADER, strFragmentShader);
data.theProgram = Shader.createAndLinkProgram(vertex_shader, fragment_shader);
data.position = GLES20.glGetAttribLocation(data.theProgram, "position");
data.texCoord = GLES20.glGetAttribLocation(data.theProgram, "texCoord");
int colorTextureUnif = GLES20.glGetUniformLocation(data.theProgram, "diffuseColorTex");
GLES20.glUseProgram(data.theProgram);
GLES20.glUniform1f(colorTextureUnif, g_colorTexUnit);
GLES20.glUseProgram(0);
return data;
}
void InitializePrograms()
{
simpleTextureProgram = LoadProgram(VertexShaders.SimpleTexture, FragmentShaders.SimpleTexture);
}
void CreateSampler()
{
/* FIXME GLES30 only
GLES20.glGenSamplers(1, sampler);
GLES20.glSamplerParameter(sampler, SamplerParameterName.TextureMagFilter, (int)TextureMagFilter.Nearest);
GLES20.glSamplerParameter(sampler, SamplerParameterName.TextureMinFilter, (int)TextureMinFilter.Nearest);
GLES20.glSamplerParameter(sampler, SamplerParameterName.TextureWrapT, (int)TextureWrapMode.Repeat);
*/
// Set filtering
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST);
}
private void ScaleCoordinates(float scale, float zOffset)
{
for (int i = 0; i < vertexData.length; i++)
{
vertexData[i] = vertexData[i] * scale;
if (i % 3 == 2) vertexData[i] = vertexData[i] + zOffset;
}
}
private void AddFourthCoordinate()
{
float[] newVertexData = new float[vertexData.length * 4/3];
for (int i = 0; i < vertexData.length / 3; i++)
{
System.arraycopy(vertexData, i*3, newVertexData, i * 4, 3);
newVertexData[i*4+3] = 1f;
}
vertexData = newVertexData;
}
private void CalculateTextureCoordinates()
{
textureCoordinates = new float[vertexCount * TEXTURE_DATA_SIZE_IN_ELEMENTS];
for (int vertex = 0; vertex < vertexCount; vertex++)
{
float x = vertexData[vertex * 3];
float y = vertexData[vertex * 3 + 1];
float z = vertexData[vertex * 3 + 2];
float longitude = (float)Math.atan2(y, x);
float latitude = (float)Math.asin(z);
textureCoordinates[vertex * 2] = (float)((longitude + Math.PI) / (Math.PI * 2));
textureCoordinates[vertex * 2 + 1] = (float)((latitude + Math.PI/2) / Math.PI);
if (textureCoordinates[vertex * 2] < 0) textureCoordinates[vertex * 2] = 0f;
if (textureCoordinates[vertex * 2] > 1) textureCoordinates[vertex * 2] = 1f;
if (textureCoordinates[vertex * 2 + 1] < 0) textureCoordinates[vertex * 2] = 0f;
if (textureCoordinates[vertex * 2 + 1] > 1) textureCoordinates[vertex * 2] = 1f;
}
// center all x coordinates in original 100%
for (int vertex = 0; vertex < vertexCount; vertex++)
{
textureCoordinates[vertex * 2] = 1f/12f + 10f/12f * textureCoordinates[vertex * 2];
}
// Check each set of 3 coordinates for crossing edges. Move some if necessary
for (int vertex = 0; vertex < vertexCount; vertex = vertex + 3)
{
if (textureCoordinates[vertex * 2] < 0.35f)
{
if (textureCoordinates[(vertex + 1) * 2] > 0.65f)
{
textureCoordinates[(vertex + 1) * 2] = textureCoordinates[(vertex + 1) * 2] - 10f/12f;
}
if (textureCoordinates[(vertex + 2) * 2] > 0.65f)
{
textureCoordinates[(vertex + 2) * 2] = textureCoordinates[(vertex + 2) * 2] - 10f/12f;
}
}
if (textureCoordinates[vertex * 2] > 0.65f)
{
if (textureCoordinates[(vertex + 1) * 2] < 0.35f)
{
textureCoordinates[(vertex + 1) * 2] = textureCoordinates[(vertex + 1) * 2] + 10f/12f;
}
if (textureCoordinates[(vertex + 2) * 2] < 0.35f)
{
textureCoordinates[(vertex + 2) * 2] = textureCoordinates[(vertex + 2) * 2] + 10f/12f;
}
}
}
}
private void AddTextureCoordinates()
{
vertexDataWithTextureCoordinates = new float[vertexData.length + textureCoordinates.length];
System.arraycopy(vertexData, 0, vertexDataWithTextureCoordinates, 0, vertexData.length);
System.arraycopy(textureCoordinates, 0, vertexDataWithTextureCoordinates, vertexData.length,
textureCoordinates.length);
}
protected void init ()
{
vertexData = Icosahedron.GetDividedTriangles(2);
vertexCount = vertexData.length / 3; // Icosahedron class only uses 3 floats per vertex
CalculateTextureCoordinates();
ScaleCoordinates(0.8f, 0.5f);
AddFourthCoordinate();
vertexCount = vertexData.length / COORDS_PER_VERTEX;
texCoordOffset = 4 * 4 * vertexCount;
AddTextureCoordinates();
InitializePrograms();
initializeVertexBuffer(vertexDataWithTextureCoordinates);
CreateSampler();
GLES20.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
//current_texture = Textures.Load("Mars_MGS_colorhillshade_mola_1024.jpg", 1);
current_texture = Textures.loadTexture(Shader.context, R.drawable.venus_magellan, true);
GLES20.glEnable(GLES20.GL_TEXTURE_2D);
setupDepthAndCull();
}
public void display()
{
clearDisplay();
GLES20.glUseProgram(simpleTextureProgram.theProgram);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, current_texture);
//GLES20.glBindSampler(texUnit, sampler);
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, vertexBufferObject[0]);
GLES20.glEnableVertexAttribArray(simpleTextureProgram.position);
GLES20.glEnableVertexAttribArray(simpleTextureProgram.texCoord);
GLES20.glVertexAttribPointer(simpleTextureProgram.position, POSITION_DATA_SIZE_IN_ELEMENTS, GLES20.GL_FLOAT,
false, POSITION_STRIDE, 0);
GLES20.glVertexAttribPointer(simpleTextureProgram.texCoord, TEXTURE_DATA_SIZE_IN_ELEMENTS, GLES20.GL_FLOAT,
false, TEXTURE_STRIDE, texCoordOffset);
GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, vertexCount);
GLES20.glDisableVertexAttribArray(simpleTextureProgram.position);
GLES20.glDisableVertexAttribArray(simpleTextureProgram.texCoord);
//GLES20.glBindSampler(texUnit, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glUseProgram(0);
}
}
| [
"JamesSEdgar@GMail.com"
] | JamesSEdgar@GMail.com |
850d22bab5ba70c905f45250ad564f98e1b23f17 | bf3091dc2e8003c724ea86c036b4c3f6eb36ab31 | /src/main/java/com/data/userresult.java | 8a0096011e070a65a1be4e2368061e7bcb7cda56 | [] | no_license | sakshi151990/GKQuiz | c50dd830bbb203a9123e79b461af5351f6f02869 | 3345de5e48ac10718adeb3df9dcfec9d8df63e55 | refs/heads/master | 2020-03-18T19:16:44.626772 | 2018-06-10T04:33:31 | 2018-06-10T04:33:31 | 135,144,985 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,495 | java | package com.data;
import javax.annotation.Generated;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Table(name="RESULT")
public class userresult {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="RESULTID")
private int resultid;
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="NAME")
private User user;
@Column(name="USERESULT")
private int useresult;
@Column(name="CORRECT")
private int correct;
@Column(name="INCORRECT")
private int incorrect;
public userresult(User userid, int result, int correct, int incorrect) {
super();
this.user = userid;
this.useresult = result;
this.correct = correct;
this.incorrect = incorrect;
}
public userresult() {
// TODO Auto-generated constructor stub
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public int getResult() {
return useresult;
}
public void setResult(int result) {
this.useresult = result;
}
public int getCorrect() {
return correct;
}
public void setCorrect(int correct) {
this.correct = correct;
}
public int getIncorrect() {
return incorrect;
}
public void setIncorrect(int incorrect) {
this.incorrect = incorrect;
}
}
| [
"sakshikansal08@gmail.com"
] | sakshikansal08@gmail.com |
e68dd58932ca3662f1bacddc9411e26f33264b24 | ff67a2f17470f39666d74c7cd15ec48ca4945774 | /src/test/java/br/gov/servicos/editor/utils/UncheckedTest.java | 25255f71fcd69a9790ae440832a3c5e5c6a8f0ac | [
"MIT"
] | permissive | ricciardi/editor-de-servicos | 76cdba811ec7f31ba9e10ebbc293261235d38008 | d0f1acb210b0e8280da748a695a1deaee1bbd7a0 | refs/heads/master | 2020-12-25T11:20:40.870780 | 2015-09-04T13:57:24 | 2015-09-04T13:58:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 555 | java | package br.gov.servicos.editor.utils;
import org.junit.Test;
public class UncheckedTest {
@Test(expected = Exception.class)
public void retornaVersaoSemExcecoesDaFuncao() throws Exception {
Unchecked.Function.<Integer, Integer>unchecked(x -> {
throw new Exception("");
}).apply(1);
}
@Test(expected = Exception.class)
public void retornaVersaoSemExcecoesDeSupplier() throws Exception {
Unchecked.Supplier.<Integer>unchecked(() -> {
throw new Exception("");
}).get();
}
} | [
"cvillela@thoughtworks.com"
] | cvillela@thoughtworks.com |
6a71210fa47c3d9b9d8ae0f40fef94352ecba3c5 | 8fa6e740fdbab106e56eb004c0b7e28db58ea9e3 | /Zafiro/src/Compras/ZafCom32/ZafCom32.java | 9c7e439ba435de22f3f543cbe8e2115ee9ccfc1c | [] | no_license | Bostel87/Zafiro_Escritorio | 639d476ea105ce87267c8a9424d56c7f2e65c676 | c47268d8df084cdd3d39f63026178333caed4f71 | refs/heads/master | 2020-11-24T17:04:46.216747 | 2019-12-16T15:24:34 | 2019-12-16T15:24:34 | 228,260,889 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 212,972 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* ZafCom32.java
*
* Created on Aug 24, 2009, 11:34:14 AM
*/
package Compras.ZafCom32;
import Librerias.ZafColNumerada.ZafColNumerada;
import Librerias.ZafParSis.ZafParSis;
import Librerias.ZafTblUti.ZafTblBus.ZafTblBus;
import Librerias.ZafTblUti.ZafTblCelEdiChk.ZafTblCelEdiChk;
import Librerias.ZafTblUti.ZafTblCelRenChk.ZafTblCelRenChk;
import Librerias.ZafTblUti.ZafTblCelRenLbl.ZafTblCelRenLbl;
import Librerias.ZafTblUti.ZafTblEdi.ZafTblEdi;
import Librerias.ZafTblUti.ZafTblFilCab.ZafTblFilCab;
import Librerias.ZafTblUti.ZafTblHeaGrp.ZafTblHeaColGrp;
import Librerias.ZafTblUti.ZafTblHeaGrp.ZafTblHeaGrp;
import Librerias.ZafTblUti.ZafTblMod.ZafTblMod;
import Librerias.ZafTblUti.ZafTblOrd.ZafTblOrd;
import Librerias.ZafTblUti.ZafTblPopMnu.ZafTblPopMnu;
import Librerias.ZafUtil.ZafUtil;
import Librerias.ZafVenCon.ZafVenCon;
import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Vector;
import Librerias.ZafTblUti.ZafTblCelRenBut.ZafTblCelRenBut;
import Librerias.ZafTblUti.ZafTblCelEdiButDlg.ZafTblCelEdiButDlg;
import Librerias.ZafTblUti.ZafTblCelEdiTxt.ZafTblCelEdiTxt;
import Librerias.ZafPerUsr.ZafPerUsr;
import java.math.BigInteger;
import javax.swing.SpinnerNumberModel;
/**
*
* @author ilino
*/
public class ZafCom32 extends javax.swing.JInternalFrame {
private ZafParSis objParSis;
private ZafUtil objUti;
private String strCodBodDes, strNomBodDes;
private ZafVenCon vcoBodDes;
private String strSQL, strAux;
private final int INT_TBL_DAT_HIS_LIN=0;
private final int INT_TBL_DAT_HIS_CHK=1;
private final int INT_TBL_DAT_HIS_ANI=2;
private final int INT_TBL_DAT_HIS_NUM_MES=3;
private final int INT_TBL_DAT_HIS_MES=4;
private Vector vecCabHis, vecRegHis, vecDatHis, vecAux;
private Vector vecCab, vecReg, vecDat;
private ZafTblMod objTblModHis, objTblMod;
private ZafColNumerada objColNumHis, objColNum;
private ZafTblFilCab objTblFilCabHis, objTblFilCab;
private ZafTblEdi objTblEdi;
private ZafTblCelRenChk objTblCelRenChkHis;
private ZafTblCelEdiChk objTblCelEdiChkHis;
private ZafDocLis objDocLis;
private ZafVenCon vcoItm;
private boolean blnHayCam;
private Connection con;
private Statement stm;
private ResultSet rst;
private String strCodAlt, strNomItm;
//PARA COLUMNAS ESTATICAS DE LA IZQUIERDA
private final int INT_TBL_DAT_LIN=0;
private final int INT_TBL_DAT_COD_ITM=1;
private final int INT_TBL_DAT_COD_ALT_ITM=2;
private final int INT_TBL_DAT_COD_ALT_ITM_DOS=3;
private final int INT_TBL_DAT_NOM_ITM=4;
private final int INT_TBL_DAT_UNI_MED=5;
private final int INT_TBL_DAT_STK_ACT_CEN_DIS=6;
private final int INT_TBL_DAT_DIS_CEN_DIS=7;
private ZafTblPopMnu objTblPopMnu;
private ZafTblBus objTblBus;
private ZafTblOrd objTblOrd;
private ArrayList arlRegAniAdd, arlDatAniAdd;
private final int INT_ARL_ANI=0;
private final int INT_ARL_NUM_MES=1;
private final int INT_ARL_MES=2;
private final int INT_ARL_COL=3;
private boolean blnCon;
private ZafThreadGUI objThrGUI;
//private int intNumColAdi=0;
private ZafTblCelRenLbl objTblCelRenLbl;
private String strDesCorCla, strDesLarCla;
private ZafVenCon vcoCla;
private ZafTblCelRenBut objTblCelRenBut;
private ZafTblCelEdiButDlg objTblCelEdiBut;
private ZafCom32_01 objCom32_01;
private ZafTblCelEdiTxt objTblCelEdiTxt;
private ZafPerUsr objPerUsr;
private int intNumColFinModEst;//la ultima columna del modelo estatico
private int intNumColAdiFec, intNumColIniFec, intNumColFinFec;//columnas a adicionar del filtro seleccionado por mes /anio
private int intNumColAdiTot, intNumColIniTot, intNumColFinTot;//columnas a adicionar para totales(obtenidas por filtro de mes/anio)
private int intNumColAdiStkAct, intNumColIniStkAct, intNumColFinStkAct;//columna del stock actual
private int intNumColAdiProMen, intNumColIniProMen, intNumColFinProMen, intColPromMan;//columna de stock minimo
private int intNumColAdiStkMinExc, intNumColIniStkMinExc, intNumColFinStkMinExc;//columna de stock minimo
private int intNumColAdiObs, intNumColIniObs, intNumColFinStkObs;//columna de observacion
private int intNumColAdiRep, intNumColIniStkRep, intNumColFinStkRep;//columna de reposicion
private int intNumColAdiCanPenRep, intNumColIniCanPenRep, intNumColFinCanPenRep;//columna de reposicion
private ZafTblCelEdiTxt objTblCelEdiTxtPro,objTblCelEdiTxtMin;
private final int INT_COD_BOD_CEN_DIS=15;
/** Crea una nueva instancia de la clase ZafCon06. */
public ZafCom32(ZafParSis obj) {
try {
initComponents();
//Inicializar objetos.
objParSis = (ZafParSis) obj.clone();
vecDatHis=new Vector();
arlDatAniAdd=new ArrayList();
} catch (CloneNotSupportedException e) {
this.setTitle(this.getTitle() + " [ERROR]");
}
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
panCon = new javax.swing.JPanel();
lblTit = new javax.swing.JLabel();
tabFrm = new javax.swing.JTabbedPane();
panConFil = new javax.swing.JPanel();
panRep = new javax.swing.JPanel();
panParRep = new javax.swing.JPanel();
lblBodDes = new javax.swing.JLabel();
txtCodBodDes = new javax.swing.JTextField();
txtNomBodDes = new javax.swing.JTextField();
butBodDes = new javax.swing.JButton();
panCanItmRep = new javax.swing.JPanel();
panOptHis = new javax.swing.JPanel();
chkHisVta = new javax.swing.JCheckBox();
optHisMen = new javax.swing.JRadioButton();
optHisAnu = new javax.swing.JRadioButton();
panFilHis = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
tblHis = new javax.swing.JTable();
jPanel1 = new javax.swing.JPanel();
panFacMin = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
txtValMin = new javax.swing.JTextField();
txtValMax = new javax.swing.JTextField();
panItm = new javax.swing.JPanel();
panFilItm = new javax.swing.JPanel();
optTodReg = new javax.swing.JRadioButton();
optFilReg = new javax.swing.JRadioButton();
lblCla = new javax.swing.JLabel();
txtCodCla = new javax.swing.JTextField();
txtDesCorCla = new javax.swing.JTextField();
txtDesLarCla = new javax.swing.JTextField();
butCla = new javax.swing.JButton();
lblItm = new javax.swing.JLabel();
txtCodItm = new javax.swing.JTextField();
txtCodAltItm = new javax.swing.JTextField();
txtNomItm = new javax.swing.JTextField();
butItm = new javax.swing.JButton();
lblNumMesRep = new javax.swing.JLabel();
jspNumMesRep = new javax.swing.JSpinner();
panItmDesHas = new javax.swing.JPanel();
jPanel3 = new javax.swing.JPanel();
lblCodAltItmDes = new javax.swing.JLabel();
txtCodAltItmHas = new javax.swing.JTextField();
lblCodAltItmHas = new javax.swing.JLabel();
txtCodAltItmDes = new javax.swing.JTextField();
chkStkMinSug = new javax.swing.JCheckBox();
chkHidColFec = new javax.swing.JCheckBox();
jPanel5 = new javax.swing.JPanel();
spnDat = new javax.swing.JScrollPane();
tblDat = new javax.swing.JTable() {
protected javax.swing.table.JTableHeader createDefaultTableHeader()
{
return new ZafTblHeaGrp(columnModel);
}
};
panPie = new javax.swing.JPanel();
panBot = new javax.swing.JPanel();
butCon = new javax.swing.JButton();
butCalRep = new javax.swing.JButton();
butGua = new javax.swing.JButton();
butCer = new javax.swing.JButton();
panBarEst = new javax.swing.JPanel();
lblMsgSis = new javax.swing.JLabel();
jPanel6 = new javax.swing.JPanel();
pgrSis = new javax.swing.JProgressBar();
setClosable(true);
setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
setIconifiable(true);
setMaximizable(true);
setResizable(true);
addInternalFrameListener(new javax.swing.event.InternalFrameListener() {
public void internalFrameActivated(javax.swing.event.InternalFrameEvent evt) {
}
public void internalFrameClosed(javax.swing.event.InternalFrameEvent evt) {
}
public void internalFrameClosing(javax.swing.event.InternalFrameEvent evt) {
exitForm(evt);
}
public void internalFrameDeactivated(javax.swing.event.InternalFrameEvent evt) {
}
public void internalFrameDeiconified(javax.swing.event.InternalFrameEvent evt) {
}
public void internalFrameIconified(javax.swing.event.InternalFrameEvent evt) {
}
public void internalFrameOpened(javax.swing.event.InternalFrameEvent evt) {
formInternalFrameOpened(evt);
}
});
getContentPane().setLayout(new java.awt.GridLayout(1, 0));
panCon.setLayout(new java.awt.BorderLayout());
lblTit.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
lblTit.setText("jLabel1");
panCon.add(lblTit, java.awt.BorderLayout.PAGE_START);
panConFil.setLayout(new java.awt.BorderLayout());
panRep.setPreferredSize(new java.awt.Dimension(710, 210));
panRep.setLayout(new java.awt.BorderLayout());
panParRep.setPreferredSize(new java.awt.Dimension(344, 24));
panParRep.setLayout(null);
lblBodDes.setText("Bodega:");
lblBodDes.setToolTipText("Bodega en la que se debe hacer el conteo");
panParRep.add(lblBodDes);
lblBodDes.setBounds(8, 6, 70, 14);
txtCodBodDes.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtCodBodDesActionPerformed(evt);
}
});
txtCodBodDes.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
txtCodBodDesFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
txtCodBodDesFocusLost(evt);
}
});
panParRep.add(txtCodBodDes);
txtCodBodDes.setBounds(70, 2, 40, 20);
txtNomBodDes.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtNomBodDesActionPerformed(evt);
}
});
txtNomBodDes.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
txtNomBodDesFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
txtNomBodDesFocusLost(evt);
}
});
panParRep.add(txtNomBodDes);
txtNomBodDes.setBounds(110, 2, 270, 20);
butBodDes.setText("...");
butBodDes.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
butBodDesActionPerformed(evt);
}
});
panParRep.add(butBodDes);
butBodDes.setBounds(380, 2, 20, 20);
panRep.add(panParRep, java.awt.BorderLayout.NORTH);
panCanItmRep.setPreferredSize(new java.awt.Dimension(350, 100));
panCanItmRep.setLayout(new java.awt.BorderLayout());
panOptHis.setPreferredSize(new java.awt.Dimension(258, 48));
panOptHis.setLayout(null);
chkHisVta.setSelected(true);
chkHisVta.setText("Histórico de ventas");
chkHisVta.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
chkHisVtaActionPerformed(evt);
}
});
panOptHis.add(chkHisVta);
chkHisVta.setBounds(3, 0, 180, 14);
optHisMen.setText("Histórico mensual");
optHisMen.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
optHisMenActionPerformed(evt);
}
});
panOptHis.add(optHisMen);
optHisMen.setBounds(20, 30, 180, 14);
optHisAnu.setSelected(true);
optHisAnu.setText("Histórico anual");
optHisAnu.setPreferredSize(new java.awt.Dimension(109, 23));
optHisAnu.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
optHisAnuActionPerformed(evt);
}
});
panOptHis.add(optHisAnu);
optHisAnu.setBounds(20, 16, 180, 14);
panCanItmRep.add(panOptHis, java.awt.BorderLayout.NORTH);
panFilHis.setPreferredSize(new java.awt.Dimension(452, 360));
panFilHis.setLayout(new java.awt.BorderLayout());
jScrollPane1.setPreferredSize(new java.awt.Dimension(452, 400));
tblHis.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane1.setViewportView(tblHis);
panFilHis.add(jScrollPane1, java.awt.BorderLayout.CENTER);
panCanItmRep.add(panFilHis, java.awt.BorderLayout.CENTER);
panRep.add(panCanItmRep, java.awt.BorderLayout.WEST);
jPanel1.setLayout(null);
panFacMin.setBorder(javax.swing.BorderFactory.createTitledBorder("Factores"));
panFacMin.setLayout(null);
jLabel1.setText("Mínimo:");
panFacMin.add(jLabel1);
jLabel1.setBounds(20, 22, 60, 14);
jLabel2.setText("Máximo:");
panFacMin.add(jLabel2);
jLabel2.setBounds(20, 42, 60, 14);
panFacMin.add(txtValMin);
txtValMin.setBounds(70, 18, 80, 20);
panFacMin.add(txtValMax);
txtValMax.setBounds(70, 40, 80, 20);
jPanel1.add(panFacMin);
panFacMin.setBounds(100, 10, 190, 80);
panRep.add(jPanel1, java.awt.BorderLayout.CENTER);
panConFil.add(panRep, java.awt.BorderLayout.CENTER);
panItm.setPreferredSize(new java.awt.Dimension(100, 172));
panItm.setLayout(new java.awt.BorderLayout());
panFilItm.setPreferredSize(new java.awt.Dimension(420, 100));
panFilItm.setLayout(null);
optTodReg.setSelected(true);
optTodReg.setText("Todos los items");
optTodReg.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
optTodRegActionPerformed(evt);
}
});
panFilItm.add(optTodReg);
optTodReg.setBounds(8, 26, 410, 14);
optFilReg.setText("Sólo los items que cumplan el criterio seleccionado");
optFilReg.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
optFilRegActionPerformed(evt);
}
});
panFilItm.add(optFilReg);
optFilReg.setBounds(8, 42, 410, 14);
lblCla.setText("Clasificación:");
lblCla.setToolTipText("Bodega en la que se debe hacer el conteo");
panFilItm.add(lblCla);
lblCla.setBounds(30, 60, 78, 14);
panFilItm.add(txtCodCla);
txtCodCla.setBounds(70, 58, 40, 20);
txtDesCorCla.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtDesCorClaActionPerformed(evt);
}
});
txtDesCorCla.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
txtDesCorClaFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
txtDesCorClaFocusLost(evt);
}
});
panFilItm.add(txtDesCorCla);
txtDesCorCla.setBounds(110, 58, 80, 20);
txtDesLarCla.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtDesLarClaActionPerformed(evt);
}
});
txtDesLarCla.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
txtDesLarClaFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
txtDesLarClaFocusLost(evt);
}
});
panFilItm.add(txtDesLarCla);
txtDesLarCla.setBounds(190, 58, 260, 20);
butCla.setText("...");
butCla.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
butClaActionPerformed(evt);
}
});
panFilItm.add(butCla);
butCla.setBounds(450, 58, 20, 20);
lblItm.setText("Item:");
lblItm.setToolTipText("Bodega en la que se debe hacer el conteo");
panFilItm.add(lblItm);
lblItm.setBounds(30, 80, 60, 16);
panFilItm.add(txtCodItm);
txtCodItm.setBounds(70, 78, 40, 20);
txtCodAltItm.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtCodAltItmActionPerformed(evt);
}
});
txtCodAltItm.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
txtCodAltItmFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
txtCodAltItmFocusLost(evt);
}
});
panFilItm.add(txtCodAltItm);
txtCodAltItm.setBounds(110, 78, 80, 20);
txtNomItm.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtNomItmActionPerformed(evt);
}
});
txtNomItm.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
txtNomItmFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
txtNomItmFocusLost(evt);
}
});
panFilItm.add(txtNomItm);
txtNomItm.setBounds(190, 78, 260, 20);
butItm.setText("...");
butItm.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
butItmActionPerformed(evt);
}
});
panFilItm.add(butItm);
butItm.setBounds(450, 78, 20, 20);
lblNumMesRep.setText("Número de meses a reponer:");
panFilItm.add(lblNumMesRep);
lblNumMesRep.setBounds(10, 8, 180, 14);
jspNumMesRep.setToolTipText("Para expresar decimales usar \",\" no \".\"");
panFilItm.add(jspNumMesRep);
jspNumMesRep.setBounds(200, 4, 80, 20);
panItm.add(panFilItm, java.awt.BorderLayout.NORTH);
panItmDesHas.setPreferredSize(new java.awt.Dimension(100, 44));
panItmDesHas.setRequestFocusEnabled(false);
panItmDesHas.setLayout(new java.awt.BorderLayout());
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Código alterno del item"));
jPanel3.setPreferredSize(new java.awt.Dimension(100, 60));
jPanel3.setLayout(null);
lblCodAltItmDes.setText("Desde:");
jPanel3.add(lblCodAltItmDes);
lblCodAltItmDes.setBounds(30, 20, 60, 14);
txtCodAltItmHas.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
txtCodAltItmHasFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
txtCodAltItmHasFocusLost(evt);
}
});
jPanel3.add(txtCodAltItmHas);
txtCodAltItmHas.setBounds(300, 16, 110, 20);
lblCodAltItmHas.setText("Hasta:");
jPanel3.add(lblCodAltItmHas);
lblCodAltItmHas.setBounds(240, 20, 60, 14);
txtCodAltItmDes.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
txtCodAltItmDesFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
txtCodAltItmDesFocusLost(evt);
}
});
jPanel3.add(txtCodAltItmDes);
txtCodAltItmDes.setBounds(90, 16, 110, 20);
chkStkMinSug.setText("Sólo mostrar items que tienen stock mínimo sugerido");
jPanel3.add(chkStkMinSug);
chkStkMinSug.setBounds(3, 38, 340, 14);
chkHidColFec.setSelected(true);
chkHidColFec.setText("Ocultar columnas del Histórico de ventas");
jPanel3.add(chkHidColFec);
chkHidColFec.setBounds(3, 54, 340, 14);
panItmDesHas.add(jPanel3, java.awt.BorderLayout.CENTER);
panItm.add(panItmDesHas, java.awt.BorderLayout.CENTER);
panConFil.add(panItm, java.awt.BorderLayout.SOUTH);
tabFrm.addTab("Filtro", panConFil);
jPanel5.setLayout(new java.awt.BorderLayout());
tblDat.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
spnDat.setViewportView(tblDat);
jPanel5.add(spnDat, java.awt.BorderLayout.CENTER);
tabFrm.addTab("Reporte", jPanel5);
panCon.add(tabFrm, java.awt.BorderLayout.CENTER);
panPie.setPreferredSize(new java.awt.Dimension(685, 50));
panPie.setLayout(new java.awt.BorderLayout());
panBot.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT, 5, 2));
butCon.setText("Consultar");
butCon.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
butConActionPerformed(evt);
}
});
panBot.add(butCon);
butCalRep.setText("Calcular reposición");
butCalRep.setToolTipText("Cambia el número de meses a reponer");
butCalRep.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
butCalRepActionPerformed(evt);
}
});
panBot.add(butCalRep);
butGua.setText("Guardar");
butGua.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
butGuaActionPerformed(evt);
}
});
panBot.add(butGua);
butCer.setText("Cerrar");
butCer.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
butCerActionPerformed(evt);
}
});
panBot.add(butCer);
panPie.add(panBot, java.awt.BorderLayout.CENTER);
panBarEst.setPreferredSize(new java.awt.Dimension(320, 22));
panBarEst.setLayout(new java.awt.BorderLayout());
lblMsgSis.setText("Listo");
lblMsgSis.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
panBarEst.add(lblMsgSis, java.awt.BorderLayout.CENTER);
jPanel6.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
jPanel6.setMinimumSize(new java.awt.Dimension(24, 26));
jPanel6.setPreferredSize(new java.awt.Dimension(200, 15));
jPanel6.setLayout(new java.awt.BorderLayout(2, 2));
pgrSis.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
pgrSis.setBorderPainted(false);
pgrSis.setDebugGraphicsOptions(javax.swing.DebugGraphics.NONE_OPTION);
pgrSis.setPreferredSize(new java.awt.Dimension(100, 16));
jPanel6.add(pgrSis, java.awt.BorderLayout.CENTER);
panBarEst.add(jPanel6, java.awt.BorderLayout.EAST);
panPie.add(panBarEst, java.awt.BorderLayout.SOUTH);
panCon.add(panPie, java.awt.BorderLayout.SOUTH);
getContentPane().add(panCon);
setBounds(0, 0, 700, 450);
}// </editor-fold>//GEN-END:initComponents
private void txtCodBodDesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtCodBodDesActionPerformed
// TODO add your handling code here:
txtCodBodDes.transferFocus();
}//GEN-LAST:event_txtCodBodDesActionPerformed
private void txtCodBodDesFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtCodBodDesFocusGained
// TODO add your handling code here:
strCodBodDes = txtCodBodDes.getText();
txtCodBodDes.selectAll();
}//GEN-LAST:event_txtCodBodDesFocusGained
private void txtCodBodDesFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtCodBodDesFocusLost
// TODO add your handling code here:
//Validar el contenido de la celda sálo si ha cambiado.
if (!txtCodBodDes.getText().equalsIgnoreCase(strCodBodDes)) {
if (txtCodBodDes.getText().equals("")) {
txtCodBodDes.setText("");
txtNomBodDes.setText("");
} else {
mostrarVenConBodDes(1);
}
} else
txtCodBodDes.setText(strCodBodDes);
}//GEN-LAST:event_txtCodBodDesFocusLost
private void formInternalFrameOpened(javax.swing.event.InternalFrameEvent evt) {//GEN-FIRST:event_formInternalFrameOpened
// TODO add your handling code here:
if( (objParSis.getCodigoEmpresa()==objParSis.getCodigoEmpresaGrupo()) && (objParSis.getCodigoMenu()==2332) ){
configurarFrm();
agregarDocLis();
}
else if( (objParSis.getCodigoEmpresa()==objParSis.getCodigoEmpresaGrupo()) && (objParSis.getCodigoMenu()==1662) ){
mostrarMsgInf("<HTML>Este programa sólo se puede ejecutar a través de Empresas.</HTML>");
dispose();
}
else if( (objParSis.getCodigoEmpresa()!=objParSis.getCodigoEmpresaGrupo()) && (objParSis.getCodigoMenu()==1662) ){
configurarFrm();
agregarDocLis();
}
else if( (objParSis.getCodigoEmpresa()!=objParSis.getCodigoEmpresaGrupo()) && (objParSis.getCodigoMenu()==2332) ){
mostrarMsgInf("<HTML>Este programa sólo se puede ejecutar a través de Grupo.</HTML>");
dispose();
}
}//GEN-LAST:event_formInternalFrameOpened
private void txtNomBodDesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtNomBodDesActionPerformed
// TODO add your handling code here:
txtNomBodDes.transferFocus();
}//GEN-LAST:event_txtNomBodDesActionPerformed
private void txtNomBodDesFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtNomBodDesFocusGained
// TODO add your handling code here:
strNomBodDes = txtNomBodDes.getText();
txtNomBodDes.selectAll();
}//GEN-LAST:event_txtNomBodDesFocusGained
private void txtNomBodDesFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtNomBodDesFocusLost
// TODO add your handling code here:
//Validar el contenido de la celda sálo si ha cambiado.
if (!txtNomBodDes.getText().equalsIgnoreCase(strNomBodDes)) {
if (txtNomBodDes.getText().equals("")) {
txtCodBodDes.setText("");
txtNomBodDes.setText("");
} else {
mostrarVenConBodDes(2);
}
}
else
txtNomBodDes.setText(strNomBodDes);
}//GEN-LAST:event_txtNomBodDesFocusLost
private void butBodDesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butBodDesActionPerformed
// TODO add your handling code here:
mostrarVenConBodDes(0);
}//GEN-LAST:event_butBodDesActionPerformed
private void optHisAnuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_optHisAnuActionPerformed
// TODO add your handling code here:
if(optHisAnu.isSelected()){
chkHisVta.setSelected(true);
optHisMen.setSelected(false);
cargarAnios();
}
else{
optHisMen.setSelected(true);
chkHisVta.setSelected(true);
cargarAniosMeses();
}
}//GEN-LAST:event_optHisAnuActionPerformed
private void optHisMenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_optHisMenActionPerformed
// TODO add your handling code here:
if(optHisMen.isSelected()){
chkHisVta.setSelected(true);
optHisAnu.setSelected(false);
cargarAniosMeses();
}
else{
chkHisVta.setSelected(true);
optHisAnu.setSelected(true);
cargarAnios();
}
}//GEN-LAST:event_optHisMenActionPerformed
private void txtCodAltItmActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtCodAltItmActionPerformed
// TODO add your handling code here:
txtCodAltItm.transferFocus();
}//GEN-LAST:event_txtCodAltItmActionPerformed
private void txtCodAltItmFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtCodAltItmFocusGained
// TODO add your handling code here:
strCodAlt=txtCodAltItm.getText();
txtCodAltItm.selectAll();
}//GEN-LAST:event_txtCodAltItmFocusGained
private void txtCodAltItmFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtCodAltItmFocusLost
// TODO add your handling code here:
//Validar el contenido de la celda sólo si ha cambiado.
if (!txtCodAltItm.getText().equalsIgnoreCase(strCodAlt))
{
if (txtCodAltItm.getText().equals(""))
{
txtCodItm.setText("");
txtCodAltItm.setText("");
txtNomItm.setText("");
}
else
{
mostrarVenConItm(1);
}
}
else
txtCodAltItm.setText(strCodAlt);
if(txtCodAltItm.getText().length()>0){
optFilReg.setSelected(true);
optTodReg.setSelected(false);
txtCodAltItmDes.setText("");
txtCodAltItmHas.setText("");
}
}//GEN-LAST:event_txtCodAltItmFocusLost
private void txtNomItmActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtNomItmActionPerformed
// TODO add your handling code here:
txtNomItm.transferFocus();
}//GEN-LAST:event_txtNomItmActionPerformed
private void txtNomItmFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtNomItmFocusGained
// TODO add your handling code here:
strNomItm=txtNomItm.getText();
txtNomItm.selectAll();
}//GEN-LAST:event_txtNomItmFocusGained
private void txtNomItmFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtNomItmFocusLost
// TODO add your handling code here:
//Validar el contenido de la celda sólo si ha cambiado.
if (!txtNomItm.getText().equalsIgnoreCase(strNomItm))
{
if (txtNomItm.getText().equals(""))
{
txtCodItm.setText("");
txtCodAltItm.setText("");
txtNomItm.setText("");
}
else
{
mostrarVenConItm(2);
}
}
else
txtNomItm.setText(strNomItm);
if(txtNomItm.getText().length()>0){
optFilReg.setSelected(true);
optTodReg.setSelected(false);
txtCodAltItmDes.setText("");
txtCodAltItmHas.setText("");
}
}//GEN-LAST:event_txtNomItmFocusLost
private void butItmActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butItmActionPerformed
// TODO add your handling code here:
mostrarVenConItm(0);
if(txtNomItm.getText().length()>0){
optFilReg.setSelected(true);
optTodReg.setSelected(false);
txtCodAltItmDes.setText("");
txtCodAltItmHas.setText("");
}
}//GEN-LAST:event_butItmActionPerformed
private void txtCodAltItmDesFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtCodAltItmDesFocusGained
// TODO add your handling code here:
txtCodAltItmDes.selectAll();
}//GEN-LAST:event_txtCodAltItmDesFocusGained
private void txtCodAltItmDesFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtCodAltItmDesFocusLost
// TODO add your handling code here:
// TODO add your handling code here:
if (txtCodAltItmDes.getText().length()>0)
{
optFilReg.setSelected(true);
optTodReg.setSelected(false);
txtCodItm.setText("");
txtCodAltItm.setText("");
txtNomItm.setText("");
if (txtCodAltItmHas.getText().length()==0)
txtCodAltItmHas.setText(txtCodAltItmDes.getText());
}
}//GEN-LAST:event_txtCodAltItmDesFocusLost
private void txtCodAltItmHasFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtCodAltItmHasFocusGained
// TODO add your handling code here:
txtCodAltItmHas.selectAll();
}//GEN-LAST:event_txtCodAltItmHasFocusGained
private void txtCodAltItmHasFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtCodAltItmHasFocusLost
// TODO add your handling code here:
if (txtCodAltItmHas.getText().length()>0){
optFilReg.setSelected(true);
optTodReg.setSelected(false);
}
}//GEN-LAST:event_txtCodAltItmHasFocusLost
private void optTodRegActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_optTodRegActionPerformed
// TODO add your handling code here:
if(optTodReg.isSelected()){
optFilReg.setSelected(false);
txtCodItm.setText("");
txtCodAltItm.setText("");
txtNomItm.setText("");
txtCodAltItmDes.setText("");
txtCodAltItmHas.setText("");
}
}//GEN-LAST:event_optTodRegActionPerformed
private void optFilRegActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_optFilRegActionPerformed
// TODO add your handling code here:
if(optFilReg.isSelected())
optTodReg.setSelected(false);
}//GEN-LAST:event_optFilRegActionPerformed
private void exitForm(javax.swing.event.InternalFrameEvent evt) {//GEN-FIRST:event_exitForm
// TODO add your handling code here:
String strTit, strMsg;
try
{
javax.swing.JOptionPane oppMsg=new javax.swing.JOptionPane();
strTit="Mensaje del sistema Zafiro";
strMsg="¿Está seguro que desea cerrar este programa?";
if (oppMsg.showConfirmDialog(this,strMsg,strTit,javax.swing.JOptionPane.YES_NO_OPTION,javax.swing.JOptionPane.QUESTION_MESSAGE)==javax.swing.JOptionPane.YES_OPTION)
{
dispose();
}
}
catch (Exception e)
{
dispose();
}
}//GEN-LAST:event_exitForm
private void butConActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butConActionPerformed
// TODO add your handling code here:
objTblMod.removeAllRows();
if (butCon.getText().equals("Consultar")){
//objTblTotales.isActivo(false);
blnCon=true;
if (objThrGUI==null){
objThrGUI=new ZafThreadGUI();
objThrGUI.start();
}
}
else{
blnCon=false;
}
}//GEN-LAST:event_butConActionPerformed
private void txtDesLarClaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtDesLarClaActionPerformed
// TODO add your handling code here:
txtDesLarCla.transferFocus();
}//GEN-LAST:event_txtDesLarClaActionPerformed
private void txtDesLarClaFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtDesLarClaFocusGained
// TODO add your handling code here:
strDesLarCla=txtDesLarCla.getText();
txtDesLarCla.selectAll();
}//GEN-LAST:event_txtDesLarClaFocusGained
private void txtDesLarClaFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtDesLarClaFocusLost
// TODO add your handling code here:
//Validar el contenido de la celda sálo si ha cambiado.
if (!txtDesLarCla.getText().equalsIgnoreCase(strDesLarCla)) {
if (txtDesLarCla.getText().equals("")) {
txtCodCla.setText("");
txtDesCorCla.setText("");
txtDesLarCla.setText("");
} else {
mostrarVenConCla(2);
}
} else
txtDesLarCla.setText(strDesLarCla);
}//GEN-LAST:event_txtDesLarClaFocusLost
private void txtDesCorClaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtDesCorClaActionPerformed
// TODO add your handling code here:
txtDesCorCla.transferFocus();
}//GEN-LAST:event_txtDesCorClaActionPerformed
private void txtDesCorClaFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtDesCorClaFocusGained
// TODO add your handling code here:
strDesCorCla=txtDesCorCla.getText();
txtDesCorCla.selectAll();
}//GEN-LAST:event_txtDesCorClaFocusGained
private void txtDesCorClaFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtDesCorClaFocusLost
// TODO add your handling code here:
//Validar el contenido de la celda sálo si ha cambiado.
if (!txtDesCorCla.getText().equalsIgnoreCase(strDesCorCla)) {
if (txtDesCorCla.getText().equals("")) {
txtCodCla.setText("");
txtDesCorCla.setText("");
txtDesLarCla.setText("");
} else {
mostrarVenConCla(1);
}
} else
txtDesCorCla.setText(strDesCorCla);
}//GEN-LAST:event_txtDesCorClaFocusLost
private void butClaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butClaActionPerformed
// TODO add your handling code here:
mostrarVenConCla(0);
}//GEN-LAST:event_butClaActionPerformed
private void butGuaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butGuaActionPerformed
// TODO add your handling code here:
if(guardarDatos()){
mostrarMsgInf("<HTML>La información se guardó correctamente.</HTML>");
objTblMod.removeAllRows();
cargarReg();
}
else{
mostrarMsgInf("<HTML>La información no se pudo guardar.<BR>Verifique y vuelva a intentarlo.</HTML>");
}
}//GEN-LAST:event_butGuaActionPerformed
private void butCerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butCerActionPerformed
// TODO add your handling code here:
exitForm();
}//GEN-LAST:event_butCerActionPerformed
private void chkHisVtaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkHisVtaActionPerformed
// TODO add your handling code here:
if(chkHisVta.isSelected()){
optHisAnu.setSelected(true);
cargarAnios();
}
else{
optHisAnu.setSelected(false);
optHisMen.setSelected(false);
objTblModHis.removeAllRows();
}
}//GEN-LAST:event_chkHisVtaActionPerformed
private void butCalRepActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butCalRepActionPerformed
// TODO add your handling code here:
cambiarNumeroMesesReponer();
calcularMinimoMaximo();
calcularCantidadReponer();
//Establecer el foco en el JTable sálo cuando haya datos.
if (tblDat.getRowCount()>0)
{
tabFrm.setSelectedIndex(1);
tblDat.setRowSelectionInterval(0, 0);
tblDat.requestFocus();
}
}//GEN-LAST:event_butCalRepActionPerformed
/**
* Esta funcián muestra un mensaje informativo al usuario. Se podráa utilizar
* para mostrar al usuario un mensaje que indique el campo que es invalido y que
* debe llenar o corregir.
*/
private void mostrarMsgInf(String strMsg)
{
javax.swing.JOptionPane oppMsg=new javax.swing.JOptionPane();
String strTit;
strTit="Mensaje del sistema Zafiro";
oppMsg.showMessageDialog(this,strMsg,strTit,javax.swing.JOptionPane.INFORMATION_MESSAGE);
}
/**
* Esta clase crea un hilo que permite manipular la interface gráfica de usuario (GUI).
* Por ejemplo: se la puede utilizar para cargar los datos en un JTable donde la idea
* es mostrar al usuario lo que está ocurriendo internamente. Es decir a medida que se
* llevan a cabo los procesos se podráa presentar mensajes informativos en un JLabel e
* ir incrementando un JProgressBar con lo cual el usuario estaráa informado en todo
* momento de lo que ocurre. Si se desea hacer ásto es necesario utilizar ásta clase
* ya que si no sálo se apreciaráa los cambios cuando ha terminado todo el proceso.
*/
private class ZafThreadGUI extends Thread
{
public void run()
{
if (!cargarReg())
{
//Inicializar objetos si no se pudo cargar los datos.
lblMsgSis.setText("Listo");
pgrSis.setValue(0);
butCon.setText("Consultar");
}
//Establecer el foco en el JTable sálo cuando haya datos.
if (tblDat.getRowCount()>0)
{
tabFrm.setSelectedIndex(1);
tblDat.setRowSelectionInterval(0, 0);
tblDat.requestFocus();
}
objThrGUI=null;
}
}
private boolean cargarReg(){
boolean blnRes=true;
try{
con=DriverManager.getConnection(objParSis.getStringConexion(), objParSis.getUsuarioBaseDatos(), objParSis.getClaveBaseDatos());
if(con!=null){
objTblMod.setModoOperacion(objTblMod.INT_TBL_NO_EDI);
if(isCamVal()){
if(chkHisVta.isSelected()){
if(configurarColumnasAniosMeses()){
if(optHisMen.isSelected())
{
if(objParSis.getCodigoEmpresa()==objParSis.getCodigoEmpresaGrupo())//grupo
{
if(consultarRegAniMesGrp()){
calcularColumnaTotalesAniMes();
calcularPromedioMensual();
calcularCantidadReponer();
}
}
else //por empresas
{
if(consultarRegAniMesEmp()){
calcularColumnaTotalesAniMes();
//SOLO POR EMPRESAS PORQ POR GRUPO ESTA COLUMNA DE PROMEDIO CALCULADO NO EXISTE
//para cuando no hay columnas de totales, sino esta informacion se calcula en "calcularColumnaTotalesAniMes"
calcularColumnaPromedioCalculado();
}
}
}
else if(optHisAnu.isSelected())
{
if(objParSis.getCodigoEmpresa()==objParSis.getCodigoEmpresaGrupo())//grupo
{
if(consultarRegAniGrp()){
calcularColumnaTotalesAniMes();
calcularPromedioAnual();
calcularCantidadReponer();
}
}
else //empresas
{
if(consultarRegAniEmp()){
calcularColumnaTotalesAniMes();
//SOLO POR EMPRESAS PORQ POR GRUPO ESTA COLUMNA DE PROMEDIO CALCULADO NO EXISTE
//para cuando no hay columnas de totales, sino esta informacion se calcula en "calcularColumnaTotalesAniMes"
calcularColumnaPromedioCalculado();
}
}
}
}
}
else{
if(configurarColumnasSinHistorico()){
if(consultarRegStkActGrp()){
}
}
}
}
objTblMod.initRowsState();
if(chkHidColFec.isSelected()){
System.out.println("A");
//FECHA
for(int h=intNumColIniFec; h<intNumColFinFec; h++){
System.out.println("B");
//Configurar JTable: Ocultar columnas del sistema.
objTblMod.addUserHiddenColumn(h, tblDat);
}
//TOTALES
for(int h=intNumColIniTot; h<intNumColFinTot; h++){
System.out.println("C");
//Configurar JTable: Ocultar columnas del sistema.
objTblMod.addUserHiddenColumn(h, tblDat);
}
}
else{
System.out.println("D");
//FECHA
for(int h=intNumColIniFec; h<intNumColFinFec; h++){
System.out.println("E");
objTblMod.removeUserHiddenColumn(h, tblDat);
}
//TOTALES
for(int h=intNumColIniTot; h<intNumColFinTot; h++){
System.out.println("E");
//Configurar JTable: Ocultar columnas del sistema.
objTblMod.removeUserHiddenColumn(h, tblDat);
}
}
con.close();
con=null;
}
}
catch (Exception e){
blnRes=false;
}
return blnRes;
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton butBodDes;
private javax.swing.JButton butCalRep;
private javax.swing.JButton butCer;
private javax.swing.JButton butCla;
private javax.swing.JButton butCon;
private javax.swing.JButton butGua;
private javax.swing.JButton butItm;
private javax.swing.JCheckBox chkHidColFec;
private javax.swing.JCheckBox chkHisVta;
private javax.swing.JCheckBox chkStkMinSug;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JSpinner jspNumMesRep;
private javax.swing.JLabel lblBodDes;
private javax.swing.JLabel lblCla;
private javax.swing.JLabel lblCodAltItmDes;
private javax.swing.JLabel lblCodAltItmHas;
private javax.swing.JLabel lblItm;
private javax.swing.JLabel lblMsgSis;
private javax.swing.JLabel lblNumMesRep;
private javax.swing.JLabel lblTit;
private javax.swing.JRadioButton optFilReg;
private javax.swing.JRadioButton optHisAnu;
private javax.swing.JRadioButton optHisMen;
private javax.swing.JRadioButton optTodReg;
private javax.swing.JPanel panBarEst;
private javax.swing.JPanel panBot;
private javax.swing.JPanel panCanItmRep;
private javax.swing.JPanel panCon;
private javax.swing.JPanel panConFil;
private javax.swing.JPanel panFacMin;
private javax.swing.JPanel panFilHis;
private javax.swing.JPanel panFilItm;
private javax.swing.JPanel panItm;
private javax.swing.JPanel panItmDesHas;
private javax.swing.JPanel panOptHis;
private javax.swing.JPanel panParRep;
private javax.swing.JPanel panPie;
private javax.swing.JPanel panRep;
private javax.swing.JProgressBar pgrSis;
private javax.swing.JScrollPane spnDat;
private javax.swing.JTabbedPane tabFrm;
private javax.swing.JTable tblDat;
private javax.swing.JTable tblHis;
private javax.swing.JTextField txtCodAltItm;
private javax.swing.JTextField txtCodAltItmDes;
private javax.swing.JTextField txtCodAltItmHas;
private javax.swing.JTextField txtCodBodDes;
private javax.swing.JTextField txtCodCla;
private javax.swing.JTextField txtCodItm;
private javax.swing.JTextField txtDesCorCla;
private javax.swing.JTextField txtDesLarCla;
private javax.swing.JTextField txtNomBodDes;
private javax.swing.JTextField txtNomItm;
private javax.swing.JTextField txtValMax;
private javax.swing.JTextField txtValMin;
// End of variables declaration//GEN-END:variables
/** Configurar el formulario. */
private boolean configurarFrm() {
boolean blnRes = true;
try {
objUti = new ZafUtil();
objPerUsr=new ZafPerUsr(objParSis);
//Inicializar objetos.
strAux = objParSis.getNombreMenu();
this.setTitle(strAux + " v0.3.8 ");
lblTit.setText(strAux);
txtCodBodDes.setBackground(objParSis.getColorCamposObligatorios());
txtNomBodDes.setBackground(objParSis.getColorCamposObligatorios());
txtCodItm.setVisible(false);
txtCodItm.setEditable(false);
txtCodItm.setEnabled(false);
//Configurar las ZafVenCon.
configurarVenConBod();
//Configurar los JTables.
configurarTblDatHis();
configurarTblDat();
cargarAnios();
configurarVenConCla();
configurarVenConItm();
if(objParSis.getCodigoEmpresa()==objParSis.getCodigoEmpresaGrupo()){
chkStkMinSug.setVisible(true);
chkStkMinSug.setEnabled(true);
}
else{
chkStkMinSug.setVisible(false);
chkStkMinSug.setEnabled(false);
}
txtCodCla.setVisible(false);
txtCodCla.setEditable(false);
txtCodCla.setEnabled(false);
butCon.setVisible(false);
butGua.setVisible(false);
butCer.setVisible(false);
if(objParSis.getCodigoUsuario()==1){
butCon.setVisible(true);
butGua.setVisible(true);
butCer.setVisible(true);
}
else{
if(objParSis.getCodigoMenu()==2332){//bodegas
if(objPerUsr.isOpcionEnabled(2333)){//consultar
butCon.setVisible(true);
}
if(objPerUsr.isOpcionEnabled(2334)){//guardar
butGua.setVisible(true);
}
if(objPerUsr.isOpcionEnabled(2335)){//cerrar
butCer.setVisible(true);
}
}
if(objParSis.getCodigoMenu()==1662){//proveedores
if(objPerUsr.isOpcionEnabled(1663)){//consultar
butCon.setVisible(true);
}
if(objPerUsr.isOpcionEnabled(1664)){//guardar
butGua.setVisible(true);
}
if(objPerUsr.isOpcionEnabled(1665)){//cerrar
butCer.setVisible(true);
}
}
}
//jspNumMesRep.setModel(new SpinnerNumberModel(1, 1, 100, 1));
jspNumMesRep.setModel(new SpinnerNumberModel(1, 0.25, 100, 0.1));
txtValMin.setEnabled(false);
txtValMax.setEnabled(false);
txtValMin.setText("0.50");
txtValMax.setText("1.00");
if(objParSis.getCodigoEmpresa()!=objParSis.getCodigoEmpresaGrupo()){
lblNumMesRep.setVisible(false);
jspNumMesRep.setVisible(false);
jspNumMesRep.setEnabled(false);
panFacMin.setVisible(false);
butCalRep.setVisible(false);
butCalRep.setEnabled(false);
}
} catch (Exception e) {
blnRes = false;
objUti.mostrarMsgErr_F1(this, e);
}
return blnRes;
}
/**
* Esta funcián configura el JTable "tblDat".
* @return true: Si se pudo configurar el JTable.
* <BR>false: En el caso contrario.
*/
private boolean configurarTblDatHis() {
boolean blnRes = true;
try {
//Configurar JTable: Establecer el modelo.
vecDatHis = new Vector(); //Almacena los datos
vecCabHis = new Vector(5); //Almacena las cabeceras
vecCabHis.clear();
vecCabHis.add(INT_TBL_DAT_HIS_LIN, "");
vecCabHis.add(INT_TBL_DAT_HIS_CHK, "");
vecCabHis.add(INT_TBL_DAT_HIS_ANI, "Año");
vecCabHis.add(INT_TBL_DAT_HIS_NUM_MES, "#");
vecCabHis.add(INT_TBL_DAT_HIS_MES, "Mes");
objTblModHis = new ZafTblMod();
objTblModHis.setHeader(vecCabHis);
//Configurar JTable: Establecer el modelo de la tabla.
tblHis.setModel(objTblModHis);
//Configurar JTable: Establecer tipo de seleccián.
tblHis.setRowSelectionAllowed(true);
tblHis.getTableHeader().setReorderingAllowed(false);
tblHis.setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
//Configurar JTable: Establecer la fila de cabecera.
objColNumHis = new ZafColNumerada(tblHis, INT_TBL_DAT_HIS_LIN);
//Configurar JTable: Establecer el tipo de redimensionamiento de las columnas.
tblHis.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
//Configurar JTable: Establecer el ancho de las columnas.
javax.swing.table.TableColumnModel tcmAux = tblHis.getColumnModel();
tcmAux.getColumn(INT_TBL_DAT_HIS_LIN).setPreferredWidth(26);
tcmAux.getColumn(INT_TBL_DAT_HIS_CHK).setPreferredWidth(26);
tcmAux.getColumn(INT_TBL_DAT_HIS_ANI).setPreferredWidth(50);
tcmAux.getColumn(INT_TBL_DAT_HIS_NUM_MES).setPreferredWidth(30);
tcmAux.getColumn(INT_TBL_DAT_HIS_MES).setPreferredWidth(120);
//Configurar JTable: Establecer las columnas que no se pueden redimensionar.
tcmAux.getColumn(INT_TBL_DAT_HIS_LIN).setResizable(false);
tcmAux.getColumn(INT_TBL_DAT_HIS_CHK).setResizable(false);
tcmAux.getColumn(INT_TBL_DAT_HIS_ANI).setResizable(false);
tcmAux.getColumn(INT_TBL_DAT_HIS_NUM_MES).setResizable(false);
tcmAux.getColumn(INT_TBL_DAT_HIS_MES).setResizable(false);
//Configurar JTable: Establecer la fila de cabecera.
objTblFilCabHis = new ZafTblFilCab(tblHis);
tcmAux.getColumn(INT_TBL_DAT_HIS_LIN).setCellRenderer(objTblFilCabHis);
vecAux=new Vector();
objTblModHis.setModoOperacion(objTblModHis.INT_TBL_EDI);
vecAux.add("" + INT_TBL_DAT_HIS_CHK);
objTblModHis.setColumnasEditables(vecAux);
vecAux=null;
//Configurar JTable: Editor de la tabla.
objTblEdi = new ZafTblEdi(tblHis);
//Configurar JTable: Renderizar celdas.
objTblCelRenChkHis=new ZafTblCelRenChk();
tcmAux.getColumn(INT_TBL_DAT_HIS_CHK).setCellRenderer(objTblCelRenChkHis);
objTblCelRenChkHis=null;
//Configurar JTable: Editor de celdas.
objTblCelEdiChkHis=new ZafTblCelEdiChk(tblHis);
tcmAux.getColumn(INT_TBL_DAT_HIS_CHK).setCellEditor(objTblCelEdiChkHis);
//Configurar JTable: Ocultar columnas del sistema.
objTblModHis.addSystemHiddenColumn(INT_TBL_DAT_HIS_NUM_MES, tblHis);
//Libero los objetos auxiliares.
tcmAux = null;
} catch (Exception e) {
blnRes = false;
objUti.mostrarMsgErr_F1(this, e);
}
return blnRes;
}
/**
* Esta funcián configura el JTable "tblDat".
* @return true: Si se pudo configurar el JTable.
* <BR>false: En el caso contrario.
*/
private boolean configurarTblDat() {
boolean blnRes = true;
try {
//Configurar JTable: Establecer el modelo.
vecDat = new Vector(); //Almacena los datos
vecCab = new Vector(8); //Almacena las cabeceras
vecCab.clear();
vecCab.add(INT_TBL_DAT_LIN, "");
vecCab.add(INT_TBL_DAT_COD_ITM, "Cod.Itm");
vecCab.add(INT_TBL_DAT_COD_ALT_ITM, "Cod.Alt.");
vecCab.add(INT_TBL_DAT_COD_ALT_ITM_DOS, "Cod.Alt.2");
vecCab.add(INT_TBL_DAT_NOM_ITM, "Nombre");
vecCab.add(INT_TBL_DAT_UNI_MED, "Unidad");
if(objParSis.getCodigoMenu()==2332){//bodegas
vecCab.add(INT_TBL_DAT_STK_ACT_CEN_DIS, "Stk.Cen.Dis.");
vecCab.add(INT_TBL_DAT_DIS_CEN_DIS, "Dis.Cen.Dis.");
}
objTblMod = new ZafTblMod();
objTblMod.setHeader(vecCab);
//Configurar JTable: Establecer el modelo de la tabla.
tblDat.setModel(objTblMod);
//Configurar JTable: Establecer tipo de seleccián.
tblDat.setRowSelectionAllowed(true);
tblDat.getTableHeader().setReorderingAllowed(false);
tblDat.setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
//Configurar JTable: Establecer la fila de cabecera.
objColNum = new ZafColNumerada(tblDat, INT_TBL_DAT_LIN);
//Configurar JTable: Establecer el mená de contexto.
objTblPopMnu=new ZafTblPopMnu(tblDat);
// objTblPopMnu.setPegarEnabled(true);
//Configurar JTable: Establecer el tipo de redimensionamiento de las columnas.
tblDat.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
//Configurar JTable: Establecer el ancho de las columnas.
javax.swing.table.TableColumnModel tcmAux = tblDat.getColumnModel();
tcmAux.getColumn(INT_TBL_DAT_LIN).setPreferredWidth(26);
tcmAux.getColumn(INT_TBL_DAT_COD_ITM).setPreferredWidth(60);
tcmAux.getColumn(INT_TBL_DAT_COD_ALT_ITM).setPreferredWidth(70);
tcmAux.getColumn(INT_TBL_DAT_COD_ALT_ITM_DOS).setPreferredWidth(60);
tcmAux.getColumn(INT_TBL_DAT_NOM_ITM).setPreferredWidth(200);
tcmAux.getColumn(INT_TBL_DAT_UNI_MED).setPreferredWidth(60);
if(objParSis.getCodigoMenu()==2332){//bodegas
tcmAux.getColumn(INT_TBL_DAT_STK_ACT_CEN_DIS).setPreferredWidth(70);
tcmAux.getColumn(INT_TBL_DAT_DIS_CEN_DIS).setPreferredWidth(70);
objTblCelRenLbl=new ZafTblCelRenLbl();
objTblCelRenLbl.setHorizontalAlignment(javax.swing.JLabel.RIGHT);
objTblCelRenLbl.setTipoFormato(objTblCelRenLbl.INT_FOR_NUM);
objTblCelRenLbl.setFormatoNumerico(objParSis.getFormatoNumero(),false,true);
tcmAux.getColumn(INT_TBL_DAT_STK_ACT_CEN_DIS).setCellRenderer(objTblCelRenLbl);
tcmAux.getColumn(INT_TBL_DAT_DIS_CEN_DIS).setCellRenderer(objTblCelRenLbl);
objTblCelRenLbl=null;
}
//Configurar JTable: Establecer la fila de cabecera.
objTblFilCab = new ZafTblFilCab(tblDat);
tcmAux.getColumn(INT_TBL_DAT_LIN).setCellRenderer(objTblFilCab);
//Configurar JTable: Editor de básqueda.
objTblBus=new ZafTblBus(tblDat);
objTblOrd=new ZafTblOrd(tblDat);
//Libero los objetos auxiliares.
tcmAux = null;
intNumColFinModEst=objTblMod.getColumnCount();
//Configurar JTable: Ocultar columnas del sistema.
objTblMod.addSystemHiddenColumn(INT_TBL_DAT_COD_ITM, tblDat);
} catch (Exception e) {
blnRes = false;
objUti.mostrarMsgErr_F1(this, e);
}
return blnRes;
}
/**
* Esta funcián se encarga de agregar el listener "DocumentListener" a los objetos
* de tipo texto para poder determinar si su contenido a cambiado o no.
*/
private void agregarDocLis() {
txtCodBodDes.getDocument().addDocumentListener(objDocLis);
txtNomBodDes.getDocument().addDocumentListener(objDocLis);
txtCodItm.getDocument().addDocumentListener(objDocLis);
txtCodAltItm.getDocument().addDocumentListener(objDocLis);
txtNomItm.getDocument().addDocumentListener(objDocLis);
txtCodAltItmDes.getDocument().addDocumentListener(objDocLis);
txtCodAltItmHas.getDocument().addDocumentListener(objDocLis);
}
/**
* Esta clase implementa la interface DocumentListener que observa los cambios que
* se presentan en los objetos de tipo texto. Por ejemplo: JTextField, JTextArea, etc.
* Se la usa en el sistema para determinar si existe algán cambio que se deba grabar
* antes de abandonar uno de los modos o desplazarse a otro registro. Por ejemplo: si
* se ha hecho cambios a un registro y quiere cancelar o moverse a otro registro se
* presentará un mensaje advirtiendo que si no guarda los cambios los perderá.
*/
class ZafDocLis implements javax.swing.event.DocumentListener {
public void changedUpdate(javax.swing.event.DocumentEvent evt) {
blnHayCam = true;
}
public void insertUpdate(javax.swing.event.DocumentEvent evt) {
blnHayCam = true;
}
public void removeUpdate(javax.swing.event.DocumentEvent evt) {
blnHayCam = true;
}
}
/**
* Esta funcián configura la "Ventana de consulta" que será utilizada para
* mostrar los "Responsables de Conteo".
*/
private boolean configurarVenConBod() {
boolean blnRes = true;
try {
//Listado de campos.
ArrayList arlCam = new ArrayList();
arlCam.add("a1.co_bod");
arlCam.add("a1.tx_nom");
//Alias de los campos.
ArrayList arlAli = new ArrayList();
arlAli.add("Código Bodega");
arlAli.add("Nombre de Bodega");
//Ancho de las columnas.
ArrayList arlAncCol = new ArrayList();
arlAncCol.add("50");
arlAncCol.add("334");
//Armar la sentencia SQL.
if(objParSis.getCodigoUsuario()==1){
strSQL = "";
strSQL += " SELECT a1.co_bod, a1.tx_nom";
strSQL += " FROM tbm_bod AS a1";
strSQL += " WHERE a1.co_emp=" + objParSis.getCodigoEmpresa() + "";
strSQL += " ORDER BY a1.co_bod, a1.tx_nom";
}
else{
strSQL = "";
strSQL += " SELECT a1.co_bod, a1.tx_nom";
strSQL += " FROM tbm_bod AS a1 INNER JOIN tbr_bodLocPrgUsr AS a2";
strSQL += " ON a1.co_emp=a2.co_emp AND a1.co_bod=a2.co_bod";
strSQL += " WHERE a1.co_emp=" + objParSis.getCodigoEmpresa() + "";
strSQL += " AND a2.co_usr=" + objParSis.getCodigoUsuario() + "";
strSQL += " AND a2.co_loc=" + objParSis.getCodigoLocal() + "";
strSQL += " AND a2.co_mnu=" + objParSis.getCodigoMenu() + "";
strSQL += " ORDER BY a1.co_bod, a1.tx_nom";
}
vcoBodDes = new ZafVenCon(javax.swing.JOptionPane.getFrameForComponent(this), objParSis, "Listado de Bodegas", strSQL, arlCam, arlAli, arlAncCol);
arlCam = null;
arlAli = null;
arlAncCol = null;
//Configurar columnas.
vcoBodDes.setConfiguracionColumna(1, javax.swing.JLabel.RIGHT);
} catch (Exception e) {
blnRes = false;
objUti.mostrarMsgErr_F1(this, e);
}
return blnRes;
}
/**
* Esta funcián permite utilizar la "Ventana de Consulta" para seleccionar un
* registro de la base de datos. El tipo de básqueda determina si se debe hacer
* una básqueda directa (No se muestra la ventana de consulta a menos que no
* exista lo que se está buscando) o presentar la ventana de consulta para que
* el usuario seleccione la opcián que desea utilizar.
* @param intTipBus El tipo de básqueda a realizar.
* @return true: Si no se presentá ningán problema.
* <BR>false: En el caso contrario.
*/
private boolean mostrarVenConBodDes(int intTipBus) {
boolean blnRes = true;
try {
switch (intTipBus) {
case 0: //Mostrar la ventana de consulta.
vcoBodDes.setCampoBusqueda(2);
vcoBodDes.show();
if (vcoBodDes.getSelectedButton() == vcoBodDes.INT_BUT_ACE) {
txtCodBodDes.setText(vcoBodDes.getValueAt(1));
txtNomBodDes.setText(vcoBodDes.getValueAt(2));
}
break;
case 1: //Básqueda directa por "Námero de cuenta".
if (vcoBodDes.buscar("a1.co_bod", txtCodBodDes.getText())) {
txtCodBodDes.setText(vcoBodDes.getValueAt(1));
txtNomBodDes.setText(vcoBodDes.getValueAt(2));
} else {
vcoBodDes.setCampoBusqueda(0);
vcoBodDes.setCriterio1(11);
vcoBodDes.cargarDatos();
vcoBodDes.show();
if (vcoBodDes.getSelectedButton() == vcoBodDes.INT_BUT_ACE) {
txtCodBodDes.setText(vcoBodDes.getValueAt(1));
txtNomBodDes.setText(vcoBodDes.getValueAt(2));
} else {
txtCodBodDes.setText(strCodBodDes);
}
}
break;
case 2: //Básqueda directa por "Descripcián larga".
if (vcoBodDes.buscar("a1.tx_nom", txtNomBodDes.getText())) {
txtCodBodDes.setText(vcoBodDes.getValueAt(1));
txtNomBodDes.setText(vcoBodDes.getValueAt(2));
} else {
vcoBodDes.setCampoBusqueda(1);
vcoBodDes.setCriterio1(11);
vcoBodDes.cargarDatos();
vcoBodDes.show();
if (vcoBodDes.getSelectedButton() == vcoBodDes.INT_BUT_ACE) {
txtCodBodDes.setText(vcoBodDes.getValueAt(1));
txtNomBodDes.setText(vcoBodDes.getValueAt(2));
} else {
txtNomBodDes.setText(strNomBodDes);
}
}
break;
}
} catch (Exception e) {
blnRes = false;
objUti.mostrarMsgErr_F1(this, e);
}
return blnRes;
}
private boolean cargarAnios(){
boolean blnRes=true;
try{
con=DriverManager.getConnection(objParSis.getStringConexion(), objParSis.getUsuarioBaseDatos(), objParSis.getClaveBaseDatos());
if(con!=null){
stm=con.createStatement();
strSQL="";
strSQL+="SELECT co_emp, ne_ani";
strSQL+=" FROM tbm_venMenInvBod";
strSQL+=" WHERE co_emp=" + objParSis.getCodigoEmpresa() + "";
strSQL+=" GROUP BY co_emp, ne_ani";
strSQL+=" ORDER BY ne_ani";
rst=stm.executeQuery(strSQL);
while(rst.next()){
vecRegHis=new Vector();
vecRegHis.add(INT_TBL_DAT_HIS_LIN,"");
vecRegHis.add(INT_TBL_DAT_HIS_CHK,"");
vecRegHis.add(INT_TBL_DAT_HIS_ANI,"" + rst.getString("ne_ani"));
vecRegHis.add(INT_TBL_DAT_HIS_NUM_MES,"");
vecRegHis.add(INT_TBL_DAT_HIS_MES,"");
vecDatHis.add(vecRegHis);
}
rst.close();
stm.close();
con.close();
rst=null;
stm=null;
con=null;
//Asignar vectores al modelo.
objTblModHis.setData(vecDatHis);
tblHis.setModel(objTblModHis);
vecDatHis.clear();
}
}
catch (java.sql.SQLException e){
objUti.mostrarMsgErr_F1(this, e);
}
catch (Exception e){
objUti.mostrarMsgErr_F1(this, e);
}
return blnRes;
}
private boolean cargarAniosMeses(){
boolean blnRes=true;
try{
con=DriverManager.getConnection(objParSis.getStringConexion(), objParSis.getUsuarioBaseDatos(), objParSis.getClaveBaseDatos());
if(con!=null){
stm=con.createStatement();
strSQL="";
strSQL+="SELECT co_emp, ne_ani, ne_mes";
strSQL+=" FROM tbm_venMenInvBod";
strSQL+=" WHERE co_emp=" + objParSis.getCodigoEmpresa() + "";
strSQL+=" GROUP BY co_emp, ne_ani, ne_mes";
strSQL+=" ORDER BY ne_ani, ne_mes";
rst=stm.executeQuery(strSQL);
while(rst.next()){
vecRegHis=new Vector();
vecRegHis.add(INT_TBL_DAT_HIS_LIN,"");
vecRegHis.add(INT_TBL_DAT_HIS_CHK,"");
vecRegHis.add(INT_TBL_DAT_HIS_ANI,"" + rst.getString("ne_ani"));
vecRegHis.add(INT_TBL_DAT_HIS_NUM_MES, "" + rst.getInt("ne_mes"));
switch(rst.getInt("ne_mes")){
case 1:
vecRegHis.add(INT_TBL_DAT_HIS_MES,"Enero");
break;
case 2:
vecRegHis.add(INT_TBL_DAT_HIS_MES,"Febrero");
break;
case 3:
vecRegHis.add(INT_TBL_DAT_HIS_MES,"Marzo");
break;
case 4:
vecRegHis.add(INT_TBL_DAT_HIS_MES,"Abril");
break;
case 5:
vecRegHis.add(INT_TBL_DAT_HIS_MES,"Mayo");
break;
case 6:
vecRegHis.add(INT_TBL_DAT_HIS_MES,"Junio");
break;
case 7:
vecRegHis.add(INT_TBL_DAT_HIS_MES,"Julio");
break;
case 8:
vecRegHis.add(INT_TBL_DAT_HIS_MES,"Agosto");
break;
case 9:
vecRegHis.add(INT_TBL_DAT_HIS_MES,"Septiembre");
break;
case 10:
vecRegHis.add(INT_TBL_DAT_HIS_MES,"Octubre");
break;
case 11:
vecRegHis.add(INT_TBL_DAT_HIS_MES,"Noviembre");
break;
case 12:
vecRegHis.add(INT_TBL_DAT_HIS_MES,"Diciembre");
break;
default:
vecRegHis.add(INT_TBL_DAT_HIS_MES,"");
break;
}
vecDatHis.add(vecRegHis);
}
rst.close();
stm.close();
con.close();
rst=null;
stm=null;
con=null;
//Asignar vectores al modelo.
objTblModHis.setData(vecDatHis);
tblHis.setModel(objTblModHis);
vecDatHis.clear();
}
}
catch (Exception e){
objUti.mostrarMsgErr_F1(this, e);
}
return blnRes;
}
/**
* Esta función configura la "Ventana de consulta" que será utilizada para
* mostrar los "Items".
*/
private boolean configurarVenConItm(){
boolean blnRes=true;
try{
//Listado de campos.
ArrayList arlCam=new ArrayList();
arlCam.add("a1.co_itm");
arlCam.add("a1.tx_codAlt");
arlCam.add("a1.tx_nomItm");
arlCam.add("a2.tx_desCor");
arlCam.add("a2.tx_desLar");
//Alias de los campos.
ArrayList arlAli=new ArrayList();
arlAli.add("Cód.Itm.");
arlAli.add("Alterno");
arlAli.add("Nombre");
arlAli.add("Unidad");
//Ancho de las columnas.
ArrayList arlAncCol=new ArrayList();
arlAncCol.add("60");
arlAncCol.add("70");
arlAncCol.add("350");
arlAncCol.add("60");
//Armar la sentencia SQL.
strSQL="";
strSQL+=" SELECT a1.co_itm, a1.tx_codAlt, a1.tx_nomItm, a2.tx_desCor, a2.tx_desLar";
strSQL+=" FROM (tbm_inv AS a1 LEFT OUTER JOIN tbm_var AS a2 ON a1.co_uni=a2.co_reg)";
if(txtCodCla.getText().equals(""))
strSQL+=" LEFT OUTER JOIN";
else
strSQL+=" INNER JOIN";
strSQL+=" tbr_invCla AS a3 ON a1.co_emp=a3.co_emp AND a1.co_itm=a3.co_itm";
strSQL+=" WHERE a1.co_emp=" + objParSis.getCodigoEmpresa() + "";
strSQL+=" AND a1.st_reg NOT IN('U','T') AND a1.st_ser NOT IN('S','T') ";
if( ! txtCodCla.getText().equals("")){
strSQL+=" AND a3.co_cla=" + txtCodCla.getText() + "";
strSQL+=" AND a3.st_reg IN('A','P')";
}
if(objParSis.getCodigoEmpresa()==objParSis.getCodigoEmpresaGrupo()){
strSQL+=" AND (a1.tx_codAlt LIKE '%I' OR a1.tx_codAlt LIKE '%S')";
}
else
strSQL+=" AND (a1.tx_codAlt LIKE '%S' OR a1.tx_codAlt LIKE '%L')";
strSQL+=" GROUP BY a1.co_itm, a1.tx_codAlt, a1.tx_nomItm, a2.tx_desCor, a2.tx_desLar";
strSQL+=" ORDER BY a1.tx_codAlt";
System.out.println("configurarVenConItm: " + strSQL);
vcoItm=new ZafVenCon(javax.swing.JOptionPane.getFrameForComponent(this), objParSis, "Listado de inventario", strSQL, arlCam, arlAli, arlAncCol);
arlCam=null;
arlAli=null;
arlAncCol=null;
//Configurar columnas.
vcoItm.setConfiguracionColumna(4, javax.swing.JLabel.CENTER);
vcoItm.setCampoBusqueda(1);
}
catch (Exception e)
{
blnRes=false;
objUti.mostrarMsgErr_F1(this, e);
}
return blnRes;
}
/**
* Esta función permite utilizar la "Ventana de Consulta" para seleccionar un
* registro de la base de datos. El tipo de búsqueda determina si se debe hacer
* una búsqueda directa (No se muestra la ventana de consulta a menos que no
* exista lo que se está buscando) o presentar la ventana de consulta para que
* el usuario seleccione la opción que desea utilizar.
* @param intTipBus El tipo de búsqueda a realizar.
* @return true: Si no se presentó ningún problema.
* <BR>false: En el caso contrario.
*/
private boolean mostrarVenConItm(int intTipBus){
boolean blnRes=true;
String strFilItm="";
try{
if(configurarVenConItm()){
switch (intTipBus){
case 0: //Mostrar la ventana de consulta.
vcoItm.setCampoBusqueda(1);
vcoItm.show();
if (vcoItm.getSelectedButton()==vcoItm.INT_BUT_ACE){
txtCodItm.setText(vcoItm.getValueAt(1));
txtCodAltItm.setText(vcoItm.getValueAt(2));
txtNomItm.setText(vcoItm.getValueAt(3));
}
break;
case 1: //Búsqueda directa por "Codigo alterno".
if (vcoItm.buscar("a1.tx_codAlt", txtCodAltItm.getText())){
txtCodItm.setText(vcoItm.getValueAt(1));
txtCodAltItm.setText(vcoItm.getValueAt(2));
txtNomItm.setText(vcoItm.getValueAt(3));
}
else{
vcoItm.setCampoBusqueda(1);
vcoItm.setCriterio1(11);
vcoItm.cargarDatos();
vcoItm.show();
if (vcoItm.getSelectedButton()==vcoItm.INT_BUT_ACE){
txtCodItm.setText(vcoItm.getValueAt(1));
txtCodAltItm.setText(vcoItm.getValueAt(2));
txtNomItm.setText(vcoItm.getValueAt(3));
}
else{
txtCodAltItm.setText(strCodAlt);
}
}
break;
case 2: //Búsqueda directa por "Nombre del item".
if (vcoItm.buscar("a1.tx_nomItm", txtNomItm.getText())){
txtCodItm.setText(vcoItm.getValueAt(1));
txtCodAltItm.setText(vcoItm.getValueAt(2));
txtNomItm.setText(vcoItm.getValueAt(3));
}
else{
vcoItm.setCampoBusqueda(2);
vcoItm.setCriterio1(11);
vcoItm.cargarDatos();
vcoItm.show();
if (vcoItm.getSelectedButton()==vcoItm.INT_BUT_ACE){
txtCodItm.setText(vcoItm.getValueAt(1));
txtCodAltItm.setText(vcoItm.getValueAt(2));
txtNomItm.setText(vcoItm.getValueAt(3));
}
else{
txtNomItm.setText(strNomItm);
}
}
break;
}
}
}
catch (Exception e)
{
blnRes=false;
objUti.mostrarMsgErr_F1(this, e);
}
return blnRes;
}
private boolean configurarColumnasAniosMeses(){
boolean blnRes=true;
try{
if(con!=null){
if(eliminaColumnasAdicionadasAnios()){
intNumColAdiFec=numeroColumnasAdicionar();
if(optHisAnu.isSelected()){
if(agregarColumnasAdicionadasAnios(intNumColAdiFec)){
}
}
else if(optHisMen.isSelected()){
if(agregarColumnasAdicionadasAniosMeses(intNumColAdiFec)){
}
}
if(agregarColumnasAdicionadasTotales()){
}
if(objParSis.getCodigoEmpresa()==objParSis.getCodigoEmpresaGrupo()){
if(agregarColumnaStockActual()){
}
if(agregarColumnasAdicionadasPromedioMensualVtas()){
}
if(agregarColumnaStockMinimo_Exceso()){
}
if(agregarColumnaAdicionadaObservacion()){
}
if(agregarColumnaAdicionadaReposicion()){
}
if(agregarColAdiCanPenRep()){
}
}
else{//POR EMPRESA
if(agregarColumnaStockActual()){
}
if(agregarColumnasAdicionadasPromedioMensualVtas()){
}
if(agregarColumnaStockMinimo()){
}
}
}
}
}
catch(Exception e){
objUti.mostrarMsgErr_F1(this, e);
blnRes=false;
}
return blnRes;
}
private boolean configurarColumnasSinHistorico(){
boolean blnRes=true;
intNumColAdiFec=0;
try{
if(con!=null){
if(eliminaColumnasAdicionadasAnios()){
if(objParSis.getCodigoEmpresa()==objParSis.getCodigoEmpresaGrupo()){
if(agregarColumnaStockActual()){
}
if(agregarColumnaAdicionadaObservacion()){
}
}
else{//POR EMPRESA
if(agregarColumnaStockActual()){
}
if(agregarColumnasAdicionadasPromedioMensualVtas()){
}
if(agregarColumnaStockMinimo()){
}
}
}
}
}
catch(Exception e){
objUti.mostrarMsgErr_F1(this, e);
blnRes=false;
}
return blnRes;
}
private boolean eliminaColumnasAdicionadasAnios(){
boolean blnRes=true;
int intNumColTot=tblDat.getColumnCount();//obtiene el numero total de columnas en ese momento
try{
for (int i=(intNumColTot-1); i>=intNumColFinModEst; i--){
objTblMod.removeColumn(tblDat, i);
}
}
catch(Exception e){
objUti.mostrarMsgErr_F1(this, e);
blnRes=false;
}
return blnRes;
}
private int numeroColumnasAdicionar(){
String strLin;
int intNumColAdd=0;
arlDatAniAdd.clear();
try{
for(int i=0; i<objTblModHis.getRowCountTrue(); i++){
strLin=objTblModHis.getValueAt(i, INT_TBL_DAT_HIS_LIN)==null?"":objTblModHis.getValueAt(i, INT_TBL_DAT_HIS_LIN).toString();
if(strLin.equals("M")){
if(objTblModHis.isChecked(i, INT_TBL_DAT_HIS_CHK)){
intNumColAdd++;
arlRegAniAdd=new ArrayList();
arlRegAniAdd.add(INT_ARL_ANI, "" + objTblModHis.getValueAt(i, INT_TBL_DAT_HIS_ANI));
arlRegAniAdd.add(INT_ARL_NUM_MES, "" + objTblModHis.getValueAt(i, INT_TBL_DAT_HIS_NUM_MES)==null?"":objTblModHis.getValueAt(i, INT_TBL_DAT_HIS_NUM_MES).toString());
arlRegAniAdd.add(INT_ARL_MES, "" + objTblModHis.getValueAt(i, INT_TBL_DAT_HIS_MES)==null?"":objTblModHis.getValueAt(i, INT_TBL_DAT_HIS_MES).toString());
arlRegAniAdd.add(INT_ARL_COL, "" );
arlDatAniAdd.add(arlRegAniAdd);
}
}
}
System.out.println("ARREGLO TIENE: " + arlDatAniAdd.toString());
}
catch(Exception e){
objUti.mostrarMsgErr_F1(this, e);
}
return intNumColAdd;
}
private boolean agregarColumnasAdicionadasAnios(int numeroColumnasAdicionar){
boolean blnRes=true;
strAux="";
javax.swing.table.TableColumn tbc;
ZafTblHeaGrp objTblHeaGrp=(ZafTblHeaGrp)tblDat.getTableHeader();
objTblHeaGrp.setHeight(16*3);
ZafTblHeaColGrp objTblHeaColGrp=null;
intNumColAdiFec=numeroColumnasAdicionar;
String strAni="", strMes="";
int p=0, f=-1;
intNumColIniFec=intNumColFinModEst;
try{
objTblCelRenLbl=new ZafTblCelRenLbl();
objTblCelRenLbl.setHorizontalAlignment(javax.swing.JLabel.RIGHT);
objTblCelRenLbl.setTipoFormato(objTblCelRenLbl.INT_FOR_NUM);
objTblCelRenLbl.setFormatoNumerico(objParSis.getFormatoNumero(),false,true);
for (int i=0; i<(intNumColAdiFec*3); i++){
if(p==0)
f++;
String strSubTit=(p==0?"Unidades":(p==1?"Veces":(p==2?"Meses":"")));
tbc=new javax.swing.table.TableColumn(intNumColIniFec+i);
tbc.setHeaderValue("" + strSubTit);
//Configurar JTable: Establecer el ancho de la columna.
tbc.setPreferredWidth(60);
//Configurar JTable: Renderizar celdas.
tbc.setCellRenderer(objTblCelRenLbl);
//Configurar JTable: Agregar la columna al JTable.
objTblMod.addColumn(tblDat, tbc);
if (!strAni.equals(objUti.getStringValueAt(arlDatAniAdd, f, INT_ARL_ANI).toString())){
objTblHeaColGrp=new ZafTblHeaColGrp("" + objUti.getStringValueAt(arlDatAniAdd, f, INT_ARL_ANI));
objTblHeaColGrp.setHeight(16);
strAni=objUti.getStringValueAt(arlDatAniAdd, f, INT_ARL_ANI).toString();
}
objTblHeaColGrp.add(tbc);
objTblHeaGrp.addColumnGroup(objTblHeaColGrp);
if(p==2){
p=0;
}
else{
p++;
}
}
objTblCelRenLbl=null;
intNumColFinFec=objTblMod.getColumnCount();
}
catch(Exception e){
blnRes=false;
objUti.mostrarMsgErr_F1(this, e);
}
return blnRes;
}
private boolean agregarColumnasAdicionadasAniosMeses(int numeroColumnasAdicionar){
boolean blnRes=true;
strAux="";
javax.swing.table.TableColumn tbc;
ZafTblHeaGrp objTblHeaGrp=(ZafTblHeaGrp)tblDat.getTableHeader();
objTblHeaGrp.setHeight(16*3);
ZafTblHeaColGrp objTblHeaColGrp=null;
ZafTblHeaColGrp objTblHeaColSubGrp=null;
intNumColAdiFec=numeroColumnasAdicionar;
String strAni="", strMes="";
javax.swing.table.TableColumnModel tcmAux=tblDat.getColumnModel();
int p=0, f=-1, d=9999;
intNumColIniFec=intNumColFinModEst;
try{
objTblCelRenLbl=new ZafTblCelRenLbl();
objTblCelRenLbl.setHorizontalAlignment(javax.swing.JLabel.RIGHT);
objTblCelRenLbl.setTipoFormato(objTblCelRenLbl.INT_FOR_NUM);
objTblCelRenLbl.setFormatoNumerico(objParSis.getFormatoNumero(),false,true);
for (int i=0; i<(intNumColAdiFec*3); i++){
if(p==0)
f++;
String strSubTit=(p==0?"Unidades":(p==1?"Veces":(p==2?"Meses":"")));
tbc=new javax.swing.table.TableColumn(intNumColIniFec+i);
tbc.setHeaderValue("" + strSubTit);
//Configurar JTable: Establecer el ancho de la columna.
tbc.setPreferredWidth(60);
//Configurar JTable: Renderizar celdas.
tbc.setCellRenderer(objTblCelRenLbl);
//Configurar JTable: Agregar la columna al JTable.
objTblMod.addColumn(tblDat, tbc);
if (!strAni.equals(objUti.getStringValueAt(arlDatAniAdd, f, INT_ARL_ANI).toString())){
objTblHeaColGrp=new ZafTblHeaColGrp("" + objUti.getStringValueAt(arlDatAniAdd, f, INT_ARL_ANI));
objTblHeaColGrp.setHeight(16);
strAni=objUti.getStringValueAt(arlDatAniAdd, f, INT_ARL_ANI).toString();
d=0;
}
else
d++;
if (!strMes.equals(objUti.getStringValueAt(arlDatAniAdd, f, INT_ARL_NUM_MES).toString())) {
objTblHeaColSubGrp=new ZafTblHeaColGrp("" + objUti.getStringValueAt(arlDatAniAdd, f, INT_ARL_MES));
objTblHeaColSubGrp.setHeight(16);
strMes=objUti.getStringValueAt(arlDatAniAdd, f, INT_ARL_NUM_MES).toString();
objTblHeaColGrp.add(objTblHeaColSubGrp);
}
else if ( (strMes.equals(objUti.getStringValueAt(arlDatAniAdd, f, INT_ARL_NUM_MES).toString())) && d==0 ){
objTblHeaColSubGrp=new ZafTblHeaColGrp("" + objUti.getStringValueAt(arlDatAniAdd, f, INT_ARL_MES));
objTblHeaColSubGrp.setHeight(16);
strMes=objUti.getStringValueAt(arlDatAniAdd, f, INT_ARL_NUM_MES).toString();
objTblHeaColGrp.add(objTblHeaColSubGrp);
}
objTblHeaGrp.addColumnGroup(objTblHeaColGrp);
objTblHeaColSubGrp.add(tcmAux.getColumn((tblDat.getColumnCount()-1)));
if(p==2){
p=0;
}
else{
p++;
}
}
objTblCelRenLbl=null;
intNumColFinFec=objTblMod.getColumnCount();
}
catch(Exception e){
blnRes=false;
objUti.mostrarMsgErr_F1(this, e);
}
return blnRes;
}
private boolean agregarColumnasAdicionadasTotales(){
boolean blnRes=true;
strAux="";
javax.swing.table.TableColumn tbc;
ZafTblHeaGrp objTblHeaGrp=(ZafTblHeaGrp)tblDat.getTableHeader();
objTblHeaGrp.setHeight(16*3);
ZafTblHeaColGrp objTblHeaColGrp=null;
intNumColAdiTot=3;
intNumColIniTot=intNumColFinFec;
try{
objTblCelRenLbl=new ZafTblCelRenLbl();
objTblCelRenLbl.setHorizontalAlignment(javax.swing.JLabel.RIGHT);
objTblCelRenLbl.setTipoFormato(objTblCelRenLbl.INT_FOR_NUM);
objTblCelRenLbl.setFormatoNumerico(objParSis.getFormatoNumero(),false,true);
for (int i=0; i<intNumColAdiTot; i++){
String strSubTit=(i==0?"Unidades":(i==1?"Veces":(i==2?"Meses":"")));
tbc=new javax.swing.table.TableColumn(intNumColIniTot+i);
tbc.setHeaderValue("" + strSubTit);
if(intNumColAdiFec>1){
//Configurar JTable: Establecer el ancho de la columna.
tbc.setPreferredWidth(60);
}
else{
tbc.setWidth(0);
tbc.setMaxWidth(0);
tbc.setMinWidth(0);
tbc.setPreferredWidth(0);
tbc.setResizable(false);
}
//Configurar JTable: Renderizar celdas.
tbc.setCellRenderer(objTblCelRenLbl);
//Configurar JTable: Agregar la columna al JTable.
objTblMod.addColumn(tblDat, tbc);
if(i==0){
objTblHeaColGrp=new ZafTblHeaColGrp("Totales");
objTblHeaColGrp.setHeight(16);
}
objTblHeaColGrp.add(tbc);
objTblHeaGrp.addColumnGroup(objTblHeaColGrp);
}
objTblCelRenLbl=null;
intNumColFinTot=objTblMod.getColumnCount();
}
catch(Exception e){
blnRes=false;
objUti.mostrarMsgErr_F1(this, e);
}
return blnRes;
}
private boolean agregarColumnaStockActual(){
boolean blnRes=true;
strAux="";
javax.swing.table.TableColumn tbc;
intNumColAdiStkAct=2;
javax.swing.table.TableColumnModel tcmAux=tblDat.getColumnModel();
intNumColIniStkAct=intNumColFinTot;
try{
objTblCelRenLbl=new ZafTblCelRenLbl();
objTblCelRenLbl.setHorizontalAlignment(javax.swing.JLabel.RIGHT);
objTblCelRenLbl.setTipoFormato(objTblCelRenLbl.INT_FOR_NUM);
objTblCelRenLbl.setFormatoNumerico(objParSis.getFormatoNumero(),false,true);
objTblCelEdiTxt=new ZafTblCelEdiTxt();
for (int i=0; i<intNumColAdiStkAct; i++){
String strSubTit=((i==0?"Stk.Act.":(i==1?"Dis.Act.":"")));
tbc=new javax.swing.table.TableColumn(intNumColIniStkAct+i);
tbc.setHeaderValue("" + strSubTit);
//Configurar JTable: Establecer el ancho de la columna.
tbc.setPreferredWidth(60);
//Configurar JTable: Renderizar celdas.
tbc.setCellRenderer(objTblCelRenLbl);
tbc.setCellEditor(objTblCelEdiTxt);
//Configurar JTable: Agregar la columna al JTable.
objTblMod.addColumn(tblDat, tbc);
}
objTblCelRenLbl=null;
intNumColFinStkAct=objTblMod.getColumnCount();
}
catch(Exception e){
blnRes=false;
objUti.mostrarMsgErr_F1(this, e);
}
return blnRes;
}
private boolean agregarColumnaStockMinimo_Exceso(){
boolean blnRes=true;
strAux="";
javax.swing.table.TableColumn tbc;
intNumColAdiStkMinExc=4;
javax.swing.table.TableColumnModel tcmAux=tblDat.getColumnModel();
intNumColIniStkMinExc=intNumColFinProMen;
try{
objTblCelRenLbl=new ZafTblCelRenLbl();
objTblCelRenLbl.setHorizontalAlignment(javax.swing.JLabel.RIGHT);
objTblCelRenLbl.setTipoFormato(objTblCelRenLbl.INT_FOR_NUM);
objTblCelRenLbl.setFormatoNumerico(objParSis.getFormatoNumero(),false,true);
objTblCelEdiTxtMin=new ZafTblCelEdiTxt();
for (int i=0; i<intNumColAdiStkMinExc; i++){
String strSubTit=(i==0?"Fijo":(i==1?"Exceso":(i==2)?"Stk.Min.Sug.":"Obs.Stk.Min.Sug."));
tbc=new javax.swing.table.TableColumn(intNumColIniStkMinExc+i);
tbc.setHeaderValue("" + strSubTit);
//Configurar JTable: Establecer el ancho de la columna.
tbc.setPreferredWidth(60);
//Configurar JTable: Renderizar celdas.
tbc.setCellRenderer(objTblCelRenLbl);
tbc.setCellEditor(objTblCelEdiTxtMin);
objTblCelEdiTxtMin.addTableEditorListener(new Librerias.ZafTblUti.ZafTblEvt.ZafTableAdapter() {
BigDecimal bdeVal=new BigDecimal(BigInteger.ZERO);
String strValCel="";
int intFil=-1;
int intCol=-1;
public void beforeEdit(Librerias.ZafTblUti.ZafTblEvt.ZafTableEvent evt) {
intFil=tblDat.getSelectedRow();
intCol=tblDat.getSelectedColumn();
}
public void afterEdit(Librerias.ZafTblUti.ZafTblEvt.ZafTableEvent evt) {
if((intNumColIniStkMinExc+3)==tblDat.getSelectedColumn()){//es la columna de observacion
}
else{
strValCel=objTblMod.getValueAt(intFil, intCol)==null?"":objTblMod.getValueAt(intFil, intCol).toString();
if(!strValCel.equals("")){
//el valor ingresado es cambiado al +- valor entero(se quitan los decimales)
bdeVal= objUti.redondearBigDecimal( (objTblMod.getValueAt(tblDat.getSelectedRow(), tblDat.getSelectedColumn()).toString()), Integer.parseInt("0") );
objTblMod.setValueAt(""+bdeVal, tblDat.getSelectedRow(), tblDat.getSelectedColumn());
calcularMinimoMaximo();
calcularCantidadReponer();
}
else{
objTblMod.setValueAt("", intFil, intCol);
calcularMinimoMaximo();
calcularCantidadReponer();
}
}
}
});
//Configurar JTable: Agregar la columna al JTable.
objTblMod.addColumn(tblDat, tbc);
}
objTblCelRenLbl=null;
intNumColFinStkMinExc=objTblMod.getColumnCount();
}
catch(Exception e){
blnRes=false;
objUti.mostrarMsgErr_F1(this, e);
}
return blnRes;
}
private boolean agregarColumnaStockMinimo(){
boolean blnRes=true;
strAux="";
javax.swing.table.TableColumn tbc;
intNumColAdiStkMinExc=1;
javax.swing.table.TableColumnModel tcmAux=tblDat.getColumnModel();
intNumColIniStkMinExc=intNumColFinProMen;
try{
objTblCelRenLbl=new ZafTblCelRenLbl();
objTblCelRenLbl.setHorizontalAlignment(javax.swing.JLabel.RIGHT);
objTblCelRenLbl.setTipoFormato(objTblCelRenLbl.INT_FOR_NUM);
objTblCelRenLbl.setFormatoNumerico(objParSis.getFormatoNumero(),false,true);
objTblCelEdiTxtMin=new ZafTblCelEdiTxt();
for (int i=0; i<intNumColAdiStkMinExc; i++){
String strSubTit=(i==0?"Stk.Min.":"");
tbc=new javax.swing.table.TableColumn(intNumColIniStkMinExc+i);
tbc.setHeaderValue("" + strSubTit);
//Configurar JTable: Establecer el ancho de la columna.
tbc.setPreferredWidth(60);
//Configurar JTable: Renderizar celdas.
tbc.setCellRenderer(objTblCelRenLbl);
tbc.setCellEditor(objTblCelEdiTxtMin);
objTblCelEdiTxtMin.addTableEditorListener(new Librerias.ZafTblUti.ZafTblEvt.ZafTableAdapter() {
BigDecimal bdeVal=new BigDecimal(BigInteger.ZERO);
public void beforeEdit(Librerias.ZafTblUti.ZafTblEvt.ZafTableEvent evt) {
}
public void afterEdit(Librerias.ZafTblUti.ZafTblEvt.ZafTableEvent evt) {
if(objUti.isNumero(objTblMod.getValueAt(tblDat.getSelectedRow(), tblDat.getSelectedColumn()).toString())){
//el valor ingresado es cambiado al +- valor entero(se quitan los decimales)
bdeVal= objUti.redondearBigDecimal( (objTblMod.getValueAt(tblDat.getSelectedRow(), tblDat.getSelectedColumn()).toString()), Integer.parseInt("0") );
objTblMod.setValueAt(""+bdeVal, tblDat.getSelectedRow(), tblDat.getSelectedColumn());
}
else{
objTblMod.setValueAt(null, tblDat.getSelectedRow(), tblDat.getSelectedColumn());
}
}
});
//Configurar JTable: Agregar la columna al JTable.
objTblMod.addColumn(tblDat, tbc);
}
objTblCelRenLbl=null;
intNumColFinStkMinExc=objTblMod.getColumnCount();
}
catch(Exception e){
blnRes=false;
objUti.mostrarMsgErr_F1(this, e);
}
return blnRes;
}
private boolean agregarColumnaAdicionadaObservacion(){
boolean blnRes=true;
strAux="";
javax.swing.table.TableColumn tbc;
intNumColAdiObs=1;
intNumColIniObs=intNumColFinStkMinExc;
try{
String strSubTit="Obs.Stk.Min.Sug";
tbc=new javax.swing.table.TableColumn(intNumColIniObs);
tbc.setHeaderValue("" + strSubTit);
//Configurar JTable: Establecer el ancho de la columna.
tbc.setPreferredWidth(30);
objTblCelRenBut=new ZafTblCelRenBut();
tbc.setCellRenderer(objTblCelRenBut);
objCom32_01=new ZafCom32_01(javax.swing.JOptionPane.getFrameForComponent(this), true, objParSis);
objTblCelEdiBut= new ZafTblCelEdiButDlg(objCom32_01);
tbc.setCellEditor(objTblCelEdiBut);
objTblCelEdiBut.addTableEditorListener(new Librerias.ZafTblUti.ZafTblEvt.ZafTableAdapter() {
public void beforeEdit(Librerias.ZafTblUti.ZafTblEvt.ZafTableEvent evt) {
objCom32_01.setContenido(""+objTblMod.getValueAt(tblDat.getSelectedRow(), (tblDat.getSelectedColumn()-1)).toString());
}
public void afterEdit(Librerias.ZafTblUti.ZafTblEvt.ZafTableEvent evt) {
objTblMod.setValueAt(objCom32_01.getContenido(), tblDat.getSelectedRow(), (tblDat.getSelectedColumn()-1));
}
});
objTblMod.addColumn(tblDat, tbc);
objTblCelRenBut=null;
intNumColFinStkObs=objTblMod.getColumnCount();
}
catch(Exception e){
blnRes=false;
objUti.mostrarMsgErr_F1(this, e);
}
return blnRes;
}
private boolean agregarColumnasAdicionadasPromedioMensualVtas()
{
boolean blnRes=true;
javax.swing.table.TableColumn tbc;
ZafTblHeaGrp objTblHeaGrp=(ZafTblHeaGrp)tblDat.getTableHeader();
objTblHeaGrp.setHeight(16*3);
ZafTblHeaColGrp objTblHeaColGrp=null;
strAux="";
intNumColAdiProMen=2;
intNumColIniProMen=intNumColFinStkAct;
intColPromMan=intNumColIniProMen+1;
try
{
objTblCelRenLbl=new ZafTblCelRenLbl();
objTblCelRenLbl.setHorizontalAlignment(javax.swing.JLabel.RIGHT);
objTblCelRenLbl.setTipoFormato(objTblCelRenLbl.INT_FOR_NUM);
objTblCelRenLbl.setFormatoNumerico(objParSis.getFormatoNumero(),false,true);
objTblCelEdiTxtPro=new ZafTblCelEdiTxt();
for (int i=0; i<intNumColAdiProMen; i++)
{
String strSubTit=(i==0?"Pro.Cal.":(i==1?"Pro.Man.":""));
tbc=new javax.swing.table.TableColumn(intNumColIniProMen+i);
tbc.setHeaderValue("" + strSubTit);
//Configurar JTable: Establecer el ancho de la columna.
tbc.setPreferredWidth(50);
//Configurar JTable: Renderizar celdas.
tbc.setCellRenderer(objTblCelRenLbl);
tbc.setCellEditor(objTblCelEdiTxtPro);
//<editor-fold defaultstate="collapsed" desc="/* Opción Copiar y Pegar Pro.Man. */">
objTblMod.setColumnDataType(intNumColIniStkMinExc, ZafTblMod.INT_COL_DBL, new Integer(0), null);
objTblMod.setColumnDataType(intNumColIniStkMinExc + 1, ZafTblMod.INT_COL_DBL, new Integer(0), null);
objTblMod.setColumnDataType(intNumColIniStkMinExc + 2, ZafTblMod.INT_COL_DBL, new Integer(0), null);
objTblMod.setColumnDataType(intNumColIniStkMinExc + 5, ZafTblMod.INT_COL_DBL, new Integer(0), null);
objTblPopMnu.addTblPopMnuListener(new Librerias.ZafTblUti.ZafTblEvt.ZafTblPopMnuAdapter()
{
public void afterClick(Librerias.ZafTblUti.ZafTblEvt.ZafTblPopMnuEvent evt)
{
if (objTblPopMnu.isClickTipoSeleccionSeleccionCelda() )
//if (objTblPopMnu.isClickTipoSeleccionSeleccionCelda() && tblDat.isColumnSelected(intColPromMan))
{
System.out.println(" HABILITAR TIPO CELDA:" + intColPromMan);
objTblPopMnu.setPegarEnabled(true);
System.out.println(" HABILITAR PEGAR:" + intColPromMan);
}
if (objTblPopMnu.isClickPegar())
{
System.out.println(" CLICK PEGAR:" + intColPromMan); //Pro.Man.
int intFilSel[], i;
String strFij, strStkExc, strStkMin, strObsStk, strNumMes;
intFilSel = tblDat.getSelectedRows();
for (i = 0; i < intFilSel.length; i++)
{
strFij = objTblMod.getValueAt(intFilSel[i], intNumColIniStkMinExc).toString();
strStkExc = objTblMod.getValueAt(intFilSel[i], intNumColIniStkMinExc + 1).toString();
strStkMin = objTblMod.getValueAt(intFilSel[i], intNumColIniStkMinExc + 2).toString();
strObsStk = objTblMod.getValueAt(intFilSel[i], intNumColIniStkMinExc + 3).toString();
strNumMes = objTblMod.getValueAt(intFilSel[i], intNumColIniStkMinExc + 5).toString();
objTblMod.setValueAt(null, intFilSel[i], intNumColIniStkMinExc); //Fijo
objTblMod.setValueAt(null, intFilSel[i], intNumColIniStkMinExc + 1); //Exceso
objTblMod.setValueAt(null, intFilSel[i], intNumColIniStkMinExc + 2); //Stk.Min.
objTblMod.setValueAt(null, intFilSel[i], intNumColIniStkMinExc + 3); //Obs.Stk.
//objTblMod.setValueAt(null, intFilSel[i], intNumColIniStkMinExc + 5); //Num.Mes.
System.out.println("PEGAR=> Fijo.:" + strFij + " Stk.Exc.:" + strStkExc + " Stk.Min.:" + strStkMin + " Obs.Stk.:" + strObsStk + " Num.Mes.:" + strNumMes);
}
}
}
}
);
//</editor-fold>
objTblCelEdiTxtPro.addTableEditorListener(new Librerias.ZafTblUti.ZafTblEvt.ZafTableAdapter() {
BigDecimal bdeVal=new BigDecimal(BigInteger.ZERO);
String strValCel="";
int intFil=-1;
int intCol=-1;
public void beforeEdit(Librerias.ZafTblUti.ZafTblEvt.ZafTableEvent evt) {
intFil=tblDat.getSelectedRow();
intCol=tblDat.getSelectedColumn();
}
public void afterEdit(Librerias.ZafTblUti.ZafTblEvt.ZafTableEvent evt) {
strValCel=objTblMod.getValueAt(intFil, intCol)==null?"":objTblMod.getValueAt(intFil, intCol).toString();
if(!strValCel.equals("")){
//el valor ingresado es cambiado al +- valor entero(se quitan los decimales)
bdeVal= objUti.redondearBigDecimal( (objTblMod.getValueAt(tblDat.getSelectedRow(), tblDat.getSelectedColumn()).toString()), Integer.parseInt("0") );
objTblMod.setValueAt(""+bdeVal, tblDat.getSelectedRow(), tblDat.getSelectedColumn());
if(objParSis.getCodigoEmpresa()==objParSis.getCodigoEmpresaGrupo()){
calcularMinimoMaximo();
calcularCantidadReponer();
}
}
else{
objTblMod.setValueAt("", tblDat.getSelectedRow(), tblDat.getSelectedColumn());
calcularMinimoMaximo();
calcularCantidadReponer();
}
}
});
//Configurar JTable: Agregar la columna al JTable.
objTblMod.addColumn(tblDat, tbc);
if(i==0){
objTblHeaColGrp=new ZafTblHeaColGrp("Pro.Men.Vta.");
objTblHeaColGrp.setHeight(16);
}
objTblHeaColGrp.add(tbc);
objTblHeaGrp.addColumnGroup(objTblHeaColGrp);
}
objTblCelRenLbl=null;
intNumColFinProMen=objTblMod.getColumnCount();
}
catch(Exception e){
blnRes=false;
objUti.mostrarMsgErr_F1(this, e);
}
return blnRes;
}
private boolean agregarColumnaAdicionadaReposicion(){
boolean blnRes=true;
strAux="";
javax.swing.table.TableColumn tbc;
ZafTblHeaGrp objTblHeaGrp=(ZafTblHeaGrp)tblDat.getTableHeader();
objTblHeaGrp.setHeight(16*3);
ZafTblHeaColGrp objTblHeaColGrp=null;
intNumColAdiRep=5;
intNumColIniStkRep=intNumColFinStkObs;
try{
objTblCelRenLbl=new ZafTblCelRenLbl();
objTblCelRenLbl.setHorizontalAlignment(javax.swing.JLabel.RIGHT);
objTblCelRenLbl.setTipoFormato(objTblCelRenLbl.INT_FOR_NUM);
objTblCelRenLbl.setFormatoNumerico(objParSis.getFormatoNumero(),false,true);
objTblCelEdiTxt=new ZafTblCelEdiTxt();
for (int i=0; i<intNumColAdiRep; i++){
String strSubTit=(i==0?"Núm,Mes.Rep.":(i==1?"Mínimo":(i==2?"Máximo":(i==3?"Can.Rep.":"Val.Uti.Cal.Min.Max"))));
tbc=new javax.swing.table.TableColumn(intNumColIniStkRep+i);
tbc.setHeaderValue("" + strSubTit);
if(i==4){
tbc.setWidth(0);
tbc.setMaxWidth(0);
tbc.setMinWidth(0);
tbc.setPreferredWidth(0);
tbc.setResizable(false);
}
else{
//Configurar JTable: Establecer el ancho de la columna.
tbc.setPreferredWidth(60);
}
//Configurar JTable: Renderizar celdas.
tbc.setCellRenderer(objTblCelRenLbl);
tbc.setCellEditor(objTblCelEdiTxt);
objTblCelEdiTxt.addTableEditorListener(new Librerias.ZafTblUti.ZafTblEvt.ZafTableAdapter() {
public void beforeEdit(Librerias.ZafTblUti.ZafTblEvt.ZafTableEvent evt) {
}
public void afterEdit(Librerias.ZafTblUti.ZafTblEvt.ZafTableEvent evt) {
if(intNumColIniStkRep==tblDat.getSelectedColumn()){//es la columna de observacion
calcularMinimoMaximo();
calcularCantidadReponer();
}
}
});
//Configurar JTable: Agregar la columna al JTable.
objTblMod.addColumn(tblDat, tbc);
if(i==0){
objTblHeaColGrp=new ZafTblHeaColGrp("Reposición");
objTblHeaColGrp.setHeight(16);
}
objTblHeaColGrp.add(tbc);
objTblHeaGrp.addColumnGroup(objTblHeaColGrp);
}
objTblCelRenLbl=null;
intNumColFinStkRep=objTblMod.getColumnCount();
}
catch(Exception e){
blnRes=false;
objUti.mostrarMsgErr_F1(this, e);
}
return blnRes;
}
private boolean agregarColAdiCanPenRep(){
boolean blnRes=true;
strAux="";
javax.swing.table.TableColumn tbc;
intNumColAdiCanPenRep=2;
intNumColIniCanPenRep=intNumColFinStkRep;
try{
objTblCelRenLbl=new ZafTblCelRenLbl();
objTblCelRenLbl.setHorizontalAlignment(javax.swing.JLabel.RIGHT);
objTblCelRenLbl.setTipoFormato(objTblCelRenLbl.INT_FOR_NUM);
objTblCelRenLbl.setFormatoNumerico(objParSis.getFormatoNumero(),false,true);
for (int i=0; i<intNumColAdiCanPenRep; i++){
String strSubTit=(i==0?"Can.Pen.Rep.":"Can.Dis.Rep.");
tbc=new javax.swing.table.TableColumn(intNumColIniCanPenRep+i);
tbc.setHeaderValue("" + strSubTit);
//Configurar JTable: Establecer el ancho de la columna.
// if(i==0){
// tbc.setWidth(0);
// tbc.setMaxWidth(0);
// tbc.setMinWidth(0);
// tbc.setPreferredWidth(0);
// tbc.setResizable(false);
// }
// else{
//Configurar JTable: Establecer el ancho de la columna.
tbc.setPreferredWidth(70);
// }
//Configurar JTable: Renderizar celdas.
tbc.setCellRenderer(objTblCelRenLbl);
//Configurar JTable: Agregar la columna al JTable.
objTblMod.addColumn(tblDat, tbc);
}
objTblCelRenLbl=null;
intNumColFinCanPenRep=objTblMod.getColumnCount();
}
catch(Exception e){
blnRes=false;
objUti.mostrarMsgErr_F1(this, e);
}
return blnRes;
}
private boolean consultarRegAniMesGrp(){
boolean blnRes=true;
int intAni=0;
int intMes=0;
String strCamSel="";
int intNumTotReg=0, i;
String strFilItm="";
BigDecimal bdeStkActCal=new BigDecimal("0");
BigDecimal bdeRepMaxCal=new BigDecimal("0");
BigDecimal bdeRepMinCal=new BigDecimal("0");
BigDecimal bdeStkExcCal=new BigDecimal("0");
BigDecimal bdeStkDspBodDstCal=new BigDecimal("0");
BigDecimal bdeRepMaxBodDstCal=new BigDecimal("0");
BigDecimal bdeRepMinBodDstCal=new BigDecimal("0");
BigDecimal bdeStkExcBodDstCal=new BigDecimal("0");
BigDecimal bdeExiCanDspRepCal=new BigDecimal("0");
try{
if(con!=null){
stm=con.createStatement();
strAux="";
strFilItm="";
if(! txtCodItm.getText().toString().equals(""))
strFilItm+=" AND a1.co_itm=" + txtCodItm.getText() + "";
if (txtCodAltItmDes.getText().length()>0 || txtCodAltItmHas.getText().length()>0)
strFilItm+=" AND ((LOWER(a1.tx_codAlt) BETWEEN '" + txtCodAltItmDes.getText().replaceAll("'", "''").toLowerCase() + "' AND '" + txtCodAltItmHas.getText().replaceAll("'", "''").toLowerCase() + "') OR LOWER(a1.tx_codAlt) LIKE '" + txtCodAltItmHas.getText().replaceAll("'", "''").toLowerCase() + "%')";
for(int j=0; j<arlDatAniAdd.size(); j++){
intAni=objUti.getObjectValueAt(arlDatAniAdd, j, INT_ARL_ANI)==null?0:objUti.getIntValueAt(arlDatAniAdd, j, INT_ARL_ANI);
intMes=objUti.getObjectValueAt(arlDatAniAdd, j, INT_ARL_NUM_MES)==null?0:objUti.getIntValueAt(arlDatAniAdd, j, INT_ARL_NUM_MES);
strAux+=" LEFT OUTER JOIN(";
strAux+=" SELECT a4.co_emp, a4.co_itm, " + txtCodBodDes.getText() + " AS co_bod, SUM(a4.nd_uniVen) AS nd_uniVen";
strAux+=" , SUM(a4.ne_numVec) AS ne_numVec, SUM(a4.ne_numMes) AS ne_numMes, a4.ne_ani, a4.ne_mes";
strAux+=" FROM(";
strAux+=" SELECT a4.co_emp, a4.co_itm, a4.co_bod, SUM(a4.nd_uniVen) AS nd_uniVen";
strAux+=" , SUM(a4.ne_numVec) AS ne_numVec, COUNT(a4.ne_numMes) AS ne_numMes, a4.ne_ani, a4.ne_mes";
strAux+=" FROM tbm_venMenInvBod AS a4";
strAux+=" INNER JOIN tbm_inv AS a1";
strAux+=" ON a4.co_emp=a1.co_emp AND a4.co_itm=a1.co_itm";
strAux+=" WHERE a4.co_emp=" + objParSis.getCodigoEmpresa() + "";
//if(txtCodBodDes.getText().equals("15"))
// strAux+=" AND a4.co_bod IN (1,2,3,5,11,28,15)";//California, Via a Daule, Quito, Manta, Santo domingo, Cuenca, Inmaconsa
//else
strAux+=" AND a4.co_bod=" + txtCodBodDes.getText() + "";
strAux+=" AND a4.ne_ani=" + intAni + "";
strAux+=" AND a4.ne_mes=" + intMes + "";
strAux+=" " + strFilItm + "";
strAux+=" GROUP BY a4.co_emp, a4.co_itm, a4.co_bod, a4.ne_ani, a4.ne_mes";
strAux+=" ORDER BY a4.co_itm, a4.ne_mes";
strAux+=" ) AS a4";
strAux+=" GROUP BY a4.co_emp, a4.co_itm, a4.ne_ani, a4.ne_mes";
strAux+=" ORDER BY a4.co_itm, a4.ne_mes";
strAux+=" ) AS b" + (j+2) + "";
strAux+=" ON b1.co_emp=b" + (j+2) + ".co_emp AND b1.co_bod=b" + (j+2) + ".co_bod AND b1.co_itm=b" + (j+2) + ".co_itm";
strCamSel+=" , b" + (j+2) + ".nd_uniVen AS " + "b" + (j+2) + "_nduniVen" ;
strCamSel+=" , b" + (j+2) + ".ne_numVec AS " + "b" + (j+2) + "_nenumVec" ;
strCamSel+=" , b" + (j+2) + ".ne_numMes AS " + "b" + (j+2) + "_nenumMes" ;
}
strAux+=" WHERE b1.st_reg NOT IN('U','T') AND b1.st_ser NOT IN('S','T') ";
strAux+=" AND (b1.tx_codAlt LIKE '%I' OR b1.tx_codAlt LIKE '%S')";
strAux+=" ORDER BY b1.tx_codAlt";
strSQL="";
strSQL+=" SELECT b1.co_itm, b1.tx_codAlt, b1.tx_codAlt2, b1.tx_nomItm, b1.tx_desCor, b1.nd_stkActCenDis, b1.nd_canDisCenDis";
strSQL+=" " + strCamSel + ", 0, 0, 0, b1.nd_stkAct, b1.nd_canDis, 0 AS nd_proMenVtaCal, b1.nd_proMenVtaMan, b1.nd_stkMin, b1.nd_stkExc, b1.nd_stkminsug, b1.tx_obsstkminsug, b1.nd_nummesrep, b1.nd_repmin, b1.nd_repmax";
strSQL+=" , b1.nd_stkExcBodCenDis, b1.nd_repMinBodCenDis, b1.nd_repMaxBodCenDis, b1.co_emp";
strSQL+=" FROM(";
strSQL+=" SELECT a1.co_emp, a1.co_itm, a1.tx_codAlt, a1.tx_codAlt2, a1.tx_nomItm, a2.tx_desCor, a1.st_reg, a1.st_ser, z1.co_bod, a3.nd_stkMin";
strSQL+=" , a3.nd_stkminsug, a3.tx_obsstkminsug, a3.nd_proMenVtaMan, z2.nd_stkActCenDis, z2.nd_canDisCenDis, z1.nd_stkAct, z1.nd_canDis, a3.nd_nummesrep";
strSQL+=" , a3.nd_stkexc, a3.nd_repmin, a3.nd_repmax, e3.nd_stkexc AS nd_stkExcBodCenDis, e3.nd_repmin AS nd_repMinBodCenDis, e3.nd_repmax AS nd_repMaxBodCenDis";
strSQL+=" FROM ( (tbm_inv AS a1 LEFT OUTER JOIN tbm_var AS a2 ON a1.co_uni=a2.co_reg)";
strSQL+=" INNER JOIN tbm_equInv AS x1 ON a1.co_emp=x1.co_emp AND a1.co_itm=x1.co_itm";
strSQL+=" INNER JOIN (";
strSQL+=" SELECT z.co_empGrp AS co_emp, z.co_bodGrp AS co_bod, z.co_itmMae, SUM(z.nd_stkAct) AS nd_stkAct, SUM(z.nd_canDis) AS nd_canDis";
strSQL+=" FROM(";
strSQL+=" SELECT x.*, y.co_empGrp, y.co_bodGrp FROM(";
strSQL+=" SELECT a1.co_emp, a1.co_itm, a1.co_bod, a1.nd_stkAct, a2.co_itmMae, a1.nd_canDis";
strSQL+=" FROM tbm_invBod AS a1 INNER JOIN tbm_equInv AS a2";
strSQL+=" ON a1.co_emp=a2.co_emp AND a1.co_itm=a2.co_itm";
strSQL+=" ) AS x";
strSQL+=" INNER JOIN(";
strSQL+=" SELECT co_emp, co_bod, co_empGrp, co_bodGrp";
strSQL+=" FROM tbr_bodEmpBodGrp";
strSQL+=" WHERE co_empGrp=" + objParSis.getCodigoEmpresa() + "";
strSQL+=" AND co_bodGrp=" + txtCodBodDes.getText() + "";
strSQL+=" ORDER BY co_emp";
strSQL+=" ) AS y";
strSQL+=" ON x.co_emp=y.co_emp AND x.co_bod=y.co_bod";
strSQL+=" ) AS z";
strSQL+=" GROUP BY z.co_empGrp, z.co_bodGrp, z.co_itmMae";
strSQL+=" ) AS z1";
strSQL+=" ON x1.co_emp=z1.co_emp AND x1.co_itmMae=z1.co_itmMae";
//para saber el stock en inmaconsa
strSQL+=" INNER JOIN (";
strSQL+=" SELECT z.co_empGrp AS co_emp, z.co_bodGrp AS co_bod, z.co_itmMae, SUM(z.nd_stkAct) AS nd_stkActCenDis, SUM(z.nd_canDis) AS nd_canDisCenDis";
strSQL+=" FROM(";
strSQL+=" SELECT x.*, y.co_empGrp, y.co_bodGrp FROM(";
strSQL+=" SELECT a1.co_emp, a1.co_itm, a1.co_bod, a1.nd_stkAct, a2.co_itmMae, a1.nd_canDis";
strSQL+=" FROM tbm_invBod AS a1 INNER JOIN tbm_equInv AS a2";
strSQL+=" ON a1.co_emp=a2.co_emp AND a1.co_itm=a2.co_itm";
strSQL+=" ) AS x";
strSQL+=" INNER JOIN(";
strSQL+=" SELECT co_emp, co_bod, co_empGrp, co_bodGrp";
strSQL+=" FROM tbr_bodEmpBodGrp";
strSQL+=" WHERE co_empGrp=" + objParSis.getCodigoEmpresa() + "";
strSQL+=" AND co_bodGrp=" + INT_COD_BOD_CEN_DIS + "";//INT_COD_BOD_CEN_DIS = Inmaconsa
strSQL+=" ORDER BY co_emp";
strSQL+=" ) AS y";
strSQL+=" ON x.co_emp=y.co_emp AND x.co_bod=y.co_bod";
strSQL+=" ) AS z";
strSQL+=" GROUP BY z.co_empGrp, z.co_bodGrp, z.co_itmMae";
strSQL+=" ) AS z2";
strSQL+=" ON x1.co_emp=z2.co_emp AND x1.co_itmMae=z2.co_itmMae";
//fin
strSQL+=" )";
strSQL+=" INNER JOIN tbm_invBod AS a3";
strSQL+=" ON a1.co_emp=a3.co_emp AND a1.co_itm=a3.co_itm ";
strSQL+=" AND a3.co_bod=" + txtCodBodDes.getText() + "";
strSQL+=" INNER JOIN tbm_invBod AS e3";
strSQL+=" ON a1.co_emp=e3.co_emp AND a1.co_itm=e3.co_itm ";
strSQL+=" AND e3.co_bod=" + INT_COD_BOD_CEN_DIS + "";
if( ! txtCodCla.getText().equals("")){
strSQL+=" INNER JOIN tbr_invCla AS c1";
strSQL+=" ON a3.co_emp=c1.co_emp AND a3.co_itm=c1.co_itm";
}
strSQL+=" WHERE a1.co_emp=" + objParSis.getCodigoEmpresa() + "";
strSQL+=" AND a3.co_bod=" + txtCodBodDes.getText() + "";
strSQL+=" AND e3.co_bod=" + INT_COD_BOD_CEN_DIS + "";
strSQL+=" " + strFilItm + "";
if(chkStkMinSug.isSelected())
strSQL+=" and a3.nd_stkminsug>=0";
if( ! txtCodCla.getText().equals("")){
strSQL+=" AND c1.co_cla=" + txtCodCla.getText() + " AND c1.st_reg IN('A','P')";
}
strSQL+=" ) AS b1";
strSQL+="" + strAux;
System.out.println("consultarRegAniMesGrp: " + strSQL);
rst=stm.executeQuery(strSQL);
vecDat.clear();
lblMsgSis.setText("Cargando datos...");
pgrSis.setMinimum(0);
pgrSis.setMaximum(intNumTotReg);
pgrSis.setValue(0);
i=0;
vecAux=new Vector();
while(rst.next()){
if (blnCon){
vecReg=new Vector();
vecReg.add(INT_TBL_DAT_LIN,"");
vecReg.add(INT_TBL_DAT_COD_ITM, "" + rst.getString("co_itm"));
vecReg.add(INT_TBL_DAT_COD_ALT_ITM, "" + rst.getString("tx_codAlt"));
vecReg.add(INT_TBL_DAT_COD_ALT_ITM_DOS, "" + rst.getObject("tx_codAlt2")==null?"":rst.getString("tx_codAlt2"));
vecReg.add(INT_TBL_DAT_NOM_ITM, "" + rst.getString("tx_nomItm"));
vecReg.add(INT_TBL_DAT_UNI_MED, "" + rst.getString("tx_desCor")==null?"":rst.getString("tx_desCor"));
vecReg.add(INT_TBL_DAT_STK_ACT_CEN_DIS, "" + rst.getString("nd_stkActCenDis"));
vecReg.add(INT_TBL_DAT_DIS_CEN_DIS, "" + rst.getString("nd_canDisCenDis"));
for(int j=intNumColIniFec; j<intNumColFinFec;j++){
vecReg.add(j, "" + rst.getObject(j)==null?"0":rst.getString(j));
}
//totales
for(int j=intNumColIniTot; j<intNumColFinTot;j++){
vecReg.add(j, "" + rst.getObject(j)==null?"0":rst.getString(j));
}
//stock actual
for(int j=intNumColIniStkAct; j<intNumColFinStkAct;j++){
vecReg.add(j, "" + rst.getObject(j)==null?"0":rst.getString(j));
}
//promedio mensual
for(int j=intNumColIniProMen; j<intNumColFinProMen;j++){
if(j==(intNumColIniProMen+1))
vecReg.add(j, rst.getObject("nd_proMenVtaMan")==null?"":rst.getString("nd_proMenVtaMan"));
else
vecReg.add(j, "");
}
//minimo y exceso
for(int j=intNumColIniStkMinExc; j<intNumColFinStkMinExc;j++){
vecReg.add(j, rst.getObject(j)==null?"": rst.getString(j));
}
//observacion - boton
vecReg.add(intNumColIniObs, "");
//reposicion
for(int j=intNumColIniStkRep; j<intNumColFinStkRep;j++){
if(j==intNumColIniStkRep)
vecReg.add(j, rst.getObject("nd_nummesrep")==null?"":rst.getObject("nd_nummesrep"));
else if(j==(intNumColIniStkRep+1))
vecReg.add(j, rst.getObject("nd_repmin")==null?"":rst.getObject("nd_repmin"));
else if(j==(intNumColIniStkRep+2))
vecReg.add(j, rst.getObject("nd_repmax")==null?"":rst.getObject("nd_repmax"));
else
vecReg.add(j, "");
}
//Bodega destino
bdeStkActCal=new BigDecimal(rst.getObject("nd_stkAct")==null?"0":(rst.getString("nd_stkAct").equals("")?"0":rst.getString("nd_stkAct")));
bdeRepMaxCal=new BigDecimal(rst.getObject("nd_repMax")==null?"0":(rst.getString("nd_repMax").equals("")?"0":rst.getString("nd_repMax")));
bdeRepMinCal=new BigDecimal(rst.getObject("nd_repMin")==null?"0":(rst.getString("nd_repMin").equals("")?"0":rst.getString("nd_repMin")));
bdeStkExcCal=new BigDecimal(rst.getObject("nd_stkExc")==null?"0":(rst.getString("nd_stkExc").equals("")?"0":rst.getString("nd_stkExc")));
//bodega centro distribucion
bdeStkDspBodDstCal=new BigDecimal(rst.getObject("nd_stkActCenDis")==null?"0":(rst.getString("nd_stkActCenDis").equals("")?"0":rst.getString("nd_stkActCenDis")));
bdeRepMaxBodDstCal=new BigDecimal(rst.getObject("nd_repMaxBodCenDis")==null?"0":(rst.getString("nd_repMaxBodCenDis").equals("")?"0":rst.getString("nd_repMaxBodCenDis")));
bdeStkExcBodDstCal=new BigDecimal(rst.getObject("nd_stkExcBodCenDis")==null?"0":(rst.getString("nd_stkExcBodCenDis").equals("")?"0":rst.getString("nd_stkExcBodCenDis")));
bdeRepMinBodDstCal=new BigDecimal(rst.getObject("nd_repMinBodCenDis")==null?"0":(rst.getString("nd_repMinBodCenDis").equals("")?"0":rst.getString("nd_repMinBodCenDis")));
//bdeExiCanDspRepCal=(bdeStkDspBodDstCal.subtract(bdeRepMaxBodDstCal.add(bdeStkExcBodDstCal)));
bdeExiCanDspRepCal=(bdeStkDspBodDstCal.subtract(bdeRepMinBodDstCal.add(bdeStkExcBodDstCal)));
//cantidad pendiente de reponer
for(int j=intNumColIniCanPenRep; j<intNumColFinCanPenRep;j++){
if((bdeRepMinCal.subtract(bdeStkActCal)).compareTo(new BigDecimal("0"))>0){
if(j==intNumColIniCanPenRep)
vecReg.add(j, (bdeRepMaxCal.subtract(bdeStkActCal)));//can.pen.rep.
else{
if(bdeExiCanDspRepCal.compareTo(new BigDecimal("0"))>0){
if(bdeExiCanDspRepCal.compareTo((bdeRepMaxCal.subtract(bdeStkActCal)))>0)
vecReg.add(j, (bdeRepMaxCal.subtract(bdeStkActCal)));//can.pen.rep.
else
vecReg.add(j, bdeExiCanDspRepCal);
}
else
vecReg.add(j, "0");
}//can.dis.rep
}
else
vecReg.add(j, "0");
}
vecDat.add(vecReg);
i++;
pgrSis.setValue(i);
}
else{
break;
}
}
lblMsgSis.setText("Se encontraron " + rst.getRow() + " registros.");
rst.close();
stm.close();
rst=null;
stm=null;
//para hacer editables las columnas
if(objParSis.getCodigoUsuario()==1){
//minimo, ecexso, sugerido, observacion
for(int j=intNumColIniStkMinExc; j<intNumColFinStkMinExc;j++){
vecAux.add("" + j);
}
//boton de observacion
vecAux.add(""+intNumColIniObs);
//promedio manual
for(int j=intNumColIniProMen; j<intNumColFinProMen;j++){
if(j==(intNumColIniProMen+1))
vecAux.add("" + j);
}
for(int j=intNumColIniStkRep; j<intNumColFinStkRep;j++){
if(j==intNumColIniStkRep)
vecAux.add("" + j);
}
}
else{
if(objParSis.getCodigoMenu()==2332){//bodegas
if(objPerUsr.isOpcionEnabled(2334)){//guardar
//minimo, ecexso, sugerido, observacion
for(int j=intNumColIniStkMinExc; j<intNumColFinStkMinExc;j++){
vecAux.add("" + j);
}
//boton de observacion
vecAux.add(""+intNumColIniObs);
//promedio manual
for(int j=intNumColIniProMen; j<intNumColFinProMen;j++){
if(j==(intNumColIniProMen+1))
vecAux.add("" + j);
}
for(int j=intNumColIniStkRep; j<intNumColFinStkRep;j++){
if(j==intNumColIniStkRep)
vecAux.add("" + j);
}
}
}
if(objParSis.getCodigoMenu()==1662){//proveedores
if(objPerUsr.isOpcionEnabled(1664)){//guardar
//para hacer editables las ultimas 5 columnas
vecAux.add("" + (intNumColIniProMen+1));
vecAux.add("" + intNumColIniStkMinExc);
}
}
}
objTblMod.setColumnasEditables(vecAux);
vecAux=null;
objTblMod.setModoOperacion(objTblMod.INT_TBL_EDI);
//Asignar vectores al modelo.
//Asignar vectores al modelo.
objTblMod.setData(vecDat);
tblDat.setModel(objTblMod);
vecDat.clear();
lblMsgSis.setText("Se encontraron " + tblDat.getRowCount() + " registros.");
pgrSis.setValue(0);
butCon.setText("Consultar");
}
}
catch(Exception e){
objUti.mostrarMsgErr_F1(this, e);
blnRes=false;
}
return blnRes;
}
private boolean consultarRegAniMesEmp(){
boolean blnRes=true;
int intAni=0;
int intMes=0;
String strCamSel="";
int intNumTotReg=0, i;
String strFilItm="";
int intNumColAdiFin=0;
try{
if(con!=null){
if(intNumColAdiFec>1)
intNumColAdiFin=6;
else
intNumColAdiFin=3;
stm=con.createStatement();
strAux="";
strFilItm="";
if(! txtCodItm.getText().toString().equals(""))
strFilItm+=" AND a1.co_itm=" + txtCodItm.getText() + "";
if (txtCodAltItmDes.getText().length()>0 || txtCodAltItmHas.getText().length()>0)
strFilItm+=" AND ((LOWER(a1.tx_codAlt) BETWEEN '" + txtCodAltItmDes.getText().replaceAll("'", "''").toLowerCase() + "' AND '" + txtCodAltItmHas.getText().replaceAll("'", "''").toLowerCase() + "') OR LOWER(a1.tx_codAlt) LIKE '" + txtCodAltItmHas.getText().replaceAll("'", "''").toLowerCase() + "%')";
for(int j=0; j<arlDatAniAdd.size(); j++){
intAni=objUti.getObjectValueAt(arlDatAniAdd, j, INT_ARL_ANI)==null?0:objUti.getIntValueAt(arlDatAniAdd, j, INT_ARL_ANI);
intMes=objUti.getObjectValueAt(arlDatAniAdd, j, INT_ARL_NUM_MES)==null?0:objUti.getIntValueAt(arlDatAniAdd, j, INT_ARL_NUM_MES);
strAux+=" LEFT OUTER JOIN(";
strAux+=" SELECT a4.co_emp, a4.co_itm, " + txtCodBodDes.getText() + " AS co_bod, SUM(a4.nd_uniVen) AS nd_uniVen";
strAux+=" , SUM(a4.ne_numVec) AS ne_numVec, SUM(a4.ne_numMes) AS ne_numMes, a4.ne_ani, a4.ne_mes";
strAux+=" FROM(";
strAux+=" SELECT a4.co_emp, a4.co_itm, a4.co_bod, SUM(a4.nd_uniVen) AS nd_uniVen";
strAux+=" , SUM(a4.ne_numVec) AS ne_numVec, COUNT(a4.ne_numMes) AS ne_numMes, a4.ne_ani, a4.ne_mes";
strAux+=" FROM tbm_venMenInvBod AS a4";
strAux+=" INNER JOIN tbm_inv AS a1";
strAux+=" ON a4.co_emp=a1.co_emp AND a4.co_itm=a1.co_itm";
strAux+=" WHERE a4.co_emp=" + objParSis.getCodigoEmpresa() + "";
//if(txtCodBodDes.getText().equals("15"))
// strAux+=" AND a4.co_bod IN (1,2,3,5,11,28,15)";//California, Via a Daule, Quito, Manta, Santo domingo, Cuenca, Inmaconsa
//else
strAux+=" AND a4.co_bod=" + txtCodBodDes.getText() + "";
strAux+=" AND a4.ne_ani=" + intAni + "";
strAux+=" AND a4.ne_mes=" + intMes + "";
strAux+=" " + strFilItm + "";
strAux+=" GROUP BY a4.co_emp, a4.co_itm, a4.co_bod, a4.ne_ani, a4.ne_mes";
strAux+=" ORDER BY a4.co_itm, a4.ne_mes";
strAux+=" ) AS a4";
strAux+=" GROUP BY a4.co_emp, a4.co_itm, a4.ne_ani, a4.ne_mes";
strAux+=" ORDER BY a4.co_itm, a4.ne_mes";
strAux+=" ) AS b" + (j+2) + "";
strAux+=" ON b1.co_emp=b" + (j+2) + ".co_emp AND b1.co_bod=b" + (j+2) + ".co_bod AND b1.co_itm=b" + (j+2) + ".co_itm";
strCamSel+=" , b" + (j+2) + ".nd_uniVen AS " + "b" + (j+2) + "_nduniVen" ;
strCamSel+=" , b" + (j+2) + ".ne_numVec AS " + "b" + (j+2) + "_nenumVec" ;
strCamSel+=" , b" + (j+2) + ".ne_numMes AS " + "b" + (j+2) + "_nenumMes" ;
}
strAux+=" WHERE b1.st_reg NOT IN('U','T') AND b1.st_ser NOT IN('S','T','O') AND (b1.tx_codAlt LIKE '%S' OR b1.tx_codAlt LIKE '%L')";
strAux+=" ORDER BY b1.tx_codAlt";
strSQL="";
strSQL+="SELECT b1.co_itm, b1.tx_codAlt, b1.tx_codAlt2, b1.tx_nomItm, b1.tx_desCor";
strSQL+=" " + strCamSel + ", 0, 0, 0 , b1.nd_stkAct, b1.nd_canDis, 0 AS nd_proMenVtaCal, b1.nd_proMenVtaMan, b1.nd_stkMin, b1.nd_stkexc, b1.nd_stkminsug, b1.tx_obsstkminsug";
strSQL+=" FROM(";
strSQL+=" SELECT a1.co_emp, a1.co_itm, a1.tx_codAlt, a1.tx_codAlt2, a1.tx_nomItm, a2.tx_desCor, a3.co_bod, a1.st_reg, a1.st_ser";
strSQL+=" , a3.nd_stkMin, a3.nd_stkexc, a3.nd_stkminsug, a3.tx_obsstkminsug, a3.nd_promenvtaman, a3.nd_stkAct, a3.nd_canDis";
strSQL+=" FROM (tbm_inv AS a1 LEFT OUTER JOIN tbm_var AS a2";
strSQL+=" ON a1.co_uni=a2.co_reg)";
strSQL+=" INNER JOIN tbm_invBod as a3";
strSQL+=" ON a1.co_emp=a3.co_emp AND a1.co_itm=a3.co_itm";
if( ! txtCodCla.getText().equals("")){
strSQL+=" INNER JOIN tbr_invCla AS c1";
strSQL+=" ON a3.co_emp=c1.co_emp AND a3.co_itm=c1.co_itm";
}
strSQL+=" WHERE a1.co_emp=" + objParSis.getCodigoEmpresa() + "";
strSQL+=" AND a3.co_bod=" + txtCodBodDes.getText() + "";
strSQL+=" " + strFilItm + "";
if(chkStkMinSug.isSelected())
strSQL+=" and a3.nd_stkminsug>=0";
if( ! txtCodCla.getText().equals("")){
strSQL+=" AND c1.co_cla=" + txtCodCla.getText() + " AND c1.st_reg IN('A','P')";
}
strSQL+=" ) AS b1";
strSQL+="" + strAux;
System.out.println(" consultarRegAniMesEmp: " + strSQL);
rst=stm.executeQuery(strSQL);
vecDat.clear();
lblMsgSis.setText("Cargando datos...");
pgrSis.setMinimum(0);
pgrSis.setMaximum(intNumTotReg);
pgrSis.setValue(0);
i=0;
vecAux=new Vector();
while(rst.next()){
if (blnCon){
vecReg=new Vector();
vecReg.add(INT_TBL_DAT_LIN,"");
vecReg.add(INT_TBL_DAT_COD_ITM, "" + rst.getString("co_itm"));
vecReg.add(INT_TBL_DAT_COD_ALT_ITM, "" + rst.getString("tx_codAlt"));
vecReg.add(INT_TBL_DAT_COD_ALT_ITM_DOS, "" + rst.getObject("tx_codAlt2")==null?"":rst.getString("tx_codAlt2"));
vecReg.add(INT_TBL_DAT_NOM_ITM, "" + rst.getString("tx_nomItm"));
vecReg.add(INT_TBL_DAT_UNI_MED, "" + rst.getString("tx_desCor")==null?"":rst.getString("tx_desCor"));
for(int j=intNumColIniFec; j<intNumColFinFec;j++){
vecReg.add(j, "" + rst.getObject(j)==null?"0":rst.getString(j));
}
//totales
for(int j=intNumColIniTot; j<intNumColFinTot;j++){
vecReg.add(j, "" + rst.getObject(j)==null?"0":rst.getString(j));
}
//stock actual
for(int j=intNumColIniStkAct; j<intNumColFinStkAct;j++){
vecReg.add(j, "" + rst.getObject(j)==null?"0":rst.getString(j));
}
//promedio mensual
for(int j=intNumColIniProMen; j<intNumColFinProMen;j++){
if(j==(intNumColIniProMen+1))
vecReg.add(j, "" + (rst.getObject("nd_proMenVtaMan")==null?"0":(rst.getString("nd_proMenVtaMan").equals("")?"0":rst.getString("nd_proMenVtaMan"))));
else
vecReg.add(j, "0");
}
//minimo y exceso
for(int j=intNumColIniStkMinExc; j<intNumColFinStkMinExc;j++){
vecReg.add(j, "" + (rst.getObject(j)==null?"0":rst.getString(j)));
}
vecDat.add(vecReg);
i++;
pgrSis.setValue(i);
// lblMsgSis.setText("Se encontraron " + rst.getRow() + " registros.");
}
else{
break;
}
}
lblMsgSis.setText("Se encontraron " + rst.getRow() + " registros.");
rst.close();
stm.close();
rst=null;
stm=null;
if(objParSis.getCodigoUsuario()==1){
//promedio manual
vecAux.add("" + (intNumColIniProMen+1));
//minimo
vecAux.add("" + intNumColIniStkMinExc);
}
else{
if(objParSis.getCodigoMenu()==1662){//proveedores
if(objPerUsr.isOpcionEnabled(1664)){//guardar
vecAux.add("" + (intNumColIniProMen+1));
vecAux.add("" + intNumColIniStkMinExc);
}
}
}
objTblMod.setColumnasEditables(vecAux);
vecAux=null;
objTblMod.setModoOperacion(objTblMod.INT_TBL_EDI);
//Asignar vectores al modelo.
objTblMod.setData(vecDat);
tblDat.setModel(objTblMod);
vecDat.clear();
lblMsgSis.setText("Se encontraron " + tblDat.getRowCount() + " registros.");
pgrSis.setValue(0);
butCon.setText("Consultar");
}
}
catch(Exception e){
objUti.mostrarMsgErr_F1(this, e);
blnRes=false;
}
return blnRes;
}
private int getRegHistoricoSeleccionados(){
int intNumChkSel=0;
String strLin="";
for(int p=0; p<objTblModHis.getRowCountTrue();p++){
strLin=objTblModHis.getValueAt(p, INT_TBL_DAT_HIS_LIN)==null?"":objTblModHis.getValueAt(p, INT_TBL_DAT_HIS_LIN).toString();
if(strLin.equals("M")){
if(objTblModHis.isChecked(p, INT_TBL_DAT_HIS_CHK)){
intNumChkSel++;
}
}
}
return intNumChkSel;
}
private boolean consultarRegAniGrp()
{
boolean blnRes=true;
int intAni=0;
String strCamSel="";
int intNumTotReg=0, i;
String strFilItm="";
BigDecimal bdeStkActCal=new BigDecimal("0");
BigDecimal bdeRepMaxCal=new BigDecimal("0");
BigDecimal bdeRepMinCal=new BigDecimal("0");
BigDecimal bdeStkExcCal=new BigDecimal("0");
BigDecimal bdeStkDspBodDstCal=new BigDecimal("0");
BigDecimal bdeRepMaxBodDstCal=new BigDecimal("0");
BigDecimal bdeRepMinBodDstCal=new BigDecimal("0");
BigDecimal bdeStkExcBodDstCal=new BigDecimal("0");
BigDecimal bdeExiCanDspRepCal=new BigDecimal("0");
try{
if(con!=null){
stm=con.createStatement();
strAux="";
strFilItm="";
if(! txtCodItm.getText().toString().equals(""))
strFilItm+=" AND a1.co_itm=" + txtCodItm.getText() + "";
if (txtCodAltItmDes.getText().length()>0 || txtCodAltItmHas.getText().length()>0)
strFilItm+=" AND ((LOWER(a1.tx_codAlt) BETWEEN '" + txtCodAltItmDes.getText().replaceAll("'", "''").toLowerCase() + "' AND '" + txtCodAltItmHas.getText().replaceAll("'", "''").toLowerCase() + "') OR LOWER(a1.tx_codAlt) LIKE '" + txtCodAltItmHas.getText().replaceAll("'", "''").toLowerCase() + "%')";
for(int j=0; j<arlDatAniAdd.size(); j++){
intAni=objUti.getObjectValueAt(arlDatAniAdd, j, INT_ARL_ANI)==null?0:objUti.getIntValueAt(arlDatAniAdd, j, INT_ARL_ANI);
strAux+=" LEFT OUTER JOIN(";
strAux+=" SELECT a4.co_emp, a4.co_itm, " + txtCodBodDes.getText() + " AS co_bod, SUM(a4.nd_uniVen) AS nd_uniVen";
strAux+=" , SUM(a4.ne_numVec) AS ne_numVec, SUM(a4.ne_numMes) AS ne_numMes, a4.ne_ani";
strAux+=" FROM(";
strAux+=" SELECT a4.co_emp, a4.co_itm, a4.co_bod, SUM(a4.nd_uniVen) AS nd_uniVen";
strAux+=" , SUM(a4.ne_numVec) AS ne_numVec, COUNT(a4.ne_numMes) AS ne_numMes, a4.ne_ani";
strAux+=" FROM tbm_venMenInvBod AS a4";
strAux+=" INNER JOIN tbm_inv AS a1";
strAux+=" ON a4.co_emp=a1.co_emp AND a4.co_itm=a1.co_itm";
strAux+=" WHERE a4.co_emp=" + objParSis.getCodigoEmpresa() + "";
//if(txtCodBodDes.getText().equals("15"))
// strAux+=" AND a4.co_bod IN (1,2,3,5,11,28,15)";//California, Via a Daule, Quito, Manta, Santo domingo, Cuenca, Inmaconsa
//else
strAux+=" AND a4.co_bod=" + txtCodBodDes.getText() + "";
strAux+=" AND a4.ne_ani=" + intAni + "";
strAux+=" " + strFilItm + "";
strAux+=" GROUP BY a4.co_emp, a4.co_itm, a4.co_bod, a4.ne_ani";
strAux+=" ORDER BY a4.co_itm";
strAux+=" ) AS a4";
strAux+=" GROUP BY a4.co_emp, a4.co_itm, a4.ne_ani";
strAux+=" ORDER BY a4.co_itm";
strAux+=" ) AS b" + (j+2) + "";
strAux+=" ON b1.co_emp=b" + (j+2) + ".co_emp AND b1.co_bod=b" + (j+2) + ".co_bod AND b1.co_itm=b" + (j+2) + ".co_itm";
strCamSel+=" , SUM(b" + (j+2) + ".nd_uniVen) AS " + "b" + (j+2) + "_nduniVen" ;
strCamSel+=" , SUM(b" + (j+2) + ".ne_numVec) AS " + "b" + (j+2) + "_nenumVec" ;
strCamSel+=" , SUM(b" + (j+2) + ".ne_numMes) AS " + "b" + (j+2) + "_nenumMes" ;
}
strAux+=" WHERE b1.st_reg NOT IN('U','T') AND b1.st_ser NOT IN('S','T') ";
strAux+=" AND (b1.tx_codAlt LIKE '%I' OR b1.tx_codAlt LIKE '%S')";
strAux+=" GROUP BY b1.co_emp, b1.co_itm, b1.tx_codAlt, b1.tx_codAlt2, b1.tx_nomItm, b1.tx_desCor, b1.nd_stkActCenDis, b1.nd_canDisCenDis, b1.nd_stkAct, b1.nd_canDis, b1.nd_proMenVtaMan, b1.co_bod, b1.nd_stkMin, b1.nd_stkexc, b1.nd_stkminsug, b1.tx_obsstkminsug, b1.nd_nummesrep, b1.nd_repmin, b1.nd_repmax,b1.nd_stkExcBodCenDis, b1.nd_repMinBodCenDis, b1.nd_repMaxBodCenDis";
strAux+=" ORDER BY b1.tx_codAlt";
strSQL="";
strSQL+="SELECT b1.co_itm, b1.tx_codAlt, b1.tx_codAlt2, b1.tx_nomItm, b1.tx_desCor, b1.nd_stkActCenDis, b1.nd_canDisCenDis";
strSQL+=" " + strCamSel + ", 0, 0, 0, b1.nd_stkAct, b1.nd_canDis, 0 AS nd_proMenVtaCal, b1.nd_proMenVtaMan, b1.nd_stkMin, b1.nd_stkexc, b1.nd_stkminsug, b1.tx_obsstkminsug, b1.nd_nummesrep, b1.nd_repmin, b1.nd_repmax, b1.nd_stkExcBodCenDis, b1.nd_repMinBodCenDis, b1.nd_repMaxBodCenDis";
strSQL+=" FROM(";
strSQL+=" SELECT a1.co_emp, a1.co_itm, a1.tx_codAlt, a1.tx_codAlt2, a1.tx_nomItm, a2.tx_desCor, a1.st_reg, a1.st_ser, z1.co_bod, a3.nd_stkMin";
strSQL+=" , a3.nd_stkexc, a3.nd_stkminsug, a3.tx_obsstkminsug, a3.nd_proMenVtaMan";
strSQL+=" , z2.nd_stkActCenDis, z2.nd_canDisCenDis, z1.nd_stkAct, z1.nd_canDis, a3.nd_nummesrep, a3.nd_repmin, a3.nd_repmax";
strSQL+=" , e3.nd_stkexc AS nd_stkExcBodCenDis, e3.nd_repmin AS nd_repMinBodCenDis, e3.nd_repmax AS nd_repMaxBodCenDis";
strSQL+=" FROM ( (tbm_inv AS a1 LEFT OUTER JOIN tbm_var AS a2 ON a1.co_uni=a2.co_reg)";
strSQL+=" INNER JOIN tbm_equInv AS x1 ON a1.co_emp=x1.co_emp AND a1.co_itm=x1.co_itm";
strSQL+=" INNER JOIN (";
strSQL+=" SELECT z.co_empGrp AS co_emp, z.co_bodGrp AS co_bod, z.co_itmMae, SUM(z.nd_stkAct) AS nd_stkAct, SUM(z.nd_canDis) AS nd_canDis";
strSQL+=" FROM(";
strSQL+=" SELECT x.*, y.co_empGrp, y.co_bodGrp FROM(";
strSQL+=" SELECT a1.co_emp, a1.co_itm, a1.co_bod, a1.nd_stkAct, a1.nd_canDis, a2.co_itmMae";
strSQL+=" FROM tbm_invBod AS a1 INNER JOIN tbm_equInv AS a2";
strSQL+=" ON a1.co_emp=a2.co_emp AND a1.co_itm=a2.co_itm";
strSQL+=" ) AS x";
strSQL+=" INNER JOIN(";
strSQL+=" SELECT co_emp, co_bod, co_empGrp, co_bodGrp";
strSQL+=" FROM tbr_bodEmpBodGrp";
strSQL+=" WHERE co_empGrp=" + objParSis.getCodigoEmpresa() + "";
strSQL+=" AND co_bodGrp=" + txtCodBodDes.getText() + "";
strSQL+=" ORDER BY co_emp";
strSQL+=" ) AS y";
strSQL+=" ON x.co_emp=y.co_emp AND x.co_bod=y.co_bod";
strSQL+=" ) AS z";
strSQL+=" GROUP BY z.co_empGrp, z.co_bodGrp, z.co_itmMae";
strSQL+=" ) AS z1";
strSQL+=" ON x1.co_emp=z1.co_emp AND x1.co_itmMae=z1.co_itmMae";
//inicio-inmaconsa
strSQL+=" INNER JOIN (";
strSQL+=" SELECT z.co_empGrp AS co_emp, z.co_bodGrp AS co_bod, z.co_itmMae, SUM(z.nd_stkAct) AS nd_stkActCenDis, SUM(z.nd_canDis) AS nd_canDisCenDis";
strSQL+=" FROM(";
strSQL+=" SELECT x.*, y.co_empGrp, y.co_bodGrp FROM(";
strSQL+=" SELECT a1.co_emp, a1.co_itm, a1.co_bod, a1.nd_stkAct, a2.co_itmMae, a1.nd_canDis";
strSQL+=" FROM tbm_invBod AS a1 INNER JOIN tbm_equInv AS a2";
strSQL+=" ON a1.co_emp=a2.co_emp AND a1.co_itm=a2.co_itm";
strSQL+=" ) AS x";
strSQL+=" INNER JOIN(";
strSQL+=" SELECT co_emp, co_bod, co_empGrp, co_bodGrp";
strSQL+=" FROM tbr_bodEmpBodGrp";
strSQL+=" WHERE co_empGrp=" + objParSis.getCodigoEmpresa() + "";
strSQL+=" AND co_bodGrp=" + INT_COD_BOD_CEN_DIS + "";//bODEGA DE CENTRO DE DISTRIBUCION - INMACONSA
strSQL+=" ORDER BY co_emp";
strSQL+=" ) AS y";
strSQL+=" ON x.co_emp=y.co_emp AND x.co_bod=y.co_bod";
strSQL+=" ) AS z";
strSQL+=" GROUP BY z.co_empGrp, z.co_bodGrp, z.co_itmMae";
strSQL+=" ) AS z2";
strSQL+=" ON x1.co_emp=z2.co_emp AND x1.co_itmMae=z2.co_itmMae";
//fin
strSQL+=" )";
strSQL+=" INNER JOIN tbm_invBod AS a3";
strSQL+=" ON a1.co_emp=a3.co_emp AND a1.co_itm=a3.co_itm ";
strSQL+=" AND a3.co_bod=" + txtCodBodDes.getText() + "";
strSQL+=" INNER JOIN tbm_invBod AS e3";
strSQL+=" ON a1.co_emp=e3.co_emp AND a1.co_itm=e3.co_itm ";
strSQL+=" AND e3.co_bod=" + INT_COD_BOD_CEN_DIS + "";
if( ! txtCodCla.getText().equals("")){
strSQL+=" INNER JOIN tbr_invCla AS c1";
strSQL+=" ON a3.co_emp=c1.co_emp AND a3.co_itm=c1.co_itm";
}
strSQL+=" WHERE a1.co_emp=" + objParSis.getCodigoEmpresa() + "";
strSQL+=" AND a3.co_bod=" + txtCodBodDes.getText() + "";
strSQL+=" " + strFilItm + "";
if(chkStkMinSug.isSelected())
strSQL+=" and a3.nd_stkminsug>=0";
if( ! txtCodCla.getText().equals("")){
strSQL+=" AND c1.co_cla=" + txtCodCla.getText() + " AND c1.st_reg IN('A','P')";
}
strSQL+=" ) AS b1";
strSQL+="" + strAux;
System.out.println("consultarRegAniGrp: " + strSQL);
rst=stm.executeQuery(strSQL);
vecDat.clear();
lblMsgSis.setText("Cargando datos...");
pgrSis.setMinimum(0);
pgrSis.setMaximum(intNumTotReg);
pgrSis.setValue(0);
i=0;
vecAux=new Vector();
while(rst.next()){
if (blnCon){
vecReg=new Vector();
vecReg.add(INT_TBL_DAT_LIN,"");
vecReg.add(INT_TBL_DAT_COD_ITM, "" + rst.getString("co_itm"));
vecReg.add(INT_TBL_DAT_COD_ALT_ITM, "" + rst.getString("tx_codAlt"));
vecReg.add(INT_TBL_DAT_COD_ALT_ITM_DOS, "" + rst.getObject("tx_codAlt2")==null?"":rst.getString("tx_codAlt2"));
vecReg.add(INT_TBL_DAT_NOM_ITM, "" + rst.getString("tx_nomItm"));
vecReg.add(INT_TBL_DAT_UNI_MED, "" + rst.getString("tx_desCor")==null?"":rst.getString("tx_desCor"));
vecReg.add(INT_TBL_DAT_STK_ACT_CEN_DIS, "" + rst.getString("nd_stkActCenDis"));
vecReg.add(INT_TBL_DAT_DIS_CEN_DIS, "" + rst.getString("nd_canDisCenDis"));
for(int j=intNumColIniFec; j<intNumColFinFec;j++){
vecReg.add(j, "" + rst.getObject(j)==null?"0":rst.getString(j));
}
//totales
for(int j=intNumColIniTot; j<intNumColFinTot;j++){
vecReg.add(j, "" + (rst.getObject(j)==null?"0":rst.getString(j)));
}
//stock actual
for(int j=intNumColIniStkAct; j<intNumColFinStkAct;j++){
vecReg.add(j, "" + (rst.getObject(j)==null?"0":rst.getString(j)));
}
//promedio mensual
for(int j=intNumColIniProMen; j<intNumColFinProMen;j++){
if(j==(intNumColIniProMen+1)){
vecReg.add(j, rst.getObject("nd_proMenVtaMan")==null?"":rst.getString("nd_proMenVtaMan"));
}
else{
vecReg.add(j, "");
}
}
//minimo y exceso
for(int j=intNumColIniStkMinExc; j<intNumColFinStkMinExc;j++){
vecReg.add(j, rst.getObject(j)==null?"":rst.getString(j));
}
//observacion - boton
vecReg.add(intNumColIniObs, "");
//reposicion
for(int j=intNumColIniStkRep; j<intNumColFinStkRep;j++){
if(j==intNumColIniStkRep)
vecReg.add(j, rst.getObject("nd_nummesrep")==null?"":rst.getObject("nd_nummesrep"));
else if(j==(intNumColIniStkRep+1))
vecReg.add(j, rst.getObject("nd_repmin")==null?"":rst.getObject("nd_repmin"));
else if(j==(intNumColIniStkRep+2))
vecReg.add(j, rst.getObject("nd_repmax")==null?"":rst.getObject("nd_repmax"));
else
vecReg.add(j, "");
}
bdeStkActCal=new BigDecimal(rst.getObject("nd_stkAct")==null?"0":(rst.getString("nd_stkAct").equals("")?"0":rst.getString("nd_stkAct")));
bdeRepMaxCal=new BigDecimal(rst.getObject("nd_repMax")==null?"0":(rst.getString("nd_repMax").equals("")?"0":rst.getString("nd_repMax")));
bdeRepMinCal=new BigDecimal(rst.getObject("nd_repMin")==null?"0":(rst.getString("nd_repMin").equals("")?"0":rst.getString("nd_repMin")));
bdeStkExcCal=new BigDecimal(rst.getObject("nd_stkExc")==null?"0":(rst.getString("nd_stkExc").equals("")?"0":rst.getString("nd_stkExc")));
//bodega centro distribucion
bdeStkDspBodDstCal=new BigDecimal(rst.getObject("nd_stkActCenDis")==null?"0":(rst.getString("nd_stkActCenDis").equals("")?"0":rst.getString("nd_stkActCenDis")));
bdeRepMaxBodDstCal=new BigDecimal(rst.getObject("nd_repMaxBodCenDis")==null?"0":(rst.getString("nd_repMaxBodCenDis").equals("")?"0":rst.getString("nd_repMaxBodCenDis")));
bdeStkExcBodDstCal=new BigDecimal(rst.getObject("nd_stkExcBodCenDis")==null?"0":(rst.getString("nd_stkExcBodCenDis").equals("")?"0":rst.getString("nd_stkExcBodCenDis")));
bdeRepMinBodDstCal=new BigDecimal(rst.getObject("nd_repMinBodCenDis")==null?"0":(rst.getString("nd_repMinBodCenDis").equals("")?"0":rst.getString("nd_repMinBodCenDis")));
//bdeExiCanDspRepCal=(bdeStkDspBodDstCal.subtract(bdeRepMaxBodDstCal.add(bdeStkExcBodDstCal)));
bdeExiCanDspRepCal=(bdeStkDspBodDstCal.subtract(bdeRepMinBodDstCal.add(bdeStkExcBodDstCal)));
//cantidad pendiente de reponer
for(int j=intNumColIniCanPenRep; j<intNumColFinCanPenRep;j++){
if((bdeRepMinCal.subtract(bdeStkActCal)).compareTo(new BigDecimal("0"))>0){
if(j==intNumColIniCanPenRep)
vecReg.add(j, (bdeRepMaxCal.subtract(bdeStkActCal)));//can.pen.rep.
else{
if(bdeExiCanDspRepCal.compareTo(new BigDecimal("0"))>0){
if(bdeExiCanDspRepCal.compareTo((bdeRepMaxCal.subtract(bdeStkActCal)))>0)
vecReg.add(j, (bdeRepMaxCal.subtract(bdeStkActCal)));//can.pen.rep.
else
vecReg.add(j, bdeExiCanDspRepCal);
}
else
vecReg.add(j, "0");
}//can.dis.rep
}
else
vecReg.add(j, "0");
}
vecDat.add(vecReg);
i++;
pgrSis.setValue(i);
}
else{
break;
}
}
lblMsgSis.setText("Se encontraron " + rst.getRow() + " registros.");
rst.close();
stm.close();
rst=null;
stm=null;
//para hacer editables las columnas
if(objParSis.getCodigoUsuario()==1){
//minimo, ecexso, sugerido, observacion
for(int j=intNumColIniStkMinExc; j<intNumColFinStkMinExc;j++){
vecAux.add("" + j);
}
//boton de observacion
vecAux.add(""+intNumColIniObs);
//promedio manual
for(int j=intNumColIniProMen; j<intNumColFinProMen;j++){
if(j==(intNumColIniProMen+1))
vecAux.add("" + j);
}
for(int j=intNumColIniStkRep; j<intNumColFinStkRep;j++){
if(j==intNumColIniStkRep)
vecAux.add("" + j);
}
}
else{
if(objParSis.getCodigoMenu()==2332){//bodegas
if(objPerUsr.isOpcionEnabled(2334)){//guardar
//minimo, ecexso, sugerido, observacion
for(int j=intNumColIniStkMinExc; j<intNumColFinStkMinExc;j++){
vecAux.add("" + j);
}
//boton de observacion
vecAux.add(""+intNumColIniObs);
//promedio manual
for(int j=intNumColIniProMen; j<intNumColFinProMen;j++){
if(j==(intNumColIniProMen+1))
vecAux.add("" + j);
}
for(int j=intNumColIniStkRep; j<intNumColFinStkRep;j++){
if(j==intNumColIniStkRep)
vecAux.add("" + j);
}
}
}
if(objParSis.getCodigoMenu()==1662){//proveedores
if(objPerUsr.isOpcionEnabled(1664)){//guardar
//para hacer editables las ultimas 5 columnas
vecAux.add("" + (intNumColIniProMen+1));
vecAux.add("" + intNumColIniStkMinExc);
}
}
}
objTblMod.setColumnasEditables(vecAux);
vecAux=null;
objTblMod.setModoOperacion(objTblMod.INT_TBL_EDI);
//Asignar vectores al modelo.
objTblMod.setData(vecDat);
tblDat.setModel(objTblMod);
vecDat.clear();
lblMsgSis.setText("Se encontraron " + tblDat.getRowCount() + " registros.");
pgrSis.setValue(0);
butCon.setText("Consultar");
}
}
catch(Exception e){
objUti.mostrarMsgErr_F1(this, e);
blnRes=false;
}
return blnRes;
}
private boolean consultarRegAniEmp(){
boolean blnRes=true;
int intAni=0;
String strCamSel="";
int intNumTotReg=0, i;
String strFilItm="";
int intNumColAdiFin=0;
try{
if(con!=null){
if(intNumColAdiFec>1)
intNumColAdiFin=6;
else
intNumColAdiFin=3;
stm=con.createStatement();
strAux="";
strFilItm="";
if(! txtCodItm.getText().toString().equals(""))
strFilItm+=" AND a1.co_itm=" + txtCodItm.getText() + "";
if (txtCodAltItmDes.getText().length()>0 || txtCodAltItmHas.getText().length()>0)
strFilItm+=" AND ((LOWER(a1.tx_codAlt) BETWEEN '" + txtCodAltItmDes.getText().replaceAll("'", "''").toLowerCase() + "' AND '" + txtCodAltItmHas.getText().replaceAll("'", "''").toLowerCase() + "') OR LOWER(a1.tx_codAlt) LIKE '" + txtCodAltItmHas.getText().replaceAll("'", "''").toLowerCase() + "%')";
for(int j=0; j<arlDatAniAdd.size(); j++){
intAni=objUti.getObjectValueAt(arlDatAniAdd, j, INT_ARL_ANI)==null?0:objUti.getIntValueAt(arlDatAniAdd, j, INT_ARL_ANI);
strAux+=" LEFT OUTER JOIN(";
strAux+=" SELECT a4.co_emp, a4.co_itm, " + txtCodBodDes.getText() + " AS co_bod, SUM(a4.nd_uniVen) AS nd_uniVen";
strAux+=" , SUM(a4.ne_numVec) AS ne_numVec, SUM(a4.ne_numMes) AS ne_numMes, a4.ne_ani";
strAux+=" FROM(";
strAux+=" SELECT a4.co_emp, a4.co_itm, a4.co_bod, SUM(a4.nd_uniVen) AS nd_uniVen";
strAux+=" , SUM(a4.ne_numVec) AS ne_numVec, COUNT(a4.ne_numMes) AS ne_numMes, a4.ne_ani";
strAux+=" FROM tbm_venMenInvBod AS a4";
strAux+=" INNER JOIN tbm_inv AS a1";
strAux+=" ON a4.co_emp=a1.co_emp AND a4.co_itm=a1.co_itm";
strAux+=" WHERE a4.co_emp=" + objParSis.getCodigoEmpresa() + "";
//if(txtCodBodDes.getText().equals("15"))
// strAux+=" AND a4.co_bod IN (1,2,3,5,11,28,15)";//California, Via a Daule, Quito, Manta, Santo domingo, Cuenca, Inmaconsa
//else
strAux+=" AND a4.co_bod=" + txtCodBodDes.getText() + "";
strAux+=" AND a4.ne_ani=" + intAni + "";
strAux+=" " + strFilItm + "";
strAux+=" GROUP BY a4.co_emp, a4.co_itm, a4.co_bod, a4.ne_ani";
strAux+=" ORDER BY a4.co_itm";
strAux+=" ) AS a4";
strAux+=" GROUP BY a4.co_emp, a4.co_itm, a4.ne_ani";
strAux+=" ORDER BY a4.co_itm";
strAux+=" ) AS b" + (j+2) + "";
strAux+=" ON b1.co_emp=b" + (j+2) + ".co_emp AND b1.co_bod=b" + (j+2) + ".co_bod AND b1.co_itm=b" + (j+2) + ".co_itm";
strCamSel+=" , SUM(b" + (j+2) + ".nd_uniVen) AS " + "b" + (j+2) + "_nduniVen" ;
strCamSel+=" , SUM(b" + (j+2) + ".ne_numVec) AS " + "b" + (j+2) + "_nenumVec" ;
strCamSel+=" , SUM(b" + (j+2) + ".ne_numMes) AS " + "b" + (j+2) + "_nenumMes" ;
}
strAux+=" WHERE b1.st_reg NOT IN('U','T') AND b1.st_ser NOT IN('S','T') AND (b1.tx_codAlt LIKE '%S' OR b1.tx_codAlt LIKE '%L')";
strAux+=" GROUP BY b1.co_emp, b1.co_itm, b1.tx_codAlt, b1.tx_codAlt2, b1.tx_nomItm, b1.tx_desCor, b1.nd_stkAct, b1.nd_canDis, b1.nd_stkMin, b1.nd_stkexc, b1.nd_stkminsug, b1.tx_obsstkminsug, b1.nd_promenvtaman";
strAux+=" ORDER BY b1.tx_codAlt";
strSQL="";
strSQL+="SELECT b1.co_itm, b1.tx_codAlt, b1.tx_codAlt2, b1.tx_nomItm, b1.tx_desCor";
strSQL+=" " + strCamSel + ", 0, 0, 0 , b1.nd_stkAct, b1.nd_canDis, 0 AS nd_proMenVtaCal, b1.nd_proMenVtaMan";
strSQL+=" , b1.nd_stkMin, b1.nd_stkexc, b1.nd_stkminsug, b1.tx_obsstkminsug";
strSQL+=" FROM(";
strSQL+=" SELECT a1.co_emp, a1.co_itm, a1.tx_codAlt, a1.tx_codAlt2, a1.tx_nomItm, a2.tx_desCor, a3.co_bod, a1.st_reg, a1.st_ser";
strSQL+=" , a3.nd_stkMin, a3.nd_stkexc, a3.nd_stkminsug, a3.tx_obsstkminsug, a3.nd_promenvtaman, a3.nd_stkAct, a3.nd_canDis";
strSQL+=" FROM (tbm_inv AS a1 LEFT OUTER JOIN tbm_var AS a2";
strSQL+=" ON a1.co_uni=a2.co_reg)";
strSQL+=" INNER JOIN tbm_invBod as a3";
strSQL+=" ON a1.co_emp=a3.co_emp AND a1.co_itm=a3.co_itm";
if( ! txtCodCla.getText().equals("")){
strSQL+=" INNER JOIN tbr_invCla AS c1";
strSQL+=" ON a3.co_emp=c1.co_emp AND a3.co_itm=c1.co_itm";
}
strSQL+=" WHERE a1.co_emp=" + objParSis.getCodigoEmpresa() + "";
strSQL+=" AND a3.co_bod=" + txtCodBodDes.getText() + "";
strSQL+=" " + strFilItm + "";
if(chkStkMinSug.isSelected())
strSQL+=" and a3.nd_stkminsug>=0";
if( ! txtCodCla.getText().equals("")){
strSQL+=" AND c1.co_cla=" + txtCodCla.getText() + " AND c1.st_reg IN('A','P')";
}
strSQL+=" ) AS b1";
strSQL+="" + strAux;
System.out.println("consultarRegAniEmp: " + strSQL);
rst=stm.executeQuery(strSQL);
vecDat.clear();
lblMsgSis.setText("Cargando datos...");
pgrSis.setMinimum(0);
pgrSis.setMaximum(intNumTotReg);
pgrSis.setValue(0);
i=0;
while(rst.next()){
if (blnCon){
vecAux=new Vector();
vecReg=new Vector();
vecReg.add(INT_TBL_DAT_LIN,"");
vecReg.add(INT_TBL_DAT_COD_ITM, "" + rst.getString("co_itm"));
vecReg.add(INT_TBL_DAT_COD_ALT_ITM, "" + rst.getString("tx_codAlt"));
vecReg.add(INT_TBL_DAT_COD_ALT_ITM_DOS, "" + rst.getObject("tx_codAlt2")==null?"":rst.getString("tx_codAlt2"));
vecReg.add(INT_TBL_DAT_NOM_ITM, "" + rst.getString("tx_nomItm"));
vecReg.add(INT_TBL_DAT_UNI_MED, "" + rst.getString("tx_desCor")==null?"":rst.getString("tx_desCor"));
for(int j=intNumColIniFec; j<intNumColFinFec;j++){
vecReg.add(j, "" + rst.getObject(j)==null?"0":rst.getString(j));
}
//totales
for(int j=intNumColIniTot; j<intNumColFinTot;j++){
vecReg.add(j, "" + rst.getObject(j)==null?"0":rst.getString(j));
}
//stock actual
for(int j=intNumColIniStkAct; j<intNumColFinStkAct;j++){
vecReg.add(j, "" + rst.getObject(j)==null?"0":rst.getString(j));
}
//promedio mensual
for(int j=intNumColIniProMen; j<intNumColFinProMen;j++){
if(j==(intNumColIniProMen+1))
vecReg.add(j, "" + (rst.getObject("nd_proMenVtaMan")==null?"0":(rst.getString("nd_proMenVtaMan").equals("")?"0":rst.getString("nd_proMenVtaMan"))));
else
vecReg.add(j, "0");
}
//minimo y exceso
for(int j=intNumColIniStkMinExc; j<intNumColFinStkMinExc;j++){
vecReg.add(j, "" + (rst.getObject(j)==null?"0":rst.getString(j)));
}
vecDat.add(vecReg);
i++;
pgrSis.setValue(i);
}
else{
break;
}
}
lblMsgSis.setText("Se encontraron " + rst.getRow() + " registros.");
rst.close();
stm.close();
rst=null;
stm=null;
if(objParSis.getCodigoUsuario()==1){
//promedio manual
vecAux.add("" + (intNumColIniProMen+1));
//minimo
vecAux.add("" + intNumColIniStkMinExc);
}
else{
if(objParSis.getCodigoMenu()==1662){//proveedores
if(objPerUsr.isOpcionEnabled(1664)){//guardar
vecAux.add("" + (intNumColIniProMen+1));
vecAux.add("" + intNumColIniStkMinExc);
}
}
}
objTblMod.setColumnasEditables(vecAux);
vecAux=null;
objTblMod.setModoOperacion(objTblMod.INT_TBL_EDI);
//Asignar vectores al modelo.
objTblMod.setData(vecDat);
tblDat.setModel(objTblMod);
vecDat.clear();
lblMsgSis.setText("Se encontraron " + tblDat.getRowCount() + " registros.");
pgrSis.setValue(0);
butCon.setText("Consultar");
}
}
catch(Exception e){
objUti.mostrarMsgErr_F1(this, e);
blnRes=false;
}
return blnRes;
}
private boolean calcularColumnaTotalesAniMes(){
boolean blnRes=true;
int p=0;
BigDecimal bdeSumUni=new BigDecimal(0);
BigDecimal bdeSumVec=new BigDecimal(0);
BigDecimal bdeSumMes=new BigDecimal(0);
double dblProCal=0.00;
double dblIntAniDiv=0.00;
try{
if(optHisAnu.isSelected()) // José Marín M - 19-Nov-2014
dblIntAniDiv=12*getRegHistoricoSeleccionados();
else
dblIntAniDiv=getRegHistoricoSeleccionados();
// José Marín M - 19-Nov-2014
for(int i=0; i<objTblMod.getRowCountTrue(); i++){
for(int j=intNumColFinModEst; j<(intNumColFinModEst+(intNumColAdiFec*3)); j++){
if(p==0){
bdeSumUni=bdeSumUni.add(objTblMod.getValueAt(i, j)==null?new BigDecimal(0):(objTblMod.getValueAt(i, j).equals("")?new BigDecimal(0):new BigDecimal(objTblMod.getValueAt(i, j).toString())));
p++;
}
else if(p==1){
bdeSumVec=bdeSumVec.add(objTblMod.getValueAt(i, j)==null?new BigDecimal(0):(objTblMod.getValueAt(i, j).equals("")?new BigDecimal(0):new BigDecimal(objTblMod.getValueAt(i, j).toString())));
p++;
}
else if(p==2){
bdeSumMes=bdeSumMes.add(objTblMod.getValueAt(i, j)==null?new BigDecimal(0):(objTblMod.getValueAt(i, j).equals("")?new BigDecimal(0):new BigDecimal(objTblMod.getValueAt(i, j).toString())));
p=0;
}
}
objTblMod.setValueAt("" + bdeSumUni, i, (intNumColFinModEst+(intNumColAdiFec*3)));
objTblMod.setValueAt("" + bdeSumVec, i, ((intNumColFinModEst+(intNumColAdiFec*3))+1));
objTblMod.setValueAt("" + bdeSumMes, i, ((intNumColFinModEst+(intNumColAdiFec*3))+2));
if(objParSis.getCodigoEmpresa()==objParSis.getCodigoEmpresaGrupo()){
}
else{//empresa
if(bdeSumUni.compareTo(new BigDecimal(0))>0){
//José Marín M. - 19-Nov-2014 - Promedio Calculado
dblProCal=objUti.redondear((Double.parseDouble(""+bdeSumUni)/dblIntAniDiv), objParSis.getDecimalesBaseDatos());
objTblMod.setValueAt("" + dblProCal, i, ((intNumColFinModEst+(intNumColAdiFec*3))+4));
//José Marín M. - 19-Nov-2014 - Promedio Calculado
}
dblProCal=0.00;
}
bdeSumUni=new BigDecimal(0);
bdeSumVec=new BigDecimal(0);
bdeSumMes=new BigDecimal(0);
}
}
catch(Exception e){
blnRes=false;
objUti.mostrarMsgErr_F1(this, e);
}
return blnRes;
}
private boolean calcularColumnaPromedioCalculado(){
boolean blnRes=true;
int p=0;
BigDecimal bdeSumUni=new BigDecimal(0);
BigDecimal bdeSumVec=new BigDecimal(0);
BigDecimal bdeSumMes=new BigDecimal(0);
double dblProCal=0.00;
double dblIntAniDiv=0.00;
try{
dblIntAniDiv=12*getRegHistoricoSeleccionados();
for(int i=0; i<objTblMod.getRowCountTrue(); i++){
bdeSumUni=bdeSumUni.add(objTblMod.getValueAt(i, intNumColFinModEst)==null?new BigDecimal(0):(objTblMod.getValueAt(i, intNumColFinModEst).equals("")?new BigDecimal(0):new BigDecimal(objTblMod.getValueAt(i, intNumColFinModEst).toString())));
bdeSumVec=bdeSumVec.add(objTblMod.getValueAt(i, (intNumColFinModEst+1))==null?new BigDecimal(0):(objTblMod.getValueAt(i, (intNumColFinModEst+1)).equals("")?new BigDecimal(0):new BigDecimal(objTblMod.getValueAt(i, (intNumColFinModEst+1)).toString())));
bdeSumMes=bdeSumMes.add(objTblMod.getValueAt(i, (intNumColFinModEst+2))==null?new BigDecimal(0):(objTblMod.getValueAt(i, (intNumColFinModEst+2)).equals("")?new BigDecimal(0):new BigDecimal(objTblMod.getValueAt(i, (intNumColFinModEst+2)).toString())));
if(bdeSumUni.compareTo(new BigDecimal(0))>0){
dblProCal=objUti.redondear((Double.parseDouble(""+bdeSumUni)/dblIntAniDiv), objParSis.getDecimalesBaseDatos());
objTblMod.setValueAt("" + dblProCal, i, (intNumColFinModEst+4));
}
dblProCal=0.00;
bdeSumUni=new BigDecimal(0);
bdeSumVec=new BigDecimal(0);
bdeSumMes=new BigDecimal(0);
}
}
catch(Exception e){
blnRes=false;
objUti.mostrarMsgErr_F1(this, e);
}
return blnRes;
}
/**
* Esta funcián configura la "Ventana de consulta" que será utilizada para
* mostrar los "Proveedores".
*/
private boolean configurarVenConCla()
{
boolean blnRes=true;
try
{
//Listado de campos.
ArrayList arlCam=new ArrayList();
arlCam.add("a1.co_grp");
arlCam.add("a1.tx_desCorGrp");
arlCam.add("a1.tx_desLarGrp");
arlCam.add("a1.co_cla");
arlCam.add("a1.tx_desCorCla");
arlCam.add("a1.tx_desLarCla");
//Alias de los campos.
ArrayList arlAli=new ArrayList();
arlAli.add("Cod.Grp.");
arlAli.add("Ali.Grp.");
arlAli.add("Nom.Grp.");
arlAli.add("Cod.Cla.");
arlAli.add("Ali.Cla.");
arlAli.add("Nom.Cla.");
//Ancho de las columnas.
ArrayList arlAncCol=new ArrayList();
arlAncCol.add("28");
arlAncCol.add("60");
arlAncCol.add("190");
arlAncCol.add("30");
arlAncCol.add("60");
arlAncCol.add("190");
//Armar la sentencia SQL.
strSQL="";
strSQL+=" SELECT a1.co_grp, a1.tx_desCor AS tx_desCorGrp, a1.tx_desLar AS tx_desLarGrp";
strSQL+=" , a2.co_cla, a2.tx_desCor AS tx_desCorCla, a2.tx_desLar AS tx_desLarCla";
strSQL+=" FROM tbm_claInv AS a2 LEFT OUTER JOIN tbm_grpClaInv AS a1";
strSQL+=" ON a1.co_emp=a2.co_emp AND a1.co_grp=a2.co_grp";
strSQL+=" WHERE a2.co_emp=" + objParSis.getCodigoEmpresa() + "";
strSQL+=" ORDER BY a1.co_grp, a2.co_cla";
//Ocultar columnas.
vcoCla=new ZafVenCon(javax.swing.JOptionPane.getFrameForComponent(this), objParSis, "Listado de clasificación", strSQL, arlCam, arlAli, arlAncCol);
arlCam=null;
arlAli=null;
arlAncCol=null;
//Configurar columnas.
vcoCla.setConfiguracionColumna(1, javax.swing.JLabel.RIGHT);
}
catch (Exception e)
{
blnRes=false;
objUti.mostrarMsgErr_F1(this, e);
}
return blnRes;
}
/**
* Esta funcián permite utilizar la "Ventana de Consulta" para seleccionar un
* registro de la base de datos. El tipo de básqueda determina si se debe hacer
* una básqueda directa (No se muestra la ventana de consulta a menos que no
* exista lo que se está buscando) o presentar la ventana de consulta para que
* el usuario seleccione la opcián que desea utilizar.
* @param intTipBus El tipo de básqueda a realizar.
* @return true: Si no se presentá ningán problema.
* <BR>false: En el caso contrario.
*/
private boolean mostrarVenConCla(int intTipBus)
{
boolean blnRes=true;
try
{
switch (intTipBus)
{
case 0: //Mostrar la ventana de consulta.
vcoCla.setCampoBusqueda(2);
vcoCla.show();
if (vcoCla.getSelectedButton()==vcoCla.INT_BUT_ACE)
{
txtCodCla.setText(vcoCla.getValueAt(4));
txtDesCorCla.setText(vcoCla.getValueAt(5));
txtDesLarCla.setText(vcoCla.getValueAt(6));
objTblMod.removeAllRows();
}
break;
case 1: //Básqueda directa por "Descripción corta".
if (vcoCla.buscar("a1.tx_desCorCla", txtDesCorCla.getText()))
{
txtCodCla.setText(vcoCla.getValueAt(4));
txtDesCorCla.setText(vcoCla.getValueAt(5));
txtDesLarCla.setText(vcoCla.getValueAt(6));
objTblMod.removeAllRows();
}
else
{
vcoCla.setCampoBusqueda(0);
vcoCla.setCriterio1(11);
vcoCla.cargarDatos();
vcoCla.show();
if (vcoCla.getSelectedButton()==vcoCla.INT_BUT_ACE)
{
txtCodCla.setText(vcoCla.getValueAt(4));
txtDesCorCla.setText(vcoCla.getValueAt(5));
txtDesLarCla.setText(vcoCla.getValueAt(6));
objTblMod.removeAllRows();
}
}
break;
case 2: //Básqueda directa por "Descripcián larga".
if (vcoCla.buscar("a1.tx_desLarCla", txtDesLarCla.getText()))
{
txtCodCla.setText(vcoCla.getValueAt(4));
txtDesCorCla.setText(vcoCla.getValueAt(5));
txtDesLarCla.setText(vcoCla.getValueAt(6));
objTblMod.removeAllRows();
}
else
{
vcoCla.setCampoBusqueda(2);
vcoCla.setCriterio1(11);
vcoCla.cargarDatos();
vcoCla.show();
if (vcoCla.getSelectedButton()==vcoCla.INT_BUT_ACE)
{
txtCodCla.setText(vcoCla.getValueAt(4));
txtDesCorCla.setText(vcoCla.getValueAt(5));
txtDesLarCla.setText(vcoCla.getValueAt(6));
objTblMod.removeAllRows();
}
}
break;
}
}
catch (Exception e)
{
blnRes=false;
objUti.mostrarMsgErr_F1(this, e);
}
return blnRes;
}
private boolean guardarDatos(){
boolean blnRes=true;
try{
con=DriverManager.getConnection(objParSis.getStringConexion(), objParSis.getUsuarioBaseDatos(), objParSis.getClaveBaseDatos());
if(con!=null){
con.setAutoCommit(false);
if(actualiza_tbmInvBod()){
con.commit();
}
else{
con.rollback();
blnRes=false;
}
con.close();
con=null;
}
}
catch(java.sql.SQLException e){
objUti.mostrarMsgErr_F1(this, e);
blnRes=false;
}
catch(Exception e){
objUti.mostrarMsgErr_F1(this, e);
blnRes=false;
}
return blnRes;
}
private boolean actualiza_tbmInvBod(){
boolean blnRes=true;
String strQueUpd;
String strLin="";
//BigDecimal bdeProMenVenMan=new BigDecimal(BigInteger.ZERO);
try{
if(con!=null){
strQueUpd="";
stm=con.createStatement();
for(int i=0; i<objTblMod.getRowCountTrue();i++){
strLin=objTblMod.getValueAt(i, INT_TBL_DAT_LIN)==null?"":objTblMod.getValueAt(i, INT_TBL_DAT_LIN).toString();
//bdeProMenVenMan=new BigDecimal(objTblMod.getValueAt(i, (intNumColIniProMen+1))==null?"0":(objTblMod.getValueAt(i, (intNumColIniProMen+1)).toString().equals("")?"0": objTblMod.getValueAt(i, (intNumColIniProMen + 1)).toString()));
if(strLin.equals("M")){
strSQL="";
strSQL+="UPDATE tbm_invbod";
if(objParSis.getCodigoEmpresa()==objParSis.getCodigoEmpresaGrupo()){
strSQL+=" SET nd_stkmin=" + objUti.codificar(objTblMod.getValueAt(i, (intNumColIniStkMinExc)), 0) + "";//fijo
strSQL+=", nd_stkexc=" + objUti.codificar(objTblMod.getValueAt(i, (intNumColIniStkMinExc+1)), 0) + "";
strSQL+=", nd_stkminsug=" + objUti.codificar(objTblMod.getValueAt(i, (intNumColIniStkMinExc+2)), 0) + "";
strSQL+=", tx_obsstkminsug=" + objUti.codificar(objTblMod.getValueAt(i, (intNumColIniStkMinExc+3)), 0) + "";
//strSQL+=", nd_promenvtaman=" + objUti.redondearBigDecimal(bdeProMenVenMan, objParSis.getDecimalesBaseDatos()) + "";
strSQL+=", nd_promenvtaman=" + objUti.codificar(objTblMod.getValueAt(i, (intNumColIniProMen+1)), 0) + "";
strSQL+=", nd_nummesrep=" + objUti.codificar(objTblMod.getValueAt(i, (intNumColIniStkRep)), 0) + "";
strSQL+=", nd_repmin=" + objUti.codificar(objTblMod.getValueAt(i, (intNumColIniStkRep+1)), 0) + "";
strSQL+=", nd_repmax=" + objUti.codificar(objTblMod.getValueAt(i, (intNumColIniStkRep+2)), 0) + "";
}
else{
//strSQL+=" SET nd_promenvtaman=" + objUti.redondearBigDecimal(bdeProMenVenMan, objParSis.getDecimalesBaseDatos()) + "";
strSQL+=" SET nd_promenvtaman=" + objUti.codificar(objTblMod.getValueAt(i, (intNumColIniProMen+1)), 0) + "";
strSQL+=", nd_stkmin=" + objUti.codificar(objTblMod.getValueAt(i, (intNumColIniStkMinExc)), 0) + "";
}
strSQL+=" WHERE co_emp=" + objParSis.getCodigoEmpresa() + "";
strSQL+=" AND co_bod=" + txtCodBodDes.getText() + "";
strSQL+=" AND co_itm=" + objTblMod.getValueAt(i, INT_TBL_DAT_COD_ITM) + "";
strSQL+=";";
System.out.println("actualiza_tbmInvBod: " + strSQL);
strQueUpd+=strSQL;
}
}
stm.executeUpdate(strQueUpd);
stm.close();
stm=null;
}
}
catch(java.sql.SQLException e){
objUti.mostrarMsgErr_F1(this, e);
blnRes=false;
}
catch(Exception e){
objUti.mostrarMsgErr_F1(this, e);
blnRes=false;
}
return blnRes;
}
/**
* Esta funcián determina si los campos son válidos.
* @return true: Si los campos son válidos.
* <BR>false: En el caso contrario.
*/
private boolean isCamVal(){
//Validar el "Tipo de documento".
if (txtCodBodDes.getText().equals("")){
tabFrm.setSelectedIndex(0);
mostrarMsgInf("<HTML>El campo <FONT COLOR=\"blue\">Bodega</FONT> es obligatorio.<BR>Escriba o seleccione una bodega y vuelva a intentarlo.</HTML>");
txtNomBodDes.requestFocus();
return false;
}
if(objParSis.getCodigoEmpresa()!=objParSis.getCodigoEmpresaGrupo()){
if( ! chkHisVta.isSelected()){
mostrarMsgInf("<HTML>El selector <FONT COLOR=\"blue\">Histórico de Ventas </FONT> es obligatorio.<BR>Seleccionelo y escoga también una de las dos opciones y vuelva a intentarlo.</HTML>");
return false;
}
}
if( (chkHisVta.isSelected()) && (getRegHistoricoSeleccionados()==0) ){
mostrarMsgInf("<HTML>Seleccione por lo menos un registro de la tabla de información histórica.</HTML>");
return false;
}
return true;
}
private boolean consultarRegStkActGrp(){
boolean blnRes=true;
int intAni=0;
String strCamSel="";
int intNumTotReg=0, i;
try{
if(con!=null){
stm=con.createStatement();
strAux="";
if(! txtCodItm.getText().toString().equals(""))
strAux+=" AND a1.co_itm=" + txtCodItm.getText() + "";
if (txtCodAltItmDes.getText().length()>0 || txtCodAltItmHas.getText().length()>0)
strAux+=" AND ((LOWER(a1.tx_codAlt) BETWEEN '" + txtCodAltItmDes.getText().replaceAll("'", "''").toLowerCase() + "' AND '" + txtCodAltItmHas.getText().replaceAll("'", "''").toLowerCase() + "') OR LOWER(a1.tx_codAlt) LIKE '" + txtCodAltItmHas.getText().replaceAll("'", "''").toLowerCase() + "%')";
strSQL="";
strSQL+=" SELECT a1.co_emp, a1.co_itm, a1.tx_codAlt, a1.tx_nomItm, a2.tx_desCor, a3.co_bod, a1.st_reg, a1.st_ser";
strSQL+=" , a3.nd_stkMin, a3.nd_stkexc, a3.nd_stkminsug, a3.tx_obsstkminsug";
strSQL+=" FROM (tbm_inv AS a1 LEFT OUTER JOIN tbm_var AS a2";
strSQL+=" ON a1.co_uni=a2.co_reg)";
strSQL+=" INNER JOIN tbm_invBod as a3";
strSQL+=" ON a1.co_emp=a3.co_emp AND a1.co_itm=a3.co_itm";
if( ! txtCodCla.getText().equals("")){
strSQL+=" INNER JOIN tbr_invCla AS c1";
strSQL+=" ON a3.co_emp=c1.co_emp AND a3.co_itm=c1.co_itm";
}
strSQL+=" WHERE a1.co_emp=" + objParSis.getCodigoEmpresa() + "";
strSQL+=" AND a3.co_bod=" + txtCodBodDes.getText() + "";
strSQL+=" " + strAux + "";
if(chkStkMinSug.isSelected())
strSQL+=" and a3.nd_stkminsug>=0";
if( ! txtCodCla.getText().equals("")){
strSQL+=" AND c1.co_cla=" + txtCodCla.getText() + " AND c1.st_reg IN('A','P')";
}
strSQL+=" AND a1.st_reg NOT IN('U','T') AND a1.st_ser NOT IN('S','T') ";
strSQL+=" AND (a1.tx_codAlt LIKE '%I' OR a1.tx_codAlt LIKE '%S')";
strSQL+=" GROUP BY a1.co_emp, a1.co_itm, a1.tx_codAlt, a1.tx_nomItm, a2.tx_desCor, a3.co_bod, a1.st_reg, a1.st_ser, a3.nd_stkMin, a3.nd_stkexc, a3.nd_stkminsug, a3.tx_obsstkminsug";
strSQL+=" ORDER BY a1.tx_codAlt";
System.out.println("consultarRegStkActGrp: " + strSQL);
rst=stm.executeQuery(strSQL);
vecDat.clear();
lblMsgSis.setText("Cargando datos...");
pgrSis.setMinimum(0);
pgrSis.setMaximum(intNumTotReg);
pgrSis.setValue(0);
i=0;
while(rst.next()){
if (blnCon){
vecAux=new Vector();
vecReg=new Vector();
vecReg.add(INT_TBL_DAT_LIN,"");
vecReg.add(INT_TBL_DAT_COD_ITM, "" + rst.getString("co_itm"));
vecReg.add(INT_TBL_DAT_COD_ALT_ITM, "" + rst.getString("tx_codAlt"));
vecReg.add(INT_TBL_DAT_COD_ALT_ITM_DOS, "" + rst.getString(""));
vecReg.add(INT_TBL_DAT_NOM_ITM, "" + rst.getString("tx_nomItm"));
vecReg.add(INT_TBL_DAT_UNI_MED, "" + rst.getString("tx_desCor")==null?"":rst.getString("tx_desCor"));
vecReg.add((INT_TBL_DAT_UNI_MED+2), "" + rst.getObject("nd_stkMin")==null?null:rst.getString("nd_stkMin"));
vecReg.add((INT_TBL_DAT_UNI_MED+3), "" + rst.getObject("nd_stkexc")==null?null:rst.getString("nd_stkexc"));
vecReg.add((INT_TBL_DAT_UNI_MED+4), "" + rst.getObject("nd_stkminsug")==null?null:rst.getString("nd_stkminsug"));
vecReg.add((INT_TBL_DAT_UNI_MED+5), "" + rst.getObject("tx_obsstkminsug")==null?null:rst.getString("tx_obsstkminsug"));
vecReg.add((INT_TBL_DAT_UNI_MED+6), "");
if(objParSis.getCodigoUsuario()==1){
//para hacer editables las ultimas 5 columnas
vecAux.add("" + (INT_TBL_DAT_UNI_MED+2));
vecAux.add("" + (INT_TBL_DAT_UNI_MED+3));
vecAux.add("" + (INT_TBL_DAT_UNI_MED+4));
vecAux.add("" + (INT_TBL_DAT_UNI_MED+5));
vecAux.add("" + (INT_TBL_DAT_UNI_MED+6));
}
else{
if(objParSis.getCodigoMenu()==2332){//bodegas
if(objPerUsr.isOpcionEnabled(2334)){//guardar
//para hacer editables las ultimas 5 columnas
vecAux.add("" + (INT_TBL_DAT_UNI_MED+2));
vecAux.add("" + (INT_TBL_DAT_UNI_MED+3));
vecAux.add("" + (INT_TBL_DAT_UNI_MED+4));
vecAux.add("" + (INT_TBL_DAT_UNI_MED+5));
vecAux.add("" + (INT_TBL_DAT_UNI_MED+6));
}
}
if(objParSis.getCodigoMenu()==1662){//proveedores
if(objPerUsr.isOpcionEnabled(1664)){//guardar
//para hacer editables las ultimas 5 columnas
vecAux.add("" + (INT_TBL_DAT_UNI_MED+2));
vecAux.add("" + (INT_TBL_DAT_UNI_MED+3));
vecAux.add("" + (INT_TBL_DAT_UNI_MED+4));
vecAux.add("" + (INT_TBL_DAT_UNI_MED+5));
vecAux.add("" + (INT_TBL_DAT_UNI_MED+6));
}
}
}
vecDat.add(vecReg);
i++;
pgrSis.setValue(i);
//lblMsgSis.setText("Se encontraron " + rst.getRow() + " registros.");
}
else{
break;
}
}
rst.close();
stm.close();
rst=null;
stm=null;
objTblMod.setColumnasEditables(vecAux);
vecAux=null;
objTblMod.setModoOperacion(objTblMod.INT_TBL_EDI);
//Asignar vectores al modelo.
objTblMod.setData(vecDat);
tblDat.setModel(objTblMod);
vecDat.clear();
lblMsgSis.setText("Se encontraron " + tblDat.getRowCount() + " registros.");
pgrSis.setValue(0);
butCon.setText("Consultar");
}
}
catch(Exception e){
objUti.mostrarMsgErr_F1(this, e);
blnRes=false;
}
return blnRes;
}
private void exitForm(){
String strTit, strMsg;
try{
javax.swing.JOptionPane oppMsg=new javax.swing.JOptionPane();
strTit="Mensaje del sistema Zafiro";
strMsg="¿Está seguro que desea cerrar este programa?";
if (oppMsg.showConfirmDialog(this,strMsg,strTit,javax.swing.JOptionPane.YES_NO_OPTION,javax.swing.JOptionPane.QUESTION_MESSAGE)==javax.swing.JOptionPane.YES_OPTION)
{
dispose();
}
}
catch (Exception e){
dispose();
}
}
private boolean calcularPromedioAnual()
{
boolean blnRes=true;
int p=0;
BigDecimal bdeTotUni=new BigDecimal(0);
BigDecimal bdeNumAniSel=new BigDecimal(0);
BigDecimal bdeProAnuCal=new BigDecimal(0);
try{
bdeNumAniSel=new BigDecimal("" + intNumColAdiFec);
for(int i=0; i<objTblMod.getRowCountTrue(); i++){
//contiene el valor de la columna de UNIDADES en TOTALES
bdeTotUni=new BigDecimal(objTblMod.getValueAt(i, intNumColIniTot)==null?"0":(objTblMod.getValueAt(i, intNumColIniTot).toString().equals("")?"0":objTblMod.getValueAt(i, intNumColIniTot).toString()));
bdeProAnuCal=(bdeTotUni.divide(bdeNumAniSel, objParSis.getDecimalesMostrar(), BigDecimal.ROUND_HALF_UP)).divide(new BigDecimal("12"), objParSis.getDecimalesMostrar(), BigDecimal.ROUND_HALF_UP);//promedio anual calculado de ventas calculado por item
objTblMod.setValueAt("" + objUti.redondearBigDecimal(bdeProAnuCal, Integer.parseInt("0")), i, intNumColIniProMen);
bdeProAnuCal=new BigDecimal(0);
bdeTotUni=new BigDecimal(0);
}
}
catch(Exception e){
blnRes=false;
objUti.mostrarMsgErr_F1(this, e);
}
return blnRes;
}
private boolean calcularPromedioMensual(){
boolean blnRes=true;
int p=0;
BigDecimal bdeTotUni=new BigDecimal(0);
BigDecimal bdeNumAniSel=new BigDecimal(0);
BigDecimal bdeProAnuCal=new BigDecimal(0);
try{
bdeNumAniSel=new BigDecimal("" + intNumColAdiFec);
for(int i=0; i<objTblMod.getRowCountTrue(); i++){
//contiene el valor de la columna de UNIDADES en TOTALES
bdeTotUni=new BigDecimal(objTblMod.getValueAt(i, intNumColIniTot)==null?"0":(objTblMod.getValueAt(i, intNumColIniTot).toString().equals("")?"0": objTblMod.getValueAt(i, intNumColIniTot).toString()));
bdeProAnuCal=(bdeTotUni.divide(bdeNumAniSel, objParSis.getDecimalesMostrar(), BigDecimal.ROUND_HALF_UP));//promedio anual calculado de ventas calculado por item
objTblMod.setValueAt("" + objUti.redondearBigDecimal(bdeProAnuCal, Integer.parseInt("0")), i, intNumColIniProMen);
bdeProAnuCal=new BigDecimal(0);
bdeTotUni=new BigDecimal(0);
}
}
catch(Exception e){
blnRes=false;
objUti.mostrarMsgErr_F1(this, e);
}
return blnRes;
}
private boolean calcularCantidadReponer(){
boolean blnRes=true;
BigDecimal bdeStkAct=new BigDecimal(0);
Object objCanRepCal="";
Object objMin="";
Object objMax="";
try{
for(int i=0; i<objTblMod.getRowCountTrue(); i++){
bdeStkAct=new BigDecimal(objTblMod.getValueAt(i, intNumColIniStkAct)==null?"":(objTblMod.getValueAt(i, intNumColIniStkAct).toString().equals("")?"0":objTblMod.getValueAt(i, intNumColIniStkAct).toString()));
objMin=objTblMod.getValueAt(i, (intNumColIniStkRep+1))==null?"":objTblMod.getValueAt(i, (intNumColIniStkRep+1)).toString();
objMax=objTblMod.getValueAt(i, (intNumColIniStkRep+2))==null?"":objTblMod.getValueAt(i, (intNumColIniStkRep+2)).toString();
if( (!objMin.equals("")) && (!objMax.equals("")) ){
if(bdeStkAct.compareTo(new BigDecimal(objMin.toString()))<0){
objCanRepCal=""+new BigDecimal(objMax.toString()).subtract(bdeStkAct);
}
else{
objCanRepCal=""+new BigDecimal(BigInteger.ZERO);
}
}
objTblMod.setValueAt(objCanRepCal, i, (intNumColIniStkRep+3));
}
}
catch(Exception e){
blnRes=false;
objUti.mostrarMsgErr_F1(this, e);
}
return blnRes;
}
private boolean cambiarNumeroMesesReponer(){
boolean blnRes=true;
try{
for(int i=0; i<objTblMod.getRowCountTrue(); i++){
objTblMod.setValueAt(jspNumMesRep.getValue(), i, intNumColIniStkRep);
}
}
catch(Exception e){
blnRes=false;
objUti.mostrarMsgErr_F1(this, e);
}
return blnRes;
}
private boolean calcularMinimoMaximo(){
boolean blnRes=true;
Object objValUtiCalMinMax="";
Object objPorMin="";
Object objPorMax="";
Object objFij="";
Object objProAnuCal="";
Object objProAnuMan="";
BigDecimal bdeNumMesRep=new BigDecimal(0);
try{
for(int i=0; i<objTblMod.getRowCountTrue(); i++){
objProAnuCal=objTblMod.getValueAt(i, intNumColIniProMen)==null?"":objTblMod.getValueAt(i, intNumColIniProMen).toString();
objProAnuMan=objTblMod.getValueAt(i, (intNumColIniProMen+1))==null?"":objTblMod.getValueAt(i, (intNumColIniProMen+1));
objFij=objTblMod.getValueAt(i, intNumColIniStkMinExc)==null?"":objTblMod.getValueAt(i, intNumColIniStkMinExc);
bdeNumMesRep=new BigDecimal(objTblMod.getValueAt(i, intNumColIniStkRep)==null?"0":(objTblMod.getValueAt(i, intNumColIniStkRep).toString().equals("")?"0": objTblMod.getValueAt(i, intNumColIniStkRep).toString()));
// 1.- promedio manual * numero de meses a reponer - stock actual
if(!objFij.equals("")){
//objValUtiCalMinMax="" + (new BigDecimal(objFij.toString()).multiply(bdeNumMesRep) );
objValUtiCalMinMax="" + (new BigDecimal(objFij.toString()) );
}
// 2.- promedio manual * numero de meses a reponer - stock actual
else if( (!objProAnuMan.equals("")) && (objFij.equals("")) ){
objValUtiCalMinMax="" + (new BigDecimal(objProAnuMan.toString()).multiply(bdeNumMesRep) );
}
// 3.- promedio calculado * numero de meses a reponer - stock actual
else if( (objProAnuMan.equals("")) && (objFij.equals("")) ){
objValUtiCalMinMax="" + (new BigDecimal(""+objProAnuCal).multiply(bdeNumMesRep) );
}
objTblMod.setValueAt("" + objValUtiCalMinMax, i, (intNumColIniStkRep+4));
if(!objValUtiCalMinMax.equals("")){
if(!objFij.equals("")){
objPorMin=objUti.redondearBigDecimal((new BigDecimal(""+objValUtiCalMinMax)), Integer.parseInt("0"));
objPorMax=new BigDecimal(""+objValUtiCalMinMax).multiply(new BigDecimal(txtValMax.getText()));
//bdeMin
objTblMod.setValueAt("" + objUti.redondearBigDecimal(objPorMin.toString(), Integer.parseInt("0")), i, (intNumColIniStkRep+1));
//bdeMax
objTblMod.setValueAt("" + objUti.redondearBigDecimal(objPorMax.toString(), Integer.parseInt("0")), i, (intNumColIniStkRep+2));
}
else{
objPorMin=objUti.redondearBigDecimal((new BigDecimal(""+objValUtiCalMinMax).multiply(new BigDecimal(txtValMin.getText()))), Integer.parseInt("0"));
objPorMax=new BigDecimal(""+objValUtiCalMinMax).multiply(new BigDecimal(txtValMax.getText()));
//bdeMin
objTblMod.setValueAt("" + objUti.redondearBigDecimal(objPorMin.toString(), Integer.parseInt("0")), i, (intNumColIniStkRep+1));
//bdeMax
objTblMod.setValueAt("" + objUti.redondearBigDecimal(objPorMax.toString(), Integer.parseInt("0")), i, (intNumColIniStkRep+2));
}
}
else{
objPorMin="";
objPorMax="";
//bdeMin
objTblMod.setValueAt("", i, (intNumColIniStkRep+1));
//bdeMax
objTblMod.setValueAt("", i, (intNumColIniStkRep+2));
}
}
}
catch(Exception e){
blnRes=false;
objUti.mostrarMsgErr_F1(this, e);
}
return blnRes;
}
}
| [
""
] | |
a7ba825021962b1e106c0d65c967430f6f38283c | c05575c4d9def561cca8339c45f79f4fdf8c2c71 | /src/main/java/com/arpit/springbootkafkaapp/SpringBootKafkaAppApplication.java | 5349062755307d1f89a6cae3c769152af2610c8d | [] | no_license | ArpitSaxena0910/Kafka-Basics | 8c68e78559a1893e5a58ae877b98848ad9a7d383 | 8cc6ea925f5dea353d515b8a0c21841d0a4f3735 | refs/heads/master | 2023-03-14T14:48:37.571395 | 2021-03-09T11:15:07 | 2021-03-09T11:15:07 | 345,595,101 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 345 | java | package com.arpit.springbootkafkaapp;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringBootKafkaAppApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootKafkaAppApplication.class, args);
}
}
| [
"arpitsaxena0910@gmail.com"
] | arpitsaxena0910@gmail.com |
5f810fddec0ecc7399d05785ef740ba06c39cf92 | 48700053bdf9176201afd389e61c9751144fa001 | /tutorial/tutorial4/modules/app/org.jowidgets.tutorials.tutorial4.app.ui/src/main/java/org/jowidgets/tutorials/tutorial4/app/ui/plugins/tree/RelationTreeModelPlugin.java | daa15c1caf7545c55a4c76ae3d7707db82cbeba7 | [] | no_license | jo-source/jo-client-platform-samples | 3adf461b6f47f3f228cbf5a802f7e147b985f71c | 5c4b58a1b6a11047cb5cc8f13856f7eea0555b06 | refs/heads/master | 2021-01-17T03:52:24.909003 | 2017-09-30T09:15:05 | 2017-09-30T09:15:05 | 39,778,875 | 2 | 1 | null | 2016-01-14T20:12:51 | 2015-07-27T14:29:24 | Java | UTF-8 | Java | false | false | 2,819 | java | /*
* Copyright (c) 2012, grossmann
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the jo-widgets.org nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL jo-widgets.org BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.jowidgets.tutorials.tutorial4.app.ui.plugins.tree;
import org.jowidgets.addons.icons.silkicons.SilkIcons;
import org.jowidgets.cap.common.api.bean.IBean;
import org.jowidgets.cap.ui.api.plugin.IBeanRelationTreeModelPlugin;
import org.jowidgets.cap.ui.api.tree.IBeanRelationNodeModelBluePrint;
import org.jowidgets.cap.ui.api.tree.IBeanRelationNodeModelConfigurator;
import org.jowidgets.cap.ui.api.tree.IBeanRelationTreeModelBuilder;
import org.jowidgets.cap.ui.api.types.IEntityTypeId;
import org.jowidgets.plugin.api.IPluginProperties;
public final class RelationTreeModelPlugin implements IBeanRelationTreeModelPlugin<IBean> {
@Override
public void modifySetup(final IPluginProperties properties, final IBeanRelationTreeModelBuilder<IBean> builder) {
builder.addNodeConfigurator(new BeanRelationNodeModelConfigurator());
}
private final class BeanRelationNodeModelConfigurator implements IBeanRelationNodeModelConfigurator {
@Override
public <CHILD_BEAN_TYPE> void configureNode(
final IEntityTypeId<CHILD_BEAN_TYPE> entityTypeId,
final IBeanRelationNodeModelBluePrint<CHILD_BEAN_TYPE, IBeanRelationNodeModelBluePrint<?, ?>> bluePrint) {
bluePrint.setIcon(SilkIcons.LINK);
}
}
}
| [
"herr.grossmann@gmx.de"
] | herr.grossmann@gmx.de |
a37b1b0024845ca7a229cd77ae4ee21a1db2ec90 | 890674368407b5b93c095b565ab25981d91b3e65 | /CompetitionRobot/src/org/frc4931/robot/vision/VisionSystem.java | 3a45e2a40d478a3149cb55d2085551f00f6b2028 | [] | no_license | frc-4931/2017-Robot | de7ac64317deb72f7ce3603288768e81d0c23504 | 48006aae2d724405620ef85519e1ea1ae549314e | refs/heads/master | 2021-06-15T04:38:13.553286 | 2017-03-10T13:30:17 | 2017-03-10T13:30:17 | 68,249,492 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,471 | java | package org.frc4931.robot.vision;
import org.frc4931.robot.components.Pixy;
import org.frc4931.robot.components.PixyBlock;
import org.strongback.command.Requirable;
import java.util.Arrays;
import java.util.List;
public class VisionSystem implements Requirable {
public static final int TARGET_SIGNATURE = 1;
public static final double FORWARD_DISTANCE_METER_PIXELS = 50.0;
private final Pixy pixy;
private final double lateralTarget;
private double forwardDistanceToLift;
private double lateralDistanceToLift;
public VisionSystem(Pixy pixy, double lateralTarget) {
this.pixy = pixy;
this.lateralTarget = lateralTarget;
forwardDistanceToLift = Double.NaN;
lateralDistanceToLift = Double.NaN;
}
public synchronized void update() {
List<PixyBlock> targets = Arrays.asList(pixy.getBlocks());
targets.removeIf((block) -> block.getSignature() != TARGET_SIGNATURE);
if (targets.size() == 2) {
forwardDistanceToLift = FORWARD_DISTANCE_METER_PIXELS / Math.abs(targets.get(0).getCenterX() - targets.get(1).getCenterX());
lateralDistanceToLift = (targets.get(0).getCenterX() + targets.get(1).getCenterX()) / 2.0 - lateralTarget;
}
}
public synchronized double getForwardDistanceToLift() {
return forwardDistanceToLift;
}
public synchronized double getLateralDistanceToLift() {
return lateralDistanceToLift;
}
}
| [
"adam@nonemu.ninja"
] | adam@nonemu.ninja |
c106daa6a5628bb7f3a83df82ab06ec39b4dd991 | 4b7d4113d0d7eac261120c0a593b4823b8865725 | /src/main/java/com/zhao/studyThread/communication/lock/TestLock.java | 9364f378cf0f90af97ea2050128544d9acf894f1 | [] | no_license | shibai906/Basic | 2fad7fa102ce390c0584819648550a9933356e57 | cf13ea10000e6d1f7e9fc379294c3643b8eba5e6 | refs/heads/master | 2020-03-09T01:10:29.483262 | 2018-11-13T05:05:12 | 2018-11-13T05:05:12 | 128,507,100 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 406 | java | package com.zhao.studyThread.communication.lock;
/*
* 注意,这里的等待唤醒机制也需要同一把锁
*/
public class TestLock {
public static void main(String[] args) throws InterruptedException {
Object lock = new Object();
ThreadWait tw = new ThreadWait(lock);
tw.start();
Thread.sleep(3000);
tw.resume();
ThreadNotify tn = new ThreadNotify(lock);
tn.start();
}
}
| [
"zh155906@163.com"
] | zh155906@163.com |
7a9828aa64f5250aff40a26eb526863b5a61446a | 4ad8f282fa015116c227e480fe913779dc3c311b | /src/test/java/com/alibaba/druid/bvt/filter/wall/mysql/MySqlWallTest152.java | 3eff105c43a102bad519c7643d2723d73c411c4e | [
"Apache-2.0"
] | permissive | lonelyit/druid | 91b6f36cdebeef4f96fec5b5c42e666c28e6019b | 08da6108e409f18d38a30c0656553ab7fcbfc0f8 | refs/heads/master | 2023-07-24T17:37:14.479317 | 2021-09-20T06:26:47 | 2021-09-20T06:26:47 | 164,882,032 | 0 | 1 | Apache-2.0 | 2021-09-20T13:40:13 | 2019-01-09T14:52:14 | Java | UTF-8 | Java | false | false | 903 | java | package com.alibaba.druid.bvt.filter.wall.mysql;
import com.alibaba.druid.wall.WallCheckResult;
import com.alibaba.druid.wall.WallProvider;
import com.alibaba.druid.wall.spi.MySqlWallProvider;
import junit.framework.TestCase;
public class MySqlWallTest152 extends TestCase {
public void test_false() throws Exception {
WallProvider provider = new MySqlWallProvider();
provider.getConfig().setSelectLimit(100);
String sql = "SELECT version FROM schema_migrations";
// assertTrue(
// provider.checkValid(sql)
// );
WallCheckResult result = provider.check(sql);
assertEquals(0, result.getViolations().size());
String wsql = result
.getStatementList().get(0).toString();
assertEquals("SELECT version\n" +
"FROM schema_migrations\n" +
"LIMIT 100", wsql);
}
}
| [
"shaojin.wensj@alibaba-inc.com"
] | shaojin.wensj@alibaba-inc.com |
7d32e2660a3164e0c877947da83e3f3f3d0b6078 | 5fe75f12b8374f1b81ad54eb1cc1a96c8e6e5974 | /app/src/main/java/com/tech/heathcilff/simplechinaweather/entity/Wind.java | bbf1b027cb63c3e2714b80c128508889fb4b5cfe | [] | no_license | zhangliangnbu/simple-china-weather | e5506b20935ead19ac680d8d0037d89d7e7ad52b | caf4dce4ae9806204a8ce3d2ef3c7cc97d1667f3 | refs/heads/master | 2021-06-16T18:00:59.987319 | 2017-04-14T07:30:38 | 2017-04-14T07:30:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 204 | java | package com.tech.heathcilff.simplechinaweather.entity;
/**
* Created by zhangliang on 2017/3/1.
*/
public class Wind {
public String deg;
public String dir;
public String sc;
public String spd;
}
| [
"zhangliangnbu@163.com"
] | zhangliangnbu@163.com |
f2d224a05083bba8837dc221ecae8befd15293cd | 2f5d88c37b2f4faeecc23c6c3e0706ab69cd52f1 | /app/src/main/java/com/example/group21/balancebasket/JoystickFragment.java | cc1d65a97a1d40d44c4867ec32a66b6cba92a1e1 | [] | no_license | doorb02/BalanceBasket | bba5cec6bf02a480336676825a1e55de6fe5eeb7 | 6a525a1c74777b51b3f5cd788cecda40afb22420 | refs/heads/master | 2020-12-11T05:55:11.480390 | 2016-04-10T15:47:40 | 2016-04-10T15:47:40 | 53,315,919 | 0 | 0 | null | 2016-03-07T10:14:16 | 2016-03-07T10:14:16 | null | UTF-8 | Java | false | false | 6,230 | java | package com.example.group21.balancebasket;
import android.content.Intent;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Locale;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link JoystickFragment.OnFragmentInteractionListener} interface
* to handle interaction events.
* Use the {@link JoystickFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class JoystickFragment extends Fragment implements JoystickView.OnJoystickChangeListener {
DecimalFormat d = (DecimalFormat) NumberFormat.getNumberInstance(Locale.ENGLISH);
JoystickView mJoystick;
TextView mText1;
private Handler mHandler = new Handler();
private Runnable mRunnable;
private double xValue, yValue;
private boolean joystickReleased;
private OnFragmentInteractionListener mListener;
public JoystickFragment() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @return A new instance of fragment JoystickFragment.
*/
public static JoystickFragment newInstance() {
JoystickFragment fragment = new JoystickFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
// process the joystick data
private void newData(double xValue, double yValue, boolean joystickReleased) {
if (xValue == 0 && yValue == 0)
joystickReleased = true;
BasketDrawer.joystickReleased = joystickReleased;
this.joystickReleased = joystickReleased;
this.xValue = xValue;
this.yValue = yValue;
mText1.setText("x: " + d.format(xValue) + " y: " + d.format(yValue));
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View v = inflater.inflate(R.layout.fragment_joystick, container, false);
mJoystick = (JoystickView) v.findViewById(R.id.joystick);
mJoystick.setOnJoystickChangeListener(this);
mText1 = (TextView) v.findViewById(R.id.textView1);
mText1.setText(R.string.defaultJoystickValue);
BasketDrawer.joystickReleased = true;
return v;
}
// TODO: Rename method, update argument and hook method into UI event
public void onButtonPressed(Uri uri) {
if (mListener != null) {
mListener.onFragmentInteraction(uri);
}
}
@Override
public void onResume() {
super.onResume();
getActivity().bindService(new Intent(getActivity(), Bluetooth.class), BasketDrawer.blueConnection, Context.BIND_AUTO_CREATE);
mJoystick.invalidate();
BasketDrawer.joystickReleased = true;
mRunnable = new Runnable() {
@Override
public void run() {
mHandler.postDelayed(this, 150); // Send data every 150ms
if (BasketDrawer.bluetoothService == null)
return;
if (BasketDrawer.bluetoothService.getState() == Bluetooth.STATE_BT_CONNECTED) {
if (joystickReleased || (xValue == 0 && yValue == 0))
BasketDrawer.bluetoothService.write(BasketDrawer.sendStop);
else {
String message = BasketDrawer.sendJoystickValues + d.format(xValue) + ',' + d.format(yValue) + ";";
BasketDrawer.bluetoothService.write(message);
}
}
}
};
mHandler.postDelayed(mRunnable, 150); // Send data every 150ms
}
@Override
public void onStart() {
super.onStart();
mJoystick.invalidate();
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
if (context instanceof OnFragmentInteractionListener) {
mListener = (OnFragmentInteractionListener) context;
} else {
throw new RuntimeException(context.toString()
+ " must implement OnFragmentInteractionListener");
}
}
@Override
public void onDetach() {
super.onDetach();
mListener = null;
}
@Override
public void setOnTouchListener(double xValue, double yValue) {
newData(xValue, yValue, false);
}
@Override
public void setOnMovedListener(double xValue, double yValue) {
newData(xValue, yValue, false);
}
@Override
public void setOnReleaseListener(double xValue, double yValue) {
newData(xValue, yValue, true);
}
/**
* This interface must be implemented by activities that contain this
* fragment to allow an interaction in this fragment to be communicated
* to the activity and potentially other fragments contained in that
* activity.
* <p/>
* See the Android Training lesson <a href=
* "http://developer.android.com/training/basics/fragments/communicating.html"
* >Communicating with Other Fragments</a> for more information.
*/
public interface OnFragmentInteractionListener {
// TODO: Update argument type and name
void onFragmentInteraction(Uri uri);
}
@Override
public void onPause() {
super.onPause();
mJoystick.invalidate();
BasketDrawer.joystickReleased = true;
mHandler.removeCallbacks(mRunnable);
getActivity().unbindService(BasketDrawer.blueConnection);
}
@Override
public void onStop() {
super.onStop();
mJoystick.invalidate();
BasketDrawer.joystickReleased = true;
}
}
| [
"doornbuschrm@gmail.com"
] | doornbuschrm@gmail.com |
83eae2d3192c9e4a2780087586f1bb7fa82322f0 | e5424c075594fb31ded77ac70393ae60ef1512b8 | /app/src/main/java/com/example/tatmon/fragments/PatientReportFragment.java | eb0cf52400baf818f8a3bb16fd8931eb9c44780f | [] | no_license | mohammedSamiMahmoud/tatammon | faaa523995bf7929676be1a887eb4c54f94b0d59 | 8e45a4080c972ae40f330b1a43457a7f8d61b8ac | refs/heads/master | 2023-04-15T19:34:47.594231 | 2021-04-24T15:56:51 | 2021-04-24T15:56:51 | 359,495,257 | 0 | 0 | null | 2021-04-20T20:41:53 | 2021-04-19T14:47:54 | Java | UTF-8 | Java | false | false | 4,892 | java | package com.example.tatmon.fragments;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.util.Base64;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.Toast;
import com.example.tatmon.API.APIResponse;
import com.example.tatmon.API.RetrofitClient;
import com.example.tatmon.API.SharedPrefManager;
import com.example.tatmon.R;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class PatientReportFragment extends Fragment {
ByteArrayOutputStream byteArrayOutputStream;
byte[] byteArray;
String ConvertImage;
private int GALLERY = 1, CAMERA = 2;
Bitmap FixBitmap;
View view;
ImageView reportPhoto, reportUpload, reportSave;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
view = inflater.inflate(R.layout.patient_report_fragment, container, false);
reportPhoto = view.findViewById(R.id.reportPhoto);
reportUpload = view.findViewById(R.id.reportUpload);
reportUpload.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
choosePhotoFromGallary();
}
});
reportSave = view.findViewById(R.id.reportSave);
reportSave.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
UploadImageToServer();
RetrofitClient.getInstance().getApi()
.addReport(SharedPrefManager
.getInstance(view.getContext()).getUser().getId(), ConvertImage)
.enqueue(new Callback<APIResponse.DefaultResponse>() {
@Override
public void onResponse(Call<APIResponse.DefaultResponse> call, Response<APIResponse.DefaultResponse> response) {
if (response.code() == 201) {
Toast.makeText(view.getContext(), "تم اضافة التقرير"
, Toast.LENGTH_SHORT).show();
} else {
Log.e("error", response.code() + "");
}
}
@Override
public void onFailure(Call<APIResponse.DefaultResponse> call, Throwable t) {
Log.e("failure", t.getMessage());
}
});
}
});
return view;
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == 0) {
return;
}
if (requestCode == GALLERY) {
if (data != null) {
Uri contentURI = data.getData();
System.out.println("Path: " + contentURI.getEncodedPath());
try {
FixBitmap = MediaStore.Images.Media.getBitmap(getContext().getContentResolver(), contentURI);
FixBitmap = Bitmap.createScaledBitmap(FixBitmap, (int) (FixBitmap.getWidth() * 0.5),
(int) (FixBitmap.getHeight() * 0.5), true);
Toast.makeText(getContext(), "تم تحميل الصورة بنجاح!", Toast.LENGTH_SHORT).show();
reportPhoto.setImageBitmap(FixBitmap);
} catch (IOException e) {
e.printStackTrace();
Toast.makeText(getContext(), "عذرا لقد حدث خطأ ،حاول لاحقا!", Toast.LENGTH_SHORT).show();
}
}
}
}
public void UploadImageToServer() {
byteArrayOutputStream = new ByteArrayOutputStream();
FixBitmap.compress(Bitmap.CompressFormat.JPEG, 20, byteArrayOutputStream);
byteArray = byteArrayOutputStream.toByteArray();
ConvertImage = Base64.encodeToString(byteArray, Base64.DEFAULT);
}
public void choosePhotoFromGallary() {
Intent galleryIntent = new Intent(Intent.ACTION_GET_CONTENT,
MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(galleryIntent, GALLERY);
}
}
| [
"moha1995mmed@gmail.com"
] | moha1995mmed@gmail.com |
24a34f151fd3dddbf39ee883d7b7fcc806edb715 | a22f6988916753038b6a3e0c3616442fd38409f5 | /src/Account.java | a275739bace41a1f70551bb3c918c81641efaddc | [] | no_license | ssiedu/InheritanceExample-Batch-1130 | c9729e054953af9e25edafd6673a86c04091d623 | e0e60b656cea43f5cf2818d928186db4d028565d | refs/heads/master | 2023-03-28T06:51:33.342319 | 2021-03-31T07:34:21 | 2021-03-31T07:34:21 | 353,267,453 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 431 | java | public class Account {
private int ano;
private String name;
private int bal;
public Account(int ano, String name, int bal){
this.ano=ano;
this.name=name;
this.bal=bal;
}
public void info(){
System.out.println("Account No. : "+ano);
System.out.println("Cust Name : "+name);
System.out.println("Balance : "+bal);
}
}
| [
"manoj.sarwate@ssiedu.in"
] | manoj.sarwate@ssiedu.in |
b48eadfad5b1094c60a723656fdaa7122352b3a7 | 41abcaa36b3f6cf49641d0ad9ba44f158647875e | /src/main/java/com/alibaba/druid/util/FnvHash.java | 48a448f6cce977ec099a897ad9a0ab673453ee74 | [
"Apache-2.0"
] | permissive | qzgit/druid | 26b9a82e4de3be8424800d6e9773152f4e1bce57 | ff9364cf1211cf012a3e331a0d864aba822f0535 | refs/heads/master | 2021-06-28T17:48:55.126636 | 2017-09-14T03:07:47 | 2017-09-14T03:07:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,959 | java | /*
* Copyright 1999-2017 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.druid.util;
import java.util.Arrays;
public final class FnvHash {
public final static long BASIC = 0xcbf29ce484222325L;
public final static long PRIME = 0x100000001b3L;
public static long fnv1a_64(String input) {
if (input == null) {
return 0;
}
long hash = BASIC;
for (int i = 0; i < input.length(); ++i) {
char c = input.charAt(i);
hash ^= c;
hash *= PRIME;
}
return hash;
}
public static long fnv1a_64(char[] chars) {
if (chars == null) {
return 0;
}
long hash = BASIC;
for (int i = 0; i < chars.length; ++i) {
char c = chars[i];
hash ^= c;
hash *= PRIME;
}
return hash;
}
/**
* lower and normalized and fnv_1a_64
* @param name
* @return
*/
public static long hashCode64(String name) {
if (name == null) {
return 0;
}
boolean quote = false;
int len = name.length();
if (len > 2) {
char c0 = name.charAt(0);
char c1 = name.charAt(len - 1);
if ((c0 == '`' && c1 == '`')
|| (c0 == '"' && c1 == '"')
|| (c0 == '\'' && c1 == '\'')
|| (c0 == '[' && c1 == ']')) {
quote = true;
}
}
if (quote) {
return FnvHash.hashCode64(name, 1, len - 1);
} else {
return FnvHash.hashCode64(name, 0, len);
}
}
public static long fnv1a_64_lower(String key) {
long hashCode = BASIC;
for (int i = 0; i < key.length(); ++i) {
char ch = key.charAt(i);
if (ch >= 'A' && ch <= 'Z') {
ch = (char) (ch + 32);
}
hashCode ^= ch;
hashCode *= PRIME;
}
return hashCode;
}
public static long hashCode64(String key, int offset, int end) {
long hashCode = BASIC;
for (int i = offset; i < end; ++i) {
char ch = key.charAt(i);
if (ch >= 'A' && ch <= 'Z') {
ch = (char) (ch + 32);
}
hashCode ^= ch;
hashCode *= PRIME;
}
return hashCode;
}
public static long hashCode64(long basic, String name) {
if (name == null) {
return basic;
}
boolean quote = false;
int len = name.length();
if (len > 2) {
char c0 = name.charAt(0);
char c1 = name.charAt(len - 1);
if ((c0 == '`' && c1 == '`')
|| (c0 == '"' && c1 == '"')
|| (c0 == '\'' && c1 == '\'')
|| (c0 == '[' && c1 == ']')) {
quote = true;
}
}
if (quote) {
return FnvHash.hashCode64(basic, name, 1, len - 1);
} else {
return FnvHash.hashCode64(basic, name, 0, len);
}
}
public static long hashCode64(long basic, String key, int offset, int end) {
long hashCode = basic;
for (int i = offset; i < end; ++i) {
char ch = key.charAt(i);
if (ch >= 'A' && ch <= 'Z') {
ch = (char) (ch + 32);
}
hashCode ^= ch;
hashCode *= PRIME;
}
return hashCode;
}
public static long fnv_32_lower(String key) {
long hashCode = 0x811c9dc5;
for (int i = 0; i < key.length(); ++i) {
char ch = key.charAt(i);
if (ch == '_' || ch == '-') {
continue;
}
if (ch >= 'A' && ch <= 'Z') {
ch = (char) (ch + 32);
}
hashCode ^= ch;
hashCode *= 0x01000193;
}
return hashCode;
}
public static long[] fnv1a_64_lower(String[] strings, boolean sort) {
long[] hashCodes = new long[strings.length];
for (int i = 0; i < strings.length; i++) {
hashCodes[i] = fnv1a_64_lower(strings[i]);
}
if (sort) {
Arrays.sort(hashCodes);
}
return hashCodes;
}
/**
* normalized and lower and fnv1a_64_hash
* @param owner
* @param name
* @return
*/
public static long hashCode64(String owner, String name) {
long hashCode = BASIC;
if (owner != null) {
String item = owner;
boolean quote = false;
int len = item.length();
if (len > 2) {
char c0 = item.charAt(0);
char c1 = item.charAt(len - 1);
if ((c0 == '`' && c1 == '`')
|| (c0 == '"' && c1 == '"')
|| (c0 == '\'' && c1 == '\'')
|| (c0 == '[' && c1 == ']')) {
quote = true;
}
}
int start = quote ? 1 : 0;
int end = quote ? len - 1 : len;
for (int j = start; j < end; ++j) {
char ch = item.charAt(j);
if (ch >= 'A' && ch <= 'Z') {
ch = (char) (ch + 32);
}
hashCode ^= ch;
hashCode *= PRIME;
}
hashCode ^= '.';
hashCode *= PRIME;
}
if (name != null) {
String item = name;
boolean quote = false;
int len = item.length();
if (len > 2) {
char c0 = item.charAt(0);
char c1 = item.charAt(len - 1);
if ((c0 == '`' && c1 == '`')
|| (c0 == '"' && c1 == '"')
|| (c0 == '\'' && c1 == '\'')
|| (c0 == '[' && c1 == ']')) {
quote = true;
}
}
int start = quote ? 1 : 0;
int end = quote ? len - 1 : len;
for (int j = start; j < end; ++j) {
char ch = item.charAt(j);
if (ch >= 'A' && ch <= 'Z') {
ch = (char) (ch + 32);
}
hashCode ^= ch;
hashCode *= PRIME;
}
}
return hashCode;
}
public static interface Constants {
long HIGH_PRIORITY = fnv1a_64_lower("HIGH_PRIORITY");
long DISTINCTROW = fnv1a_64_lower("DISTINCTROW");
long STRAIGHT_JOIN = fnv1a_64_lower("STRAIGHT_JOIN");
long SQL_SMALL_RESULT = fnv1a_64_lower("SQL_SMALL_RESULT");
long SQL_BIG_RESULT = fnv1a_64_lower("SQL_BIG_RESULT");
long SQL_BUFFER_RESULT = fnv1a_64_lower("SQL_BUFFER_RESULT");
long SQL_CACHE = fnv1a_64_lower("SQL_CACHE");
long SQL_NO_CACHE = fnv1a_64_lower("SQL_NO_CACHE");
long SQL_CALC_FOUND_ROWS = fnv1a_64_lower("SQL_CALC_FOUND_ROWS");
long OUTFILE = fnv1a_64_lower("OUTFILE");
long SETS = fnv1a_64_lower("SETS");
long REGEXP = fnv1a_64_lower("REGEXP");
long RLIKE = fnv1a_64_lower("RLIKE");
long USING = fnv1a_64_lower("USING");
long IGNORE = fnv1a_64_lower("IGNORE");
long FORCE = fnv1a_64_lower("FORCE");
long CROSS = fnv1a_64_lower("CROSS");
long NATURAL = fnv1a_64_lower("NATURAL");
long APPLY = fnv1a_64_lower("APPLY");
long CONNECT = fnv1a_64_lower("CONNECT");
long START = fnv1a_64_lower("START");
long BTREE = fnv1a_64_lower("BTREE");
long HASH = fnv1a_64_lower("HASH");
long NO_WAIT = fnv1a_64_lower("NO_WAIT");
long WAIT = fnv1a_64_lower("WAIT");
long NOWAIT = fnv1a_64_lower("NOWAIT");
long ERRORS = fnv1a_64_lower("ERRORS");
long VALUE = fnv1a_64_lower("VALUE");
long NEXT = fnv1a_64_lower("NEXT");
long NEXTVAL = fnv1a_64_lower("NEXTVAL");
long CURRVAL = fnv1a_64_lower("CURRVAL");
long PREVVAL = fnv1a_64_lower("PREVVAL");
long PREVIOUS = fnv1a_64_lower("PREVIOUS");
long LOW_PRIORITY = fnv1a_64_lower("LOW_PRIORITY");
long COMMIT_ON_SUCCESS = fnv1a_64_lower("COMMIT_ON_SUCCESS");
long ROLLBACK_ON_FAIL = fnv1a_64_lower("ROLLBACK_ON_FAIL");
long QUEUE_ON_PK = fnv1a_64_lower("QUEUE_ON_PK");
long TARGET_AFFECT_ROW = fnv1a_64_lower("TARGET_AFFECT_ROW");
long COLLATE = fnv1a_64_lower("COLLATE");
long BOOLEAN = fnv1a_64_lower("BOOLEAN");
long SMALLINT = fnv1a_64_lower("SMALLINT");
long CHARSET = fnv1a_64_lower("CHARSET");
long SEMI = fnv1a_64_lower("SEMI");
long ANTI = fnv1a_64_lower("ANTI");
long PRIOR = fnv1a_64_lower("PRIOR");
long NOCYCLE = fnv1a_64_lower("NOCYCLE");
long CONNECT_BY_ROOT = fnv1a_64_lower("CONNECT_BY_ROOT");
long DATE = fnv1a_64_lower("DATE");
long DATETIME = fnv1a_64_lower("DATETIME");
long TIMESTAMP = fnv1a_64_lower("TIMESTAMP");
long CLOB = fnv1a_64_lower("CLOB");
long NCLOB = fnv1a_64_lower("NCLOB");
long BLOB = fnv1a_64_lower("BLOB");
long XMLTYPE = fnv1a_64_lower("XMLTYPE");
long BFILE = fnv1a_64_lower("BFILE");
long UROWID = fnv1a_64_lower("UROWID");
long ROWID = fnv1a_64_lower("ROWID");
long INTEGER = fnv1a_64_lower("INTEGER");
long INT = fnv1a_64_lower("INT");
long BINARY_FLOAT = fnv1a_64_lower("BINARY_FLOAT");
long BINARY_DOUBLE = fnv1a_64_lower("BINARY_DOUBLE");
long FLOAT = fnv1a_64_lower("FLOAT");
long REAL = fnv1a_64_lower("REAL");
long NUMBER = fnv1a_64_lower("NUMBER");
long DEC = fnv1a_64_lower("DEC");
long DECIMAL = fnv1a_64_lower("DECIMAL");
long CURRENT = fnv1a_64_lower("CURRENT");
long COUNT = fnv1a_64_lower("COUNT");
long ROW_NUMBER = fnv1a_64_lower("ROW_NUMBER");
long WM_CONAT = fnv1a_64_lower("WM_CONAT");
long AVG = fnv1a_64_lower("AVG");
long MAX = fnv1a_64_lower("MAX");
long MIN = fnv1a_64_lower("MIN");
long STDDEV = fnv1a_64_lower("STDDEV");
long SUM = fnv1a_64_lower("SUM");
long GROUP_CONCAT = fnv1a_64_lower("GROUP_CONCAT");
long DEDUPLICATION = fnv1a_64_lower("DEDUPLICATION");
long CONVERT = fnv1a_64_lower("CONVERT");
long CHAR = fnv1a_64_lower("CHAR");
long VARCHAR = fnv1a_64_lower("VARCHAR");
long VARCHAR2 = fnv1a_64_lower("VARCHAR2");
long NCHAR = fnv1a_64_lower("NCHAR");
long NVARCHAR = fnv1a_64_lower("NVARCHAR");
long NVARCHAR2 = fnv1a_64_lower("NVARCHAR2");
long NCHAR_VARYING = fnv1a_64_lower("nchar varying");
long TINYTEXT = fnv1a_64_lower("TINYTEXT");
long TEXT = fnv1a_64_lower("TEXT");
long MEDIUMTEXT = fnv1a_64_lower("MEDIUMTEXT");
long LONGTEXT = fnv1a_64_lower("LONGTEXT");
long TRIM = fnv1a_64_lower("TRIM");
long LEADING = fnv1a_64_lower("LEADING");
long BOTH = fnv1a_64_lower("BOTH");
long TRAILING = fnv1a_64_lower("TRAILING");
long MOD = fnv1a_64_lower("MOD");
long MATCH = fnv1a_64_lower("MATCH");
long EXTRACT = fnv1a_64_lower("EXTRACT");
long POSITION = fnv1a_64_lower("POSITION");
long DUAL = fnv1a_64_lower("DUAL");
long LEVEL = fnv1a_64_lower("LEVEL");
long CONNECT_BY_ISCYCLE = fnv1a_64_lower("CONNECT_BY_ISCYCLE");
long CURRENT_TIMESTAMP = fnv1a_64_lower("CURRENT_TIMESTAMP");
long FALSE = fnv1a_64_lower("FALSE");
long TRUE = fnv1a_64_lower("TRUE");
long SET = fnv1a_64_lower("SET");
long LESS = fnv1a_64_lower("LESS");
long MAXVALUE = fnv1a_64_lower("MAXVALUE");
long OFFSET = fnv1a_64_lower("OFFSET");
long RAW = fnv1a_64_lower("RAW");
long LONG_RAW = fnv1a_64_lower("LONG RAW");
long LONG = fnv1a_64_lower("LONG");
long ROWNUM = fnv1a_64_lower("ROWNUM");
long PRECISION = fnv1a_64_lower("PRECISION");
long DOUBLE = fnv1a_64_lower("DOUBLE");
long DOUBLE_PRECISION = fnv1a_64_lower("DOUBLE PRECISION");
long WITHOUT = fnv1a_64_lower("WITHOUT");
long DEFINER = fnv1a_64_lower("DEFINER");
long DETERMINISTIC = fnv1a_64_lower("DETERMINISTIC");
long CONTAINS = fnv1a_64_lower("CONTAINS");
long SQL = fnv1a_64_lower("SQL");
long CALL = fnv1a_64_lower("CALL");
long CHARACTER = fnv1a_64_lower("CHARACTER");
long VALIDATE = fnv1a_64_lower("VALIDATE");
long NOVALIDATE = fnv1a_64_lower("NOVALIDATE");
long SIMILAR = fnv1a_64_lower("SIMILAR");
long CASCADE = fnv1a_64_lower("CASCADE");
long RELY = fnv1a_64_lower("RELY");
long NORELY = fnv1a_64_lower("NORELY");
long ROW = fnv1a_64_lower("ROW");
long ROWS = fnv1a_64_lower("ROWS");
long RANGE = fnv1a_64_lower("RANGE");
long PRECEDING = fnv1a_64_lower("PRECEDING");
long FOLLOWING = fnv1a_64_lower("FOLLOWING");
long UNBOUNDED = fnv1a_64_lower("UNBOUNDED");
long SIBLINGS = fnv1a_64_lower("SIBLINGS");
long NULLS = fnv1a_64_lower("NULLS");
long FIRST = fnv1a_64_lower("FIRST");
long LAST = fnv1a_64_lower("LAST");
long AUTO_INCREMENT = fnv1a_64_lower("AUTO_INCREMENT");
long STORAGE = fnv1a_64_lower("STORAGE");
long STORED = fnv1a_64_lower("STORED");
long VIRTUAL = fnv1a_64_lower("VIRTUAL");
long UNSIGNED = fnv1a_64_lower("UNSIGNED");
long ZEROFILL = fnv1a_64_lower("ZEROFILL");
long GLOBAL = fnv1a_64_lower("GLOBAL");
long SESSION = fnv1a_64_lower("SESSION");
long NAMES = fnv1a_64_lower("NAMES");
long PARTIAL = fnv1a_64_lower("PARTIAL");
long SIMPLE = fnv1a_64_lower("SIMPLE");
long RESTRICT = fnv1a_64_lower("RESTRICT");
long ON = fnv1a_64_lower("ON");
long ACTION = fnv1a_64_lower("ACTION");
long SEPARATOR = fnv1a_64_lower("SEPARATOR");
long DATA = fnv1a_64_lower("DATA");
long MAX_ROWS = fnv1a_64_lower("MAX_ROWS");
long MIN_ROWS = fnv1a_64_lower("MIN_ROWS");
long ENGINE = fnv1a_64_lower("ENGINE");
long SKIP = fnv1a_64_lower("SKIP");
long RECURSIVE = fnv1a_64_lower("RECURSIVE");
long ROLLUP = fnv1a_64_lower("ROLLUP");
long CUBE = fnv1a_64_lower("CUBE");
long YEAR = fnv1a_64_lower("YEAR");
long MONTH = fnv1a_64_lower("MONTH");
long DAY = fnv1a_64_lower("DAY");
long HOUR = fnv1a_64_lower("HOUR");
long MINUTE = fnv1a_64_lower("MINUTE");
long SECOND = fnv1a_64_lower("SECOND");
long BEFORE = fnv1a_64_lower("BEFORE");
long AFTER = fnv1a_64_lower("AFTER");
long INSTEAD = fnv1a_64_lower("INSTEAD");
long DEFERRABLE = fnv1a_64_lower("DEFERRABLE");
long AS = fnv1a_64_lower("AS");
long DELAYED = fnv1a_64_lower("DELAYED");
long GO = fnv1a_64_lower("GO");
long WAITFOR = fnv1a_64_lower("WAITFOR");
long EXEC = fnv1a_64_lower("EXEC");
long EXECUTE = fnv1a_64_lower("EXECUTE");
long SOURCE = fnv1a_64_lower("SOURCE");
long STAR = fnv1a_64_lower("*");
}
}
| [
"szujobs@hotmail.com"
] | szujobs@hotmail.com |
bc99384c1505534bc7f2a3c022c480112b049eca | b9f273ea469a77693d2bdac2b82a9e0c9c9f87a2 | /TeleOpFinal.java | dd9186ed1e266124c35696c1f5d0e0dad77d4c60 | [
"BSD-3-Clause"
] | permissive | teaborgs/ftc_app | bf0d94d8a3ab0fe1bcc8321c7859ebabd43a9579 | fc9a0e266913d9ff369e2f82a2abb55e38ba79e5 | refs/heads/master | 2020-04-01T04:34:07.657577 | 2019-02-21T11:03:48 | 2019-02-21T11:03:48 | 152,868,914 | 3 | 0 | null | 2018-10-13T12:17:57 | 2018-10-13T12:17:57 | null | UTF-8 | Java | false | false | 8,586 | java | /* Copyright (c) 2017 FIRST. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted (subject to the limitations in the disclaimer below) provided that
* the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* Neither the name of FIRST nor the names of its contributors may be used to endorse or
* promote products derived from this software without specific prior written permission.
*
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS
* LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.CRServo;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.Servo;
import com.qualcomm.robotcore.util.ElapsedTime;
import com.qualcomm.robotcore.util.Range;
@TeleOp(name="TeleOpFinal", group="Linear Opmode")
//@Disabled
public class TeleOpFinal extends LinearOpMode {
// Declare OpMode members.
private ElapsedTime rtLock = new ElapsedTime();
//omni
public DcMotor frontLeft;
public DcMotor frontRight;
public DcMotor backLeft;
public DcMotor backRight;
//latching motor
public DcMotor latching;
//brat
public DcMotor arm;
//slider
public DcMotor slider;
//cuva
public DcMotor cup;
//marker servo
public Servo markerServo;
@Override
public void runOpMode() {
telemetry.addData("Status", "Initialized");
telemetry.update();
frontLeft = hardwareMap.get(DcMotor.class, "fl_motor");
frontRight = hardwareMap.get(DcMotor.class, "fr_motor");
backLeft = hardwareMap.get(DcMotor.class, "bl_motor");
backRight = hardwareMap.get(DcMotor.class, "br_motor");
latching = hardwareMap.get(DcMotor.class, "latching");
markerServo = hardwareMap.get(Servo.class, "marker_servo");
arm = hardwareMap.get(DcMotor.class, "brat");
slider = hardwareMap.get(DcMotor.class, "slider");
cup = hardwareMap.get(DcMotor.class, "cup");
frontLeft.setDirection(DcMotor.Direction.REVERSE);
frontRight.setDirection(DcMotor.Direction.REVERSE);
backLeft.setDirection(DcMotor.Direction.REVERSE);
backRight.setDirection(DcMotor.Direction.REVERSE);
latching.setDirection(DcMotor.Direction.FORWARD);
arm.setDirection(DcMotor.Direction.FORWARD);
slider.setDirection(DcMotor.Direction.FORWARD);
cup.setDirection(DcMotor.Direction.FORWARD);
frontLeft.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
frontRight.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
backLeft.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
backRight.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
latching.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
arm.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
slider.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
frontRight.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
backRight.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
frontLeft.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
backLeft.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
latching.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
arm.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
slider.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
cup.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
double servoInitPosition = 0.4;
markerServo.setPosition(servoInitPosition);
// Wait for the game to start (driver presses PLAY)
waitForStart();
rtLock.reset();
double omniSupress = 0.3;
double armSupress = 0.3;
// run until the end of the match (driver presses STOP)
while (opModeIsActive()) {
//omni
double gamepadLeftY = -gamepad2.right_stick_y;
double gamepadLeftX = -gamepad2.right_stick_x;
double gamepadRightX = -gamepad2.left_stick_x;
double powerFrontLeft = -gamepadLeftY - gamepadLeftX - gamepadRightX;
double powerFrontRight = gamepadLeftY - gamepadLeftX - gamepadRightX;
double powerBackLeft = -gamepadLeftY + gamepadLeftX - gamepadRightX;
double powerBackRight = gamepadLeftY + gamepadLeftX - gamepadRightX;
double powerLatchingUp = -gamepad2.right_trigger;
double powerLatchingDown = gamepad2.left_trigger;
double powerArmUp = -gamepad1.right_trigger;
double powerArmDown = gamepad1.left_trigger;
double powerSlider = gamepad1.left_stick_y;
double powerCup = gamepad1.right_stick_y;
powerFrontLeft = Range.clip(powerFrontLeft, -1, 1);
powerFrontRight = Range.clip(powerFrontRight, -1, 1);
powerBackLeft = Range.clip(powerBackLeft, -1, 1);
powerBackRight = Range.clip(powerBackRight, -1, 1);
powerLatchingUp = Range.clip(powerLatchingUp, -1, 1);
powerLatchingDown = Range.clip(powerLatchingDown, -1, 1);
powerArmUp = Range.clip(powerLatchingUp, -1, 1);
powerArmDown = Range.clip(powerLatchingDown, -1, 1);
powerSlider = Range.clip(powerLatchingDown, -1, 1);
powerCup = Range.clip(powerLatchingDown, -1, 1);
if (gamepad2.right_bumper == true) {
powerFrontLeft = powerFrontLeft * omniSupress;
powerBackLeft = powerBackLeft * omniSupress;
powerFrontRight = powerFrontRight * omniSupress;
powerBackRight = powerBackRight * omniSupress;
}
if (gamepad1.right_bumper == true)
{
powerArmUp = powerArmUp * armSupress;
powerArmDown = powerArmDown * armSupress;
}
if (gamepad1.left_bumper == true)
{
powerSlider = powerSlider * armSupress;
}
frontLeft.setPower(powerFrontLeft);
frontRight.setPower(powerFrontRight);
backLeft.setPower(powerBackLeft);
backRight.setPower(powerBackRight);
//omni
//LATCHING - ridicare & coborare
if(powerLatchingUp !=0 ) latching.setPower(powerLatchingUp);
else if(powerLatchingDown!=0)latching.setPower(powerLatchingDown);
else latching.setPower(0);
//ARM
if(powerArmUp !=0 ) arm.setPower(powerArmUp);
else if(powerArmDown!=0)arm.setPower(powerArmDown);
else arm.setPower(0);
//slider
slider.setPower(powerSlider);
//cup
cup.setPower(powerCup);
// Show the elapsed game time and wheel power.
// telemetry.addData("Status", "Run Time: " + runtime.toString());
telemetry.addData("Motors", "left (%.2f), right (%.2f)", powerFrontLeft, powerFrontRight);
telemetry.update();
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
54467fc20d4f06aa0143656838dc829a74d4fcc5 | e24dfb6d1ef7ba01da661318a6d0087e2bd3b8a1 | /JavaSE_WorkSpace/day14_Date_DateFormat_Calender/src/cn/itcast_01/DateDemo.java | 3008a0601b75d6a2c099841ba8be987f4e9d5122 | [] | no_license | TJtulong/Javase-0to1 | 13b37c946dcfe23b90abd315f37848e184cb0549 | be25ca75b9e5f59ed0f29f36e29b8aac2dffa5ba | refs/heads/master | 2020-03-28T05:19:56.926136 | 2018-09-07T04:30:48 | 2018-09-07T04:30:48 | 147,769,823 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 511 | java | package cn.itcast_01;
import java.util.Date;
/*
* Date()
* 表示特定的瞬间,精确到毫秒
* 构造方法:
* Date():根据当前的默认毫秒值创建日期对象
* Date(long date):根据给定的毫秒值创建日期对象
* 注意要考虑时差问题
*/
public class DateDemo {
public static void main(String[] args) {
Date d=new Date();
System.out.println("d="+d);
long time=System.currentTimeMillis();
Date d2 = new Date(time);
System.out.println("d2="+d);
}
}
| [
"TJtulong@163.com"
] | TJtulong@163.com |
64b9b53b527c74b341c83fa9b8a19e2c5259fa7b | ba35d24b415155e81e2e360370d1bc49004eac64 | /src/test/java/com/java4all/responsibility/ResponsibilityTest.java | cf4fe0b22424bfb11e7dda91d588abde71776726 | [
"Apache-2.0"
] | permissive | lightClouds917/designMode | f2e574ccf106444b76e80b26b074324be9dd38d1 | 30b596f8f94792aecc2db8710cec4a6f78589eb3 | refs/heads/master | 2021-06-21T02:16:46.926381 | 2020-06-10T12:38:07 | 2020-06-10T12:38:07 | 190,321,621 | 1 | 1 | Apache-2.0 | 2021-03-31T21:35:04 | 2019-06-05T03:44:56 | Java | UTF-8 | Java | false | false | 892 | java | package com.java4all.responsibility;
import org.junit.Test;
/**
* 测试责任链模式
* @author IT云清
* @date 2019年07月06日 17:09:19
*/
public class ResponsibilityTest {
@Test
public void testResponsibility(){
AbstractLogger loggerChain = this.getChainOfLoggers();
loggerChain.logMessage(AbstractLogger.ERROR,"这里出error级别的问题了");
loggerChain.logMessage(AbstractLogger.INFO,"这里出info级别的问题了");
}
private AbstractLogger getChainOfLoggers(){
InfoLogger infoLogger = new InfoLogger(AbstractLogger.INFO);
DebugLogger debugLogger = new DebugLogger(AbstractLogger.DEBUG);
ErrorLogger errorLogger = new ErrorLogger(AbstractLogger.ERROR);
errorLogger.setNextAbstractLogger(debugLogger);
debugLogger.setNextAbstractLogger(infoLogger);
return errorLogger;
}
}
| [
"1186355422@qq.com"
] | 1186355422@qq.com |
fe071372c831d8f4da06702879a0f56a6bd1f070 | 510aa6dcffcea7d2b3906582ca588f83680eb21e | /src/annotation/Column.java | 64459f123fb7deb953c29f2ca903aad3d63e4f32 | [] | no_license | shihabcsedu09/pluralsight-java-reflection | 34bc3ac1a2e8597476cc19ebb1f8988576ef3787 | 10e3d6b9a448cae3751732a0f97d5b8bdc90c376 | refs/heads/master | 2022-07-28T07:13:07.737527 | 2020-05-22T09:58:39 | 2020-05-22T09:58:39 | 264,958,814 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 191 | java | package annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
public @interface Column {
String name();
}
| [
"shihab.csedu09@gmail.com"
] | shihab.csedu09@gmail.com |
1aa6f484d80aedb7628e43960dcdb5ae17f72d90 | ff56d413fafc491d40edd7e5082f41d1b8e4e7c0 | /src/com/winitech/incominglistener/IncomingStreamAddr.java | a524b217801fb0c1538eb223556ee66803ce10fd | [] | no_license | BaeHongil/IncomingListener | b333728a1ff8c9222f404ece9518e30e8c671fac | a5d21dbbf26d46888fe483d22fe2e59dc03b39a3 | refs/heads/master | 2021-01-20T10:30:50.091063 | 2016-08-19T07:21:20 | 2016-08-19T07:21:20 | 63,414,980 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,257 | java | package com.winitech.incominglistener;
public class IncomingStreamAddr {
private boolean isPublish;
private String vhostName;
private String appName;
private String appInstanceName;
private String streamName;
public IncomingStreamAddr(boolean isPublish, String vhostName, String appName, String appInstanceName, String streamName) {
this.isPublish = isPublish;
this.vhostName = vhostName;
this.appName = appName;
this.appInstanceName = appInstanceName;
this.streamName = streamName;
}
public boolean isPublish() {
return isPublish;
}
public void setPublish(boolean isPublish) {
this.isPublish = isPublish;
}
public String getVhostName() {
return vhostName;
}
public void setVhostName(String vhostName) {
this.vhostName = vhostName;
}
public String getAppName() {
return appName;
}
public void setAppName(String appName) {
this.appName = appName;
}
public String getAppInstanceName() {
return appInstanceName;
}
public void setAppInstanceName(String appInstanceName) {
this.appInstanceName = appInstanceName;
}
public String getStreamName() {
return streamName;
}
public void setStreamName(String streamName) {
this.streamName = streamName;
}
}
| [
"il0616@knu.ac.kr"
] | il0616@knu.ac.kr |
f7581667b34ad91c735ae9c8e85022c5f752aec7 | 9a89db32f13bde843caec8c63221481f8be1641d | /java/src/main/java/org/xiaomao/java/io/InputStreamTest.java | 3489071d24c7b8de261fb9c5ca21f7ea394334bd | [] | no_license | 465753920/java | 628082b3f834d1ce2b83908877ec06a11278d17a | 9bdb6a602846d83445065f839f986a2c8c2df22a | refs/heads/master | 2021-01-19T13:07:59.312852 | 2018-04-25T10:03:10 | 2018-04-25T10:03:10 | 88,066,864 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 901 | java | package org.xiaomao.java.io;
import org.junit.Test;
import java.io.IOException;
import java.io.InputStream;
public class InputStreamTest {
/**
* InputStream.mark(int readlimit) 方法的readlimit参数
*/
@Test
public void test1() {
try {
InputStream in = System.in;
char hook = '2';
int i;
while ((i = in.read()) != -1) {
System.out.println(i);
if (i == hook) {
in.mark(1);
}
}
System.out.println("End of first output.");
in.reset();
while ((i = in.read()) != -1) {
System.out.println(i);
}
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 测试read()方法
*/
@Test
public void test2() {
InputStream in = System.in;
byte[] bytes = new byte[10];
try {
in.read(bytes, 0, bytes.length);
for(byte b : bytes){
System.out.println(b);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"465753920@qq.com"
] | 465753920@qq.com |
c78d1e149daffb37f18596dfb8e0421b7dedfc78 | 0c91ed85e31a595acae8c24a6516aa96e522a5e1 | /api/src/main/java/com/icompete/utils/EventStateUtils.java | 5ef1b7ccfdef6ef49e1645ce38632817d7b58e9d | [] | no_license | xhuliokondakciu/iCompete | 505e3d345e1632ac6f283a90e49ae9e7c08bf5ae | 6e69ccf3669c7cc1517511919ff0221359ea2006 | refs/heads/master | 2021-06-11T14:37:52.462343 | 2017-01-16T14:03:53 | 2017-01-16T14:03:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 542 | java | package com.icompete.utils;
import com.icompete.enums.EventState;
import java.util.Date;
/**
* @author Sekan
*/
public class EventStateUtils {
public static EventState getState(Date startDate, Date endDate) {
Date currentDate = new Date();
if (currentDate.compareTo(startDate) == -1) {
return EventState.NOT_STARTED;
}
else if (currentDate.compareTo(endDate) == 1) {
return EventState.FINISHED;
}
else {
return EventState.ONGOING;
}
}
}
| [
"433390@mail.muni.cz"
] | 433390@mail.muni.cz |
e8acfcd3f76cb8a1463f9fb5e7b0294990f523be | 0272f79c6b0a0f18ecdfd294d0f2291f594a5bdf | /carro/Carro.java | 156ab71d2995dc33e59338244fe7131c98bda172 | [] | no_license | emanuelbmota/aulaspoo | 4b36b6853d1daaaaf6291c4a1bf258a1bc586648 | f834841107461e6e04acd3f7e5b2704af1c9bc3b | refs/heads/master | 2020-07-23T04:40:08.142344 | 2019-11-18T23:33:27 | 2019-11-18T23:33:27 | 207,448,228 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,419 | java | package carro;
public class Carro {
private float capacidadeTanque;
private float volumeTanque;
private float rendimento;
Carro(float capacidadeTanque, float volumeTanque, float rendimento){
this.capacidadeTanque = capacidadeTanque;
this.volumeTanque = volumeTanque;
this.rendimento = rendimento;
}
public void encheTanque(float litros){
if (this.capacidadeTanque >= (this.volumeTanque + litros) && litros != 0 && litros > 0){
this.volumeTanque += litros;
System.out.println("Abastecimento realizado.\nVolume no tanque(l): " + this.volumeTanque);
}
else{
System.out.println("Impossível abastecer: " + litros + " litros\nVolume no tanque(l): " + this.volumeTanque + " litros.\nCapadidade do tanque (l): " + this.capacidadeTanque + " litros");
}
}
public void passeio(float km){
if ((this.volumeTanque * this.rendimento) > km && km != 0 && km > 0){
float resultado = this.volumeTanque * this.rendimento - km;
System.out.println("Passeio será realizado com segurança!\n Volume no tanque após passeio (l): " + resultado);
}
else{
System.out.println("Não há combustível suficiente para realizar o passeio!\nVolume no tanque (l): "+ this.volumeTanque );
}
}
}
| [
"emanuel.mota03@gmail.com"
] | emanuel.mota03@gmail.com |
c33d377c1e553e6f8c92c7d9c0879e6761b77989 | 2704cf69aab8e65ab628d72e015e6dea479622b9 | /src/test/java/com/ekb/cache/CacheTieredCacheTest.java | 190ea6de233d648bcb37395b63449cd9c076aef6 | [] | no_license | EdSwArchitect/cache-play | 3466e65d2fdb618d76e341da1161d350a31c1a49 | 0030cb52675f6ade3a921518500adc229b78b7ac | refs/heads/master | 2021-08-28T02:25:23.310990 | 2017-12-11T03:17:40 | 2017-12-11T03:17:40 | 113,806,519 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,296 | java | package com.ekb.cache;
import org.ehcache.Cache;
import org.ehcache.CacheManager;
import org.ehcache.config.builders.CacheConfigurationBuilder;
import org.ehcache.config.builders.CacheEventListenerConfigurationBuilder;
import org.ehcache.config.builders.CacheManagerBuilder;
import org.ehcache.config.units.EntryUnit;
import org.ehcache.config.units.MemoryUnit;
import org.ehcache.event.*;
import org.ehcache.expiry.Duration;
import org.ehcache.expiry.Expirations;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.EnumSet;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.TimeUnit;
import static org.ehcache.config.builders.ResourcePoolsBuilder.newResourcePoolsBuilder;
public class CacheTieredCacheTest {
public static class ListenerObject implements CacheEventListener {
/**
* Invoked on {@link CacheEvent CacheEvent} firing.
* <p>
* This method is invoked according to the
* {@link EventType} requirements provided at listener registration time.
* <p>
* Any exception thrown from this listener will be swallowed and logged but will not prevent other listeners to run.
*
* @param event the actual {@code CacheEvent}
*/
@Override
public void onEvent(CacheEvent event) {
log.info("Cache event fired: {} for key: {}", event.getType(), event.getKey());
}
}
private static CacheManager cacheManager;
public static Logger log = LoggerFactory.getLogger(CacheTieredCacheTest.class);
private static CacheEventListenerConfigurationBuilder cacheEventListenerConfiguration;
@BeforeClass
public static void setup() {
cacheEventListenerConfiguration = CacheEventListenerConfigurationBuilder
.newEventListenerConfiguration(new ListenerObject(), EventType.EVICTED)
.unordered().asynchronous();
cacheManager = CacheManagerBuilder.newCacheManagerBuilder()
.with(CacheManagerBuilder.persistence(new File("C:/dev/data/cache", "cache-data")))
.withCache("tripleTier",
CacheConfigurationBuilder.newCacheConfigurationBuilder(Long.class, String.class,
newResourcePoolsBuilder().heap(500, EntryUnit.ENTRIES)
.offheap(500, MemoryUnit.MB)
.disk(200, MemoryUnit.GB, true)
).add(cacheEventListenerConfiguration)
)
.build();
cacheManager.init();
}
@Test
public void expireCache() throws Exception {
ListenerObject lo = new ListenerObject();
CacheManager cm = CacheManagerBuilder.newCacheManagerBuilder()
.withCache("expires",
CacheConfigurationBuilder.newCacheConfigurationBuilder(Long.class, String.class,
newResourcePoolsBuilder().heap(500, EntryUnit.ENTRIES)).
withExpiry(Expirations.timeToLiveExpiration(Duration.of(45, TimeUnit.SECONDS))
))
.build();
cm.init();
Cache<Long, String> cache =
cm.getCache("expires", Long.class, String.class);
cache.getRuntimeConfiguration().registerCacheEventListener(lo, EventOrdering.ORDERED,
EventFiring.ASYNCHRONOUS, EnumSet.of(EventType.CREATED, EventType.REMOVED, EventType.EVICTED,
EventType.EXPIRED));
for (long i = 0; i < 20; i++) {
cache.put(i, "Item " + i + " entry!");
}
Set<Long> keys = new TreeSet<>();
keys.add(0L);
keys.add(1L);
keys.add(2L);
keys.add(3L);
keys.add(4L);
keys.add(5L);
keys.add(6L);
keys.add(7L);
keys.add(8L);
keys.add(9L);
keys.add(10L);
keys.add(11L);
keys.add(12L);
keys.add(13L);
Map<Long, String> contents = cache.getAll(keys);
log.info("***** Contents returned: {}", contents);
log.info("Sleeping 1 minute then going to retrieve");
TimeUnit.MINUTES.sleep(1L);
contents = cache.getAll(keys);
log.info("Contents returned: {}", contents);
cm.close();
}
@Test
public void readCache() {
Set<Long> keys = new TreeSet<>();
keys.add(0L);
keys.add(1L);
keys.add(2L);
keys.add(3L);
keys.add(4L);
keys.add(5L);
keys.add(6L);
keys.add(7L);
keys.add(8L);
keys.add(9L);
keys.add(10L);
keys.add(11L);
keys.add(12L);
keys.add(13L);
Cache<Long, String> cache =
cacheManager.getCache("tripleTier", Long.class, String.class);
Assert.assertNotNull("Missing cache?", cache);
Map<Long, String> contents = cache.getAll(keys);
log.info("Contents returned: {}", contents);
}
@AfterClass
public static void tearDown() {
cacheManager.close();
}
}
| [
"edswarchitect@gmail.com"
] | edswarchitect@gmail.com |
cfa0b7cbf07fdcaa789c5cd87958ca62c0e9b5b4 | 1798932e8e8231607f605bfe49e7f8d8903f139c | /src/pl/edu/wszib/jwe/DataProvider.java | 094681365b8213baa50bc24cf6238cfab14cd748 | [] | no_license | skaznik/podyplpmowe3 | 20a2bff8c6e12b7abf058ae1fd8d8ccf41978c6b | dc2a281948f69b093d6c649e5496e5b37aad4bf7 | refs/heads/master | 2020-11-24T07:23:38.407270 | 2020-01-12T14:21:49 | 2020-01-12T14:21:49 | 228,027,902 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 83 | java | package pl.edu.wszib.jwe;
public interface DataProvider {
String getData();
}
| [
"skaznik@wszib.edu.pl"
] | skaznik@wszib.edu.pl |
6ebee5a75e7a992c81712c9c315e992d1ddc7294 | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Lang/41/org/apache/commons/lang/ClassUtils_getPackageName_228.java | 7a9baedd29a8a84c663f4e20940410993188f941 | [] | no_license | hvdthong/NetML | dca6cf4d34c5799b400d718e0a6cd2e0b167297d | 9bb103da21327912e5a29cbf9be9ff4d058731a5 | refs/heads/master | 2021-06-30T15:03:52.618255 | 2020-10-07T01:58:48 | 2020-10-07T01:58:48 | 150,383,588 | 1 | 1 | null | 2018-09-26T07:08:45 | 2018-09-26T07:08:44 | null | UTF-8 | Java | false | false | 1,490 | java |
org apach common lang
oper class reflect
handl invalid code code input
method document behaviour detail
notion code canon code includ human
readabl type code code
canon method variant work jvm name
code code
author stephen colebourn
author gari gregori
author norm dean
author alban peignier
author tomasz blachowicz
version
class util classutil
code class code
param cl code code
empti string
string packag getpackagenam class cl
cl
string util stringutil empti
packag getpackagenam cl getnam
| [
"hvdthong@gmail.com"
] | hvdthong@gmail.com |
7841ce37f8d816c89244c798ac891cdf7a3c1fbc | 696bbbb05e0e6d3623279fca42c9c02a96f35f9f | /hr-worker/src/main/java/com/gilbertogavioli/hrworker/HrWorkerApplication.java | 5a3c265895c953c3679dc367051fb7315a51c50d | [] | no_license | GilbertoGavioli/cursoSpringBoot | 23c781f129301f3226cbdf48cf118f43b1e3400e | a9b16937f2c8dc60cdb147cdb94ce16878c46ea8 | refs/heads/master | 2023-06-03T15:26:53.589021 | 2021-06-22T11:25:44 | 2021-06-22T11:25:44 | 376,548,112 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 413 | java | package com.gilbertogavioli.hrworker;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
@EnableEurekaClient
@SpringBootApplication
public class HrWorkerApplication {
public static void main(String[] args) {
SpringApplication.run(HrWorkerApplication.class, args);
}
}
| [
"gilberto.gavioli@gmail.com"
] | gilberto.gavioli@gmail.com |
c6af7b64efdf31dffb3d7da971e6355282be32e6 | f8307f30d7ba905491728ada3658c35bd2ca1d15 | /src/org/compiere/model/I_BPM_ServicesLine.java | 89c2ed3d650ec24dcd983ba08fb07edf2532de23 | [] | no_license | erlanibraev/zerde_adempiere2 | bbd752aada87c8630f6b151b9d78d9d042ef65f6 | 59cbb2e6785cab9eafcbc17d615d543b126cdb74 | refs/heads/master | 2020-07-10T17:07:06.519966 | 2013-09-09T10:26:43 | 2013-09-09T10:26:43 | 204,318,180 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,783 | java | /******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.model;
import java.math.BigDecimal;
import java.sql.Timestamp;
import org.compiere.util.KeyNamePair;
/** Generated Interface for BPM_ServicesLine
* @author Adempiere (generated)
* @version Release 3.7.0LTS
*/
public interface I_BPM_ServicesLine
{
/** TableName=BPM_ServicesLine */
public static final String Table_Name = "BPM_ServicesLine";
/** AD_Table_ID=1000228 */
public static final int Table_ID = MTable.getTable_ID(Table_Name);
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
/** AccessLevel = 3 - Client - Org
*/
BigDecimal accessLevel = BigDecimal.valueOf(3);
/** Load Meta Data */
/** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
/** Get Client.
* Client/Tenant for this installation.
*/
public int getAD_Client_ID();
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organization.
* Organizational entity within client
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Get Organization.
* Organizational entity within client
*/
public int getAD_Org_ID();
/** Column name BPM_ABP_ID */
public static final String COLUMNNAME_BPM_ABP_ID = "BPM_ABP_ID";
/** Set BPM_ABP ID */
public void setBPM_ABP_ID (int BPM_ABP_ID);
/** Get BPM_ABP ID */
public int getBPM_ABP_ID();
/** Column name BPM_Services_ID */
public static final String COLUMNNAME_BPM_Services_ID = "BPM_Services_ID";
/** Set BPM_Services_ID */
public void setBPM_Services_ID (int BPM_Services_ID);
/** Get BPM_Services_ID */
public int getBPM_Services_ID();
public I_BPM_ServicesWork getBPM_Services() throws RuntimeException;
/** Column name BPM_ServicesLine_ID */
public static final String COLUMNNAME_BPM_ServicesLine_ID = "BPM_ServicesLine_ID";
/** Set BPM_ServicesLine ID */
public void setBPM_ServicesLine_ID (int BPM_ServicesLine_ID);
/** Get BPM_ServicesLine ID */
public int getBPM_ServicesLine_ID();
/** Column name BPM_ServicesWork_ID */
public static final String COLUMNNAME_BPM_ServicesWork_ID = "BPM_ServicesWork_ID";
/** Set BPM_ServicesWork ID */
public void setBPM_ServicesWork_ID (int BPM_ServicesWork_ID);
/** Get BPM_ServicesWork ID */
public int getBPM_ServicesWork_ID();
public I_BPM_ServicesWork getBPM_ServicesWork() throws RuntimeException;
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
/** Get Created.
* Date this record was created
*/
public Timestamp getCreated();
/** Column name CreatedBy */
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
/** Get Created By.
* User who created this records
*/
public int getCreatedBy();
/** Column name IsActive */
public static final String COLUMNNAME_IsActive = "IsActive";
/** Set Active.
* The record is active in the system
*/
public void setIsActive (boolean IsActive);
/** Get Active.
* The record is active in the system
*/
public boolean isActive();
/** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated";
/** Get Updated.
* Date this record was updated
*/
public Timestamp getUpdated();
/** Column name UpdatedBy */
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
/** Get Updated By.
* User who updated this records
*/
public int getUpdatedBy();
}
| [
"V.Sokolov@localhost"
] | V.Sokolov@localhost |
6291b7ad1f2ded40c45d6d9aa2f716e689d1d079 | 40fa14367302f38b37cca8da00cfe09842ae86af | /src/test/java/keypressestests/KeyPressesTests.java | 3ae325d40ea270fffe66a6211eb7a051a1a8ef61 | [] | no_license | anands220193/advanced-selenium-webdriver | 957a97a25da04aded2bc64b5ea6f9803710bf87b | 55b563fcf4cfafc327858178be2396d4756a232d | refs/heads/master | 2023-08-16T03:09:35.471354 | 2021-09-27T04:33:23 | 2021-09-27T04:33:23 | 410,684,569 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,715 | java | package keypressestests;
import Pages.KeyPressesPage;
import Pages.WelcomePage;
import base.TestUtilities;
import org.openqa.selenium.Keys;
import org.testng.Assert;
import org.testng.annotations.Test;
public class KeyPressesTests extends TestUtilities {
@Test
public void keyPressesTests(){
log.info("Starting Key Presses0L, Value Test");
//open main page
WelcomePage welcomePage = new WelcomePage(driver, log);
welcomePage.openPage();
//Click on KEY PRESSES link
KeyPressesPage keyPressesPage=welcomePage.clickKeyPressesLink();
//Push keyboard key
keyPressesPage.pressKey(Keys.SPACE);
//Get result text
String result=keyPressesPage.getResultText();
//Verification Result text expected
Assert.assertTrue(result.equals("You entered: SPACE"),"The expected result is text is 'You entered: SPACE'" +
" and actual result is: " + result);
}
@Test
public void pressKeyWithActionTests(){
log.info("Starting Press Key With Action Tests");
//open main page
WelcomePage welcomePage = new WelcomePage(driver, log);
welcomePage.openPage();
//Click on KEY PRESSES link
KeyPressesPage keyPressesPage=welcomePage.clickKeyPressesLink();
//Push keyboard key
keyPressesPage.pressKeyWithActionTests(Keys.SPACE);
//Get result text
String result=keyPressesPage.getResultText();
//Verification Result text expected
Assert.assertTrue(result.equals("You entered: SPACE"),"The expected result is text is 'You entered: SPACE'" +
" and actual result is: " + result);
}
}
| [
"anands_official@yahoo.com"
] | anands_official@yahoo.com |
2140e5fe9a9cc5117d9d7f5ff03fe8127789e5cf | 7bd3005495d0ba120c43c0c5cd6e6384c95c5990 | /meadjohnson/src/main/java/com/cpm/xmlGetterSetter/SkuMasterGetterSetter.java | 20f9d9432abee3b0b3db24e8f555ccd21b30d994 | [] | no_license | osgirl/ReckittBenckiser | a0f53ca5b662c24069644ebb5987cbca408054f1 | 01f95600920d3a7c870563c2b9df996e7f32d5fe | refs/heads/master | 2020-04-21T12:02:17.479096 | 2019-03-04T19:25:38 | 2019-03-04T19:25:38 | 169,549,152 | 0 | 0 | null | 2019-02-07T09:45:24 | 2019-02-07T09:45:24 | null | UTF-8 | Java | false | false | 2,854 | java | package com.cpm.xmlGetterSetter;
import java.util.ArrayList;
public class SkuMasterGetterSetter {
String sku_master_table;
public String getSku_master_table() {
return sku_master_table;
}
public void setSku_master_table(String sku_master_table) {
this.sku_master_table = sku_master_table;
}
ArrayList<String> sku_cd = new ArrayList<String>();
ArrayList<String> sku = new ArrayList<String>();
ArrayList<String> brand_cd = new ArrayList<String>();
ArrayList<String> brand = new ArrayList<String>();
ArrayList<String> category_cd = new ArrayList<String>();
ArrayList<String> category = new ArrayList<String>();
ArrayList<String> mrp = new ArrayList<String>();
/*ArrayList<String> category_type = new ArrayList<String>();
ArrayList<String> packing_size = new ArrayList<String>();*/
ArrayList<String> sku_sequence = new ArrayList<String>();
ArrayList<String> brand_sequence = new ArrayList<String>();
ArrayList<String> category_sequence = new ArrayList<String>();
/*public ArrayList<String> getPacking_size() {
return packing_size;
}
public void setPacking_size(String packing_size) {
this.packing_size.add(packing_size);
}*/
public ArrayList<String> getSku_cd() {
return sku_cd;
}
public void setSku_cd(String sku_cd) {
this.sku_cd.add(sku_cd);
}
public ArrayList<String> getSku() {
return sku;
}
public void setSku(String sku) {
this.sku.add(sku);
}
public ArrayList<String> getBrand_cd() {
return brand_cd;
}
public void setBrand_cd(String brand_cd) {
this.brand_cd.add(brand_cd);
}
public ArrayList<String> getBrand() {
return brand;
}
public void setBrand(String brand) {
this.brand.add(brand);
}
public ArrayList<String> getCategory_cd() {
return category_cd;
}
public void setCategory_cd(String category_cd) {
this.category_cd.add(category_cd);
}
/* public ArrayList<String> getCategory_type() {
return category_type;
}
public void setCategory_type(String category_type) {
this.category_type.add(category_type);
}*/
public ArrayList<String> getCategory() {
return category;
}
public ArrayList<String> getSku_sequence() {
return sku_sequence;
}
public void setSku_sequence(String sku_sequence) {
this.sku_sequence.add(sku_sequence);
}
public ArrayList<String> getBrand_sequence() {
return brand_sequence;
}
public void setBrand_sequence(String brand_sequence) {
this.brand_sequence.add(brand_sequence);
}
public ArrayList<String> getCategory_sequence() {
return category_sequence;
}
public void setCategory_sequence(String category_sequence) {
this.category_sequence.add(category_sequence);
}
public void setCategory(String category) {
this.category.add(category);
}
public ArrayList<String> getMrp() {
return mrp;
}
public void setMrp(String mrp) {
this.mrp.add(mrp);
}
}
| [
"yadavendra.singh@in.cpm-int.com"
] | yadavendra.singh@in.cpm-int.com |
c269751aa3f6207fca380cc517657bc49b8a7538 | 8889cf661efb1b993329c133e160060fb9f8525c | /Depo/src/Depo/InfoTrain.java | c9276b2c317148b1cc98be265a763c13cc3f8de8 | [] | no_license | jakowgithub/jakow | 2d752d20edf30f4734592d9e90f36785b831230c | d32954d2fa54981c788f91e8edaf85a604beed39 | refs/heads/master | 2020-03-12T16:42:06.070826 | 2019-01-27T09:44:54 | 2019-01-27T09:44:54 | 130,721,981 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,503 | java | package Depo;
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.border.Border;
public class InfoTrain {
// ogoloshuu vsi komponenti
private JPanel vmistVikna=new JPanel();
private static JLabel labelInfo [][]=new JLabel [9][4];
private Border ramkaGovta1 = BorderFactory.createLineBorder(Color.YELLOW, 1);
InfoTrain (){
for (int i=0; i<9; i++){
for (int j=0; j<4; j++){
if (0==i) {
if (0==j) labelInfo [i][j]=new JLabel("Parametr");
if (1==j) labelInfo [i][j]=new JLabel("Value");
if (2==j) labelInfo [i][j]=new JLabel("Pasagir");
if (3==j) labelInfo [i][j]=new JLabel("Notes");
}
else if (0==j) {
//if (0==i) labelInfo [i][j]=new JLabel();
if (1==i) labelInfo [i][j]=new JLabel("Line");
if (2==i) labelInfo [i][j]=new JLabel("Driver");
if (3==i) labelInfo [i][j]=new JLabel("Train");
if (4==i) labelInfo [i][j]=new JLabel("Vagon1");
if (5==i) labelInfo [i][j]=new JLabel("Vagon2");
if (6==i) labelInfo [i][j]=new JLabel("Vagon3");
if (7==i) labelInfo [i][j]=new JLabel("Vagon4");
if (8==i) labelInfo [i][j]=new JLabel("Vagon5");
}
else labelInfo [i][j]=new JLabel();
labelInfo [i][j].setHorizontalAlignment(SwingConstants.CENTER);
labelInfo [i][j].setBorder(ramkaGovta1);
vmistVikna.add(labelInfo [i][j]);
}}
//Zadau sxemu dlya paneli vmistVikna
vmistVikna.setLayout(new GridLayout (9,4));
//Stvoruu Frame ta viznachau ego osnovnu panel
JFrame frame = new JFrame ("InfoTrain");
frame.setContentPane(vmistVikna);
frame.setLocation(90, 245);
//Zadau dostatnij rozmir vikna
//frame.pack();
frame.setSize(400, 180);
//Vidobragaem vikno
frame.setVisible(true);
//vstanjvluu operaziu pri zakritti vikna
//frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e) {
MetroRuch.praporKilkostiIT=0;
//System.exit(0);
}});
}
public static void setText (int i, int j, int kilkist) {labelInfo[i][j].setText(""+kilkist);}
public static void setText (int i, int j, String str) {labelInfo[i][j].setText(str);}
}
| [
"jakowgit@gmail.com"
] | jakowgit@gmail.com |
caac5741072cbc872612e04fee94ca139e0f42b2 | 95132287c256537f8b3e7ca827255990b8a5d3ff | /src/main/java/checker/NeweggChecker.java | 1e8f0118ef0229e0e4847adee4b7a45d7652cbe7 | [
"MIT"
] | permissive | MinhazMurks/availability-checker | 38d55c5422d2b49d082aeb71784d508b8a2560f8 | d00d7064b7a1aab91286133411dd17a970a720a5 | refs/heads/master | 2023-01-22T19:34:17.860425 | 2020-12-08T18:32:02 | 2020-12-08T18:32:02 | 297,005,591 | 1 | 0 | null | 2020-12-08T18:32:03 | 2020-09-20T05:02:40 | Java | UTF-8 | Java | false | false | 565 | java | package checker;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
/**
* Checker for Newegg Store.
* @see <a href="https://newegg.com">https://newegg.com</a>
*/
public class NeweggChecker extends SeleniumAvailabilityChecker {
public NeweggChecker(String... pageURLs) {
super(pageURLs);
}
@Override
protected Availability checkAvailability(Document document) {
Element element = document.getElementById("landingpage-cart");
return Availability.isSoldOut(element.getElementsByClass("btn").text());
}
}
| [
"minhazabdullah1@gmail.com"
] | minhazabdullah1@gmail.com |
172bd1a34f760f88ccb14f93efcc961f598851e2 | 650b6dd5e624904b147d7e09f922a2487dcb9102 | /tests/java/src/main/java/com/tmall/top/BackendWebSocketServlet.java | 26ea84327d8a82eafad5b09a8ed590b713c94303 | [
"Apache-2.0"
] | permissive | jn2304/top-push | 144095a3c2a74d5412a10268a988fded442e5f72 | c10dea446aa1b5181b539d04be3390151a20ad74 | refs/heads/master | 2021-01-17T10:15:24.782575 | 2013-06-27T07:32:12 | 2013-06-27T07:32:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,173 | java | package com.tmall.top;
import java.io.IOException;
import java.util.Date;
import java.util.concurrent.ConcurrentLinkedQueue;
import javax.servlet.http.HttpServletRequest;
import org.eclipse.jetty.websocket.WebSocket;
import org.eclipse.jetty.websocket.WebSocket.Connection;
import org.eclipse.jetty.websocket.WebSocketServlet;
import org.eclipse.jetty.websocket.WebSocket.OnTextMessage;
import com.tmall.top.FrontendWebSocketServlet.FrontendWebSocket;
public class BackendWebSocketServlet extends WebSocketServlet {
public static ConcurrentLinkedQueue<String> Messages = new ConcurrentLinkedQueue<String>();
public static Connection Backend = null;
public WebSocket doWebSocketConnect(HttpServletRequest arg0, String arg1) {
return new BackendWebSocket();
}
private class BackendWebSocket implements OnTextMessage {
private int _total;
public void onClose(int arg0, String arg1) {
}
public void onOpen(Connection arg0) {
Backend = arg0;
}
public void onMessage(String arg0) {
if (this._total == 0) {
this._total = Integer.parseInt(arg0);
return;
}
for (int i = 0; i < this._total; i++)
Messages.add(arg0);
}
}
}
| [
"wskyhx@gmail.com"
] | wskyhx@gmail.com |
31a5fd488c7dc922a29bb31b726e2a27f9c996d5 | 2a68a19161ca085a778da778f34e22e8ce0f96a7 | /WorkPlatformApplication/ViewController/src/com/zypg/cms/work/view/util/FileManageThread.java | 7bff18f77648e3910e400598e9a6b1c554a377fe | [] | no_license | vickysongang/Founder | a40ee6dd1672e807bf7a31fb9ccdaa788f9e1ab0 | 62bc7293f433f89b25b8205b47fd1c6476d70d78 | refs/heads/master | 2021-01-10T02:10:28.358554 | 2016-01-10T07:08:19 | 2016-01-10T07:08:19 | 49,356,437 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,872 | java | package com.zypg.cms.work.view.util;
import com.honythink.applicationframework.hadf.util.DataSourceUtil;
import com.zypg.cms.foldermanager.manager.FolderManager;
import com.zypg.cms.foldermanager.model.Folder;
import com.zypg.cms.foldermanager.model.FolderFactory;
import com.zypg.cms.work.view.model.UcmFileModel;
import java.io.ByteArrayInputStream;
import java.io.UnsupportedEncodingException;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.List;
import net.sf.jftp.net.FtpConnection;
import oracle.jbo.domain.Number;
public class FileManageThread implements Runnable {
private List<String> fileManageList = new ArrayList<String>();
private String compName;
private String libName;
private String currStatus;
public FileManageThread() {
super();
}
public FileManageThread(List<String> fileManageList, String compName, String libName, String currStatus) {
this.fileManageList = fileManageList;
this.compName = compName;
this.libName = libName;
this.currStatus = currStatus;
}
@Override
public void run() {
try {
CommonUtil.initFtpConn();
FolderManager fm = new FolderManager();
FtpConnection ftpConn = fm.getConn();
Connection conn = DataSourceUtil.getJndiDatasource().getConnection();
for (String key : fileManageList) {
Number docId = new Number(Integer.parseInt(key.substring(key.lastIndexOf("_") + 1)));
//参数 用户登录名 出版社名(中文) LibCode “具体库名(中文)”
List<String> folders = new ArrayList<String>();
//根据lookup表获取图书库的所有文件结构
String directorys = DaoUtil.getFileManageDirectory(conn, docId);
if (directorys == null || directorys.length() == 0) {
continue;
}
for (String directory : directorys.split(",")) {
if (directory != null && directory.length() > 0) {
folders.add(directory);
}
}
String docName = DaoUtil.getDocNameByDocId(conn, docId);
Folder rootFolder = FolderFactory.createFolderByList(compName, libName, docName, folders);
fm.mkAllDir(rootFolder);
System.out.println("currStatus:" + currStatus);
if (currStatus.contains(Constants.GATHER_STATUS_PREFIX)) {
System.out.println("从采集状态点击文件管理");
continue;
}
//生成占位符
List<UcmFileModel> ucmFileList = DaoUtil.getUCMFilesByDocId(conn, docId);
int size = ucmFileList.size();
DaoUtil.insertFileManageMonitorRecord(conn, docId, 0, size); //先归零
if (ucmFileList != null && size > 0) {
int i = 0;
for (UcmFileModel file : ucmFileList) {
i++;
String ftpRelativePath = file.getFilePath();
String ftpPath = "/" + compName + "/" + libName + "/" + docName + "/" + ftpRelativePath;
String fileName = file.getFileName();
Number dId = file.getUcmDid();
String ucmDocName = file.getUcmDocName();
String placeholderFlag = "FEILIUZHIXIASANQIANCHIPLACEHOLDER";
String placeholderStr =
placeholderFlag + "/docId---->" + docId + "#@#" + "fileName" + "---->" + fileName + "#@#" +
"filePath" + "---->" + ftpPath + "#@#" + "ucmDocId" + "---->" + dId.toString() + "#@#" +
"ucmDocName" + "---->" + ucmDocName;
ByteArrayInputStream in = null;
try {
in = new ByteArrayInputStream(placeholderStr.getBytes("UTF-8"));
ftpConn.sendFtpCommand(FtpConnection.CWD + " " + ftpPath);
ftpConn.updatePWD();
ftpConn.upload(fileName, fileName, in);
DaoUtil.insertFileManageMonitorRecord(conn, docId, i, size); //先归零
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} finally {
if (in != null) {
in.close();
}
}
}
ftpConn.sendFtpCommand(FtpConnection.CWD + " /");
ftpConn.updatePWD();
}
System.out.println("改变状态。。。");
DaoUtil.fileManage(conn, docId, null);
}
if (ftpConn != null) {
ftpConn.disconnect();
}
if (conn != null) {
conn.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void setFileManageList(List<String> fileManageList) {
this.fileManageList = fileManageList;
}
public List<String> getFileManageList() {
return fileManageList;
}
public void setCompName(String compName) {
this.compName = compName;
}
public String getCompName() {
return compName;
}
public void setLibName(String libName) {
this.libName = libName;
}
public String getLibName() {
return libName;
}
public void setCurrStatus(String currStatus) {
this.currStatus = currStatus;
}
public String getCurrStatus() {
return currStatus;
}
}
| [
"vickysongang@gmail.com"
] | vickysongang@gmail.com |
2310fa9d4a8f1f88dd9cff6d02bfae8ea8505758 | e682fa3667adce9277ecdedb40d4d01a785b3912 | /internal/fischer/mangf/A067353.java | 40c5c2def51fa979f04ccbfd6e9e18b1ef76da94 | [
"Apache-2.0"
] | permissive | gfis/joeis-lite | 859158cb8fc3608febf39ba71ab5e72360b32cb4 | 7185a0b62d54735dc3d43d8fb5be677734f99101 | refs/heads/master | 2023-08-31T00:23:51.216295 | 2023-08-29T21:11:31 | 2023-08-29T21:11:31 | 179,938,034 | 4 | 1 | Apache-2.0 | 2022-06-25T22:47:19 | 2019-04-07T08:35:01 | Roff | UTF-8 | Java | false | false | 549 | java | package irvine.oeis.a067;
import irvine.math.z.Z;
import irvine.oeis.HolonomicRecurrence;
/**
* A067353 Divide the natural numbers in sets of consecutive numbers starting with {1,2} as the first set.
* The number of elements of the n-th set is equal to the sum of the n-1 final numbers in the (n-1)st set.
* The final number of the n-th set gives a(n).
* @author Georg Fischer
*/
public class A067353 extends HolonomicRecurrence {
/** Construct the sequence. */
public A067353() {
super(1, "[[-2,3,-1],[0,2],[-2]]", "2", 0);
}
}
| [
"dr.Georg.Fischer@gmail.com"
] | dr.Georg.Fischer@gmail.com |
8d84898a3af60eedd291f2d513605ca332db8355 | 4313877464e2d9439650a940bf4aa9c2f9f65078 | /nutri-api/src/main/java/com/example/nutri/NutriApplication.java | ce8b3b73a5ce89a4642b9dd63b6eac3f79cf9cc5 | [] | no_license | harawata/nutri | 9d885cb771edbefc3a64f2ceba3f7153ad637281 | e5fe82022acc71571537b520fdf1c44ffda7427c | refs/heads/master | 2023-02-21T00:51:29.542440 | 2021-01-08T07:38:22 | 2021-01-08T07:38:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 308 | java | package com.example.nutri;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class NutriApplication {
public static void main(String[] args) {
SpringApplication.run(NutriApplication.class, args);
}
}
| [
"we.are.one779@gmail.com"
] | we.are.one779@gmail.com |
1d8fbba738065400ea33eddbc539362efb80978a | a5b1dfb64f3ae17b4d2a392c08764eae17f5443f | /src/tasks/CopyFileTask.java | ead17e0172a89fa8e292e633cc4edda685defd64 | [] | no_license | Ahmed-Ghanem/Sphinx | dab9a9226f72bbc210f8a9037c1e78e451b2f028 | f099425bc0f95334d8977a5e1abe339d98f87fb3 | refs/heads/master | 2016-09-06T06:33:18.828273 | 2011-06-28T18:43:15 | 2011-06-28T18:43:15 | 1,428,620 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,467 | java | package tasks;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.JProgressBar;
/**
*
* @author Ahmed Ghanem
*/
public class CopyFileTask implements Runnable {
private int currentValue;
private JProgressBar bar;
private String copyFrom;
private String copyTo;
private JDialog dialog;
public CopyFileTask(String f, String t) {
this.copyFrom = f;
this.copyTo = t;
}
public void progressRef(JProgressBar bar, JDialog d) {
this.bar = bar;
this.dialog = d;
}
public void run() {
BufferedInputStream in = null;
BufferedOutputStream out = null;
try {
// Create file input stream
File inFile = new File(copyFrom);
in = new BufferedInputStream(new FileInputStream(inFile));
// Create file output stream
File outFile = new File(copyTo);
out = new BufferedOutputStream(new FileOutputStream(outFile));
// Get total bytes in the file
long totalBytes = in.available();
// Start progress meter bar
bar.setValue(0);
bar.setMaximum(100);
int r;
long bytesRead = 0;
// You may increase buffer size to improve IO speed
byte[] b = new byte[10];
while ((r = in.read(b, 0, b.length)) != -1) {
out.write(b, 0, r);
bytesRead += r;
currentValue = (int) (bytesRead * 100 / totalBytes);
// Update the progress bar
bar.setValue(currentValue);
}
} catch (FileNotFoundException ex) {
JOptionPane.showMessageDialog(null, "Data not found", "info", JOptionPane.INFORMATION_MESSAGE);
} catch (IOException ex) {
JOptionPane.showMessageDialog(null, "Data not found", "info", JOptionPane.INFORMATION_MESSAGE);
} finally {
dialog.dispose();
try {
if (in != null) {
in.close();
}
if (out != null) {
out.close();
}
} catch (Exception ex) {
}
}
}
}
| [
"x_rootex@yahoo.com"
] | x_rootex@yahoo.com |
4b5c39e18c81ec2a0e63069783b9b30f5327bcb5 | e5d95f260c63cb820cfd20001e21996a12d9d0f6 | /javawebparts/WEB-INF/src/javawebparts/filter/ParameterMungerFilter.java | d44f1d547d947e42bd6e4324595ac744222e6a9b | [
"Apache-2.0"
] | permissive | fzammetti/java-web-parts | 6725e698fc3cefe416bab7789d6bae71af0d6d2f | 1422b90430c996f8eda26805b3f3d4a69be5a15c | refs/heads/master | 2022-04-01T06:44:10.431551 | 2020-02-15T07:19:50 | 2020-02-15T07:19:50 | 108,367,873 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,212 | java | /*
* Copyright 2005 Frank W. Zammetti
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package javawebparts.filter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.StringTokenizer;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* This filter can perform various operations on incoming parameters. It allows
* for including or excluding paths from filter functionality. It also allows
* for performing one or more defined operations on every parameter received.
* <br><br>
* Init parameters are:
* <br>
* <ul>
* <li><b>pathSpec</b> - Either "include" or "exclude". This determines whether
* the list of paths in the pathList parameter is a list of paths to include in
* filter functionality, or a list of paths to exclude. Required: No.
* Default: None.</li>
* <br><br>
* <li><b>pathList</b> - This is a comma-separated list of paths, which can use
* asterisk for wildcard support, that denotes either paths to include or
* exclude from the functioning of this filter (depending on what pathSpec
* is set to). The paths ARE case-senitive! There is no limit to how many
* items can be specified, although for performance reasons a developer will
* probably want to specify as few as possible to get the job done (each
* requested path is matched via regex). Note also that you are of course
* still required to specify a path for the filter itself as per the servlet
* spec. This parameter however, together with pathSpec, gives you more control
* and flexibility than that setting alone. Required: No. Default: None.
* <br><br>
* General note on pathSpec and pathList: If pathSpec is not specified but
* pathList IS, then 'exclude' is assumed for pathSpec. If pathSpec is
* specified by pathList IS NOT, then the filter WILL NEVER EXECUTE (this is
* technically a misconfiguration). If NEITHER is defined then the generic
* filter mapping will be in effect only.</li>
* <br><br>
* <li><b>functionList</b> - This is a comma-separated list of functions to
* perform on all parameters of the request. You can string as many of these
* functions together as you wish. The supported values are 'trim' (trim
* whitespace from both ends of the parameter), 'ucase' (convert parameter
* to upper-case), 'lcase' (conert the parameter to lower-case), 'reverse'
* (reverse the parameter, i.e., java becomes avaj). Required: Yes.
* Default: None (must be at least one of the valid values).</li>
* </ul>
* <br>
* Example configuration in web.xml:
* <br><br>
* <filter><br>
* <filter-name>ParameterMungerFilter</filter-name><br>
* <filter-class>javawebparts.filter.
* ParameterMungerFilter</filter-class><br>
* <init-param><br>
* <param-name>pathSpec</param-name><br>
* <param-value>include</param-value><br>
* </init-param><br>
* <init-param><br>
* <param-name>pathList</param-name><br>
* <param-value>*‍/parameterMungerFilterTest
* </param-value><br>
* </init-param><br>
* <init-param><br>
* <param-name>functionList</param-name><br>
* <param-value>trim,ucase,reverse</
* param-value><br>
* </init-param><br>
* </filter>
* <br><br>
* <filter-mapping><br>
* <filter-name>ParameterMungerFilter</filter-name><br>
* <url-pattern>/*</url-pattern><br>
* </filter-mapping>
*
* @author <a href="mailto:fzammetti@omnytex.com">Frank W. Zammetti</a>.
*/
public class ParameterMungerFilter implements Filter {
/**
* This static initializer block tries to load all the classes this one
* depends on (those not from standard Java anyway) and prints an error
* meesage if any cannot be loaded for any reason.
*/
static {
try {
Class.forName("javax.servlet.Filter");
Class.forName("javax.servlet.FilterChain");
Class.forName("javax.servlet.FilterConfig");
Class.forName("javax.servlet.http.HttpServletRequest");
Class.forName("javax.servlet.ServletException");
Class.forName("javax.servlet.ServletRequest");
Class.forName("javax.servlet.ServletResponse");
Class.forName("org.apache.commons.logging.Log");
Class.forName("org.apache.commons.logging.LogFactory");
} catch (ClassNotFoundException e) {
System.err.println("ParameterMungerFilter" +
" could not be loaded by classloader because classes it depends" +
" on could not be found in the classpath...");
e.printStackTrace();
}
}
/**
* Log instance.
*/
private static Log log = LogFactory.getLog(ParameterMungerFilter.class);
/**
* Constant for function trim function.
*/
private static final String FUNCTION_TRIM = "trim";
/**
* Constant for function lcase function.
*/
private static final String FUNCTION_LCASE = "lcase";
/**
* Constant for function ucase function.
*/
private static final String FUNCTION_UCASE = "ucase";
/**
* Constant for function reverse function.
*/
private static final String FUNCTION_REVERSE = "reverse";
/**
* Whether pathList includes or excludes.
*/
private String pathSpec;
/**
* List of paths for filter functionality determination.
*/
private ArrayList pathList = new ArrayList();
/**
* The list of functions to be performed.
*/
private ArrayList functionList = new ArrayList();
/**
* Destroy.
*/
public void destroy() {
} // End destroy.
/**
* Initialize this filter.
*
* @param filterConfig The configuration information for this filter.
* @throws ServletException ServletException.
*/
public void init(FilterConfig filterConfig) throws ServletException {
log.info("init() started");
// Do pathSpec and pathList init work.
pathSpec = FilterHelpers.initPathSpec(getClass().getName(), filterConfig);
pathList = FilterHelpers.initPathList(getClass().getName(), filterConfig);
// Get the comma-separater list of functions and populate the functionList
// ArrayList from it.
String csvFunctionList = filterConfig.getInitParameter("functionList");
if (functionList == null) {
String es = getClass().getName() + " could not initialize " +
"because mandatory functionList init parameter " +
"was not found";
log.error(es);
throw new ServletException(es);
}
log.info("csvFunctionList = " + csvFunctionList);
StringTokenizer st = new StringTokenizer(csvFunctionList, ",");
while (st.hasMoreTokens()) {
String s = st.nextToken();
if (s.equalsIgnoreCase(FUNCTION_TRIM) ||
s.equalsIgnoreCase(FUNCTION_LCASE) ||
s.equalsIgnoreCase(FUNCTION_UCASE) ||
s.equalsIgnoreCase(FUNCTION_REVERSE)) {
functionList.add(s);
} else {
String es = getClass().getName() + " could not initialize " +
"because there was an unrecognized function in the " +
"functionList init parameter (function was " + s + ")";
log.error(es);
throw new ServletException(es);
}
}
log.info("functionList = " + functionList);
log.info("init() completed");
} // End init().
/**
* Do filter's work.
*
* @param request The current request object.
* @param response The current response object.
* @param filterChain The current filter chain.
* @throws ServletException ServletException.
* @throws IOException IOException.
*/
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain filterChain)
throws ServletException, IOException {
if (FilterHelpers.filterPath(request, pathList, pathSpec)) {
log.info("ParameterMungerFilter firing...");
filterChain.doFilter(new ParameterMungerResWrapper(
(HttpServletRequest)request, functionList), response);
} else {
filterChain.doFilter(request, response);
}
} // End doFilter().
} // End class.
| [
"fzammetti@etherient.com"
] | fzammetti@etherient.com |
3f01c4095ca33e0c13b9f76beb47bc38a2e1405e | e441c8e36a5c9abe426f12f7783ffb7180f4c7e3 | /GPay/src/main/java/com/sbc/gpay/service/StatementService.java | d7dad27bf128cd58149b53e001f1705873b0f627 | [] | no_license | Aayush-5795/Gpay | 46236e543d3cbc7c4f59788cce6ef71992fecf98 | eb381dc611b9950d3dad4d71f2ff150b55ccd607 | refs/heads/main | 2023-05-14T17:42:45.960452 | 2021-06-10T10:05:38 | 2021-06-10T10:05:38 | 374,655,253 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 176 | java | package com.sbc.gpay.service;
import com.sbc.gpay.dto.StatementResponseDto;
public interface StatementService {
StatementResponseDto getStatement(long userId);
}
| [
"noreply@github.com"
] | noreply@github.com |
d5ce91cb18acc4088556047d444fb054a680a9c4 | e023eba90034de0ac4e842cc8a951e741dfd5fa3 | /src/main/java/domain/AppManager.java | 2fa6fe1a7aa20962b4ee3c8f8ca36a40f805de75 | [] | no_license | kasarevich/HT3 | 147a453387d1984ea30242b4831341333b15e326 | 8490e5544886f04e52fd5f74ebb3e621f4be7612 | refs/heads/master | 2020-04-11T17:00:01.745251 | 2018-12-16T23:53:10 | 2018-12-16T23:53:10 | 161,944,681 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,693 | java | package domain;
import data.instructions.Operation;
import exception.InputFileException;
import exception.LogException;
import exception.WebException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
/**
* class AppManager сщдержит основную бизнес-логику фреймворка
* Модуль взаимодействует со слоем данных и UI через интерфейс,
* для возможности разной реальзации пользовательского интерфейса или логики слоя данных
*/
public class AppManager{
private final static SimpleDateFormat sdf = new SimpleDateFormat("hh:mm:ss dd.MM.yyyy");
private UI ui;
private FileManager fm;
private WebManager wm;
private ArrayList<Operation> script;
private int totalCounter;
private int successCounter;
private long statTime;
public AppManager() {
}
public void setUI(UI ui){
this.ui = ui;
}
public void setFileManager(FileManager fm){
this.fm = fm;
}
public void setWebManager(WebManager wm){
this.wm = wm;
}
/**
* Метод получает готовый список инструкций ArrayList<Operation> script из WebManager вызовом метода
* fm.readInstructions(filename) с именем файла инструкций.
* Если парсинг прошел успешно, в цикле поочередно начинают исполняться инструкции, собирается общая статистика для лога.
* Когда все инструкции выполнены, отображается и логируется статистика.
* @param filename - название файла с инструкциями.
*/
public void start(String filename) {
log("[ parsing \"" + filename + "\" started ]");
try {
script = fm.readInstructions(filename);
} catch (InputFileException e) {
log(e.getMessage());
return;
}
log("[ instructions from file \"" + filename + "\" are ready ]\n\t\t +++++++++++++ Tests +++++++++++++");
statTime = System.nanoTime();
successCounter = 0;
totalCounter = 0;
for(Operation operation : script){
switch (operation.getType()){
case open:{
try {
open(operation.getValue(), operation.getTimeout());
}catch (WebException e){
log(e.getMessage());
}
totalCounter++;
break;
}
case checkPageTitle:{
try {
checkPageTitle(operation.getValue());
}catch (WebException e){
log(e.getMessage());
}
totalCounter++;
break;
}
case checkPageContains:{
try {
checkPageContains(operation.getValue());
}catch (WebException e){
log(e.getMessage());
}
totalCounter++;
break;
}
case checkLinkPresentByHref:{
try{
checkLinkPresentByHref(operation.getValue());
}catch (WebException e){
log(e.getMessage());
}
totalCounter++;
break;
}
case checkLinkPresentByName:{
try{
checkLinkPresentByName(operation.getValue());
}catch (WebException e){
log(e.getMessage());
}
totalCounter++;
break;
}
}
}
printResult();
}
/**
* Этот метод вызывает openUrl(url, timeout) класса WebManager, который переходит по url
* и получает html документ. Если документ доступен, тест считается пройденным, статистика обновляется.
* @param url - искомый URL адрес
* @param timeout - максимальное время получения ответа
* @throws WebException - кастомное исключение-обертка всех ошибок, связанных с получением и парсингом html-документа.
* Сообщение об ошибке записывается в лог и выводится на экран.
*/
private void open(String url, int timeout) throws WebException {
long start = System.nanoTime();
boolean result = wm.openUrl(url, timeout);
formatLog(result, "open \"" + url + "\" \"" + (timeout/1000) + "\"", start);
if(result){
successCounter ++;
}
}
/**
* Этот метод вызывает checkLinkByHref(href) класса WebManager, который ищет в полученном html-документе
* ссылку со значением href. Если ссылка найдена, тест считается пройденным, статистика обновляется.
* @param href - искомая ссылка
* @throws WebException - кастомное исключение-обертка всех ошибок, связанных с получением и парсингом html-документа.
* Сообщение об ошибке записывается в лог и выводится на экран.
*/
private void checkLinkPresentByHref(String href) throws WebException {
long start = System.nanoTime();
boolean result = wm.checkLinkByHref(href);
formatLog(result,"checkLinkByHref \"" + href +"\"", start);
if(result){
successCounter ++;
}
}
/**
* Этот метод вызывает checkLinkByName(name) класса WebManager, который ищет в полученном html-документе
* ссылку с текстом name. Если ссылка найдена, тест считается пройденным, статистика обновляется.
* @param name - текст искомой ссылки
* @throws WebException - кастомное исключение-обертка всех ошибок, связанных с получением и парсингом html-документа.
* Сообщение об ошибке записывается в лог и выводится на экран.
*/
private void checkLinkPresentByName(String name) throws WebException {
long start = System.nanoTime();
boolean result = wm.checkLinkByName(name);
formatLog(result, "checkLinkPresentByName \"" + name +"\"", start);
if(result){
successCounter ++;
}
}
/**
* Этот метод вызывает checkTitle(title) класса WebManager, который проверяет заголовок полученного html-документа
* на равенство с title. Если заголовок совпадает, тест считается пройденным, статистика обновляется.
* @param title - текст искомого заголовка
* @throws WebException - кастомное исключение-обертка всех ошибок, связанных с получением и парсингом html-документа.
* Сообщение об ошибке записывается в лог и выводится на экран.
*/
private void checkPageTitle(String title) throws WebException {
long start = System.nanoTime();
boolean result = wm.checkTitle(title);
formatLog(result, "checkPageTitle \"" + title +"\"", start);
if(result){
successCounter ++;
}
}
/**
* Этот метод вызывает checkPageContains(text) класса WebManager, который осуществляет поиск в полученном html-документе
* текст. Если текст найден, тест считается пройденным, статистика обновляется.
* @param text - искомый текст
* @throws WebException - кастомное исключение-обертка всех ошибок, связанных с получением и парсингом html-документа.
* Сообщение об ошибке записывается в лог и выводится на экран.
*/
private void checkPageContains(String text) throws WebException {
long start = System.nanoTime();
boolean result = wm.checkPageContains(text);
formatLog(result, "checkPageContains \"" + text +"\"", start);
if(result){
successCounter ++;
}
}
/**
* Этот метод передает сообщение для вывода на экран и делает запись в лог.
* @param message
*/
private void log(String message){
try {
ui.showMessage(time() + "\t" + message);
fm.writeLog(time() + "\t" + message);
} catch (LogException e) {
ui.showMessage(time() + "\t" + e.getMessage());
}
}
private String time(){
return "[ " + sdf.format(new Date()) + " ]";
}
private double getConsumedTime(long start){
return (System.nanoTime() - start) / 1000000000d;
}
private void formatLog(boolean result, String text, long startTime){
if(result){
log(" + [ " + text + " ] " + getConsumedTime(startTime));
}else {
log(" ! [ " + text + " ] " + getConsumedTime(startTime));
}
}
public void printResult(){
double total = getConsumedTime(statTime);
double average = total/totalCounter;
ui.showMessage("\n\t\t ------------- Tests -------------");
log("Total tests: " + totalCounter);
log("Failed: " + (totalCounter - successCounter));
log("Total time: " + total);
log("AverageTime: " + average);
}
}
| [
"alekseykosarevski@gmail.com"
] | alekseykosarevski@gmail.com |
dc67ac9c26ec2f66f82592323505aff3d43fed2e | b0bd521a07437cc9e4a11ae2d6a637908558fbf4 | /Exercícios/src/uri1007/src/Main.java | befa948402870c3494075e1928dc0d41d4c80ed3 | [
"MIT"
] | permissive | ErinaldoFerreira/CursoNelioAlves-Java | e03328b73f723e6d58ac837bf274d183f52fc936 | b8c5009d6baae95d924c52db43c0e19a5865201f | refs/heads/master | 2022-08-03T03:21:36.594587 | 2020-05-21T21:02:29 | 2020-05-21T21:02:29 | 265,949,539 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 323 | java | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int A, B, C, D, dif;
Scanner sc = new Scanner(System.in);
A = sc.nextInt();
B = sc.nextInt();
C = sc.nextInt();
D = sc.nextInt();
dif = A*B-C*D;
System.out.println("DIFERENCA = " + dif);
sc.close();
}
}
| [
"erinaldopaladino@gmail.com"
] | erinaldopaladino@gmail.com |
d4b66f7f0929389a0baead0a840e2b1cf366ed5b | 14abd5c5a4582feb4eba6e3f8529d636ab57cf2b | /src/main/java/UserDao.java | d9f3edbb36d9950e8c45d339917c12f0850f38e6 | [] | no_license | liang-1997/ideaTestGit | 713586c05fb0f8b9b9c58b20aa0fa3792802af60 | 2312b2857e2f9658ba313c9cf8ef7cb1e44f0095 | refs/heads/master | 2023-02-16T15:29:36.983902 | 2021-01-18T05:39:57 | 2021-01-18T05:39:57 | 325,538,422 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 258 | java | import java.util.HashMap;
import java.util.List;
public interface UserDao {
List<User> queryAllUser();
List<User> queryUser();
List<User> query();
User getLike(String name);
void testGit();
HashMap<String, User> queryById();
}
| [
"jie18851033137@163.com"
] | jie18851033137@163.com |
7bea432c6e2e2ed6a4586470e6d22efc6e608bbe | a2d377a0a3439899c46a8400c465ee0578d849ac | /VTSApp/app/src/main/java/ssadteam5/vtsapp/DeviceDetailsFragment.java | 0398c80fd9863b85af3403264cb238f1dde1c86d | [] | no_license | dakshlalwani/Location-Tracker-Android-app | 7aabcc9214b4c383da0973d6ceba9abe5e69811c | ae160a1cc704155892ff43b1bd0df2e8098ae41f | refs/heads/master | 2021-08-28T00:38:23.812749 | 2017-12-10T22:16:53 | 2017-12-10T22:16:53 | 111,433,839 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,446 | java | package ssadteam5.vtsapp;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.GradientDrawable;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import org.json.JSONObject;
public class DeviceDetailsFragment extends DialogFragment
{
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState)
{
LayoutInflater l = getActivity().getLayoutInflater();
@SuppressLint("InflateParams") View view = l.inflate(R.layout.fragment_device_details, null);
String vehicleDetails = getArguments().getString("vehicleDetails");
String deviceName = getArguments().getString("deviceName");
TableLayout tl = view.findViewById(R.id.tl);
// tl.setPadding(75, 50, 0, 0);
try
{
JSONObject json = new JSONObject(vehicleDetails);
tl.addView(row("Vehicle name", json.getString("vehicleName")));
// Spannable spannableText = (Spannable) tl.getText();
// tl.setBackgroundColor(Color.BLUE);
// tl.setBackgroundColor(Color.rgb(51, 51, 51)
tl.addView(row("Device ID", json.getString("device")));
tl.addView(row("Vehicle Reg No.", json.getString("vehicleNumber")));
tl.addView(row("Vehicle Type", json.getString("vehicleType")));
tl.addView(row("Purchase Year", json.getString("purchaseYear")));
tl.addView(row("Previous Service", json.getString("serviceOn")));
tl.addView(row("Next Service", json.getString("nextServiceOn")));
tl.addView(row("Notes", json.getString("notes")));
}
catch (Exception e)
{
e.printStackTrace();
}
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("Vehicle Details");
builder.setView(view);
//builder.setMessage(vehicledetails);
builder.setPositiveButton("Track", new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog, int id){
try {
Intent intent = new Intent(getActivity(), TrackVehicleActivity.class);
intent.putExtra("deviceName", deviceName);
startActivity(intent);
}
catch(Exception e)
{
e.printStackTrace();
}
}
});
return builder.create();
}
private TableRow row(String a, String b) {
GradientDrawable gd = new GradientDrawable();
gd.setStroke(2, Color.BLACK);
TableRow tr = new TableRow(getActivity());
TextView tv1 = new TextView(getActivity());
tv1.setTypeface(null, Typeface.BOLD);
tv1.setText(a + ": ");
tr.addView(tv1);
TextView tv2 = new TextView(getActivity());
tv2.setText(b);
tr.addView(tv2);
tr.setPadding(50, 20, 50, 20);
tr.setBackgroundDrawable(gd);
return tr;
}
}
| [
"daksh.lalwani@students.iiit.ac.in"
] | daksh.lalwani@students.iiit.ac.in |
cabd7d5397def6fce9663c9c0f39756693fe0ebf | 26e06ad63f0c96d4bda20f5ff3ea7abe8a896f1b | /005-p2p-web/src/main/java/com/powernode/p2p/controller/IndexController.java | 15dab0e68fde019b661b4feead964c45601bf898 | [] | no_license | AlanLinHY824/p2p | f44037c8c584e3aa5e2534c9e3aa37f5cfa5c511 | ed5ba976745ec454ac51c3e30b0158aa3e7bce21 | refs/heads/master | 2023-02-04T09:46:39.231072 | 2020-12-13T14:23:59 | 2020-12-13T14:23:59 | 303,940,005 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,757 | java | package com.powernode.p2p.controller;
import com.alibaba.dubbo.config.annotation.Reference;
import com.powernode.p2p.constants.MyConstants;
import com.powernode.p2p.model.BLoanInfo;
import com.powernode.p2p.service.BidService;
import com.powernode.p2p.service.LoanService;
import com.powernode.p2p.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author AlanLin
* @Description
* @Date 2020/10/12
*/
@Controller
public class IndexController {
@Reference(interfaceClass = LoanService.class,timeout = 20000,version = "1.0.0",check = false,cluster = "failover",loadbalance = "random")
private LoanService loanService;
@Reference(interfaceClass = UserService.class,timeout = 20000,version = "1.0.0",check = false,cluster = "failover",loadbalance = "random")
private UserService userService;
@Reference(interfaceClass = BidService.class,timeout = 20000,version = "1.0.0",check = false,cluster = "failover",loadbalance = "random")
private BidService bidService;
/**
* 查询首页所需数据并跳转到页面
* @param model
* @return
*/
@RequestMapping("/index")
public String index(Model model, HttpSession session){
//查询历史平均利率
Double hisAvgRate = loanService.queryHisAvgRate();
model.addAttribute(MyConstants.HISAVGRATE,hisAvgRate);
//用户总数
Long userCount = userService.queryUserCount();
model.addAttribute(MyConstants.USERCOUNT,userCount);
//查询交易总额
Double totalDealAmount=bidService.queryTotalDealAmount();
model.addAttribute(MyConstants.TOTALDEALAMOUNT,totalDealAmount);
Map<String,Object> condition =new HashMap<>();
condition.put("type", 0);
condition.put("start", 0);
condition.put("length", 1);
List<BLoanInfo> bLoanInfos_X = loanService.queryLoanInfoByTypeAndNum(condition);
model.addAttribute(MyConstants.BLOANINFOS_X, bLoanInfos_X);
condition.put("type", 1);
condition.put("start", 0);
condition.put("length", 4);
List<BLoanInfo> bLoanInfos_Y = loanService.queryLoanInfoByTypeAndNum(condition);
model.addAttribute(MyConstants.BLOANINFOS_Y, bLoanInfos_Y);
condition.put("type", 2);
condition.put("start", 0);
condition.put("length", 8);
List<BLoanInfo> bLoanInfos_S = loanService.queryLoanInfoByTypeAndNum(condition);
model.addAttribute(MyConstants.BLOANINFOS_S, bLoanInfos_S);
return "index";
}
}
| [
"alanlin824@aliyun.com"
] | alanlin824@aliyun.com |
4668d23543726db14f425b745b8844c48c5ad706 | 43febd7f97aed5fdc8b6a104ae1d2962fd1ca851 | /taotao-eureka/src/main/java/com/taotao/erureka/entity/A.java | d8667ff2e29e993027f21a1ea7f825283026c7f4 | [] | no_license | mybug99/spring-cloud-jwt-ByteTCC | e867a3d742cd7efdcdb4615978f7a5ab8f3213e7 | 34695242b867c7ce7c53ec197b7495a1e5e2cec0 | refs/heads/master | 2022-06-03T11:12:24.773838 | 2019-05-29T09:05:24 | 2019-05-29T09:05:24 | 174,918,918 | 5 | 0 | null | 2022-05-20T20:54:50 | 2019-03-11T03:25:05 | Java | UTF-8 | Java | false | false | 312 | java | package com.taotao.erureka.entity;
public class A {
public String name = "A";
static {
System.out.println("A的static");
}
public A(){
System.out.println(this);
System.out.println("A的无参");
}
public void aabb(){
System.out.println("aabb");
}
}
| [
"guxin8989@163.com"
] | guxin8989@163.com |
48ae10ae24f2939161e2b8299f04c1a5f1c3d348 | 178cb3c5735b0b5e11a030fb5c276ac88f94e701 | /plugins/java-decompiler/engine/testData/src/pkg/TestSwitchOnStringsEcj.java | 9cf451aaca78f9d6496b862faa0c90ea1be9a1da | [
"Apache-2.0"
] | permissive | michaelsiepmann/intellij-community | 6b4495f5ee3399c28eff9f22a4773dd24d8abb20 | 9539e7b156f3f4b2fcde5e6160798e29abcc1aaf | refs/heads/master | 2022-01-23T18:34:40.332804 | 2022-01-04T10:10:46 | 2022-01-04T10:37:19 | 136,669,423 | 0 | 0 | Apache-2.0 | 2019-05-21T21:54:03 | 2018-06-08T21:56:11 | null | UTF-8 | Java | false | false | 4,028 | java | package pkg;
public class TestSwitchOnStringsEcj {
String s;
static final String S = "";
void noCase() {
switch (getStr()) {
}
}
void oneCase(String s) {
System.out.println(1);
switch (s) {
case "xxx":
System.out.println(2);
break;
}
System.out.println(3);
}
void oneCaseWithDefault() {
System.out.println(1);
switch (s) {
case "xxx":
System.out.println(2);
break;
default:
System.out.println(3);
break;
}
System.out.println(4);
}
void multipleCases1() {
System.out.println(1);
switch (S) {
case "xxx":
System.out.println(2);
break;
case "yyy":
System.out.println(3);
break;
}
System.out.println(4);
}
void multipleCasesWithDefault1() {
System.out.println(1);
switch (getStr()) {
case "xxx":
System.out.println(2);
break;
case "yyy":
System.out.println(3);
break;
default:
System.out.println(4);
break;
}
System.out.println(5);
}
void multipleCases2() {
System.out.println(1);
switch (S) {
case "xxx":
System.out.println(2);
break;
case "yyy":
System.out.println(3);
break;
case "zzz":
System.out.println(4);
break;
}
System.out.println(5);
}
void multipleCasesWithDefault2() {
System.out.println(1);
switch (getStr()) {
case "xxx":
System.out.println(2);
break;
case "yyy":
System.out.println(3);
break;
case "zzz":
System.out.println(4);
break;
default:
System.out.println(5);
break;
}
System.out.println(6);
}
void combined() {
System.out.println("started");
if (s.length() > 0) {
System.out.println();
switch(s) {
case "b" -> System.out.println(1);
case "d" -> System.out.println(2);
case "a" -> System.out.println(3);
case "f" -> System.out.println(4);
default -> System.out.println(Math.random());
}
System.out.println(s);
combined();
} else {
try {
switch (getStr()) {
case "h":
case "i":
while (s != null) {
try {
if (s.length() == 1) {
System.out.println(s);
}
} catch (NullPointerException e) {
System.out.println(e.getMessage());
}
}
System.out.println(5);
case "j":
case "f":
System.out.println(6);
return;
default:
System.out.println(7);
}
} catch (NullPointerException e) {
for (int i = 0; i < 10; i++) {
switch (getStr()) {
case S -> System.out.println(8);
default -> System.out.println(e.getMessage());
}
}
System.out.println(9);
}
}
System.out.println("finished");
}
String getStr() {
return "";
}
}
| [
"intellij-monorepo-bot-no-reply@jetbrains.com"
] | intellij-monorepo-bot-no-reply@jetbrains.com |
33033d391905e225beaee0fd9f300e939b9a23fb | ebdcaff90c72bf9bb7871574b25602ec22e45c35 | /modules/adwords_appengine/src/main/java/com/google/api/ads/adwords/jaxws/v201809/cm/MediaServiceInterfaceupload.java | d242cdc808d5c3881f6a1b9b9dec579ee70c0124 | [
"Apache-2.0"
] | permissive | ColleenKeegan/googleads-java-lib | 3c25ea93740b3abceb52bb0534aff66388d8abd1 | 3d38daadf66e5d9c3db220559f099fd5c5b19e70 | refs/heads/master | 2023-04-06T16:16:51.690975 | 2018-11-15T20:50:26 | 2018-11-15T20:50:26 | 158,986,306 | 1 | 0 | Apache-2.0 | 2023-04-04T01:42:56 | 2018-11-25T00:56:39 | Java | UTF-8 | Java | false | false | 2,830 | java | // Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.api.ads.adwords.jaxws.v201809.cm;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
*
* Uploads new media. Currently, you can upload {@link Image} files and {@link MediaBundle}s.
*
* @param media A list of {@code Media} objects, each containing the data to
* be uploaded.
* @return A list of uploaded media in the same order as the argument list.
*
*
* <p>Java class for upload element declaration.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <element name="upload">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="media" type="{https://adwords.google.com/api/adwords/cm/v201809}Media" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"media"
})
@XmlRootElement(name = "upload")
public class MediaServiceInterfaceupload {
protected List<Media> media;
/**
* Gets the value of the media property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the media property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getMedia().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Media }
*
*
*/
public List<Media> getMedia() {
if (media == null) {
media = new ArrayList<Media>();
}
return this.media;
}
}
| [
"jradcliff@users.noreply.github.com"
] | jradcliff@users.noreply.github.com |
e65eb4daef1769bc85d79257ea01f81f7225550f | 521fbbcb9570e455184200d3035ff17e897029dd | /src/main/java/by/jrr/learn/lecture15NestedClasses/src/main/java/by/jrr/learn/lecture15NestedClasses/src/main/java/nestedclasses/bestpractisebuilding/Apartment.java | 1362e4fe01f0d70b3d8648ef7ce641dd9e8fcd9f | [] | no_license | ArtikTico/JIS7 | 01d213638fb345b35b319bb8b3bef17558351d42 | f247f8d8493122238b41b49168f827337ac9971f | refs/heads/release | 2023-06-22T18:23:12.558579 | 2021-07-17T09:39:34 | 2021-07-17T09:39:34 | 350,488,257 | 0 | 2 | null | 2021-07-23T09:40:54 | 2021-03-22T21:01:14 | Java | UTF-8 | Java | false | false | 275 | java | package nestedclasses.bestpractisebuilding;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@Data
@AllArgsConstructor
@Builder
public class Apartment {
private int number;
private int floor; //этаж
private int numberOfRooms;
}
| [
"articzander@mail.ru"
] | articzander@mail.ru |
8e29cfef03595279709bfdeb79626d27af634e3b | 6cfcecad9f632175909d354d0226ce850656e24c | /app/src/main/java/com/example/umut/popular_movies_stage_1/MoviesAdapter.java | 5744d0e7616c74a4afd73c02a82036aa6ef5d383 | [] | no_license | UmutFlash/movies_stage_1 | 8b61814a6b3477ccb838c6edb148e9ef5e67ab63 | 1767a1a843a7a12c82431e51cdafb78a48a303be | refs/heads/master | 2020-04-23T11:28:27.437968 | 2019-02-21T09:45:04 | 2019-02-21T09:45:04 | 169,999,707 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,093 | java | package com.example.umut.popular_movies_stage_1;
import android.app.Activity;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import com.squareup.picasso.Picasso;
public class MoviesAdapter extends ArrayAdapter<Movie> {
MoviesAdapter(Activity context, Movie[] movieCollection) {
super(context, 0, movieCollection);
}
@NonNull
@Override
public View getView(int position, View convertView, @NonNull ViewGroup parent) {
Movie movie = getItem(position);
if (convertView == null) {
convertView = LayoutInflater.from(getContext()).inflate(
R.layout.poster_item, parent, false);
}
ImageView imageView = (ImageView) convertView.findViewById(R.id.poster_image);
Picasso.get().
load(movie != null ? movie.getmPosterPath() : null)
.resize(185, 278).into(imageView);
return convertView;
}
}
| [
"umut.yildirim@gmx.net"
] | umut.yildirim@gmx.net |
e392364a3d24edaaf031c85f4664a48255bca6f9 | a8f57fdf1339039f2ae19841eb624df0732f8b69 | /src/com/newIns/service/imp/NiLotteryStatisticsServiceImp.java | 26f873009b2b9032f06a96960998d8cebaa4e52c | [] | no_license | sangpf/xdc_NIMS | 2db7e58342c4479b7988c5aca37dfc63fdd66b47 | b42bc845f1870e470ad367dde12a78dfbd871526 | refs/heads/master | 2020-04-06T10:56:56.509664 | 2018-11-13T13:37:19 | 2018-11-13T13:37:19 | 157,397,918 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,365 | java | package com.newIns.service.imp;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.newIns.dao.NiLotteryStatisticsMapper;
import com.newIns.model.NiLotteryStatistics;
import com.newIns.service.NiLotteryStatisticsService;
/**
* @author lj
* @Description : 抽奖统计的Service实现类
* @time : 2016年8月16日 下午4:29:11
*/
@Service
public class NiLotteryStatisticsServiceImp implements
NiLotteryStatisticsService {
@Resource
private NiLotteryStatisticsMapper niLotteryStatisticsMapper;
/**
* @author lj
* @Description : 根据条件查询调查玩校抽奖统计
* @time : 2016年8月16日 下午4:50:28
* @param hashMap
* @return List<NiLotteryStatistics>
*/
public List<NiLotteryStatistics> selectSurveyWanxLotteryList(
HashMap<String, Object> hashMap) {
// TODO Auto-generated method stub
List<NiLotteryStatistics> niLotteryStatisticsList=niLotteryStatisticsMapper.selectSurveyWanxLotteryList(hashMap);
//填充其它属性
for(NiLotteryStatistics niLotteryStatistics:niLotteryStatisticsList){
int sqnId=niLotteryStatistics.getQnId();
niLotteryStatistics.setChannel(1);
niLotteryStatistics.setChannelStr("玩校");
niLotteryStatistics.setType(1);
niLotteryStatistics.setTypeStr("调查");
niLotteryStatistics.setValidOrderNum(selectSurveyWanxLotteryValidOrderNum(sqnId));
niLotteryStatistics.setTakePartNum(selectSurveyWanxLotteryTakePartNum(sqnId));
niLotteryStatistics.setAward3ReceiveNum(selectSurveyWanxLotteryAward3ReceiveNum(sqnId));
niLotteryStatistics.setAward2ReceiveNum(selectSurveyWanxLotteryAward2ReceiveNum(sqnId));
niLotteryStatistics.setAward1ReceiveNum(selectSurveyWanxLotteryAward1ReceiveNum(sqnId));
}
return niLotteryStatisticsList;
}
/**
* @author lj
* @Description : 调查玩校投放抽奖有效订单数统计
* @time : 2016年8月16日 下午4:30:54
* @param sqnId
* @return int
*/
public int selectSurveyWanxLotteryValidOrderNum(Integer sqnId) {
// TODO Auto-generated method stub
int surveyWanxLotteryValidOrderNum=niLotteryStatisticsMapper.selectSurveyWanxLotteryValidOrderNum(sqnId);
return surveyWanxLotteryValidOrderNum;
}
/**
* @author lj
* @Description : 调查玩校投放抽奖参与人数统计
* @time : 2016年8月16日 下午4:32:36
* @param sqnId
* @return int
*/
public int selectSurveyWanxLotteryTakePartNum(Integer sqnId) {
// TODO Auto-generated method stub
int surveyWanxLotteryTakePartNum=niLotteryStatisticsMapper.selectSurveyWanxLotteryTakePartNum(sqnId);
return surveyWanxLotteryTakePartNum;
}
/**
* @author lj
* @Description : 调查玩校投放抽奖三等奖领取人数统计
* @time : 2016年8月16日 下午4:37:50
* @param sqnId
* @return int
*/
public int selectSurveyWanxLotteryAward3ReceiveNum(Integer sqnId) {
// TODO Auto-generated method stub
int surveyWanxLotteryAward3ReceiveNum=niLotteryStatisticsMapper.selectSurveyWanxLotteryAward3ReceiveNum(sqnId);
return surveyWanxLotteryAward3ReceiveNum;
}
/**
* @author lj
* @Description : 调查玩校投放抽奖二等奖领取人数统计
* @time : 2016年8月16日 下午4:38:49
* @param sqnId
* @return int
*/
public int selectSurveyWanxLotteryAward2ReceiveNum(Integer sqnId) {
// TODO Auto-generated method stub
int surveyWanxLotteryAward2ReceiveNum=niLotteryStatisticsMapper.selectSurveyWanxLotteryAward2ReceiveNum(sqnId);
return surveyWanxLotteryAward2ReceiveNum;
}
/**
* @author lj
* @Description : 调查玩校投放抽奖一等奖领取人数统计
* @time : 2016年8月16日 下午4:39:30
* @param sqnId
* @return int
*/
public int selectSurveyWanxLotteryAward1ReceiveNum(Integer sqnId) {
// TODO Auto-generated method stub
int surveyWanxLotteryAward1ReceiveNum=niLotteryStatisticsMapper.selectSurveyWanxLotteryAward1ReceiveNum(sqnId);
return surveyWanxLotteryAward1ReceiveNum;
}
/**
* @author lj
* @Description : 根据条件查询测评玩校抽奖统计
* @time : 2016年8月16日 下午5:14:17
* @param hashMap
* @return List<NiLotteryStatistics>
*/
public List<NiLotteryStatistics> selectAssessWanxLotteryList(
HashMap<String, Object> hashMap) {
// TODO Auto-generated method stub
List<NiLotteryStatistics> niLotteryStatisticsList=niLotteryStatisticsMapper.selectAssessWanxLotteryList(hashMap);
//填充其它属性
for(NiLotteryStatistics niLotteryStatistics:niLotteryStatisticsList){
int aqnId=niLotteryStatistics.getQnId();
niLotteryStatistics.setChannel(1);
niLotteryStatistics.setChannelStr("玩校");
niLotteryStatistics.setType(2);
niLotteryStatistics.setTypeStr("测评");
niLotteryStatistics.setValidOrderNum(selectAssessWanxLotteryValidOrderNum(aqnId));
niLotteryStatistics.setTakePartNum(selectAssessWanxLotteryTakePartNum(aqnId));
niLotteryStatistics.setAward3ReceiveNum(selectAssessWanxLotteryAward3ReceiveNum(aqnId));
niLotteryStatistics.setAward2ReceiveNum(selectAssessWanxLotteryAward2ReceiveNum(aqnId));
niLotteryStatistics.setAward1ReceiveNum(selectAssessWanxLotteryAward1ReceiveNum(aqnId));
}
return niLotteryStatisticsList;
}
/**
* @author lj
* @Description : 测评玩校投放抽奖有效订单数统计
* @time : 2016年8月16日 下午4:40:33
* @param aqnId
* @return int
*/
public int selectAssessWanxLotteryValidOrderNum(Integer aqnId) {
// TODO Auto-generated method stub
int assessWanxLotteryValidOrderNum=niLotteryStatisticsMapper.selectAssessWanxLotteryValidOrderNum(aqnId);
return assessWanxLotteryValidOrderNum;
}
/**
* @author lj
* @Description : 测评玩校投放抽奖参与人数统计
* @time : 2016年8月16日 下午4:41:35
* @param aqnId
* @return int
*/
public int selectAssessWanxLotteryTakePartNum(Integer aqnId) {
// TODO Auto-generated method stub
int assessWanxLotteryTakePartNum=niLotteryStatisticsMapper.selectAssessWanxLotteryTakePartNum(aqnId);
return assessWanxLotteryTakePartNum;
}
/**
* @author lj
* @Description : 测评玩校投放抽奖三等奖领取人数统计
* @time : 2016年8月16日 下午4:42:34
* @param aqnId
* @return int
*/
public int selectAssessWanxLotteryAward3ReceiveNum(Integer aqnId) {
// TODO Auto-generated method stub
int assessWanxLotteryAward3ReceiveNum=niLotteryStatisticsMapper.selectAssessWanxLotteryAward3ReceiveNum(aqnId);
return assessWanxLotteryAward3ReceiveNum;
}
/**
* @author lj
* @Description : 测评玩校投放抽奖二等奖领取人数统计
* @time : 2016年8月16日 下午4:43:16
* @param aqnId
* @return int
*/
public int selectAssessWanxLotteryAward2ReceiveNum(Integer aqnId) {
// TODO Auto-generated method stub
int assessWanxLotteryAward2ReceiveNum=niLotteryStatisticsMapper.selectAssessWanxLotteryAward2ReceiveNum(aqnId);
return assessWanxLotteryAward2ReceiveNum;
}
/**
* @author lj
* @Description : 测评玩校投放抽奖一等奖领取人数统计
* @time : 2016年8月16日 下午4:44:04
* @param aqnId
* @return int
*/
public int selectAssessWanxLotteryAward1ReceiveNum(Integer aqnId) {
// TODO Auto-generated method stub
int assessWanxLotteryAward1ReceiveNum=niLotteryStatisticsMapper.selectAssessWanxLotteryAward1ReceiveNum(aqnId);
return assessWanxLotteryAward1ReceiveNum;
}
/**
* @author lj
* @Description : 根据条件查询投票玩校抽奖统计
* @time : 2016年8月16日 下午5:18:05
* @param hashMap
* @return List<NiLotteryStatistics>
*/
public List<NiLotteryStatistics> selectVoteWanxLotteryList(
HashMap<String, Object> hashMap) {
// TODO Auto-generated method stub
List<NiLotteryStatistics> niLotteryStatisticsList=niLotteryStatisticsMapper.selectVoteWanxLotteryList(hashMap);
//填充其它属性
for(NiLotteryStatistics niLotteryStatistics: niLotteryStatisticsList){
int vqnId=niLotteryStatistics.getQnId();
niLotteryStatistics.setChannel(1);
niLotteryStatistics.setChannelStr("玩校");
niLotteryStatistics.setType(3);
niLotteryStatistics.setTypeStr("投票");
niLotteryStatistics.setValidOrderNum(selectVoteWanxLotteryValidOrderNum(vqnId));
niLotteryStatistics.setTakePartNum(selectVoteWanxLotteryTakePartNum(vqnId));
niLotteryStatistics.setAward3ReceiveNum(selectVoteWanxLotteryAward3ReceiveNum(vqnId));
niLotteryStatistics.setAward2ReceiveNum(selectVoteWanxLotteryAward2ReceiveNum(vqnId));
niLotteryStatistics.setAward1ReceiveNum(selectVoteWanxLotteryAward1ReceiveNum(vqnId));
}
return niLotteryStatisticsList;
}
/**
* @author lj
* @Description : 投票玩校投放抽奖有效订单数统计
* @time : 2016年8月16日 下午4:44:52
* @param vqnId
* @return int
*/
public int selectVoteWanxLotteryValidOrderNum(Integer vqnId) {
// TODO Auto-generated method stub
int voteWanxLotteryValidOrderNum=niLotteryStatisticsMapper.selectVoteWanxLotteryValidOrderNum(vqnId);
return voteWanxLotteryValidOrderNum;
}
/**
* @author lj
* @Description : 投票玩校投放抽奖参与人数统计
* @time : 2016年8月16日 下午4:46:02
* @param vqnId
* @return int
*/
public int selectVoteWanxLotteryTakePartNum(Integer vqnId) {
// TODO Auto-generated method stub
int voteWanxLotteryTakePartNum=niLotteryStatisticsMapper.selectVoteWanxLotteryTakePartNum(vqnId);
return voteWanxLotteryTakePartNum;
}
/**
* @author lj
* @Description : 投票玩校投放抽奖三等奖领取人数统计
* @time : 2016年8月16日 下午4:46:51
* @param vqnId
* @return int
*/
public int selectVoteWanxLotteryAward3ReceiveNum(Integer vqnId) {
// TODO Auto-generated method stub
int voteWanxLotteryAward3ReceiveNum=niLotteryStatisticsMapper.selectVoteWanxLotteryAward3ReceiveNum(vqnId);
return voteWanxLotteryAward3ReceiveNum;
}
/**
* @author lj
* @Description : 投票玩校投放抽奖二等奖领取人数统计
* @time : 2016年8月16日 下午4:48:05
* @param vqnId
* @return int
*/
public int selectVoteWanxLotteryAward2ReceiveNum(Integer vqnId) {
// TODO Auto-generated method stub
int voteWanxLotteryAward2ReceiveNum=niLotteryStatisticsMapper.selectVoteWanxLotteryAward2ReceiveNum(vqnId);
return voteWanxLotteryAward2ReceiveNum;
}
/**
* @author lj
* @Description : 投票玩校投放抽奖一等奖领取人数统计
* @time : 2016年8月16日 下午4:49:11
* @param vqnId
* @return int
*/
public int selectVoteWanxLotteryAward1ReceiveNum(Integer vqnId) {
// TODO Auto-generated method stub
int voteWanxLotteryAward1ReceiveNum=niLotteryStatisticsMapper.selectVoteWanxLotteryAward1ReceiveNum(vqnId);
return voteWanxLotteryAward1ReceiveNum;
}
/**
* @author lj
* @Description : 根据条件得到抽奖统计List
* @time : 2016年8月16日 下午5:25:06
* @param hashMap
* @return List<NiLotteryStatistics>
*/
public List<NiLotteryStatistics> getLotteryStatisticsList(
HashMap<String, Object> hashMap) {
// TODO Auto-generated method stub
List<NiLotteryStatistics> niLotteryStatisticsList=new ArrayList<NiLotteryStatistics>();
niLotteryStatisticsList.addAll(selectSurveyWanxLotteryList(hashMap));
niLotteryStatisticsList.addAll(selectAssessWanxLotteryList(hashMap));
niLotteryStatisticsList.addAll(selectVoteWanxLotteryList(hashMap));
return niLotteryStatisticsList;
}
/**
* @author lj
* @Description : 导出抽奖统计表格
* @time : 2016年8月16日 下午6:06:40
* @param deliveryId
* @param channel
* @param type
* @return List<NiLotteryStatistics>
*/
public List<NiLotteryStatistics> exportLotteryStatisticsSheet(
String deliveryId_str, String channel_str, String type_str) {
// TODO Auto-generated method stub
List<NiLotteryStatistics> niLotteryStatisticsList=new ArrayList<NiLotteryStatistics>();
String []deliveryId_arr=deliveryId_str.split("!");
String []channel_arr=channel_str.split("!");
String []type_arr=type_str.split("!");
//前端接收的参数字符串是逆序拼接的,所以采用每次减1的循环
for(int i=deliveryId_arr.length-1;i>=0;i--){
String deliveryId=deliveryId_arr[i];
String channel=channel_arr[i];
String type=type_arr[i];
int channel_int=0;
int type_int=0;
HashMap<String, Object> hashMap=new HashMap<String, Object>();
if(deliveryId != null && !("".equals(deliveryId))){
hashMap.put("deliveryId", Integer.valueOf(deliveryId));
}
if(channel != null && !("".equals(channel))){
channel_int=Integer.valueOf(channel);
}
if(type != null && !("".equals(type))){
type_int=Integer.valueOf(type);
}
if(channel_int == 1){
//玩校渠道
if(type_int == 1){
//调查类型
niLotteryStatisticsList.addAll(selectSurveyWanxLotteryList(hashMap));
}else if(type_int == 2){
//测评类型
niLotteryStatisticsList.addAll(selectAssessWanxLotteryList(hashMap));
}else if(type_int == 3){
//投票类型
niLotteryStatisticsList.addAll(selectVoteWanxLotteryList(hashMap));
}
}
}
return niLotteryStatisticsList;
}
/**
* @author lj
* @Description : 导出抽奖统计时的编码转换
* @time : 2016年8月16日 下午7:03:46
* @param niLotteryStatisticsList
* @return List<NiLotteryStatistics>
*/
public List<NiLotteryStatistics> codingConvert(
List<NiLotteryStatistics> niLotteryStatisticsList) {
// TODO Auto-generated method stub
for(NiLotteryStatistics niLotteryStatistics:niLotteryStatisticsList){
switch (niLotteryStatistics.getStatus()) {
//1待投放;2投放中;3暂停中;4人工终止;5时间完成;6数量完成
case 1:
niLotteryStatistics.setStatusStr("待投放");
break;
case 2:
niLotteryStatistics.setStatusStr("投放中");
break;
case 3:
niLotteryStatistics.setStatusStr("暂停中");
break;
case 4:
niLotteryStatistics.setStatusStr("人工终止");
break;
case 5:
niLotteryStatistics.setStatusStr("时间完成");
break;
case 6:
niLotteryStatistics.setStatusStr("数量完成");
break;
default:
break;
}
}
return niLotteryStatisticsList;
}
/**
* @author lj
* @Description : 得到导出的抽奖统计excel列
* @time : 2016年8月16日 下午7:04:06
* @return LinkedHashMap<String, String>
*/
public LinkedHashMap<String, String> getExportLotteryStatisticsColumn() {
// TODO Auto-generated method stub
LinkedHashMap<String, String> fieldMap=new LinkedHashMap<String, String>();
fieldMap.put("deliveryId", "报告id");
fieldMap.put("qnName", "问卷名称");
fieldMap.put("channelStr", "渠道");
fieldMap.put("statusStr", "状态");
fieldMap.put("typeStr", "类型");
fieldMap.put("validOrderNum", "有效订单数");
fieldMap.put("takePartNum", "参与抽奖人数");
fieldMap.put("award3Name", "三等奖名称");
fieldMap.put("award3Id", "三等奖奖品ID");
fieldMap.put("award3ReceiveNum", "领取人数");
fieldMap.put("award2Name", "二等奖名称");
fieldMap.put("award2Id", "二等奖奖品ID");
fieldMap.put("award2ReceiveNum", "领取人数");
fieldMap.put("award1Name", "一等奖名称");
fieldMap.put("award1Id", "一等奖奖品ID");
fieldMap.put("award1ReceiveNum", "领取人数");
return fieldMap;
}
}
| [
"sangpf@163.com"
] | sangpf@163.com |
2a2e2ea1a15c6d24b9b466298e45ff4cf84fef98 | eab23692fd713eaed41256e128a8e10ef52655d6 | /src/main/java/demo/controller/Menu01Controller.java | e49a9df5a92a29e25669c94ddf1e292e9ab40f33 | [] | no_license | hengguo/javaee_springmvc_maven | a8b15caa5b46b844c368909390b6aab76a3caaf5 | 4469df77052e4f873077d319627dac4bc438e9b1 | refs/heads/master | 2021-01-19T13:32:11.779560 | 2015-05-12T01:18:24 | 2015-05-12T01:18:24 | 24,140,207 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,501 | java | package demo.controller;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import demo.domain.User;
@Controller
@RequestMapping(value="/menu01")
public class Menu01Controller {
@RequestMapping(value = "/page1", produces = "text/plain;charset=utf-8")
@ResponseBody
public ModelAndView page1(HttpServletRequest request, HttpServletResponse response) {
return new ModelAndView("menu01/page1");
}
@RequestMapping(value = "/page2", produces = "text/plain;charset=utf-8")
@ResponseBody
public ModelAndView page2(HttpServletRequest request, HttpServletResponse response) {
List<User> users = new ArrayList<User>();
User u1 = new User();
u1.setCreateTime(new Date());u1.setName("A1");
User u2 = new User();
u2.setCreateTime(new Date());u2.setName("A2");
users.add(u1);users.add(u2);
request.setAttribute("test", "ttt");
return new ModelAndView("userList", "users", users);
}
@RequestMapping(value="/autocompleteView", produces = "text/plain;charset=utf-8")
@ResponseBody
public ModelAndView autocompleteView(HttpServletRequest request, HttpServletResponse response) {
return new ModelAndView("menu01/autocomplete");
}
}
| [
"abcd19921007@163.com"
] | abcd19921007@163.com |
3b0d458b7d097898855817b88b8ab61c0f3370e5 | 841060e745df2c24e6a4f2370ab2d50d4a66b250 | /guava-gwt/test/com/google/common/primitives/TestModuleEntryPoint.java | 23c6337017fddc5af84265d4e979f2b4e6a7ce52 | [
"Apache-2.0"
] | permissive | yangfancoming/guava-parent | 2d61b596fbce5ee82896a00e02f0490a8db2dcc1 | bda34e5e2a9ebfc0d4ff29077a739d542e736299 | refs/heads/master | 2021-06-19T23:21:36.712821 | 2019-07-26T06:50:48 | 2019-07-26T06:50:48 | 198,820,961 | 0 | 0 | Apache-2.0 | 2021-03-31T21:26:52 | 2019-07-25T11:45:39 | Java | UTF-8 | Java | false | false | 272 | java |
package com.google.common.primitives;
import com.google.gwt.core.client.EntryPoint;
/**
* A dummy entry point of the test module.
*
* @author Hayward Chan
*/
public class TestModuleEntryPoint implements EntryPoint {
@Override public void onModuleLoad() {
}
}
| [
"34465021+jwfl724168@users.noreply.github.com"
] | 34465021+jwfl724168@users.noreply.github.com |
99378511ab822f884370bbdbe3af7c9ea32c9d78 | 43f9cb4974216ea2ad8ded563b9de60c442f588e | /Quality Assurance/TestNG_Practice/src/com/Parameter/testUtil.java | a31079830fc447f479d3755c86a2c18b330f7a01 | [] | no_license | sudoAshishTiwari/ordinalRepo | 037c3e604e2936bc58370a57cfedbcfbfa6e8e6d | f275de03d518e098b9b159e7c1cbdcec5ccc023c | refs/heads/master | 2020-12-01T17:47:03.997806 | 2020-01-21T12:51:20 | 2020-01-21T12:51:20 | 230,715,301 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,134 | java | package com.Parameter;
import java.io.FileInputStream;
import java.io.FilterInputStream;
import java.util.ArrayList;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
public class testUtil {
public static ArrayList<Object[]> getDataExcel()
{
ArrayList<Object[]> mydata = new ArrayList<Object[]>();
try {
FileInputStream file = new FileInputStream("C:\\Users\\Ashish\\eclipse-workspace\\UserFile.xlsx");
XSSFWorkbook wordbook = new XSSFWorkbook(file);
XSSFSheet currentSheet = wordbook.getSheet("Sheet1");
int rowNum= currentSheet.getLastRowNum();
for (int i=1;i<rowNum;i++)
{
XSSFRow currentRow =currentSheet.getRow(i);
//XSSFCell currentCell = currentRow.getCell(0);
XSSFCell username = currentRow.getCell(0);
}
}
catch(Exception e)
{
e.printStackTrace();
}
return mydata;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
07acab7f52884df4539662e878afa1652e2539b8 | 911108af93f7cc29cf66a63b2bda627d3c6e03a1 | /src/main/java/com/kino/beta/threadPool/ThreadPoolTest.java | 31e744c2f119580414a8d9cab0108bd00ad2ee90 | [] | no_license | jynvch/multithreading | 89322c1b59d9f4210ca3b72b69be3fff41f1d18a | c0f25f855743ece04ad2b811d5eee9dd2322acca | refs/heads/master | 2023-03-09T16:01:46.445477 | 2019-02-02T03:00:52 | 2019-02-02T03:00:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,267 | java | package com.kino.beta.threadPool;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Vector;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
public class ThreadPoolTest {
class MyTask implements Runnable{
private int taskNum;
public MyTask(int taskNum) {
super();
this.taskNum = taskNum;
}
@Override
public void run() {
System.out.println("正在执行任务:"+taskNum);
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("任务执行完毕:"+taskNum);
}
}
public static void main(String[] args) throws InterruptedException {
Random r = new Random();
Math.random();
System.out.println(r.nextInt(500)+" :"+Math.random());
for (int i = 0; i < 1000; i++) {
System.out.println(250+r.nextInt(250)+" :"+(int)(Math.random()*1000));
}
final ThreadLocal<Integer> a = new ThreadLocal<Integer>();
System.out.println("----"+a.toString());
a.set(1);
System.out.println(a.get());List<Integer> aa = new ArrayList(); Vector<String> bb = new Vector<>();
// new Thread(new Runnable() {
//
// @Override
// public void run() {
// System.out.println(a.get());
// a.set(5);
// System.out.println(a.get());
// }
// }).start();
System.out.println("----------"+a.toString());
a.set(3);
System.out.println(a.get());
// ThreadPoolExecutor executor = new ThreadPoolExecutor(5, 10, 200, TimeUnit.MILLISECONDS,
// new ArrayBlockingQueue<Runnable>(5));
//
// for(int i=0;i<15;i++){
// MyTask myTask = new ThreadPoolTest().new MyTask(i);
// executor.execute(myTask);
// System.out.println("线程池中线程数目:"+executor.getPoolSize()+",队列中等待执行的任务数目:"+
// executor.getQueue().size()+",已执行玩别的任务数目:"+executor.getCompletedTaskCount());
//// Thread.sleep(2000);
// }
//
// executor.shutdown();
}
}
| [
"lu_junjie12@sina.com"
] | lu_junjie12@sina.com |
c73d46a2f39b45eedeb228f092cbfdd25b3a3ead | d26c914ffcf81aa34113c6745685d09f3ae2b873 | /kie-wb-common-stunner/kie-wb-common-stunner-extensions/kie-wb-common-stunner-forms/kie-wb-common-stunner-forms-client/src/main/java/org/kie/workbench/common/stunner/forms/client/widgets/container/displayer/FormDisplayer.java | a8c26b4ef341b632095aae38d16850fabbcf07d7 | [
"Apache-2.0"
] | permissive | kurobako/kie-wb-common | 06708e3053fce77324a9b678fe56f7f07d541240 | 2522f6205038952445d0490513f4b73b87c985d4 | refs/heads/master | 2021-01-25T11:57:14.868454 | 2018-03-08T23:09:13 | 2018-03-08T23:09:13 | 123,449,104 | 0 | 0 | null | 2018-03-01T14:54:09 | 2018-03-01T14:54:08 | null | UTF-8 | Java | false | false | 4,783 | java | /*
* Copyright 2018 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.kie.workbench.common.stunner.forms.client.widgets.container.displayer;
import java.util.logging.Logger;
import javax.annotation.PreDestroy;
import javax.enterprise.context.Dependent;
import javax.inject.Inject;
import org.jboss.errai.common.client.api.IsElement;
import org.jboss.errai.common.client.dom.HTMLElement;
import org.jboss.errai.databinding.client.BindableProxy;
import org.jboss.errai.databinding.client.BindableProxyFactory;
import org.kie.workbench.common.forms.dynamic.client.DynamicFormRenderer;
import org.kie.workbench.common.forms.dynamic.service.shared.FormRenderingContext;
import org.kie.workbench.common.forms.dynamic.service.shared.adf.DynamicFormModelGenerator;
import org.kie.workbench.common.forms.dynamic.service.shared.impl.StaticModelFormRenderingContext;
import org.kie.workbench.common.forms.processing.engine.handling.FieldChangeHandler;
import org.kie.workbench.common.stunner.core.definition.adapter.binding.BindableAdapterUtils;
import org.kie.workbench.common.stunner.core.graph.Element;
import org.kie.workbench.common.stunner.core.graph.content.definition.Definition;
import org.kie.workbench.common.stunner.forms.context.PathAwareFormContext;
import org.uberfire.backend.vfs.Path;
@Dependent
public class FormDisplayer implements FormDisplayerView.Presenter,
IsElement {
private static Logger LOGGER = Logger.getLogger(FormDisplayer.class.getName());
private final FormDisplayerView view;
private final DynamicFormRenderer renderer;
private final DynamicFormModelGenerator modelGenerator;
private String currentDefinitionId;
@Inject
public FormDisplayer(FormDisplayerView view, DynamicFormRenderer renderer, DynamicFormModelGenerator modelGenerator) {
this.view = view;
this.renderer = renderer;
this.modelGenerator = modelGenerator;
view.init(this);
}
public void render(final Element<? extends Definition<?>> element, final Path diagramPath, final FieldChangeHandler changeHandler) {
final Object definition = element.getContent().getDefinition();
String definitionId = getDefinitionId(definition);
LOGGER.fine("Rendering form for element: " + element.getUUID());
// If currentDefinitionId is empty or definitionId is different we must render the form.
// if currentDefinitionId & definitionId are the same means that the form is already rendered so no need to render again
if (null == currentDefinitionId || !definitionId.equals(currentDefinitionId)) {
doRender(definitionId, definition, diagramPath, changeHandler);
} else if (!renderer.isValid()) {
doRender(definitionId, definition, diagramPath, changeHandler);
}
show();
}
private void doRender(String definitionId, Object definition, Path diagramPath, FieldChangeHandler changeHandler) {
if (renderer.isInitialized()) {
LOGGER.fine("Clearing previous form");
renderer.unBind();
}
LOGGER.fine("Rendering a new form for element");
final BindableProxy<?> proxy = (BindableProxy<?>) BindableProxyFactory.getBindableProxy(definition);
final StaticModelFormRenderingContext generatedCtx = modelGenerator.getContextForModel(proxy.deepUnwrap());
final FormRenderingContext<?> pathAwareCtx = new PathAwareFormContext<>(generatedCtx, diagramPath);
currentDefinitionId = definitionId;
renderer.render(pathAwareCtx);
renderer.addFieldChangeHandler(changeHandler);
}
protected String getDefinitionId(Object definition) {
return BindableAdapterUtils.getDefinitionId(definition.getClass());
}
public void show() {
view.show();
}
public void hide() {
view.hide();
}
@Override
public HTMLElement getElement() {
return view.getElement();
}
public void dispose() {
renderer.unBind();
}
@Override
public DynamicFormRenderer getRenderer() {
return renderer;
}
@PreDestroy
public void destroy() {
dispose();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
cee2a5596a4fd4a61903ad1691ef504f7482df62 | 304179ef97c2b064255edbbc82ba68efa0efe2e6 | /app/src/main/java/com/example/pb0386/nimblewirelesstask/activity/LoginActivity.java | 0131112ef12f051ab30da00bad6f9c6e72d74e15 | [] | no_license | paventhanCv/nimblewirelessTaskLatest | 2ffd2cd3327c9ce56d2042101ef30286acc30a80 | 3ba4d7d8d69b7698f3394d784f9b30a46edebb4f | refs/heads/master | 2020-07-05T08:11:13.564738 | 2019-08-15T17:37:15 | 2019-08-15T17:37:15 | 202,584,555 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,662 | java | package com.example.pb0386.nimblewirelesstask.activity;
import android.app.ProgressDialog;
import android.arch.persistence.room.Room;
import android.content.Intent;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.example.pb0386.nimblewirelesstask.R;
import com.example.pb0386.nimblewirelesstask.Database.User;
import com.example.pb0386.nimblewirelesstask.Database.UserDao;
import com.example.pb0386.nimblewirelesstask.Database.UserDatabase;
public class LoginActivity extends AppCompatActivity {
EditText log_username;
EditText log_password;
Button login_button;
Button signup_button;
private UserDatabase database;
private UserDao userDao;
private ProgressDialog progressDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
log_username = findViewById(R.id.log_username);
log_password = findViewById(R.id.log_pasword);
login_button = findViewById(R.id.login_button);
signup_button = findViewById(R.id.sign_up_button);
progressDialog = new ProgressDialog(this);
progressDialog.setCancelable(false);
progressDialog.setMessage("Checking User...");
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progressDialog.setProgress(0);
database = Room.databaseBuilder(this, UserDatabase.class, "nimble-database.db")
.allowMainThreadQueries()
.build();
userDao = database.getUserDao();
login_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
try {
final String str_username = log_username.getText().toString();
final String str_password = log_password.getText().toString();
if (str_username != null && str_password != null) {
progressDialog.show();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
User user = userDao.getUser(str_username, str_password);
if (user != null) {
Intent i = new Intent(LoginActivity.this, MainActivity.class);
startActivity(i);
finish();
} else {
Toast.makeText(LoginActivity.this, "Unregistered user, or incorrect", Toast.LENGTH_SHORT).show();
}
progressDialog.dismiss();
}
}, 1000);
} else {
Toast.makeText(LoginActivity.this, "Empty Fields", Toast.LENGTH_SHORT).show();
}
}
catch (Exception e)
{
e.toString();
}
}
});
signup_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent sign_in_intent = new Intent(LoginActivity.this,SignUpActivity.class);
startActivity(sign_in_intent);
finish();
}
});
}
}
| [
"PB0386@precisionbio.local"
] | PB0386@precisionbio.local |
e7fd4138df55de44db6b75e551a428802f89251d | d255158affa72345a89120292ecfbefc0336fd1c | /src/main/java/com/myblog/wj/entity/personalUser/BlogQQUser.java | e6f53923c0d06675440b389caa61d79b8de61a2d | [] | no_license | WJFight/-Blog | 6fec7ff9cee1d614302304616cd2c80ce7303559 | bd92cc827ea62bc4271910476229809550bee226 | refs/heads/master | 2020-12-01T19:18:09.660642 | 2019-12-29T11:22:35 | 2019-12-29T11:24:37 | 230,739,907 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,819 | java | package com.myblog.wj.entity.personalUser;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
@TableName(value = "blog_qquser")
public class BlogQQUser implements Serializable {
private String nickname;
private String figureurl;
private String gender;
@TableId
private String openid;
private Integer user_id;
public BlogQQUser() {
}
public BlogQQUser(String nickname, String figureurl, String gender, String openid, Integer user_id) {
this.nickname = nickname;
this.figureurl = figureurl;
this.gender = gender;
this.openid = openid;
this.user_id = user_id;
}
@Override
public String toString() {
return "BlogQQUser{" +
"nickname='" + nickname + '\'' +
", figureurl='" + figureurl + '\'' +
", gender='" + gender + '\'' +
", openid='" + openid + '\'' +
", user_id=" + user_id +
'}';
}
public Integer getUser_id() {
return user_id;
}
public void setUser_id(Integer user_id) {
this.user_id = user_id;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getFigureurl() {
return figureurl;
}
public void setFigureurl(String figureurl) {
this.figureurl = figureurl;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getOpenid() {
return openid;
}
public void setOpenid(String openid) {
this.openid = openid;
}
}
| [
"2405870111@qq.com"
] | 2405870111@qq.com |
15f336e09b65bb7d1bc94552f6e6ec08d62ac05d | 34bac26242ed93e073dd4198b22144613fcba897 | /src/main/java/com/github/kneotrino/employee/common/ModelMapUtil.java | fa080709fe84d6c919d03d3657ed5d1753e29905 | [] | no_license | Kneotrino/employee | 2b7b6c0f987b98dc4a23c856943d6ec532435f63 | 898995b7aa90575b284ed6d3d5306af62c32aa3c | refs/heads/master | 2023-03-31T10:26:33.819934 | 2021-04-01T04:02:34 | 2021-04-01T04:04:14 | 346,105,027 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 394 | java | package com.github.kneotrino.employee.common;
import org.modelmapper.ModelMapper;
/**
* @author Kneotrino
* @date 17/12/20
*/
public class ModelMapUtil {
private static ModelMapper modelMapper = null;
public static ModelMapper GetDefaultModelMapper() {
if (modelMapper == null) {
modelMapper = new ModelMapper();
}
return modelMapper;
}
}
| [
"neutrino.sae.b.kusrorong@geteasycash.asia"
] | neutrino.sae.b.kusrorong@geteasycash.asia |
506d7a4b0af03a98053997da10d536f21cdc191b | 995f73d30450a6dce6bc7145d89344b4ad6e0622 | /DVC-AN20_EMUI10.1.1/src/main/java/com/huawei/servicehost/d3d/IIPEvent4D3DResult.java | daa113c980d85692e3c5c5bbb98aa9cb68ecf103 | [] | no_license | morningblu/HWFramework | 0ceb02cbe42585d0169d9b6c4964a41b436039f5 | 672bb34094b8780806a10ba9b1d21036fd808b8e | refs/heads/master | 2023-07-29T05:26:14.603817 | 2021-09-03T05:23:34 | 2021-09-03T05:23:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,065 | java | package com.huawei.servicehost.d3d;
import android.os.Binder;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;
import android.os.RemoteException;
import com.huawei.servicehost.d3d.IImage3D;
public interface IIPEvent4D3DResult extends IInterface {
IImage3D getResult() throws RemoteException;
void release() throws RemoteException;
public static class Default implements IIPEvent4D3DResult {
@Override // com.huawei.servicehost.d3d.IIPEvent4D3DResult
public IImage3D getResult() throws RemoteException {
return null;
}
@Override // com.huawei.servicehost.d3d.IIPEvent4D3DResult
public void release() throws RemoteException {
}
public IBinder asBinder() {
return null;
}
}
public static abstract class Stub extends Binder implements IIPEvent4D3DResult {
private static final String DESCRIPTOR = "com.huawei.servicehost.d3d.IIPEvent4D3DResult";
static final int TRANSACTION_getResult = 1;
static final int TRANSACTION_release = 2;
public Stub() {
attachInterface(this, DESCRIPTOR);
}
public static IIPEvent4D3DResult asInterface(IBinder obj) {
if (obj == null) {
return null;
}
IInterface iin = obj.queryLocalInterface(DESCRIPTOR);
if (iin == null || !(iin instanceof IIPEvent4D3DResult)) {
return new Proxy(obj);
}
return (IIPEvent4D3DResult) iin;
}
public IBinder asBinder() {
return this;
}
@Override // android.os.Binder
public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
if (code == 1) {
data.enforceInterface(DESCRIPTOR);
IImage3D _result = getResult();
reply.writeNoException();
reply.writeStrongBinder(_result != null ? _result.asBinder() : null);
return true;
} else if (code == 2) {
data.enforceInterface(DESCRIPTOR);
release();
reply.writeNoException();
return true;
} else if (code != 1598968902) {
return super.onTransact(code, data, reply, flags);
} else {
reply.writeString(DESCRIPTOR);
return true;
}
}
/* access modifiers changed from: private */
public static class Proxy implements IIPEvent4D3DResult {
public static IIPEvent4D3DResult sDefaultImpl;
private IBinder mRemote;
Proxy(IBinder remote) {
this.mRemote = remote;
}
public IBinder asBinder() {
return this.mRemote;
}
public String getInterfaceDescriptor() {
return Stub.DESCRIPTOR;
}
@Override // com.huawei.servicehost.d3d.IIPEvent4D3DResult
public IImage3D getResult() throws RemoteException {
Parcel _data = Parcel.obtain();
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(1, _data, _reply, 0) && Stub.getDefaultImpl() != null) {
return Stub.getDefaultImpl().getResult();
}
_reply.readException();
IImage3D _result = IImage3D.Stub.asInterface(_reply.readStrongBinder());
_reply.recycle();
_data.recycle();
return _result;
} finally {
_reply.recycle();
_data.recycle();
}
}
@Override // com.huawei.servicehost.d3d.IIPEvent4D3DResult
public void release() throws RemoteException {
Parcel _data = Parcel.obtain();
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken(Stub.DESCRIPTOR);
if (this.mRemote.transact(2, _data, _reply, 0) || Stub.getDefaultImpl() == null) {
_reply.readException();
_reply.recycle();
_data.recycle();
return;
}
Stub.getDefaultImpl().release();
} finally {
_reply.recycle();
_data.recycle();
}
}
}
public static boolean setDefaultImpl(IIPEvent4D3DResult impl) {
if (Proxy.sDefaultImpl != null || impl == null) {
return false;
}
Proxy.sDefaultImpl = impl;
return true;
}
public static IIPEvent4D3DResult getDefaultImpl() {
return Proxy.sDefaultImpl;
}
}
}
| [
"dstmath@163.com"
] | dstmath@163.com |
8ecf093878004ad089b075123886203297532105 | 158842e4f0a50e88f1b56908feccc68aa38ae251 | /Devoir2/simpleChat/ClientConsole.java | 6dff40c9618ba7a3c7dd9db8e87c259979dc73c9 | [] | no_license | alexwall2000/Assignment2 | 904c42568bad1fed04501f20ef18cce74ba04e44 | 4a747619d07ac9fcde6c0a3cd000be3bf90fd092 | refs/heads/master | 2023-01-13T22:37:43.668503 | 2020-11-04T06:41:40 | 2020-11-04T06:41:40 | 309,908,030 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,577 | java | // This file contains material supporting section 3.7 of the textbook:
// "Object Oriented Software Engineering" and is issued under the open-source
// license found at www.lloseng.com
import java.io.*;
import java.util.Scanner;
import client.*;
import common.*;
/**
* This class constructs the UI for a chat client. It implements the
* chat interface in order to activate the display() method.
* Warning: Some of the code here is cloned in ServerConsole
*
* @author François Bélanger
* @author Dr Timothy C. Lethbridge
* @author Dr Robert Laganière
* @version September 2020
*/
public class ClientConsole implements ChatIF
{
//Class variables *************************************************
/**
* The default port to connect on.
*/
final public static int DEFAULT_PORT = 5555;
//Instance variables **********************************************
/**
* The instance of the client that created this ConsoleChat.
*/
ChatClient client;
/**
* Scanner to read from the console
*/
Scanner fromConsole;
//Constructors ****************************************************
/**
* Constructs an instance of the ClientConsole UI.
*
* @param host The host to connect to.
* @param port The port to connect on.
*/
//Excerice 3a)
public ClientConsole(String loginID, String host, int port)
{
if(loginID == "") {
System.out.println("ERROR - No login ID specified. Connection aborted");
System.exit(1);
}
try
{
client= new ChatClient(loginID, host, port, this);
}
catch(IOException exception)
{
System.out.println("Error: Can't setup connection!"
+ " Terminating client.");
System.exit(1);
}
// Create scanner object to read from console
fromConsole = new Scanner(System.in);
}
//Instance methods ************************************************
/**
* This method waits for input from the console. Once it is
* received, it sends it to the client's message handler.
*/
public void accept()
{
try
{
String message;
while (true)
{
message = fromConsole.nextLine();
client.handleMessageFromClientUI(message);
}
}
catch (Exception ex)
{
System.out.println
("Unexpected error while reading from console!");
}
}
/**
* This method overrides the method in the ChatIF interface. It
* displays a message onto the screen.
*
* @param message The string to be displayed.
*/
public void display(String message)
{
System.out.println("> " + message);
}
//Class methods ***************************************************
/**
* This method is responsible for the creation of the Client UI.
*
* @param args[0] The host to connect to.
*/
//Exercice 1b) et 3a)
public static void main(String[] args)
{
String host = "";
int port = 0;
String loginID = "";
try
{
loginID = args[0];
host = args[1];
port = Integer.parseInt(args[2]);
}
catch(ArrayIndexOutOfBoundsException e)
{
host = "localhost";
}
catch(NumberFormatException x) {
port = DEFAULT_PORT;
}
ClientConsole chat= new ClientConsole(loginID, host, DEFAULT_PORT);
chat.accept(); //Wait for console data
}
}
//End of ConsoleChat class
| [
"noreply@github.com"
] | noreply@github.com |
397d478a97b0989d0ee2692bc9abac87468d8c00 | 27511a2f9b0abe76e3fcef6d70e66647dd15da96 | /src/com/instagram/android/graphql/ae.java | 4c0eef8471cd3b44eec0f88d8691bcb5cafda5a0 | [] | no_license | biaolv/com.instagram.android | 7edde43d5a909ae2563cf104acfc6891f2a39ebe | 3fcd3db2c3823a6d29a31ec0f6abcf5ceca995de | refs/heads/master | 2022-05-09T15:05:05.412227 | 2016-07-21T03:48:36 | 2016-07-21T03:48:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 219 | java | package com.instagram.android.graphql;
public final class ae
{
public String a;
}
/* Location:
* Qualified Name: com.instagram.android.graphql.ae
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"reverseengineeringer@hackeradmin.com"
] | reverseengineeringer@hackeradmin.com |
de19c09740957c27dae8987b654a48e14bc63b38 | 6045a0d3f0c0b05ad17c8ca666a2a619e8a9e556 | /app/src/main/java/com/macinternetservices/sablebusinessdirectory/ui/item/history/HistoryFragment.java | 7e52c92531b3af1b5e096d2e449c3bea5bb97b2d | [] | no_license | c1scok1d/sablebusinessdirectory3_0 | b77654e4ac02ab85ab961f3607a34e1f031238e1 | 642ba27f63c5a3a9e8639e1577523799613cae6f | refs/heads/master | 2023-06-07T08:28:04.795737 | 2021-06-30T22:15:40 | 2021-06-30T22:15:40 | 368,712,647 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,073 | java | package com.macinternetservices.sablebusinessdirectory.ui.item.history;
import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.macinternetservices.sablebusinessdirectory.Config;
import com.macinternetservices.sablebusinessdirectory.MainActivity;
import com.macinternetservices.sablebusinessdirectory.R;
import com.macinternetservices.sablebusinessdirectory.binding.FragmentDataBindingComponent;
import com.macinternetservices.sablebusinessdirectory.databinding.FragmentHistoryBinding;
import com.macinternetservices.sablebusinessdirectory.ui.common.DataBoundListAdapter;
import com.macinternetservices.sablebusinessdirectory.ui.common.PSFragment;
import com.macinternetservices.sablebusinessdirectory.ui.item.history.adapter.HistoryAdapter;
import com.macinternetservices.sablebusinessdirectory.utils.AutoClearedValue;
import com.macinternetservices.sablebusinessdirectory.utils.Utils;
import com.macinternetservices.sablebusinessdirectory.viewmodel.item.HistoryViewModel;
import com.macinternetservices.sablebusinessdirectory.viewobject.ItemHistory;
import java.util.List;
/**
* A simple {@link Fragment} subclass.
*/
public class HistoryFragment extends PSFragment implements DataBoundListAdapter.DiffUtilDispatchedInterface {
//region Variables
private final androidx.databinding.DataBindingComponent dataBindingComponent = new FragmentDataBindingComponent(this);
private HistoryViewModel historyViewModel;
@VisibleForTesting
private AutoClearedValue<FragmentHistoryBinding> binding;
private AutoClearedValue<HistoryAdapter> historyAdapter;
//endregion
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
FragmentHistoryBinding dataBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_history, container, false, dataBindingComponent);
binding = new AutoClearedValue<>(this, dataBinding);
return binding.get().getRoot();
}
@Override
public void onDispatched() {
if (historyViewModel.loadingDirection == Utils.LoadingDirection.bottom) {
if (binding.get().historyRecycler != null) {
LinearLayoutManager layoutManager = (LinearLayoutManager)
binding.get().historyRecycler.getLayoutManager();
if (layoutManager != null) {
layoutManager.scrollToPosition(0);
}
}
}
}
@Override
protected void initUIAndActions() {
if(getActivity() instanceof MainActivity) {
((MainActivity) this.getActivity()).binding.toolbar.setBackgroundColor(getResources().getColor(R.color.global__primary));
((MainActivity)getActivity()).updateToolbarIconColor(Color.WHITE);
((MainActivity)getActivity()).updateMenuIconWhite();
}
binding.get().historyRecycler.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
LinearLayoutManager layoutManager = (LinearLayoutManager)
recyclerView.getLayoutManager();
if (layoutManager != null) {
int lastPosition = layoutManager
.findLastVisibleItemPosition();
if (lastPosition == historyAdapter.get().getItemCount() - 1) {
if (!binding.get().getLoadingMore() && !historyViewModel.forceEndLoading) {
historyViewModel.loadingDirection = Utils.LoadingDirection.bottom;
int limit = Config.HISTORY_COUNT;
historyViewModel.offset = historyViewModel.offset + limit;
historyViewModel.setHistoryItemListObj(String.valueOf(historyViewModel.offset));
}
}
}
}
});
}
@Override
protected void initViewModels() {
historyViewModel = new ViewModelProvider(this, viewModelFactory).get(HistoryViewModel.class);
}
@Override
protected void initAdapters() {
HistoryAdapter historyAdapter = new HistoryAdapter(dataBindingComponent,
itemHistory -> navigationController.navigateToItemDetailActivity(HistoryFragment.this.getActivity(), itemHistory, selectedCityId));
this.historyAdapter = new AutoClearedValue<>(this, historyAdapter);
binding.get().historyRecycler.setAdapter(historyAdapter);
}
@Override
protected void initData() {
loadData();
}
private void loadData() {
//load basket
historyViewModel.offset = Config.HISTORY_COUNT;
historyViewModel.setHistoryItemListObj(String.valueOf(historyViewModel.offset));
LiveData<List<ItemHistory>> historyItemList = historyViewModel.getAllHistoryItemList();
if (historyItemList != null) {
historyItemList.observe(this, listResource -> {
if (listResource != null) {
replaceItemHistoryData(listResource);
}
});
}
historyViewModel.getLoadingState().observe(this, loadingState -> binding.get().setLoadingMore(historyViewModel.isLoading));
}
private void replaceItemHistoryData(List<ItemHistory> historyItemList) {
historyAdapter.get().replace(historyItemList);
binding.get().executePendingBindings();
}
}
| [
"rchatman@macinternetservices.com"
] | rchatman@macinternetservices.com |
c8bbfaa05f30f380dd985706c589f546e4a0b5e0 | d14979192b98ecc06d6ca2694143e3381d4df8e7 | /app/src/main/java/com/example/chiroq/FlashClass.java | 9d089431729c12c6f06e82394c6b67ce4d684cf7 | [] | no_license | MrD12-iOS-Android/Chiroq | 13020d087b7f0f8ae457b70d1aeee31b7b4dfc18 | 2a55ca4199a8c5db2996ba3c45c588ee3feb1e65 | refs/heads/main | 2023-02-12T08:47:45.656583 | 2021-01-10T21:04:50 | 2021-01-10T21:04:50 | 328,478,225 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,292 | java | package com.example.chiroq;
import android.content.Context;
import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraManager;
public class FlashClass {
private boolean flash_status = false;
private Context context;
public FlashClass(Context context) {
this.context = context;
}
public void flashOn(){
CameraManager cameraManager = (CameraManager)context.getSystemService(Context.CAMERA_SERVICE);
try {
assert cameraManager != null;
String cameraId = cameraManager.getCameraIdList()[0];
cameraManager.setTorchMode(cameraId, true);
flash_status = true;
} catch (CameraAccessException e) {
e.printStackTrace();
}
}
public void flashOff(){
CameraManager cameraManager = (CameraManager)context.getSystemService(Context.CAMERA_SERVICE);
try {
assert cameraManager != null;
String cameraId = cameraManager.getCameraIdList()[0];
cameraManager.setTorchMode(cameraId, false);
flash_status = false;
} catch (CameraAccessException e) {
e.printStackTrace();
}
}
public boolean isFlash_status() {
return flash_status;
}
}
| [
"76392416+DilshodIskandarov456@users.noreply.github.com"
] | 76392416+DilshodIskandarov456@users.noreply.github.com |
6c0bd5f174c34add687144f1b812e11b648eacb3 | b7be23628a79b2571791d2f940c82e9054a5803f | /ProjectN/app/src/main/java/com/sora/projectn/utils/Adapter/MySimpleAdapter.java | b717e3a1eb1c6ad55e06691ba97db6f84241c54d | [] | no_license | sora003/ProjectN | 4f16af612f7c1e8a0434b5a90ee8792e78a5a5f8 | afb1c2c38439d02d016529f374f4caed65894621 | refs/heads/master | 2021-01-21T13:15:11.695283 | 2016-05-26T15:49:39 | 2016-05-26T15:49:39 | 49,414,578 | 0 | 1 | null | 2016-05-23T16:32:54 | 2016-01-11T09:09:45 | Java | UTF-8 | Java | false | false | 1,739 | java | package com.sora.projectn.utils.Adapter;
import android.content.Context;
import android.widget.ImageView;
import android.widget.SimpleAdapter;
import com.sora.projectn.utils.BitmapHelper;
import java.util.List;
import java.util.Map;
/**
* Created by Sora on 2016-04-26.
* 当图片数量过多或图片大小较大时,加载速度明显减慢
* 优化SimpleAdapter的图片加载
*/
public class MySimpleAdapter extends SimpleAdapter {
Context mContext;
/**
* Constructor
*
* @param context The context where the View associated with this SimpleAdapter is running
* @param data A List of Maps. Each entry in the List corresponds to one row in the list. The
* Maps contain the data for each row, and should include all the entries specified in
* "from"
* @param resource Resource identifier of a view layout that defines the views for this list
* item. The layout file should include at least those named views defined in "to"
* @param from A list of column names that will be added to the Map associated with each
* item.
* @param to The views that should display column in the "from" parameter. These should all be
* TextViews. The first N views in this list are given the values of the first N columns
*/
public MySimpleAdapter(Context context, List<? extends Map<String, ?>> data, int resource, String[] from, int[] to) {
super(context, data, resource, from, to);
mContext = context;
}
@Override
public void setViewImage(ImageView v, int value) {
v.setImageBitmap(BitmapHelper.loadBitMap(mContext, value));
}
}
| [
"sumisoras@163.com"
] | sumisoras@163.com |
22ed6b5af8a73ba8ebb95a0c7b9b231fde329dca | f71a7ec87f7e90f8025a3079daced5dbf41aca9c | /sf-pay/src/main/java/com/alipay/api/response/AlipayMobilePublicLabelUserAddResponse.java | 96b33daa21247cf4e89b451ed10cb0d3785c620c | [] | no_license | luotianwen/yy | 5ff456507e9ee3dc1a890c9bead4491d350f393d | 083a05aac4271689419ee7457cd0727eb10a5847 | refs/heads/master | 2021-01-23T10:34:24.402548 | 2017-10-08T05:03:10 | 2017-10-08T05:03:10 | 102,618,007 | 1 | 3 | null | null | null | null | UTF-8 | Java | false | false | 754 | java | package com.alipay.api.response;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.AlipayResponse;
/**
* ALIPAY API: alipay.mobile.public.label.user.add response.
*
* @author auto create
* @since 1.0, 2016-07-29 19:59:10
*/
public class AlipayMobilePublicLabelUserAddResponse extends AlipayResponse {
private static final long serialVersionUID = 4236963236753485524L;
/**
* 结果码
*/
@ApiField("code")
private String code;
/**
* 结果信息
*/
@ApiField("msg")
private String msg;
public void setCode(String code) {
this.code = code;
}
public String getCode( ) {
return this.code;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getMsg( ) {
return this.msg;
}
}
| [
"tw l"
] | tw l |
237aa310d4cad562340ad4d717ba1b71a1715ba9 | c7e7722798671b3ec0f780386694bf8f978a1b82 | /JSP_Project/DocumentManagement/src/DAO/UserDAO.java | f256b14e9cec139c3a8c6ff13953db081676f822 | [] | no_license | hands731/JSP | dde69dfd8f680bc0039e33fc2a9d239d80d2a33c | 5872379ad3e41738c19b15c98bdae1f7b1194b23 | refs/heads/master | 2022-12-21T09:01:29.104457 | 2020-03-18T13:01:32 | 2020-03-18T13:01:32 | 243,929,233 | 0 | 0 | null | 2022-12-16T12:13:50 | 2020-02-29T08:07:06 | Java | UTF-8 | Java | false | false | 1,440 | java | package DAO;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import Common.JdbcTemplate;
import VO.UserVO;
public class UserDAO {
public VO.UserVO getUserInfo(String userId, String userPassword) {
List<String> groupList = new ArrayList<>();
Connection conn = JdbcTemplate.getConnection();
PreparedStatement pstmt = null;
ResultSet rs = null;
UserVO userVO = new UserVO();
GroupIdDAO dao = new GroupIdDAO();
String sql = "select * from usertbl where userid = ? and password = ?";
try {
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, userId);
pstmt.setString(2, userPassword);
rs = pstmt.executeQuery();
if (!rs.next())
return null;
userVO.setUserid(rs.getString(1));
userVO.setName(rs.getString(3));
userVO.setGrade(rs.getString(4));
userVO.set_class(rs.getString(5));
userVO.setPosition(rs.getString(6));
if (userVO.getPosition().equals("professor")) {
groupList = dao.professorGroupList(userId, conn);
} else {
groupList = dao.studentGroupList(userId, conn);
}
userVO.setGroupList(groupList);
} catch (SQLException e) {
e.printStackTrace();
// return null;
} finally {
JdbcTemplate.close(rs);
JdbcTemplate.close(pstmt);
JdbcTemplate.close(conn);
}
return userVO;
}
}
| [
"hands731@naver.com"
] | hands731@naver.com |
e039d488e4eff62627f93fb8a535070f8b318324 | 89b0a68dcae504169826e61e242df27cbb2fbbb7 | /SplitWordsTest.java | 1acae71cfaa34d49595b2b40a0ea00e573c297ff | [] | no_license | miked71998/judges | 5bce832bb581ee1b3bf14fea5d6f54b3a3fbadd6 | 44f054dbc57e39cca4bf2d452e600609780b7460 | refs/heads/master | 2021-09-03T19:26:02.827028 | 2018-01-11T11:51:46 | 2018-01-11T11:51:46 | 106,468,019 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,234 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package spellchecker;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author Stavros
*/
public class SplitWordsTest {
public SplitWordsTest() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
/**
* Test of newSplit method, of class SplitWords.
*/
@Test
public void testNewSplit() {
System.out.println("newSplit");
MainForm instance=new MainForm();
String[] expResult = {""};
String[] result = SplitWords.newSplit();
assertArrayEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
// fail("The test case is a prototype.");
}
}
| [
"noreply@github.com"
] | noreply@github.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.