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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
650e22c5ea74662b70204d5a489c70ef0909aa1d | 9413b96fd6212e388593361c3b2361bf725201ea | /CS4215/cs4215_week_6/simPLcompiler/IndexTable.java | 7bef6ad33982c4474a49018885a4f31350b35898 | [] | no_license | nineten/nus | 03e37672031f8d3dd50e607660782447bf3e6b5f | 83d6ac89f7a802aa99081935fb7d81280caa620b | refs/heads/master | 2020-05-04T15:34:11.014154 | 2013-11-25T07:48:44 | 2013-11-25T07:48:44 | 14,658,325 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 259 | java | package simPLcompiler;
import java.util.*;
public class IndexTable extends Vector<String> {
private static final long serialVersionUID = 1L;
public void extend(String v) {
addElement(v);
}
public int access(String v) {
return lastIndexOf(v);
}
}
| [
"jayden87@gmail.com"
] | jayden87@gmail.com |
759a072eada91efffaedeb1e54527b3ca80a000f | 0423111edfc03ac1ddd2dc11ba66212a483a90ce | /src/main/java/com/aroto/util/FileUtils.java | a9be63251ddc9b06a552a174b9bf64009a94ef78 | [] | no_license | yitao/aroto | 6e93f64dfcefa788f0b95f3eeb22948b0f057292 | cee19356c90ffcaabb0b11cdaba5f7a52a993eb1 | refs/heads/master | 2021-01-20T18:48:19.623976 | 2016-10-18T11:52:57 | 2016-10-18T11:52:57 | 64,455,418 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 584 | java | package com.aroto.util;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
/**
* Created by yitao on 2016/10/18.
*/
public class FileUtils {
public static void write(String path,String data,boolean append) throws IOException{
File file = new File(path);
if(!file.exists()){
File dir = file.getParentFile();
dir.mkdirs();
}
FileWriter fw = new FileWriter(file,append);
PrintWriter pw = new PrintWriter(fw);
pw.print(data);
pw.close();
}
}
| [
"528171154@qq.com"
] | 528171154@qq.com |
527b93bdeefcc9e6f142c620fba08222853ba447 | 38cfbba14f65ef38dd172f4e5fc1940517d12b13 | /src/Main.java | f53a1ec99db48edb67654d28c2b342fcf2cea2b2 | [] | no_license | Jack4Code/SolitaireChessSolver | 2be9379e118911ed172761636d46adddb931a7d2 | 105a795c220eacc04e41c1f6ddd13b96d010600d | refs/heads/master | 2020-12-02T09:12:06.650598 | 2017-08-03T01:04:24 | 2017-08-03T01:04:24 | 96,710,821 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 737 | java | import java.util.function.DoubleFunction;
/**
* Created by jack on 7/9/17.
*/
public class Main {
public static void main(String[] args) {
String[] boardVisual =
{" ", " ", " ", " ",
" ", "P", "K", " ",
" ", " ", " ", " ",
" ", " ", " ", " "};
System.out.println(boardVisual[6]);
}
}
/*
//was inside the main class
public static Board board = new Board();
public static void main(String[] args) {
for(int i=0; i<board.getBoard().length; i++){
for(int j=0; j<board.getBoard()[i].length; j++){
System.out.print(board.getBoard());
}
System.out.println();
}
}
*/
| [
"jack.giannini@gmail.com"
] | jack.giannini@gmail.com |
fbc5497fdd4a9514ca6d8f4c10fc8b866f11d3d4 | e5b025d1a34a50c9760e477760101924c2d45acd | /src/main/java/com/oreilly/servlet/HttpMessage.java | fed043dfec6ed4d0de57e66fb6c1dc67e4bf7273 | [
"Apache-2.0"
] | permissive | sergiomt/bulkmailer | aa26e9f2e89a74a483a13222ce8ecec93b46575a | 215d35212d695b477101278a18cbc30935f1c013 | refs/heads/master | 2021-01-20T00:10:43.194907 | 2018-09-02T15:11:14 | 2018-09-02T15:11:14 | 89,088,687 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,402 | java | // Copyright (C) 1998-2001 by Jason Hunter <jhunter_AT_acm_DOT_org>.
// All rights reserved. Use of this class is limited.
// Please see the LICENSE for more information.
package com.oreilly.servlet;
import java.io.*;
import java.net.*;
import java.util.*;
/**
* A class to simplify HTTP applet-server communication. It abstracts
* the communication into messages, which can be either GET or POST.
* <p>
* It can be used like this:
* <blockquote><pre>
* URL url = new URL(getCodeBase(), "/servlet/ServletName");
*
* HttpMessage msg = new HttpMessage(url);
*
* // Parameters may optionally be set using java.util.Properties
* Properties props = new Properties();
* props.put("name", "value");
*
* // Headers, cookies, and authorization may be set as well
* msg.setHeader("Accept", "image/png"); // optional
* msg.setCookie("JSESSIONID", "9585155923883872"); // optional
* msg.setAuthorization("guest", "try2gueSS"); // optional
*
* InputStream in = msg.sendGetMessage(props);
* </pre></blockquote>
* <p>
* This class is loosely modeled after the ServletMessage class written
* by Rod McChesney of JavaSoft.
*
* @author <b>Jason Hunter</b>, Copyright © 1998
* @version 1.3, 2000/10/24, fixed headers NPE bug
* @version 1.2, 2000/10/15, changed uploaded object MIME type to
* application/x-java-serialized-object
* @version 1.1, 2000/06/11, added ability to set headers, cookies,
and authorization
* @version 1.0, 1998/09/18
*/
public class HttpMessage {
URL servlet = null;
Hashtable headers = null;
/**
* Constructs a new HttpMessage that can be used to communicate with the
* servlet at the specified URL.
*
* @param servlet the server resource (typically a servlet) with which
* to communicate
*/
public HttpMessage(URL servlet) {
this.servlet = servlet;
}
/**
* Performs a GET request to the servlet, with no query string.
*
* @return an InputStream to read the response
* @exception IOException if an I/O error occurs
*/
public InputStream sendGetMessage() throws IOException {
return sendGetMessage(null);
}
/**
* Performs a GET request to the servlet, building
* a query string from the supplied properties list.
*
* @param args the properties list from which to build a query string
* @return an InputStream to read the response
* @exception IOException if an I/O error occurs
*/
public InputStream sendGetMessage(Properties args) throws IOException {
String argString = ""; // default
if (args != null) {
argString = "?" + toEncodedString(args);
}
URL url = new URL(servlet.toExternalForm() + argString);
// Turn off caching
URLConnection con = url.openConnection();
con.setUseCaches(false);
// Send headers
sendHeaders(con);
return con.getInputStream();
}
/**
* Performs a POST request to the servlet, with no query string.
*
* @return an InputStream to read the response
* @exception IOException if an I/O error occurs
*/
public InputStream sendPostMessage() throws IOException {
return sendPostMessage(null);
}
/**
* Performs a POST request to the servlet, building
* post data from the supplied properties list.
*
* @param args the properties list from which to build the post data
* @return an InputStream to read the response
* @exception IOException if an I/O error occurs
*/
public InputStream sendPostMessage(Properties args) throws IOException {
String argString = ""; // default
if (args != null) {
argString = toEncodedString(args); // notice no "?"
}
URLConnection con = servlet.openConnection();
// Prepare for both input and output
con.setDoInput(true);
con.setDoOutput(true);
// Turn off caching
con.setUseCaches(false);
// Work around a Netscape bug
con.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");
// Send headers
sendHeaders(con);
// Write the arguments as post data
DataOutputStream out = new DataOutputStream(con.getOutputStream());
out.writeBytes(argString);
out.flush();
out.close();
return con.getInputStream();
}
/**
* Performs a POST request to the servlet, uploading a serialized object.
* <p>
* The servlet can receive the object in its <tt>doPost()</tt> method
* like this:
* <pre>
* ObjectInputStream objin =
* new ObjectInputStream(req.getInputStream());
* Object obj = objin.readObject();
* </pre>
* The type of the uploaded object can be determined through introspection.
*
* @param obj the serializable object to upload
* @return an InputStream to read the response
* @exception IOException if an I/O error occurs
*/
public InputStream sendPostMessage(Serializable obj) throws IOException {
URLConnection con = servlet.openConnection();
// Prepare for both input and output
con.setDoInput(true);
con.setDoOutput(true);
// Turn off caching
con.setUseCaches(false);
// Set the content type to be application/x-java-serialized-object
con.setRequestProperty("Content-Type",
"application/x-java-serialized-object");
// Send headers
sendHeaders(con);
// Write the serialized object as post data
ObjectOutputStream out = new ObjectOutputStream(con.getOutputStream());
out.writeObject(obj);
out.flush();
out.close();
return con.getInputStream();
}
/**
* Sets a request header with the given name and value. The header
* persists across multiple requests. The caller is responsible for
* ensuring there are no illegal characters in the name and value.
*
* @param name the header name
* @param value the header value
*/
public void setHeader(String name, String value) {
if (headers == null) {
headers = new Hashtable();
}
headers.put(name, value);
}
// Send the contents of the headers hashtable to the server
private void sendHeaders(URLConnection con) {
if (headers != null) {
Enumeration headerenum = headers.keys();
while (headerenum.hasMoreElements()) {
String name = (String) headerenum.nextElement();
String value = (String) headers.get(name);
con.setRequestProperty(name, value);
}
}
}
/**
* Sets a request cookie with the given name and value. The cookie
* persists across multiple requests. The caller is responsible for
* ensuring there are no illegal characters in the name and value.
*
* @param name the header name
* @param value the header value
*/
public void setCookie(String name, String value) {
if (headers == null) {
headers = new Hashtable();
}
String existingCookies = (String) headers.get("Cookie");
if (existingCookies == null) {
setHeader("Cookie", name + "=" + value);
}
else {
setHeader("Cookie", existingCookies + "; " + name + "=" + value);
}
}
/**
* Sets the authorization information for the request (using BASIC
* authentication via the HTTP Authorization header). The authorization
* persists across multiple requests.
*
* @param name the user name
* @param name the user password
*/
public void setAuthorization(String name, String password) {
String authorization = Base64.getEncoder().encodeToString((name + ":" + password).getBytes());
setHeader("Authorization", "Basic " + authorization);
}
/*
* Converts a properties list to a URL-encoded query string
*/
private String toEncodedString(Properties args) {
StringBuffer buf = new StringBuffer();
Enumeration names = args.propertyNames();
while (names.hasMoreElements()) {
String name = (String) names.nextElement();
String value = args.getProperty(name);
buf.append(URLEncoder.encode(name) + "=" + URLEncoder.encode(value));
if (names.hasMoreElements()) buf.append("&");
}
return buf.toString();
}
}
| [
"sergiom@knowgate.com"
] | sergiom@knowgate.com |
9a63da4001c266ec5c9fba60bf72363df9511e98 | e907ddd25a998bae09338ae6c45239ce342f80d5 | /solutions/S0860.java | eb229bfb4c029da6d5104d350541dadde7d3b99c | [] | no_license | JimWang97/LeetCode-Problems-Solutions | c1d5a667d3a700a08940ba470aa3e4db0cd04f7f | 821b80830dde9d3ee9544176a583966dc2996a41 | refs/heads/master | 2023-06-02T09:19:45.157738 | 2021-06-20T04:26:45 | 2021-06-20T04:26:45 | 278,378,173 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,630 | java | package solutions;
/**
* 860. 柠檬水找零
* 在柠檬水摊上,每一杯柠檬水的售价为 5 美元。
*
* 顾客排队购买你的产品,(按账单 bills 支付的顺序)一次购买一杯。
*
* 每位顾客只买一杯柠檬水,然后向你付 5 美元、10 美元或 20 美元。你必须给每个顾客正确找零,也就是说净交易是每位顾客向你支付 5 美元。
*
* 注意,一开始你手头没有任何零钱。
*
* 如果你能给每位顾客正确找零,返回 true ,否则返回 false 。
*
* 示例 1:
*
* 输入:[5,5,5,10,20]
* 输出:true
* 解释:
* 前 3 位顾客那里,我们按顺序收取 3 张 5 美元的钞票。
* 第 4 位顾客那里,我们收取一张 10 美元的钞票,并返还 5 美元。
* 第 5 位顾客那里,我们找还一张 10 美元的钞票和一张 5 美元的钞票。
* 由于所有客户都得到了正确的找零,所以我们输出 true。
*/
public class S0860 {
public boolean lemonadeChange(int[] bills) {
int d5 = 0, d10 =0;
for(int i = 0; i < bills.length; i++) {
if(bills[i]==5) {
d5++;
} else if(bills[i]==10) {
d10++;
d5--;
if(d5<0) {
return false;
}
} else {
if(d5>=1&&d10>=1) {
d5--;
d10--;
} else if(d5>=3) {
d5 -=3;
} else {
return false;
}
}
}
return true;
}
}
| [
"1163747770@qq.com"
] | 1163747770@qq.com |
d5f619af68ae36f5b0458e5d59ea47c4080281f4 | 4d7ac53121682ec527818ed2b5e4a1c23e20dc0e | /src/test/java/com/cucumberBaby/runners/RestAssureDemo.java | d424f139619b07d3a229e755414a403c8117ae63 | [] | no_license | horax2020/challenge | 60a0c750fc8ff69998019d18aafa74c5ac1fd7bb | 499e336135354fae62abb91f6b389bda6b5b31f1 | refs/heads/master | 2023-04-18T21:05:35.345207 | 2021-05-06T23:18:30 | 2021-05-06T23:18:30 | 364,718,052 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 415 | java | package com.cucumberBaby.runners;
import com.cucumberBaby.REST.restBaseClass;
import io.restassured.RestAssured;
import org.testng.annotations.Test;
public class RestAssureDemo extends restBaseClass {
@Test
public void test1(){
int code = RestAssured.given()
.get()
.getStatusCode();
System.out.println("Response Code from server is " + code);
}
}
| [
"horax2000@gmail.com"
] | horax2000@gmail.com |
dd0059a2e9e87aa180a83c8584b92ecda7119ad5 | 6f1b8f3fe0c9922a575ec8f1c64958827258a84a | /src/com/space/spaceshooter/PlayerShip.java | d739c8b3e0a9f743d7377f88c4a76e3a9c408486 | [] | no_license | Richie700/Supra-Caelum | 3caf91d2fbef65953178a6732e6e443d0d137b73 | c804758fc6363c497e2e2d19473ffea5e8203cc9 | refs/heads/master | 2020-03-29T13:02:54.022048 | 2009-12-29T18:09:02 | 2009-12-29T18:09:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,857 | java | //testing from mark
package com.space.spaceshooter;
import android.view.KeyEvent;
import android.graphics.Paint;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.util.Log;
class PlayerShip extends Ship
{
public enum FireControls
{
Trackball,
Tap
}
public enum MovementControls
{
Trackball,
Accelerometer
}
private SensorManager mySensorManager;
private MovementControls m_moveControls;
public FireControls m_fireControls;
private Bar m_overheatBar;
private Bar m_healthBar;
private Bar m_scoreBar;
private float[] mOrientation = new float[3];
public static int m_level = 1;
public static int m_killsNeeded = 5;
public static int shots_fired;
private SensorEventListener sensorEventListener = new SensorEventListener() {
public void onAccuracyChanged(Sensor sensor, int accuracy) {
// TODO Auto-generated method stub
}
public void onSensorChanged(SensorEvent event) {
for (int i = 0; i < 3; i++)
{
if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER)
mOrientation[i] = -event.values[i];
}
}
};
public PlayerShip(int x, int y)
{
super(x,y);
SetBorderBehavior(BorderBehavior.Stop);
m_moveControls = MovementControls.Accelerometer; // m_moveControls = MoveMentControls.Accelerometer;
m_fireControls = FireControls.Trackball; //m_fireControls = FireControls.Tap;
mySensorManager = SpaceShooter.getManager();;
if(m_moveControls == MovementControls.Accelerometer)
mySensorManager.registerListener(sensorEventListener, mySensorManager.getDefaultSensor(1), SensorManager.SENSOR_DELAY_GAME);
else
Log.w("Sensor", "No need to initialize");
m_overheatBar = new Bar();
m_overheatBar.setVal(getOverheat(), maxOverheat);
m_overheatBar.setRect(10, 25, 100, 10);
m_overheatBar.setFrontColor(255, 255, 0);
m_overheatBar.setBackColor(80, 80, 80);
m_healthBar = new Bar();
m_healthBar.setVal(getHealth(), getMaxHealth());
m_healthBar.setRect(10, 10, 100, 10);
m_healthBar.setFrontColor(255, 0, 0);
m_healthBar.setBackColor(80, 80, 80);
m_scoreBar = new Bar();
m_scoreBar.setVal(ShipHandler.getKills(),5); //Start out of 5 kills
m_scoreBar.setRect(getScreenSize().right-107,10,100,10);
m_scoreBar.setFrontColor(0, 255, 255);
m_scoreBar.setBackColor(80, 80, 80);
shots_fired = 0;
}
@Override
public void Draw()
{
super.Draw();
m_overheatBar.draw();
m_healthBar.draw();
m_scoreBar.draw();
Paint healthPaint = new Paint();
Paint xPaint = new Paint();
healthPaint.setARGB(255, 0, 255, 0);
healthPaint.setTextSize(14);
xPaint.setARGB(255, 255, 0, 0);
xPaint.setTextSize(14);
getCanvas().drawText(getHealth()+" / "+getMaxHealth(), getScreenSize().left+33, getScreenSize().top+20, healthPaint);
getCanvas().drawText(ShipHandler.getKills()+" / "+m_killsNeeded, getScreenSize().right-69, getScreenSize().top+20, xPaint);
}
public void killSensor() //Call whenever sensor is no longer needed
{
if (m_moveControls == MovementControls.Accelerometer)
{
mySensorManager.unregisterListener(sensorEventListener);
Log.w("Sensor", "Sensor Unregistered");
}
else
{
Log.w("Sensor", "Sensor isnt active!");
}
}
@Override
public void ProcInput(Input in)
{
//probably used only for debugging now that we have accelerometer
if(m_moveControls == MovementControls.Trackball)
{
if(in.buttonDown(KeyEvent.KEYCODE_DPAD_LEFT))
setMoveX(-10);
else if(in.buttonDown(KeyEvent.KEYCODE_DPAD_RIGHT))
setMoveX(10);
else
setMoveX(0);
}
if(m_moveControls == MovementControls.Accelerometer)
{
setMoveX((int)(mOrientation[0]*3));
}
if(m_fireControls == FireControls.Trackball)
{
if(in.buttonDown(KeyEvent.KEYCODE_DPAD_CENTER))
{
requestShot(-20);
}
}
/*if(in.buttonDown(KeyEvent.KEYCODE_DPAD_DOWN)) //temporary method for killing sensor
{
this.killSensor();
}*/
}
@Override
public void Update()
{
super.Update();
m_overheatBar.setVal(getOverheat());
m_healthBar.setVal(getHealth());
m_scoreBar.setVal(ShipHandler.getKills());
//if(ShipHandler.getKills() == m_killsNeeded)
// levelUp();
/*
switch (m_level) //Very very simple implementation of leveling
{
default:
break;
case 0:
if (ShipHandler.getKills() == 5)
{
m_scoreBar.setVal(0,10);
setCooling(15);
setMaxHealth(150);
m_healthBar.setMax(150);
m_level = 1;
ShipHandler.resetKills();
m_level = 1;
}
break;
case 1:
if (ShipHandler.getKills() == 10)
{
m_scoreBar.setVal(0,5);
setCooling(20);
setMaxHealth(200);
m_healthBar.setMax(200);
m_level = 0;
ShipHandler.resetKills();
m_level = 0;
}
break;
}
*/
}
@Override
public boolean requestShot(int speed) {
if(super.requestShot(speed))
{
shots_fired++;
return true;
}
return false;
}
public int getKillsNeeded()
{
return m_killsNeeded;
}
public void levelUp()
{
m_level++;
m_killsNeeded += 5;
incCooling(5);
incMaxHealth(50);
setHealthFull();
m_scoreBar.setVal(0, m_killsNeeded);
m_healthBar.setMax(getMaxHealth());
}
public static void setM_level(int m_level) {
PlayerShip.m_level = m_level;
}
public static void setShots_fired(int shots_fired) {
PlayerShip.shots_fired = shots_fired;
}
public static int getM_level() {
return m_level;
}
public static int getShots_fired() {
return shots_fired;
}
} | [
"="
] | = |
bcbad466cf2616c41cd3c6dcc91d80a72436bf63 | 03dd7e34ea82c73f829fe5aa04537467381d2cae | /Second Seventeen Programs/Test11_6.java | 4b1b30a480d90952996f9604af77ef1005e6061e | [] | no_license | xieyezi/my-java-programes | 5bc0df7ea245847183c5b18c0f3b6f9f33e55fa9 | b1e4648653b94144f839ed6d950cdb446ce8f93c | refs/heads/master | 2021-01-17T13:27:26.302223 | 2016-06-28T16:41:00 | 2016-06-28T16:41:00 | 57,396,989 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 536 | java | package io.github.xieyezi;
import java.util.ArrayList;
import java.util.Date;
import javafx.scene.shape.Circle;
public class Test11_6 {
public static void main(String[] args) {
ArrayList<Object> list = new ArrayList<>();
Loan loan = new Loan();
Date date = new Date();
String str = "abcd";
Circle circle = new Circle(5.0);
list.add(loan);
list.add(date);
list.add(str);
list.add(circle);
for(int i = 0;i<list.size();i++) {
System.out.println(list.get(i).toString());
}
}
}
class Loan{
public Loan(){
}
}
| [
"suyechun@icloud.com"
] | suyechun@icloud.com |
9641313ac5b58e02cfeb442e33f80f9ce7f638ce | 56e9ed4fb19345d5d20b742931bb9694bca8750f | /src/main/java/io/github.graphqly.reflector/metadata/messages/ResourceMessageBundle.java | 0dc441f1a7a55b4072853b1ce80d72c4d38ea323 | [] | no_license | graphqly/graphql-reflector | 371ac5d3a1334f51e06246b528a10676f669e4d1 | 4866469aceb1b7f7bc90c63dde2574146739a5cf | refs/heads/master | 2023-06-24T08:20:19.550576 | 2023-06-15T14:31:23 | 2023-06-15T14:31:23 | 237,756,575 | 0 | 0 | null | 2023-06-15T14:31:24 | 2020-02-02T10:52:00 | Java | UTF-8 | Java | false | false | 414 | java | package io.github.graphqly.reflector.metadata.messages;
import java.util.ResourceBundle;
public class ResourceMessageBundle implements MessageBundle {
private final ResourceBundle resourceBundle;
public ResourceMessageBundle(ResourceBundle resourceBundle) {
this.resourceBundle = resourceBundle;
}
@Override
public String getMessage(String key) {
return resourceBundle.getString(key);
}
}
| [
"anhld2@vng.com.vn"
] | anhld2@vng.com.vn |
5a224b6fb5458c8900499e0f07ff6a2bea4c61c6 | 19d737106eb507e35169a2813ba2033da2ddd521 | /src/main/java/tellhow/cavate/utils/TellhowResult.java | 671d989930793bdb63c5c8528cbdd75e8c48d1b4 | [] | no_license | 971497975/testgithub | 5654769a30ad4076f7a4faa32021a69f4e5e7dcd | bca58e235912070c2754638a80818359857ec301 | refs/heads/master | 2020-03-19T12:53:38.387577 | 2018-06-08T02:05:16 | 2018-06-08T02:05:16 | 136,547,810 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,427 | java | package tellhow.cavate.utils;
import java.util.List;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
/**
* 泰豪公司自定义响应结构,需要引入jackson相关的jar包
*/
public class TellhowResult {
// 定义jackson对象
private static final ObjectMapper MAPPER = new ObjectMapper();
// 响应业务状态
private Integer status;//例如 :200 400 500 200正确 400错误 500异常
// 响应消息
private String msg;//例如:成功 失败
// 响应中的数据
private Object data;
/**
* 自定义方法,都需返回对应的构造方法,生成代餐的TellhowResult对象
*/
//3个参数的build方法, 参数1:状态; 参数2:信息; 参数3:数据类型
public static TellhowResult build(Integer status, String msg, Object data) {
return new TellhowResult(status, msg, data);
}
//2个参数的build方法, 参数1:状态; 参数2:信息;
public static TellhowResult build(Integer status, String msg) {
return new TellhowResult(status, msg, null);
}
//1个参数的ok方法, 参数1:数据类型;
public static TellhowResult ok(Object data) {
return new TellhowResult(data);
}
//0个参数的ok方法
public static TellhowResult ok() {
return new TellhowResult(null);
}
/**
* 将json结果集转化为TellhowResult对象
*
* @param jsonData json数据
* @param clazz TellhowResult中的object类型
* @return
*/
public static TellhowResult formatToPojo(String jsonData, Class<?> clazz) {
try {
if (clazz == null) {
return MAPPER.readValue(jsonData, TellhowResult.class);
}
JsonNode jsonNode = MAPPER.readTree(jsonData);
JsonNode data = jsonNode.get("data");
Object obj = null;
if (clazz != null) {
if (data.isObject()) {
obj = MAPPER.readValue(data.traverse(), clazz);
} else if (data.isTextual()) {
obj = MAPPER.readValue(data.asText(), clazz);
}
}
return build(jsonNode.get("status").intValue(), jsonNode.get("msg").asText(), obj);
} catch (Exception e) {
return null;
}
}
/**
* 没有object对象的转化
*
* @param json
* @return
*/
public static TellhowResult format(String json) {
try {
return MAPPER.readValue(json, TellhowResult.class);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* Object是集合转化
*
* @param jsonData json数据
* @param clazz 集合中的类型
* @return
*/
public static TellhowResult formatToList(String jsonData, Class<?> clazz) {
try {
JsonNode jsonNode = MAPPER.readTree(jsonData);
JsonNode data = jsonNode.get("data");
Object obj = null;
if (data.isArray() && data.size() > 0) {
obj = MAPPER.readValue(data.traverse(),
MAPPER.getTypeFactory().constructCollectionType(List.class, clazz));
}
return build(jsonNode.get("status").intValue(), jsonNode.get("msg").asText(), obj);
} catch (Exception e) {
return null;
}
}
//构造方法
public TellhowResult() {
}
public TellhowResult(Integer status, String msg, Object data) {
this.status = status;
this.msg = msg;
this.data = data;
}
public TellhowResult(Object data) {
this.status = 200;
this.msg = "OK";
this.data = data;
}
//参数的get,set方法
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
}
| [
"root@qq.com"
] | root@qq.com |
542335afd516a4544dc6bec6455460ff648c5aaa | 4d7d2b851a41d7d986150ebccb7f1301b2499a67 | /QXVideoLib/src/main/java/org/bson/io/OutputBuffer.java | 75fa57be654c90c6659881f1f3893f5b79c051f6 | [] | no_license | improj/android | 0231d57f4f3c304ed38c6ff95f3cc53176b2156e | eec49b4766624f84c05fd8746ac98ed62fe13d32 | refs/heads/master | 2020-04-28T10:19:52.001946 | 2019-03-12T11:55:34 | 2019-03-12T11:55:34 | 175,197,994 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 4,500 | java | // OutputBuffer.java
/**
* Copyright (C) 2008 10gen Inc.
*
* 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.bson.io;
import java.io.*;
import java.security.*;
import org.bson.util.Util;
public abstract class OutputBuffer extends OutputStream {
public abstract void write(byte[] b);
public abstract void write(byte[] b, int off, int len);
public abstract void write(int b);
public abstract int getPosition();
public abstract void setPosition( int position );
public abstract void seekEnd();
public abstract void seekStart();
/**
* @return size of data so far
*/
public abstract int size();
/**
* @return bytes written
*/
public abstract int pipe( OutputStream out )
throws IOException;
/**
* mostly for testing
*/
public byte [] toByteArray(){
try {
final ByteArrayOutputStream bout = new ByteArrayOutputStream( size() );
pipe( bout );
return bout.toByteArray();
}
catch ( IOException ioe ){
throw new RuntimeException( "should be impossible" , ioe );
}
}
public String asString(){
return new String( toByteArray() );
}
public String asString( String encoding )
throws UnsupportedEncodingException {
return new String( toByteArray() , encoding );
}
public String hex(){
final StringBuilder buf = new StringBuilder();
try {
pipe( new OutputStream(){
public void write( int b ){
String s = Integer.toHexString(0xff & b);
if (s.length() < 2)
buf.append("0");
buf.append(s);
}
}
);
}
catch ( IOException ioe ){
throw new RuntimeException( "impossible" );
}
return buf.toString();
}
public String md5(){
final MessageDigest md5 ;
try {
md5 = MessageDigest.getInstance("MD5");
}
catch (NoSuchAlgorithmException e) {
throw new RuntimeException("Error - this implementation of Java doesn't support MD5.");
}
md5.reset();
try {
pipe( new OutputStream(){
public void write( byte[] b , int off , int len ){
md5.update( b , off , len );
}
public void write( int b ){
md5.update( (byte)(b&0xFF) );
}
}
);
}
catch ( IOException ioe ){
throw new RuntimeException( "impossible" );
}
return Util.toHex( md5.digest() );
}
public void writeInt( int x ){
write( x >> 0 );
write( x >> 8 );
write( x >> 16 );
write( x >> 24 );
}
public void writeIntBE( int x ){
write( x >> 24 );
write( x >> 16 );
write( x >> 8 );
write( x );
}
public void writeInt( int pos , int x ){
final int save = getPosition();
setPosition( pos );
writeInt( x );
setPosition( save );
}
public void writeLong( long x ){
write( (byte)(0xFFL & ( x >> 0 ) ) );
write( (byte)(0xFFL & ( x >> 8 ) ) );
write( (byte)(0xFFL & ( x >> 16 ) ) );
write( (byte)(0xFFL & ( x >> 24 ) ) );
write( (byte)(0xFFL & ( x >> 32 ) ) );
write( (byte)(0xFFL & ( x >> 40 ) ) );
write( (byte)(0xFFL & ( x >> 48 ) ) );
write( (byte)(0xFFL & ( x >> 56 ) ) );
}
public void writeDouble( double x ){
writeLong( Double.doubleToRawLongBits( x ) );
}
public String toString(){
return getClass().getName() + " size: " + size() + " pos: " + getPosition() ;
}
}
| [
"16408015@qq.com"
] | 16408015@qq.com |
dad445e2a5bc5e5b435ce7b5495adc51438b1119 | 541298b7b5299c8d3c1186c77e7e5d1391951a4a | /bit/SpringTest/diTest04/src/com/bit/exam01/MainTest.java | e27c24be6acb96a3ac75d0d247b69e86c4ae44f1 | [] | no_license | ldh85246/Rong | ec055f4522a1023343abaac47e6506348ddeac04 | f176327d20324f1ad01a2019305b60aca313e101 | refs/heads/master | 2022-10-04T11:28:20.854497 | 2020-09-15T10:56:12 | 2020-09-15T10:56:12 | 211,037,350 | 0 | 1 | null | 2022-09-01T23:31:54 | 2019-09-26T08:19:33 | Java | WINDOWS-1252 | Java | false | false | 446 | java | package com.bit.exam01;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
public class MainTest {
public static void main(String[] args) {
// TODO Auto-generated method stub
ApplicationContext context
= new AnnotationConfigApplicationContext(SpringConfig.class);
Person p =(Person) context.getBean("p");
p.eat("¸ÆÁÖ");
}
}
| [
"go85246@hanmail.net"
] | go85246@hanmail.net |
fc29365247c22dc2c0683dca765705a3bcf5ca1a | 6700e654ae6bdad028fd7f0cef05f0889dd16051 | /mobile/src/main/java/it/unipi/wearmusic/ListenerService.java | 6ec43de286352d21bd740808200129fad0da311b | [] | no_license | nchungdev/WearMusic | 4e107d7f57b4909f3afa36f538484d029fcf7827 | f150c93f918febabd314b75fe6581fa9a91f960a | refs/heads/master | 2021-12-16T14:43:54.415806 | 2017-09-20T09:44:48 | 2017-09-20T09:44:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,702 | java | package it.unipi.wearmusic;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.media.AudioManager;
import android.os.Binder;
import android.os.Handler;
import android.os.IBinder;
import android.util.Log;
import android.widget.ImageButton;
import com.google.android.gms.wearable.MessageApi;
import com.google.android.gms.wearable.MessageEvent;
import com.google.android.gms.wearable.WearableListenerService;
import it.unipi.wearmusic.MainActivity;
import static android.media.AudioManager.ADJUST_LOWER;
import static android.media.AudioManager.ADJUST_RAISE;
public class ListenerService extends WearableListenerService{
public static final String ACTION_MSG_RECEIVED = "it.unipi.wearmusic.Received";
private static final String COMMAND_KEY = "command";
private static final String TAG = "WearMusic";
Intent intent;
@Override
public void onCreate() {
super.onCreate();
intent = new Intent(ACTION_MSG_RECEIVED);
}
private void sendCommand(String msg) {
Log.i(TAG, "SendCommand");
intent.putExtra(COMMAND_KEY,msg);
sendBroadcast(intent);
}
@Override
public void onDestroy() {
super.onDestroy();
}
@Override
public void onMessageReceived(MessageEvent messageEvent) {
Log.i(TAG, "messaggio ricevuto");
if (messageEvent.getPath().equals("/wear_message")) {
String mess = new String(messageEvent.getData());
Log.i(TAG, "ricevuto: " + mess);
sendCommand(mess);
}
}
} | [
"Francesco_fdr@libero.it"
] | Francesco_fdr@libero.it |
b1befca54ae04aa3b37916e0325811cf7a035b34 | b6bfa7d59c7788b1da187fa6c8c4b421deefae35 | /demo/src/main/java/com/example/demo/DemoApplication.java | 1baaad6324cbc55fda66878a67ab424e802d797f | [] | no_license | dimmxx/lab | 099195f30437c2ef81beb9a20ce5ce6ff73e1e96 | d3f1a926fb0f2bfdf79458656bae8b2e9ca3da03 | refs/heads/master | 2021-06-21T15:19:30.012542 | 2020-02-12T20:31:50 | 2020-02-12T20:31:50 | 223,227,959 | 0 | 0 | null | 2021-06-04T02:21:36 | 2019-11-21T17:27:47 | JavaScript | UTF-8 | Java | false | false | 3,435 | java | package com.example.demo;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.*;
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
try {
FileInputStream excelFile = new FileInputStream(new File("src/main/resources/parse.xlsx"));
Workbook workbook = new XSSFWorkbook(excelFile);
String sheetName = "test";
Sheet sheet = workbook.getSheet(sheetName);
Map<Integer, List<String>> map = parseXLSXToMap(workbook, sheet);
map.entrySet().forEach(entry -> System.out.println(entry.getKey() + " " + entry.getValue()));
} catch (IOException e) {
e.printStackTrace();
}
}
public static Map<Integer, List<String>> parseXLSXToMap(Workbook workbook, Sheet sheet) {
//finding out the max number of cells in a row
int maxCellNum = 0;
for (Row row : sheet) {
if (maxCellNum < row.getLastCellNum()) maxCellNum = row.getLastCellNum();
}
System.out.println("Parsing started: " + sheet.getLastRowNum() + " rows, " + maxCellNum + " cells");
System.out.println(sheet.getNumMergedRegions());
System.out.println(Arrays.toString(sheet.getMergedRegions().toArray()));
System.out.println(sheet.getMergedRegion(2));
Map<Integer, List<String>> data = new HashMap<>();
for (int i = 0; i <= sheet.getLastRowNum(); i++) {
Row row = sheet.getRow(i);
if (row == null) {
sheet.createRow(i);
row = sheet.getRow(i);
}
data.put(i, new ArrayList<String>());
for (int j = 0; j <= maxCellNum; j++) {
Cell cell = row.getCell(j);
if (cell == null) {
row.createCell(j);
data.get(i).add("#NULL");
continue;
}
switch (cell.getCellType()) {
case STRING:
data.get(i).add(cell.getStringCellValue());
break;
case NUMERIC:
data.get(i).add(String.valueOf(cell.getNumericCellValue()));
break;
case BOOLEAN:
data.get(i).add("#BOOLEAN");
break;
case FORMULA:
data.get(i).add("#FORMULA");
break;
case BLANK:
data.get(i).add("0.0");
break;
case _NONE:
data.get(i).add("#_NONE");
break;
case ERROR:
data.get(i).add("#ERROR");
break;
default:
data.get(i).add("#VALUE");
}
}
}
return data;
}
} | [
"dimmxx@gmail.com"
] | dimmxx@gmail.com |
c52f3bb34c1e096334588caeb54f9e3db026d7c8 | 6ea3ce3754c892f48318362758a49b0e9713ada0 | /DealsDateBackend/DealsDateCartMicroService/src/main/java/com/cg/dealsdatecartmicroservice/service/CartIntf.java | fb6b7613f70ac4f5e4d506f424f1d8f1dcd46f5c | [] | no_license | shruti98dwivedi/DealsDateProject | 3eed56ea7a3a23dd10fac69d4f93d4e8b482f361 | c728795d42bc9ef68fddba5457df3356a3590626 | refs/heads/master | 2023-02-15T08:26:25.192028 | 2021-01-17T06:47:44 | 2021-01-17T06:47:44 | 330,188,697 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 464 | java | package com.cg.dealsdatecartmicroservice.service;
import java.util.List;
import com.cg.dealsdatecartmicroservice.entity.Cart;
import com.cg.dealsdatecartmicroservice.exception.CartException;
import com.cg.dealsdatecartmicroservice.model.CartModel;
public interface CartIntf{
public CartModel addToCart(Cart model) throws CartException;
public boolean removeFromCart(int id) throws CartException;
public List<Cart> getCart() throws CartException;
} | [
"dwivedishruti98@gmail.com"
] | dwivedishruti98@gmail.com |
394c20f084b290af9da805ca72dbd27b0d51e855 | 4c45ec4d2f8810b9350854d787b6e84d8cbbcdb1 | /wndjsbg-1.1/src/main/java/com/ccthanking/business/rygl/WuGongController.java | 83d85e8d22d71b95effb2d67baad0dc5e5598081 | [] | no_license | tigerisadandan/tianyu | 95ed49ed11a23d8e74cafce64c343ee3c2a23af4 | 20767b0acedbcecc277a86123f22dcc1e6ea020a | refs/heads/master | 2021-01-25T10:29:52.496359 | 2015-09-07T08:51:54 | 2015-09-07T08:51:54 | 41,982,285 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 7,259 | java | /* ==================================================================
* 版权: kcit 版权所有 (c) 2013
* 文件: rygl.service.WuGongController.java
* 创建日期: 2015-03-24 上午 11:44:51
* 功能: 服务控制类:务工信息
* 所含类: WuGongService
* 修改记录:
* 日期 作者 内容
* ==================================================================
* 2015-03-24 上午 11:44:51 龚伟雄 创建文件,实现基本功能
*
* ==================================================================
*/
package com.ccthanking.business.rygl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ccthanking.business.rygl.service.WuGongService;
import com.ccthanking.framework.common.User;
import com.ccthanking.framework.common.rest.handle.servlet.RestContext;
import com.ccthanking.framework.model.requestJson;
/**
* <p> WuGongController.java </p>
* <p> 功能:务工信息 </p>
*
* <p><a href="WuGongController.java.html"><i>查看源代码</i></a></p>
*
* @author <a href="mailto:gongwx_java@163.com">龚伟雄</a>
* @version 0.1
* @since 2015-03-24
*
*/
@Controller
@RequestMapping("/rygl/wuGongController")
public class WuGongController {
private static Logger logger = LoggerFactory.getLogger(WuGongController.class);
@Autowired
private WuGongService wuGongService;
/**
* 查询json
*
* @param json
* @return
* @throws Exception
*/
@RequestMapping(params = "query")
@ResponseBody
public requestJson queryCondition(final HttpServletRequest request, requestJson json) throws Exception {
User user = RestContext.getCurrentUser();
logger.info("<{}>执行操作【务工信息查询】",user.getName());
requestJson j = new requestJson();
String domresult = "";
domresult = this.wuGongService.queryCondition(json.getMsg());
j.setMsg(domresult);
return j;
}
/**
* 保存数据json
*
* @param json
* @return
* @throws Exception
*/
@RequestMapping(params = "insert")
@ResponseBody
protected requestJson insert(final HttpServletRequest request, requestJson json) throws Exception {
User user = RestContext.getCurrentUser();
logger.info("<{}>执行操作【务工信息新增】",user.getName());
requestJson j = new requestJson();
String resultVO = "";
resultVO = this.wuGongService.insert(json.getMsg());
j.setMsg(resultVO);
return j;
}
/**
* 修改记录.
*
* @param request
* @param json
* @return
* @throws Exception
* @since v1.00
*/
@RequestMapping(params = "update")
@ResponseBody
protected requestJson update(HttpServletRequest request, requestJson json) throws Exception {
User user = RestContext.getCurrentUser();
logger.info("<{}>执行操作【务工信息修改】",user.getName());
requestJson j = new requestJson();
String resultVO = "";
resultVO = this.wuGongService.update(json.getMsg());
j.setMsg(resultVO);
return j;
}
/**
* 删除记录.
*
* @param request
* @param json
* @return
* @throws Exception
* @since v1.00
*/
@RequestMapping(params = "delete")
@ResponseBody
public requestJson delete(HttpServletRequest request, requestJson json) throws Exception {
User user = RestContext.getCurrentUser();
logger.info("<{}>执行操作【务工信息删除】",user.getName());
requestJson j = new requestJson();
String resultVO = "";
resultVO = this.wuGongService.delete(json.getMsg());
j.setMsg(resultVO);
return j;
}
/**
* 查询json
*
* @param json
* @return
* @throws Exception
*/
@RequestMapping(params = "wugongtj")
@ResponseBody
public requestJson wugongtj(final HttpServletRequest request, requestJson json) throws Exception {
User user = RestContext.getCurrentUser();
logger.info("<{}>执行操作【务工信息查询】",user.getName());
requestJson j = new requestJson();
String domresult = "";
domresult = this.wuGongService.wugongtj(json.getMsg());
j.setMsg(domresult);
return j;
}
/**
* 查询json
*
* @param json
* @return
* @throws Exception
*/
@RequestMapping(params = "queryById")
@ResponseBody
public requestJson queryById(final HttpServletRequest request, requestJson json) throws Exception {
User user = RestContext.getCurrentUser();
logger.info("<{}>执行操作【务工信息查询】",user.getName());
requestJson j = new requestJson();
String domresult = "";
domresult = this.wuGongService.queryById(json.getMsg());
j.setMsg(domresult);
return j;
}
/**
* 查询json
*
* @param json
* @return
* @throws Exception
*/
@RequestMapping(params = "queryJineng")
@ResponseBody
public requestJson queryJineng(final HttpServletRequest request, requestJson json) throws Exception {
User user = RestContext.getCurrentUser();
logger.info("<{}>执行操作【务工信息查询】",user.getName());
requestJson j = new requestJson();
String domresult = "";
domresult = this.wuGongService.queryJineng(json.getMsg());
j.setMsg(domresult);
return j;
}
/**
* 查询json
*
* @param json
* @return
* @throws Exception
*/
@RequestMapping(params = "queryTijianInfo")
@ResponseBody
public requestJson queryTijianInfo(final HttpServletRequest request, requestJson json) throws Exception {
User user = RestContext.getCurrentUser();
logger.info("<{}>执行操作【务工信息查询】",user.getName());
requestJson j = new requestJson();
String domresult = "";
domresult = this.wuGongService.queryTijianInfo(json.getMsg());
j.setMsg(domresult);
return j;
}
/**
* 查询json
*
* @param json
* @return
* @throws Exception
*/
@RequestMapping(params = "queryGzqk")
@ResponseBody
public requestJson queryqueryGzqk(final HttpServletRequest request, requestJson json) throws Exception {
User user = RestContext.getCurrentUser();
logger.info("<{}>执行操作【务工信息查询】",user.getName());
requestJson j = new requestJson();
String domresult = "";
domresult = this.wuGongService.queryGzqk(json.getMsg());
j.setMsg(domresult);
return j;
}
}
| [
"943849983@qq.com"
] | 943849983@qq.com |
2ef510b004d255d34a071a419ae92fc6c44c2014 | 742fea78036543736c2382273a9944981c406c63 | /CurrencyConvert/app/src/test/java/com/okorkut/currencyconvert/ExampleUnitTest.java | b5249ca250a7647003fb471bdb0e159bed64ae03 | [] | no_license | oguzkorkut/AndroidExamples | 6e02fd56457d7fd7dac5b64d7cfcbe27cb4397e9 | 1a9900b428d982df7285463119b9451ebd932cdb | refs/heads/master | 2020-03-31T14:41:02.094481 | 2019-02-17T20:54:13 | 2019-02-17T20:54:13 | 152,305,007 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 388 | java | package com.okorkut.currencyconvert;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"oguzkrkt@gmail.com"
] | oguzkrkt@gmail.com |
8780021401284ee299e8fe64e30d5b1e911f8a86 | 1f3c00468850bc6e7794cb70efd8dd1c73eda1b5 | /ManagerServer/src/net/modol/LawSignedpdfEN.java | ebc2dfabfd6a448a941dde7ed1da1a9629af45dd | [] | no_license | litcas/PRJ | 2861f3eabe163465fb640b5259d0b946a3d3778a | 2cceb861502d8b7b0f54e4b99c50469b3c97b63a | refs/heads/master | 2021-06-27T19:32:47.168612 | 2017-09-17T05:44:31 | 2017-09-17T05:44:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,094 | java | package net.modol;
/**
* Created by Admin on 2016/11/23.
*/
public class LawSignedpdfEN {
private int id;
private String dir;
String unsigneddir;
public String getUnsigneddir() {
return unsigneddir;
}
public void setUnsigneddir(String unsigneddir) {
this.unsigneddir = unsigneddir;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getDir() {
return dir;
}
public void setDir(String dir) {
this.dir = dir;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
LawSignedpdfEN that = (LawSignedpdfEN) o;
if (id != that.id) return false;
if (dir != null ? !dir.equals(that.dir) : that.dir != null) return false;
return true;
}
@Override
public int hashCode() {
int result = id;
result = 31 * result + (dir != null ? dir.hashCode() : 0);
return result;
}
}
| [
"393054246@qq.com"
] | 393054246@qq.com |
089bce6f948831709b5a3482882a534ea82ed425 | cec43e0c08c68bbea2856a710f9314140f8920b1 | /src/main/java/io/swagger/model/Books.java | 3165ccba1f593278398fcdbc4d3d1dde0ec612e3 | [] | no_license | Lirone29/swagger-spring | 2cc7e21efa2fac99b21c2b0f88e96806b37ed249 | 34af664fffd9b8c68251192838e1ac20d9a68a7d | refs/heads/master | 2023-04-21T20:33:10.127369 | 2021-04-08T13:08:16 | 2021-04-08T13:08:16 | 355,911,415 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 740 | java | package io.swagger.model;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import java.io.Serializable;
import java.util.List;
@JacksonXmlRootElement(localName = "Books")
public class Books implements Serializable {
private static final long serialVersionUID = 1L;
@JacksonXmlProperty(localName = "Book")
@JacksonXmlElementWrapper(useWrapping = false)
protected List<Book> books = null;
public List<Book> getBooks() {
return books;
}
public void setBooks(List<Book> books) {
this.books = books;
}
}
| [
"235543@student.pwr.edu.pl"
] | 235543@student.pwr.edu.pl |
4efb588654cb65d3a32acb917bf9a834d5ee49d6 | 201e9bdc04e8d5ab7148b67f612d1d1b103e58b4 | /src/competitiveprogramming/chapter1/AdHoc/card/BeggarMyNeighbour/Main.java | 5a9208ca29101ac91545321de44cb1f5013d87fb | [] | no_license | munkhbat1900/contest | 44a8797e5e656c92ed70f3e5f23ae8234f7c709d | c017eb1acf14c1b56f5e4b5153ffefd5eef5385b | refs/heads/master | 2020-04-06T07:02:28.856857 | 2016-10-05T13:21:54 | 2016-10-05T13:21:54 | 41,925,980 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,474 | java | package competitiveprogramming.chapter1.AdHoc.card.BeggarMyNeighbour;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
/**
* @author munkhbat
* UVA 00162 Beggar My Neighbour
*/
class Player {
private List<Integer> card = new ArrayList<Integer>();
private boolean isLost = false;
public void dealCard(int c) {
card.add(c);
}
public int playCard() {
if (card.size() == 0) {
isLost = true;
return -1;
}
int c = card.get(card.size() - 1);
card.remove(card.size() - 1);
return c;
}
public boolean isLost() {
return isLost;
}
public void takeAll(List<Integer> c) {
List<Integer> tmp= new ArrayList<Integer>(c);
Collections.reverse(tmp);
tmp.addAll(card);
card = tmp;
}
public int getCardCount() {
return card.size();
}
}
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (true) {
Player player = new Player();
Player dealer = new Player();
for (int j = 0; j < 52; j++) {
String str = sc.next();
if (str.equals("#")) {
sc.close();
return;
}
int a = 0;
switch(str.charAt(1)) {
case 'A':
a = 4;
break;
case 'J':
a = 1;
break;
case 'Q':
a = 2;
break;
case 'K':
a = 3;
break;
default:
a = 0;
break;
}
if (j % 2 == 0) {
player.dealCard(a);
} else {
dealer.dealCard(a);
}
}
Player[] players = new Player[2];
players[0] = dealer;
players[1] = player;
// simulation begins
List<Integer> stack = new ArrayList<Integer>();
for (int p = 1; !dealer.isLost() && !player.isLost(); p = 1 - p) {
if (stack.size() == 0) {
stack.add(players[p].playCard());
continue;
}
int prev = stack.get(stack.size() - 1);
if (prev == 0) {
int c = players[p].playCard();
stack.add(c);
continue;
}
int k = 0;
boolean isTakeAll= true;
for (k = 0; k < prev; k++) {
int c = players[p].playCard();
if (players[p].isLost()) {
isTakeAll = false;
break;
}
stack.add(c);
if (c > 0) {
isTakeAll = false;
break;
}
}
if (isTakeAll) {
players[1 - p].takeAll(stack);
stack.clear();
}
}
if (player.isLost()) {
System.out.printf("1%3d\n", dealer.getCardCount());
} else {
System.out.printf("2%3d\n", player.getCardCount());
}
}
}
}
| [
"munkhbata@gmail.com"
] | munkhbata@gmail.com |
e41fa6265ee0b5daa0cc739ab8ad47abc86e8d29 | c178a5e7564f53f9aa5fa0376c8e32f3d8563fb9 | /src/com/duanxr/yith/easy/TwoSumIIInputArrayIsSorted.java | 1f463e6af84a38762a242650589d07b4c90de141 | [] | no_license | duanxr/Great-Algorithm-of-Yith | d775283648809a6f15bf4d7fa2f28c31551f0779 | 76110f9ce8e914f8deae8c18eba1cbf00b0d6e8a | refs/heads/master | 2021-12-01T10:20:29.155610 | 2021-11-23T02:56:24 | 2021-11-23T02:56:24 | 165,953,707 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,642 | java | package com.duanxr.yith.easy;
import java.util.HashMap;
import java.util.Map;
/**
* @author 段然 2021/3/8
*/
public class TwoSumIIInputArrayIsSorted {
/**
* Given an array of integers numbers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.
*
* Return the indices of the two numbers (1-indexed) as an integer array answer of size 2, where 1 <= answer[0] < answer[1] <= numbers.length.
*
* You may assume that each input would have exactly one solution and you may not use the same element twice.
*
*
*
* Example 1:
*
* Input: numbers = [2,7,11,15], target = 9
* Output: [1,2]
* Explanation: The sum of 2 and 7 is 9. Therefore index1 = 1, index2 = 2.
* Example 2:
*
* Input: numbers = [2,3,4], target = 6
* Output: [1,3]
* Example 3:
*
* Input: numbers = [-1,0], target = -1
* Output: [1,2]
*
*
* Constraints:
*
* 2 <= numbers.length <= 3 * 104
* -1000 <= numbers[i] <= 1000
* numbers is sorted in increasing order.
* -1000 <= target <= 1000
* Only one valid answer exists.
*
* 给定一个已按照 升序排列 的整数数组 numbers ,请你从数组中找出两个数满足相加之和等于目标数 target 。
*
* 函数应该以长度为 2 的整数数组的形式返回这两个数的下标值。numbers 的下标 从 1 开始计数 ,所以答案数组应当满足 1 <= answer[0] < answer[1] <= numbers.length 。
*
* 你可以假设每个输入只对应唯一的答案,而且你不可以重复使用相同的元素。
*
*
* 示例 1:
*
* 输入:numbers = [2,7,11,15], target = 9
* 输出:[1,2]
* 解释:2 与 7 之和等于目标数 9 。因此 index1 = 1, index2 = 2 。
* 示例 2:
*
* 输入:numbers = [2,3,4], target = 6
* 输出:[1,3]
* 示例 3:
*
* 输入:numbers = [-1,0], target = -1
* 输出:[1,2]
*
*
* 提示:
*
* 2 <= numbers.length <= 3 * 104
* -1000 <= numbers[i] <= 1000
* numbers 按 递增顺序 排列
* -1000 <= target <= 1000
* 仅存在一个有效答案
*
*/
class Solution {
public int[] twoSum(int[] numbers, int target) {
Map<Integer, Integer> map = new HashMap<>(numbers.length / 2);
for (int i = 0; i < numbers.length; i++) {
if (map.containsKey(target - numbers[i])) {
int[] r = new int[2];
r[0] = map.get(target - numbers[i]) + 1;
r[1] = i + 1;
return r;
}
map.put(numbers[i], i);
}
return null;
}
}
}
| [
"admin@duanxr.com"
] | admin@duanxr.com |
1a78a872463e3cc03bdf0a45d0d5efc28785fda0 | 221c6c2bfd8537d673b052aefd2624516a511ca6 | /the9/src/main/java/com/example/myapplication07/util/DateUtil.java | 09a5c4619f5fe3e2dcd9e4c92ad4c14c138735b1 | [] | no_license | qcy15035153885/2020---- | 1997a855956c36ef4a2ed9edabf0c3d42dba2e7d | 7e2c2d332eb060b39201069e7a6cb22a04deab61 | refs/heads/main | 2023-02-02T17:04:13.198337 | 2020-12-19T16:43:31 | 2020-12-19T16:43:31 | 306,804,440 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,049 | java | package com.example.myapplication07.util;
import android.text.TextUtils;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class DateUtil {
public static String getNowDateTime(String formatStr) {
String format = formatStr;
if (TextUtils.isEmpty(format)) {
format = "yyyyMMddHHmmss";
}
SimpleDateFormat sdf = new SimpleDateFormat(format);
return sdf.format(new Date());
}
public static String getNowTime() {
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
return sdf.format(new Date());
}
public static String getNowTimeDetail() {
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss.SSS");
return sdf.format(new Date());
}
public static String getNowDate() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
return sdf.format(new Date());
}
public static String getNowYearCN() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年");
return sdf.format(new Date());
}
public static int getNowYear() {
Calendar calendar = Calendar.getInstance();
return calendar.get(Calendar.YEAR);
}
public static int getNowMonth() {
Calendar calendar = Calendar.getInstance();
return calendar.get(Calendar.MONTH) + 1;
}
public static int getNowDay() {
Calendar calendar = Calendar.getInstance();
return calendar.get(Calendar.DAY_OF_MONTH);
}
public static String getAddDate(String str, long day_num) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
Date old_date;
try {
old_date = sdf.parse(str);
} catch (Exception e) {
e.printStackTrace();
return "";
}
long time = old_date.getTime();
long diff_time = day_num * 24 * 60 * 60 * 1000;
// LogUtil.debug(TAG, "day_num="+day_num+", diff_time="+diff_time);
time += diff_time;
Date new_date = new Date(time);
return sdf.format(new_date);
}
public static int getWeekIndex(String s_date) {
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
Date d_date;
try {
d_date = format.parse(s_date);
} catch (Exception e) {
e.printStackTrace();
return 1;
}
Calendar cal = Calendar.getInstance();
cal.setTime(d_date);
int week_index = cal.get(Calendar.DAY_OF_WEEK) - 1;
if (week_index == 0) {
week_index = 7;
}
return week_index;
}
public static boolean isHoliday(String text) {
boolean result = true;
if ((text.length() == 2 && (text.indexOf("月") > 0
|| text.contains("初") || text.contains("十")
|| text.contains("廿") || text.contains("卅")))
|| (text.length() == 3 && text.indexOf("月") > 0)) {
result = false;
}
return result;
}
}
| [
"853361278@qq.com"
] | 853361278@qq.com |
6db039774674b5e7b45626b3328ad51fae8d766d | d3b78e32bf4c5139aa8b09d4b29538e31731811f | /PortalService2/src/main/java/kr/ac/jejunu/userdao/UserServlet.java | 64fa793e456f062f36489b7e18978f82abc5c2a7 | [] | no_license | acisliver/PortalService | 5b1ec3e4f2ab7480950b75a8651159ccf47a312c | 4b9c0abfbcce30bdc71f0446cb0a278d7b13d50a | refs/heads/main | 2023-05-09T01:15:13.802295 | 2021-06-04T07:02:11 | 2021-06-04T07:02:11 | 344,729,628 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,686 | java | package kr.ac.jejunu.userdao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.stereotype.Controller;
import javax.servlet.*;
import java.io.IOException;
@Controller("/userServlet")
public class UserServlet extends GenericServlet {
@Autowired
private UserDao userDao;
@Override
public void destroy() {
System.out.println("*************** destroy *****************");
}
@Override
public void init(ServletConfig config) throws ServletException {
ApplicationContext applicationContext =
new AnnotationConfigApplicationContext("kr.ac.jejunu.userdao");
userDao = applicationContext.getBean("userDao", UserDao.class);
System.out.println("*************** init *****************");
}
@Override
public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
System.out.println("*************** service *****************");
// Integer id = Integer.parseInt(req.getParameter("id"));
User user = userDao.findById(1);
res.setContentType("text/html; charset=UTF-8");
StringBuffer response = new StringBuffer();
response.append("<html>");
response.append("<body>");
response.append("<h1>");
response.append(String.format("Hello %s !!!", user.getName()));
response.append("</h1>");
response.append("</body>");
response.append("</html>");
res.getWriter().println(response.toString());
}
} | [
"7273322@naver.com"
] | 7273322@naver.com |
773176832b3a0273650c92fda81bfc0100767f3d | 2d3394fa289c9ac1f76dfc88caed6a2f74c2d4dc | /src/boardGame/Board.java | da0820668437c54b9b6970708a12133a1fdf5a20 | [
"MIT"
] | permissive | murilodepa/Chess-System-Java | 0f4cd67d2051c9bd49f14fd8948820c80304d84f | 3d909732b5245b24b4e8ce84a102719578f58360 | refs/heads/master | 2022-04-06T07:23:14.478569 | 2020-02-22T03:59:32 | 2020-02-22T03:59:32 | 233,727,117 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,465 | 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 boardGame;
/**
*
* @author Murilo Araujo
*/
public class Board {
private int rows;
private int columns;
private Piece[][] pieces;
public Board(int rows, int columns) {
if(rows < 1 || columns < 1){
throw new BoardException("Error creating board: there must be at least 1 row and 1 column");
}
this.rows = rows;
this.columns = columns;
pieces = new Piece[rows][columns];
}
public int getRows() {
return rows;
}
public int getColumns() {
return columns;
}
public Piece piece(int row, int column) {
if(!positionExists(row, column)) {
throw new BoardException("Position not on the board");
}
return pieces[row][column];
}
public Piece piece(Position position){
if(!positionExists(position)) {
throw new BoardException("Position not on the board");
}
return pieces[position.getRow()][position.getColumn()];
}
public void placePiece(Piece piece, Position position) {
if (thereIsAPiece(position)) {
throw new BoardException("There is already a piece on position " + position);
}
pieces[position.getRow()][position.getColumn()] = piece;
piece.position = position;
}
public Piece removePiece(Position position) {
if(!positionExists(position)){
throw new BoardException("Position not on the board");
}
if (piece(position) == null){
return null;
}
Piece aux = piece(position);
aux.position = null;
pieces[position.getRow()][position.getColumn()] = null;
return aux;
}
private boolean positionExists(int row, int column){
return row >= 0 && row < rows && column >= 0 && column < columns;
}
public boolean positionExists(Position position){
return positionExists(position.getRow(), position.getColumn());
}
public boolean thereIsAPiece(Position position){
if(!positionExists(position)) {
throw new BoardException("Position not on the board");
}
return piece(position) != null;
}
}
| [
"murilodepa@gmail.com"
] | murilodepa@gmail.com |
4cd41646712e1ecf89b77e0a4c1c8df19967929b | 08be78ee28957fe393bea727228fbe13e5c00df1 | /modules/socket/src/main/java/com/socket/demo/ChatClient.java | 66ccaaadc6d02280c0f961c9ac08f4ca099d82f2 | [] | no_license | javachengwc/java-apply | 432259eadfca88c6f3f2b80aae8e1e8a93df5159 | 98a45c716f18657f0e4181d0c125a73feb402b16 | refs/heads/master | 2023-08-22T12:30:05.708710 | 2023-08-15T08:21:15 | 2023-08-15T08:21:15 | 54,971,501 | 10 | 4 | null | 2022-12-16T11:03:56 | 2016-03-29T11:50:21 | Java | UTF-8 | Java | false | false | 5,505 | java | package com.socket.demo;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.net.*;
import java.io.*;
import java.util.*;
public class ChatClient extends Applet {
TextField tfName = new TextField(15); //姓名输入文本域
Button btConnect = new Button("连接"); //连接按钮
Button btDisconnect = new Button("断开连接");
TextArea tfChat = new TextArea(8,27); //显示聊天信息文本框
Button btSend = new Button("发送");
TextField tfMessage = new TextField(30); //聊天输入
java.awt.List list1 = new java.awt.List(9); //显示在线用户信息
Socket socket=null; //连接端口
PrintStream ps=null; //输出流
Listen listen=null; //监听线程
public void init() { //Applet初始化
tfChat.setEditable(false); //设置信息显示框为不可编辑
Panel panel1 = new Panel(); //实例化面板
Panel panel2 = new Panel();
Panel panel3 = new Panel();
tfChat.setBackground(Color.white); //设置组件背景颜色
panel1.setBackground(Color.orange);
panel2.setBackground(Color.pink);
panel3.setBackground(Color.orange);
panel1.add(new Label("姓名:")); //增加组件到面板上
panel1.add(tfName);
panel1.add(btConnect);
panel1.add(btDisconnect);
panel2.add(tfChat);
panel2.add(list1);
panel3.add(new Label("聊天信息"));
panel3.add(tfMessage);
panel3.add(btSend);
setLayout(new BorderLayout()); //设置Applet布局管理器
add(panel1, BorderLayout.NORTH); //增加面板到Applet上
add(panel2, BorderLayout.CENTER);
add(panel3, BorderLayout.SOUTH);
}
public boolean action(Event evt,Object obj){ //事件处理
try{
if(evt.target==btConnect){ //点击连接按钮
if (socket==null){
socket=new Socket(InetAddress.getLocalHost(),5656); //实例化一个套接字
ps=new PrintStream(socket.getOutputStream()); //获取输出流
StringBuffer info=new StringBuffer("INFO: ");
String userinfo=tfName.getText()+":"+InetAddress.getLocalHost().toString();
ps.println(info.append(userinfo)); //输出信息
ps.flush();
listen=new Listen(this,tfName.getText(),socket); //实例化监听线程
listen.start(); //启动线程
}
}
else if(evt.target==btDisconnect){ //点击断开连接按钮
disconnect(); //调用断开连接方法
}
else if(evt.target==btSend){ //点击发送按钮
if(socket!=null){
StringBuffer msg=new StringBuffer("MSG: ");
String msgtxt=new String(tfMessage.getText());
ps.println(msg.append(tfMessage.getText())); //发送信息
ps.flush();
}
}
}
catch (Exception ex){
ex.printStackTrace(); //输出错误信息
}
return true;
}
public void disconnect() { //断开连接方法
if(socket!=null){
ps.println("QUIT"); //发送信息
ps.flush();
}
}
class Listen extends Thread{ //监听服务器传送的信息
String name=null; //用户名
BufferedReader reader ; //输入流
PrintStream ps=null; //输出流
Socket socket=null; //本地套接字
ChatClient client=null; //客户端ChatClient实例
public Listen(ChatClient p,String n,Socket s) {
client=p;
name=n;
socket=s;
try{
reader = new BufferedReader(new InputStreamReader(s.getInputStream())); //获取输入流
ps=new PrintStream(s.getOutputStream()); //获取输出流
}
catch(IOException ex){
client.disconnect(); //出错则断开连接
ex.printStackTrace(); //输出错误信息
}
}
public void run(){
String msg=null;
while(socket!=null){
try{
msg=reader.readLine(); //读取服务器端传来信息
}
catch(IOException ex){
client.disconnect(); //出错则断开连接
ex.printStackTrace(); //输出错误信息
}
if (msg==null) { //从服务器传来的信息为空则断开此次连接
client.listen=null;
client.socket=null;
client.list1.removeAll();
return;
}
StringTokenizer st=new StringTokenizer(msg,":"); //分解字符串
String keyword=st.nextToken();
if(keyword.equals("newUser")) { //新用户连接信息
client.list1.removeAll(); //移除原有用户名
while(st.hasMoreTokens()) { //取得目前所有聊天室用户名
String str=st.nextToken();
client.list1.add(str); //增加到用户列表中
}
}
else if(keyword.equals("MSG")) { //聊天信息
String usr=st.nextToken();
client.tfChat.append(usr); //增加聊天信息到信息显示框
client.tfChat.append(st.nextToken("\0"));
client.tfChat.append("\n");
}
else if(keyword.equals("QUIT")) { //断天连接信息
System.out.println("Quit");
try{
client.listen=null;
client.socket.close(); //关闭端口
client.socket=null;
}
catch(IOException e){}
client.list1.removeAll(); //移除用户列表
return;
}
}
}
}
}
| [
"chengwenchao@cd.tuan800.com"
] | chengwenchao@cd.tuan800.com |
b6c43fcb7ad3e0b25fc574a834cbd8014f4a33d0 | 4878f7ee6459634292c8cfbe7325e36ed37cb66e | /app/src/main/java/com/supets/pet/mock/ui/translate/SortAdapter.java | 4784ad93a85afd25de273d6932e852ca46200bad | [] | no_license | androidgwh/rabbit | cdae9e0cb50b31aeb36503847b67464b1c9a7656 | 2fcfaa5320d32c688dcd151c84558e97ac1b9621 | refs/heads/master | 2023-04-07T20:32:14.005310 | 2021-03-30T07:18:37 | 2021-03-30T07:18:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,095 | java | package com.supets.pet.mock.ui.translate;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.SectionIndexer;
import android.widget.TextView;
import com.supets.pet.mockui.R;
import java.util.ArrayList;
import java.util.List;
public class SortAdapter extends BaseAdapter implements SectionIndexer {
private List<SortModel> list = new ArrayList<>();
private Context mContext;
public SortAdapter(Context mContext) {
this.mContext = mContext;
}
public void updateListView(List<SortModel> list) {
this.list = list;
notifyDataSetInvalidated();
}
@Override
public int getCount() {
return this.list.size();
}
@Override
public Object getItem(int position) {
return list.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(final int position, View view, ViewGroup viewGroup) {
ViewHolder viewHolder;
final SortModel mContent = list.get(position);
if (view == null) {
viewHolder = new ViewHolder();
view = LayoutInflater.from(mContext).inflate(R.layout.m_pet_sort_item, viewGroup, false);
viewHolder.tvTitle = view.findViewById(R.id.title);
viewHolder.tvLetter = view.findViewById(R.id.catalog);
viewHolder.line=view.findViewById(R.id.line);
view.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) view.getTag();
}
int section = getSectionForPosition(position);
if (position == getPositionForSection(section)) {
viewHolder.tvLetter.setVisibility(View.VISIBLE);
viewHolder.tvLetter.setText(mContent.getSortLetters());
} else {
viewHolder.tvLetter.setVisibility(View.GONE);
}
viewHolder.tvTitle.setText(this.list.get(position).getName());
viewHolder.line.setVisibility(list.get(position).isLast?View.GONE:View.VISIBLE);
return view;
}
private final static class ViewHolder {
TextView tvLetter;
TextView tvTitle;
View line;
}
@Override
public int getSectionForPosition(int position) {
return list.get(position).getSortLetters().charAt(0);
}
@Override
public int getPositionForSection(int section) {
for (int i = 0; i < getCount(); i++) {
String sortStr = list.get(i).getSortLetters();
char firstChar = sortStr.toUpperCase().charAt(0);
if (firstChar == section) {
return i;
}
}
return -1;
}
private String getAlpha(String str) {
String sortStr = str.trim().substring(0, 1).toUpperCase();
if (sortStr.matches("[A-Z]")) {
return sortStr;
} else {
return "#";
}
}
@Override
public Object[] getSections() {
return null;
}
} | [
"254608684@qq.com"
] | 254608684@qq.com |
24d4dd483d977990e6fd44bfa73590bf51ff8d0e | eec5131ba75aabb91381a083dc3cc522794e2a11 | /src/com/scsb/servlet/ManagerPersonalServlet.java | 8817425be9c881f9e94b0baad9b367757dbcc8df | [] | no_license | rangerkao/scsbsmpp | ea015675bd56e8516bef4926910ac359e76f87e6 | e72dc7b47ffb6267fa8a49246dedb433770a31ca | refs/heads/master | 2021-01-10T05:38:58.095618 | 2016-01-25T03:48:56 | 2016-01-25T03:48:56 | 49,861,624 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,406 | java | package com.scsb.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.scsb.bean.Admin;
import com.scsb.bean.Smppuser;
import com.scsb.dao.AdminDAO;
import com.scsb.dao.SmppuserDAO;
import com.scsb.function.SendMail;
public class ManagerPersonalServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
resp.setContentType("text/html; charset=utf-8");
HttpSession session = req.getSession();
String type = req.getParameter("type");
String action = req.getParameter("action");
PrintWriter out = resp.getWriter();
/*------------------------ 會員註冊 -------------------------------------- */
if (type.equals("smppuser")&&action.equals("reg")){
SmppuserDAO smppuserDAO = new SmppuserDAO();
Smppuser smppuser = (Smppuser)req.getAttribute("reg");
int i = smppuserDAO.save(smppuser);
if(i==1){
resp.sendRedirect(req.getContextPath()+"/index_admin.jsp?type=smppuser&action=reg");
}else{
resp.sendRedirect("index_admin.jsp");
}
req.removeAttribute("reg");
}
/*------------------------ 管理員註冊 -------------------------------------- */
if(type.equals("admin")&&action.equals("reg")){
AdminDAO adminDAO = new AdminDAO();
Admin admin = (Admin)req.getAttribute("reg");
int i = adminDAO.save(admin);
if(i==1){
resp.sendRedirect(req.getContextPath()+"/index_admin.jsp?type=admin&action=reg");
}else{
resp.sendRedirect("index_admin.jsp");
}
req.removeAttribute("reg");
}
/*------------------------ 會員修改個人資料 -------------------------------------- */
if (type.equals("smppuser")&&action.equals("edit")){
SmppuserDAO smppuserDAO = new SmppuserDAO();
Smppuser smppuser = (Smppuser)req.getAttribute("edit");
int i = smppuserDAO.edit(smppuser);
if(i==1){
session.setAttribute("smppuser", smppuser);
out.println("<script languate='javascript'>alert('修改成功!');location.href='member/personal.jsp';</script>");
}else{
out.println("<script languate='javascript'>alert('修改失敗!');location.href='member/personal.jsp';</script>");
}
req.removeAttribute("edit");
}
/*------------------------ 管理者修改個人資料 -------------------------------------- */
if(type.equals("admin")&&action.equals("edit")){
AdminDAO adminDAO = new AdminDAO();
Admin admin = (Admin)req.getAttribute("edit");
int i = adminDAO.edit(admin);
if(i==1){
session.setAttribute("admin", admin);
out.println("<script languate='javascript'>alert('修改成功!');location.href='admin/personal.jsp';</script>");
}else{
out.println("<script languate='javascript'>alert('修改失敗!');location.href='admin/personal.jsp';</script>");
}
req.removeAttribute("edit");
}
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
doGet(req,resp);
}
}
| [
"ranger@gmail.com"
] | ranger@gmail.com |
96f1a53cb4167aeda08a8f8a695e861ae92e4b4b | 75a5a4c02ab65244da7d39802190412dc739a002 | /ExtList/src/com/adminsys/test/FailFast.java | daabdf1b53b14ac62226dbe8744dd5b4e11dfd50 | [] | no_license | memo012/list-source-study | 2fb15107a15181d8895a4f5459d62f4d01322b68 | cf6a0db50a82eeb0e234e2b947d82cbcc56c1b49 | refs/heads/master | 2020-09-30T21:32:03.074821 | 2019-12-19T00:41:52 | 2019-12-19T00:41:52 | 227,378,399 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,221 | java | package com.adminsys.test;
import java.util.ArrayList;
/**
* @Author: qiang
* @Description:
* @Create: 2019-12-12 07-11
**/
public class FailFast {
// 定义一个全局的集合存放 存在于高并发的情况下线程安全问题
private static ArrayList<String> list = new ArrayList<>();
public static void main(String[] args) {
/*
Fail-Fast 是我们Java集合框架为了解解决集合中结构发生改变的时候,快速失败的机制
*/
new FailFast().startRun();
}
private void startRun(){
new Thread(new ThreadOne()).start();
new Thread(new ThreadTwo()).start();
}
private class ThreadOne implements Runnable{
@Override
public void run() {
for (int i = 0; i < 20; i++) {
list.add("i:" + i);
print();
}
}
}
private class ThreadTwo implements Runnable{
@Override
public void run() {
for (int i = 0; i < 20; i++) {
list.add("i:" + i);
print();
}
}
}
public static void print(){
list.forEach((t)->System.out.println("t:"+t));
}
}
| [
"1158821459@qq.com"
] | 1158821459@qq.com |
5f8f32b5b512cbb46c8379e760a95bae50c069b1 | 6c96b9e48e33b38a8691be512339317fec71d298 | /src/com/javarush/task/task16/task1609/Solution.java | 886f3fa6134b07262520aeb99ea7bb56cfb3d7e8 | [] | no_license | vagif-lalaev/JavaRush-JavaCore | b7ee24a04e8995785abcbdb2588eb5aa995f9565 | 83cca34d4aa8373e21107efcd99a85adcdfe5d9d | refs/heads/master | 2020-05-09T21:09:49.870472 | 2019-04-16T07:08:22 | 2019-04-16T07:08:22 | 181,433,544 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 801 | java | package com.javarush.task.task16.task1609;
/*
Справедливость
*/
public class Solution {
public static void main(String[] args) throws InterruptedException {
Mouse alpha = new Mouse("#1");
//alpha.join();
Mouse mouse1 = new Mouse("#2");
Mouse mouse2 = new Mouse("#3");
}
private static void eating() {
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
}
}
public static class Mouse extends Thread {
public Mouse(String name) {
super(name);
start();
}
public void run() {
System.out.println(getName() + " starts eating");
eating();
System.out.println(getName() + " finished eating");
}
}
}
| [
"vagif-lalaev@yandex.ru"
] | vagif-lalaev@yandex.ru |
5645114b7f95916d4d1ae5f8bb6ad0c2aef72ee2 | ff3a46d84e0757d884882ea63e872db25985a6fc | /src/main/java/com/jsohpill/App.java | dfc20f73734a0db73ef811a5cc833d3dd03831f0 | [] | no_license | jsohpill/nothing | b1dab5a7524fa5d9e4fc97ecd08bcd4ab7693c2f | 5797b13b957ed301cad561200bbb38be01ad4a8c | refs/heads/master | 2021-07-14T20:12:38.131677 | 2019-10-22T11:32:51 | 2019-10-22T11:32:51 | 216,790,433 | 0 | 0 | null | 2020-10-13T16:54:09 | 2019-10-22T10:50:27 | Java | UTF-8 | Java | false | false | 217 | java | package com.jsohpill;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!");
Child child = new Child("Mike");
}
}
| [
"yuyanlin201268@gmail.com"
] | yuyanlin201268@gmail.com |
851a8ce1cb6d5b37efb6aeebfd2e06381af209e8 | 20a025b909e037b80331ea80e27bfc06d703ca12 | /Training/src/com/Java/WorkOutExamples/AdditionOfAllEvenNumbers.java | 7766379516783d953aa99f04a67d9a6af924d459 | [] | no_license | ramachandrareddyk/SeleniumJava | 2b4a44abf84f2878690091856e14af39aa405c16 | b7e9912ab42a49b697043d37ae906d6c947224b8 | refs/heads/master | 2020-06-16T17:10:36.163355 | 2019-07-08T15:43:24 | 2019-07-08T15:43:24 | 195,646,480 | 1 | 0 | null | 2019-07-08T15:43:25 | 2019-07-07T12:07:37 | HTML | UTF-8 | Java | false | false | 282 | java | package com.Java.WorkOutExamples;
public class AdditionOfAllEvenNumbers {
public static void main(String args[]) {
int count = 0;
for(int i = 1; i <= 1000; i++) {
if(i%2==0) {
count = count + i;
}
}
System.out.println("Sum of all even numbers:" + count);
}
}
| [
"ramureddy4555@gmail.com"
] | ramureddy4555@gmail.com |
fa333988a148689b7d77c128ad9c0980faf00fd0 | 033b7034cdc0e9da61d0eda7bd58721b6c162275 | /app/src/main/java/cn/kyrioscraft/mycraft/ui/MainActivity.java | 5ed9ac7c50136a876aeab7b38dba0dd7af4d3d66 | [] | no_license | Kyrioscraft/MyCraft | e1bca5fd7622b8e9bcaa53f5943865d5b6edf60c | 5859e9ed3d2d6beded3eb6933da26f5f16c8cdc4 | refs/heads/master | 2021-01-01T03:52:48.866006 | 2016-04-19T14:53:24 | 2016-04-19T14:53:24 | 56,606,061 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,861 | java | package cn.kyrioscraft.mycraft.ui;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.view.View;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;
import cn.kyrioscraft.mycraft.R;
import cn.kyrioscraft.mycraft.utils.Authenticator;
import cn.kyrioscraft.mycraft.utils.LogUtils;
public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
private static final String TAG = LogUtils.makeLogTag(MainActivity.class);
private Account[] accounts;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_main);
AccountManager am = AccountManager.get(this);
Account account = new Account("Kay","com.kyrioscraft");
Bundle userdata = new Bundle();
userdata.putString("miaoshu", "Kay");
am.addAccountExplicitly(account, "123", userdata);
Account account2 = new Account("Kay2","com.kyrioscraft");
Bundle userdata2 = new Bundle();
userdata2.putString("miaoshu","Kay2");
am.addAccountExplicitly(account2,"123",userdata2);
accounts = am.getAccountsByType("com.kyrioscraft");
ListView acl = (ListView) findViewById(R.id.account_lv);
acl.setAdapter(new AccountAdapter(accounts));
}
public class AccountAdapter extends BaseAdapter{
private Account[] mAccounts;
public AccountAdapter(Account[] accounts) {
this.mAccounts = accounts;
}
@Override
public int getCount() {
return mAccounts != null ? mAccounts.length : 0;
}
@Override
public Object getItem(int position) {
return mAccounts[position];
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
TextView tv = new TextView(getBaseContext());
tv.setText(mAccounts[position].name +" " + mAccounts[position].type);
return tv;
}
}
@Override
public boolean onNavigationItemSelected(MenuItem menuItem) {
return false;
}
}
| [
"kai qi"
] | kai qi |
4f8e2870ece9cb42ae5018377c34d5f70370e8f7 | eb05ddee5d76cce3db1500b4523c3e9e21dff5cf | /src/test/java/com/github/fddqdcb/parser/date/DatesTest.java | af301f4134ced53c7bd42803a7ef10c2f4d7207c | [] | no_license | fddqdcb/LogicalExpressions | 8efbf5a19255732b8bbe1d1050a7116b47229ea9 | 8df1158b9587b25f21cb41499cb4220adfe5c913 | refs/heads/main | 2023-01-21T18:32:10.999219 | 2020-11-25T08:22:00 | 2020-11-25T08:22:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,676 | java | package com.github.fddqdcb.parser.date;
import com.github.fddqdcb.parser.date.Dates;
import java.time.LocalDate;
import org.junit.Assert;
import org.junit.Test;
/**
*
* @author
*/
public class DatesTest
{
@Test
public void getDateTest()
{
Assert.assertEquals(LocalDate.of(2010, 5, 17), Dates.getDate("2010", "5", "17", Dates.Bound.lower));
Assert.assertEquals(LocalDate.of(2010, 5, 17), Dates.getDate("2010", "5", "17", Dates.Bound.upper));
Assert.assertEquals(LocalDate.of(2010, 1, 1), Dates.getDate("2010", "1", "1", Dates.Bound.lower));
Assert.assertEquals(LocalDate.of(2010, 1, 1), Dates.getDate("2010", "1", "1", Dates.Bound.upper));
Assert.assertEquals(LocalDate.of(2010, 1, 1), Dates.getDate("10", "01", "01", Dates.Bound.lower));
Assert.assertEquals(LocalDate.of(2010, 1, 1), Dates.getDate("10", "01", "01", Dates.Bound.upper));
Assert.assertEquals(LocalDate.of(2010, 4, 1), Dates.getDate("10", "04", null, Dates.Bound.lower));
Assert.assertEquals(LocalDate.of(2010, 4, 30), Dates.getDate("10", "04", null, Dates.Bound.upper));
Assert.assertEquals(LocalDate.of(2010, 5, 1), Dates.getDate("10", "05", null, Dates.Bound.lower));
Assert.assertEquals(LocalDate.of(2010, 5, 31), Dates.getDate("10", "05", null, Dates.Bound.upper));
Assert.assertEquals(LocalDate.of(2010, 1, 1), Dates.getDate("10", null, null, Dates.Bound.lower));
Assert.assertEquals(LocalDate.of(2010, 12, 31), Dates.getDate("10", null, null, Dates.Bound.upper));
}
// Test needs to be adjusted in year 2070
@Test
public void getFourDigitYearTest()
{
Assert.assertEquals(2000, Dates.getFourDigitYear(0));
Assert.assertEquals(2007, Dates.getFourDigitYear(7));
Assert.assertEquals(2015, Dates.getFourDigitYear(15));
Assert.assertEquals(2020, Dates.getFourDigitYear(20));
Assert.assertEquals(1970, Dates.getFourDigitYear(70));
Assert.assertEquals(1999, Dates.getFourDigitYear(99));
Assert.assertEquals(1970, Dates.getFourDigitYear(1970));
Assert.assertEquals(1999, Dates.getFourDigitYear(1999));
Assert.assertEquals(2000, Dates.getFourDigitYear(2000));
Assert.assertEquals(2007, Dates.getFourDigitYear(2007));
Assert.assertEquals(2020, Dates.getFourDigitYear(2020));
Assert.assertEquals(2070, Dates.getFourDigitYear(2070));
Assert.assertEquals(2099, Dates.getFourDigitYear(2099));
}
// Test neeed to be adjusted in year 2100
@Test
public void getCurrentCenturyTest()
{
Assert.assertEquals(2000, Dates.getCurrentCentury());
}
}
| [
"none@aol.com"
] | none@aol.com |
3d4f6a45691cc9d2d625f889594ae243ca331422 | 6bd50367d00c57cf915af7f7a6322a3f846f6bb4 | /pinyougou-sellergoods-service/src/main/java/com/pinyougou/sellergoods/service/impl/TypeTemplateServiceImpl.java | 1a8f392e53e1bd9ac8106e1b9ad11dd789185579 | [] | no_license | ceshizhanghao001/pinyougouparent | 0049407b2097113178a6dce67376db86fdca98c2 | 0b4dbfb88b50034294d9facb2b696330312f02e3 | refs/heads/master | 2020-03-28T17:24:08.591000 | 2018-09-16T03:29:00 | 2018-09-16T03:29:00 | 148,785,940 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,136 | java | package com.pinyougou.sellergoods.service.impl;
import java.util.List;
import com.pinyougou.vo.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.pinyougou.mapper.TbTypeTemplateMapper;
import com.pinyougou.pojo.TbTypeTemplate;
import com.pinyougou.pojo.TbTypeTemplateExample;
import com.pinyougou.pojo.TbTypeTemplateExample.Criteria;
import com.pinyougou.sellergoods.service.TypeTemplateService;
/**
* 服务实现层
* @author Administrator
*
*/
@Service
public class TypeTemplateServiceImpl implements TypeTemplateService {
@Autowired
private TbTypeTemplateMapper typeTemplateMapper;
/**
* 查询全部
*/
@Override
public List<TbTypeTemplate> findAll(TbTypeTemplate tbTypeTemplate) {
TbTypeTemplateExample tbTypeTemplateExample=new TbTypeTemplateExample();
Criteria criteria = tbTypeTemplateExample.createCriteria();
criteria.andNameLike("%"+tbTypeTemplate.getName()+"%");
return typeTemplateMapper.selectByExample(tbTypeTemplateExample);
}
/**
* 按分页查询
*/
@Override
public PageResult findPage(int pageNum, int pageSize) {
PageHelper.startPage(pageNum, pageSize);
Page<TbTypeTemplate> page= (Page<TbTypeTemplate>) typeTemplateMapper.selectByExample(null);
return new PageResult(page.getTotal(), page.getResult());
}
/**
* 增加
*/
@Override
public void add(TbTypeTemplate typeTemplate) {
typeTemplateMapper.insert(typeTemplate);
}
/**
* 修改
*/
@Override
public void update(TbTypeTemplate typeTemplate){
typeTemplateMapper.updateByPrimaryKey(typeTemplate);
}
/**
* 根据ID获取实体
* @param id
* @return
*/
@Override
public TbTypeTemplate findOne(Long id){
return typeTemplateMapper.selectByPrimaryKey(id);
}
/**
* 批量删除
*/
@Override
public void delete(Long[] ids) {
for(Long id:ids){
typeTemplateMapper.deleteByPrimaryKey(id);
}
}
@Override
public PageResult findPage(TbTypeTemplate typeTemplate, int pageNum, int pageSize) {
PageHelper.startPage(pageNum, pageSize);
TbTypeTemplateExample example=new TbTypeTemplateExample();
Criteria criteria = example.createCriteria();
if(typeTemplate!=null){
if(typeTemplate.getName()!=null && typeTemplate.getName().length()>0){
criteria.andNameLike("%"+typeTemplate.getName()+"%");
}
if(typeTemplate.getSpecIds()!=null && typeTemplate.getSpecIds().length()>0){
criteria.andSpecIdsLike("%"+typeTemplate.getSpecIds()+"%");
}
if(typeTemplate.getBrandIds()!=null && typeTemplate.getBrandIds().length()>0){
criteria.andBrandIdsLike("%"+typeTemplate.getBrandIds()+"%");
}
if(typeTemplate.getCustomAttributeItems()!=null && typeTemplate.getCustomAttributeItems().length()>0){
criteria.andCustomAttributeItemsLike("%"+typeTemplate.getCustomAttributeItems()+"%");
}
}
Page<TbTypeTemplate> page= (Page<TbTypeTemplate>)typeTemplateMapper.selectByExample(example);
return new PageResult(page.getTotal(), page.getResult());
}
}
| [
"1005979871@qq.com"
] | 1005979871@qq.com |
3c3569842ffdd441dd2a5360c7fc74ffa274a067 | 573d4bd2fbda83e4b067804659446ba75df4b72b | /project/android/MiiReader/app/src/main/java/com/moses/miiread/widget/ScrollTextView.java | bd2d3d04c24269f4d89795d93486f258ff84bde8 | [] | no_license | chang1157/openmiiread | d98c1565d4e3b56f12f49e0ea135647b112c2cc2 | 06e12e0afa38346a6cda7f5dc8eb1451e82ba36b | refs/heads/master | 2021-06-18T08:58:38.678645 | 2021-03-30T13:41:47 | 2021-03-30T13:41:47 | 194,989,400 | 17 | 2 | null | null | null | null | UTF-8 | Java | false | false | 3,231 | java | package com.moses.miiread.widget;
import android.annotation.SuppressLint;
import android.content.Context;
import android.text.Layout;
import android.util.AttributeSet;
import android.view.MotionEvent;
import androidx.appcompat.widget.AppCompatTextView;
public class ScrollTextView extends AppCompatTextView {
//滑动距离的最大边界
private int mOffsetHeight;
//是否到顶或者到底的标志
private boolean mBottomFlag = false;
public ScrollTextView(Context context) {
super(context);
}
public ScrollTextView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public ScrollTextView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
initOffsetHeight();
}
@Override
protected void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) {
super.onTextChanged(text, start, lengthBefore, lengthAfter);
initOffsetHeight();
}
private void initOffsetHeight() {
int paddingTop;
int paddingBottom;
int mHeight;
int mLayoutHeight;
//获得内容面板
Layout mLayout = getLayout();
if (mLayout == null) return;
//获得内容面板的高度
mLayoutHeight = mLayout.getHeight();
//获取上内边距
paddingTop = getTotalPaddingTop();
//获取下内边距
paddingBottom = getTotalPaddingBottom();
//获得控件的实际高度
mHeight = getMeasuredHeight();
//计算滑动距离的边界
mOffsetHeight = mLayoutHeight + paddingTop + paddingBottom - mHeight;
if (mOffsetHeight <= 0) {
scrollTo(0, 0);
}
}
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
//如果是新的按下事件,则对mBottomFlag重新初始化
mBottomFlag = mOffsetHeight <= 0;
}
//如果已经不要这次事件,则传出取消的信号,这里的作用不大
if (mBottomFlag) {
event.setAction(MotionEvent.ACTION_CANCEL);
}
return super.dispatchTouchEvent(event);
}
@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouchEvent(MotionEvent event) {
boolean result = super.onTouchEvent(event);
//如果是需要拦截,则再拦截,这个方法会在onScrollChanged方法之后再调用一次
if (!mBottomFlag)
getParent().requestDisallowInterceptTouchEvent(true);
return result;
}
@Override
protected void onScrollChanged(int horiz, int vert, int oldHoriz, int oldVert) {
super.onScrollChanged(horiz, vert, oldHoriz, oldVert);
if (vert == mOffsetHeight || vert == 0) {
//这里触发父布局或祖父布局的滑动事件
getParent().requestDisallowInterceptTouchEvent(false);
mBottomFlag = true;
}
}
}
| [
"234531164@qq.com"
] | 234531164@qq.com |
e76689a54bba321c88456e3852435d7b09741e78 | 81c7067c8170e3e61530522835577fd5e58527c1 | /app/src/main/java/com/zjzy/morebit/fragment/CommissonFragment.java | 6976f19131c31d7f29ef9c03c65dcfe247d5f7ec | [
"Apache-2.0"
] | permissive | Lchenghui/morebit-android-app | 7806295750770f8fb55483797f621bc88054d259 | c889f6c3efdc3b96fbff48a23b0d01a65d6b8aa5 | refs/heads/master | 2023-02-26T18:31:51.575690 | 2020-09-14T09:35:00 | 2020-09-14T09:35:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,008 | java | package com.zjzy.morebit.fragment;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
import com.zjzy.morebit.Module.common.widget.SwipeRefreshLayout;
import com.zjzy.morebit.R;
import com.zjzy.morebit.goodsvideo.adapter.CommissionClassAdapter;
import com.zjzy.morebit.goodsvideo.adapter.VideoGoodsAdapter;
import com.zjzy.morebit.goodsvideo.contract.VideoContract;
import com.zjzy.morebit.goodsvideo.presenter.VideoPresenter;
import com.zjzy.morebit.mvp.base.base.BaseView;
import com.zjzy.morebit.mvp.base.frame.MvpFragment;
import com.zjzy.morebit.pojo.ShopGoodInfo;
import com.zjzy.morebit.pojo.VideoClassBean;
import com.zjzy.morebit.utils.SpaceItemDecorationUtils;
import java.util.ArrayList;
import java.util.List;
/**
* 高佣分类
*/
public class CommissonFragment extends MvpFragment<VideoPresenter> implements VideoContract.View {
private RecyclerView rcy_videclass;
private String catId="";
private CommissionClassAdapter videoGoodsAdapter;
private int minId=1;
private List<ShopGoodInfo> list=new ArrayList<>();
private SwipeRefreshLayout swipeList;
private LinearLayout searchNullTips_ly;
public static CommissonFragment newInstance(String name, String id) {
CommissonFragment fragment = new CommissonFragment();
Bundle args = new Bundle();
Log.e("id",id);
args.putString("id", id);
fragment.setArguments(args);
return fragment;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return super.onCreateView(inflater, container, savedInstanceState);
}
@Override
protected void initData() {
getData();
}
private void getData() {
mPresenter.getCommissionGoods(this,catId,minId);
}
@Override
protected void initView(View view) {
Bundle arguments = getArguments();
if (arguments != null) {
catId = arguments.getString("id");
}
rcy_videclass = view.findViewById(R.id.rcy_videclass);
swipeList=view.findViewById(R.id.swipeList);
searchNullTips_ly=view.findViewById(R.id.searchNullTips_ly);
GridLayoutManager manager = new GridLayoutManager(getActivity(), 2);
//设置图标的间距
SpaceItemDecorationUtils spaceItemDecorationUtils = new SpaceItemDecorationUtils(20, 2);
rcy_videclass.setLayoutManager(manager);
rcy_videclass.addItemDecoration(spaceItemDecorationUtils);
swipeList.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
minId=1;
initData();
refreshLayout.finishRefresh(true);//刷新完成
}
});
swipeList.setOnLoadMoreListener(new OnLoadMoreListener() {
@Override
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
minId++;
initData();
}
});
}
@Override
protected int getViewLayout() {
return R.layout.fragment_video;
}
@Override
public BaseView getBaseView() {
return this;
}
@Override
public void onVideoClassSuccess(List<VideoClassBean> shopGoodInfo) {
}
@Override
public void onVideoClassError(String throwable) {
}
@Override
public void onVideoGoodsSuccess(List<ShopGoodInfo> shopGoodInfo) {
}
@Override
public void onVideoGoodsError() {
}
@Override
public void onCommissionGoodsSuccess(List<ShopGoodInfo> shopGoodInfo) {
list= shopGoodInfo;
if (shopGoodInfo!=null&& shopGoodInfo.size() != 0){
searchNullTips_ly.setVisibility(View.GONE);
if (minId==1){
videoGoodsAdapter = new CommissionClassAdapter(getActivity(),shopGoodInfo);
rcy_videclass.setAdapter(videoGoodsAdapter);
}else{
videoGoodsAdapter.loadMore(list);
swipeList.finishLoadMore(false);
}
}else{
swipeList.finishLoadMore(false);
}
}
@Override
public void onCommissionGoodsError() {
swipeList.finishLoadMore(false);
if (minId==1){
searchNullTips_ly.setVisibility(View.VISIBLE);
}else{
searchNullTips_ly.setVisibility(View.GONE);
}
}
}
| [
"1658865887@qq.com"
] | 1658865887@qq.com |
e0625ba8d12f8e9e3588c13805f9faeb261b18d0 | af0048b7c1fddba3059ae44cd2f21c22ce185b27 | /dubbo/src/main/java/org/apache/dubbo/rpc/cluster/router/condition/config/AppRouterFactory.java | 8a53181b5a1e67ada86db70053a8f39489925fb9 | [] | no_license | P79N6A/whatever | 4b51658fc536887c870d21b0c198738ed0d1b980 | 6a5356148e5252bdeb940b45d5bbeb003af2f572 | refs/heads/master | 2020-07-02T19:58:14.366752 | 2019-08-10T14:45:17 | 2019-08-10T14:45:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 885 | java | package org.apache.dubbo.rpc.cluster.router.condition.config;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.extension.Activate;
import org.apache.dubbo.configcenter.DynamicConfiguration;
import org.apache.dubbo.rpc.cluster.Router;
import org.apache.dubbo.rpc.cluster.RouterFactory;
@Activate(order = 200)
public class AppRouterFactory implements RouterFactory {
public static final String NAME = "app";
private volatile Router router;
@Override
public Router getRouter(URL url) {
if (router != null) {
return router;
}
synchronized (this) {
if (router == null) {
router = createRouter(url);
}
}
return router;
}
private Router createRouter(URL url) {
return new AppRouter(DynamicConfiguration.getDynamicConfiguration(), url);
}
}
| [
"heavenlystate@163.com"
] | heavenlystate@163.com |
5500b14a3325dc0502250da15789a7335e9ff66f | 8fa853474f5d8914baf381a9a465a539ee741ede | /android/src/java/planets/core/SplashActivity.java | e950f879dd417412ce601e2d098664f90e7034c4 | [] | no_license | setupminimal/planets | 1880411d7fc2512805ee1a085fa8f9779a23b919 | 30364879905dd3c5d5a99375e25e48fa7c54a8cf | refs/heads/master | 2016-09-07T07:40:23.515666 | 2014-05-31T13:02:21 | 2014-05-31T13:02:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,144 | java | package planets.core;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.TextView;
import android.util.Log;
import clojure.lang.Symbol;
import clojure.lang.Var;
import clojure.lang.RT;
import planets.core.R;
public class SplashActivity extends Activity {
private static boolean firstLaunch = true;
private static String TAG = "Splash";
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
if (firstLaunch) {
firstLaunch = false;
setupSplash();
loadClojure();
} else {
proceed();
}
}
public void setupSplash() {
setContentView(R.layout.splashscreen);
TextView appNameView = (TextView)findViewById(R.id.splash_app_name);
appNameView.setText(R.string.app_name);
Animation rotation = AnimationUtils.loadAnimation(this, R.anim.splash_rotation);
ImageView circleView = (ImageView)findViewById(R.id.splash_circles);
circleView.startAnimation(rotation);
}
public void proceed() {
startActivity(new Intent("planets.core.MAIN"));
finish();
}
public void loadClojure() {
new Thread(new Runnable(){
@Override
public void run() {
Symbol CLOJURE_MAIN = Symbol.intern("neko.init");
Var REQUIRE = RT.var("clojure.core", "require");
REQUIRE.invoke(CLOJURE_MAIN);
Var INIT = RT.var("neko.init", "init");
INIT.invoke(SplashActivity.this.getApplication());
try {
Class.forName("planets.core.AndroidLauncher");
} catch (ClassNotFoundException e) {
Log.e(TAG, "Failed loading AndroidLauncher", e);
}
proceed();
}
}).start();
}
}
| [
"Daroc.Alden@gmail.com"
] | Daroc.Alden@gmail.com |
9352f27bc88558a29ee90b4323eb5a882b8dfa3b | 4bfa4e705ec11e644b6886c64972118f0c7a940c | /src/main/java/org/logink/cloud/api/gateway/demo/util/SignUtil.java | 85d1b2c869f1d72706005b8d7b88c24fbe65c676 | [] | no_license | huojuntao/logink-cloud-api-railway-demo-java | 6c0fa7b680cdf422ba2a911cd128ab1d3f41c04a | 5c60a4c7f26661629ddb1dae9e1cf109175c2029 | refs/heads/master | 2021-09-01T18:33:54.512495 | 2017-12-28T08:10:23 | 2017-12-28T08:10:23 | 113,631,599 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,931 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.logink.cloud.api.gateway.demo.util;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang.StringUtils;
import org.logink.cloud.api.gateway.demo.constant.Constants;
import org.logink.cloud.api.gateway.demo.constant.HttpHeader;
import org.logink.cloud.api.gateway.demo.constant.SystemHeader;
/**
* 绛惧悕宸ュ叿
*/
public class SignUtil {
/**
* 计算签名
*
* @param secret 用户APP密钥
* @param headers 所有header信息
* @param signHeaderPrefixList 参与签名的header信息
* @return 签名值
*/
public static String sign(String secret, Map<String, String> headers, List<String> signHeaderPrefixList) {
try {
Mac hmacSha256 = Mac.getInstance(Constants.HMAC_SHA256);
byte[] keyBytes = secret.getBytes(Constants.ENCODING);
hmacSha256.init(new SecretKeySpec(keyBytes, 0, keyBytes.length, Constants.HMAC_SHA256));
return new String(Base64.encodeBase64(
hmacSha256.doFinal(buildStringToSign(headers,signHeaderPrefixList)
.getBytes(Constants.ENCODING))),
Constants.ENCODING);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
* Build String used to sign
* @param headers
* @param signHeaderPrefixList
* @return
*/
private static String buildStringToSign(Map<String, String> headers, List<String> signHeaderPrefixList) {
StringBuilder sb = new StringBuilder();
if (null != headers) {
if (null != headers.get(HttpHeader.HTTP_HEADER_ACCEPT)) {
sb.append(headers.get(HttpHeader.HTTP_HEADER_ACCEPT));
}
sb.append(Constants.LF);
if (null != headers.get(HttpHeader.HTTP_HEADER_CONTENT_MD5)) {
sb.append(headers.get(HttpHeader.HTTP_HEADER_CONTENT_MD5));
}
sb.append(Constants.LF);
if (null != headers.get(HttpHeader.HTTP_HEADER_CONTENT_TYPE)) {
sb.append(headers.get(HttpHeader.HTTP_HEADER_CONTENT_TYPE));
}
sb.append(Constants.LF);
if (null != headers.get(HttpHeader.HTTP_HEADER_DATE)) {
sb.append(headers.get(HttpHeader.HTTP_HEADER_DATE));
}
}
sb.append(Constants.LF);
sb.append(buildHeaders(headers, signHeaderPrefixList));
return sb.toString();
}
/**
* Build headers String that used to sign
* @param headers
* @param signHeaderPrefixList
* @return
*/
private static String buildHeaders(Map<String, String> headers, List<String> signHeaderPrefixList) {
StringBuilder sb = new StringBuilder();
if (null != signHeaderPrefixList) {
signHeaderPrefixList.remove(SystemHeader.X_CA_SIGNATURE);
signHeaderPrefixList.remove(HttpHeader.HTTP_HEADER_ACCEPT);
signHeaderPrefixList.remove(HttpHeader.HTTP_HEADER_CONTENT_MD5);
signHeaderPrefixList.remove(HttpHeader.HTTP_HEADER_CONTENT_TYPE);
signHeaderPrefixList.remove(HttpHeader.HTTP_HEADER_DATE);
Collections.sort(signHeaderPrefixList);
if (null != headers) {
Map<String, String> sortMap = new TreeMap<String, String>();
sortMap.putAll(headers);
StringBuilder signHeadersStringBuilder = new StringBuilder();
for (Map.Entry<String, String> header : sortMap.entrySet()) {
if (isHeaderToSign(header.getKey(), signHeaderPrefixList)) {
// sb.append(header.getKey());
// sb.append(Constants.SPE2);
if (!StringUtils.isBlank(header.getValue())) {
sb.append(header.getValue());
}
sb.append(Constants.LF);
if (0 < signHeadersStringBuilder.length()) {
signHeadersStringBuilder.append(Constants.SPE1);
}
signHeadersStringBuilder.append(header.getKey());
}
}
headers.put(SystemHeader.X_CA_SIGNATURE_HEADERS, signHeadersStringBuilder.toString());
}
}
return sb.toString();
}
/**
* Return true if header is used to sign
*/
private static boolean isHeaderToSign(String headerName, List<String> signHeaderPrefixList) {
if (StringUtils.isBlank(headerName)) {
return false;
}
if (headerName.startsWith(Constants.CA_HEADER_TO_SIGN_PREFIX_SYSTEM)) {
return true;
}
if (null != signHeaderPrefixList) {
for (String signHeaderPrefix : signHeaderPrefixList) {
if (headerName.equalsIgnoreCase(signHeaderPrefix)) {
return true;
}
}
}
return false;
}
}
| [
"33516616+huojuntao@users.noreply.github.com"
] | 33516616+huojuntao@users.noreply.github.com |
71888376e424b06be8dc98ab11c5f503ac8a4c9b | 8ce0671d68f1427c8dfcd125c7fbd82d9dd3e028 | /domain-api/jbb-event-registry/src/main/java/org/jbb/security/event/SignOutEvent.java | 8f0a0059b5040da0b4dd753fc311eef0c9dd2888 | [
"Apache-2.0"
] | permissive | viviand2020/jbb | 740cecc3ccc9a4a9b99510a4546caf4689e23630 | fcfccadf55e5de9e65a13e6f4ef3f5b20453fbb7 | refs/heads/master | 2020-03-07T06:07:26.247758 | 2017-10-11T05:03:17 | 2017-10-11T05:03:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 677 | java | /*
* Copyright (C) 2017 the original author or authors.
*
* This file is part of jBB Application Project.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*/
package org.jbb.security.event;
import javax.validation.constraints.NotNull;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.ToString;
import org.jbb.lib.eventbus.JbbEvent;
@Getter
@ToString
@RequiredArgsConstructor
public class SignOutEvent extends JbbEvent {
@NotNull
private final Long memberId;
@Getter
private final boolean sessionExpired;
}
| [
"baart92@gmail.com"
] | baart92@gmail.com |
26ed69ca31ee2975caa540b4e83b57419cc3674d | f626d025282ca887c512a3b6fc4a39f155b6e6ec | /src/main/java/com/product/app/configuration/CorsFilter.java | 3eeac94d39d92e6a11deae71bfd19c85a22b898e | [] | no_license | dmholland/UCADwebservice | 3faa1fc15dc82ac6efa25a4f0e018a99182d7b86 | 8542a9ec801909c38930e37cf49ab810e02b2b95 | refs/heads/master | 2022-11-28T03:52:24.876539 | 2020-08-01T14:11:13 | 2020-08-01T14:11:13 | 278,986,678 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,781 | java | //package com.product.app.configuration;
//
//import org.springframework.stereotype.Component;
//import org.springframework.web.filter.OncePerRequestFilter;
//
//import javax.servlet.FilterChain;
//import javax.servlet.ServletException;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//import java.util.Arrays;
//import java.util.List;
//
///**
// * Arpit Khatri
// */
//@Component
//public class CorsFilter extends OncePerRequestFilter {
//
// @Override
// protected void doFilterInternal(final HttpServletRequest request, final HttpServletResponse response,
// final FilterChain filterChain) throws ServletException, IOException {
// final List<String> allowedOrigins = Arrays.asList("http://localhost");
// //final List<String> allowedOrigins = Arrays.asList("http://localhost:4200");
// String origin = request.getHeader("Origin");
// response.setHeader("Access-Control-Allow-Origin", allowedOrigins.contains(origin) ? origin : "");
// response.setHeader("Vary", "Origin");
// response.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT, PATCH, HEAD");
// response.addHeader("Access-Control-Allow-Headers", "authorization,accepts,Origin, Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers");
// response.addHeader("Access-Control-Expose-Headers", "authorization,accepts,Access-Control-Allow-Origin, Access-Control-Allow-Credentials");
// response.addHeader("Access-Control-Allow-Credentials", "true");
// response.addIntHeader("Access-Control-Max-Age", 10);
// filterChain.doFilter(request, response);
// }
//} | [
"khatri.arpit@gmail.com"
] | khatri.arpit@gmail.com |
b079bf05d093c59949aaa3b736e2733e49b5b165 | 47b2a5d7b567e0e2f66fd22a015c923054b542fd | /app/src/main/java/com/example/poc/MerchantDashboard.java | c06d0cffeb14ef0fd44261d234ecd87dedb7617d | [] | no_license | LeeMunKit/Poc | 1c736815738b351e27927a8fbeb5b4c244253ac7 | d4351b0da5be140c01e5cb36839b6bcf969a26e8 | refs/heads/master | 2020-05-03T03:14:17.614937 | 2019-04-19T07:14:16 | 2019-04-19T07:14:16 | 178,392,726 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 347 | java | package com.example.poc;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MerchantDashboard extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_merchant_dashboard);
}
}
| [
"munkit.lee@softspace.com.my"
] | munkit.lee@softspace.com.my |
d613f5418d07d8cba4b986eea4d6fb9cff4d17f0 | db8104664d9767bbac684f37fde26dbeaa356402 | /src/main/java/com/maviance/protecting_queen/exceptions/InvalidDimensionException.java | 3ca69b15b1e24d8d6ea32b7fd45291efde9dad05 | [] | no_license | rostowich/protect_queen | 11fc3c0ec35a46f22ed77f14f500f0b782cb294f | 1ff63652c0c498b40e590965bc0d9097f6a9c74a | refs/heads/master | 2021-01-25T10:22:25.929767 | 2019-04-10T12:00:14 | 2019-04-10T12:00:14 | 122,176,357 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 301 | java | package com.maviance.protecting_queen.exceptions;
public class InvalidDimensionException extends Exception {
private static final long serialVersionUID = 1L;
public InvalidDimensionException() {
super();
}
public InvalidDimensionException(String errorMessage) {
super(errorMessage);
}
}
| [
"rostowgokeng@gmail.com"
] | rostowgokeng@gmail.com |
8c1b2d1068916567f95e0278d972d570bd0feb4b | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/30/30_3a3417f1572179ba1f1de4b416c83afd9d56d791/LibraryActivity/30_3a3417f1572179ba1f1de4b416c83afd9d56d791_LibraryActivity_s.java | dd4cf016709ecefda94e6060a61a57aaefc5c169 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 22,582 | java | /*
* Copyright (C) 2011 Alex Kuiper
*
* This file is part of PageTurner
*
* PageTurner is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PageTurner 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 PageTurner. If not, see <http://www.gnu.org/licenses/>.*
*/
package net.nightwhistler.pageturner.activity;
import java.io.File;
import java.text.DateFormat;
import java.util.Date;
import java.util.List;
import net.nightwhistler.pageturner.Configuration;
import net.nightwhistler.pageturner.Configuration.LibrarySelection;
import net.nightwhistler.pageturner.Configuration.LibraryView;
import net.nightwhistler.pageturner.R;
import net.nightwhistler.pageturner.library.ImportCallback;
import net.nightwhistler.pageturner.library.ImportTask;
import net.nightwhistler.pageturner.library.LibraryBook;
import net.nightwhistler.pageturner.library.LibraryService;
import net.nightwhistler.pageturner.library.QueryResult;
import net.nightwhistler.pageturner.library.QueryResultAdapter;
import net.nightwhistler.pageturner.view.BookCaseView;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import roboguice.activity.RoboActivity;
import roboguice.inject.InjectResource;
import roboguice.inject.InjectView;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MenuItem.OnMenuItemClickListener;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.RadioButton;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.ViewSwitcher;
import com.google.inject.Inject;
public class LibraryActivity extends RoboActivity implements ImportCallback {
@Inject
private LibraryService libraryService;
@InjectView(R.id.librarySpinner)
private Spinner spinner;
@InjectView(R.id.libraryList)
private ListView listView;
@InjectView(R.id.bookCaseView)
private BookCaseView bookCaseView;
@InjectResource(R.drawable.river_diary)
private Drawable backupCover;
@InjectView(R.id.libHolder)
private ViewSwitcher switcher;
@Inject
private Configuration config;
private static final int[] ICONS = { R.drawable.book_binoculars,
R.drawable.book_add, R.drawable.book_star,
R.drawable.book, R.drawable.user };
private QueryResultAdapter<LibraryBook> bookAdapter;
private static final DateFormat DATE_FORMAT = DateFormat.getDateInstance(DateFormat.LONG);
private ProgressDialog waitDialog;
private ProgressDialog importDialog;
private AlertDialog importQuestion;
private boolean askedUserToImport;
private boolean oldKeepScreenOn;
private static final Logger LOG = LoggerFactory.getLogger(LibraryActivity.class);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.library_menu);
if ( savedInstanceState != null ) {
this.askedUserToImport = savedInstanceState.getBoolean("import_q", false);
}
if ( config.getLibraryView() == LibraryView.BOOKCASE ) {
this.bookAdapter = new BookCaseAdapter(this);
this.bookCaseView.setAdapter(bookAdapter);
if ( switcher.getDisplayedChild() == 0 ) {
switcher.showNext();
}
} else {
this.bookAdapter = new BookListAdapter(this);
this.listView.setAdapter(bookAdapter);
}
ArrayAdapter<String> adapter = new QueryMenuAdapter(this,
getResources().getStringArray(R.array.libraryQueries));
spinner.setAdapter(adapter);
spinner.setOnItemSelectedListener(new MenuSelectionListener());
this.waitDialog = new ProgressDialog(this);
this.waitDialog.setOwnerActivity(this);
this.importDialog = new ProgressDialog(this);
this.importDialog.setOwnerActivity(this);
importDialog.setTitle(R.string.importing_books);
importDialog.setMessage(getString(R.string.scanning_epub));
registerForContextMenu(this.listView);
}
private void onBookClicked( LibraryBook book ) {
Intent intent = new Intent(this, ReadingActivity.class);
intent.setData( Uri.parse(book.getFileName()));
this.setResult(RESULT_OK, intent);
startActivityIfNeeded(intent, 99);
}
private void showBookDetails( final LibraryBook libraryBook ) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.book_details);
LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.book_details, null);
builder.setView( layout );
ImageView coverView = (ImageView) layout.findViewById(R.id.coverImage );
if ( libraryBook.getCoverImage() != null ) {
coverView.setImageBitmap( libraryBook.getCoverImage() );
} else {
coverView.setImageDrawable( getResources().getDrawable(R.drawable.river_diary));
}
TextView titleView = (TextView) layout.findViewById(R.id.titleField);
TextView authorView = (TextView) layout.findViewById(R.id.authorField);
TextView lastRead = (TextView) layout.findViewById(R.id.lastRead);
TextView added = (TextView) layout.findViewById(R.id.addedToLibrary);
TextView descriptionView = (TextView) layout.findViewById(R.id.bookDescription);
titleView.setText(libraryBook.getTitle());
String authorText = String.format( getString(R.string.book_by),
libraryBook.getAuthor().getFirstName() + " "
+ libraryBook.getAuthor().getLastName() );
authorView.setText( authorText );
if (libraryBook.getLastRead() != null && ! libraryBook.getLastRead().equals(new Date(0))) {
String lastReadText = String.format(getString(R.string.last_read),
DATE_FORMAT.format(libraryBook.getLastRead()));
lastRead.setText( lastReadText );
} else {
String lastReadText = String.format(getString(R.string.last_read), getString(R.string.never_read));
lastRead.setText( lastReadText );
}
String addedText = String.format( getString(R.string.added_to_lib),
DATE_FORMAT.format(libraryBook.getAddedToLibrary()));
added.setText( addedText );
descriptionView.setText(libraryBook.getDescription());
builder.setNegativeButton(android.R.string.cancel, null);
builder.setPositiveButton(R.string.read, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
onBookClicked(libraryBook);
}
});
builder.show();
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {
int pos;
if ( menuInfo != null ) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
pos = info.position;
} else {
pos = (Integer) v.getTag();
}
final LibraryBook selectedBook = bookAdapter.getResultAt(pos);
MenuItem detailsItem = menu.add( R.string.view_details);
detailsItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
showBookDetails(selectedBook);
return true;
}
});
MenuItem deleteItem = menu.add(R.string.delete);
deleteItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
libraryService.deleteBook( selectedBook.getFileName() );
new LoadBooksTask().execute(config.getLastLibraryQuery());
return true;
}
});
}
private void startImport(File startFolder, boolean copy) {
ImportTask importTask = new ImportTask(this, libraryService, this, copy);
importDialog.setOnCancelListener(importTask);
importDialog.show();
this.oldKeepScreenOn = listView.getKeepScreenOn();
listView.setKeepScreenOn(true);
importTask.execute(startFolder);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.library_menu, menu);
OnMenuItemClickListener toggleListener = new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
if ( switcher.getDisplayedChild() == 0 ) {
bookAdapter = new BookCaseAdapter(LibraryActivity.this);
bookCaseView.setAdapter(bookAdapter);
config.setLibraryView(LibraryView.BOOKCASE);
} else {
bookAdapter = new BookListAdapter(LibraryActivity.this);
listView.setAdapter(bookAdapter);
config.setLibraryView(LibraryView.LIST);
}
switcher.showNext();
new LoadBooksTask().execute(config.getLastLibraryQuery());
return true;
}
};
MenuItem shelves = menu.findItem(R.id.shelves_view);
shelves.setOnMenuItemClickListener(toggleListener);
MenuItem list = menu.findItem(R.id.list_view);
list.setOnMenuItemClickListener(toggleListener);
MenuItem prefs = menu.findItem(R.id.preferences);
prefs.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
Intent intent = new Intent(LibraryActivity.this, PageTurnerPrefsActivity.class);
startActivity(intent);
return true;
}
});
MenuItem scan = menu.findItem(R.id.scan_books);
scan.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
AlertDialog dialog = showImportDialog();
dialog.show();
return true;
}
});
return true;
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
boolean bookCaseActive = switcher.getDisplayedChild() != 0;
menu.findItem(R.id.shelves_view).setVisible(! bookCaseActive);
menu.findItem(R.id.list_view).setVisible(bookCaseActive);
return true;
}
private AlertDialog showImportDialog() {
AlertDialog.Builder builder;
LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
final View layout = inflater.inflate(R.layout.import_dialog, null);
final RadioButton scanSpecific = (RadioButton) layout.findViewById(R.id.radioScanFolder);
final TextView folder = (TextView) layout.findViewById(R.id.folderToScan);
final CheckBox copyToLibrary = (CheckBox) layout.findViewById(R.id.copyToLib);
folder.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
scanSpecific.setChecked(true);
}
});
//Copy default setting from the prefs
copyToLibrary.setChecked( config.isCopyToLibrayEnabled() );
builder = new AlertDialog.Builder(this);
builder.setView(layout);
OnClickListener okListener = new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
if ( scanSpecific.isChecked() ) {
startImport(new File(folder.getText().toString()), copyToLibrary.isChecked() );
} else {
startImport(new File("/sdcard"), copyToLibrary.isChecked());
}
}
};
builder.setTitle(R.string.import_books);
builder.setPositiveButton(android.R.string.ok, okListener );
builder.setNegativeButton(android.R.string.cancel, null );
return builder.create();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
outState.putBoolean("import_q", askedUserToImport);
}
@Override
protected void onStop() {
this.libraryService.close();
this.waitDialog.dismiss();
this.importDialog.dismiss();
super.onStop();
}
@Override
public void onBackPressed() {
finish();
}
@Override
protected void onPause() {
this.bookAdapter.clear();
this.libraryService.close();
//We clear the list to free up memory.
super.onPause();
}
@Override
protected void onResume() {
super.onResume();
LibrarySelection lastSelection = config.getLastLibraryQuery();
if ( spinner.getSelectedItemPosition() != lastSelection.ordinal() ) {
spinner.setSelection(lastSelection.ordinal());
} else {
new LoadBooksTask().execute(lastSelection);
}
}
@Override
public void importCancelled() {
listView.setKeepScreenOn(oldKeepScreenOn);
//Switch to the "recently added" view.
if ( spinner.getSelectedItemPosition() == LibrarySelection.LAST_ADDED.ordinal() ) {
new LoadBooksTask().execute(LibrarySelection.LAST_ADDED);
} else {
spinner.setSelection(LibrarySelection.LAST_ADDED.ordinal());
}
}
@Override
public void importComplete(int booksImported, List<String> errors) {
importDialog.hide();
OnClickListener dismiss = new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
};
//If the user cancelled the import, don't bug him/her with alerts.
if ( (! errors.isEmpty()) ) {
AlertDialog.Builder builder = new AlertDialog.Builder(LibraryActivity.this);
builder.setTitle(R.string.import_errors);
builder.setItems( errors.toArray(new String[errors.size()]), null );
builder.setNeutralButton(android.R.string.ok, dismiss );
builder.show();
}
listView.setKeepScreenOn(oldKeepScreenOn);
if ( booksImported > 0 ) {
//Switch to the "recently added" view.
if ( spinner.getSelectedItemPosition() == LibrarySelection.LAST_ADDED.ordinal() ) {
new LoadBooksTask().execute(LibrarySelection.LAST_ADDED);
} else {
spinner.setSelection(LibrarySelection.LAST_ADDED.ordinal());
}
} else {
AlertDialog.Builder builder = new AlertDialog.Builder(LibraryActivity.this);
builder.setTitle(R.string.no_books_found);
builder.setMessage( getString(R.string.no_bks_fnd_text) );
builder.setNeutralButton(android.R.string.ok, dismiss);
builder.show();
}
}
@Override
public void importFailed(String reason) {
importDialog.hide();
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.import_failed);
builder.setMessage(reason);
builder.setNeutralButton(android.R.string.ok, null);
builder.show();
}
@Override
public void importStatusUpdate(String update) {
importDialog.setMessage(update);
}
/**
* Based on example found here:
* http://www.vogella.de/articles/AndroidListView/article.html
*
* @author work
*
*/
private class BookListAdapter extends QueryResultAdapter<LibraryBook> {
private Context context;
public BookListAdapter(Context context) {
this.context = context;
}
@Override
public View getView(int index, final LibraryBook book, View convertView,
ViewGroup parent) {
View rowView;
if ( convertView == null ) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
rowView = inflater.inflate(R.layout.book_row, parent, false);
} else {
rowView = convertView;
}
rowView.setOnClickListener( new View.OnClickListener() {
public void onClick(View v) {
onBookClicked(book);
}
});
TextView titleView = (TextView) rowView.findViewById(R.id.bookTitle);
TextView authorView = (TextView) rowView.findViewById(R.id.bookAuthor);
TextView dateView = (TextView) rowView.findViewById(R.id.addedToLibrary);
TextView progressView = (TextView) rowView.findViewById(R.id.readingProgress);
ImageView imageView = (ImageView) rowView.findViewById(R.id.bookCover);
String authorText = String.format(getString(R.string.book_by),
book.getAuthor().getFirstName() + " " + book.getAuthor().getLastName() );
authorView.setText(authorText);
titleView.setText(book.getTitle());
if ( book.getProgress() > 0 ) {
progressView.setText( "" + book.getProgress() + "%");
} else {
progressView.setText("");
}
String dateText = String.format(getString(R.string.added_to_lib),
DATE_FORMAT.format(book.getAddedToLibrary()));
dateView.setText( dateText );
if ( book.getCoverImage() != null ) {
imageView.setImageBitmap(book.getCoverImage());
} else {
imageView.setImageDrawable(backupCover);
}
return rowView;
}
}
private class BookCaseAdapter extends QueryResultAdapter<LibraryBook> {
private Context context;
public BookCaseAdapter(Context context) {
this.context = context;
}
@Override
public View getView(int index, final LibraryBook object, View convertView,
ViewGroup parent) {
View result;
if ( convertView == null ) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
result = inflater.inflate(R.layout.bookcase_row, parent, false);
} else {
result = convertView;
}
registerForContextMenu(result);
result.setTag(index);
result.setOnClickListener( new View.OnClickListener() {
@Override
public void onClick(View v) {
onBookClicked(object);
}
});
ImageView image = (ImageView) result.findViewById(R.id.bookCover);
Bitmap bitmap = object.getCoverImage();
if ( bitmap != null ) {
image.setImageBitmap( object.getCoverImage() );
} else {
image.setImageDrawable(backupCover);
}
return result;
}
}
private class QueryMenuAdapter extends ArrayAdapter<String> {
String[] strings;
public QueryMenuAdapter(Context context, String[] strings) {
super(context, android.R.layout.simple_spinner_item, strings);
this.strings = strings;
}
@Override
public View getDropDownView(int position, View convertView,
ViewGroup parent) {
View rowView;
if ( convertView == null ) {
LayoutInflater inflater = (LayoutInflater) getContext()
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
rowView = inflater.inflate(R.layout.menu_row, parent, false);
} else {
rowView = convertView;
}
TextView textView = (TextView) rowView.findViewById(R.id.menuText);
textView.setText(strings[position]);
textView.setTextColor(Color.BLACK);
ImageView img = (ImageView) rowView.findViewById(R.id.icon);
img.setImageResource(ICONS[position]);
return rowView;
}
}
private void buildImportQuestionDialog() {
if ( importQuestion != null ) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(LibraryActivity.this);
builder.setTitle(R.string.no_books_found);
builder.setMessage( getString(R.string.scan_bks_question) );
builder.setPositiveButton(android.R.string.yes, new android.content.DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
startImport(new File("/sdcard"), config.isCopyToLibrayEnabled());
}
});
builder.setNegativeButton(android.R.string.no, new android.content.DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
importQuestion = null;
}
});
this.importQuestion = builder.create();
}
private class MenuSelectionListener implements OnItemSelectedListener {
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1, int pos,
long arg3) {
LibrarySelection newSelections = LibrarySelection.values()[pos];
config.setLastLibraryQuery(newSelections);
bookAdapter.clear();
new LoadBooksTask().execute(newSelections);
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
}
}
private class LoadBooksTask extends AsyncTask<Configuration.LibrarySelection, Integer, QueryResult<LibraryBook>> {
private Configuration.LibrarySelection sel;
@Override
protected void onPreExecute() {
waitDialog.setTitle(R.string.loading_library);
waitDialog.show();
}
@Override
protected QueryResult<LibraryBook> doInBackground(Configuration.LibrarySelection... params) {
this.sel = params[0];
switch ( sel ) {
case LAST_ADDED:
return libraryService.findAllByLastAdded();
case UNREAD:
return libraryService.findUnread();
case BY_TITLE:
return libraryService.findAllByTitle();
case BY_AUTHOR:
return libraryService.findAllByAuthor();
default:
return libraryService.findAllByLastRead();
}
}
@Override
protected void onPostExecute(QueryResult<LibraryBook> result) {
bookAdapter.setResult(result);
waitDialog.hide();
if ( sel == Configuration.LibrarySelection.LAST_ADDED && result.getSize() == 0 && ! askedUserToImport ) {
askedUserToImport = true;
buildImportQuestionDialog();
importQuestion.show();
}
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
23ccef95b37ce63f0258c147acade00ef919a72d | a02c6cb80fc620766ba366db18d8308e4646bf99 | /crm-oauth2/src/test/java/com/aliyun/cloudcallcenter/crm/api/test/OpenPermissionServiceTest.java | 7665601d0fa3846e36612df407d2adc972aebb45 | [] | no_license | leejinki1/ccc-crm-demo-java | 4e6822d229e35a00592d688be8aae8699ddd11fd | 309967aecc059151cd39b95c7f5ba67f46cb1e5b | refs/heads/master | 2020-04-10T00:32:58.792489 | 2018-12-10T19:39:35 | 2018-12-10T19:39:35 | 160,688,670 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,466 | java | package com.aliyun.cloudcallcenter.crm.api.test;
import com.alibaba.fastjson.JSONObject;
import com.aliyun.cloudcallcenter.crm.CrmDemoApplicationTests;
import com.aliyuncs.CommonRequest;
import com.aliyuncs.CommonResponse;
import com.aliyuncs.exceptions.ClientException;
import org.junit.Assert;
import org.junit.Test;
/**
* Created by lingyi on 17/11/22.
*/
public class OpenPermissionServiceTest extends CrmDemoApplicationTests {
// @Test
// public void testListRoleWithInstanceNotExist() {
//
// CommonRequest commonRequest = new CommonRequest();
// commonRequest.setDomain("ccc.aliyuncs.com");
// commonRequest.setVersion("2017-07-05");
// commonRequest.setAction("listroles");
// commonRequest.putQueryParameter("InstanceId", "instance1");
// commonRequest.putQueryParameter("SecurityToken", getSecurityToken());
// commonRequest.putQueryParameter("AccessKeyId", getAccessKeyId());
//
// CommonResponse response = null;
// try {
// response = getClient().getCommonResponse(commonRequest);
// JSONObject resultData = JSONObject.parseObject(response.getData());
// System.out.println("验证错误码");
// System.out.println(JSONObject.toJSONString(response));
// Assert.assertEquals("NotExist.Instance", resultData.getString("Code"));
// } catch (ClientException e) {
// e.printStackTrace();
// }
// }
}
| [
"zql.eamil@example.com"
] | zql.eamil@example.com |
c68bbf5eaff7fd6904ea41edf3812c92aee27312 | 5159524f50b60ef13d1b24e446d77742fdea27c3 | /src/com/alex/phony/action/InjectorImpl.java | b4cc344ba9fff206bd8ea47e0cbcdebcf353d8e9 | [] | no_license | axenlarde/PHONY | 664bf030cbb027b787731c3595036a254a3b80c3 | 1290b471f667a0262ee0b950fb1089154a4cc210 | refs/heads/master | 2022-12-25T04:51:28.389679 | 2020-10-08T11:29:41 | 2020-10-08T11:29:41 | 302,123,954 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 112 | java | package com.alex.phony.action;
public interface InjectorImpl
{
public void exec() throws Exception;
}
| [
"ratelal@LVCPFRPA00394C0.D1.cougar.ms.lvmh"
] | ratelal@LVCPFRPA00394C0.D1.cougar.ms.lvmh |
1d02698cba015ef6ad54d52bcbc39cdc0faa39aa | 7b548c3699a0ec81412b4cbef28a0f18305a3e30 | /src/main/java/patterns/behavioral/observer/extendFrame/Bear.java | fcea5cd8a3cdb7dd5f539e3f7a231bb20b2964fc | [] | no_license | ccszwg/design-patterns-practice | 1ba83cdce0ded599bde5b2dc3dc98e2efe267e93 | 65aeaf77a6439e5fdc9e3347c9e5cc5f49f56adb | refs/heads/main | 2023-03-21T13:37:26.783921 | 2021-03-15T07:57:37 | 2021-03-15T07:57:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 512 | java | package patterns.behavioral.observer.extendFrame;
import java.util.Observable;
import java.util.Observer;
/**
* 1.0v created by wujf on 2021-3-9
*/
public class Bear implements Observer {
@Override
public void update(Observable o, Object arg) {
double price = (Double) arg;
if (price > 0) {
System.out.println("油价上涨" + price + "元,空方伤心了!");
} else {
System.out.println("油价下跌" + (-price) + "元,空方高兴了!");
}
}
}
| [
""
] | |
a5ed0b3d70e64a3a30976c1750717bec98948f9e | e3ceae6eb15c899a854e778b520a673e33f6690c | /matrix-publish/matrix-publish-core/src/main/java/com/mryx/matrix/publish/provider/AgentServiceImpl.java | a62bef1cb84850f7cc152da80b254a17d4b9085d | [] | no_license | GSIL-Monitor/mf-max | d1133cbedea82c3680ff92fde8234b4386686765 | 20cd35fe2a2e630328c9ac50c31dbd0cce86d825 | refs/heads/master | 2020-04-13T05:16:58.099297 | 2018-12-24T11:58:08 | 2018-12-24T11:58:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,823 | java | package com.mryx.matrix.publish.provider;
import com.mryx.common.utils.HttpClientUtil;
import com.mryx.matrix.common.domain.HttpClientResult;
import com.mryx.matrix.common.dto.AppInfoDto;
import com.mryx.matrix.common.dto.GroupInfoDto;
import com.mryx.matrix.common.dto.ServerResourceDto;
import com.mryx.matrix.common.util.HttpClientUtils;
import com.mryx.matrix.publish.AgentService;
import com.mryx.matrix.publish.dto.AgentDTO;
import com.mryx.matrix.publish.enums.AgentStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
/**
* Agent Service impl
*
* @author supeng
* @date 2018/09/17
*/
@Service("agentService")
public class AgentServiceImpl implements AgentService {
private static final Logger LOGGER = LoggerFactory.getLogger(AgentServiceImpl.class);
@Resource
private RedisTemplate redisTemplate;
@Override
public AgentDTO getAgentInfo(String key) {
LOGGER.info("getAgentInfo key = {}", key);
Map<String, Object> map = (Map<String, Object>) redisTemplate.opsForValue().get(key);
if (Objects.isNull(map)) {
return null;
}
AgentDTO agentDTO = new AgentDTO(null, null, null, null, getAgentStatus(key), String.valueOf(map.get("ip")), String.valueOf(map.get("java")),
String.valueOf(map.get("cpu")), String.valueOf(map.get("load")),
String.valueOf(map.get("mem")), String.valueOf(map.get("disk")),
String.valueOf(map.get("os")), null);
// TODO
LOGGER.info("getAgentInfo agentDTO = {}", agentDTO.toString());
return agentDTO;
}
@Override
public List<AgentDTO> getAppAgentInfoList(AppInfoDto appInfoDto) {
if (appInfoDto == null || appInfoDto.getAppCode() == null
|| appInfoDto.getGroupInfo() == null || appInfoDto.getGroupInfo().isEmpty()) {
return new ArrayList<>();
}
List<AgentDTO> agentDTOS = new ArrayList<>();
assemAgentDTOS(appInfoDto, agentDTOS);
return agentDTOS;
}
/**
* 拼装AgentDTOS数据
*
* @param appInfoDto
* @param agentDTOS
* @return
*/
private void assemAgentDTOS(AppInfoDto appInfoDto, List<AgentDTO> agentDTOS) {
List<GroupInfoDto> groupInfoDtos = appInfoDto.getGroupInfo();
for (GroupInfoDto groupInfoDto : groupInfoDtos) {
if (groupInfoDto == null || groupInfoDto.getServerInfo() == null || groupInfoDto.getServerInfo().isEmpty()) {
continue;
}
List<ServerResourceDto> serverResourceDtos = groupInfoDto.getServerInfo();
for (ServerResourceDto serverResourceDto : serverResourceDtos) {
if (serverResourceDto == null || serverResourceDto.getHostIp() == null) {
continue;
}
Map<String, Object> map = (Map<String, Object>) redisTemplate.opsForValue().get(serverResourceDto.getHostIp());
if (Objects.isNull(map)) {
map = new HashMap<>();
}
AgentDTO agentDTO = new AgentDTO(appInfoDto.getAppCode(), appInfoDto.getAppName(), null, null, getAgentStatus(serverResourceDto.getHostIp()), String.valueOf(map.get("ip")), String.valueOf(map.get("java")),
String.valueOf(map.get("cpu")), String.valueOf(map.get("load")),
String.valueOf(map.get("mem")), String.valueOf(map.get("disk")),
String.valueOf(map.get("os")), null);
// TODO
agentDTOS.add(agentDTO);
}
}
}
@Override
public List<AgentDTO> getAgentInfoList(List<AppInfoDto> appInfoDtos) {
if (appInfoDtos == null || appInfoDtos.isEmpty()) {
return new ArrayList<>();
}
List<AgentDTO> agentDTOS = new ArrayList<>();
for (AppInfoDto appInfoDto : appInfoDtos) {
if (appInfoDto == null || appInfoDto.getGroupInfo() == null) {
continue;
}
assemAgentDTOS(appInfoDto, agentDTOS);
}
return agentDTOS;
}
/**
* 获取Agent状态
*
* @param ip
* @return
*/
public String getAgentStatus(String ip) {
String url = "http://" + ip + ":30000/api/healthcheck";
try {
HttpClientResult result = HttpClientUtils.doPost(url);
if (result.getCode() == 200) {
return AgentStatus.ONLINE.getCommand();
}
} catch (Exception e) {
LOGGER.error("agent healthcheck error ", e);
}
return AgentStatus.OFFLINE.getCommand();
}
}
| [
"lina02@missfresh.cn"
] | lina02@missfresh.cn |
285a72978b9b3748219bfe223fc22fa207b8bb3d | 4d37505edab103fd2271623b85041033d225ebcc | /spring-webflux/src/main/java/org/springframework/web/reactive/result/method/HandlerMethodArgumentResolver.java | 64073146ef665d3187e2e6672b241c50fe1c252a | [
"Apache-2.0"
] | permissive | huifer/spring-framework-read | 1799f1f073b65fed78f06993e58879571cc4548f | 73528bd85adc306a620eedd82c218094daebe0ee | refs/heads/master | 2020-12-08T08:03:17.458500 | 2020-03-02T05:51:55 | 2020-03-02T05:51:55 | 232,931,630 | 6 | 2 | Apache-2.0 | 2020-03-02T05:51:57 | 2020-01-10T00:18:15 | Java | UTF-8 | Java | false | false | 1,722 | java | /*
* Copyright 2002-2016 the original author or authors.
*
* 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
*
* https://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.springframework.web.reactive.result.method;
import reactor.core.publisher.Mono;
import org.springframework.core.MethodParameter;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.server.ServerWebExchange;
/**
* Strategy to resolve the argument value for a method parameter in the context
* of the current HTTP request.
*
* @author Rossen Stoyanchev
* @since 5.0
*/
public interface HandlerMethodArgumentResolver {
/**
* Whether this resolver supports the given method parameter.
*
* @param parameter the method parameter
*/
boolean supportsParameter(MethodParameter parameter);
/**
* Resolve the value for the method parameter.
*
* @param parameter the method parameter
* @param bindingContext the binding context to use
* @param exchange the current exchange
* @return {@code Mono} for the argument value, possibly empty
*/
Mono<Object> resolveArgument(
MethodParameter parameter, BindingContext bindingContext, ServerWebExchange exchange);
}
| [
"huifer97@163.com"
] | huifer97@163.com |
0a02f341f20f65da6480e457dd0e4c0d2cc494f8 | 10934449fff9499469a4d26917ea11863ad179c6 | /src/com/solutions/samples/mvc/controllers/IController.java | d9bc42fd5f4d4f033397fa0a4e6f2503eb5dc6a4 | [] | no_license | sawrus/nc-projects | aa0281050eae954019c6d7ce69e54390f9f84296 | 1dac83a0ab6c9e13ac8571225be323dd093f7688 | refs/heads/master | 2021-01-19T13:02:49.863737 | 2012-11-15T11:48:21 | 2012-11-15T11:48:21 | 32,445,725 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 376 | java | package com.solutions.samples.mvc.controllers;
import com.solutions.samples.mvc.events.Event;
import com.solutions.samples.mvc.models.IModel;
import com.solutions.samples.mvc.views.IView;
public interface IController<TModel extends IModel, TView extends IView> {
void setModel(TModel model);
void setView(TView view);
void handleEvent(Event event);
}
| [
"sawrus@gmail.com@7159ea72-5042-624f-90be-b02e59218691"
] | sawrus@gmail.com@7159ea72-5042-624f-90be-b02e59218691 |
06f683c36fca314d024481c4c478a306179ac01e | 7203c05fd8ac38415f6179eabd368b510f90edcd | /src/cit260/savingThePit/view/View.java | 654cbe735b817edb0fa2f9ac83b552d39980830f | [] | no_license | splattedone/savingThePit | 7ae5b288fa92f02f528b7a862313a93802272ea6 | 231d28d2bb8e74faaf0a69ca2229cf40d51cb87b | refs/heads/master | 2021-01-21T14:24:09.354131 | 2016-07-08T05:17:38 | 2016-07-08T05:17:38 | 58,688,125 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,463 | 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 cit260.savingThePit.view;
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.util.Scanner;
import savingthepit.SavingThePit;
/**
*
* @author Appel
*/
public abstract class View implements ViewInterface{
/*Inherits the following functions from ViewInterface:
public void display();
public String getInput();
public boolean doAction(String value);
*/
protected String message;
protected final BufferedReader keyboard = SavingThePit.getInFile();
protected final PrintWriter console = SavingThePit.getOutFile();
public View(String message){
this.message = message;
}
@Override
public void display() {
String value;
boolean done = false;
do {
this.console.println(this.message);
value = this.getInput();
done = this.doAction(value);
/*String value = this.getInput(); // prompt for and get players name
if (value.toUpperCase().equals("Q")) // user wants to quit
return; // exit the game
// do the requested action and display the next view
done = this.doAction(value);
*/
} while (!done);
}
@Override
public String getInput() {
boolean valid = false; // initialize to not valid
String value = null;
try {
while (!valid) { // loop while an invalid value is entered
// prompt for the player's name
System.out.println("\n" + this.message);
value = keyboard.readLine(); // get next line typed on keyboard
value = value.trim(); // trim off leading and trailing blanks
if (value.length() < 1) { // value is blank
System.out.println("\nInvalid value: value can not be blank");
continue;
}
break; // end the loop
}
} catch (Exception e){
System.out.println("Error reading input: " + e.getMessage());
}
return value; // return the name
}
}
| [
"Appel@Appel"
] | Appel@Appel |
6588a32b69651b14e4afaf788f4a076aac822f4a | c1ff680d7f4f0885fa915d2d4c29b025036671fb | /java-kakfa-producer-consumer/src/main/java/it/fabiano/kafka/deserializer/CustomDeserializer.java | 1d0e517c26a1b164f250eb4b7db8991e5d5fdec5 | [] | no_license | gaetanofabiano/java-kakfa-producer-consumer | 9edc7611b3ae2f70c11df4a0c70a369e5e4df2cc | 76f0f0b537edf08027589383381bf5d65a19c0d5 | refs/heads/master | 2023-04-09T13:16:23.445565 | 2021-03-16T23:13:16 | 2021-03-16T23:13:16 | 348,514,725 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 849 | java | package it.fabiano.kafka.deserializer;
import java.util.Map;
import org.apache.kafka.common.serialization.Deserializer;
import com.fasterxml.jackson.databind.ObjectMapper;
import it.fabiano.kafka.pojo.CustomObject;
/**
* Java-kafka-Webinar
*
* @author Gaetano Fabiano
* @version 1.0.0
* @since 2021-03-15
*/
public class CustomDeserializer implements Deserializer<CustomObject> {
@Override
public void configure(Map<String, ?> configs, boolean isKey) {
}
@Override
public CustomObject deserialize(String topic, byte[] data) {
ObjectMapper mapper = new ObjectMapper();
CustomObject object = null;
try {
object = mapper.readValue(data, CustomObject.class);
} catch (Exception exception) {
System.out.println("Error in deserializing bytes " + exception);
}
return object;
}
@Override
public void close() {
}
} | [
"fabiano.gaetano@gmail.com"
] | fabiano.gaetano@gmail.com |
bb88893d9d1be226e1eddfe5b3544bd06d7c4127 | be41ad0f885c580d9c31cc27fb473c2d2c4aa478 | /integration-testing-spring/src/main/java/spring/testing/server/rules/CurrencyRule.java | 71bbac2f2d351944a917ba22a8612332b2d6378b | [] | no_license | gilzilberfeld/integration-testing-spring | ea711d9e35fc0d738e2482e155d295d70c24c521 | 0e225fc8a1f6a6e42c461074f88b6b9632f24c7f | refs/heads/master | 2021-07-10T15:20:26.594942 | 2020-06-16T08:08:02 | 2020-06-16T08:08:02 | 150,082,557 | 0 | 3 | null | null | null | null | UTF-8 | Java | false | false | 742 | java | package spring.testing.server.rules;
import java.util.HashMap;
import java.util.Map;
import spring.testing.server.bills.LineItem;
public class CurrencyRule implements CalculationRule {
Map<String, Float> currencies;
public CurrencyRule(Map<String,Float> factors) {
this.currencies = new HashMap<String,Float>(factors);
}
public CurrencyRule() {
Map<String, Float> factors = new HashMap<>();
factors.put("CHF", 1.15f);
factors.put("EUR", 0.9f);
}
@Override
public float getMultiplier(LineItem lineItem) {
String currencyName = lineItem.getItemPrice().getCurrency();
Float knownMultiplier = currencies.get(currencyName);
return (knownMultiplier==null) ? 1 : knownMultiplier.floatValue();
}
}
| [
"gil.zilberfeld@gmail.com"
] | gil.zilberfeld@gmail.com |
590553a97a31f64c6c1e75a5b8b05c5d021a0f6e | 8e37c4466e862f0eec595cb74ae3cb6b4e2ff269 | /rabbitMQDemo/src/main/java/com/demo/rabbitMQ/sample/Produce.java | 660f08fe8760c52cbdb988d1c1adbf15de90fee8 | [] | no_license | Carlutf8/rabbitMQ | 5c064c853532e92cdc4de7d7697aa347fcf33c2b | 4f2bc743c01e3f798c06078946fad7a837a67990 | refs/heads/master | 2020-03-22T06:03:01.543154 | 2018-08-07T15:35:32 | 2018-08-07T15:35:32 | 139,608,367 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,002 | java | package com.demo.rabbitMQ.sample;
import java.io.IOException;
import java.util.concurrent.TimeoutException;
import com.demo.rabbitMQ.util.ConnectionUtils;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
/**
* 消息队列生产者
* @author Administrator
*
*/
public class Produce {
private static final String QUEUE_NAME="simple_test";
public static void main(String[] args) throws IOException, TimeoutException {
//1.获取一个连接
Connection connection = ConnectionUtils.getConnection();
//2.从连接中获取一个通道
Channel channel = connection.createChannel();
//3.声明队列
channel.queueDeclare(QUEUE_NAME, false, false, false, null);
//4.发布消息
String msg="我是生产者发出的消息!2";
//发布消息
channel.basicPublish("", QUEUE_NAME, null,msg.getBytes());
System.out.println("=============消息已发出===============");
//关闭通道和连接
channel.close();
connection.close();
}
}
| [
"you@example.com"
] | you@example.com |
b9a286a59aab2567c90a0174fcc3a3970393844a | d5b6a3f9c0609976d42c356a386d6e87220baedf | /cloud-consumer-feign-order80/src/main/java/com/bw/springcloud/controller/OrderFeignController.java | 532bd31472a464fe6291374f0996e705985d6919 | [] | no_license | 783764457/cloud2020 | 122a5eff742d3803495e09e7b751e59c77476178 | fadf0442b67bd331b04efe55013c7cd2a36b0508 | refs/heads/master | 2022-12-05T05:36:05.643991 | 2020-08-19T03:19:18 | 2020-08-19T03:19:18 | 288,622,703 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 979 | java | package com.bw.springcloud.controller;
import com.bw.springcloud.entity.CommonResult;
import com.bw.springcloud.entity.Payment;
import com.bw.springcloud.service.PaymentFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@RestController
@Slf4j
public class OrderFeignController {
@Resource
private PaymentFeignService paymentFeignService;
@GetMapping(value="/consumer/payment/get/{id}")
public CommonResult<Payment> getPaymentById(@PathVariable("id") Long id) {
return paymentFeignService.getPaymentById(id);
}
@GetMapping(value = "/consumer/payment/feign/timeout")
public String paymentFeignTimeout(){
//openfeign-ribbon 客户端默认等待1S
return paymentFeignService.paymentFeignTimeout();
}
}
| [
"783764457@qq.com"
] | 783764457@qq.com |
e1195550752498a7340f61f7245682f09bd04159 | d11fb0d15b73a28742caa97e349dcfbe70d2563f | /server/iih.ci/iih.ci.ord/src/main/java/iih/ci/ord/s/ems/biz/itf/IDefaultCreateOrderInfo.java | 87f9c8cc0b83a6b9d488023bb6d86685661218cf | [] | no_license | fhis/order.client | 50a363fd3e4f56d95ccc5aa288e907a0a8571031 | 56cfa7877f600a10c54fdb30306a32ffa28b8217 | refs/heads/master | 2021-08-22T20:50:59.511923 | 2017-12-01T07:10:27 | 2017-12-01T07:10:27 | 112,678,072 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 584 | java | package iih.ci.ord.s.ems.biz.itf;
import iih.ci.ord.ems.d.CiEnContextDTO;
import iih.ci.ord.s.ems.biz.meta.DefaultCreateParam;
import iih.ci.ord.s.ems.biz.meta.OrderPackageInfo;
import xap.mw.core.data.BizException;
/**
* 默认医嘱生成接口
* @author wangqingzhu
*
*/
public interface IDefaultCreateOrderInfo {
/**
* 创建通用医嘱信息
* @param id_srv
* @param id_mm
* @param ctx
* @return
* @throws BizException
*/
abstract public OrderPackageInfo[] createOrderPakageInfo(CiEnContextDTO ctx, DefaultCreateParam[] szParam) throws BizException;
}
| [
"27696830@qq.com"
] | 27696830@qq.com |
d8b88a83a87296f568e4d1b29ddfb2f4244802bd | 988225faeaed492b89937d1b8ee0e4a85cd63ce5 | /TOMProjekte/src/schuleAufgaben052018/AufgabenW3T1a.java | f1ce021d54cd6dbd0912a19ec4c0b98dd8c0ab97 | [] | no_license | TOMcyber/TomJavaWorkSchule2018 | 576195f32261784403c5983d1d516d9509205447 | 8d9f5474b7335b78670673d09078b73401ca241d | refs/heads/master | 2020-03-16T21:50:45.703139 | 2018-06-07T13:29:12 | 2018-06-07T13:29:12 | 133,016,683 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,380 | java | package schuleAufgaben052018;
import java.util.Arrays;
public class AufgabenW3T1a {
public static void main(String[] args) {
// ====
Person p1 = new Person(21);
Person p2 = new Person(39);
Person p3 = new Person(16);
Person p4 = new Person(54);
// Array vom Datentyp Person
Person[] personen = {p1,p2,p3,p4};
for (Person person : personen) {
System.out.print(person + ", ");
}
Arrays.sort(personen);
System.out.println("\n== Sortiertes Personen Array==");
for (Person person : personen) {
System.out.print(person + ", ");
}
}
}
class Person implements Comparable<Person> {
int alter;
Person(int alter) {
this.alter = alter;
}
// Überschreiben der compareTo Methode aus dem Interface Comparable
@Override
public int compareTo(Person p2) {
// Sortierung: aufsteigend nach Alter
// int ergebnis = this.alter - p2.alter;
// Sortierung: absteigend nach Alter
int ergebnis = p2.alter - this.alter;
// return Werte > 0 --> this vs. p2: sortieren this Objekt nach hinten/p2 nach vorne
// return Werte == 0 --> this vs. p2: keine Veränderung der Ordnung
// return Werte < 0 --> this vs. p2: this Objekt nach vorne, p2 naqch hinten sortiert
return ergebnis;
}
@Override
public String toString() {
return "Person " + this.alter + " Jahre";
}
} | [
"Alfa@KA-B09-103.alfatraining.local"
] | Alfa@KA-B09-103.alfatraining.local |
09261d125488496b14765443e59b7e2550c62abc | da20be5e198a5465f183841cb7df57626c3bc17f | /NumArrayList/NumArrayList.java | d23833287533cfe9882daee0f19e08c679093a4f | [] | no_license | sunziping2016/Java-Homework | a3e205670c054b516ab6553c76386e6259269bbf | 830a96f55683df52414e159549f7942fc49c4860 | refs/heads/master | 2020-06-10T17:24:31.158689 | 2016-12-08T09:18:32 | 2016-12-08T09:18:32 | 75,922,199 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 683 | java | package NumArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* Created by sun on 5/14/16.
*
* NumArrayList class.
*/
public class NumArrayList {
public static void main(String[] args) {
Random random = new Random();
List<Integer> numList = Stream.generate(() -> random.nextInt(1001)).limit(20).collect(Collectors.toList());
for (Iterator<Integer> iter = numList.iterator(); iter.hasNext();)
if (iter.next() < 500)
iter.remove();
numList.forEach(System.out::println);
}
}
| [
"sunziping2016@gmail.com"
] | sunziping2016@gmail.com |
670cf063b6fa46e1c0026d96bd54c56136313350 | 0ed56dd13c606fa092bdfe6b5bef996cd0007893 | /java/sync/opush/push-bean/src/main/java/org/obm/push/bean/FolderType.java | fac79af12aa832d1ee6bdf90ac4f6a46cad8a618 | [] | no_license | Eriflow/obm_slemaistre | d967e5ea5ac605d379571987d1766e014bdb3670 | 37e0c5b8814884f4c0e8cd5359b9db257f6b7f37 | refs/heads/master | 2021-01-17T11:54:22.557021 | 2011-12-21T16:29:49 | 2011-12-23T11:11:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,533 | java | package org.obm.push.bean;
public enum FolderType {
USER_FOLDER_GENERIC, // 1
DEFAULT_INBOX_FOLDER, // 2
DEFAULT_DRAFTS_FOLDERS, // 3
DEFAULT_DELETED_ITEMS_FOLDERS, // 4
DEFAULT_SENT_EMAIL_FOLDER, // 5
DEFAULT_OUTBOX_FOLDER, // 6
DEFAULT_TASKS_FOLDER, // 7
DEFAULT_CALENDAR_FOLDER, // 8
DEFAULT_CONTACTS_FOLDER, // 9
DEFAULT_NOTES_FOLDER, // 10
DEFAULT_JOURNAL_FOLDER, // 11
USER_CREATED_EMAIL_FOLDER, // 12
USER_CREATED_CALENDAR_FOLDER, // 13
USER_CREATED_CONTACTS_FOLDER, // 14
USER_CREATED_TASKS_FOLDER, // 15
USER_CREATED_JOURNAL_FOLDER, // 16
USER_CREATED_NOTES_FOLDER, // 17
UNKNOWN_FOLDER_TYPE; // 18
public String asIntString() {
switch (this) {
case USER_FOLDER_GENERIC:
return "1";
case DEFAULT_INBOX_FOLDER:
return "2";
case DEFAULT_DRAFTS_FOLDERS:
return "3";
case DEFAULT_DELETED_ITEMS_FOLDERS:
return "4";
case DEFAULT_SENT_EMAIL_FOLDER:
return "5";
case DEFAULT_OUTBOX_FOLDER:
return "6";
case DEFAULT_TASKS_FOLDER:
return "7";
case DEFAULT_CALENDAR_FOLDER:
return "8";
case DEFAULT_CONTACTS_FOLDER:
return "9";
case DEFAULT_NOTES_FOLDER:
return "10";
case DEFAULT_JOURNAL_FOLDER:
return "11";
case USER_CREATED_EMAIL_FOLDER:
return "12";
case USER_CREATED_CALENDAR_FOLDER:
return "13";
case USER_CREATED_CONTACTS_FOLDER:
return "14";
case USER_CREATED_TASKS_FOLDER:
return "15";
case USER_CREATED_JOURNAL_FOLDER:
return "16";
case USER_CREATED_NOTES_FOLDER:
return "17";
default:
return "18";
}
}
}
| [
"jribier@linagora.com"
] | jribier@linagora.com |
50758820b858ac7e1be25e62ae0a665543f8c5fa | 2d212ec3d9739d629f701f95d9bdfb0f5da1602f | /1.utils/core/src/main/java/com/octopus/utils/bftask/impl/BFTaskMgr.java | e7b748683b682c4791b75e67c63d64dca56395b1 | [
"Apache-2.0"
] | permissive | pacoolin/octopus | a42bdfb551df2b567760c4cf2e3a23dcb70942ec | 5439561133af00de089d6d30b3527542a434057f | refs/heads/master | 2023-05-11T08:26:02.210724 | 2021-05-05T02:14:02 | 2021-05-05T02:14:02 | 281,041,828 | 0 | 0 | Apache-2.0 | 2020-07-20T07:10:12 | 2020-07-20T07:10:11 | null | UTF-8 | Java | false | false | 1,270 | java | package com.octopus.utils.bftask.impl;
import com.octopus.utils.bftask.BFParameters;
import com.octopus.utils.bftask.IBFExecutor;
import com.octopus.utils.bftask.IBFTaskMgr;
import com.octopus.utils.thread.ds.InvokeTaskByObjName;
import com.octopus.utils.xml.XMLMakeup;
import com.octopus.utils.xml.XMLObject;
import java.util.HashMap;
import java.util.Map;
/**
* User: wangfeng2
* Date: 14-8-22
* Time: 下午2:30
*/
public class BFTaskMgr extends XMLObject implements IBFTaskMgr {
IBFExecutor executor=null;
Map<String,BFTask> tasks =new HashMap();
public BFTaskMgr(XMLMakeup xml,XMLObject parent,Object[] containers) throws Exception {
super(xml,parent,containers);
}
@Override
public void notifyObject(String op, Object obj) throws Exception {
}
@Override
public void addTrigger(Object cond, InvokeTaskByObjName task) throws Exception {
}
@Override
public void destroy() throws Exception {
}
@Override
public void initial() throws Exception {
}
public boolean isExist(String taskkey){
return tasks.containsKey(taskkey);
}
public void doTask(String taskkey,BFParameters parameters) throws Exception {
tasks.get(taskkey).doTask(parameters);
}
}
| [
"kodw38@126.com"
] | kodw38@126.com |
133af14486e768b334b68dfd5c19d07b5bc9f50b | 72424d2cdc78f9b5c3c2e5df708ad1c5190c3283 | /app/src/test/java/com/yuri_khechoyan/queued/ExampleUnitTest.java | 6814f160881b39a42124a33b80803fbca8b3ee42 | [] | no_license | Khechoyan-Yuri/android-indv | c93cf0b07741462ce8d5bf2d087ca3290496fe90 | 018ddf9e00d09fddff20f2735bd7952484eea3c6 | refs/heads/master | 2021-01-20T05:40:32.978602 | 2017-05-02T21:11:09 | 2017-05-02T21:11:09 | 89,798,025 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 419 | java | package com.yuri_khechoyan.queued;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"ykhechoyan@gmail.com"
] | ykhechoyan@gmail.com |
e7e96b00dc2126f7841c40bc2ca5bc963fbee1aa | cca2066b673db6af22e5343920f36adf228b47b4 | /Coding Challenges/src/LinkedList2/LinkedListmain.java | 95c12214278375cf79ea189cd619caedf3cd5a22 | [] | no_license | Hossammetwalli/HackerRankChallenges | 5dae02f57d045fd71eb1272dc8ba236a486bc786 | d1757c8d9fbffaa1d9878ab47d37119cd678965e | refs/heads/master | 2023-01-15T04:42:03.920764 | 2020-11-15T15:06:49 | 2020-11-15T15:06:49 | 313,056,052 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 197 | java | package LinkedList2;
public class LinkedListmain {
public static void main ( String [] args ) {
LinkedList list = new LinkedList ( );
list.addFirst ( 10 );
list.addFirst ( 20 );
}
}
| [
"57620818+Hossammetwalli@users.noreply.github.com"
] | 57620818+Hossammetwalli@users.noreply.github.com |
9f9921661d6aafedd2becae0260173706ac45b26 | af62115e68f9411b326d3268f9fb4fd9b6cc9b1d | /src/main/java/br/com/gokustore/address/utils/Constants.java | 9c040844f5bdcc958176d0a03ab592e5b3a0ecc7 | [] | no_license | AllanRomanato/address-service | 56a9eeb859a9cdde64a834bc437dbde70858eb6a | 01fd6bb03f4e8e8d6d0ae3d7655bc3143384bf2e | refs/heads/master | 2023-08-21T04:07:49.675062 | 2021-09-20T17:57:08 | 2021-09-20T17:57:08 | 408,540,321 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 128 | java | package br.com.gokustore.address.utils;
public class Constants {
public static final String APP_NAME = "AddressService";
}
| [
""
] | |
c6e5377e338a26de0590d46cf38c81e43c09d2f2 | 3fe8e5db53dc425afdb24303f2f6926cade14f04 | /user/ezt_hall/src/main/java/com/eztcn/user/eztcn/activity/mine/MyWalletActivity.java | aeba9b69766837e6e911f763ea37e21b9006111e | [] | no_license | llorch19/ezt_user_code | 087a9474a301d8d8fef7bd1172d6c836373c2faf | ee82f4bfbbd14c81976be1275dcd4fc49f6b1753 | refs/heads/master | 2021-06-01T09:40:19.437831 | 2016-08-10T02:33:35 | 2016-08-10T02:33:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,576 | java | package com.eztcn.user.eztcn.activity.mine;
import java.util.Map;
import xutils.ViewUtils;
import xutils.http.RequestParams;
import xutils.view.annotation.ViewInject;
import xutils.view.annotation.event.OnClick;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.eztcn.user.R;
import com.eztcn.user.eztcn.BaseApplication;
import com.eztcn.user.eztcn.activity.FinalActivity;
import com.eztcn.user.eztcn.api.IHttpResult;
import com.eztcn.user.eztcn.bean.DragonCard;
import com.eztcn.user.eztcn.impl.EztServiceCardImpl;
import com.eztcn.user.eztcn.impl.PayImpl;
import com.eztcn.user.eztcn.utils.HttpParams;
/**
* @title 我的钱包
* @describe
* @author ezt
* @created 2014年12月30日
*/
public class MyWalletActivity extends FinalActivity implements IHttpResult {
@ViewInject(R.id.money)
private TextView money;
@ViewInject(R.id.couponLayout)//, click = "onClick"
private LinearLayout couponLayout;// 优惠券
@ViewInject(R.id.coupon_num)
private TextView tvCouponNum;// 优惠券数量
@ViewInject(R.id.moneyLayout)//, click = "onClick"
private LinearLayout moneyLayout;
@ViewInject(R.id.tradeDetail)//, click = "onClick"
private TextView tradeDetail;
@ViewInject(R.id.myOrderForm)//, click = "onClick"
private TextView myOrderForm;
@ViewInject(R.id.myHealthCard)//, click = "onClick"
private TextView myService;
@ViewInject(R.id.health_dragon)//, click = "onClick"
private TextView myHealthDragon;
@ViewInject(R.id.allLayout)
private LinearLayout allLayout;
private Intent intent;
private int eztCurrency;// 余额
// private boolean isBinding = false;// 是否绑定激活建行龙卡
private DragonCard card;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mywallet);
ViewUtils.inject(MyWalletActivity.this);
loadTitleBar(true, "我的钱包", null);
}
@Override
protected void onResume() {
super.onResume();
callbackNum = 0;
if (BaseApplication.getInstance().isNetConnected) {
getUserInfo();
// getHealthDragonInfo();
getHealthDragonInfo();
showProgressToast();
} else {
Toast.makeText(mContext, getString(R.string.network_hint),
Toast.LENGTH_SHORT).show();
}
}
@OnClick(R.id.tradeDetail)// 交易明细
private void tradeDetailClick(View v){
intent = new Intent();
intent.setClass(mContext, TradeDetailActivity.class);
if (intent != null) {
startActivity(intent);
}
}
@OnClick(R.id.myOrderForm)// 我的订单
private void myOrderFormClick(View v){
intent = new Intent();
intent.setClass(mContext, MyOrderListActivity.class);
if (intent != null) {
startActivity(intent);
}
}
@OnClick(R.id.myHealthCard)// 健康卡
private void myHealthCardClick(View v){
intent = new Intent();
intent.setClass(mContext, MyHealthCardActivity.class);
if (intent != null) {
startActivity(intent);
}
}
@OnClick(R.id.moneyLayout)
private void moneyLayoutClick(View v){
intent = new Intent();
intent.setClass(mContext, EztCurrencyActivity.class);
intent.putExtra("ec", eztCurrency);
if (intent != null) {
startActivity(intent);
}
}
@OnClick(R.id.couponLayout)// 优惠券
private void couponLayoutClick(View v){
intent = new Intent();
intent.setClass(mContext, MyCouponsActivity.class);
intent.putExtra("ec", eztCurrency);
if (intent != null) {
startActivity(intent);
}
}
@OnClick(R.id.health_dragon)// 健康龙卡
private void health_dragonClick(View v){
intent = new Intent();
// intent.putExtra("isActivate", isBinding);
// intent.putExtra("isActivate", false); 2015/11/20 直接条健康龙卡,去那个界面做判断
// intent.setClass(getApplicationContext(), MyDragonCardActivity.class);
if(null==card){
intent.setClass(getApplicationContext(), DragonToActiveActivity.class);
}else{
intent.setClass(getApplicationContext(), DragonCardActivity.class);
}
intent.putExtra("ec", eztCurrency);
if (intent != null) {
startActivity(intent);
}
}
// public void onClick(View v) {
// intent = new Intent();
// switch (v.getId()) {
// case R.id.tradeDetail:// 交易明细
// // Toast.makeText(mContext, getString(R.string.function_hint),
// // Toast.LENGTH_SHORT).show();
// intent.setClass(mContext, TradeDetailActivity.class);
// break;
// case R.id.myOrderForm:// 我的订单
// // Toast.makeText(mContext, getString(R.string.function_hint),
// // Toast.LENGTH_SHORT).show();
// // intent = null;
// intent.setClass(mContext, MyOrderListActivity.class);
// break;
// case R.id.myHealthCard:// 健康卡
// intent.setClass(mContext, MyHealthCardActivity.class);
// // Toast.makeText(mContext, getString(R.string.function_hint),
// // Toast.LENGTH_SHORT).show();
// // intent = null;
// break;
// case R.id.moneyLayout:
// intent.setClass(mContext, EztCurrencyActivity.class);
// intent.putExtra("ec", eztCurrency);
// break;
//
// case R.id.couponLayout:// 优惠券
// intent.setClass(mContext, MyCouponsActivity.class);
// break;
//
// case R.id.health_dragon:// 健康龙卡
//
// // intent.putExtra("isActivate", isBinding);
// // intent.putExtra("isActivate", false); 2015/11/20 直接条健康龙卡,去那个界面做判断
//// intent.setClass(getApplicationContext(), MyDragonCardActivity.class);
// if(null==card){
// intent.setClass(getApplicationContext(), DragonToActiveActivity.class);
// }else{
// intent.setClass(getApplicationContext(), DragonCardActivity.class);
// }
// break;
// }
// if (intent != null) {
// startActivity(intent);
// }
// }
private void getHealthDragonInfo() {
if (BaseApplication.patient == null) {
return;
}
RequestParams params=new RequestParams();
//TODO
params.addBodyParameter("CustID", BaseApplication.patient.getEpPid());
EztServiceCardImpl api = new EztServiceCardImpl();
api.getCCbInfo(params, this);
}
/**
* 获取用户账户信息
*/
private void getUserInfo() {
if (BaseApplication.patient == null) {
return;
}
RequestParams params=new RequestParams();
params.addBodyParameter("userId", BaseApplication.patient.getUserId() + "");
new PayImpl().getCurrencyMoney(params, this);
}
private int callbackNum = 0;
@Override
public void result(Object... object) {
if (object == null) {
return;
}
int callBackFlag = (Integer) object[0];
boolean isSuc = (Boolean) object[1];
switch (callBackFlag) {
case HttpParams.GET_CURRENCY_MONEY:
callbackNum++;
if (isSuc) {
allLayout.setVisibility(View.VISIBLE);
@SuppressWarnings("unchecked")
Map<String, Object> map = (Map<String, Object>) object[2];
if (map == null || map.size() == 0) {
return;
}
boolean flag = (Boolean) map.get("flag");
if (flag) {
Double d = (Double) map.get("remain");
if (d != null) {
eztCurrency = (int) Math.floor(d);
}
money.setText(eztCurrency + " 医通币");
}
}
break;
case HttpParams.GAIN_CCBINFO: {
if(isSuc){
Map<String, Object> map = (Map<String, Object>) object[2];
if(map.containsKey("flag")){
if((Boolean) map.get("flag")){
//绑定卡了
if(map.containsKey("data")){
card=(DragonCard) map.get("data");
}
}else{
//用户信息不存在 未绑定卡
card=null;
}
}
}
}
break;
}
if (callbackNum == 1) {
hideProgressToast();
}
}
}
| [
"liangxing@eztcn.com"
] | liangxing@eztcn.com |
0fdad22a44108596b670f248ded8ba7adc3d3989 | f42ebd77022788395e8829ec591931e3f6fddd09 | /spring_mysql/src/main/java/com/jordanbigelow/spring_mysql/MainController.java | 4ba9d6d481ad50930730d17e10843da1dad7c29d | [
"Unlicense"
] | permissive | beehivewarrior/spring_boot_demos | 16254a9ab2a86dd974882dc9e88cb8dd7efa23f2 | 98ee87a54b3909c6b3854d0890d7755fb157ccdc | refs/heads/master | 2023-08-25T07:37:47.388735 | 2021-10-24T09:01:48 | 2021-10-24T09:01:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,005 | java | package com.jordanbigelow.spring_mysql;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping(path = "/demo")
public class MainController {
@Autowired
private UserRepository userRepository;
@PostMapping(path = "/add")
public @ResponseBody String addNewUser(@RequestParam String name, @RequestParam String email) {
User n = new User();
n.setEmail(email);
n.setName(name);
userRepository.save(n);
return "Saved";
}
@GetMapping(path = "/all")
public @ResponseBody Iterable<User> getAllUsers() {
return userRepository.findAll();
}
}
| [
"jordan@jordanbigelow.com"
] | jordan@jordanbigelow.com |
8c46325fc9646346b3ceb59320e684e1cc5816c0 | ede3480511044ce5a6f86a5e1d2fea9ec669c2f7 | /src/main/java/pages/NavPage.java | c782ba57e424ee82ec2ab92eadf409bf9caf50cc | [] | no_license | bgonibeedu/IDE2ETest | c0efe50ca5182a8ac6d865e2c5cf3c7d485e3930 | 5ba922ff8a68e6d4d68d0575efbf66256bcec15d | refs/heads/master | 2021-01-24T12:10:22.947793 | 2018-02-27T12:22:36 | 2018-02-27T12:22:36 | 123,119,401 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 597 | java | package pages;
import org.junit.Assert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
public class NavPage {
@FindBy(id = "Vrm")
private WebElement reg_number;
@FindBy(name = "Continue")
private WebElement continue_Button;
public WebElement getRegistrationNumber() {
return reg_number;
}
public WebElement getContinueButton() {
return continue_Button;
}
public void submitContinueButton() {
continue_Button.click();
}
public void RegistrationNumber(String value) {
reg_number.sendKeys(value);
}
}
| [
"Banuprakash.Manjunatha@hmcts.net"
] | Banuprakash.Manjunatha@hmcts.net |
54c35f502c18b15cd5db5d254f175137f9939e0e | 1ba3e6f1f1c3ff7568ba1190acae63ffe40898ba | /src/main/java/com/wanhutong/backend/modules/cms/web/CmsController.java | 5838f2baccb111ab2b9548a501bc538c529f6af9 | [
"Apache-2.0"
] | permissive | Mamata2507/wanhugou_bg | 015fc28fe7e2f26659664786b5bce8c76d0451af | a5d7579b331ef6d81f367be34967652fcb848da7 | refs/heads/master | 2023-03-15T13:01:10.860578 | 2019-01-21T01:50:17 | 2019-01-21T01:50:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,256 | java | /**
* Copyright © 2017 <a href="www.wanhutong.com">wanhutong</a> All rights reserved.
*/
package com.wanhutong.backend.modules.cms.web;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import com.wanhutong.backend.common.web.BaseController;
import com.wanhutong.backend.modules.cms.service.CategoryService;
/**
* 内容管理Controller
* @author ThinkGem
* @version 2013-4-21
*/
@Controller
@RequestMapping(value = "${adminPath}/cms")
public class CmsController extends BaseController {
@Autowired
private CategoryService categoryService;
@RequiresPermissions("cms:view")
@RequestMapping(value = "")
public String index() {
return "modules/cms/cmsIndex";
}
@RequiresPermissions("cms:view")
@RequestMapping(value = "tree")
public String tree(Model model) {
model.addAttribute("categoryList", categoryService.findByUser(true, null));
return "modules/cms/cmsTree";
}
@RequiresPermissions("cms:view")
@RequestMapping(value = "none")
public String none() {
return "modules/cms/cmsNone";
}
}
| [
"13391822168@qq.com"
] | 13391822168@qq.com |
4c6a115911898488e187f7b18c5db6ec17641c44 | ab70067be22f4ef7e734a681895a88a055196795 | /app/src/main/java/com/example/publictransport/api/Point.java | 6e2ea1cb0b23c6d39cd9cb483a4e216c2f20a029 | [] | no_license | devwonkyo/GoogleMap-marker | 0dca44a73b4ce3b104a29bdbd6f98ba05271bb3b | 1c228fd89604b78c60a4fbbaf76877ee16b5a4a9 | refs/heads/master | 2023-03-07T02:53:21.928183 | 2021-02-22T06:11:12 | 2021-02-22T06:11:12 | 341,097,846 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,094 | java | package com.example.publictransport.api;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Point {
@SerializedName("Station")
@Expose
public Station station;
@SerializedName("Prefecture")
@Expose
public Prefecture prefecture;
@SerializedName("GeoPoint")
@Expose
public GeoPoint geoPoint;
@SerializedName("Distance")
@Expose
public String distance;
public Station getStation() {
return station;
}
public void setStation(Station station) {
this.station = station;
}
public Prefecture getPrefecture() {
return prefecture;
}
public void setPrefecture(Prefecture prefecture) {
this.prefecture = prefecture;
}
public GeoPoint getGeoPoint() {
return geoPoint;
}
public void setGeoPoint(GeoPoint geoPoint) {
this.geoPoint = geoPoint;
}
public String getDistance() {
return distance;
}
public void setDistance(String distance) {
this.distance = distance;
}
} | [
"jungjqk@gmail.com"
] | jungjqk@gmail.com |
a25c2c2d7016ea78a16ecaea43e1ffb21359907b | 645d01a5ec47c066b0fea3efd0aa92de8a8ebfac | /demo/src/main/java/com/example/demo/topic/TopicService.java | 7a3e754b3b6d3e09a50bae933dafc964f015c1a8 | [] | no_license | aditya299/springboot-helloworld | f45f4172e204543c5055695ac58d9d04f67ef085 | c545626c685619a6dbe26b6a7bb95088f0168b0e | refs/heads/main | 2023-07-23T23:21:54.431980 | 2021-09-05T16:25:40 | 2021-09-05T16:25:40 | 403,357,168 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,129 | java | package com.example.demo.topic;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import org.springframework.stereotype.Service;
@Service
public class TopicService {
private List<Topic> topics = new ArrayList<>(Arrays.asList(
new Topic("spring", "spring Framework", "spring framework description"),
new Topic("java", "Core java", "core java description"),
new Topic("jjavascript", "javascript", "javascript description")
));
public List<Topic> getAllTopics(){
return topics;
}
public Topic getTopic(String id){
return topics.stream().filter(t -> t.getId().equals(id)).findFirst().get();
}
public void addTopic(Topic topic) {
topics.add(topic);
}
public void updateTopic(String id, Topic topic) {
for(int i = 0; i < topics.size(); i++){
Topic t = topics.get(i);
if(t.getId().equals(id)){
topics.set(i, topic);
return;
}
}
}
public void deleteTopic(String id) {
topics.removeIf(t -> t.getId().equals(id));
}
} | [
"adityadahasahasra@gmail.com"
] | adityadahasahasra@gmail.com |
6f4ae2143afd45be6f81023b3525ade6bcf476af | 44478a86560cb1cb4cd242d6fbd2c2925e8e6066 | /app/src/main/java/rt/com/http/MainActivity.java | 225aefa2ed0733d788ec156e368d32e4c787cdda | [] | no_license | nyeboy619/http | e8b6028867265a0e0dc6a99b13a9bc489f105c90 | 8374a300d8ffaa600cbc62c81210335b91cf0bdb | refs/heads/master | 2020-04-14T12:27:47.812382 | 2019-01-02T12:54:26 | 2019-01-02T12:54:26 | 163,840,851 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,009 | java | package rt.com.http;
import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
public class MainActivity extends AppCompatActivity {
Context mContext;
TextView mTextView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mContext = this.getApplicationContext();
setContentView(R.layout.activity_main);
Button btn = findViewById(R.id.btn);
mTextView = findViewById(R.id.text);
}
public void check(View v) {
jsonObject();
// stringObject();
}
public void jsonObject() {
RequestQueue requestQueue = Volley.newRequestQueue(mContext);
String mJSONURLString ="https://reqres.in/api/users/2";
// Initialize a new JsonObjectRequest instance
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(
Request.Method.GET,
mJSONURLString,
null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
// Do something with response
//mTextView.setText(response.toString());
// Process the JSON
try {
StringBuilder formattedResult = new StringBuilder();
JSONArray responseJSONArray = response.getJSONArray("data");
for (int i = 0; i < responseJSONArray.length(); i++) { formattedResult.append("\n" + responseJSONArray.getJSONArray(i).get("id") + "=> \t" + responseJSONArray.getJSONObject(i).get("first_name"));
}
String data = formattedResult.toString();
mTextView.setText("List of Restaurants \n" + " ID no. " + "\t First : \n" + response.toString());
} catch (JSONException e) {
e.printStackTrace();
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
// Do something when error occurred
mTextView.setText("That didn't work!");
}
}
);
// Add JsonObjectRequest to the RequestQueue
requestQueue.add(jsonObjectRequest);
}
public void stringObject(){
// ...
// Instantiate the RequestQueue.
RequestQueue queue = Volley.newRequestQueue(this);
String url ="http://reqres.in/api/users/2";
// Request a string response from the provided URL.
StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
// Display the first 500 characters of the response string.
mTextView.setText("Response is: "+ response);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
mTextView.setText("That didn't work!");
}
});
// Add the request to the RequestQueue.
queue.add(stringRequest);
}
}
| [
"nyeboy619@gmail.com"
] | nyeboy619@gmail.com |
71f27c01d1dfc2371fc1e2f06abfbcc477285d77 | ceb0adbc9cac1e651c9cef13c74fc5a6f59817ec | /pet-clinic-data/src/main/java/ostino/springframework/petclinic/services/map/AbstractMapService.java | 371eeea91b24278e235d863cd07dcebbf0ca52db | [] | no_license | OleksandrStino/pet-clinic | 44d6ee3e1dcc2641fbb200d48999214509a3e81e | deb1dd379ac31de3f4644adf3e88b1878467ce52 | refs/heads/master | 2021-08-16T12:24:25.397433 | 2021-03-30T18:33:18 | 2021-03-30T18:33:18 | 247,508,545 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,168 | java | package ostino.springframework.petclinic.services.map;
import ostino.springframework.petclinic.models.BaseEntity;
import java.util.*;
public abstract class AbstractMapService<T extends BaseEntity, ID extends Long> {
private Map<Long, T> map = new HashMap<>();
Set<T> findAll() {
return new HashSet<>(map.values());
}
T findById(ID id) {
return map.get(id);
}
T save(T object) {
T savedObject = null;
if (object != null) {
if (object.getId() == null) {
object.setId(nextId());
}
savedObject = map.put(object.getId(), object);
} else {
throw new IllegalArgumentException("Failed to save entity. Object is null");
}
return savedObject;
}
void deleteById(ID id) {
map.remove(id);
}
void delete(T object) {
map.entrySet().removeIf(entry -> entry.getValue().equals(object));
}
public Map<Long, T> getMap() {
return Collections.unmodifiableMap(map);
}
private Long nextId() {
return map.keySet().isEmpty() ? 1L : Collections.max(map.keySet()) + 1;
}
}
| [
"sashastinio@gmail.com"
] | sashastinio@gmail.com |
4114e74f57dcf4655dc0c6b1fa24df0c99906192 | ade3cbf92c99152ca91aa0faa9e9d18da2e53bd8 | /KsdcTraning/src/com/ksdc/training/generics/GenericInterface.java | 6416a8aadadb5ba3c89d5df1ce8c63873c85519a | [] | no_license | dirsavancha/KSDCTraining | 2432360fbd07060051aa1baa91d3f443c367f106 | 687406ba3ad600b19d68af51d3f162a5eb47b957 | refs/heads/master | 2022-11-25T04:57:15.623613 | 2020-07-21T20:51:04 | 2020-07-21T20:51:04 | 281,478,252 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 757 | java | package com.ksdc.training.generics;
interface Animal<T>{
void categoryOfAnimal(T animal);
}
class AnyTypeOfAnimal<T> implements Animal<T>{
@Override
public void categoryOfAnimal(T animal) {
String animalName=animal.getClass().getName();
if(animalName.endsWith("Lion")) {
System.out.println("It is a wild animal");
}else if(animalName.endsWith("Dog")) {
System.out.println("It is pet animal");
}
}
}
class Dog{
}
class Lion{
}
public class GenericInterface<T> {
public static void main(String[] args) {
Dog d=new Dog();
Lion l=new Lion();
AnyTypeOfAnimal<Dog> obj=new AnyTypeOfAnimal<>();
AnyTypeOfAnimal<Lion> obj1=new AnyTypeOfAnimal<>();
obj.categoryOfAnimal(d);
obj1.categoryOfAnimal(l);
}
}
| [
"ramki.me2012@gmail.com"
] | ramki.me2012@gmail.com |
94d93b6579d4dd84ecc81ef31d29a16599f70306 | b65e2abb8aee465b3a6d6b5cb3558b12982441f6 | /TheNewBoston/src/com/example/thenewboston/SimpleBrowser.java | 833ae08fc8ec762b1908ca02b5cb1bc0304a6e2b | [] | no_license | phamhoangbl/TheNewBoston | 8a9de307e40c075ffb606a319a7b568b5a7bfedb | 4fce7f3d8913fefb175c8448432e95a0ddcfa035 | refs/heads/master | 2020-05-27T15:02:54.014449 | 2014-07-02T10:04:32 | 2014-07-02T10:04:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,465 | java | package com.example.thenewboston;
import android.app.Activity;
import android.content.Context;
import android.hardware.input.InputManager;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.InputMethodManager;
import android.webkit.*;
import android.widget.*;
public class SimpleBrowser extends Activity implements OnClickListener {
WebView webView;
Button btGo, btBack, btForward, btRefesh, btClearHistory;
EditText etUrlAddress;
InputMethodManager input;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.simplebrowser);
initialize();
}
private void initialize() {
btGo = (Button) findViewById(R.id.btGo);
btBack = (Button) findViewById(R.id.btBack);
btForward = (Button) findViewById(R.id.btForward);
btRefesh = (Button) findViewById(R.id.btRefesh);
btClearHistory = (Button) findViewById(R.id.btClearHistory);
etUrlAddress = (EditText) findViewById(R.id.etUrlAddress);
btGo.setOnClickListener(this);
btBack.setOnClickListener(this);
btForward.setOnClickListener(this);
btRefesh.setOnClickListener(this);
btClearHistory.setOnClickListener(this);
webView = (WebView) findViewById(R.id.wvBrowser);
//WebView settings
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
//call directly the URL
webView.setWebViewClient(new CustomViewClient());
//input
input = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
input.showSoftInputFromInputMethod(etUrlAddress.getWindowToken(), 0);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch (v.getId()) {
case R.id.btGo:
String address = etUrlAddress.getText().toString();
webView.loadUrl(address);
input.hideSoftInputFromInputMethod(etUrlAddress.getWindowToken(), 0);
break;
case R.id.btBack:
if(webView.canGoBack()){
webView.goBack();
}
break;
case R.id.btForward:
if(webView.canGoForward()){
webView.goForward();
}
break;
case R.id.btRefesh:
webView.reload();
break;
case R.id.btClearHistory:
webView.clearHistory();
break;
default:
break;
}
}
}
| [
"john.hoang.contact@gmail.com"
] | john.hoang.contact@gmail.com |
ba0660f10ad034bc7adef6db49dbf9c99b1cd60a | c038d307aa544c0931988ae45ea516022f8cea03 | /service/src/main/java/com/freeshow/service/CustomerFacadeImpl.java | 8b72790f5b9a3d0952c16c41b0c953a8ff37d9ba | [] | no_license | zhangqhjava/freeshow | 1cf598b1063e20a03a5aa5d3690c55c8de35d48e | 1b243456d8eee1595c2fe93fa79854ff7867b592 | refs/heads/master | 2021-01-17T20:46:50.343963 | 2014-11-08T12:39:56 | 2014-11-08T12:39:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,402 | java | package com.freeshow.service;
import com.freeshow.Response;
import com.freeshow.manager.exception.FreeShowException;
import com.freeshow.manager.util.VerifyUtil;
import com.freeshow.service.enums.BussErrorCode;
import com.freeshow.service.models.CustomerAuthReqDTO;
import com.freeshow.service.models.CustomerCreateReqDTO;
import com.freeshow.service.models.CustomerQueryReqDTO;
import com.freeshow.service.models.CustomerResDTO;
import com.google.common.base.Throwables;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.MDC;
import org.slf4j.Marker;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;
/**
* 客户信息 service
* Created by Mac Zhang on 14-11-8 下午6:00
*/
@Service
@Slf4j
public class CustomerFacadeImpl implements CustomerFacade{
@Override
public Response<String> createCustomer(CustomerCreateReqDTO reqDTO, String traceLogId) {
MDC.put(Marker.ANY_MARKER, traceLogId);
log.info("call createCustomer, PARAMETER: {}, {}", reqDTO, traceLogId);
Response<String> response = new Response<String>();
try {
//参数校验
VerifyUtil.validateObject(reqDTO);
log.info("success to createCustomer, RESULT: {} {}", response,traceLogId);
} catch (FreeShowException e) {
response.setErrorCode(e.getCode());
response.setErrorMsg(e.getMessage());
log.error("failed to createCustomer, PARAMETER: {} {}, RESULT: {}",
reqDTO, traceLogId, response);
} catch (DataAccessException e) {
response.setErrorCode(BussErrorCode.DATABASE_PROCESS_EXCEPTION.getErrorCode());
response.setErrorMsg(BussErrorCode.DATABASE_PROCESS_EXCEPTION.getErrorMsg());
log.error("failed to createCustomer, PARAMETER:{} {}, CAUSE:{}",
reqDTO, traceLogId, Throwables.getStackTraceAsString(e));
}catch (Exception e) {
response.setErrorCode(BussErrorCode.INTERNAL_PROCESS_EXCEPTION.getErrorCode());
response.setErrorMsg(BussErrorCode.INTERNAL_PROCESS_EXCEPTION.getErrorMsg());
log.error("failed to createCustomer, PARAMETER:{} {}, CAUSE:{}",
reqDTO, traceLogId, Throwables.getStackTraceAsString(e));
}
return response;
}
@Override
public Response<CustomerResDTO> queryCustomer(CustomerQueryReqDTO reqDTO, String traceLogId) {
MDC.put(Marker.ANY_MARKER, traceLogId);
log.info("call queryCustomer, PARAMETER: {}, {}", reqDTO, traceLogId);
Response<CustomerResDTO> response = new Response<CustomerResDTO>();
try {
//参数校验
VerifyUtil.validateObject(reqDTO);
log.info("success to queryCustomer, RESULT: {} {}", response,traceLogId);
} catch (FreeShowException e) {
response.setErrorCode(e.getCode());
response.setErrorMsg(e.getMessage());
log.error("failed to queryCustomer, PARAMETER: {} {}, RESULT: {}",
reqDTO, traceLogId, response);
} catch (DataAccessException e) {
response.setErrorCode(BussErrorCode.DATABASE_PROCESS_EXCEPTION.getErrorCode());
response.setErrorMsg(BussErrorCode.DATABASE_PROCESS_EXCEPTION.getErrorMsg());
log.error("failed to queryCustomer, PARAMETER:{} {}, CAUSE:{}",
reqDTO, traceLogId, Throwables.getStackTraceAsString(e));
}catch (Exception e) {
response.setErrorCode(BussErrorCode.INTERNAL_PROCESS_EXCEPTION.getErrorCode());
response.setErrorMsg(BussErrorCode.INTERNAL_PROCESS_EXCEPTION.getErrorMsg());
log.error("failed to queryCustomer, PARAMETER:{} {}, CAUSE:{}",
reqDTO, traceLogId, Throwables.getStackTraceAsString(e));
}
return response;
}
@Override
public Response<Boolean> authCustomer(CustomerAuthReqDTO reqDTO, String traceLogId) {
MDC.put(Marker.ANY_MARKER, traceLogId);
log.info("call authCustomer, PARAMETER: {}, {}", reqDTO, traceLogId);
Response<Boolean> response = new Response<Boolean>();
try {
//参数校验
VerifyUtil.validateObject(reqDTO);
log.info("success to authCustomer, RESULT: {} {}", response,traceLogId);
} catch (FreeShowException e) {
response.setErrorCode(e.getCode());
response.setErrorMsg(e.getMessage());
log.error("failed to authCustomer, PARAMETER: {} {}, RESULT: {}",
reqDTO, traceLogId, response);
} catch (DataAccessException e) {
response.setErrorCode(BussErrorCode.DATABASE_PROCESS_EXCEPTION.getErrorCode());
response.setErrorMsg(BussErrorCode.DATABASE_PROCESS_EXCEPTION.getErrorMsg());
log.error("failed to authCustomer, PARAMETER:{} {}, CAUSE:{}",
reqDTO, traceLogId, Throwables.getStackTraceAsString(e));
}catch (Exception e) {
response.setErrorCode(BussErrorCode.INTERNAL_PROCESS_EXCEPTION.getErrorCode());
response.setErrorMsg(BussErrorCode.INTERNAL_PROCESS_EXCEPTION.getErrorMsg());
log.error("failed to authCustomer, PARAMETER:{} {}, CAUSE:{}",
reqDTO, traceLogId, Throwables.getStackTraceAsString(e));
}
return response;
}
}
| [
"zhangqh_123@163.com"
] | zhangqh_123@163.com |
a432e6b74b1b0a53cbb1599ec7da06cdd463b28c | 0ab571864f71dfe7e54ca6b1d65f482e3efd46dc | /csc201/chapter1/src/lecture/NameLettersCounter.java | d12cbf2141e0a1de8eda0d2987650af0169cc82d | [] | no_license | maks112v/csc | 0b1fd68524bc4d788f9c3de09f9ae65e7d4d6d89 | c9973b69f63b380ca26ae64eb30c3ca1e25a343b | refs/heads/master | 2022-04-07T12:53:08.610565 | 2020-02-26T21:01:40 | 2020-02-26T21:01:40 | 234,000,094 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 804 | java | package lecture;
import java.util.Scanner;
public class NameLettersCounter {
private static Scanner scnr = new Scanner(System.in);
public static int getAndCountNameLetters() {
String name = "";
if (scnr.hasNext()) {
name = scnr.next();
}
return name.length();
}
public static void main(String[] args) {
int firstNameLetterCount;
int lastNameLetterCount;
System.out.println("Enter a person's first and last names:");
firstNameLetterCount = getAndCountNameLetters();
lastNameLetterCount = getAndCountNameLetters();
System.out.println("The first name has " + firstNameLetterCount + " letters.");
System.out.println("The last name has " + lastNameLetterCount + " letters.");
}
}
| [
"maks112v@gmail.com"
] | maks112v@gmail.com |
fc56ef49f13a2293e7fcc74039df3d949f3e1658 | 9eeb2635f2a00f2e1a0b67931c1048d926ecc924 | /libs/apache-log4j-2.6.2-src/apache-log4j-2.6.2-src/log4j-core/src/test/java/org/apache/logging/log4j/core/lookup/Log4jLookupWithSpacesTest.java | 7b88ad49b196b21be60bff4aacb62a65e2a9945b | [
"Apache-2.0"
] | permissive | AndrewNovitskiy/taskONE | 2488872823731c7797cd16f94aeaf853379b2ee9 | 831213d319abd583369109e5b4161a0321a0672f | refs/heads/master | 2020-11-29T15:29:24.043189 | 2017-04-06T21:31:11 | 2017-04-06T21:31:11 | 87,476,825 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,115 | java | /*
* Copyright 2015 Apache Software Foundation.
*
* 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.apache.logging.log4j.core.lookup;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.config.Configuration;
import org.apache.logging.log4j.core.config.ConfigurationAware;
import org.apache.logging.log4j.core.config.ConfigurationSource;
import org.apache.logging.log4j.core.impl.ContextAnchor;
import org.easymock.EasyMock;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.apache.logging.log4j.core.lookup.Log4jLookup.*;
import static org.easymock.EasyMock.*;
import static org.junit.Assert.*;
/**
*
*/
public class Log4jLookupWithSpacesTest {
private final static File EXPECT = new File(System.getProperty("user.home"), "/a a/b b/c c/d d/e e/log4j2 file.xml");
private LoggerContext mockCtx = null;
private Configuration config = null;
private ConfigurationSource configSrc = null;
@Before
public void setup() throws URISyntaxException, MalformedURLException {
this.mockCtx = EasyMock.createMock(LoggerContext.class);
ContextAnchor.THREAD_CONTEXT.set(mockCtx);
this.config = EasyMock.createMock(Configuration.class);
this.configSrc = EasyMock.createMock(ConfigurationSource.class);
expect(config.getConfigurationSource()).andReturn(configSrc);
expect(configSrc.getFile()).andReturn(EXPECT);
replay(mockCtx, config, configSrc);
}
@After
public void cleanup() {
verify(mockCtx, config, configSrc);
ContextAnchor.THREAD_CONTEXT.set(null);
this.mockCtx = null;
}
@Test
public void lookupConfigLocation_withSpaces() {
final StrLookup log4jLookup = new Log4jLookup();
((ConfigurationAware) log4jLookup).setConfiguration(config);
final String value = log4jLookup.lookup(KEY_CONFIG_LOCATION);
assertEquals(
new File(System.getProperty("user.home"), "/a a/b b/c c/d d/e e/log4j2 file.xml").getAbsolutePath(),
value);
}
@Test
public void lookupConfigParentLocation_withSpaces() {
final StrLookup log4jLookup = new Log4jLookup();
((ConfigurationAware) log4jLookup).setConfiguration(config);
final String value = log4jLookup.lookup(KEY_CONFIG_PARENT_LOCATION);
assertEquals(new File(System.getProperty("user.home"), "/a a/b b/c c/d d/e e").getAbsolutePath(), value);
}
}
| [
"starwars@tut.by"
] | starwars@tut.by |
94b0c67c1786c47e55d08a132bc38981e96c3c6c | 9c66af2bd4b85ce2c0c028e7aa89120b6c63396b | /src/main/java/com/abich/config/DbConfigurationServiceFactory.java | 9f93174e46eb7e7ba439af80c3eeb3fbde9a1a1b | [
"MIT"
] | permissive | flyhard/membershipManager | e0295811fbb41fb1250326ab967c5a380a94a85b | fe4933606cffaf45312772b38a0bc2aeca6bef57 | refs/heads/master | 2022-12-06T09:59:40.299137 | 2015-01-12T16:55:12 | 2015-01-12T16:55:12 | 27,817,452 | 0 | 0 | MIT | 2022-11-16T04:23:44 | 2014-12-10T11:48:38 | Java | UTF-8 | Java | false | false | 294 | java | package com.abich.config;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import io.dropwizard.jackson.Discoverable;
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
public interface DbConfigurationServiceFactory extends Discoverable {
DbConfigurationService build();
}
| [
"per.abich@gmail.com"
] | per.abich@gmail.com |
8f392438e23842c272088bafd611eb8df019d202 | adeec3693a1e1481ed88b362d6cd6e04f4b3f306 | /Codechef December Long Challenge 2020/Even-Pair.java | 7aac437c0db5be77482af1c66fe18ba68a871225 | [] | no_license | Kushagra-Dubey/Java | 09be50721f073586e91cfc98a49fff4f22a8f633 | f9b4fb9e62256a2f0191f115873f14205be554c1 | refs/heads/main | 2023-03-07T07:21:31.269858 | 2021-02-26T18:47:58 | 2021-02-26T18:47:58 | 342,666,729 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 511 | java | import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc = new Scanner(System.in);
int t=sc.nextInt();
while(t-->0) {
long a=sc.nextInt();
long b=sc.nextInt();
long even1 = a/2;
long odd1=a-even1;
long even2=b/2;
long odd2=b-even2;
long ans = even1*even2 +odd1*odd2;
System.out.println(ans);
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
35bc4c28567f814be40a95ce964e8c198e638ae2 | 382872451e6022087ee1f17966b2a5bf78faa213 | /200219-200226_문제풀이/BOJ1012_유기농배추_Main_김형준.java | 37140aa3087038e4e8a5669cd17fd4bf53fba905 | [] | no_license | ToADPlus/BOJ | cf0d5b7789fc1c79dadd6b252928d538d85efd20 | dba13f5b1200da9967b31c46d648f6a6aa8b69f9 | refs/heads/master | 2020-12-22T20:37:48.715861 | 2020-07-16T00:36:52 | 2020-07-16T00:36:52 | 236,925,580 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 2,016 | java | package 백준;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;
public class BOJ1012_유기농배추_Main_김형준 {
static boolean [][]m;
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int TC = Integer.parseInt(st.nextToken());
for (int i = 0; i < TC; i++) {
st = new StringTokenizer(br.readLine());
int M = Integer.parseInt(st.nextToken()); //가로
int N = Integer.parseInt(st.nextToken()); //세로
int K = Integer.parseInt(st.nextToken()); //배추의 개수
m = new boolean [N][M];
for (int j = 0; j < K; j++) {
st = new StringTokenizer(br.readLine());
int x = Integer.parseInt(st.nextToken());
int y = Integer.parseInt(st.nextToken());
m[y][x] = true;
}
int cnt = 0;
for (int j = 0; j < N; j++) {
for (int k = 0; k < M; k++) {
if(m[j][k]) {
bfs(j,k);
cnt++;
}
}
}
System.out.println(cnt);
}
}
private static void bfs(int j, int k) {
Queue<pair> q = new LinkedList<pair>();
q.add(new pair(j,k));
m[j][k] = false;
int []wy = {-1,1,0,0};//상하좌우
int []wx = {0,0,-1,1};//상하좌우
while(!q.isEmpty()) {
pair pinfo = q.poll();
int y = pinfo.y;
int x = pinfo.x;
for (int i = 0; i < wx.length; i++) {
int ny = y + wy[i];
int nx = x + wx[i];
if(ny >=0&& nx>=0 && ny <m.length && nx<m[0].length && m[ny][nx]) {
q.offer(new pair(ny,nx));
m[ny][nx] = false;
}
}
}
}
}
class pair{
int y;
int x;
public pair(int y, int x) {
super();
this.y = y;
this.x = x;
}
@Override
public String toString() {
return "pair [y=" + y + ", x=" + x + "]";
}
}
| [
"noreply@github.com"
] | noreply@github.com |
44dcef48e0a39bda02b21caaf00ffdd1e0e1fad7 | aefc3c420e1f1bd2f2117c6bec789574eb715d1a | /src/main/java/com/charlie1/charts/cagr.java | 12a8da6ff570ae56f88400a9aae720899daff053 | [] | no_license | davidwillock/Stats | e15cb619d1e0ba792f75937a92c1fc879f56d7df | 64d593c2abdfcfa9630e05053ef4a0b5d97e17e4 | refs/heads/master | 2021-09-05T00:08:53.395548 | 2018-01-23T00:38:44 | 2018-01-23T00:38:44 | 117,581,267 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,572 | java | package com.charlie1.charts;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.awt.Color;
import java.io.*;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.XYPlot;
import org.jfree.data.time.Day;
import org.jfree.data.time.TimeSeries;
import org.jfree.data.time.TimeSeriesCollection;
import org.jfree.data.xy.XYDataset;
import java.awt.image.RenderedImage;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
//import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.DefaultCategoryDataset;
/**
* Servlet implementation class cagr
*/
public class cagr extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public cagr() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
//response.getWriter().append("Served at: ").append(request.getContextPath());
response.setContentType("image/png");
ServletOutputStream os = response.getOutputStream();
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.addValue(76, "Java", "Sandeep");
dataset.addValue(30, "Java", "Sangeeta");
dataset.addValue(50, "Java", "Surabhi");
dataset.addValue(20,"Java", "Sumanta");
dataset.addValue(10, "Oracle", "Sandeep");
dataset.addValue(90, "Oracle", "Sangeeta");
dataset.addValue(23, "Oracle", "Surabhi");
dataset.addValue(87, "Oracle", "Sumanta");
JFreeChart chart = ChartFactory.createAreaChart(
"Area Chart", "", "Value", dataset,
PlotOrientation.VERTICAL,
true, true, false);
RenderedImage chartImage = chart.createBufferedImage(300, 300);
ImageIO.write(chartImage, "png", os);
os.flush();
os.close();
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
private XYDataset createDataset() {
TimeSeriesCollection dataset = new TimeSeriesCollection();
TimeSeries series1 = new TimeSeries("Series1");
series1.add(new Day(1, 1, 2017), 50);
series1.add(new Day(2, 1, 2017), 40);
series1.add(new Day(3, 1, 2017), 45);
series1.add(new Day(4, 1, 2017), 30);
series1.add(new Day(5, 1, 2017), 50);
series1.add(new Day(6, 1, 2017), 45);
series1.add(new Day(7, 1, 2017), 60);
series1.add(new Day(8, 1, 2017), 45);
series1.add(new Day(9, 1, 2017), 55);
series1.add(new Day(10, 1, 2017), 48);
series1.add(new Day(11, 1, 2017), 60);
series1.add(new Day(12, 1, 2017), 45);
series1.add(new Day(13, 1, 2017), 65);
series1.add(new Day(14, 1, 2017), 45);
series1.add(new Day(15, 1, 2017), 55);
dataset.addSeries(series1);
TimeSeries series2 = new TimeSeries("Series2");
series2.add(new Day(1, 1, 2017), 40);
series2.add(new Day(2, 1, 2017), 35);
series2.add(new Day(3, 1, 2017), 26);
series2.add(new Day(4, 1, 2017), 45);
series2.add(new Day(5, 1, 2017), 40);
series2.add(new Day(6, 1, 2017), 35);
series2.add(new Day(7, 1, 2017), 45);
series2.add(new Day(8, 1, 2017), 48);
series2.add(new Day(9, 1, 2017), 31);
series2.add(new Day(10, 1, 2017), 32);
series2.add(new Day(11, 1, 2017), 21);
series2.add(new Day(12, 1, 2017), 35);
series2.add(new Day(13, 1, 2017), 10);
series2.add(new Day(14, 1, 2017), 25);
series2.add(new Day(15, 1, 2017), 15);
dataset.addSeries(series2);
return dataset;
}
}
| [
"david.willock@hotmail.com"
] | david.willock@hotmail.com |
1426a7964af1b81c56605ed782868522a92744fe | 87766766135b2efb369563037fc02be96bcb98e7 | /spring-boot-mybatis/spring-boot-mybatis-annotation/src/main/java/com/lancelot/mapper/UserMapper.java | ab4523ea668e1efb4eabc6d518481ea659f972c8 | [] | no_license | Lancelothe/spring-boot-demo | f8872d785239a6465211e16a327fc80906f6263c | f40b09304c2fb14d9172cb85d628ee196adeb10f | refs/heads/master | 2021-02-08T07:42:12.648509 | 2020-04-26T15:41:12 | 2020-04-26T15:41:12 | 244,123,789 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,078 | java | package com.lancelot.mapper;
import com.lancelot.enums.UserSexEnum;
import com.lancelot.model.User;
import org.apache.ibatis.annotations.*;
import java.util.List;
/**
* @author lancelot
* @date 2020/3/9
*/
public interface UserMapper {
@Select("SELECT * FROM users")
@Results({
@Result(property = "userSex", column = "user_sex", javaType = UserSexEnum.class),
@Result(property = "nickName", column = "nick_name")
})
List<User> getAll();
@Select("SELECT * FROM users WHERE id = #{id}")
@Results({
@Result(property = "userSex", column = "user_sex", javaType = UserSexEnum.class),
@Result(property = "nickName", column = "nick_name")
})
User getOne(Long id);
@Insert("INSERT INTO users(userName,passWord,user_sex) VALUES(#{userName}, #{passWord}, #{userSex})")
void insert(User user);
@Update("UPDATE users SET userName=#{userName},nick_name=#{nickName} WHERE id =#{id}")
void update(User user);
@Delete("DELETE FROM users WHERE id =#{id}")
void delete(Long id);
}
| [
"whoami.ace@gmail.com"
] | whoami.ace@gmail.com |
67c856a8f61f66b1ceda4bee05c116c2eb48dea6 | 0b82b139d276a29727eecf2e7f3c2a055a8e7c7e | /src/Dec7b.java | fcf108ba507173258689cf144485323950977af2 | [] | no_license | ristolainen/aoc2019 | 528cc92bb843ab71a6de2174ed41eaba6ff4ecf8 | facf5d311f16b0dbbdb95259d5e779bcbac0a8aa | refs/heads/master | 2023-06-23T03:33:46.308080 | 2023-05-31T14:19:58 | 2023-05-31T14:19:58 | 228,337,842 | 1 | 0 | null | 2023-06-14T22:29:29 | 2019-12-16T08:24:57 | Java | UTF-8 | Java | false | false | 2,090 | java | import com.google.common.collect.Collections2;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;
public class Dec7b {
public static void main(String[] args) throws IOException {
final var permutations = Collections2.permutations(List.of(5, 6, 7, 8, 9));
int maxOutput = 0;
for (List<Integer> permutation : permutations) {
final var amplifiers = List.of(
new IntComputer4(input(), permutation.get(0)),
new IntComputer4(input(), permutation.get(1)),
new IntComputer4(input(), permutation.get(2)),
new IntComputer4(input(), permutation.get(3)),
new IntComputer4(input(), permutation.get(4))
);
int signal = 0;
boolean programEnd = false;
while (!programEnd) {
for (int i = 0; i < 5; i++) {
final var amplifier = amplifiers.get(i);
final var amplifierOutput = amplifier.runToOutput(signal);
System.out.println(amplifierOutput);
if (amplifierOutput != null) {
signal = amplifierOutput;
} else {
programEnd = true;
}
}
}
if (signal > maxOutput) {
maxOutput = signal;
}
}
System.out.println(maxOutput);
}
private static List<Integer> input() throws IOException {
final var program = Arrays.stream(Files.readString(Paths.get("7.txt"))
.split(","))
.map(String::trim)
.map(Integer::valueOf)
.collect(Collectors.toList());
return program;
//return new ArrayList<>(List.of(3,26,1001,26,-4,26,3,27,1002,27,2,27,1,27,26, 27,4,27,1001,28,-1,28,1005,28,6,99,0,0,5));
}
}
| [
"kristoffer.johansson@symphony.com"
] | kristoffer.johansson@symphony.com |
1c4876db587885b4b7d2a992aae4086f7f2fb5f3 | 7020e98be8292ef1786b607f18289363d7fb4ac1 | /baseframework/src/main/java/com/gu/baselibrary/baseui/view/AppDelegate.java | 43c55f9b73e3201e8051c17822993db2974d6ea6 | [] | no_license | msdgwzhy6/MyBaseMvpLibrary | 7e5a818546cd61d6d6720b2d60975a38e159e514 | e704ffc2954ef6c529ffe7c043a6b629ef3d2cd9 | refs/heads/master | 2021-01-24T00:09:16.705329 | 2016-02-01T03:00:44 | 2016-02-01T03:00:44 | 52,052,308 | 1 | 0 | null | 2016-02-19T01:30:29 | 2016-02-19T01:30:28 | null | UTF-8 | Java | false | false | 3,539 | java | /*
* Copyright (c) 2015, 张涛.
*
* 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.gu.baselibrary.baseui.view;
import android.app.Activity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import com.gu.baselibrary.utils.Toastor;
/**
* View delegate base class
* 视图层代理的基类
*
* @author kymjs (http://www.kymjs.com/) on 10/23/15.
*/
public abstract class AppDelegate implements IDelegate {
protected final SparseArray<View> mViews = new SparseArray<View>();
protected View rootView = null;
@Override
public void create(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
int rootLayoutId = getRootLayoutId();
if (rootView == null) {
rootView = inflater.inflate(rootLayoutId, container, false);
}
}
/**
* @param id
* @param <T>
* @return 通过id,获取到控件对象
*/
public <T extends View> T get(int id) {
return (T) bindView(id);
}
/**
* @param id
* @param <T>
* @return 绑定视图对象并返回
*/
private <T extends View> T bindView(int id) {
T view = (T) mViews.get(id);
if (view == null) {
view = (T) rootView.findViewById(id);
mViews.put(id, view);
}
return view;
}
/**
* 设置点击监听
*
* @param listener
* @param ids
*/
public void setOnClickListener(View.OnClickListener listener, int... ids) {
if (ids == null) {
return;
}
for (int id : ids) {
get(id).setOnClickListener(listener);
}
}
/**
* 返回当前的Activity
*
* @param <T>
* @return
*/
public <T extends Activity> T getActivity() {
return (T) rootView.getContext();
}
/**
* 展示一个toast提示
*
* @param msg
*/
protected void showToast(String msg) {
if (!TextUtils.isEmpty(msg)) {
new Toastor(rootView.getContext()).showSingletonToast(msg);
}
}
/**
* 展示一个toast提示
*
* @param msgId
*/
protected void showToast(int msgId) {
new Toastor(rootView.getContext()).showSingletonToast(msgId);
}
/**
* @return 返回root视图的id
*/
public abstract int getRootLayoutId();
/**
* 此方法里做一些初始化的操作
*/
@Override
public abstract void initWidget();
/**
* 返回当前的View
*/
@Override
public View getRootView() {
return rootView;
}
/**
* @return menu菜单id
*/
@Override
public abstract int getOptionsMenuId();
/**
* @return 返回toolbar对象
*/
@Override
public abstract Toolbar getToolbar();
}
| [
"15951084423@163.com"
] | 15951084423@163.com |
b5fc50b2a6f14f480b4c0d8547c6a923ece11731 | 3abdd72bd3bcf567194955d0ca05bbcb4f506de3 | /src/main/java/org/elasticsearch/river/couchdb/CouchdbRiverModule.java | 3dfed7905b4179276b06d193137a991e1b9db750 | [
"Apache-2.0"
] | permissive | Keyintegrity/elasticsearch-river-couchdb | 23c2bef2e7d8535288b230d24323ac0d9d516ae1 | ce6ef76380a7bfee09b1a368aa2ddf2521671cbd | refs/heads/master | 2020-12-25T21:55:48.942094 | 2013-10-08T03:37:49 | 2013-10-08T03:37:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,136 | java | /*
* Licensed to ElasticSearch and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. ElasticSearch licenses this
* file to you 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.elasticsearch.river.couchdb;
import org.elasticsearch.common.inject.AbstractModule;
import org.elasticsearch.river.River;
/**
*
*/
public class CouchdbRiverModule extends AbstractModule {
@Override
protected void configure() {
bind(River.class).to(CouchdbRiver.class).asEagerSingleton();
}
}
| [
"kimchy@gmail.com"
] | kimchy@gmail.com |
fa25770e4e1b8f454a221da5bb2b8dd07fdb1251 | 116399a77718d5ac50ca39a20d1983b0ec65a616 | /src/test/java/co/com/choucair/certification/test2/stepdefinitions/UtestAcademyStepDefinitions.java | f37032330b8e06b7623a15d81d595a7fc1d19aa8 | [] | no_license | dgallegoo2/test2 | 748a971ba3675bee739ef0a2316232da2ef09fe7 | e34cd0237eb051d0e1488541d3541596c36e062c | refs/heads/master | 2023-01-23T01:25:06.129654 | 2020-11-25T01:41:24 | 2020-11-25T01:41:24 | 315,666,861 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,690 | java | package co.com.choucair.certification.test2.stepdefinitions;
import co.com.choucair.certification.test2.model.UtestAcademyData;
import co.com.choucair.certification.test2.questions.Answer;
import co.com.choucair.certification.test2.tasks.Join;
import co.com.choucair.certification.test2.tasks.OpenUp;
import co.com.choucair.certification.test2.tasks.Login;
import cucumber.api.java.Before;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
import net.serenitybdd.screenplay.GivenWhenThen;
import net.serenitybdd.screenplay.actors.OnStage;
import net.serenitybdd.screenplay.actors.OnlineCast;
import java.util.List;
public class UtestAcademyStepDefinitions {
@Before
public void setStage(){
OnStage.setTheStage(new OnlineCast());
}
@Given("^than Daniel wants to be part of the world's largest independent software tester community$")
public void thanDanielWantsToBePartOfTheWorldSLargestIndependentSoftwareTesterCommunity(List<UtestAcademyData> utestAcademyData ) throws Exception {
OnStage.theActorCalled("Daniel").wasAbleTo(OpenUp.thePage(), Join.
onThePage(utestAcademyData.get(0).getStrFirstName(),utestAcademyData.get(0).getStrLastName(),utestAcademyData.get(0).getStrEmailAddress(),utestAcademyData.get(0).getStrMonthOfBird(),utestAcademyData.get(0).getIntDayOfBird(),utestAcademyData.get(0).getIntYearOfBird(),utestAcademyData.get(0).getStrCity(),utestAcademyData.get(0).getIntPostalCode(),utestAcademyData.get(0).getStrCountry(),utestAcademyData.get(0).getStrYourComputer(),utestAcademyData.get(0).getIntVersion(),utestAcademyData.get(0).getStrLanguage(),utestAcademyData.get(0).getStrYourMobileDevice(),utestAcademyData.get(0).getStrModel(),utestAcademyData.get(0).getStrOperatingSystem(),utestAcademyData.get(0).getStrPassword(),utestAcademyData.get(0).getStrConfirmPassword()));
}
@When("^he enters the world's largest community of freelance software testers$")
public void heEntersTheWorldSLargestCommunityOfFreelanceSoftwareTesters(List<UtestAcademyData> utestAcademyData ) throws Exception {
OnStage.theActorInTheSpotlight().attemptsTo(Login.onThePage(utestAcademyData.get(0).getStrUser(),utestAcademyData.get(0).getStrPassword()));
}
@Then("^he finds that he is already part of the world's largest community of freelance software testers$")
public void heFindsThatHeIsAlreadyPartOfTheWorldSLargestCommunityOfFreelanceSoftwareTesters(List<UtestAcademyData> utestAcademyData ) throws Exception {
OnStage.theActorInTheSpotlight().should(GivenWhenThen.seeThat(Answer.toThe(utestAcademyData.get(0).getStrMessage())));
}
}
| [
"danielgallego205265@correo.itm.edu.co"
] | danielgallego205265@correo.itm.edu.co |
d5be6eaef4f58d2ac2d07248937423bb02b73c85 | 2beeb86e127ed14387508f4e1fc5b119df6897d7 | /ui/src/main/java/com/vaadin/demo/ui/views/ErrorView.java | 20def1d3a842ac3f8d81fb6b9193d2a265998be9 | [] | no_license | jojule/patient-portal-vaadin | 4ccde1d4509df54e66784f3f70d332e0216a3f31 | b61ef21541429bd7da283f06e45117fe86e55876 | refs/heads/master | 2021-01-22T04:04:57.058100 | 2017-03-28T04:25:05 | 2017-03-28T04:25:05 | 81,498,978 | 0 | 1 | null | 2017-02-09T21:57:56 | 2017-02-09T21:57:56 | null | UTF-8 | Java | false | false | 794 | java | package com.vaadin.demo.ui.views;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.UIScope;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.themes.ValoTheme;
@SpringComponent
@UIScope
public class ErrorView extends VerticalLayout implements View {
public ErrorView() {
setSizeFull();
setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
Label failMessage = new Label("You failed.");
failMessage.addStyleName(ValoTheme.LABEL_H1);
addComponent(failMessage);
}
@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
}
}
| [
"marcus@vaadin.com"
] | marcus@vaadin.com |
11988fcd108872ed458974fe7ce9fe6e425f551a | a8a07f6259cf8347ee9a6cd13d4650325deab112 | /app/src/main/java/company/sunjunjie/come/sjjmusicplayer60/LocalMusicFragment.java | fa5a7285945ea891d7aa3f2f7c786ea94dfd4453 | [] | no_license | sjjdd/SJJMusic | ed005af6a948da0e5024c27df18982a3d4c1a38e | 5d2519c39616c322946b084cd0f4eb177186fac3 | refs/heads/master | 2021-05-10T09:17:34.175810 | 2018-01-25T14:11:15 | 2018-01-25T14:11:15 | 118,919,683 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,319 | java | package company.sunjunjie.come.sjjmusicplayer60;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import org.litepal.crud.DataSupport;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link LocalMusicFragment.OnFragmentInteractionListener} interface
* to handle interaction events.
* Use the {@link LocalMusicFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class LocalMusicFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
Music music=new Music();
// List<File> list=new ArrayList<File>();//定义一个list待会儿用于存放寻找的文件
private ListView listView;
private List<Music> musicList=new ArrayList<>();
private OnFragmentInteractionListener mListener;
private TextView showMusicName,showSingerName;
List<PlayedMusic> playedMusics;
public LocalMusicFragment() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment LocalMusicFragment.
*/
// TODO: Rename and change types and number of parameters
public static LocalMusicFragment newInstance(String param1, String param2) {
LocalMusicFragment fragment = new LocalMusicFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view=inflater.inflate(R.layout.fragment_local_music, container, false);
return view;
}
//加这个函数是为了避免将同样的歌曲重复添加到已经播放过的
public boolean NoRepeateInPlayed(int music_id){
List<PlayedMusic> music=DataSupport.findAll(PlayedMusic.class);
if(music.size()>1) {
for (int i = 0; i < music.size(); i++) {
if (music_id==music.get(i).getMusic_id()) {
return false;
}
}
}return true;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// initMusic();
musicList= DataSupport.findAll(Music.class);
MusicAdapter adapter=new MusicAdapter(getActivity(),R.layout.activity_sjjnodelete_item,musicList);
/* showMusicName=(TextView)getActivity().findViewById(R.id.music_info_textView);
showSingerName=(TextView)getActivity().findViewById(R.id.singer_info_textView);*/
listView=(ListView) getActivity().findViewById(R.id.list_view_reposity);
listView.setAdapter(adapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, final int position, long id) {
// Toast.makeText(getActivity(),String.valueOf(musicList.size()), Toast.LENGTH_SHORT).show();//打印出所有本地歌曲数量
Music music=musicList.get(position);
List<PlayedMusic> Played=DataSupport.findAll(PlayedMusic.class);
//将已经播放过的列表与本地音乐库中的音乐数比较,若小于其数量,则删除当前数据重新导入一遍
//if(Played.size()<musicList.size()) {
PlayedMusic.deleteAll(PlayedMusic.class);
for (int i = 0; i < musicList.size(); i++) {
PlayedMusic playedMusic = new PlayedMusic();
playedMusic.setPlayed_id( i);
playedMusic.setMusic_id(musicList.get(i).getMusic_id());
playedMusic.save();
}
// }
playedMusics=DataSupport.where("music_id=?",String.valueOf(music.getMusic_id())).find(PlayedMusic.class);
if(playedMusics.size()>0)
mListener.playMusic(music,playedMusics.get(0).getPlayed_id());//接口回调
/*Button play=(Button) getActivity().findViewById(R.id.play_button);
play.setBackgroundResource(R.drawable.play);*/
}
});
Button backTomain=(Button) getActivity().findViewById(R.id.backTomain);
backTomain.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mListener.changeToMain();
}
});
}
// TODO: Rename method, update argument and hook method into UI event
public void onButtonPressed(Uri uri) {
if (mListener != null) {
mListener.playMusic(music,(int)playedMusics.get(0).getPlayed_id());
mListener.changeToMain();
}
}
@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;
}
/**
* 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 playMusic(Music music,int id);
void changeToMain();
}
}
| [
"1667688587@qq.com"
] | 1667688587@qq.com |
91704196b754f0034ed62327ad987256b39957dc | a6d8e20009252fabf153abd3d5b1fc4ed05c4c95 | /src/main/java/demo/classloader/CharSequenceJavaFileObject.java | 6f3cafdabe63deda94668047ab41bf3c9d96a78b | [] | no_license | dang414238645/javatest | d65c4e0c7b31bd894bada50d13f1bf6d63d8b03f | 19d20f37f279831b03a49fac4a5275c47c471d96 | refs/heads/master | 2020-05-05T02:08:15.588284 | 2014-12-16T06:21:59 | 2014-12-16T06:21:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 698 | java | package demo.classloader;
import javax.tools.JavaFileObject;
import javax.tools.SimpleJavaFileObject;
import java.net.URI;
public class CharSequenceJavaFileObject extends SimpleJavaFileObject {
private CharSequence content;
public CharSequenceJavaFileObject(String className,
CharSequence content) {
super(URI.create("string:///" + className.replace('.', '/')
+ JavaFileObject.Kind.SOURCE.extension), JavaFileObject.Kind.SOURCE);
this.content = content;
}
@Override
public CharSequence getCharContent(
boolean ignoreEncodingErrors) {
return content;
}
}
| [
"dang414238645@163.com"
] | dang414238645@163.com |
a8f3eb4737cac2b99ca3df7e9f68424a17f35a15 | 7d0506ab0293293e49bb65f5e49ce45e16f4df68 | /L8.2.1/src/main/java/ru/otus/l821/reflection/ReflectionHelper.java | dfce775f886ba1bb9f255e60b774bcf9a07ba83e | [
"MIT"
] | permissive | olaaa/otus_java_2017_06 | 5f3ed8c968c1c3da33f34f62651259ba7a1622b8 | 5f9fdedb6f4c98c0920de8c157ac9cc0773baffd | refs/heads/master | 2022-04-03T08:41:42.585636 | 2017-10-05T16:20:05 | 2017-10-05T16:20:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,009 | java | package ru.otus.l821.reflection;
import java.lang.reflect.Field;
public class ReflectionHelper {
public static Object createInstance(String className) {
try {
return Class.forName(className).newInstance();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public static void setFieldValue(Object object,
String fieldName,
String value) {
try {
Field field = object.getClass().getDeclaredField(fieldName);
field.setAccessible(true);
if (field.getType().equals(String.class)) {
field.set(object, value);
} else if (field.getType().equals(int.class)) {
field.set(object, Integer.decode(value));
}
field.setAccessible(false);
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"vitaly.chibrikov@gmail.com"
] | vitaly.chibrikov@gmail.com |
52bdff783ee127207a1abeab025c48dc3dfaaa78 | 3c52ef6d49cd1dc212eb4473f96e09cea373931d | /src/net/hzjxy/myshop/dao/impl/GoodsUnitDaoImpl.java | 008b1c8d595be12010d04e9a0aa23c134a64975b | [] | no_license | songlei0710/MyShop | be17f5370bf6217c0eefce94fa757c2bea10efdc | 67ac14caeb908cc611f93e7c9ad1b753ab6da717 | refs/heads/master | 2021-01-19T07:46:22.677578 | 2014-12-26T01:25:37 | 2014-12-26T01:25:37 | 27,355,502 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,773 | java | package net.hzjxy.myshop.dao.impl;
import net.hzjxy.myshop.dao.GoodsUnitDao;
import net.hzjxy.myshop.entity.GoodsUnit;
import org.apache.ibatis.session.SqlSession;
import java.util.List;
/**
* Created by linchunlei on 2014/12/14.
*/
public class GoodsUnitDaoImpl implements GoodsUnitDao {
@Override
public int delGoodsunit(String[] list) {
SqlSession session=MybatisUtil.currentSession();
GoodsUnitDao goodsUnitDao=session.getMapper(GoodsUnitDao.class);
goodsUnitDao.delGoodsunit(list);
session.commit();
return goodsUnitDao.delGoodsunit(list);
}
@Override
public int updateGoodsunit(GoodsUnit u) {
SqlSession session=MybatisUtil.currentSession();
GoodsUnitDao goodsUnitDao=session.getMapper(GoodsUnitDao.class);
int update=goodsUnitDao.updateGoodsunit(u);
return update;
}
@Override
public List<GoodsUnit> findAllGoodsunit(int currentPage, int lineSize) {
SqlSession session=MybatisUtil.currentSession();
GoodsUnitDao goodsUnitDao=session.getMapper(GoodsUnitDao.class);
List<GoodsUnit> goodsunit=goodsUnitDao.findAllGoodsunit(currentPage,lineSize);
return goodsunit;
}
@Override
public int countfindAllGoodsunit() {
SqlSession session=MybatisUtil.currentSession();
GoodsUnitDao goodsUnitDao=session.getMapper(GoodsUnitDao.class);
int countfindall=goodsUnitDao.countfindAllGoodsunit();
return goodsUnitDao.countfindAllGoodsunit();
}
@Override
public GoodsUnit findGoodsunitById(String unitid) {
SqlSession session=MybatisUtil.currentSession();
GoodsUnitDao goodsUnitDao=session.getMapper(GoodsUnitDao.class);
GoodsUnit goodsUnit=goodsUnitDao.findGoodsunitById(unitid);
return goodsUnit;
}
@Override
public List<GoodsUnit> findAllGoodsunitjson() {
SqlSession session=MybatisUtil.currentSession();
GoodsUnitDao goodsUnitDao=session.getMapper(GoodsUnitDao.class);
List<GoodsUnit> goodsunitfind=goodsUnitDao.findAllGoodsunitjson();
return goodsunitfind;
}
@Override
public List<GoodsUnit> sortAllGoodsnit(int currentPage, int lineSize, String queryString) {
SqlSession session=MybatisUtil.currentSession();
GoodsUnitDao goodsUnitDao=session.getMapper(GoodsUnitDao.class);
List<GoodsUnit> goodsunitsort=goodsUnitDao.sortAllGoodsnit(currentPage,lineSize,queryString);
return goodsunitsort;
}
@Override
public int add(GoodsUnit goodsUnit) {
SqlSession session=MybatisUtil.currentSession();
GoodsUnitDao goodsUnitDao=session.getMapper(GoodsUnitDao.class);
int add=goodsUnitDao.add(goodsUnit);
return add;
}
}
| [
"664390026@qq.com"
] | 664390026@qq.com |
fa6f215cdbdebdbb6add7e4c9c6d63d20d9463e9 | af46928031f6ef682c21a19d322155119b6b25ba | /HelloWorld/src/com/dicks/action/EditRuleAction.java | a8a5a1c4751391bcc07494fe1e82ee0a820b2cc1 | [] | no_license | claire921/dicks | a6e3d82485194c01c93d07b26cb9129519c4c8bf | 0b87a6d27439ad149ed8c6c0a645eebddc063a34 | refs/heads/master | 2016-09-05T20:56:08.744429 | 2013-08-17T23:02:43 | 2013-08-17T23:02:43 | 11,529,894 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 190 | java | package com.dicks.action;
import com.opensymphony.xwork2.ActionSupport;
public class EditRuleAction extends ActionSupport {
public String editRule() {
return SUCCESS;
}
}
| [
"claire921@gmail.com"
] | claire921@gmail.com |
6dac5965e0f1aab2757ad6350c0e43bfabf7f829 | 606cd7931bc5288ffe91cf58f45d3e4f64a9b3df | /pk/src/java/com/pelindo/ebtos/bean/GateInReceivingBean.java | 8970c985108322f7ebd6da0bbb973f16a164705b | [] | no_license | surachman/iconos-tarakan | 5655284ac69059935922d92ee856b6926b656d1d | d7fa1c120d22d391983dab95c5654cb63b27e1f7 | refs/heads/master | 2021-01-20T20:21:40.937285 | 2016-06-27T14:51:22 | 2016-06-27T14:51:22 | 61,995,382 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 45,743 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.pelindo.ebtos.bean;
import com.qtasnim.jsf.FacesHelper;
import com.qtasnim.url.UrlHelper;
import com.pelindo.ebtos.ejb.facade.remote.MasterContDamageFacadeRemote;
import com.pelindo.ebtos.ejb.facade.remote.MasterContainerTypeFacadeRemote;
import com.pelindo.ebtos.ejb.facade.remote.MasterVehicleFacadeRemote;
import com.pelindo.ebtos.ejb.facade.remote.MasterYardFacadeRemote;
import com.pelindo.ebtos.ejb.facade.remote.PlanningContLoadFacadeRemote;
import com.pelindo.ebtos.ejb.facade.remote.PlanningContReceivingFacadeRemote;
import com.pelindo.ebtos.ejb.facade.remote.PlanningReceivingFacadeRemote;
import com.pelindo.ebtos.ejb.facade.remote.PluggingReeferServiceFacadeRemote;
import com.pelindo.ebtos.ejb.facade.remote.ReceivingServiceFacadeRemote;
import com.pelindo.ebtos.ejb.facade.remote.ServiceContLoadFacadeRemote;
import com.pelindo.ebtos.ejb.facade.remote.ServiceGateReceivingFacadeRemote;
import com.pelindo.ebtos.ejb.facade.remote.ServiceReceivingFacadeRemote;
import com.pelindo.ebtos.model.db.PlanningContLoad;
import com.pelindo.ebtos.model.db.PlanningContReceiving;
import com.pelindo.ebtos.model.db.PlanningReceivingAllocation;
import com.pelindo.ebtos.model.db.PlanningVessel;
import com.pelindo.ebtos.model.db.PluggingReeferService;
import com.pelindo.ebtos.model.db.PreserviceVessel;
import com.pelindo.ebtos.model.db.ReceivingService;
import com.pelindo.ebtos.model.db.ServiceContLoad;
import com.pelindo.ebtos.model.db.ServiceGateReceiving;
import com.pelindo.ebtos.model.db.ServiceReceiving;
import com.pelindo.ebtos.model.db.master.MasterContDamage;
import com.pelindo.ebtos.model.db.master.MasterContainerType;
import com.pelindo.ebtos.model.db.master.MasterDangerousClass;
import com.pelindo.ebtos.model.db.master.MasterVehicle;
import com.pelindo.ebtos.model.db.master.MasterYard;
import com.pelindo.ebtos.util.GrossConverter;
import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.faces.event.ValueChangeEvent;
import org.apache.commons.lang3.StringEscapeUtils;
import org.primefaces.context.RequestContext;
/**
*
* @author dycoder
*/
@ManagedBean(name = "gateInReceivingBean")
@ViewScoped
public class GateInReceivingBean implements Serializable {
@EJB
private MasterContDamageFacadeRemote masterContDamageFacade;
@EJB
private ReceivingServiceFacadeRemote receivingServiceFacade;
@EJB
private ServiceGateReceivingFacadeRemote serviceGateReceivingFacadeRemote;
@EJB
private MasterVehicleFacadeRemote masterVehicleFacadeRemote;
@EJB
private PlanningContReceivingFacadeRemote planningContReceivingFacadeRemote;
@EJB
private PlanningReceivingFacadeRemote planningReceivingFacadeRemote;
@EJB
private MasterContainerTypeFacadeRemote masterContainerTypeFacadeRemote;
@EJB
private PluggingReeferServiceFacadeRemote pluggingReeferServiceFacadeRemote;
@EJB
private MasterYardFacadeRemote masterYardFacadeRemote;
@EJB
private ServiceReceivingFacadeRemote serviceReceivingFacadeRemote;
@EJB
private ServiceContLoadFacadeRemote serviceContLoadFacadeRemote;
@EJB
private PlanningContLoadFacadeRemote planningContLoadFacadeRemote;
private List<Object[]> serviceGateIntList;
private List<Object[]> masterContDamages;
private List<MasterVehicle> vehicles;
private Object[] serviceGateReceivingObject;
private Object[] receivingObject;
private Object[] pluggingReefer;
private Object[] vesselCapacityStatus;
private ServiceGateReceiving serviceGateReceiving;
private MasterVehicle masterVehicle;
private PlanningReceivingAllocation planningReceivingAllocation;
private MasterContainerType masterContainerType;
private ReceivingService receivingService;
private PlanningVessel planningVessel;
private PreserviceVessel preserviceVessel;
private MasterContDamage masterContDamage;
private PluggingReeferService pluggingReeferService;
private PlanningContReceiving planningContReceiving;
private Integer idGate;
private String containerNo;
private String blok;
private String vesselName;
private String voyage;
private String mode;
private String jobSlip;
private String contNo;
private String contSize;
private String contNamaType;
private String containerType;
private String noPpkb;
private String contStatus;
private String operation = "RECEIVING";
private String sealNo;
private String isoCode;
private boolean visible;
private String slot;
private short fRow;
private short tRow;
private String contType;
private Integer estContWeight;
private Short tonage;
private String inputState;
/** Creates a new instance of GateInReceivingBean */
public GateInReceivingBean() {}
@PostConstruct
private void construct() {
serviceGateReceiving = new ServiceGateReceiving();
serviceGateReceiving.setMasterContDamage(new MasterContDamage());
serviceGateReceiving.setMasterVehicle(new MasterVehicle());
receivingService = new ReceivingService();
masterVehicle = new MasterVehicle();
masterContainerType = new MasterContainerType();
masterContDamage = new MasterContDamage();
preserviceVessel = new PreserviceVessel();
visible = Boolean.FALSE;
pluggingReeferService = new PluggingReeferService();
blok = "-";
noPpkb = null;
operation = "RECEIVING";
contType = "1";
inputState = "1";
tonage = 0;
serviceGateIntList = receivingServiceFacade.findReceivingServiceByClosingTime(Calendar.getInstance().getTime());
vehicles = masterVehicleFacadeRemote.findAll();
masterContDamages = masterContDamageFacade.findMasterContDamages();
}
public void clear2() {
Integer i = serviceGateReceiving.getWeight();
serviceGateReceiving = new ServiceGateReceiving();
serviceGateReceiving.setMasterContDamage(new MasterContDamage());
if (getContType().equals("2") && inputState.equals("1")) {
inputState = "2";
serviceGateReceiving.setContWeight(i - tonage - estContWeight);
estContWeight = 0;
serviceGateReceiving.setMasterVehicle(masterVehicle);
serviceGateReceiving.setWeight(i);
} else {
contType = "1";
inputState = "1";
serviceGateReceiving.setMasterVehicle(new MasterVehicle());
}
contStatus = null;
sealNo = null;
isoCode = null;
contNamaType=null;
//this.operation = "RECEIVING";
}
public void clear() {
serviceGateReceiving = new ServiceGateReceiving();
serviceGateReceiving.setMasterContDamage(new MasterContDamage());
serviceGateReceiving.setMasterVehicle(new MasterVehicle());
receivingService = new ReceivingService();
masterVehicle = new MasterVehicle();
masterContainerType = new MasterContainerType();
masterContDamage = new MasterContDamage();
preserviceVessel = new PreserviceVessel();
pluggingReeferService = new PluggingReeferService();
visible = Boolean.FALSE;
blok = "-";
fRow = 0;
slot = "00";
tRow = 0;
vesselName = null;
voyage = null;
containerNo = null;
containerType = null;
contStatus = null;
sealNo = null;
isoCode = null;
operation = "RECEIVING";
planningContReceiving = null;
}
public void handleClear(ActionEvent event) {
this.clear();
}
public List<String> setListAutoComplete(String query) {
List<String> results = receivingServiceFacade.findGateInPassableJobSlips(query);
return results;
}
public void ambilContNo(ActionEvent event) {
RequestContext context = RequestContext.getCurrentInstance();
boolean loggedIn = false;
boolean bPlanContRecIsOverSize = false;
setContNo((String) event.getComponent().getAttributes().get("contNo"));
receivingObject = receivingServiceFacade.findReceivingServiceByClosingTimeByJobSlip(contNo);
pluggingReefer = pluggingReeferServiceFacadeRemote.findPluggingReeferServiceByJobSlip(contNo);
serviceGateReceivingObject = serviceGateReceivingFacadeRemote.findServiceGateReceivingDateOutByJobSlip(contNo);
if (receivingObject != null) {
operation = "RECEIVING";
//contNo="AAA11223344";
receivingService = receivingServiceFacade.findDataReceiving(contNo);
serviceGateReceiving.setJobSlip(receivingService.getJobSlip());
serviceGateReceiving.setContNo(receivingService.getContNo());
serviceGateReceiving.setMlo(receivingService.getMlo());
serviceGateReceiving.setContType(receivingService.getMasterContainerType().getContType());
masterContainerType = masterContainerTypeFacadeRemote.find(serviceGateReceiving.getContType());
contStatus = receivingService.getContStatus();
contSize=receivingService.getContSize().toString();
contNamaType=masterContainerType.getName();
serviceGateReceiving.setNoPpkb(receivingService.getPlanningVessel().getNoPpkb());
serviceGateReceiving.setContGross(receivingService.getContGross());
serviceGateReceiving.setSealNo(receivingService.getSealNo());
serviceGateReceiving.setBlNo(receivingService.getBlNo());
this.visible = Boolean.FALSE;
FacesHelper.addFacesMessage(FacesContext.getCurrentInstance(), FacesMessage.SEVERITY_INFO, "Info", "application.search.found");
loggedIn = true;
} else if (pluggingReefer != null) {
operation = "PLUGG";
pluggingReeferService = pluggingReeferServiceFacadeRemote.find(jobSlip);
serviceGateReceiving.setContNo(pluggingReeferService.getContNo());
serviceGateReceiving.setMlo(pluggingReeferService.getMlo());
serviceGateReceiving.setContType(pluggingReeferService.getMasterContainerType().getContType());
masterContainerType = masterContainerTypeFacadeRemote.find(serviceGateReceiving.getContType());
contStatus = pluggingReeferService.getContStatus();
serviceGateReceiving.setNoPpkb(pluggingReeferService.getNoPpkb());
serviceGateReceiving.setContGross(pluggingReeferService.getContGross());
//serviceGateReceiving.setSealNo(pluggingReeferService.getSealNo());
serviceGateReceiving.setJobSlip(pluggingReeferService.getJobSlip());
serviceGateReceiving.setBlNo(pluggingReeferService.getBlNo());
this.visible = Boolean.FALSE;
FacesHelper.addFacesMessage(FacesContext.getCurrentInstance(), FacesMessage.SEVERITY_INFO, "Info", "application.search.found");
loggedIn = true;
} else if (serviceGateReceivingObject != null) {
serviceGateReceiving = serviceGateReceivingFacadeRemote.find(serviceGateReceivingObject[0]);
planningContReceiving = planningContReceivingFacadeRemote.findByNoPpkbAndContNo(serviceGateReceiving.getNoPpkb(), serviceGateReceiving.getContNo());
if (planningContReceiving != null) {
String grossClass = GrossConverter.convert(planningContReceiving.getContSize(), serviceGateReceiving.getContWeight());
planningContReceiving.setGrossClass(grossClass);
Object[] recommendedLocation = planningReceivingFacadeRemote.findRecommendedLocation(
planningContReceiving.getPlanningVessel().getNoPpkb(),
planningContReceiving.getDischPort(),
planningContReceiving.getMasterContainerType().getContType(),
planningContReceiving.getGrossClass(),
planningContReceiving.getContSize(),
planningContReceiving.getContStatus(),
planningContReceiving.getOverSize(),
planningContReceiving.getDg(),
planningContReceiving.getIsExport());
if (recommendedLocation != null) {
blok = (String) recommendedLocation[1];
slot = String.format("%02d", ((Integer) recommendedLocation[2]));
fRow = ((Integer) recommendedLocation[5]).shortValue();
tRow = ((Integer) recommendedLocation[6]).shortValue();
} else {
blok = null;
slot = "00";
fRow = 0;
tRow = 0;
loggedIn = false;
context.addCallbackParam("receivingAllocationIsNotEnough", true);
FacesHelper.addFacesMessage(FacesContext.getCurrentInstance(), FacesMessage.SEVERITY_ERROR, "Error", "application.validation.receiving_allocation_not_enough");
}
containerNo = planningContReceiving.getContNo();
masterContainerType = planningContReceiving.getMasterContainerType();
containerType = masterContainerType.getName();
planningVessel = planningContReceiving.getPlanningVessel();
vesselName = planningVessel.getPreserviceVessel().getMasterVessel().getName();
voyage = planningVessel.getPreserviceVessel().getVoyIn();
noPpkb = planningVessel.getNoPpkb();
FacesHelper.addFacesMessage(FacesContext.getCurrentInstance(), FacesMessage.SEVERITY_INFO, "Info", "application.search.found");
loggedIn = true;
} else {
setContainerNo(serviceGateReceiving.getContNo());
masterContainerType = masterContainerTypeFacadeRemote.find(serviceGateReceiving.getContType());
setContainerType(masterContainerType.getName());
setVesselName("-");
setVoyage("-");
this.noPpkb = serviceGateReceiving.getNoPpkb();
FacesHelper.addFacesMessage(FacesContext.getCurrentInstance(), FacesMessage.SEVERITY_INFO, "Info", "application.search.found");
loggedIn = true;
}
this.visible = Boolean.TRUE;
this.clear2();
} else {
FacesHelper.addFacesMessage(FacesContext.getCurrentInstance(), FacesMessage.SEVERITY_WARN, "Warning", "application.search.notfound_jobslip");
//this.clear();
}
context.addCallbackParam("loggedIn", loggedIn);
context.addCallbackParam("tipe", "receiv");
}
public void handleLookupMasterVehicle(ActionEvent event) {
RequestContext requestContext = RequestContext.getCurrentInstance();
FacesContext facesContext = FacesContext.getCurrentInstance();
if (serviceGateReceiving.getMasterVehicle().getVehicleCode() != null) {
masterVehicle = masterVehicleFacadeRemote.find(serviceGateReceiving.getMasterVehicle().getVehicleCode());
if (masterVehicle != null) {
setTonage(masterVehicle.getTonage());
serviceGateReceiving.setMasterVehicle(masterVehicle);
requestContext.addCallbackParam("loggedIn", true);
return;
}
requestContext.addCallbackParam("loggedIn", false);
FacesHelper.addFacesMessage(facesContext, FacesMessage.SEVERITY_WARN, "Warning", "application.validation.license_plate.not_registered");
return;
}
masterVehicle = new MasterVehicle();
serviceGateReceiving.setMasterVehicle(masterVehicle);
}
public void handleResetMasterVehicle(ActionEvent event) {
masterVehicle = new MasterVehicle();
serviceGateReceiving.setMasterVehicle(masterVehicle);
}
public void saveEdit(ActionEvent event) {
RequestContext requestContext = RequestContext.getCurrentInstance();
FacesContext facesContext = FacesContext.getCurrentInstance();
Date tgl = Calendar.getInstance().getTime();
MasterContainerType receivedContainerType = masterContainerTypeFacadeRemote.findByIsoCode(isoCode);
boolean isValid = true;
if (getContType().equals("2") && inputState.equals("1")){
serviceGateReceiving.setContWeight(estContWeight);
}
if (serviceGateReceiving.getWeight() == null || serviceGateReceiving.getWeight() < 2000) {
isValid = false;
FacesHelper.addFacesMessage(FacesContext.getCurrentInstance(), FacesMessage.SEVERITY_WARN, "Info", "application.validation.gate_gross");
} else if (receivedContainerType == null || !(receivedContainerType.getName().equals(contNamaType)) ) {
isValid = false;
FacesHelper.addFacesMessage(FacesContext.getCurrentInstance(), FacesMessage.SEVERITY_WARN, "Info", "application.validation.receiving_iso_code_not_same");
} else if (serviceGateReceiving.getContWeight() == null || serviceGateReceiving.getContWeight() < 1000) {
isValid = false;
FacesHelper.addFacesMessage(FacesContext.getCurrentInstance(), FacesMessage.SEVERITY_WARN, "Info", "application.validation.cont_weight");
}else if (receivedContainerType == null || !(masterContainerType.getFeetMark().compareTo(receivedContainerType.getFeetMark()) == 0 || masterContainerType.getFeetMark() == 40)) {
isValid = false;
FacesHelper.addFacesMessage(FacesContext.getCurrentInstance(), FacesMessage.SEVERITY_WARN, "Info", "application.validation.feet_mark.not_match");
} else if (serviceGateReceiving.getContWeight() > masterVehicle.getWeightMax()) {
isValid = false;
FacesHelper.addFacesMessage(FacesContext.getCurrentInstance(), FacesMessage.SEVERITY_WARN, "Info", "application.validation.cont_weight.exceeds_the_limit");
} else {
if (operation.equalsIgnoreCase("PLUGG")) {
blok = "-";
fRow = Short.parseShort("0");
slot = "00";
tRow = Short.parseShort("0");
masterContainerType = masterContainerTypeFacadeRemote.find(serviceGateReceiving.getContType());
containerType = masterContainerType.getName();
vesselName = "-";
voyage = "-";
containerNo = serviceGateReceiving.getContNo();
noPpkb = serviceGateReceiving.getNoPpkb();
serviceGateReceiving.setDateIn(tgl);
serviceGateReceivingFacadeRemote.create(serviceGateReceiving);
FacesHelper.addFacesMessage(FacesContext.getCurrentInstance(), FacesMessage.SEVERITY_INFO, "Info", "application.save.succeeded");
clear2();
} else {
planningContReceiving = planningContReceivingFacadeRemote.findByNoPpkbAndContNo(serviceGateReceiving.getNoPpkb(), serviceGateReceiving.getContNo());
vesselCapacityStatus = serviceGateReceivingFacadeRemote.findReceivingCapacityStatusByNoPpkb(serviceGateReceiving.getNoPpkb());
planningVessel = planningContReceiving.getPlanningVessel();
Long currentGrt = ((Number) vesselCapacityStatus[0]).longValue();
Long currentContCapacity = ((Number) vesselCapacityStatus[1]).longValue();
Integer contTeus = 0;
if (receivedContainerType.getFeetMark() == 20) {
contTeus = 1;
} else if (receivedContainerType.getFeetMark() == 40) {
contTeus = 2;
}
if (currentGrt + (serviceGateReceiving.getContWeight() / 1000) > planningVessel.getPreserviceVessel().getMasterVessel().getGrt()) {
isValid = false;
FacesHelper.addFacesTextMessage(facesContext, FacesMessage.SEVERITY_WARN, "Warning", String.format(FacesHelper.getLocaleMessage("application.validation.exceed_limit", facesContext), "Container Gross", "(max " + planningVessel.getPreserviceVessel().getMasterVessel().getGrt() + " ton)"), null);
}
if (currentContCapacity + contTeus > planningVessel.getPreserviceVessel().getMasterVessel().getContCapacity()) {
isValid = false;
FacesHelper.addFacesTextMessage(facesContext, FacesMessage.SEVERITY_WARN, "Warning", String.format(FacesHelper.getLocaleMessage("application.validation.exceed_limit", facesContext), "Container Capacity", "(max " + planningVessel.getPreserviceVessel().getMasterVessel().getContCapacity() + " teus)"), null);
}
if (isValid && planningContReceiving != null) {
String grossClass = GrossConverter.convert(planningContReceiving.getContSize(), serviceGateReceiving.getContWeight());
planningContReceiving.setContGross(serviceGateReceiving.getContWeight());
planningContReceiving.setSealNo(sealNo);
planningContReceiving.setGrossClass(grossClass);
planningContReceiving.setMasterContainerType(receivedContainerType);
Object[] recommendedLocation = planningReceivingFacadeRemote.findRecommendedLocation(
planningContReceiving.getPlanningVessel().getNoPpkb(),
planningContReceiving.getDischPort(),
planningContReceiving.getMasterContainerType().getContType(),
planningContReceiving.getGrossClass(),
planningContReceiving.getContSize(),
planningContReceiving.getContStatus(),
planningContReceiving.getOverSize(),
planningContReceiving.getDg(),
planningContReceiving.getIsExport());
boolean dangerous = receivingService.getMasterCommodity() != null && receivingService.getMasterCommodity().getMasterDangerousClass() != null && MasterDangerousClass.affectedToHandling.contains(receivingService.getMasterCommodity().getMasterDangerousClass().getDangerousClass());
if (recommendedLocation == null && !dangerous) {
blok = null;
slot = "00";
fRow = 0;
tRow = 0;
requestContext.addCallbackParam("loggedIn", false);
requestContext.addCallbackParam("receivingAllocationIsNotEnough", true);
FacesHelper.addFacesMessage(FacesContext.getCurrentInstance(), FacesMessage.SEVERITY_ERROR, "Error", "application.validation.receiving_allocation_not_enough");
return;
} else if (recommendedLocation == null && dangerous){
blok = "-";
fRow = Short.parseShort("0");
slot = "00";
tRow = Short.parseShort("0");
} else {
blok = (String) recommendedLocation[1];
slot = String.format("%02d", ((Integer) recommendedLocation[2]));
fRow = ((Integer) recommendedLocation[5]).shortValue();
tRow = ((Integer) recommendedLocation[6]).shortValue();
}
serviceGateReceiving.setDateIn(tgl);
serviceGateReceiving.setSealNo(planningContReceiving.getSealNo());
serviceGateReceiving.setContType(receivedContainerType.getContType());
containerType = receivedContainerType.getName();
containerNo = planningContReceiving.getContNo();
noPpkb = planningVessel.getNoPpkb();
vesselName = planningVessel.getPreserviceVessel().getMasterVessel().getName();
voyage = planningVessel.getPreserviceVessel().getVoyIn();
//validasi service vessel
if (receivingService.getMasterCommodity() != null && receivingService.getMasterCommodity().getMasterDangerousClass() != null && MasterDangerousClass.affectedToHandling.contains(receivingService.getMasterCommodity().getMasterDangerousClass().getDangerousClass())) {
if (planningVessel.getServiceVessel() != null) {
MasterYard masterYard = masterYardFacadeRemote.find("A");
ServiceReceiving serviceReceiving = new ServiceReceiving();
serviceReceiving.setContNo(planningContReceiving.getContNo());
serviceReceiving.setMlo(planningContReceiving.getMlo());
serviceReceiving.setContGross(planningContReceiving.getContGross());
serviceReceiving.setContSize(planningContReceiving.getContSize());
serviceReceiving.setContStatus(planningContReceiving.getContStatus());
serviceReceiving.setDangerous(planningContReceiving.getDg());
serviceReceiving.setDgLabel(planningContReceiving.getDgLabel());
serviceReceiving.setMasterCommodity(planningContReceiving.getMasterCommodity());
serviceReceiving.setMasterContainerType(planningContReceiving.getMasterContainerType());
serviceReceiving.setTwentyOneFeet(planningContReceiving.getTwentyOneFeet());
serviceReceiving.setPlanningVessel(planningContReceiving.getPlanningVessel());
serviceReceiving.setOverSize(planningContReceiving.getOverSize());
serviceReceiving.setSealNo(planningContReceiving.getSealNo());
serviceReceiving.setGrossClass(planningContReceiving.getGrossClass());
serviceReceiving.setTransactionDate(tgl);
serviceReceiving.setIsBehandle("FALSE");
serviceReceiving.setIsCfs("FALSE");
serviceReceiving.setIsInspection("FALSE");
serviceReceiving.setBlNo(planningContReceiving.getBlNo());
serviceReceiving.setPortOfDelivery(planningContReceiving.getPortOfDelivery());
serviceReceiving.setChangeStatus("FALSE");
serviceReceiving.setIsChangeDestination("FALSE");
serviceReceiving.setStatusCancelLoading("FALSE");
serviceReceiving.setIsLifton("FALSE");
serviceReceiving.setMasterYard(masterYard);
serviceReceiving.setYSlot((short) 1);
serviceReceiving.setYRow((short) 1);
serviceReceiving.setYTier((short) 1);
planningContReceiving.setPosition("02");
PlanningContLoad planningContLoad = new PlanningContLoad();
planningContLoad.setMasterCommodity(serviceReceiving.getMasterCommodity());
planningContLoad.setMasterYard(serviceReceiving.getMasterYard());
planningContLoad.setMasterContainerType(serviceReceiving.getMasterContainerType());
planningContLoad.setPlanningVessel(serviceReceiving.getPlanningVessel());
planningContLoad.setContNo(serviceReceiving.getContNo());
planningContLoad.setMlo(serviceReceiving.getMlo());
planningContLoad.setDischPort(planningContReceiving.getDischPort());
planningContLoad.setLoadPort(planningContReceiving.getLoadPort());
planningContLoad.setContSize(serviceReceiving.getContSize());
planningContLoad.setIsSling(serviceReceiving.getIsSling());
planningContLoad.setContStatus(serviceReceiving.getContStatus());
planningContLoad.setIsTranshipment("FALSE");
planningContLoad.setPosition("02");
planningContLoad.setContGross(serviceReceiving.getContGross());
planningContLoad.setSealNo(serviceReceiving.getSealNo());
planningContLoad.setOverSize(serviceReceiving.getOverSize());
planningContLoad.setDgLabel(serviceReceiving.getDgLabel());
planningContLoad.setDg(serviceReceiving.getDangerous());
planningContLoad.setIsExportImport(planningContReceiving.getIsExport());
planningContLoad.setTwentyOneFeet(planningContReceiving.getTwentyOneFeet());
planningContLoad.setYSlot(serviceReceiving.getYSlot());
planningContLoad.setYRow(serviceReceiving.getYRow());
planningContLoad.setYTier(serviceReceiving.getYTier());
planningContLoad.setCompleted("FALSE");
planningContLoad.setUnknown("FALSE");
planningContLoad.setBlNo(serviceReceiving.getBlNo());
planningContLoad.setPortOfDelivery(serviceReceiving.getPortOfDelivery());
ServiceContLoad serviceContLoad = new ServiceContLoad();
serviceContLoad.setContNo(planningContLoad.getContNo());
serviceContLoad.setMlo(planningContLoad.getMlo());
serviceContLoad.setContGross(planningContLoad.getContGross());
serviceContLoad.setContSize(planningContLoad.getContSize());
serviceContLoad.setContStatus(planningContLoad.getContStatus());
serviceContLoad.setDangerous(planningContLoad.getDg());
serviceContLoad.setIsExportImport(planningContLoad.getIsExportImport());
serviceContLoad.setIsSeling(planningContLoad.getIsSling());
serviceContLoad.setDgLabel(planningContLoad.getDgLabel());
serviceContLoad.setMasterCommodity(planningContLoad.getMasterCommodity());
serviceContLoad.setMasterContainerType(planningContLoad.getMasterContainerType());
serviceContLoad.setMasterYard(planningContLoad.getMasterYard());
serviceContLoad.setServiceVessel(planningVessel.getServiceVessel());
serviceContLoad.setOverSize(planningContLoad.getOverSize());
serviceContLoad.setSealNo(planningContLoad.getSealNo());
serviceContLoad.setVBay(planningContLoad.getVBay());
serviceContLoad.setVRow(planningContLoad.getVRow());
serviceContLoad.setVTier(planningContLoad.getVTier());
serviceContLoad.setYSlot(planningContLoad.getYSlot());
serviceContLoad.setYRow(planningContLoad.getYRow());
serviceContLoad.setYTier(planningContLoad.getYTier());
serviceContLoad.setTransactionDate(tgl);
serviceContLoad.setTwentyOneFeet(planningContLoad.getTwentyOneFeet());
serviceContLoad.setPosition("02");
serviceContLoad.setIsTranshipment("FALSE");
serviceContLoad.setIsChangeVessel(planningContLoad.getIsChangeVessel());
serviceContLoad.setBlNo(planningContLoad.getBlNo());
serviceContLoad.setStatusCancelLoading("FALSE");
serviceContLoad.setPortOfDelivery(planningContLoad.getPortOfDelivery());
serviceReceivingFacadeRemote.create(serviceReceiving);
serviceContLoadFacadeRemote.create(serviceContLoad);
planningContLoadFacadeRemote.create(planningContLoad);
serviceGateReceivingFacadeRemote.create(serviceGateReceiving);
planningContReceivingFacadeRemote.edit(planningContReceiving);
masterVehicleFacadeRemote.edit(masterVehicle);
FacesHelper.addFacesMessage(FacesContext.getCurrentInstance(), FacesMessage.SEVERITY_INFO, "Info", "application.save.succeeded");
} else {
clear();
isValid = false;
FacesHelper.addFacesMessage(FacesContext.getCurrentInstance(), FacesMessage.SEVERITY_WARN, "Warning", "application.validation.start_service");
}
} else {
serviceGateReceivingFacadeRemote.create(serviceGateReceiving);
planningContReceivingFacadeRemote.edit(planningContReceiving);
masterVehicleFacadeRemote.edit(masterVehicle);
FacesHelper.addFacesMessage(FacesContext.getCurrentInstance(), FacesMessage.SEVERITY_INFO, "Info", "application.save.succeeded");
}
clear2();
} else {
isValid = false;
FacesHelper.addFacesMessage(FacesContext.getCurrentInstance(), FacesMessage.SEVERITY_WARN, "Warning", "application.save.failed");
}
}
}
requestContext.addCallbackParam("loggedIn", isValid);
requestContext.addCallbackParam("receivingAllocationIsNotEnough", false);
}
public void handleDownload(ActionEvent event) {
RequestContext context = RequestContext.getCurrentInstance();
FacesContext fc = FacesContext.getCurrentInstance();
context.addCallbackParam("doPrint", true); //harus ada, buat ngeflag di izinkan ngeprint ato ngga
context.addCallbackParam("target", (String) event.getComponent().getAttributes().get("target"));
context.addCallbackParam("url", StringEscapeUtils.escapeHtml3(UrlHelper.resolveFullAddress(fc, "/gateInReceiving.pdf?no_ppkb=" + noPpkb + "&block=" + blok + "&slot=" + slot + "&fr_row=" + fRow + "&to_row=" + tRow + "&cont_no=" + containerNo + "&operation=" + operation)));
}
public void onChangeContType(ValueChangeEvent event) {
String ct = (String) event.getNewValue();
inputState = "1";
}
public void onChangeWeight(ValueChangeEvent event) {
Integer wg = (Integer) event.getNewValue();
}
public void onChangeTrailer(ValueChangeEvent event) {
String ttype = (String) event.getNewValue();
contType = "1";
inputState = "1";
if(!masterVehicle.getMasterVehicleType().getVehicleTypeCode().equals(ttype)){
setTonage(masterVehicle.getMasterVehicleType().getTonage());
}else{
setTonage(masterVehicle.getTonage());
}
}
/**
* @return the serviceGateReceiving
*/
public ServiceGateReceiving getServiceGateReceiving() {
return serviceGateReceiving;
}
/**
* @param serviceGateReceiving the serviceGateReceiving to set
*/
public void setServiceGateReceiving(ServiceGateReceiving serviceGateReceiving) {
this.serviceGateReceiving = serviceGateReceiving;
}
/**
* @return the vehicles
*/
public List<MasterVehicle> getVehicles() {
return vehicles;
}
/**
* @param vehicles the vehicles to set
*/
public void setVehicles(List<MasterVehicle> vehicles) {
this.setVehicles(vehicles);
}
/**
* @return the planningReceivingAllocation
*/
public PlanningReceivingAllocation getPlanningReceivingAllocation() {
return planningReceivingAllocation;
}
/**
* @param planningReceivingAllocation the planningReceivingAllocation to set
*/
public void setPlanningReceivingAllocation(PlanningReceivingAllocation planningReceivingAllocation) {
this.planningReceivingAllocation = planningReceivingAllocation;
}
public Object[] getPluggingReefer() {
return pluggingReefer;
}
public void setPluggingReefer(Object[] pluggingReefer) {
this.pluggingReefer = pluggingReefer;
}
/**
* @return the serviceGateIntList
*/
public List<Object[]> getServiceGateIntList() {
return serviceGateIntList;
}
/**
* @param serviceGateIntList the serviceGateIntList to set
*/
public void setServiceGateIntList(List<Object[]> serviceGateIntList) {
this.serviceGateIntList = serviceGateIntList;
}
/**
* @return the receivingService
*/
public ReceivingService getReceivingService() {
return receivingService;
}
/**
* @param receivingService the receivingService to set
*/
public void setReceivingService(ReceivingService receivingService) {
this.receivingService = receivingService;
}
/**
* @return the masterContDamages
*/
public List<Object[]> getMasterContDamages() {
return masterContDamages;
}
/**
* @param masterContDamages the masterContDamages to set
*/
public void setMasterContDamages(List<Object[]> masterContDamages) {
this.masterContDamages = masterContDamages;
}
/**
* @return the masterVehicle
*/
public MasterVehicle getMasterVehicle() {
return masterVehicle;
}
/**
* @param masterVehicle the masterVehicle to set
*/
public void setMasterVehicle(MasterVehicle masterVehicle) {
this.masterVehicle = masterVehicle;
}
/**
* @return the blok
*/
public String getBlok() {
return blok;
}
/**
* @param blok the blok to set
*/
public void setBlok(String blok) {
this.blok = blok;
}
/**
* @return the fRow
*/
public short getfRow() {
return fRow;
}
/**
* @param fRow the fRow to set
*/
public void setfRow(short fRow) {
this.fRow = fRow;
}
/**
* @return the tRow
*/
public short gettRow() {
return tRow;
}
/**
* @param tRow the tRow to set
*/
public void settRow(short tRow) {
this.tRow = tRow;
}
/**
* @return the masterContainerType
*/
public MasterContainerType getMasterContainerType() {
return masterContainerType;
}
/**
* @param masterContainerType the masterContainerType to set
*/
public void setMasterContainerType(MasterContainerType masterContainerType) {
this.masterContainerType = masterContainerType;
}
/**
* @return the vesselName
*/
public String getVesselName() {
return vesselName;
}
/**
* @param vesselName the vesselName to set
*/
public void setVesselName(String vesselName) {
this.vesselName = vesselName;
}
/**
* @return the preserviceVessel
*/
public PreserviceVessel getPreserviceVessel() {
return preserviceVessel;
}
/**
* @param preserviceVessel the preserviceVessel to set
*/
public void setPreserviceVessel(PreserviceVessel preserviceVessel) {
this.preserviceVessel = preserviceVessel;
}
/**
* @return the voyage
*/
public String getVoyage() {
return voyage;
}
/**
* @param voyage the voyage to set
*/
public void setVoyage(String voyage) {
this.voyage = voyage;
}
/**
* @return the masterContDamage
*/
public MasterContDamage getMasterContDamage() {
return masterContDamage;
}
/**
* @param masterContDamage the masterContDamage to set
*/
public void setMasterContDamage(MasterContDamage masterContDamage) {
this.masterContDamage = masterContDamage;
}
/**
* @return the idGate
*/
public Integer getIdGate() {
return idGate;
}
/**
* @param idGate the idGate to set
*/
public void setIdGate(Integer idGate) {
this.idGate = idGate;
}
/**
* @return the mode
*/
public String getMode() {
return mode;
}
/**
* @param mode the mode to set
*/
public void setMode(String mode) {
this.mode = mode;
}
/**
* @return the jobSlip
*/
public String getJobSlip() {
return jobSlip;
}
/**
* @param jobSlip the jobSlip to set
*/
public void setJobSlip(String jobSlip) {
this.jobSlip = jobSlip;
}
/**
* @return the receivingObject
*/
public Object[] getReceivingObject() {
return receivingObject;
}
/**
* @param receivingObject the receivingObject to set
*/
public void setReceivingObject(Object[] receivingObject) {
this.receivingObject = receivingObject;
}
/**
* @return the serviceGateReceivingObject
*/
public Object[] getServiceGateReceivingObject() {
return serviceGateReceivingObject;
}
/**
* @param serviceGateReceivingObject the serviceGateReceivingObject to set
*/
public void setServiceGateReceivingObject(Object[] serviceGateReceivingObject) {
this.serviceGateReceivingObject = serviceGateReceivingObject;
}
/**
* @return the visible
*/
public boolean isVisible() {
return visible;
}
/**
* @param visible the visible to set
*/
public void setVisible(boolean visible) {
this.visible = visible;
}
/**
* @return the container_no
*/
public String getContainerNo() {
return containerNo;
}
/**
* @param container_no the container_no to set
*/
public void setContainerNo(String containerNo) {
this.containerNo = containerNo;
}
/**
* @return the container_type
*/
public String getContainerType() {
return containerType;
}
/**
* @param container_type the container_type to set
*/
public void setContainerType(String containerType) {
this.containerType = containerType;
}
public String getContStatus() {
return contStatus;
}
public void setContStatus(String contStatus) {
this.contStatus = contStatus;
}
public PluggingReeferService getPluggingReeferService() {
return pluggingReeferService;
}
public void setPluggingReeferService(PluggingReeferService pluggingReeferService) {
this.pluggingReeferService = pluggingReeferService;
}
public String getOperation() {
return operation;
}
public void setOperation(String operation) {
this.operation = operation;
}
public String getIsoCode() {
return isoCode;
}
public void setIsoCode(String isoCode) {
this.isoCode = isoCode;
}
public String getSealNo() {
return sealNo;
}
public void setSealNo(String sealNo) {
this.sealNo = sealNo;
}
public String getSlot() {
return slot;
}
public PlanningContReceiving getPlanningContReceiving() {
return planningContReceiving;
}
/**
* @return the contType
*/
public String getContType() {
return contType;
}
/**
* @param contType the contType to set
*/
public void setContType(String contType) {
this.contType = contType;
}
/**
* @return the estContWeight
*/
public Integer getEstContWeight() {
return estContWeight;
}
/**
* @param estContWeight the estContWeight to set
*/
public void setEstContWeight(Integer estContWeight) {
this.estContWeight = estContWeight;
}
/**
* @return the tonage
*/
public Short getTonage() {
return tonage;
}
/**
* @param tonage the tonage to set
*/
public void setTonage(Short tonage) {
this.tonage = tonage;
}
public String getInputState() {
return inputState;
}
public String getContNo() {
return contNo;
}
public void setContNo(String contNo) {
this.contNo = contNo;
}
public String getContSize() {
return contSize;
}
public void setContSize(String contSize) {
this.contSize = contSize;
}
public String getContNamaType() {
return contNamaType;
}
public void setContNamaType(String contNamaType) {
this.contNamaType = contNamaType;
}
}
| [
"surachman026@gmail.com"
] | surachman026@gmail.com |
4a690148946f0d7aec85b438f9bd29a9a2c30a32 | 7590c90ec6ff23a713c165ab07f7ca6876187f60 | /src/main/java/org/jbit/controller/OrderController.java | 527022773886fe44fe9905920766b5ae172b0c7c | [] | no_license | gushengliang/HetelManagement | e608ee52621a12f339be844f245b7f79e37716c6 | 5e80d1eb2e1d0f0dad6742cd336fee3c68fedb62 | refs/heads/master | 2023-07-13T01:09:08.384996 | 2021-08-23T13:30:25 | 2021-08-23T13:30:25 | 398,807,778 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,806 | java | package org.jbit.controller;
import com.alibaba.fastjson.JSON;
import org.apache.log4j.Logger;
import org.ietf.jgss.Oid;
import org.jbit.dao.CustomerDao;
import org.jbit.dao.OrderDao;
import org.jbit.dao.RoomDao;
import org.jbit.dao.impl.CustomerDaoMysqlImpl;
import org.jbit.dao.impl.OrderDaoMysqlImpl;
import org.jbit.dao.impl.RoomDaoMysqlImpl;
import org.jbit.dto.OrderQueryDto;
import org.jbit.entity.Customer;
import org.jbit.entity.Deposit;
import org.jbit.entity.Order;
import org.jbit.entity.Room;
import org.jbit.service.DepositService;
import org.jbit.service.OrderService;
import org.jbit.service.RoomService;
import org.jbit.service.impl.DepositServiceImpl;
import org.jbit.service.impl.OrderServiceImpl;
import org.jbit.service.impl.RoomServiceImpl;
import org.jbit.utils.JdbcUtil;
import org.jbit.utils.PageUtil;
import org.jbit.vo.ResultVo;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import static java.lang.Thread.sleep;
/**
* @author jzt
* @description
* @date 2020/12/1
*/
@WebServlet("/order")
public class OrderController extends BaseController{
/**
* 日志管理
*/
private static final Logger LOG = Logger.getLogger(JdbcUtil.class);
/**
* 注入Service
*/
RoomService roomService=new RoomServiceImpl();
OrderService orderService = new OrderServiceImpl();
DepositService depositService=new DepositServiceImpl();
/**
* 数据列表
*
* @param req
* @param res
*/
public void ExeOrder_list(HttpServletRequest req, HttpServletResponse res) throws Exception {
sleep(1000);
String customerId = req.getParameter("customerId");
//处理数据
ResultVo resultVo = null;
try {
//调用Service
List<Order> orders= orderService.ExeOrder(customerId);
resultVo = new ResultVo<>(orders);
} catch (Exception e) {
e.printStackTrace();
resultVo = new ResultVo(500, "未知服务错误");
}
String json = JSON.toJSONString(resultVo);
// 响应结果
PrintWriter out = res.getWriter();
out.print(json);
}
public void OverOrder_list(HttpServletRequest req, HttpServletResponse res) throws Exception {
String customerId = req.getParameter("customerId");
//处理数据
ResultVo resultVo = null;
try {
//调用Service
List<Order> orders= orderService.OverOrder(customerId);
resultVo = new ResultVo<>(orders);
} catch (Exception e) {
e.printStackTrace();
resultVo = new ResultVo(500, "未知服务错误");
}
String json = JSON.toJSONString(resultVo);
// 响应结果
PrintWriter out = res.getWriter();
out.print(json);
}
public void ChangeRoom(HttpServletRequest req, HttpServletResponse res) throws Exception{
String RoomId=req.getParameter("Rid");
String OrderId=req.getParameter("Oid");
//生成新的房间
Room room=roomService.selectById(RoomId);
//查询订单
Order order=orderService.selectById(OrderId);
Deposit deposit=depositService.selectById(OrderId);
order.setRoom(room);
deposit.setOrder(order);
deposit.count();
ResultVo resultVo=null;
try{
orderService.save(order);
depositService.save(deposit);
resultVo = new ResultVo(0, "成功");
}catch (Exception e){
resultVo = new ResultVo(500, "失败");
}
String json = JSON.toJSONString(resultVo);
/**
* 响应结果
*/
PrintWriter out = res.getWriter();
out.print(json);
}
public void Faults(HttpServletRequest req, HttpServletResponse res) throws Exception{
String OrderId=req.getParameter("Oid");
Date date=new Date();
//查询订单
Order order=orderService.selectById(OrderId);
Deposit deposit=depositService.selectById(OrderId);
order.setOverTime(date);
deposit.setOrder(order);
deposit.count();
ResultVo resultVo=null;
try{
orderService.save(order);
depositService.save(deposit);
resultVo = new ResultVo(0, "成功");
}catch (Exception e){
resultVo = new ResultVo(500, "失败");
}
String json = JSON.toJSONString(resultVo);
/**
* 响应结果
*/
PrintWriter out = res.getWriter();
out.print(json);
}
}
| [
"gututu521@gmail.com"
] | gututu521@gmail.com |
6459f04034d1828f14ac0277a373d1c6e172ed1c | 0de62641adb415954a22112a974b78556549e20b | /src/StringsLecture.java | e2c8f3c34f467bf084b0eab4dbae17b1177ed38c | [] | no_license | irfasheikh/codeup-java-exercises | 3581f434ee5dbd68287fcb0b2698d5a24b97e8f4 | afd7b5bc91aa102c4292c74e65f8dd626b1c6b29 | refs/heads/main | 2023-05-13T15:40:42.202723 | 2021-06-07T04:58:13 | 2021-06-07T04:58:13 | 360,677,727 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,951 | java | //public class StringsLecture {
// public static void main (String[] args) {
// String myname= "Iffy";
// String myname2= "Iffy";
// String myname3= "Iffy";
// String lowercaseIff = "iffy";
//
// System.out.println("(myname == myname2) = " + (myname.equals(myname2)));
// System.out.println("(myname2 == myname3) = " + (myname2.equals(myname3)));
// System.out.println("(myname == myname3) = " + (myname.equals(myname3)));
//
// System.out.println("lowercaseKen.equals(myname) = " + lowercaseIff.equals(myname));
// System.out.println("lowercaseKen.equalsIgnoreCase(myname) = " + lowercaseIff.equalsIgnoreCase(myname));
//
//// equals and equalsIgnoreCase
//
// String txCapitalCity = "Austin";
// String lowercaseTxCapitalCity = "austin";
//
// System.out.println("txCapitalCity.equals(lowercaseTxCapitalCity) = " + txCapitalCity.equals(lowercaseTxCapitalCity));
//
// System.out.println("txCapitalCity,eqaualsIgnoreCase(lowercaseTxCapitalCity) = " + lowercaseTxCapitalCity.equalsIgnoreCase(lowercaseTxCapitalCity);
//
// // .startsWith and .endsWith
//
// String austinSentence = "The capital city of Texas is " + txCapitalCity +" , and it is growing quickly.";
//
// System.out.println("austinSentence.startsWith(\"The capital city\") = " + austinSentence.startsWith("The capital city"));
//
// System.out.println
//
//
//
//
//
//
// }
//}
public class StringsLecture {
public static void main(String[] args){
// ' ~ " * "strings" * " ~ '
//Strings can be given a more formal definition - some letters, numbers, and special characters combined (STRUNG together) in some fashion
//In Java . . they are not primitives! They are objects - your variables are a reference type instead. That means == asks if both sides have the same reference vs value
//This leads us to use object comparison methods (.equals and family) to reliably check the VALUES of the objects vs. the REFERENCES of the objects
//Don't do this! ! ! This is behavior from a woods-y topic related to how the Java Virtual Machine works
// if("This is a string" == "This is a string"){
// System.out.println("Performing some kind of super important operation with the above!! (Skynet launched!)");
// }
//Utilize the methods introduced here instead for consistency and reliability:
if("This is a string".equals("This is a string")){
System.out.println("Everything is a-okay over here! We used .equals, so we're feeling confident in what's going on with our code.");}
// ' ~ " * "string comparison methods" * " ~ '
//Expanding on the thought above: we have a range of string comparison methods! These include a couple we've seen (.equals and its sibling .equalsIgnoreCase), but there are also a couple prefix/suffix focused methods (.startsWith vs .endsWith)
//equals and equalsIgnoreCase
String txCapitalCity = "Austin";
String lowercaseTxCapitalCity = "austin";
System.out.println("txCapitalCity.equals(lowercaseTxCapitalCity) = " + txCapitalCity.equals(lowercaseTxCapitalCity));
System.out.println("txCapitalCity.equalsIgnoreCase(lowercaseTxCapitalCity) = " + txCapitalCity.equalsIgnoreCase(lowercaseTxCapitalCity));
System.out.println();
//.startsWith and .endsWith [with a bonus: .contains!]
String austinSentence = "The capital city of Texas is " + txCapitalCity +", and it is growing quickly.";
System.out.println(austinSentence);
System.out.println("austinSentence.startsWith(\"The capital city\") = " + austinSentence.startsWith("The capital city"));
System.out.println("austinSentence.startsWith(\"the capital city\") = " + austinSentence.startsWith("the capital city"));
System.out.println("austinSentence.startsWith(\"The capitol city\") = " + austinSentence.startsWith("The capitol city"));
System.out.println("austinSentence.startsWith(\"the city\") = " + austinSentence.startsWith("the city"));
System.out.println();
System.out.println("austinSentence.contains(\"it is growing quickly\") = " + austinSentence.contains("it is growing quickly"));
System.out.println("austinSentence.endsWith(\"it is growing quickly.\") = " + austinSentence.endsWith("it is growing quickly."));
System.out.println("austinSentence.endsWith(\"it is growing QUICKLY\") = " + austinSentence.endsWith("it is growing QUICKLY"));
System.out.println("austinSentence.endsWith(\"it is growing quick.\") = " + austinSentence.endsWith("it is growing quick."));
System.out.println();
//' ~ " * "string manipulation methods" * " ~ '
// .indexOf [search start to finish], .lastIndexOf [start end to finish], .charAt(int index)
System.out.println(austinSentence);
System.out.println("austinSentence.indexOf('x') = " + austinSentence.indexOf('x'));
System.out.println("austinSentence.charAt(20) = " + austinSentence.charAt(20));
System.out.println("austinSentence.charAt(21) = " + austinSentence.charAt(21));
System.out.println("austinSentence.charAt(22) = " + austinSentence.charAt(22));
System.out.println("austinSentence.charAt(23) = " + austinSentence.charAt(23));
System.out.println("austinSentence.charAt(24) = " + austinSentence.charAt(24));
System.out.println();
System.out.println("***************************************************************");
System.out.println("** indexOf goes start to end, lastIndexOf goes end to start: **");
System.out.println("***************************************************************");
System.out.println("austinSentence.indexOf(\"is\") = " + austinSentence.indexOf("is"));
System.out.println("austinSentence.lastIndexOf(\"is\") = " + austinSentence.lastIndexOf("is"));
System.out.println();
System.out.println("austinSentence.indexOf(\"capital city\") = " + austinSentence.indexOf("capital city"));
System.out.println("austinSentence.indexOf(\"capitol city\") = " + austinSentence.indexOf("capitol city"));
System.out.println();
//int length() - returns length of string
System.out.println(austinSentence);
System.out.println("austinSentence.length() = " + austinSentence.length());
System.out.println("txCapitalCity = " + txCapitalCity);
System.out.println("txCapitalCity.length() = " + txCapitalCity.length());
System.out.println();
//String .replace(searchPattern, replacementString) - Returns a copy of the string with the matching pattern replaced by the second argument
System.out.println("austinSentence = " + austinSentence);
String newCapitalSentence = austinSentence.replace("is Austin, and it is", "was five other cities before Austin, and the state is");
String theIsTestSentence = austinSentence.replace("is", "is not");
System.out.println("newCapitalSentence = " + newCapitalSentence);
System.out.println("theIsTestSentence = " + theIsTestSentence);
System.out.println();
//toLowerCase() && toUpperCase()
System.out.println("txCapitalCity = " + txCapitalCity);
System.out.println("txCapitalCity.toUpperCase() = " + txCapitalCity.toUpperCase());
System.out.println("txCapitalCity.toLowerCase() = " + txCapitalCity.toLowerCase());
System.out.println("txCapitalCity = " + txCapitalCity);
//.trim() - trim the whitespace out of a string
String userInputString = " austin ";
System.out.println("userInputString = " + "The capital city of Texas is "+ userInputString + ".");
System.out.println("userInputString.trim() = "+ "The capital city of Texas is " + userInputString.trim() + ".");
}
}
| [
"irfasheikh@gmail.com"
] | irfasheikh@gmail.com |
60931f7097ac7d7975520d31d4dec2ca0d67f8c9 | a959811bd8afd8826eb5d25db89a22033b8542b3 | /src/game/cards/rooms/Kitchen.java | 9f8fd07e1582fa375aaab5e002d26dbdc6e4a6e9 | [] | no_license | MattByers/SWEN222-Assig1 | 434a025ef644bbc0474c55d3d57f40c8e5c9ab62 | 312152742e12d01d892421780b37492d59bb6c36 | refs/heads/master | 2021-01-22T06:49:07.086012 | 2015-08-05T04:57:07 | 2015-08-05T04:57:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 195 | java | package game.cards.rooms;
import game.cards.RoomCard;
public class Kitchen extends RoomCard {
private static final String NAME = "Kitchen";
public Kitchen(){
super(NAME);
}
}
| [
"matt_byers@live.com"
] | matt_byers@live.com |
01a9976417ea54ba9c2dafc8e003c39d2ea0a891 | 1ca86d5d065372093c5f2eae3b1a146dc0ba4725 | /logging-modules/log4j2/src/test/java/com/surya/logging/log4j2/xmlconfiguration/CustomXMLConfigurationFactory.java | c4cdb5da2191493eb7d3681e48099fcd5fbaa09f | [] | no_license | Suryakanta97/DemoExample | 1e05d7f13a9bc30f581a69ce811fc4c6c97f2a6e | 5c6b831948e612bdc2d9d578a581df964ef89bfb | refs/heads/main | 2023-08-10T17:30:32.397265 | 2021-09-22T16:18:42 | 2021-09-22T16:18:42 | 391,087,435 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 895 | java | package com.surya.logging.log4j2.xmlconfiguration;
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.config.Configuration;
import org.apache.logging.log4j.core.config.ConfigurationFactory;
import org.apache.logging.log4j.core.config.ConfigurationSource;
import org.apache.logging.log4j.core.config.Order;
import org.apache.logging.log4j.core.config.plugins.Plugin;
import org.apache.logging.log4j.core.config.xml.XmlConfigurationFactory;
@Plugin(name = "xml", category = ConfigurationFactory.CATEGORY)
@Order(50)
public class CustomXMLConfigurationFactory extends XmlConfigurationFactory {
@Override
public Configuration getConfiguration(LoggerContext loggerContext, ConfigurationSource source) {
return new MyXMLConfiguration(loggerContext, source);
}
@Override
public String[] getSupportedTypes() {
return new String[] { ".xml", "*" };
}
}
| [
"suryakanta97@github.com"
] | suryakanta97@github.com |
9a57010860a993aa8ad6f66b6fcd42b402873d54 | 8c929b61e9930e27c86e89801285718841568142 | /src/br/com/pbd/view/Despesas.java | e052a8b08719ad68fe364f9413c93f2543cead52 | [] | no_license | glendaalves/PBDacademia | fc5319acf4419adef90e3d09074a0ee635259806 | 80bd43b634618ba7206954402c17ee8359b1ba50 | refs/heads/master | 2020-06-18T21:40:38.294846 | 2019-07-18T14:10:08 | 2019-07-18T14:10:08 | 196,459,473 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 32,387 | 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 br.com.pbd.view;
import br.com.pbd.modelos.ContaaPagar;
import java.awt.Color;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JTextField;
/**
*
* @author Glenda Alves de Lima
*/
public class Despesas extends javax.swing.JInternalFrame {
/**
* Creates new form ContaaPagar
*/
private Icon Iconeditar, Iconexcluir;
private JButton btnEx, btnEd;
private JButton btnPag;
private Icon Iconpagar;
public Despesas() {
initComponents();
Iconeditar = new ImageIcon(getClass().getResource("/br/com/pbd/resource/editarr.png"));
Iconexcluir = new ImageIcon(getClass().getResource("/br/com/pbd/resource/Exclui.png"));
Iconpagar = new ImageIcon(getClass().getResource("/br/com/pbd/resource/o.png"));
btnPag = new JButton(getIconpagar());
btnPag.setName("pagar");
btnPag.setBorder(null);
btnPag.setContentAreaFilled(false);
btnEd = new JButton(getIconeditar());
btnEd.setName("editar");
btnEd.setBorder(null);
btnEd.setContentAreaFilled(false);
btnEx = new JButton(getIconexcluir());
btnEx.setName("excluir");
btnEx.setBorder(null);
btnEx.setContentAreaFilled(false);
}
/**
* 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() {
jPanel1 = new javax.swing.JPanel();
labelcadastro2 = new javax.swing.JLabel();
jPanel9 = new javax.swing.JPanel();
panelContas = new javax.swing.JPanel();
label2 = new java.awt.Label();
descricaoConta = new javax.swing.JTextField();
label4 = new java.awt.Label();
datavencimentoconta = new com.toedter.calendar.JDateChooser();
label5 = new java.awt.Label();
valorconta = new javax.swing.JTextField();
botaoSalvarconta = new javax.swing.JButton();
botaoCancelar = new javax.swing.JButton();
label6 = new java.awt.Label();
txtPesquisa = new br.com.pbd.modelos.JTextFieldHint(new JTextField(), "pesquisar", " Pesquise por Descrição ");
botaoadicionar = new javax.swing.JButton();
botaoFechar = new javax.swing.JButton();
jPanel3 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
jScrollPane2 = new javax.swing.JScrollPane();
tabelaconta = new javax.swing.JTable();
jPanel1.setBackground(new java.awt.Color(255, 255, 255));
labelcadastro2.setFont(new java.awt.Font("Felix Titling", 0, 24)); // NOI18N
labelcadastro2.setForeground(new java.awt.Color(0, 102, 102));
labelcadastro2.setText("despesas");
jPanel9.setBackground(new java.awt.Color(153, 153, 153));
javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
jPanel9.setLayout(jPanel9Layout);
jPanel9Layout.setHorizontalGroup(
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
jPanel9Layout.setVerticalGroup(
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 9, Short.MAX_VALUE)
);
panelContas.setBackground(new java.awt.Color(255, 255, 255));
panelContas.setBorder(javax.swing.BorderFactory.createTitledBorder("Contas"));
label2.setText("Descricao :");
label4.setText("Data Vencimento");
label5.setText("Valor :");
botaoSalvarconta.setBackground(new java.awt.Color(255, 255, 255));
botaoSalvarconta.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
botaoSalvarconta.setForeground(new java.awt.Color(0, 102, 102));
botaoSalvarconta.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/pbd/resource/Salva.png"))); // NOI18N
botaoSalvarconta.setText("Salvar");
botaoSalvarconta.setBorderPainted(false);
botaoSalvarconta.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
botaoSalvarcontaMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
botaoSalvarcontaMouseExited(evt);
}
});
botaoCancelar.setBackground(new java.awt.Color(255, 255, 255));
botaoCancelar.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
botaoCancelar.setForeground(new java.awt.Color(0, 102, 102));
botaoCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/pbd/resource/Cancela.png"))); // NOI18N
botaoCancelar.setText("Cancelar");
botaoCancelar.setBorderPainted(false);
botaoCancelar.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
botaoCancelarMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
botaoCancelarMouseExited(evt);
}
});
botaoCancelar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
botaoCancelarActionPerformed(evt);
}
});
javax.swing.GroupLayout panelContasLayout = new javax.swing.GroupLayout(panelContas);
panelContas.setLayout(panelContasLayout);
panelContasLayout.setHorizontalGroup(
panelContasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelContasLayout.createSequentialGroup()
.addGap(19, 19, 19)
.addGroup(panelContasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelContasLayout.createSequentialGroup()
.addGap(571, 571, 571)
.addComponent(botaoSalvarconta)
.addGap(42, 42, 42)
.addComponent(botaoCancelar)
.addContainerGap(49, Short.MAX_VALUE))
.addGroup(panelContasLayout.createSequentialGroup()
.addGroup(panelContasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(label2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(descricaoConta, javax.swing.GroupLayout.PREFERRED_SIZE, 406, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(panelContasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(label4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(datavencimentoconta, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(37, 37, 37)
.addGroup(panelContasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(label5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(valorconta, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(97, 97, 97))))
);
panelContasLayout.setVerticalGroup(
panelContasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelContasLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelContasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelContasLayout.createSequentialGroup()
.addGroup(panelContasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(label2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(label4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(panelContasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(descricaoConta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(datavencimentoconta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(panelContasLayout.createSequentialGroup()
.addComponent(label5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(valorconta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(25, 25, 25)
.addGroup(panelContasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(botaoSalvarconta)
.addComponent(botaoCancelar))
.addContainerGap())
);
label6.setText("Pesquisar :");
txtPesquisa.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtPesquisaActionPerformed(evt);
}
});
botaoadicionar.setBackground(new java.awt.Color(255, 255, 255));
botaoadicionar.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
botaoadicionar.setForeground(new java.awt.Color(0, 102, 102));
botaoadicionar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/pbd/resource/plus (1).png"))); // NOI18N
botaoadicionar.setText("Adicionar");
botaoadicionar.setBorderPainted(false);
botaoadicionar.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
botaoadicionarMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
botaoadicionarMouseExited(evt);
}
});
botaoadicionar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
botaoadicionarActionPerformed(evt);
}
});
botaoFechar.setBackground(new java.awt.Color(255, 255, 255));
botaoFechar.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
botaoFechar.setForeground(new java.awt.Color(0, 102, 102));
botaoFechar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/pbd/resource/Cancela.png"))); // NOI18N
botaoFechar.setText("Fechar");
botaoFechar.setBorderPainted(false);
botaoFechar.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
botaoFecharMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
botaoFecharMouseExited(evt);
}
});
botaoFechar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
botaoFecharActionPerformed(evt);
}
});
jPanel3.setBackground(new java.awt.Color(153, 153, 153));
jLabel2.setFont(new java.awt.Font("DeVinne Txt BT", 1, 36)); // NOI18N
jLabel2.setForeground(new java.awt.Color(255, 255, 255));
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel2.setText("Contas a Pagar");
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 934, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 6, Short.MAX_VALUE))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jLabel2)
.addGap(0, 0, 0))
);
tabelaconta.setBorder(javax.swing.BorderFactory.createEtchedBorder());
tabelaconta.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
tabelaconta.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{},
{},
{},
{}
},
new String [] {
}
));
tabelaconta.setFocusable(false);
tabelaconta.setRowHeight(30);
tabelaconta.getTableHeader().setReorderingAllowed(false);
jScrollPane2.setViewportView(tabelaconta);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(label6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtPesquisa, javax.swing.GroupLayout.PREFERRED_SIZE, 489, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(48, 48, 48)
.addComponent(botaoadicionar)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(botaoFechar)
.addGap(71, 71, 71))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jPanel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(panelContas, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(labelcadastro2, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(labelcadastro2, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(panelContas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtPesquisa, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(botaoadicionar)
.addComponent(botaoFechar, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(31, 31, 31)
.addComponent(label6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(23, 23, 23)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 312, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 118, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void botaoCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoCancelarActionPerformed
}//GEN-LAST:event_botaoCancelarActionPerformed
private void botaoCancelarMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_botaoCancelarMouseExited
getBotaoCancelar().setBackground(new Color(255, 255, 255));// Fundo Quando Solta
getBotaoCancelar().setForeground(new Color(0, 102, 102));// letra quando solta cor
}//GEN-LAST:event_botaoCancelarMouseExited
private void botaoCancelarMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_botaoCancelarMouseEntered
getBotaoCancelar().setBackground(new Color(204, 204, 204)); // cor de fundo quando aparece
getBotaoCancelar().setForeground(new Color(255, 255, 255)); // cor da letra quando aparece
}//GEN-LAST:event_botaoCancelarMouseEntered
private void botaoSalvarcontaMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_botaoSalvarcontaMouseExited
getBotaoSalvarconta().setBackground(new Color(255, 255, 255));// Fundo Quando Solta
getBotaoSalvarconta().setForeground(new Color(0, 102, 102));// letra quando solta cor
}//GEN-LAST:event_botaoSalvarcontaMouseExited
private void botaoSalvarcontaMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_botaoSalvarcontaMouseEntered
getBotaoSalvarconta().setBackground(new Color(204, 204, 204)); // cor de fundo quando aparece
getBotaoSalvarconta().setForeground(new Color(255, 255, 255)); // cor da letra quando aparece
}//GEN-LAST:event_botaoSalvarcontaMouseEntered
private void txtPesquisaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtPesquisaActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txtPesquisaActionPerformed
private void botaoadicionarMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_botaoadicionarMouseEntered
getBotaoadicionar().setBackground(new Color(204, 204, 204)); // cor de fundo quando aparece
getBotaoadicionar().setForeground(new Color(255, 255, 255)); // cor da letra quando aparece
}//GEN-LAST:event_botaoadicionarMouseEntered
private void botaoadicionarMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_botaoadicionarMouseExited
getBotaoadicionar().setBackground(new Color(255, 255, 255));// Fundo Quando Solta
getBotaoadicionar().setForeground(new Color(0, 102, 102));// letra quando solta cor
}//GEN-LAST:event_botaoadicionarMouseExited
private void botaoadicionarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoadicionarActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_botaoadicionarActionPerformed
private void botaoFecharMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_botaoFecharMouseEntered
getBotaoFechar().setBackground(new Color(204, 204, 204)); // cor de fundo quando aparece
getBotaoFechar().setForeground(new Color(255, 255, 255)); // cor da letra quando aparece
}//GEN-LAST:event_botaoFecharMouseEntered
private void botaoFecharMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_botaoFecharMouseExited
getBotaoFechar().setBackground(new Color(255, 255, 255));// Fundo Quando Solta
getBotaoFechar().setForeground(new Color(0, 102, 102));// letra quando solta cor
}//GEN-LAST:event_botaoFecharMouseExited
private void botaoFecharActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoFecharActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_botaoFecharActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton botaoCancelar;
private javax.swing.JButton botaoFechar;
private javax.swing.JButton botaoSalvarconta;
private javax.swing.JButton botaoadicionar;
private com.toedter.calendar.JDateChooser datavencimentoconta;
private javax.swing.JTextField descricaoConta;
private javax.swing.JLabel jLabel2;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel9;
private javax.swing.JScrollPane jScrollPane2;
private java.awt.Label label2;
private java.awt.Label label4;
private java.awt.Label label5;
private java.awt.Label label6;
private javax.swing.JLabel labelcadastro2;
private javax.swing.JPanel panelContas;
private javax.swing.JTable tabelaconta;
private javax.swing.JTextField txtPesquisa;
private javax.swing.JTextField valorconta;
// End of variables declaration//GEN-END:variables
public void Limpar() {
getDescricaoConta().setText("");
getDatavencimentoconta().setDate(null);
getValorconta().setText("");
}
public void preencherCadastro(ContaaPagar p) {
getDescricaoConta().setText(p.getDescricao());
getDatavencimentoconta().setDate(p.getData_vencimento());
getValorconta().setText(p.getValor() + "");
}
/**
* @return the Iconeditar
*/
public Icon getIconeditar() {
return Iconeditar;
}
/**
* @param Iconeditar the Iconeditar to set
*/
public void setIconeditar(Icon Iconeditar) {
this.Iconeditar = Iconeditar;
}
/**
* @return the Iconexcluir
*/
public Icon getIconexcluir() {
return Iconexcluir;
}
/**
* @param Iconexcluir the Iconexcluir to set
*/
public void setIconexcluir(Icon Iconexcluir) {
this.Iconexcluir = Iconexcluir;
}
/**
* @return the btnEx
*/
public JButton getBtnEx() {
return btnEx;
}
/**
* @param btnEx the btnEx to set
*/
public void setBtnEx(JButton btnEx) {
this.btnEx = btnEx;
}
/**
* @return the btnEd
*/
public JButton getBtnEd() {
return btnEd;
}
/**
* @param btnEd the btnEd to set
*/
public void setBtnEd(JButton btnEd) {
this.btnEd = btnEd;
}
/**
* @return the btnPag
*/
public JButton getBtnPag() {
return btnPag;
}
/**
* @param btnPag the btnPag to set
*/
public void setBtnPag(JButton btnPag) {
this.btnPag = btnPag;
}
/**
* @return the Iconpagar
*/
public Icon getIconpagar() {
return Iconpagar;
}
/**
* @param Iconpagar the Iconpagar to set
*/
public void setIconpagar(Icon Iconpagar) {
this.Iconpagar = Iconpagar;
}
/**
* @return the botaoCancelar
*/
public javax.swing.JButton getBotaoCancelar() {
return botaoCancelar;
}
/**
* @param botaoCancelar the botaoCancelar to set
*/
public void setBotaoCancelar(javax.swing.JButton botaoCancelar) {
this.botaoCancelar = botaoCancelar;
}
/**
* @return the botaoFechar
*/
public javax.swing.JButton getBotaoFechar() {
return botaoFechar;
}
/**
* @param botaoFechar the botaoFechar to set
*/
public void setBotaoFechar(javax.swing.JButton botaoFechar) {
this.botaoFechar = botaoFechar;
}
/**
* @return the botaoSalvarconta
*/
public javax.swing.JButton getBotaoSalvarconta() {
return botaoSalvarconta;
}
/**
* @param botaoSalvarconta the botaoSalvarconta to set
*/
public void setBotaoSalvarconta(javax.swing.JButton botaoSalvarconta) {
this.botaoSalvarconta = botaoSalvarconta;
}
/**
* @return the botaoadicionar
*/
public javax.swing.JButton getBotaoadicionar() {
return botaoadicionar;
}
/**
* @param botaoadicionar the botaoadicionar to set
*/
public void setBotaoadicionar(javax.swing.JButton botaoadicionar) {
this.botaoadicionar = botaoadicionar;
}
/**
* @return the datavencimentoconta
*/
public com.toedter.calendar.JDateChooser getDatavencimentoconta() {
return datavencimentoconta;
}
/**
* @param datavencimentoconta the datavencimentoconta to set
*/
public void setDatavencimentoconta(com.toedter.calendar.JDateChooser datavencimentoconta) {
this.datavencimentoconta = datavencimentoconta;
}
/**
* @return the descricaoConta
*/
public javax.swing.JTextField getDescricaoConta() {
return descricaoConta;
}
/**
* @param descricaoConta the descricaoConta to set
*/
public void setDescricaoConta(javax.swing.JTextField descricaoConta) {
this.descricaoConta = descricaoConta;
}
/**
* @return the jLabel2
*/
public javax.swing.JLabel getjLabel2() {
return jLabel2;
}
/**
* @param jLabel2 the jLabel2 to set
*/
public void setjLabel2(javax.swing.JLabel jLabel2) {
this.jLabel2 = jLabel2;
}
/**
* @return the jPanel1
*/
public javax.swing.JPanel getjPanel1() {
return jPanel1;
}
/**
* @param jPanel1 the jPanel1 to set
*/
public void setjPanel1(javax.swing.JPanel jPanel1) {
this.jPanel1 = jPanel1;
}
/**
* @return the jPanel3
*/
public javax.swing.JPanel getjPanel3() {
return jPanel3;
}
/**
* @param jPanel3 the jPanel3 to set
*/
public void setjPanel3(javax.swing.JPanel jPanel3) {
this.jPanel3 = jPanel3;
}
/**
* @return the jPanel9
*/
public javax.swing.JPanel getjPanel9() {
return jPanel9;
}
/**
* @param jPanel9 the jPanel9 to set
*/
public void setjPanel9(javax.swing.JPanel jPanel9) {
this.jPanel9 = jPanel9;
}
/**
* @return the jScrollPane2
*/
public javax.swing.JScrollPane getjScrollPane2() {
return jScrollPane2;
}
/**
* @param jScrollPane2 the jScrollPane2 to set
*/
public void setjScrollPane2(javax.swing.JScrollPane jScrollPane2) {
this.jScrollPane2 = jScrollPane2;
}
/**
* @return the label2
*/
public java.awt.Label getLabel2() {
return label2;
}
/**
* @param label2 the label2 to set
*/
public void setLabel2(java.awt.Label label2) {
this.label2 = label2;
}
/**
* @return the label4
*/
public java.awt.Label getLabel4() {
return label4;
}
/**
* @param label4 the label4 to set
*/
public void setLabel4(java.awt.Label label4) {
this.label4 = label4;
}
/**
* @return the label5
*/
public java.awt.Label getLabel5() {
return label5;
}
/**
* @param label5 the label5 to set
*/
public void setLabel5(java.awt.Label label5) {
this.label5 = label5;
}
/**
* @return the label6
*/
public java.awt.Label getLabel6() {
return label6;
}
/**
* @param label6 the label6 to set
*/
public void setLabel6(java.awt.Label label6) {
this.label6 = label6;
}
/**
* @return the labelcadastro2
*/
public javax.swing.JLabel getLabelcadastro2() {
return labelcadastro2;
}
/**
* @param labelcadastro2 the labelcadastro2 to set
*/
public void setLabelcadastro2(javax.swing.JLabel labelcadastro2) {
this.labelcadastro2 = labelcadastro2;
}
/**
* @return the panelContas
*/
public javax.swing.JPanel getPanelContas() {
return panelContas;
}
/**
* @param panelContas the panelContas to set
*/
public void setPanelContas(javax.swing.JPanel panelContas) {
this.panelContas = panelContas;
}
/**
* @return the tabelaconta
*/
public javax.swing.JTable getTabelaconta() {
return tabelaconta;
}
/**
* @param tabelaconta the tabelaconta to set
*/
public void setTabelaconta(javax.swing.JTable tabelaconta) {
this.tabelaconta = tabelaconta;
}
/**
* @return the txtPesquisa
*/
public javax.swing.JTextField getTxtPesquisa() {
return txtPesquisa;
}
/**
* @param txtPesquisa the txtPesquisa to set
*/
public void setTxtPesquisa(javax.swing.JTextField txtPesquisa) {
this.txtPesquisa = txtPesquisa;
}
/**
* @return the valorconta
*/
public javax.swing.JTextField getValorconta() {
return valorconta;
}
/**
* @param valorconta the valorconta to set
*/
public void setValorconta(javax.swing.JTextField valorconta) {
this.valorconta = valorconta;
}
}
| [
"Glenda Alves de Lima@LAPTOP-AC2RP1QK"
] | Glenda Alves de Lima@LAPTOP-AC2RP1QK |
59e9aa6b62657527ae95f3b8c8446966bf794ec0 | 68b9867e0616c8bbcd80996d715baff6835462f7 | /exercises/module-testing/src/jokeapp.developer/com/squeed/jokeapp/developer/DeveloperJokeService.java | 2883cbc5a25e08d2c3d5651b820e46e706088252 | [] | no_license | mbaeumer/java-module-dojo | 697ef7d00443db226dfed04c9fbf27c849ce7c40 | fb6ef666f5714a4131bc092f463c2458a59a56c1 | refs/heads/master | 2020-05-01T10:33:35.741248 | 2019-09-25T10:07:49 | 2019-09-25T10:07:49 | 177,422,918 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,058 | java | package com.squeed.jokeapp.developer;
import com.squeed.jokeapp.api.*;
import java.util.logging.*;
public class DeveloperJokeService extends AbstractJokeService {
public static final String NAME = "chuck";
private final static Logger LOGGER = Logger.getLogger(DeveloperJokeService.class.getName());
@Override
public void initJokes(){
LOGGER.info("this is a logging message from the developer module");
jokes.add("A programmer had a problem. He used Java. Now he has a ProblemFactory.");
jokes.add("Why did the developer quit the job? Because he did not get arrays");
jokes.add("Why do Java developers wear glasses? Because they do not C#");
jokes.add("An SQL database walks into a NoSQL bar...a while later it walks out again, because it could not find a table ");
jokes.add("An SQL query goes into a bar, walks up to two table and asks 'Can I join you?'");
jokes.add("Why was the C programmer ignored by everyone during the last party? Because she did not have class.");
}
}
| [
"martin.baeumer@gmail.com"
] | martin.baeumer@gmail.com |
5c8ff4c1e2c1ac3f7d69bb16dd82ca9fb696d7f9 | ad32344c4c016cdf06ebb47af43ddaa5c6e2ac39 | /alipay-service/alipay-service-3rdparty/src/main/java/com/alipay/api/domain/AlipayEcoMycarMaintainBizorderstatusUpdateModel.java | 30777a4c26dc1323e8d8c98bff89e7ecbb0314c1 | [] | no_license | leijuan1014/ljj-project | 96f4bcded39ab3ff422ddf3cd515c38511d7524d | dda018e182c4c1229d5392d6d2ed16b0c7001fbd | refs/heads/master | 2021-01-20T23:47:32.854069 | 2017-10-09T07:10:31 | 2017-10-09T07:10:31 | 101,843,379 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,219 | java | package com.alipay.api.domain;
import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;
/**
* 订单状态变更通知接口
*
* @author auto create
* @since 1.0, 2016-11-16 10:04:05
*/
public class AlipayEcoMycarMaintainBizorderstatusUpdateModel extends AlipayObject {
private static final long serialVersionUID = 3857424363183534775L;
/**
* 支付宝交易流水号
如果保养订单变更状态为已支付,则必填
*/
@ApiField("alipay_trade_no")
private String alipayTradeNo;
/**
* ISV订单业务状态文案,车主平台状态和ISV订单状态存在差异时,记录ISV对应的业务状态。
*/
@ApiField("biz_status_txt")
private String bizStatusTxt;
/**
* 行业类目标识
洗车-015;保养-016;4S-020
*/
@ApiField("industry_code")
private String industryCode;
/**
* 物流公司编号。支付宝支持物流公司编号。具体查看
支付宝支持物流公司编码.zip。
如果保养订单变更状态为已出库,则必填
*/
@ApiField("logistics_code")
private String logisticsCode;
/**
* 物流公司名称。支付宝支付物流公司名称。具体查看 支付宝支持物流公司编码.zip。
如果保养订单变更状态为已出库,则必填
*/
@ApiField("logistics_company")
private String logisticsCompany;
/**
* 流单号, ISV上传商品物流单号,用于物流流水的查询。
如果保养订单变更状态为已出库,则必填
*/
@ApiField("logistics_no")
private String logisticsNo;
/**
* 订单号
*/
@ApiField("order_no")
private String orderNo;
/**
* 车主平台业务订单状态
1-未支付;
4-已关闭;
6-支付完成;
7-已出库;
8-已收货;
11-服务开始;
55-服务完成/已核销;
56-订单完成;
*/
@ApiField("order_status")
private String orderStatus;
/**
* 支付宝账号
如果保养订单变更状态为已支付,则必填
*/
@ApiField("pay_account")
private String payAccount;
/**
* 支付时间yyyy-MM-dd HH:mm:ss
如果保养订单变更状态为已支付,则必填
*/
@ApiField("pay_time")
private String payTime;
/**
* 订单发货地址。记录订单发货的详细地址。省^^^市^^^区^^^详细地址。
如果保养订单变更状态为已出库,则必填
*/
@ApiField("sender_addr")
private String senderAddr;
public String getAlipayTradeNo() {
return this.alipayTradeNo;
}
public void setAlipayTradeNo(String alipayTradeNo) {
this.alipayTradeNo = alipayTradeNo;
}
public String getBizStatusTxt() {
return this.bizStatusTxt;
}
public void setBizStatusTxt(String bizStatusTxt) {
this.bizStatusTxt = bizStatusTxt;
}
public String getIndustryCode() {
return this.industryCode;
}
public void setIndustryCode(String industryCode) {
this.industryCode = industryCode;
}
public String getLogisticsCode() {
return this.logisticsCode;
}
public void setLogisticsCode(String logisticsCode) {
this.logisticsCode = logisticsCode;
}
public String getLogisticsCompany() {
return this.logisticsCompany;
}
public void setLogisticsCompany(String logisticsCompany) {
this.logisticsCompany = logisticsCompany;
}
public String getLogisticsNo() {
return this.logisticsNo;
}
public void setLogisticsNo(String logisticsNo) {
this.logisticsNo = logisticsNo;
}
public String getOrderNo() {
return this.orderNo;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public String getOrderStatus() {
return this.orderStatus;
}
public void setOrderStatus(String orderStatus) {
this.orderStatus = orderStatus;
}
public String getPayAccount() {
return this.payAccount;
}
public void setPayAccount(String payAccount) {
this.payAccount = payAccount;
}
public String getPayTime() {
return this.payTime;
}
public void setPayTime(String payTime) {
this.payTime = payTime;
}
public String getSenderAddr() {
return this.senderAddr;
}
public void setSenderAddr(String senderAddr) {
this.senderAddr = senderAddr;
}
}
| [
"leijuan1014@163.com"
] | leijuan1014@163.com |
acef194c5d8df79bf60f82fab6d79a9b11178862 | b4e2238b5dd4846f0c1eaf4ed02edb7a60bffd57 | /app/src/main/java/com/example/tushar/aad/TrackerService.java | 81fe65b8b5d2a221491e54938c4e295838da18ec | [] | no_license | anchliyatushar/BusTracker | 73fefc7c366de72058e85163b882c7cd72bc5ca3 | 38ac10170367e27933ed7d5c3ecb31d76f5e9ea9 | refs/heads/master | 2020-03-23T21:45:00.300219 | 2019-10-11T16:13:27 | 2019-10-11T16:13:27 | 142,130,386 | 0 | 1 | null | 2019-10-11T16:13:28 | 2018-07-24T08:41:53 | Java | UTF-8 | Java | false | false | 4,735 | java | package com.example.tushar.aad;
import com.google.android.gms.location.FusedLocationProviderClient;
import com.google.android.gms.location.LocationCallback;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationResult;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import android.app.PendingIntent;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.location.Location;
import android.Manifest;
import android.os.IBinder;
import android.support.v4.app.NotificationCompat;
import android.support.v4.content.ContextCompat;
import android.util.Log;
public class TrackerService extends Service {
private static final String TAG = TrackerService.class.getSimpleName();
@Override
public IBinder onBind(Intent intent) {return null;}
@Override
public void onCreate() {
super.onCreate();
buildNotification();
loginToFirebase();
}
private void buildNotification() {
String stop = "stop";
registerReceiver(stopReceiver, new IntentFilter(stop));
PendingIntent broadcastIntent = PendingIntent.getBroadcast(
this, 0, new Intent(stop), PendingIntent.FLAG_UPDATE_CURRENT);
// Create the persistent notification
NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
.setContentTitle(getString(R.string.app_name))
.setContentText(getString(R.string.notification_text))
.setOngoing(true)
.setContentIntent(broadcastIntent)
.setSmallIcon(R.drawable.ic_tracker);
startForeground(1, builder.build());
}
protected BroadcastReceiver stopReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Log.d(TAG, "received stop broadcast");
// Stop the service when the notification is tapped
unregisterReceiver(stopReceiver);
stopSelf();
}
};
private void loginToFirebase() {
// Functionality coming next step
// Authenticate with Firebase, and request location updates
String email = getString(R.string.firebase_email);
String password = getString(R.string.firebase_password);
FirebaseAuth.getInstance().signInWithEmailAndPassword(
email, password).addOnCompleteListener(new OnCompleteListener<AuthResult>(){
@Override
public void onComplete(Task<AuthResult> task) {
if (task.isSuccessful()) {
Log.d(TAG, "firebase auth success");
requestLocationUpdates();
} else {
Log.d(TAG, "firebase auth failed");
}
}
});
}
private void requestLocationUpdates() {
// Functionality coming next step
LocationRequest request = new LocationRequest();
request.setInterval(500);
request.setFastestInterval(500);
request.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
FusedLocationProviderClient client = LocationServices.getFusedLocationProviderClient(this);
final String path = getString(R.string.firebase_path) + "/" + getString(R.string.transport_id);
int permission = ContextCompat.checkSelfPermission(this,
Manifest.permission.ACCESS_FINE_LOCATION);
if (permission == PackageManager.PERMISSION_GRANTED) {
// Request location updates and when an update is
// received, store the location in Firebase
client.requestLocationUpdates(request, new LocationCallback() {
@Override
public void onLocationResult(LocationResult locationResult) {
DatabaseReference ref = FirebaseDatabase.getInstance().getReference(path);
Location location = locationResult.getLastLocation();
if (location != null) {
Log.d(TAG, "location update " + location);
ref.setValue(location);
}
}
}, null);
}
}
} | [
"tusharjn16@gmail.com"
] | tusharjn16@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.