blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
acd9db9f5cc6a4daf7a63be1ed681cc1b161fb9e | 3a6f1c626b71ad4e2253ee2baf52655ec7903fe6 | /剑指offer第二遍/代码/src/面试题3.java | b2811ee052e154c0dddf7b0a493959c3480bd168 | [] | no_license | ChasingForWind/algorithm | 50793a33863d8725accea393eeb21d28fef22130 | a82734e8249fd0662cd1fc7976fce4c2b22dc350 | refs/heads/master | 2020-05-20T05:44:34.165379 | 2020-03-17T01:57:47 | 2020-03-17T01:57:47 | 185,413,343 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,000 | java | import java.util.HashMap;
import java.util.HashSet;
public class 面试题3 {
public class Solution {
/*在一个长度为n的数组里的所有数字都在0到n-1的范围内。
数组中某些数字是重复的,但不知道有几个数字是重复的。
也不知道每个数字重复几次。
请找出数组中任意一个重复的数字。 例如,如果输入长度为7的数组{2,3,1,0,2,5,3},那么对应的输出是第一个重复的数字2。*/
public boolean duplicate(int numbers[],int length,int [] duplication) {
if (numbers==null||numbers.length==0) return false;
HashSet<Integer> set = new HashSet<>();
for (int i=0;i<length;i++){
if(set.contains(numbers[i])){
duplication[0]=numbers[i];
return true;
}else {
set.add(numbers[i]);
}
}
return false;
}
}
}
| [
"[email protected]"
] | |
5f30901dbedb1bcc45dd4145d042b5100fc54135 | bcaceec7e3d5ffa9a32d007f2ef410c4f3d45300 | /app/src/main/java/com/edu/feicui/fragment_add_replace/fragment_interactfragment/FragmentInteractFragment.java | bb43b3437152cea530512c28742493e270367f7c | [] | no_license | hyh1005847706/lion | cfb3d09d16eb2345e37b9ca67cce5c4047f78308 | 5baabb342e82e28343375d27d31deae2390b5401 | refs/heads/master | 2020-06-15T11:46:33.573100 | 2016-12-01T13:46:35 | 2016-12-01T13:46:35 | 75,297,052 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,707 | java | package com.edu.feicui.fragment_add_replace.fragment_interactfragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.AppCompatActivity;
import android.widget.Button;
import com.edu.feicui.fragment_add_replace.R;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
/**
* Created by Administrator on 2016/11/26.
*/
public class FragmentInteractFragment extends AppCompatActivity implements MenuFragment.ChangeWomanListener {
private Button btnShow;
@Override
protected void onStart() {
super.onStart();
EventBus.getDefault().register(this);
}
@Override
protected void onStop() {
super.onStop();
EventBus.getDefault().unregister(this);
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_frag_interact_frag);
btnShow = (Button) findViewById(R.id.btn_show);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onMessageEvent(MessageEvent messageEvent){
btnShow.setText("EventBus" + messageEvent.getName());
}
@Override
public void display(String name, String path) {
//显示标题
btnShow.setText(name);
//通过查找fragment,找到contentFragment,调用displayImage方法
FragmentManager fm = getSupportFragmentManager();
ContentFragment fragment = (ContentFragment) fm.findFragmentById(R.id.fragment_content);
fragment.setDisplayImage(path);
}
}
| [
"[email protected]"
] | |
54ee88bbf971242e6bcf02e1e0726a35fa9afa40 | d2cb1f4f186238ed3075c2748552e9325763a1cb | /methods_all/nonstatic_methods/javax_swing_plaf_metal_MetalInternalFrameTitlePane_requestFocusInWindow.java | b2c8a3f0ddfbfb20274afa4f7aac7545334810b6 | [] | no_license | Adabot1/data | 9e5c64021261bf181b51b4141aab2e2877b9054a | 352b77eaebd8efdb4d343b642c71cdbfec35054e | refs/heads/master | 2020-05-16T14:22:19.491115 | 2019-05-25T04:35:00 | 2019-05-25T04:35:00 | 183,001,929 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 253 | java | class javax_swing_plaf_metal_MetalInternalFrameTitlePane_requestFocusInWindow{ public static void function() {javax.swing.plaf.metal.MetalInternalFrameTitlePane obj = new javax.swing.plaf.metal.MetalInternalFrameTitlePane();obj.requestFocusInWindow();}} | [
"[email protected]"
] | |
96c4326bd073bb18c36f15b55ad74d7f9b6b0fca | edf3ae14cac95c6060d99bf6d383a859e71cd1a8 | /Checkers Redone/src/GamePanel.java | 6fc1d2a6edf61585a4a94fb2464124bd39477a0a | [] | no_license | garcia2002julian/Checkers | b6386cc739cb5c5720303780144accc0c01638f0 | f04e97668c4d8d66f154f15b1e7622927368c84c | refs/heads/main | 2023-08-25T18:01:58.909672 | 2021-09-24T01:56:16 | 2021-09-24T01:56:16 | 409,798,703 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,910 | java | import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.ArrayList;
public class GamePanel extends JPanel{
private WhitePiece[] whitePieces = new WhitePiece[12];
private BlackPiece[] blackPieces = new BlackPiece[12];
private boolean turn = true; // made boolean bc easier to switch back and forth
private SquareDetails squareDetails = new SquareDetails();
private ArrayList<GreenSquare> greenSquares = new ArrayList<GreenSquare>();
private BufferedImage img = null;
public GamePanel(){
setPreferredSize(new Dimension(600,600));
setFocusable(true);
setLayout(null);
initializePieces();
initActionListeners();
getBackgroundImage();
}
private void initActionListeners() {
for(int i = 0; i < 12; i++){
WhitePiece white = whitePieces[i];
white.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
for(int i = 0; i < greenSquares.size(); i++)
remove(greenSquares.get(i));
greenSquares.clear();
if(turn)
initGreenSquares(white, null,0);
for(int i = 0; i < greenSquares.size(); i++){
greenSquares.get(i).setSize(new Dimension(65, 65));
initGreenButttonListener(greenSquares.get(i), white);
add(greenSquares.get(i));
}
repaint();
}
});
BlackPiece black = blackPieces[i];
black.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
for(int i = 0; i < greenSquares.size(); i++)
remove(greenSquares.get(i));
greenSquares.clear();
if(!turn)
initGreenSquares(black, null, 0);
for(int i = 0; i < greenSquares.size(); i++){
greenSquares.get(i).setSize(new Dimension(65, 65));
initGreenButttonListener(greenSquares.get(i), black);
add(greenSquares.get(i));
}
repaint();
}
});
}
}
public void clearMoveablePieces(){
Piece[] pieces;
if(turn)
pieces = whitePieces;
else
pieces = blackPieces;
for(int i = 0; i < 12; i++){
pieces[i].setMoveable(false);
}
}
public void checkMoveablePieces(){
Piece[] pieces;
if(turn)
pieces = whitePieces;
else
pieces = blackPieces;
for(int i = 0; i < 12;i++) {
Point square = pieces[i].getSquare();
Point Location = pieces[i].getLocation();
if (pieces[i].getPlayer() == 0 || pieces[i].isKing()) {
if (square.getY() != 7) { //end of the checker board same thing with statement below
if (square.getX() != 0) {
if (!squareDetails.isFilled((int) square.getY() + 1, (int) square.getX() - 1)) {
whitePieces[i].setMoveable(true);
} else if (squareDetails.getPlayer((int) square.getY() + 1, (int) square.getX() - 1) != pieces[i].getPlayer()) { // if piece is the opposite team's
if (square.getY() + 1 != 7 && square.getX() - 1 != 0) { // end of checker board
if (!squareDetails.isFilled((int) square.getY() + 2, (int) square.getX() - 2)) {
whitePieces[i].setMoveable(true);
}
}
}
}
if (square.getX() != 7) {
if (!squareDetails.isFilled((int) square.getY() + 1, (int) square.getX() + 1)) {
pieces[i].setMoveable(true);
} else if (squareDetails.getPlayer((int) square.getY() + 1, (int) square.getX() + 1) != pieces[i].getPlayer()) { // if piece is the opposite team's
if (square.getY() + 1 != 7 && square.getX() + 1 != 7) { // end of checker board
if (!squareDetails.isFilled((int) square.getY() + 2, (int) square.getX() + 2)) {
pieces[i].setMoveable(true);
}
}
}
}
}
}
if(pieces[i].getPlayer() == 1 || pieces[i].isKing()){ // if black piece
if (square.getY() != 0) { //end of the checker board same thing with if statement below
if (square.getX() != 0) {
if (!squareDetails.isFilled((int) square.getY() - 1, (int) square.getX() - 1)) {
pieces[i].setMoveable(true);
}
else if(squareDetails.getPlayer((int) square.getY() - 1, (int) square.getX() - 1) != pieces[i].getPlayer()){ // if piece is the opposite team's
if(square.getY() - 1 != 0 && square.getX() - 1 != 0){ // end of checker board
if(!squareDetails.isFilled((int) square.getY() - 2, (int) square.getX() - 2)) {
pieces[i].setMoveable(true);
}
}
}
}
if (square.getX() != 7) {
if (!squareDetails.isFilled((int) square.getY() - 1, (int) square.getX() + 1)) {
pieces[i].setMoveable(true);
}
else if(squareDetails.getPlayer((int) square.getY() - 1, (int) square.getX() + 1) != pieces[i].getPlayer()){ // if piece is the opposite team's
if(square.getY() - 1 != 0 && square.getX() + 1 != 7){ // end of checker board
if(!squareDetails.isFilled((int) square.getY() - 2, (int) square.getX() + 2)) {
pieces[i].setMoveable(true);
}
}
}
}
}
}
}
}
public void initGreenSquares(Piece piece, GreenSquare pastSquare, int pastDirection){ //pastsquare is for recursion to get all the targeted pieces from the past greensquares, past direction is to avoid infinte loops with king pieces
Point square = piece.getSquare();
Point Location = piece.getLocation();
if(piece.getPlayer() == 0 || piece.isKing()) { // if white peice
if (square.getY() != 7) { //end of the checker board same thing with statement below
if (square.getX() != 0) {
if (!squareDetails.isFilled((int) square.getY() + 1, (int) square.getX() - 1)) {
if(pastSquare == null)
greenSquares.add(new GreenSquare(new Point((int) Location.getX() - 65, (int) Location.getY() + 65)));
}
else if(squareDetails.getPlayer((int) square.getY() + 1, (int) square.getX() - 1) != piece.getPlayer()){ // if piece is the opposite team's
if(square.getY() + 1 != 7 && square.getX() - 1 != 0){ // end of checker board
if(!squareDetails.isFilled((int) square.getY() + 2, (int) square.getX() - 2)) {
if(pastDirection != 4) {
GreenSquare greenSquare = new GreenSquare(new Point((int) Location.getX() - 130, (int) Location.getY() + 130));
if (pastSquare != null) {
ArrayList<Piece> temp = pastSquare.getDeadPieces();
for (int i = 0; i < temp.size(); i++)
greenSquare.addDeadPiece(temp.get(i));
}
greenSquare.addDeadPiece(squareDetails.getBoardPiece((int) square.getY() + 1, (int) square.getX() - 1));
greenSquares.add(greenSquare);
piece.setLocation((int) Location.getX() - 130, (int) Location.getY() + 130);
initGreenSquares(piece, greenSquare, 1);
piece.setLocation((int) Location.getX(), (int) Location.getY());
}
}
}
}
}
if (square.getX() != 7) {
if (!squareDetails.isFilled((int) square.getY() + 1, (int) square.getX() + 1)) {
if(pastSquare == null)
greenSquares.add(new GreenSquare(new Point((int) Location.getX() + 65, (int) Location.getY() + 65)));
}
else if(squareDetails.getPlayer((int) square.getY() + 1, (int) square.getX() + 1) != piece.getPlayer()){ // if piece is the opposite team's
if(square.getY() + 1 != 7 && square.getX() + 1 != 7){ // end of checker board
if(!squareDetails.isFilled((int) square.getY() + 2, (int) square.getX() + 2)) {
if(pastDirection != 3) {
GreenSquare greenSquare = new GreenSquare(new Point((int) Location.getX() + 130, (int) Location.getY() + 130));
if (pastSquare != null) {
ArrayList<Piece> temp = pastSquare.getDeadPieces();
for (int i = 0; i < temp.size(); i++)
greenSquare.addDeadPiece(temp.get(i));
}
greenSquare.addDeadPiece(squareDetails.getBoardPiece((int) square.getY() + 1, (int) square.getX() + 1));
greenSquares.add(greenSquare);
piece.setLocation((int) Location.getX() + 130, (int) Location.getY() + 130);
initGreenSquares(piece, greenSquare, 2);
piece.setLocation((int) Location.getX(), (int) Location.getY());
}
}
}
}
}
}
}
if(piece.getPlayer() == 1 || piece.isKing()){ // if black piece
if (square.getY() != 0) { //end of the checker board same thing with if statement below
if (square.getX() != 0) {
if (!squareDetails.isFilled((int) square.getY() - 1, (int) square.getX() - 1)) {
if(pastSquare == null)
greenSquares.add(new GreenSquare(new Point((int) Location.getX() - 65, (int) Location.getY() - 65)));
}
else if(squareDetails.getPlayer((int) square.getY() - 1, (int) square.getX() - 1) != piece.getPlayer()){ // if piece is the opposite team's
if(square.getY() - 1 != 0 && square.getX() - 1 != 0){ // end of checker board
if(!squareDetails.isFilled((int) square.getY() - 2, (int) square.getX() - 2)) {
if(pastDirection != 2) {
GreenSquare greenSquare = new GreenSquare(new Point((int) Location.getX() - 130, (int) Location.getY() - 130));
if (pastSquare != null) {
ArrayList<Piece> temp = pastSquare.getDeadPieces();
for (int i = 0; i < temp.size(); i++)
greenSquare.addDeadPiece(temp.get(i));
}
greenSquare.addDeadPiece(squareDetails.getBoardPiece((int) square.getY() - 1, (int) square.getX() - 1));
greenSquares.add(greenSquare);
piece.setLocation((int) Location.getX() - 130, (int) Location.getY() - 130);
initGreenSquares(piece, greenSquare, 3);
piece.setLocation((int) Location.getX(), (int) Location.getY());
}
}
}
}
}
if (square.getX() != 7) {
if (!squareDetails.isFilled((int) square.getY() - 1, (int) square.getX() + 1)) {
if(pastSquare == null)
greenSquares.add(new GreenSquare(new Point((int) Location.getX() + 65, (int) Location.getY() - 65)));
}
else if(squareDetails.getPlayer((int) square.getY() - 1, (int) square.getX() + 1) != piece.getPlayer()){ // if piece is the opposite team's
if(square.getY() - 1 != 0 && square.getX() + 1 != 7){ // end of checker board
if(!squareDetails.isFilled((int) square.getY() - 2, (int) square.getX() + 2)) {
if(pastDirection != 1) {
GreenSquare greenSquare = new GreenSquare(new Point((int) Location.getX() + 130, (int) Location.getY() - 130));
if (pastSquare != null) {
ArrayList<Piece> temp = pastSquare.getDeadPieces();
for (int i = 0; i < temp.size(); i++)
greenSquare.addDeadPiece(temp.get(i));
}
greenSquare.addDeadPiece(squareDetails.getBoardPiece((int) square.getY() - 1, (int) square.getX() + 1));
greenSquares.add(greenSquare);
piece.setLocation((int) Location.getX() + 130, (int) Location.getY() - 130);
initGreenSquares(piece, greenSquare, 4);
piece.setLocation((int) Location.getX(), (int) Location.getY());
}
}
}
}
}
}
}
}
public void initGreenButttonListener(GreenSquare greenSquare, Piece piece){
greenSquare.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
squareDetails.setBoardPiece((int)piece.getSquare().getY(), (int)piece.getSquare().getX(), null);
piece.setLocation((int)greenSquare.getLocation().getX(), (int)greenSquare.getLocation().getY());
squareDetails.setBoardPiece((int)piece.getSquare().getY(), (int)piece.getSquare().getX(), piece);
ArrayList<Piece> deadPieces = greenSquare.getDeadPieces();
for(int i = 0; i < deadPieces.size(); i++){
squareDetails.setBoardPiece((int)deadPieces.get(i).getSquare().getY(), (int)deadPieces.get(i).getSquare().getX(), null);
remove(deadPieces.get(i));
}
for(int i = 0; i < greenSquares.size(); i++)
remove(greenSquares.get(i));
greenSquares.clear();
if(piece.getPlayer() == 0 && piece.getSquare().getY() == 7)
piece.makeKing();
else if(piece.getPlayer() == 1 && piece.getSquare().getY() == 0)
piece.makeKing();
clearMoveablePieces();
turn = !turn;
checkMoveablePieces();
repaint();
}
});
}
public void getBackgroundImage(){
try {
img = ImageIO.read(getClass().getResource("/Resources/checkerboard.jpg"));
}
catch (IOException e){
e.printStackTrace();
}
}
public void paintComponent(Graphics g){
g.drawImage(img.getScaledInstance(600, 600, Image.SCALE_DEFAULT), 0, 0, null);
}
public void initializePieces(){
int x = 105;
int y = 40;
int difference = -65; // adjusting left or right from white pieces
for(int i = 0; i < 12; i++){
WhitePiece white = new WhitePiece();
BlackPiece black = new BlackPiece();
white.setSize(new Dimension(65, 65));
black.setSize(new Dimension(65, 65));
white.setLocation(x, y);
black.setLocation(x + difference, y + 325);
x += 130;
if ((i + 1) % 4 == 0) { // Every changing row
if(x == 625) { // 625 bc after it adds up 4 times
x = 40;
difference = 65;
}
else {
x = 105;
difference = -65;
}
y += 65;
}
whitePieces[i] = white;
add(whitePieces[i]);
blackPieces[i] = black;
add(blackPieces[i]);
}
int temp = -1;
int temp2 = 1;
int temp3 = 0;
for(int i = 0 ; i < 12; i++){
if(i % 4 == 0) {
if(i == 4) {
temp2 = 0;
temp3 = 1;
}
else if(i == 8) {
temp2 = 1;
temp3 = 0;
}
temp++;
}
squareDetails.setBoardPiece(0 + temp, (2 * (i % 4)) + temp2, whitePieces[i]);
squareDetails.setBoardPiece(5 + temp, (2 * (i % 4)) + temp3, blackPieces[i]);
}
checkMoveablePieces();
}
}
| [
"[email protected]"
] | |
c69308bb10741e45b5dd0aff5c87d59f02a89625 | 53069e4752f31ee9e3f2a6bc90ed3cd608c98f84 | /src/main/java/model/HttpMethod.java | 6e682d4464ef2f75b9d010fd6b9f0bb357e6bd61 | [] | no_license | isisrin/web-application-server | 7ae033745e6471a132da9c18c2a139bed0242565 | c8534e80af78f25a268c0fd81637276e6db5ee83 | refs/heads/master | 2020-05-17T08:56:26.959044 | 2019-05-23T00:38:04 | 2019-05-23T00:38:04 | 183,619,801 | 0 | 0 | null | 2019-04-26T11:51:19 | 2019-04-26T11:51:19 | null | UTF-8 | Java | false | false | 228 | java | package model;
public class HttpMethod {
public static final String POST = "POST";
public static final String GET = "GET";
public static final String PUT = "PUT";
public static final String DELETE = "DELETE";
}
| [
"[email protected]"
] | |
b31a4bb11ce07715f793b5d0b18bae1e3488ec1e | c91f8e0d6c5490f4a64f759e158c3cb1cc99afa6 | /src/test/java/org/lasencinas/ApiRestPracticeApplicationTests.java | eced41412a30570ff0cbaf45bc74911f7abe34da | [] | no_license | alexnro/API-REST-Practice | b0bd5bd211e77c178316200727477db479c63e21 | c29755d7c178e8b2d70e18e4dc34bd8dd236d47b | refs/heads/master | 2020-05-19T13:45:21.878627 | 2019-05-12T17:48:00 | 2019-05-12T17:48:00 | 185,047,542 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 340 | java | package org.lasencinas;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class ApiRestPracticeApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"[email protected]"
] | |
105e28068198e5fd12f7253ec75d72c82002c9b3 | 0e64e1b191dae517a5cb93bdbb24370e0efbbdf6 | /src/org/tcs/line/Day1Nex.java | d036149faca43bb1a45deae3aebadf0cb72a9f5e | [] | no_license | huntback/ProjectTask | 201909ac2c8101ed7b2dce37cb4dfa24affa85a5 | aae95d80b07e66071a15b7ae9a88b99b299cf942 | refs/heads/master | 2020-03-23T23:44:59.153118 | 2018-07-25T06:53:00 | 2018-07-25T06:53:00 | 142,253,417 | 0 | 0 | null | 2018-07-25T06:53:01 | 2018-07-25T05:50:39 | Java | UTF-8 | Java | false | false | 443 | java | package org.tcs.line;
public class Day1Nex {
public static void main(String[] args) {
System.out.println("dhinesh");
add("Siddharthan", "Prabakaran");
add(5,6);
add(5.5,6.5);
}
public static void add(int i,int j)
{
int c = i+j;
System.out.println(c);
}
public static void add(double i,double j)
{
double c = i+j;
System.out.println(c);
}
public static void add(String a,String b)
{
String c = a+b;
System.out.println(c);
}
}
| [
"[email protected]"
] | |
70db07df030447ebfc6531974006b150c9538370 | 2a8458736e95d561a4f16e70bc3b146566284c1c | /src/main/java/com/marlononorio/locadora/web/rest/AuditResource.java | 60c7cf664c78a4468b4b12ef9a946c1677215e44 | [] | no_license | marlononorio/locadora-passatempo-application | 8e12742f61afece1fdaf13fafa9b9b02e14953b7 | 8b5da4e6a142180f9d297572a5df39d1e4206428 | refs/heads/master | 2022-12-22T16:59:46.122881 | 2020-02-23T15:14:18 | 2020-02-23T15:14:18 | 242,539,211 | 0 | 0 | null | 2022-12-16T05:13:04 | 2020-02-23T15:14:04 | Java | UTF-8 | Java | false | false | 3,326 | java | package com.marlononorio.locadora.web.rest;
import com.marlononorio.locadora.service.AuditEventService;
import io.github.jhipster.web.util.PaginationUtil;
import io.github.jhipster.web.util.ResponseUtil;
import org.springframework.boot.actuate.audit.AuditEvent;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
import java.time.Instant;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.List;
/**
* REST controller for getting the {@link AuditEvent}s.
*/
@RestController
@RequestMapping("/management/audits")
public class AuditResource {
private final AuditEventService auditEventService;
public AuditResource(AuditEventService auditEventService) {
this.auditEventService = auditEventService;
}
/**
* {@code GET /audits} : get a page of {@link AuditEvent}s.
*
* @param pageable the pagination information.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of {@link AuditEvent}s in body.
*/
@GetMapping
public ResponseEntity<List<AuditEvent>> getAll(Pageable pageable) {
Page<AuditEvent> page = auditEventService.findAll(pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page);
return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
/**
* {@code GET /audits} : get a page of {@link AuditEvent} between the {@code fromDate} and {@code toDate}.
*
* @param fromDate the start of the time period of {@link AuditEvent} to get.
* @param toDate the end of the time period of {@link AuditEvent} to get.
* @param pageable the pagination information.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of {@link AuditEvent} in body.
*/
@GetMapping(params = {"fromDate", "toDate"})
public ResponseEntity<List<AuditEvent>> getByDates(
@RequestParam(value = "fromDate") LocalDate fromDate,
@RequestParam(value = "toDate") LocalDate toDate,
Pageable pageable) {
Instant from = fromDate.atStartOfDay(ZoneId.systemDefault()).toInstant();
Instant to = toDate.atStartOfDay(ZoneId.systemDefault()).plusDays(1).toInstant();
Page<AuditEvent> page = auditEventService.findByDates(from, to, pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page);
return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
/**
* {@code GET /audits/:id} : get an {@link AuditEvent} by id.
*
* @param id the id of the entity to get.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and the {@link AuditEvent} in body, or status {@code 404 (Not Found)}.
*/
@GetMapping("/{id:.+}")
public ResponseEntity<AuditEvent> get(@PathVariable Long id) {
return ResponseUtil.wrapOrNotFound(auditEventService.find(id));
}
}
| [
"[email protected]"
] | |
c2a10c8eaf12fb45592c2406e98019474c25826f | 8b6e067f0ae7a54f53b40c45bf168010aa6b2099 | /demo/src/main/java/demo/training/JenkinsIntegration.java | 2550e75d1f7e330240ca11e306e7fd7b28a0257c | [] | no_license | smkreddy2001/demo | 71dc60aec822c92a105b0e041a70d2813fb16751 | 208011bae9aaf92c1fab2aac7f29f56005109a38 | refs/heads/master | 2021-01-10T03:33:57.557912 | 2015-10-16T06:37:35 | 2015-10-16T06:37:35 | 44,360,936 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 327 | java | package demo.training;
public class JenkinsIntegration {
public String sayHello(String helloString) {
System.out.println("received : " + helloString);
return "Demo " + helloString;
}
public String sayHello() {
String helloString = "hello";
System.out.println(" Saying : "+ helloString);
return helloString;
}
}
| [
"Reddy@localhost"
] | Reddy@localhost |
ea894edc1808f6b0d45082f1d36e772fc36379f7 | cd41dca89641e3d535c940c693c6948a8f4b1d70 | /sumhangtest/src/main/java/net/bit/sumhang/domain/UserVO.java | 7440762f8244456163f3cc4dc99813de4db04798 | [] | no_license | blitz2200/sumhang | 86a01bc82ed3b6e0b12b6760b8c017f32a4084f7 | 99fb625c69b88724a543dec457c80810f9fb627c | refs/heads/master | 2021-01-15T10:14:12.598538 | 2014-07-22T06:46:43 | 2014-07-22T06:46:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,794 | java | package net.bit.sumhang.domain;
public class UserVO {
private String id;
private String name;
private String password;
private String nick;
private String birth;
private String gender;
private String photo;
private String push;
private String invite;
private String signout;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getNick() {
return nick;
}
public void setNick(String nick) {
this.nick = nick;
}
public String getBirth() {
return birth;
}
public void setBirth(String birth) {
this.birth = birth;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getPhoto() {
return photo;
}
public void setPhoto(String photo) {
this.photo = photo;
}
public String getPush() {
return push;
}
public void setPush(String push) {
this.push = push;
}
public String getInvite() {
return invite;
}
public void setInvite(String invite) {
this.invite = invite;
}
public String getSignout() {
return signout;
}
public void setSignout(String signout) {
this.signout = signout;
}
@Override
public String toString() {
// TODO Auto-generated method stub
return ("id:"+id
+", name:"+name
+", password:"+password
+", nick:"+nick
+", birth:"+birth
+", gender:"+gender
+", photo:"+photo
+", push:"+push
+", invite:"+invite
+", signout:"+signout);
}
}
| [
"bit@bitacademy21"
] | bit@bitacademy21 |
a069ec40d6b09bf2b4b4d33cbc3c4f44bcd18a26 | 8658fef25d3bbab3d43a1420bc03b7acbb5fec61 | /app/src/main/java/com/example/d851/myproject/Breakfast.java | f077c703fa8a962849196c452a15a27dc5403b5d | [] | no_license | Diarda/Schoolstuff | 88f027a15dec4a85a1fbdcd92ca4d0ffc542f832 | a810f5653f11a98d399dff58d76a4121937ea199 | refs/heads/master | 2021-03-30T14:17:30.020579 | 2020-04-11T22:36:58 | 2020-04-11T22:36:58 | 248,062,535 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 898 | java | package com.example.d851.myproject;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
public class Breakfast extends AppCompatActivity {
SQLiteDatabase db;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_breakfast);
db=openOrCreateDatabase("Helper1", Context.MODE_PRIVATE, null);
Cursor cursor = db.rawQuery("SELECT recomendations FROM FoodMenu WHERE type = '"+StartingPoint.currentUser.getType()+"' AND time = 'Breakfast'", null);
cursor.moveToFirst();
String recomendations = cursor.getString(0);
((TextView)findViewById(R.id.breakfast)).setText(recomendations);
}
}
| [
"[email protected]"
] | |
144399829f3249eb1b67043504736399a77b5433 | 3f94093d6138361674380890c595c5d999f50676 | /SpringUtils-07/src/com/yanxi/poxity/main/DiayInvocationHandler.java | d77927026a8d15b1c97b10797d4c749720ab44c5 | [] | no_license | zddcvb/code-study | a8d6bd1847ca7d1eafb09f6994187f71a65bf2c9 | 4d469548607bc1784255f1acf48210ade41fecf4 | refs/heads/master | 2020-04-29T14:17:40.715034 | 2019-03-18T02:43:15 | 2019-03-18T02:43:15 | 176,192,030 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 555 | java | package com.yanxi.poxity.main;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
public class DiayInvocationHandler implements InvocationHandler {
private Object object;
public DiayInvocationHandler(Object object) {
this.object = object;
}
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
System.out.println("======invoke before============");
Object result = method.invoke(object, args);
System.out.println("======invoke after=============");
return result;
}
}
| [
"[email protected]"
] | |
78455864c504efc0acb5115961c11451a4e73904 | 5093d921468f2089aeb97c6944e4292c30d8d7d2 | /blog-api/src/main/java/com/billion/entity/Tag.java | d42b9217d67c40a0b1568861c22cbb2823de9d74 | [] | no_license | github-is-too-slow/blogSystem | f06c4e6680667067a656796f3c62b77ba55a057e | f167478c44193aefd96c05987ec493123ea64658 | refs/heads/master | 2023-04-02T13:12:12.485303 | 2021-04-15T04:40:00 | 2021-04-15T04:40:00 | 358,127,967 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 494 | java | package com.billion.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
/**
* @author Billion
* @create 2021/04/07 16:32
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
@ToString
public class Tag {
@TableId(value = "id",type = IdType.AUTO)
private Integer id;
private String name;
private String img;
}
| [
"[email protected]"
] | |
ee571c25b1711f7636ce2811423094281f946026 | 837f5b201ad30d4ead883098e3009f3a7324bd34 | /src/main/java/br/com/conductor/pier/api/v2/model/OportunidadeResponse.java | 4102ebc02f7695a07c68a149f5dbe76f40a4161f | [] | no_license | rafaelchei/pier-sdk-java | 1c362d869dca233cc6408ae65a149bd8f79d9304 | e0dbe0a58e50d8235724496fd96f2e5781a84bbf | refs/heads/master | 2021-05-15T16:06:35.663445 | 2017-10-18T17:02:51 | 2017-10-18T17:02:51 | 107,436,451 | 0 | 0 | null | 2017-10-18T16:47:12 | 2017-10-18T16:47:12 | null | UTF-8 | Java | false | false | 9,264 | java | package br.com.conductor.pier.api.v2.model;
import java.util.Objects;
import br.com.conductor.pier.api.v2.model.DetalheOportunidadeResponse;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
/**
* Representa\u00C3\u00A7\u00C3\u00A3o da resposta do recurso Oportunidades
**/
@ApiModel(description = "Representa\u00C3\u00A7\u00C3\u00A3o da resposta do recurso Oportunidades")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen")
public class OportunidadeResponse {
private Long id = null;
private Long idTipoOportunidade = null;
private Long idStatusOportunidade = null;
private String dataCadastro = null;
private String dataAtualizacao = null;
private String numeroReceitaFederal = null;
private String dataInicioVigencia = null;
private String dataFimVigencia = null;
private Boolean flagAtivo = null;
private List<DetalheOportunidadeResponse> detalhes = new ArrayList<DetalheOportunidadeResponse>();
/**
* C\u00C3\u00B3digo identificador da oportunidade
**/
public OportunidadeResponse id(Long id) {
this.id = id;
return this;
}
@ApiModelProperty(example = "null", value = "C\u00C3\u00B3digo identificador da oportunidade")
@JsonProperty("id")
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
/**
* C\u00C3\u00B3digo identificador do tipo oportunidade
**/
public OportunidadeResponse idTipoOportunidade(Long idTipoOportunidade) {
this.idTipoOportunidade = idTipoOportunidade;
return this;
}
@ApiModelProperty(example = "null", value = "C\u00C3\u00B3digo identificador do tipo oportunidade")
@JsonProperty("idTipoOportunidade")
public Long getIdTipoOportunidade() {
return idTipoOportunidade;
}
public void setIdTipoOportunidade(Long idTipoOportunidade) {
this.idTipoOportunidade = idTipoOportunidade;
}
/**
* C\u00C3\u00B3digo identificador do status oportunidade
**/
public OportunidadeResponse idStatusOportunidade(Long idStatusOportunidade) {
this.idStatusOportunidade = idStatusOportunidade;
return this;
}
@ApiModelProperty(example = "null", value = "C\u00C3\u00B3digo identificador do status oportunidade")
@JsonProperty("idStatusOportunidade")
public Long getIdStatusOportunidade() {
return idStatusOportunidade;
}
public void setIdStatusOportunidade(Long idStatusOportunidade) {
this.idStatusOportunidade = idStatusOportunidade;
}
/**
* Data cadastro da oportunidade.
**/
public OportunidadeResponse dataCadastro(String dataCadastro) {
this.dataCadastro = dataCadastro;
return this;
}
@ApiModelProperty(example = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", value = "Data cadastro da oportunidade.")
@JsonProperty("dataCadastro")
public String getDataCadastro() {
return dataCadastro;
}
public void setDataCadastro(String dataCadastro) {
this.dataCadastro = dataCadastro;
}
/**
* Data atualiza\u00C3\u00A7\u00C3\u00A3o da oportunidade.
**/
public OportunidadeResponse dataAtualizacao(String dataAtualizacao) {
this.dataAtualizacao = dataAtualizacao;
return this;
}
@ApiModelProperty(example = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", value = "Data atualiza\u00C3\u00A7\u00C3\u00A3o da oportunidade.")
@JsonProperty("dataAtualizacao")
public String getDataAtualizacao() {
return dataAtualizacao;
}
public void setDataAtualizacao(String dataAtualizacao) {
this.dataAtualizacao = dataAtualizacao;
}
/**
* N\u00C3\u00BAmero receita federal do cliente ao qual ser\u00C3\u00A1 ofertada a oportunidade
**/
public OportunidadeResponse numeroReceitaFederal(String numeroReceitaFederal) {
this.numeroReceitaFederal = numeroReceitaFederal;
return this;
}
@ApiModelProperty(example = "null", value = "N\u00C3\u00BAmero receita federal do cliente ao qual ser\u00C3\u00A1 ofertada a oportunidade")
@JsonProperty("numeroReceitaFederal")
public String getNumeroReceitaFederal() {
return numeroReceitaFederal;
}
public void setNumeroReceitaFederal(String numeroReceitaFederal) {
this.numeroReceitaFederal = numeroReceitaFederal;
}
/**
* In\u00C3\u00ADcio da vig\u00C3\u00AAncia da oportunidade
**/
public OportunidadeResponse dataInicioVigencia(String dataInicioVigencia) {
this.dataInicioVigencia = dataInicioVigencia;
return this;
}
@ApiModelProperty(example = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", value = "In\u00C3\u00ADcio da vig\u00C3\u00AAncia da oportunidade")
@JsonProperty("dataInicioVigencia")
public String getDataInicioVigencia() {
return dataInicioVigencia;
}
public void setDataInicioVigencia(String dataInicioVigencia) {
this.dataInicioVigencia = dataInicioVigencia;
}
/**
* Fim da vig\u00C3\u00AAncia da oportunidade
**/
public OportunidadeResponse dataFimVigencia(String dataFimVigencia) {
this.dataFimVigencia = dataFimVigencia;
return this;
}
@ApiModelProperty(example = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", value = "Fim da vig\u00C3\u00AAncia da oportunidade")
@JsonProperty("dataFimVigencia")
public String getDataFimVigencia() {
return dataFimVigencia;
}
public void setDataFimVigencia(String dataFimVigencia) {
this.dataFimVigencia = dataFimVigencia;
}
/**
* Flag de verifica\u00C3\u00A7\u00C3\u00A3o se a oportunidade est\u00C3\u00A1 ativa
**/
public OportunidadeResponse flagAtivo(Boolean flagAtivo) {
this.flagAtivo = flagAtivo;
return this;
}
@ApiModelProperty(example = "true", value = "Flag de verifica\u00C3\u00A7\u00C3\u00A3o se a oportunidade est\u00C3\u00A1 ativa")
@JsonProperty("flagAtivo")
public Boolean getFlagAtivo() {
return flagAtivo;
}
public void setFlagAtivo(Boolean flagAtivo) {
this.flagAtivo = flagAtivo;
}
/**
* Lista de detalhes da oportunidade
**/
public OportunidadeResponse detalhes(List<DetalheOportunidadeResponse> detalhes) {
this.detalhes = detalhes;
return this;
}
@ApiModelProperty(example = "null", value = "Lista de detalhes da oportunidade")
@JsonProperty("detalhes")
public List<DetalheOportunidadeResponse> getDetalhes() {
return detalhes;
}
public void setDetalhes(List<DetalheOportunidadeResponse> detalhes) {
this.detalhes = detalhes;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
OportunidadeResponse oportunidadeResponse = (OportunidadeResponse) o;
return Objects.equals(this.id, oportunidadeResponse.id) &&
Objects.equals(this.idTipoOportunidade, oportunidadeResponse.idTipoOportunidade) &&
Objects.equals(this.idStatusOportunidade, oportunidadeResponse.idStatusOportunidade) &&
Objects.equals(this.dataCadastro, oportunidadeResponse.dataCadastro) &&
Objects.equals(this.dataAtualizacao, oportunidadeResponse.dataAtualizacao) &&
Objects.equals(this.numeroReceitaFederal, oportunidadeResponse.numeroReceitaFederal) &&
Objects.equals(this.dataInicioVigencia, oportunidadeResponse.dataInicioVigencia) &&
Objects.equals(this.dataFimVigencia, oportunidadeResponse.dataFimVigencia) &&
Objects.equals(this.flagAtivo, oportunidadeResponse.flagAtivo) &&
Objects.equals(this.detalhes, oportunidadeResponse.detalhes);
}
@Override
public int hashCode() {
return Objects.hash(id, idTipoOportunidade, idStatusOportunidade, dataCadastro, dataAtualizacao, numeroReceitaFederal, dataInicioVigencia, dataFimVigencia, flagAtivo, detalhes);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class OportunidadeResponse {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" idTipoOportunidade: ").append(toIndentedString(idTipoOportunidade)).append("\n");
sb.append(" idStatusOportunidade: ").append(toIndentedString(idStatusOportunidade)).append("\n");
sb.append(" dataCadastro: ").append(toIndentedString(dataCadastro)).append("\n");
sb.append(" dataAtualizacao: ").append(toIndentedString(dataAtualizacao)).append("\n");
sb.append(" numeroReceitaFederal: ").append(toIndentedString(numeroReceitaFederal)).append("\n");
sb.append(" dataInicioVigencia: ").append(toIndentedString(dataInicioVigencia)).append("\n");
sb.append(" dataFimVigencia: ").append(toIndentedString(dataFimVigencia)).append("\n");
sb.append(" flagAtivo: ").append(toIndentedString(flagAtivo)).append("\n");
sb.append(" detalhes: ").append(toIndentedString(detalhes)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| [
"[email protected]"
] | |
e0331a3f0da9a875fe5549c4a17f5469accbbbea | e91223c785fa330884b3ea0180a67befcf372a53 | /app/src/main/java/com/clarkgarrent/instagramviewer/Models/Meta.java | c60df8cb30523040663dc8b2deb4539dd1d32467 | [] | no_license | KarlClark/InstagramViewerRepo | ad993c05af7d98e4345597770ac16abdb4fb8f5a | a753fef6ee8bf52d6f251a803398c19541947f72 | refs/heads/master | 2021-07-16T12:42:11.698124 | 2017-10-23T22:20:04 | 2017-10-23T22:20:04 | 100,264,791 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 874 | java | package com.clarkgarrent.instagramviewer.Models;
/**
* Created by karlc on 8/10/2017.
*/
public class Meta {
private String error_type;
private String code;
private String error_message;
public Meta(){}
public Meta(String error_type, String error_message) {
this.error_type = error_type;
this.error_message = error_message;
code = "";
}
public String getError_type() {
return error_type;
}
public void setError_type(String error_type) {
this.error_type = error_type;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getError_message() {
return error_message;
}
public void setError_message(String error_message) {
this.error_message = error_message;
}
}
| [
"[email protected]"
] | |
28aac7e6df36444680e4db5d4a92e085718fd5b3 | 6306b979e466bb750162d4454837a6f5b4a5e276 | /BWAWorker/src/main/java/com/bwa/worker/service/HealthCheckService.java | 265ee7e19d8fe16cde8227661628f0ce0a35b971 | [] | no_license | abhijeetrathaur/bwa_aws | 9a635296f5af2a666d81fec7540dff93353e14fd | 88556f1e221540d30753cdb076c2c2066f3ed79b | refs/heads/master | 2020-03-20T14:42:16.506455 | 2018-08-13T21:47:23 | 2018-08-13T21:47:23 | 137,493,187 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 180 | java | package com.bwa.worker.service;
import com.bwa.worker.dto.BWAWorker;
/**
* The Interface HealthCheck.
*/
public interface HealthCheckService {
BWAWorker getHealthCheck();
}
| [
"[email protected]"
] | |
1381ab6a3a1c1c826b52bbb54053550246409360 | a5de30a45470262ad0ae4a8039c0d9f558080d1e | /src/com/infamous/logcat/AboutActivity.java | d51795cce298c01d9c72b8de246c07c5b6421b5c | [] | no_license | The-Nemesis-Project/Logcat | caaf9afe48c5cc55a58db59324ea119a690c40b2 | d2a1973eca4af2993c5b2a38c18d197e3a7441cf | refs/heads/master | 2020-03-27T02:33:55.010240 | 2014-11-22T18:35:36 | 2014-11-22T18:35:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,380 | java | package com.infamous.logcat;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.ProgressBar;
import com.infamous.logcat.helper.PackageHelper;
import com.infamous.logcat.util.UtilLogger;
public class AboutActivity extends Activity implements OnClickListener {
private static UtilLogger log = new UtilLogger(AboutActivity.class);
private Button okButton;
private WebView aboutWebView;
private ProgressBar progressBar;
private Handler handler = new Handler();
private View topPanel;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.about);
topPanel = findViewById(R.id.topPanel);
topPanel.setVisibility(View.GONE);
okButton = (Button) findViewById(R.id.okButton);
okButton.setOnClickListener(this);
okButton.setVisibility(View.GONE);
aboutWebView = (WebView) findViewById(R.id.aboutTextWebView);
aboutWebView.setVisibility(View.GONE);
progressBar = (ProgressBar) findViewById(R.id.aboutProgressBar);
aboutWebView.setBackgroundColor(0);
aboutWebView.setWebViewClient(new AboutWebClient());
initializeWebView();
}
public void initializeWebView() {
String text = loadTextFile(R.raw.about_body);
String version = PackageHelper.getVersionName(this);
boolean isDonateVersion = PackageHelper.isCatlogDonateInstalled(getApplicationContext());
if (isDonateVersion) {
version += " (" + getString(R.string.donate_version_name) + ")";
}
String message = loadTextFile(isDonateVersion ? R.raw.donate_message : R.raw.free_message);
String changelog = loadTextFile(R.raw.changelog);
String css = loadTextFile(R.raw.about_css);
String translations = loadTextFile(R.raw.translations);
text = String.format(text, version, message, changelog, css, translations);
WebSettings settings = aboutWebView.getSettings();
settings.setDefaultTextEncodingName("utf-8");
aboutWebView.loadDataWithBaseURL(null, text, "text/html", "UTF-8", null);
}
private String loadTextFile(int resourceId) {
InputStream is = getResources().openRawResource(resourceId);
BufferedReader buff = new BufferedReader(new InputStreamReader(is));
StringBuilder sb = new StringBuilder();
try {
while (buff.ready()) {
sb.append(buff.readLine()).append("\n");
}
} catch (IOException e) {
log.e(e, "This should not happen");
}
return sb.toString();
}
private void loadExternalUrl(String url) {
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
intent.setData(Uri.parse(url));
startActivity(intent);
}
@Override
public void onClick(View v) {
finish();
}
private class AboutWebClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, final String url) {
log.d("shouldOverrideUrlLoading");
// XXX hack to make the webview go to an external url if the hyperlink is
// in my own HTML file - otherwise it says "Page not available" because I'm not calling
// loadDataWithBaseURL. But if I call loadDataWithBaseUrl using a fake URL, then
// the links within the page itself don't work!! Arggggh!!!
if (url.startsWith("http") || url.startsWith("mailto") || url.startsWith("market")) {
handler.post(new Runnable() {
@Override
public void run() {
loadExternalUrl(url);
}
});
return true;
}
return false;
}
@Override
public void onPageFinished(WebView view, String url) {
// dismiss the loading bar when the page has finished loading
handler.post(new Runnable(){
@Override
public void run() {
progressBar.setVisibility(View.GONE);
aboutWebView.setVisibility(View.VISIBLE);
topPanel.setVisibility(View.VISIBLE);
okButton.setVisibility(View.VISIBLE);
}});
super.onPageFinished(view, url);
}
}
}
| [
"[email protected]"
] | |
b3212ae3d2fdde91bf1fdea5a06d0cadf0daed90 | 1cda9a251637d703f05365e42a6a1212264a0f2d | /test/funciones/InsertarElementoTest.java | 7377bdf2c842241466bf97421521342ea3ad6a60 | [] | no_license | magasuan/ProyectoRoberto | 4f9d8f22b6a2d42588f4fc53d8b8b7535bdb3e4d | c94082a0f5a2fafa87260792563dba7c3d0e4dba | refs/heads/master | 2020-04-06T15:31:59.258506 | 2018-11-14T16:56:17 | 2018-11-14T16:56:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 118 | java | package funciones;
import static org.junit.Assert.*;
import org.junit.Test;
public class InsertarElementoTest {
}
| [
"[email protected]"
] | |
e85dab1d8e6c4d59acf9a516f736d3139b818b66 | 67edee3e41a288e11909305ae6323100f1e8e020 | /src/main/java/com/apap/tugas1/controller/JabatanController.java | 6bfa69b54a3c77d953bf4959d4018235a680846e | [] | no_license | Apap-2018/tugas1_1606888752 | 2ed9f05c8ff5116814fd84bc2fed429d38dedbbb | b1a6cba7bf0fecdcb14b6cd477b801386a95cdde | refs/heads/master | 2020-04-02T00:03:12.398720 | 2018-10-29T15:28:47 | 2018-10-29T15:28:47 | 153,786,350 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,409 | java | package com.apap.tugas1.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import com.apap.tugas1.model.JabatanModel;
import com.apap.tugas1.model.JabatanPegawaiModel;
import com.apap.tugas1.service.JabatanPegawaiService;
import com.apap.tugas1.service.JabatanService;
@Controller
public class JabatanController {
@Autowired
private JabatanService jabatanService;
@Autowired
private JabatanPegawaiService jabatanPegawaiService;
@RequestMapping(value = "/jabatan/view", method = RequestMethod.GET)
public String viewJabatan (@RequestParam(value = "idJabatan") Long idJabatan, Model model) {
JabatanModel jabatan = jabatanService.getJabatanDetailById(idJabatan).get();
model.addAttribute("jabatan", jabatan);
return "view-jabatan";
}
@RequestMapping(value = "/jabatan/viewall", method = RequestMethod.GET)
public String viewAllJabatan (Model model) {
List<JabatanModel> listJabatan = jabatanService.getAllJabatan();
model.addAttribute("listJabatan", listJabatan);
Map<JabatanModel, Integer> data = new HashMap<JabatanModel, Integer>();
for(JabatanModel jabatan : listJabatan) {
data.put(jabatan, 0);
}
List<JabatanPegawaiModel> listJabatanPegawai = jabatanPegawaiService.getAllJabatan();
for(JabatanPegawaiModel jabatanPegawai : listJabatanPegawai) {
if(data.containsKey(jabatanPegawai.getJabatan())) {
data.put(jabatanPegawai.getJabatan(), data.get(jabatanPegawai.getJabatan())+1);
}
}
model.addAttribute("data", data);
return "view-all-jabatan";
}
@RequestMapping(value = "/jabatan/tambah", method = RequestMethod.GET)
public String tambahJabatan (Model model) {
model.addAttribute("jabatan", new JabatanModel());
return "add-jabatan";
}
@RequestMapping(value = "/jabatan/tambah", method = RequestMethod.POST)
public String tambahJabatan (Model model, @ModelAttribute JabatanModel jabatan) {
jabatanService.addJabatan(jabatan);
String url = "redirect:/jabatan/view?idJabatan=" + jabatan.getId();
return url;
}
@RequestMapping(value = "/jabatan/ubah", method = RequestMethod.GET)
public String ubahJabatan (@RequestParam(value = "idJabatan", required = true) Long idJabatan, Model model) {
JabatanModel jabatan = jabatanService.getJabatanDetailById(idJabatan).get();
model.addAttribute("jabatan", jabatan);
return "update-jabatan";
}
@RequestMapping(value = "/jabatan/ubah", method = RequestMethod.POST)
public String ubahJabatan (Model model, @ModelAttribute JabatanModel jabatan) {
jabatanService.updateJabatan(jabatan, jabatan.getId());
String url = "redirect:/jabatan/view?idJabatan=" + jabatan.getId();
return url;
}
@RequestMapping(value = "/jabatan/hapus", method = RequestMethod.POST)
public String hapusJabatan (Model model, @RequestParam(value = "idJabatan", required = true) Long idJabatan) {
try {
jabatanService.deleteJabatanById(idJabatan);
return "delete-jabatan-sukses";
}
catch (Exception ex) {
return "delete-jabatan-gagal";
}
}
}
| [
"[email protected]"
] | |
7095ae1073287a35ee5fac3ac5724f0175826f76 | c252da77359143bc24dbeef136484392f1508c64 | /src/test/java/com/pradeep/emsspringboot/EmsSpringBootV1ApplicationTests.java | 16db2f40482c21f9e26a7dc1aaf5921f2f9df523 | [] | no_license | Sameer021/EmpSringBootAppV1 | c4f5e8de8762da597329f947ecd95f53a6babf63 | 97880213b510f332361bf989b3372173914f8ddd | refs/heads/master | 2022-12-04T17:26:52.244054 | 2020-07-21T12:01:19 | 2020-07-21T12:01:19 | 281,013,851 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 226 | java | package com.pradeep.emsspringboot;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class EmsSpringBootV1ApplicationTests {
@Test
void contextLoads() {
}
}
| [
"[email protected]"
] | |
425717ce98ca85e6dd94033895cd8f8ac82eb1c8 | d45198c43802a699a10165e17d68a6eb7b0166fb | /app/src/main/java/com/socket/an2t/placingwidgets/fragmentsCommunication/BFragment.java | 743738b77625fc490a9bb5c289bd634bc3174aa3 | [] | no_license | anant00729/And_Basic_one | 8dfcb1948d810e7957c3076bf41e64f1433d243f | 9b7ab8aee5fcc7da6bc08ee2c75a059b44a33729 | refs/heads/master | 2020-03-26T23:39:34.497005 | 2018-08-31T13:43:43 | 2018-08-31T13:43:43 | 145,558,580 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,745 | java | package com.socket.an2t.placingwidgets.fragmentsCommunication;
import android.os.Bundle;
import android.support.annotation.NonNull;
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.TextView;
import com.socket.an2t.placingwidgets.R;
/**
* A simple {@link Fragment} subclass.
*/
public class BFragment extends Fragment {
public BFragment() {
// Required empty public constructor
}
public static BFragment newInstance(String msg){
BFragment fragment = new BFragment();
Bundle b = new Bundle();
b.putString("in_message", msg);
fragment.setArguments(b);
return fragment;
}
private TextView tv_message;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_b, container, false);
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
tv_message = getView().findViewById(R.id.tv_message);
Bundle b = this.getArguments();
String msg = b.getString("in_message");
tv_message.setText(msg);
}
public void getDataFromActivity(String message){
if (tv_message != null) {
tv_message.setText("The message is : " + message);
}else {
//Toast.makeText(getContext(), "You have not add the fragment", Toast.LENGTH_SHORT).show();
}
}
}
| [
"[email protected]"
] | |
d89ef126dd00458059da54e5c059e3cfee6f0c33 | 6ed9804e0ed4f4f4f218cfe0d760f85eb7b109f3 | /git/hudlauncher/hudEndPointPrimaryLauncher/src/main/java/com/haloai/hud/hudendpoint/upgrade/policy/PolicyInter.java | 8af239168b7afe4dfae17f8d8fe86c7da527e3ce | [] | no_license | gucasbrg/ArrayZhangWork | 1c821c1701d72af4ad55a97692c1a86b82bd5dcf | 2cfb6fdccf5e64ebd231c7074aa7d5311c627a20 | refs/heads/master | 2020-05-14T13:08:33.361505 | 2018-10-31T02:01:04 | 2018-10-31T02:01:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,326 | java | package com.haloai.hud.hudendpoint.upgrade.policy;
import android.content.Context;
/**
* Created by zhangrui on 16/12/13.
*/
public interface PolicyInter {
/**
* 下载对wifi要求
*
* @return true if need wifi.
*/
boolean is_request_wifi();
/**
* 下载对剩余空间的要求
*
* @param path 下载文件的父目录 绝对路径
* @return true if has more space
*/
boolean is_storage_space_enough(String path);
/**
* 升级包存放路径
*
* @return 所配置的路径,未做任何逻辑处理。若没有配,则返回null
*/
String get_storage_path();
boolean is_notify_pop();
boolean is_notification_always();
/**
* 升级电量要求,应该在返回true的时候,去升级
*
* @return false 配置了电量要求字段,并且当前手机电量小于配置电量,否则 true
*/
boolean is_battery_enough(Context ctx);
/**
* 下载完成后,是否强制升级
*
* @return
*/
boolean is_auto_upgrade();
/**
* 检测版本周期。单位:分钟。最小值60.
*
* @return -1:没有配置该项,-2:该项配置错误
*/
int get_check_cycle();
}
| [
"[email protected]"
] | |
fd7edfe7c19c23693ca45acf3087c7fafb9386aa | 7598e1de87cfa565e9dc24da60aaaa9c7abde245 | /apeclient/src/main/java/pl/michalek/marcin/apeclient/exception/client/initialization/NoConfigurationInterfaceProvidedException.java | d56a9565047f2e77bb76399bcbf25868d4e15be5 | [] | no_license | marcin-michalek/APE-Client | 08efc07ff1c28ec640897c53e906b5d4592c8391 | bb83f8edc39838cfcd70dbacfb3769774c8397f0 | refs/heads/master | 2021-01-10T07:54:22.748328 | 2015-10-18T12:54:00 | 2015-10-18T12:55:13 | 44,477,741 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 540 | java | package pl.michalek.marcin.apeclient.exception.client.initialization;
/**
* Exception thrown when user does not provide configuration class implementing configuration interface.
*
* @author Marcin Michałek
*/
public class NoConfigurationInterfaceProvidedException extends NoConfigurationProvidedException {
@Override
public String getMessage() {
return "You must provide non null configuration to APE Client. Configuration passed to APE Client must implement pl.michalek.marcin.apeclient.config.ConfigurationInterface";
}
}
| [
"[email protected]"
] | |
329a57309c342f4b95d4305fd6dd0731cc0f7c27 | 863c9cb281bfe387d847b575a077d42e0baa6a5a | /src/ch3/Input02.java | deb1549d804b69bfe8565664913d55a48eda83ad | [] | no_license | eunho3854/JAVASTUDY | 22271eb7b3a84668cc32d9461783169e5c99b4d9 | 4665108b2928755be53211e432e1a60b99c199da | refs/heads/master | 2023-01-20T04:42:09.144815 | 2020-12-01T08:46:24 | 2020-12-01T08:46:24 | 317,478,440 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 515 | java | package ch3;
import java.io.IOException;
import java.io.InputStream;
public class Input02 {
public static void main(String[] args) {
// I/O 장치 중에 Input되는 장치의 선에 접근해서
// 1Byte 데이터를 읽어주는 클래스
InputStream in = System.in; // 컴퓨터로 입력되는 선(키보드)
try {
int num = in.read();
System.out.println("입력받은 값 : " + num);
System.out.println((char)num);
} catch (IOException e) {
System.out.println("괜찮");
}
}
}
| [
"[email protected]"
] | |
51093c48ce959268f335290dae5977a950aa19bd | 0936e32579ca91793c16cb2ffac60c7975ff08d9 | /src/main/java/pl/sda/library/model/Book.java | 174a143ce75195f42e2be7c678480df9940bdc9b | [] | no_license | lukasz-ciupek/librarySpringBoot | f52407122d6597b76f9477c338ffd2c4c2a78c21 | 195c3a5e4ba6c3ca9fe5698e2e31295b15570764 | refs/heads/master | 2020-08-22T07:55:36.914685 | 2019-10-20T12:13:56 | 2019-10-20T12:13:56 | 216,352,573 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,718 | java | package pl.sda.library.model;
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.time.LocalDate;
import java.util.Objects;
public class Book {
private Integer id;
private String author;
private String title;
private LocalDate borrowedTill;
public Book(Integer id, String author, String title) {
this.id = id;
this.author = author;
this.title = title;
}
@JsonGetter
public Integer getId() {
return id;
}
@JsonIgnore
public void setId(Integer id) {
this.id = id;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@JsonGetter
public LocalDate getBorrowedTill() {
return borrowedTill;
}
@JsonIgnore
public void setBorrowedTill(LocalDate borrowedTill) {
this.borrowedTill = borrowedTill;
}
@Override
public String toString() {
return "Book{" +
"id=" + id +
", author='" + author + '\'' +
", title='" + title + '\'' +
", date=" + borrowedTill +
'}';
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null || getClass() != obj.getClass())
return false;
Book book = (Book) obj;
return id == book.id;
}
@Override
public int hashCode() {
return Objects.hash(id);
}
}
| [
"[email protected]"
] | |
6b1b07b2e8b9e5c7ffc6eec9c80057a0b1ee35d9 | 436105a332ee3da90b994e7abc7dbe707cd5a755 | /src/structure/LetterFile.java | e2e0157abc5a3241ccc9c0fce15be0d21d806e87 | [] | no_license | ycj28c/Abuse-Report-WebApp | 23754d68d9ca04a67a645cf3a26f207d84eddec0 | babed5184249eddbae4d86d72b14350725f221a0 | refs/heads/master | 2021-05-28T02:49:34.165564 | 2014-11-05T01:01:18 | 2014-11-05T01:01:18 | 17,345,211 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 704 | java | package structure;
public class LetterFile {
private String directionName;
private String oldName;
private String newName;
private String path;
public String getdirectionName(){
return this.directionName;
}
public void setdirectionName(String directionName){
this.directionName = directionName;
}
public String getoldName(){
return this.oldName;
}
public void setoldName(String oldName){
this.oldName = oldName;
}
public String getnewName(){
return this.newName;
}
public void setnewName(String newName){
this.newName = newName;
}
public String getpath(){
return this.path;
}
public void setpath(String path){
this.path = path;
}
}
| [
"[email protected]"
] | |
8be55a95ee4d78bd35943d5f0d3a738a327e7e05 | 004832e529873885f1559eb8c864384b3e1cda3f | /java/lineage2/gameserver/skills/effects/EffectChargesOverTime.java | a7bbad568f201ec768c796989021703341a0c927 | [] | no_license | wks1222/mobius-source | 02323e79316eabd4ce7e5b29f8cd5749c930d098 | 325a49fa23035f4d529e5a34b809b83c68d19cad | refs/heads/master | 2021-01-10T02:22:17.746138 | 2015-01-17T20:08:13 | 2015-01-17T20:08:13 | 36,601,733 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,077 | java | /*
* This program 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.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package lineage2.gameserver.skills.effects;
import lineage2.gameserver.model.Effect;
import lineage2.gameserver.network.serverpackets.SystemMessage;
import lineage2.gameserver.stats.Env;
/**
* @author Mobius
* @version $Revision: 1.0 $
*/
public class EffectChargesOverTime extends Effect
{
private final int _maxCharges;
/**
* Constructor for EffectChargesOverTime.
* @param env Env
* @param template EffectTemplate
*/
public EffectChargesOverTime(Env env, EffectTemplate template)
{
super(env, template);
_maxCharges = getTemplate().getParam().getInteger("maxCharges", 10);
}
/**
* Method onActionTime.
* @return boolean
*/
@Override
public boolean onActionTime()
{
if (_effected.isDead())
{
return false;
}
double damage = calc();
if (damage > (_effected.getCurrentHp() - 1))
{
if (!getSkill().isOffensive())
{
_effected.sendPacket(new SystemMessage(SystemMessage.NOT_ENOUGH_HP));
}
return false;
}
if (_effected.getIncreasedForce() >= _maxCharges)
{
_effected.sendPacket(new SystemMessage(SystemMessage.YOUR_FORCE_HAS_REACHED_MAXIMUM_CAPACITY_));
return false;
}
_effected.setIncreasedForce(_effected.getIncreasedForce() + 1);
_effected.reduceCurrentHp(damage, 0, _effector, getSkill(), false, false, true, false, false, true, false);
return true;
}
}
| [
"[email protected]"
] | |
a97f4991f727ae917b19429a7c18da13edc7a75f | 011029a8f69af8051d649c06e7919ae7f0e03bc2 | /work/nms.old.1603583427431/minecraft/server/EntityCat.java | 3148863984c9acb8611831551acc44bcab14f757 | [
"MIT"
] | permissive | Omnipico/PicoItemLib | 4dfeb71888a181062ae0778d76466a7e58d6e6de | b1c0deee8652dbc7d2b28cbf44637c94731b7c32 | refs/heads/main | 2023-02-02T18:46:59.394176 | 2020-12-23T22:21:21 | 2020-12-23T22:21:21 | 308,218,171 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,420 | java | package net.minecraft.server;
import com.google.common.collect.Maps;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.function.Predicate;
import javax.annotation.Nullable;
public class EntityCat extends EntityTameableAnimal {
private static final RecipeItemStack br = RecipeItemStack.a(Items.COD, Items.SALMON);
private static final DataWatcherObject<Integer> bs = DataWatcher.a(EntityCat.class, DataWatcherRegistry.b);
private static final DataWatcherObject<Boolean> bt = DataWatcher.a(EntityCat.class, DataWatcherRegistry.i);
private static final DataWatcherObject<Boolean> bu = DataWatcher.a(EntityCat.class, DataWatcherRegistry.i);
private static final DataWatcherObject<Integer> bv = DataWatcher.a(EntityCat.class, DataWatcherRegistry.b);
public static final Map<Integer, MinecraftKey> bq = (Map) SystemUtils.a(Maps.newHashMap(), (hashmap) -> { // CraftBukkit - decompile error
hashmap.put(0, new MinecraftKey("textures/entity/cat/tabby.png"));
hashmap.put(1, new MinecraftKey("textures/entity/cat/black.png"));
hashmap.put(2, new MinecraftKey("textures/entity/cat/red.png"));
hashmap.put(3, new MinecraftKey("textures/entity/cat/siamese.png"));
hashmap.put(4, new MinecraftKey("textures/entity/cat/british_shorthair.png"));
hashmap.put(5, new MinecraftKey("textures/entity/cat/calico.png"));
hashmap.put(6, new MinecraftKey("textures/entity/cat/persian.png"));
hashmap.put(7, new MinecraftKey("textures/entity/cat/ragdoll.png"));
hashmap.put(8, new MinecraftKey("textures/entity/cat/white.png"));
hashmap.put(9, new MinecraftKey("textures/entity/cat/jellie.png"));
hashmap.put(10, new MinecraftKey("textures/entity/cat/all_black.png"));
});
private EntityCat.a<EntityHuman> bw;
private PathfinderGoalTempt bx;
private float by;
private float bz;
private float bA;
private float bB;
private float bC;
private float bD;
public EntityCat(EntityTypes<? extends EntityCat> entitytypes, World world) {
super(entitytypes, world);
}
public MinecraftKey eU() {
return (MinecraftKey) EntityCat.bq.getOrDefault(this.getCatType(), EntityCat.bq.get(0));
}
@Override
protected void initPathfinder() {
this.bx = new EntityCat.PathfinderGoalTemptChance(this, 0.6D, EntityCat.br, true);
this.goalSelector.a(1, new PathfinderGoalFloat(this));
this.goalSelector.a(1, new PathfinderGoalSit(this));
this.goalSelector.a(2, new EntityCat.b(this));
this.goalSelector.a(3, this.bx);
this.goalSelector.a(5, new PathfinderGoalCatSitOnBed(this, 1.1D, 8));
this.goalSelector.a(6, new PathfinderGoalFollowOwner(this, 1.0D, 10.0F, 5.0F, false));
this.goalSelector.a(7, new PathfinderGoalJumpOnBlock(this, 0.8D));
this.goalSelector.a(8, new PathfinderGoalLeapAtTarget(this, 0.3F));
this.goalSelector.a(9, new PathfinderGoalOcelotAttack(this));
this.goalSelector.a(10, new PathfinderGoalBreed(this, 0.8D));
this.goalSelector.a(11, new PathfinderGoalRandomStrollLand(this, 0.8D, 1.0000001E-5F));
this.goalSelector.a(12, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 10.0F));
this.targetSelector.a(1, new PathfinderGoalRandomTargetNonTamed<>(this, EntityRabbit.class, false, (Predicate) null));
this.targetSelector.a(1, new PathfinderGoalRandomTargetNonTamed<>(this, EntityTurtle.class, false, EntityTurtle.bo));
}
public int getCatType() {
return (Integer) this.datawatcher.get(EntityCat.bs);
}
public void setCatType(int i) {
if (i < 0 || i >= 11) {
i = this.random.nextInt(10);
}
this.datawatcher.set(EntityCat.bs, i);
}
public void x(boolean flag) {
this.datawatcher.set(EntityCat.bt, flag);
}
public boolean eW() {
return (Boolean) this.datawatcher.get(EntityCat.bt);
}
public void y(boolean flag) {
this.datawatcher.set(EntityCat.bu, flag);
}
public boolean eX() {
return (Boolean) this.datawatcher.get(EntityCat.bu);
}
public EnumColor getCollarColor() {
return EnumColor.fromColorIndex((Integer) this.datawatcher.get(EntityCat.bv));
}
public void setCollarColor(EnumColor enumcolor) {
this.datawatcher.set(EntityCat.bv, enumcolor.getColorIndex());
}
@Override
protected void initDatawatcher() {
super.initDatawatcher();
this.datawatcher.register(EntityCat.bs, 1);
this.datawatcher.register(EntityCat.bt, false);
this.datawatcher.register(EntityCat.bu, false);
this.datawatcher.register(EntityCat.bv, EnumColor.RED.getColorIndex());
}
@Override
public void saveData(NBTTagCompound nbttagcompound) {
super.saveData(nbttagcompound);
nbttagcompound.setInt("CatType", this.getCatType());
nbttagcompound.setByte("CollarColor", (byte) this.getCollarColor().getColorIndex());
}
@Override
public void loadData(NBTTagCompound nbttagcompound) {
super.loadData(nbttagcompound);
this.setCatType(nbttagcompound.getInt("CatType"));
if (nbttagcompound.hasKeyOfType("CollarColor", 99)) {
this.setCollarColor(EnumColor.fromColorIndex(nbttagcompound.getInt("CollarColor")));
}
}
@Override
public void mobTick() {
if (this.getControllerMove().b()) {
double d0 = this.getControllerMove().c();
if (d0 == 0.6D) {
this.setPose(EntityPose.CROUCHING);
this.setSprinting(false);
} else if (d0 == 1.33D) {
this.setPose(EntityPose.STANDING);
this.setSprinting(true);
} else {
this.setPose(EntityPose.STANDING);
this.setSprinting(false);
}
} else {
this.setPose(EntityPose.STANDING);
this.setSprinting(false);
}
}
@Nullable
@Override
protected SoundEffect getSoundAmbient() {
return this.isTamed() ? (this.isInLove() ? SoundEffects.ENTITY_CAT_PURR : (this.random.nextInt(4) == 0 ? SoundEffects.ENTITY_CAT_PURREOW : SoundEffects.ENTITY_CAT_AMBIENT)) : SoundEffects.ENTITY_CAT_STRAY_AMBIENT;
}
@Override
public int D() {
return 120;
}
public void eZ() {
this.playSound(SoundEffects.ENTITY_CAT_HISS, this.getSoundVolume(), this.dG());
}
@Override
protected SoundEffect getSoundHurt(DamageSource damagesource) {
return SoundEffects.ENTITY_CAT_HURT;
}
@Override
protected SoundEffect getSoundDeath() {
return SoundEffects.ENTITY_CAT_DEATH;
}
public static AttributeProvider.Builder fa() {
return EntityInsentient.p().a(GenericAttributes.MAX_HEALTH, 10.0D).a(GenericAttributes.MOVEMENT_SPEED, 0.30000001192092896D).a(GenericAttributes.ATTACK_DAMAGE, 3.0D);
}
@Override
public boolean b(float f, float f1) {
return false;
}
@Override
protected void a(EntityHuman entityhuman, ItemStack itemstack) {
if (this.k(itemstack)) {
this.playSound(SoundEffects.ENTITY_CAT_EAT, 1.0F, 1.0F);
}
super.a(entityhuman, itemstack);
}
private float fb() {
return (float) this.b(GenericAttributes.ATTACK_DAMAGE);
}
@Override
public boolean attackEntity(Entity entity) {
return entity.damageEntity(DamageSource.mobAttack(this), this.fb());
}
@Override
public void tick() {
super.tick();
if (this.bx != null && this.bx.h() && !this.isTamed() && this.ticksLived % 100 == 0) {
this.playSound(SoundEffects.ENTITY_CAT_BEG_FOR_FOOD, 1.0F, 1.0F);
}
this.fc();
}
private void fc() {
if ((this.eW() || this.eX()) && this.ticksLived % 5 == 0) {
this.playSound(SoundEffects.ENTITY_CAT_PURR, 0.6F + 0.4F * (this.random.nextFloat() - this.random.nextFloat()), 1.0F);
}
this.fd();
this.fe();
}
private void fd() {
this.bz = this.by;
this.bB = this.bA;
if (this.eW()) {
this.by = Math.min(1.0F, this.by + 0.15F);
this.bA = Math.min(1.0F, this.bA + 0.08F);
} else {
this.by = Math.max(0.0F, this.by - 0.22F);
this.bA = Math.max(0.0F, this.bA - 0.13F);
}
}
private void fe() {
this.bD = this.bC;
if (this.eX()) {
this.bC = Math.min(1.0F, this.bC + 0.1F);
} else {
this.bC = Math.max(0.0F, this.bC - 0.13F);
}
}
@Override
public EntityCat createChild(WorldServer worldserver, EntityAgeable entityageable) {
EntityCat entitycat = (EntityCat) EntityTypes.CAT.a((World) worldserver);
if (entityageable instanceof EntityCat) {
if (this.random.nextBoolean()) {
entitycat.setCatType(this.getCatType());
} else {
entitycat.setCatType(((EntityCat) entityageable).getCatType());
}
if (this.isTamed()) {
entitycat.setOwnerUUID(this.getOwnerUUID());
entitycat.setTamed(true);
if (this.random.nextBoolean()) {
entitycat.setCollarColor(this.getCollarColor());
} else {
entitycat.setCollarColor(((EntityCat) entityageable).getCollarColor());
}
}
}
return entitycat;
}
@Override
public boolean mate(EntityAnimal entityanimal) {
if (!this.isTamed()) {
return false;
} else if (!(entityanimal instanceof EntityCat)) {
return false;
} else {
EntityCat entitycat = (EntityCat) entityanimal;
return entitycat.isTamed() && super.mate(entityanimal);
}
}
@Nullable
@Override
public GroupDataEntity prepare(WorldAccess worldaccess, DifficultyDamageScaler difficultydamagescaler, EnumMobSpawn enummobspawn, @Nullable GroupDataEntity groupdataentity, @Nullable NBTTagCompound nbttagcompound) {
groupdataentity = super.prepare(worldaccess, difficultydamagescaler, enummobspawn, groupdataentity, nbttagcompound);
if (worldaccess.ae() > 0.9F) {
this.setCatType(this.random.nextInt(11));
} else {
this.setCatType(this.random.nextInt(10));
}
WorldServer worldserver = worldaccess.getMinecraftWorld();
if (worldserver instanceof WorldServer && ((WorldServer) worldserver).getStructureManager().a(this.getChunkCoordinates(), true, StructureGenerator.SWAMP_HUT).e()) {
this.setCatType(10);
this.setPersistent();
}
return groupdataentity;
}
@Override
public EnumInteractionResult b(EntityHuman entityhuman, EnumHand enumhand) {
ItemStack itemstack = entityhuman.b(enumhand);
Item item = itemstack.getItem();
if (this.world.isClientSide) {
return this.isTamed() && this.i((EntityLiving) entityhuman) ? EnumInteractionResult.SUCCESS : (this.k(itemstack) && (this.getHealth() < this.getMaxHealth() || !this.isTamed()) ? EnumInteractionResult.SUCCESS : EnumInteractionResult.PASS);
} else {
EnumInteractionResult enuminteractionresult;
if (this.isTamed()) {
if (this.i((EntityLiving) entityhuman)) {
if (!(item instanceof ItemDye)) {
if (item.isFood() && this.k(itemstack) && this.getHealth() < this.getMaxHealth()) {
this.a(entityhuman, itemstack);
this.heal((float) item.getFoodInfo().getNutrition());
return EnumInteractionResult.CONSUME;
}
enuminteractionresult = super.b(entityhuman, enumhand);
if (!enuminteractionresult.a() || this.isBaby()) {
this.setWillSit(!this.isWillSit());
}
return enuminteractionresult;
}
EnumColor enumcolor = ((ItemDye) item).d();
if (enumcolor != this.getCollarColor()) {
this.setCollarColor(enumcolor);
if (!entityhuman.abilities.canInstantlyBuild) {
itemstack.subtract(1);
}
this.setPersistent();
return EnumInteractionResult.CONSUME;
}
}
} else if (this.k(itemstack)) {
this.a(entityhuman, itemstack);
if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) { // CraftBukkit
this.tame(entityhuman);
this.setWillSit(true);
this.world.broadcastEntityEffect(this, (byte) 7);
} else {
this.world.broadcastEntityEffect(this, (byte) 6);
}
this.setPersistent();
return EnumInteractionResult.CONSUME;
}
enuminteractionresult = super.b(entityhuman, enumhand);
if (enuminteractionresult.a()) {
this.setPersistent();
}
return enuminteractionresult;
}
}
@Override
public boolean k(ItemStack itemstack) {
return EntityCat.br.test(itemstack);
}
@Override
protected float b(EntityPose entitypose, EntitySize entitysize) {
return entitysize.height * 0.5F;
}
@Override
public boolean isTypeNotPersistent(double d0) {
return !this.isTamed() && this.ticksLived > 2400;
}
@Override
protected void eL() {
if (this.bw == null) {
this.bw = new EntityCat.a<>(this, EntityHuman.class, 16.0F, 0.8D, 1.33D);
}
this.goalSelector.a((PathfinderGoal) this.bw);
if (!this.isTamed()) {
this.goalSelector.a(4, this.bw);
}
}
static class b extends PathfinderGoal {
private final EntityCat a;
private EntityHuman b;
private BlockPosition c;
private int d;
public b(EntityCat entitycat) {
this.a = entitycat;
}
@Override
public boolean a() {
if (!this.a.isTamed()) {
return false;
} else if (this.a.isWillSit()) {
return false;
} else {
EntityLiving entityliving = this.a.getOwner();
if (entityliving instanceof EntityHuman) {
this.b = (EntityHuman) entityliving;
if (!entityliving.isSleeping()) {
return false;
}
if (this.a.h((Entity) this.b) > 100.0D) {
return false;
}
BlockPosition blockposition = this.b.getChunkCoordinates();
IBlockData iblockdata = this.a.world.getType(blockposition);
if (iblockdata.getBlock().a((Tag) TagsBlock.BEDS)) {
this.c = (BlockPosition) iblockdata.d(BlockBed.FACING).map((enumdirection) -> {
return blockposition.shift(enumdirection.opposite());
}).orElseGet(() -> {
return new BlockPosition(blockposition);
});
return !this.g();
}
}
return false;
}
}
private boolean g() {
List<EntityCat> list = this.a.world.a(EntityCat.class, (new AxisAlignedBB(this.c)).g(2.0D));
Iterator iterator = list.iterator();
EntityCat entitycat;
do {
do {
if (!iterator.hasNext()) {
return false;
}
entitycat = (EntityCat) iterator.next();
} while (entitycat == this.a);
} while (!entitycat.eW() && !entitycat.eX());
return true;
}
@Override
public boolean b() {
return this.a.isTamed() && !this.a.isWillSit() && this.b != null && this.b.isSleeping() && this.c != null && !this.g();
}
@Override
public void c() {
if (this.c != null) {
this.a.setSitting(false);
this.a.getNavigation().a((double) this.c.getX(), (double) this.c.getY(), (double) this.c.getZ(), 1.100000023841858D);
}
}
@Override
public void d() {
this.a.x(false);
float f = this.a.world.f(1.0F);
if (this.b.eB() >= 100 && (double) f > 0.77D && (double) f < 0.8D && (double) this.a.world.getRandom().nextFloat() < 0.7D) {
this.h();
}
this.d = 0;
this.a.y(false);
this.a.getNavigation().o();
}
private void h() {
Random random = this.a.getRandom();
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
blockposition_mutableblockposition.g(this.a.getChunkCoordinates());
this.a.a((double) (blockposition_mutableblockposition.getX() + random.nextInt(11) - 5), (double) (blockposition_mutableblockposition.getY() + random.nextInt(5) - 2), (double) (blockposition_mutableblockposition.getZ() + random.nextInt(11) - 5), false);
blockposition_mutableblockposition.g(this.a.getChunkCoordinates());
LootTable loottable = this.a.world.getMinecraftServer().getLootTableRegistry().getLootTable(LootTables.ak);
LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.a.world)).set(LootContextParameters.ORIGIN, this.a.getPositionVector()).set(LootContextParameters.THIS_ENTITY, this.a).a(random);
List<ItemStack> list = loottable.populateLoot(loottableinfo_builder.build(LootContextParameterSets.GIFT));
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
ItemStack itemstack = (ItemStack) iterator.next();
this.a.world.addEntity(new EntityItem(this.a.world, (double) blockposition_mutableblockposition.getX() - (double) MathHelper.sin(this.a.aA * 0.017453292F), (double) blockposition_mutableblockposition.getY(), (double) blockposition_mutableblockposition.getZ() + (double) MathHelper.cos(this.a.aA * 0.017453292F), itemstack));
}
}
@Override
public void e() {
if (this.b != null && this.c != null) {
this.a.setSitting(false);
this.a.getNavigation().a((double) this.c.getX(), (double) this.c.getY(), (double) this.c.getZ(), 1.100000023841858D);
if (this.a.h((Entity) this.b) < 2.5D) {
++this.d;
if (this.d > 16) {
this.a.x(true);
this.a.y(false);
} else {
this.a.a((Entity) this.b, 45.0F, 45.0F);
this.a.y(true);
}
} else {
this.a.x(false);
}
}
}
}
static class PathfinderGoalTemptChance extends PathfinderGoalTempt {
@Nullable
private EntityLiving chosenTarget; // CraftBukkit
private final EntityCat d;
public PathfinderGoalTemptChance(EntityCat entitycat, double d0, RecipeItemStack recipeitemstack, boolean flag) {
super(entitycat, d0, recipeitemstack, flag);
this.d = entitycat;
}
@Override
public void e() {
super.e();
if (this.chosenTarget == null && this.a.getRandom().nextInt(600) == 0) {
this.chosenTarget = this.target;
} else if (this.a.getRandom().nextInt(500) == 0) {
this.chosenTarget = null;
}
}
@Override
protected boolean g() {
return this.chosenTarget != null && this.chosenTarget.equals(this.target) ? false : super.g();
}
@Override
public boolean a() {
return super.a() && !this.d.isTamed();
}
}
static class a<T extends EntityLiving> extends PathfinderGoalAvoidTarget<T> {
private final EntityCat i;
public a(EntityCat entitycat, Class<T> oclass, float f, double d0, double d1) {
// Predicate predicate = IEntitySelector.e; // CraftBukkit - decompile error
super(entitycat, oclass, f, d0, d1, IEntitySelector.e::test); // CraftBukkit - decompile error
this.i = entitycat;
}
@Override
public boolean a() {
return !this.i.isTamed() && super.a();
}
@Override
public boolean b() {
return !this.i.isTamed() && super.b();
}
}
}
| [
"[email protected]"
] | |
5c9f3a64c5ce375c04853000d4734cedc270e2b5 | b3caa557c9ff034a8191f81f59d0b9e4bc82b08f | /ProjectEuler06.java | 1613df8e6d7bc33feaf59bb361566642a4b5051d | [] | no_license | demetriushenry/ProjectEuler-Resolutions | f0e3570e4563998a814d5a93677884ab2a72fa5b | aa0491c43cd173f568f2cb9f50db407725ef5cfa | refs/heads/master | 2021-01-20T08:34:19.303020 | 2017-08-27T23:02:29 | 2017-08-27T23:02:29 | 101,564,968 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 704 | java | import java.util.Scanner;
public class PE06SumSquareDifference {
static int getAbsoluteDifference(int num) {
int sumOfSquares = 0;
int sumOfNumbers = 0;
for (int i = 1; i <= num; i++) {
sumOfSquares += (int) Math.pow(i, 2);
sumOfNumbers += i;
}
return ((int) Math.pow(sumOfNumbers, 2) - sumOfSquares);
}
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t = Math.abs(in.nextInt());
t = t < 1 ? 1 : t;
int[] list = new int[t];
for (int i = 0; i < t; i++) {
int n = Math.abs(in.nextInt());
n = n < 1 ? 1 : n;
list[i] = getAbsoluteDifference(n);
}
for (int l : list) {
System.out.println("" + l);
}
in.close();
}
}
| [
"[email protected]"
] | |
2f3573fba172aeb93eb3bdd275f73cbc3996bf90 | afc09157fc9db83037814935c72462a893c4ae07 | /mybatis-common-example/src/main/java/com/mybatis/common/example/domain/criteria/PersonCriteria.java | c70a679d64993b29f9711b2fbeca3ce6b21c38f7 | [] | no_license | bruckuo/java-common-utils | 12d2217a253041c48d2588829dc935a6e04e3489 | 758cc7d5339adad8ff8a808aea030a4b093b4167 | refs/heads/master | 2021-01-21T15:58:13.408743 | 2017-05-20T06:21:15 | 2017-05-20T06:21:15 | 91,867,232 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 261 | java | package com.mybatis.common.example.domain.criteria;
import com.mybatis.common.example.domain.entity.PersonEntity;
/**
* @ description:
* @ author: guojiang.xiong
* @ created: 2017-05-20 下午12:14
*/
public class PersonCriteria extends PersonEntity {
}
| [
"[email protected]"
] | |
45c5cc91a7c771d8972e7fbca144e1af87841d00 | 62b6160a0941c7175d970e1e478eb5be6716f1bb | /miao/src/main/java/com/lqh/miao/mvp/model/imp/StatusListModelImp.java | 002ba5325866ab4ebd877dfb8247e6c0552b891f | [] | no_license | linqiaqia0622/Miaobo | 734e2ffdca3c02fb6fe87dc387a51cb1ce04d051 | 1350223422a56d514209e88bfc140bfb66430793 | refs/heads/master | 2020-07-05T17:03:49.195829 | 2016-08-20T09:21:16 | 2016-08-20T09:21:16 | 66,076,539 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,834 | java | package com.lqh.miao.mvp.model.imp;
import android.content.Context;
import android.text.TextUtils;
import com.lqh.miao.mvp.model.StatusListModel;
import com.lqh.miao.net.AccessTokenKeeper;
import com.lqh.miao.net.Constants;
import com.lqh.miao.net.NewFeature;
import com.lqh.miao.net.api.GroupAPI;
import com.lqh.miao.net.api.StatusesAPI;
import com.lqh.miao.net.entity.Status;
import com.lqh.miao.net.entity.list.StatusList;
import com.lqh.miao.utils.SDCardUtil;
import com.lqh.miao.utils.ToastUtil;
import com.sina.weibo.sdk.exception.WeiboException;
import com.sina.weibo.sdk.net.RequestListener;
import java.util.ArrayList;
import java.util.Timer;
import java.util.TimerTask;
/**
* Created by wenmingvs on 16/5/14.
*/
public class StatusListModelImp implements StatusListModel {
private static final int REFRESH_FRIENDS_TIMELINE_TASK = 15 * 60 * 1000;
private ArrayList<Status> mFriendsTimeline = new ArrayList<>();
private ArrayList<Status> mGroupList = new ArrayList<>();
private TimerTask mRefrshFriendsTimelineTask;
/**
* 当前的分组位置
*/
private long mCurrentPage = Constants.GROUP_TYPE_ALL;
/**
* 是否全局刷新
*/
private boolean mFirstLoad = true;
/**
* 是否需要重新刷新整个列表
*/
private boolean mRefrshFriendsTimeline;
@Override
public void friendsTimeline(final Context context, final OnDataFinishedListener onDataFinishedListener) {
setRefrshFriendsTimelineTask();
StatusesAPI mStatusesAPI = new StatusesAPI(context, Constants.APP_KEY, AccessTokenKeeper.readAccessToken(context));
long sinceId = 0;
if (mCurrentPage != Constants.GROUP_TYPE_ALL) {
mFirstLoad = true;
}
if (mFriendsTimeline.size() > 0 && mCurrentPage == Constants.GROUP_TYPE_ALL && mFirstLoad == false) {
sinceId = Long.valueOf(mFriendsTimeline.get(0).id);
}
if (mRefrshFriendsTimeline) {
sinceId = 0;
}
mCurrentPage = Constants.GROUP_TYPE_ALL;
mStatusesAPI.friendsTimeline(sinceId, 0, NewFeature.GET_WEIBO_NUMS, 1, false, 0, false, new RequestListener() {
@Override
public void onComplete(String response) {
ArrayList<Status> temp = StatusList.parse(response).statusList;
if (temp != null && temp.size() > 0) {
if (mFriendsTimeline != null) {
mFriendsTimeline.clear();
}
friendsTimelineCacheSave(context, response);
mFriendsTimeline = temp;
onDataFinishedListener.onDataFinish(mFriendsTimeline);
mFirstLoad = false;
} else {
if (mFirstLoad == false) {//局部刷新,get不到数据
//ToastUtil.showShort(context, "没有更新的内容了");
ToastUtil.showShort(context, "局部刷新,get不到数据");
onDataFinishedListener.noMoreData();
} else {//全局刷新,get不到数据
ToastUtil.showShort(context, "全局刷新,get不到数据");
onDataFinishedListener.noDataInFirstLoad();
}
}
mRefrshFriendsTimeline = false;
}
@Override
public void onWeiboException(WeiboException e) {
ToastUtil.showShort(context, e.getMessage());
onDataFinishedListener.onError(e.getMessage());
}
});
}
@Override
public void friendsTimelineNextPage(final Context context, final OnDataFinishedListener onRequestFinishedListener) {
setRefrshFriendsTimelineTask();
StatusesAPI mStatusesAPI = new StatusesAPI(context, Constants.APP_KEY, AccessTokenKeeper.readAccessToken(context));
final String maxId = mFriendsTimeline.get(mFriendsTimeline.size() - 1).id;
mStatusesAPI.friendsTimeline(0, Long.valueOf(maxId), NewFeature.LOADMORE_WEIBO_ITEM, 1, false, 0, false, new RequestListener() {
@Override
public void onComplete(String response) {
if (!TextUtils.isEmpty(response)) {
ArrayList<Status> temp = StatusList.parse(response).statusList;
if (temp.size() == 0 || (temp != null && temp.size() == 1 && temp.get(0).id.equals(maxId))) {
onRequestFinishedListener.noMoreData();
} else if (temp.size() > 1) {
temp.remove(0);
mFriendsTimeline.addAll(temp);
onRequestFinishedListener.onDataFinish(mFriendsTimeline);
}
} else {
onRequestFinishedListener.noMoreData();
}
}
@Override
public void onWeiboException(WeiboException e) {
ToastUtil.showShort(context, e.getMessage());
onRequestFinishedListener.onError(e.getMessage());
}
});
}
@Override
public void friendsTimelineCacheLoad(Context context, OnDataFinishedListener onDataFinishedListener) {
String response = SDCardUtil.get(context, SDCardUtil.getSDCardPath() + "/weiSwift/", "微博列表缓存_" + AccessTokenKeeper.readAccessToken(context).getUid() + ".txt");
if (response != null) {
ArrayList<Status> temp = StatusList.parse(response).statusList;
if (temp == null || temp.size() == 0) {
onDataFinishedListener.noMoreData();
} else {
mFriendsTimeline = temp;
mCurrentPage = Constants.GROUP_TYPE_ALL;
onDataFinishedListener.onDataFinish(mFriendsTimeline);
}
}
}
@Override
public void friendsTimelineCacheSave(Context context, String response) {
if (NewFeature.CACHE_WEIBOLIST) {
SDCardUtil.put(context, SDCardUtil.getSDCardPath() + "/weiSwift/", "微博列表缓存_" + AccessTokenKeeper.readAccessToken(context).getUid() + ".txt", response);
}
}
@Override
public void bilateralTimeline(final Context context, final OnDataFinishedListener onDataFinishedListener) {
setRefrshFriendsTimelineTask();
StatusesAPI mStatusesAPI = new StatusesAPI(context, Constants.APP_KEY, AccessTokenKeeper.readAccessToken(context));
long sinceId = 0;
if (mCurrentPage != Constants.GROUP_TYPE_FRIENDS_CIRCLE) {
mFirstLoad = true;
}
if (mFriendsTimeline.size() > 0 && mCurrentPage == Constants.GROUP_TYPE_FRIENDS_CIRCLE && mFirstLoad == false) {
sinceId = Long.valueOf(mFriendsTimeline.get(0).id);
}
if (mRefrshFriendsTimeline) {
sinceId = 0;
}
mCurrentPage = Constants.GROUP_TYPE_FRIENDS_CIRCLE;
mStatusesAPI.bilateralTimeline(sinceId, 0, NewFeature.GET_WEIBO_NUMS, 1, false, StatusesAPI.FEATURE_ORIGINAL, false, new RequestListener() {
@Override
public void onComplete(String response) {
ArrayList<Status> temp = StatusList.parse(response).statusList;
if (temp != null && temp.size() > 0) {
if (mFriendsTimeline != null) {
mFriendsTimeline.clear();
}
friendsTimelineCacheSave(context, response);
mFriendsTimeline = temp;
mFirstLoad = false;
onDataFinishedListener.onDataFinish(mFriendsTimeline);
} else {
if (mFirstLoad == false) {//局部刷新,get不到数据
ToastUtil.showShort(context, "没有更新的内容了");
onDataFinishedListener.noMoreData();
} else {//全局刷新,get不到数据
onDataFinishedListener.noDataInFirstLoad();
}
}
mRefrshFriendsTimeline = false;
}
@Override
public void onWeiboException(WeiboException e) {
ToastUtil.showShort(context, e.getMessage());
onDataFinishedListener.onError(e.getMessage());
}
});
}
@Override
public void bilateralTimelineNextPage(final Context context, final OnDataFinishedListener onDataFinishedListener) {
setRefrshFriendsTimelineTask();
StatusesAPI mStatusesAPI = new StatusesAPI(context, Constants.APP_KEY, AccessTokenKeeper.readAccessToken(context));
final String maxId = mFriendsTimeline.get(mFriendsTimeline.size() - 1).id;
mStatusesAPI.bilateralTimeline(0, Long.valueOf(maxId), NewFeature.LOADMORE_WEIBO_ITEM, 1, false, StatusesAPI.FEATURE_ORIGINAL, false, new RequestListener() {
@Override
public void onComplete(String response) {
if (!TextUtils.isEmpty(response)) {
ArrayList<Status> temp = StatusList.parse(response).statusList;
if (temp.size() == 0 || (temp != null && temp.size() == 1 && temp.get(0).id.equals(maxId))) {
onDataFinishedListener.noMoreData();
} else if (temp.size() > 1) {
temp.remove(0);
mFriendsTimeline.addAll(temp);
onDataFinishedListener.onDataFinish(mFriendsTimeline);
}
} else {
onDataFinishedListener.noMoreData();
}
}
@Override
public void onWeiboException(WeiboException e) {
ToastUtil.showShort(context, e.getMessage());
onDataFinishedListener.onError(e.getMessage());
}
});
}
@Override
public void timeline(long newGroupId, final Context context, final OnDataFinishedListener onDataFinishedListener) {
setRefrshFriendsTimelineTask();
GroupAPI groupAPI = new GroupAPI(context, Constants.APP_KEY, AccessTokenKeeper.readAccessToken(context));
long sinceId = 0;
if (mCurrentPage != newGroupId) {
mFirstLoad = true;
}
if (mGroupList.size() > 0 && mCurrentPage == newGroupId && mFirstLoad == false) {
sinceId = Long.valueOf(mGroupList.get(0).id);
}
if (mRefrshFriendsTimeline) {
sinceId = 0;
}
mCurrentPage = newGroupId;
groupAPI.timeline(newGroupId, sinceId, 0, NewFeature.GET_WEIBO_NUMS, 1, false, GroupAPI.FEATURE_ALL, new RequestListener() {
@Override
public void onComplete(String response) {
ArrayList<Status> temp = StatusList.parse(response).statusList;
if (temp != null && temp.size() > 0) {
if (mGroupList != null) {
mGroupList.clear();
}
mGroupList = temp;
mFirstLoad = false;
onDataFinishedListener.onDataFinish(mGroupList);
} else {
if (mFirstLoad == false) {//局部刷新,get不到数据
ToastUtil.showShort(context, "没有更新的内容了");
onDataFinishedListener.noMoreData();
} else {//全局刷新,get不到数据
onDataFinishedListener.noDataInFirstLoad();
}
}
mRefrshFriendsTimeline = false;
}
@Override
public void onWeiboException(WeiboException e) {
ToastUtil.showShort(context, e.getMessage());
onDataFinishedListener.onError(e.getMessage());
}
});
}
@Override
public void timelineNextPage(long groundId, final Context context, final OnDataFinishedListener onDataFinishedListener) {
GroupAPI groupAPI = new GroupAPI(context, Constants.APP_KEY, AccessTokenKeeper.readAccessToken(context));
setRefrshFriendsTimelineTask();
final String maxId = mGroupList.get(mGroupList.size() - 1).id;
groupAPI.timeline(groundId, 0, Long.valueOf(maxId), NewFeature.GET_WEIBO_NUMS, 1, false, GroupAPI.FEATURE_ALL, new RequestListener() {
@Override
public void onComplete(String response) {
if (!TextUtils.isEmpty(response)) {
ArrayList<Status> temp = StatusList.parse(response).statusList;
if (temp.size() == 0 || (temp != null && temp.size() == 1 && temp.get(0).id.equals(maxId))) {
onDataFinishedListener.noMoreData();
} else if (temp.size() > 1) {
temp.remove(0);
mGroupList.addAll(temp);
onDataFinishedListener.onDataFinish(mGroupList);
}
} else {
onDataFinishedListener.noMoreData();
}
}
@Override
public void onWeiboException(WeiboException e) {
ToastUtil.showShort(context, e.getMessage());
onDataFinishedListener.onError(e.getMessage());
}
});
}
public void setRefrshFriendsTimelineTask() {
if (mRefrshFriendsTimelineTask == null) {
mRefrshFriendsTimelineTask = new TimerTask() {
@Override
public void run() {
mRefrshFriendsTimeline = true;
}
};
new Timer().schedule(mRefrshFriendsTimelineTask, 0, REFRESH_FRIENDS_TIMELINE_TASK);
}
}
}
| [
"[email protected]"
] | |
ed11703160dcc2222fe4ed04d0e48939347f3d5f | 3f7a5d7c700199625ed2ab3250b939342abee9f1 | /src/gcom/gui/atendimentopublico/EfetuarReligacaoAguaAction.java | c91f7d1f8a79f126efc46defacf52d02939f8ba5 | [] | no_license | prodigasistemas/gsan-caema | 490cecbd2a784693de422d3a2033967d8063204d | 87a472e07e608c557e471d555563d71c76a56ec5 | refs/heads/master | 2021-01-01T06:05:09.920120 | 2014-10-08T20:10:40 | 2014-10-08T20:10:40 | 24,958,220 | 1 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 10,050 | java | /**
*
*/
/*
* Copyright (C) 2007-2007 the GSAN - Sistema Integrado de Gestão de Serviços de Saneamento
*
* This file is part of GSAN, an integrated service management system for Sanitation
*
* GSAN 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 2 of the License.
*
* GSAN is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
/*
* GSAN - Sistema Integrado de Gestão de Serviços de Saneamento
* Copyright (C) <2007>
* Adriano Britto Siqueira
* Alexandre Santos Cabral
* Ana Carolina Alves Breda
* Ana Maria Andrade Cavalcante
* Aryed Lins de Araújo
* Bruno Leonardo Rodrigues Barros
* Carlos Elmano Rodrigues Ferreira
* Cláudio de Andrade Lira
* Denys Guimarães Guenes Tavares
* Eduardo Breckenfeld da Rosa Borges
* Fabíola Gomes de Araújo
* Flávio Leonardo Cavalcanti Cordeiro
* Francisco do Nascimento Júnior
* Homero Sampaio Cavalcanti
* Ivan Sérgio da Silva Júnior
* José Edmar de Siqueira
* José Thiago Tenório Lopes
* Kássia Regina Silvestre de Albuquerque
* Leonardo Luiz Vieira da Silva
* Márcio Roberto Batista da Silva
* Maria de Fátima Sampaio Leite
* Micaela Maria Coelho de Araújo
* Nelson Mendonça de Carvalho
* Newton Morais e Silva
* Pedro Alexandre Santos da Silva Filho
* Rafael Corrêa Lima e Silva
* Rafael Francisco Pinto
* Rafael Koury Monteiro
* Rafael Palermo de Araújo
* Raphael Veras Rossiter
* Roberto Sobreira Barbalho
* Rodrigo Avellar Silveira
* Rosana Carvalho Barbosa
* Sávio Luiz de Andrade Cavalcante
* Tai Mu Shih
* Thiago Augusto Souza do Nascimento
* Tiago Moreno Rodrigues
* Vivianne Barbosa Sousa
*
* Este programa é software livre; você pode redistribuí-lo e/ou
* modificá-lo sob os termos de Licença Pública Geral GNU, conforme
* publicada pela Free Software Foundation; versão 2 da
* Licença.
* Este programa é distribuído na expectativa de ser útil, mas SEM
* QUALQUER GARANTIA; sem mesmo a garantia implícita de
* COMERCIALIZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM
* PARTICULAR. Consulte a Licença Pública Geral GNU para obter mais
* detalhes.
* Você deve ter recebido uma cópia da Licença Pública Geral GNU
* junto com este programa; se não, escreva para Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307, USA.
*/
package gcom.gui.atendimentopublico;
import gcom.atendimentopublico.bean.IntegracaoComercialHelper;
import gcom.atendimentopublico.ligacaoagua.LigacaoAgua;
import gcom.atendimentopublico.ordemservico.OrdemServico;
import gcom.atendimentopublico.ordemservico.ServicoNaoCobrancaMotivo;
import gcom.cadastro.imovel.Imovel;
import gcom.fachada.Fachada;
import gcom.gui.ActionServletException;
import gcom.gui.GcomAction;
import gcom.seguranca.acesso.usuario.Usuario;
import gcom.util.Util;
import java.math.BigDecimal;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
/**
* Descrição da classe
*
* @author Rômulo Aurélio
* @date 07/07/2006
*/
public class EfetuarReligacaoAguaAction extends GcomAction {
/**
* [UC0357] Efetuar Religação de Água
*
* Este caso de uso permite efetuar a religação de água, sendo chamada pela
* funcionalidade que encerra a execução da ordem de serviço ou chamada
* diretamente do menu.
*
* @param actionMapping
* Description of the Parameter
* @param actionForm
* Description of the Parameter
* @param httpServletRequest
* Description of the Parameter
* @param httpServletResponse
* Description of the Parameter
* @return Description of the Return Value
*/
public ActionForward execute(ActionMapping actionMapping,
ActionForm actionForm, HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse) {
// Seta o retorno
ActionForward retorno = actionMapping.findForward("telaSucesso");
// Obtém a instância da fachada
Fachada fachada = Fachada.getInstancia();
HttpSession sessao = httpServletRequest.getSession(false);
EfetuarReligacaoAguaActionForm efetuarReligacaoAguaActionForm = (EfetuarReligacaoAguaActionForm) actionForm;
// Usuario logado no sistema
Usuario usuario = (Usuario) sessao.getAttribute("usuarioLogado");
OrdemServico ordemServico = null;
Boolean veioEncerrarOS = null;
if (httpServletRequest.getAttribute("veioEncerrarOS") != null) {
veioEncerrarOS = Boolean.TRUE;
} else {
veioEncerrarOS = Boolean.FALSE;
}
if (sessao.getAttribute("ordemServico") == null) {
String idOrdemServico = efetuarReligacaoAguaActionForm
.getIdOrdemServico();
if (efetuarReligacaoAguaActionForm.getIdOrdemServico() != null) {
idOrdemServico = efetuarReligacaoAguaActionForm
.getIdOrdemServico();
} else {
idOrdemServico = (String) httpServletRequest
.getAttribute("veioEncerrarOS");
sessao
.setAttribute(
"caminhoRetornoIntegracaoComercial",
httpServletRequest
.getAttribute("caminhoRetornoIntegracaoComercial"));
}
if (idOrdemServico != null && !idOrdemServico.trim().equals("")) {
ordemServico = fachada.recuperaOSPorId(new Integer(
idOrdemServico));
if (ordemServico != null) {
fachada.validarExibirRestabelecimentoLigacaoAgua(
ordemServico, veioEncerrarOS);
} else {
throw new ActionServletException(
"atencao.ordem_servico.inexistente");
}
}
} else {
ordemServico = (OrdemServico) sessao.getAttribute("ordemServico");
}
//ordemServico = (OrdemServico) sessao.getAttribute("ordemServico");
String idServicoMotivoNaoCobranca = efetuarReligacaoAguaActionForm
.getMotivoNaoCobranca();
String valorPercentual = efetuarReligacaoAguaActionForm
.getPercentualCobranca();
String qtdParcelas = efetuarReligacaoAguaActionForm
.getQuantidadeParcelas();
if (ordemServico != null
&& efetuarReligacaoAguaActionForm.getIdTipoDebito() != null) {
ServicoNaoCobrancaMotivo servicoNaoCobrancaMotivo = null;
ordemServico.setIndicadorComercialAtualizado(new Short("1"));
BigDecimal valorAtual = new BigDecimal(0);
if (efetuarReligacaoAguaActionForm.getValorDebito() != null) {
String valorDebito = efetuarReligacaoAguaActionForm
.getValorDebito().toString().replace(".", "");
valorDebito = valorDebito.replace(",", ".");
valorAtual = new BigDecimal(valorDebito);
ordemServico.setValorAtual(valorAtual);
}
if (idServicoMotivoNaoCobranca != null) {
servicoNaoCobrancaMotivo = new ServicoNaoCobrancaMotivo();
servicoNaoCobrancaMotivo.setId(new Integer(
idServicoMotivoNaoCobranca));
}
ordemServico.setServicoNaoCobrancaMotivo(servicoNaoCobrancaMotivo);
if (valorPercentual != null) {
ordemServico
.setPercentualCobranca(new BigDecimal(
efetuarReligacaoAguaActionForm
.getPercentualCobranca()));
}
}
Imovel imovel = ordemServico.getRegistroAtendimento().getImovel();
LigacaoAgua ligacaoAgua = new LigacaoAgua();
// [FS0005] Verificar preenchimento dos Campos
// validar Data Corte
if (efetuarReligacaoAguaActionForm.getDataReligacao() != null
&& !efetuarReligacaoAguaActionForm.getDataReligacao()
.equals("")) {
Date data = Util
.converteStringParaDate(efetuarReligacaoAguaActionForm
.getDataReligacao());
ligacaoAgua.setId(imovel.getId());
ligacaoAgua.setDataReligacao(data);
} else {
throw new ActionServletException("atencao.informe_campo", null,
" Data da Ligação");
}
IntegracaoComercialHelper integracaoComercialHelper = new IntegracaoComercialHelper();
integracaoComercialHelper.setImovel(imovel);
integracaoComercialHelper.setLigacaoAgua(ligacaoAgua);
integracaoComercialHelper.setOrdemServico(ordemServico);
integracaoComercialHelper.setQtdParcelas(qtdParcelas);
integracaoComercialHelper.setUsuarioLogado(usuario);
if (efetuarReligacaoAguaActionForm.getVeioEncerrarOS()
.equalsIgnoreCase("FALSE") || (sessao.getAttribute("movimentarOS") != null && sessao.getAttribute("movimentarOS").equals("TRUE"))) {
integracaoComercialHelper.setVeioEncerrarOS(Boolean.FALSE);
fachada.efetuarReligacaoAgua(integracaoComercialHelper);
} else {
integracaoComercialHelper.setVeioEncerrarOS(Boolean.TRUE);
sessao.setAttribute("integracaoComercialHelper",
integracaoComercialHelper);
if (sessao.getAttribute("semMenu") == null) {
retorno = actionMapping
.findForward("encerrarOrdemServicoAction");
} else {
retorno = actionMapping
.findForward("encerrarOrdemServicoPopupAction");
}
sessao.removeAttribute("caminhoRetornoIntegracaoComercial");
}
// fachada.efetuarReligacaoAgua(ordemServico,
// efetuarReligacaoAguaActionForm.getVeioEncerrarOS());
if (retorno.getName().equalsIgnoreCase("telaSucesso")) {
montarPaginaSucesso(httpServletRequest,
"Religação de Água para o imóvel " + imovel.getId()
+ " efetuada com sucesso",
"Efetuar outra Religação de Água",
"exibirEfetuarReligacaoAguaAction.do?menu=sim");
}
return retorno;
}
}
| [
"[email protected]"
] | |
f0f5971de589801dbda609e8f7d2b68f5473cdbd | d55d09abde9fe1f2f21b7c93c03ed770289f210a | /adapterlib/src/main/java/cn/ffb/adapter/expand/IChildItemViewProviderSelector.java | 199ec9c0ad4a895f3f14b6e86be819d90f636e5b | [] | no_license | lingfei263/adapter | b274f36aac5fe56b9c5cb1bbadc0fe6b8e0139ef | a1eba1ab3bc5a781ffbcdae600c323ff8a9f5b60 | refs/heads/master | 2020-07-14T05:21:05.268657 | 2017-06-14T06:45:23 | 2017-06-14T06:45:23 | 94,298,723 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 229 | java | package cn.ffb.adapter.expand;
/**
* Created by lingfei on 2017/5/12.
*/
public interface IChildItemViewProviderSelector<G, C> {
boolean isForProvider(int groupPosition, G groupEntity, int childPosition, C childEntity);
}
| [
"[email protected]"
] | |
9656040e9f33e296be1a244691bb9b26c116b0fd | 47ca1283692dd1023e72cf8a07a73e134fcbceb0 | /app/src/main/java/com/guillaume/beaconsdemo/fragment_page_decouverte.java | 4cfe04074dd773007c6393259b9c94782836506c | [] | no_license | GuillaumeVrill/BeaconsDemo | 1acf239fcea89a7044bb27e3ca40375a69f4c4ee | b71f8706f7c842a7d1df2e0d67f923c46875675e | refs/heads/master | 2021-01-01T03:44:20.435301 | 2016-05-29T14:16:49 | 2016-05-29T14:16:49 | 58,806,784 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,119 | java | package com.guillaume.beaconsdemo;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.guillaume.beaconsdemo.R;
public class fragment_page_decouverte extends Fragment {
private TextView texte_decouverte;
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View mainView = inflater.inflate(R.layout.fragment_page_decouverte, container, false);
return mainView;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
} | [
"[email protected]"
] | |
dc8265e2f4ad6f3c27ba33751b48b83f3339dad3 | e0601ef164bca0aae41b2943347fe5641e72d793 | /EJERCICIOS PRO 02/Ejercicio08.java | af3dbb4944128126d859cf31b51399ce95995e0a | [] | no_license | Miguelgm1693/ejercicios-java | 767fb67dbf2cbc95469156e864da4c2ccafa34ab | 9d045859e700f03cf8caebdcfe0f519061da3036 | refs/heads/master | 2020-08-01T00:31:30.753219 | 2020-03-18T22:59:48 | 2020-03-18T22:59:48 | 210,800,305 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 311 | java | public class Ejercicio08 {
public static void main(String [] args) {
char letra1 = 'c';
char letra2 = 'o';
char letra3 = 'c';
char letra4 = 'h';
char letra5 = 'e';
String coche = "" + letra1 + letra2 + letra3 + letra4 + letra5;
System.out.println(coche);
}
}
| [
"[email protected]"
] | |
2efa0d00aa5f04380c822370d9195088a2dead44 | 689d490fdf37603cc11ee5c81374db50a3a89b14 | /src/test/java/org/testdata/SamplePrem.java | fbaa2ae510473c2a919ac4a0942905d1966c9fc3 | [] | no_license | GowriSubramaniam/SampleProjectGithub | 65aa5835183bee2d4519d21c81e2df0249bf862b | 59d9084cc82862d5b60a0b22ef59676eb61a0af2 | refs/heads/master | 2023-02-01T09:30:49.444293 | 2020-12-16T14:04:29 | 2020-12-16T14:04:29 | 321,954,547 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,063 | java | package org.testdata;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
public class SamplePrem {
public static void main(String[] args) throws InterruptedException {
System.setProperty("webdriver.chrome.driver",
"C:\\Users\\Lenovo\\eclipse-workspace\\MavenHotelapp\\driver\\chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.get("http://adactinhotelapp.com/");
driver.manage().window().maximize();
WebElement txtusr=driver.findElement(By.id("username"));
txtusr.sendKeys("KavithaGowri");
WebElement txtpass=driver.findElement(By.id("password"));
txtpass.sendKeys("arsika2016");
WebElement login=driver.findElement(By.id("login"));
login.click();
Thread.sleep(3000);
WebElement drlocation=driver.findElement(By.id("location"));
Select s=new Select(drlocation);
s.selectByVisibleText("London");
WebElement drhotel=driver.findElement(By.id("hotels"));
Select s1=new Select(drhotel);
s1.selectByValue("Hotel Sunshine");
WebElement room=driver.findElement(By.id("room_type"));
Select s2=new Select(room);
s2.selectByIndex(2);
WebElement roomnos=driver.findElement(By.id("room_nos"));
Select s3=new Select(roomnos);
s3.selectByValue("2");
WebElement datein=driver.findElement(By.id("datepick_in"));
datein.sendKeys("25/12/2010");
WebElement dateout=driver.findElement(By.id("datepick_out"));
dateout.sendKeys("27/12/2010");
WebElement adultroom=driver.findElement(By.id("adult_room"));
Select s4=new Select(adultroom);
s4.selectByValue("2");
WebElement childroom=driver.findElement(By.id("child_room"));
Select s5=new Select(childroom);
s5.selectByValue("1");
WebElement search=driver.findElement(By.id("Submit"));
search.click();
Thread.sleep(3000);
WebElement radio=driver.findElement(By.id("radiobutton_0"));
radio.click();
WebElement contine=driver.findElement(By.id("continue"));
contine.click();
driver.findElement(By.id("first_name")).sendKeys("Gowri");
driver.findElement(By.id("last_name")).sendKeys("Subramanian");
driver.findElement(By.id("address")).sendKeys("75/22-C,T.P Road, Annur");
driver.findElement(By.id("cc_num")).sendKeys("9876543210123456");
WebElement cardtype=driver.findElement(By.id("cc_type"));
Select s6=new Select(cardtype);
s6.selectByVisibleText("VISA");
WebElement expmnth=driver.findElement(By.id("cc_exp_month"));
Select s7=new Select(expmnth);
s7.selectByVisibleText("April");
WebElement expyr=driver.findElement(By.id("cc_exp_year"));
Select s8=new Select(expyr);
s8.selectByVisibleText("2022");
driver.findElement(By.id("cc_cvv")).sendKeys("852");
driver.findElement(By.id("book_now")).click();
Thread.sleep(5000);
WebElement orderno=driver.findElement(By.id("order_no"));
String txt=orderno.getAttribute("value");
System.out.println("order no is:-"+txt);
}
}
| [
"[email protected]"
] | |
c49cb45f5ef9237bdbd148ad44d0d6dcbea27230 | 26d615715778229bc68bac1b959bb5bbe83d5ce7 | /procmon/src/main/java/com/mlog/procmon/status/rx/ProcessStatusRxHandler.java | db5d2b2056c7f0515441abbb1c832cb981b979a1 | [] | no_license | jeongkijeong/procmon | 7fa0e22a73d8bf61ff840ebffc317ede5632ebfe | 082169ae6c470df676ba70d8b09f337395e3c856 | refs/heads/master | 2023-03-29T08:35:15.624058 | 2021-04-05T01:42:05 | 2021-04-05T01:42:05 | 353,609,707 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,556 | java | package com.mlog.procmon.status.rx;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import com.medialog.meerkat.handler.MeerKat;
import com.mlog.procmon.cli.CliManager;
import com.mlog.procmon.common.Utils;
import com.mlog.procmon.context.TimeHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelId;
public class ProcessStatusRxHandler extends TimeHandler implements MeerKat {
private Map<ChannelId, ChannelHandlerContext> connectdChannel = null;
public ProcessStatusRxHandler() {
super();
connectdChannel = new HashMap<ChannelId, ChannelHandlerContext>();
}
@Override
public void handler(Object object) {
if (object != null) {
String message = Utils.objectToJsonStr(object);
sendMessage(message);
}
}
@Override
public void channelActived(ChannelHandlerContext ctx) {
connectdChannel.put(ctx.channel().id(), ctx);
}
@Override
public void channelRemoved(ChannelHandlerContext ctx) {
connectdChannel.remove(ctx.channel().id());
}
@Override
public void recvMessage(String msg) {
if (msg == null || msg.length() == 0) {
return;
}
CliManager.getInstance().address(msg);
}
@Override
public void recvMessage(ChannelHandlerContext ctx, Object msg) {
recvMessage(msg.toString());
}
@Override
public void sendMessage(String msg) {
for (Entry<ChannelId, ChannelHandlerContext> entry : connectdChannel.entrySet()) {
ChannelHandlerContext context = entry.getValue();
if (context != null) {
context.writeAndFlush(msg);
}
}
}
}
| [
"[email protected]"
] | |
c35866f35b98c201108cd9dd5a734fc7b90c3ce8 | 9b8a19e9cb293cb6a01730c4530234cf8cb472b3 | /src/main/java/org/neustupov/concurrentcollections/blockingqueue/BlockingQueueDemo.java | 6359c40e28e97804dcf99714864e6e8b185e0ff1 | [] | no_license | neustupov/java-concurrency-in-practice | e7a14d2ef7759ab5bb4cf03c6452ec7b00f5ca56 | cf7073f49f3c319983b53a037e78f8c98d449fb4 | refs/heads/master | 2023-02-01T12:42:27.789652 | 2020-12-22T14:31:51 | 2020-12-22T14:31:51 | 308,053,248 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 679 | java | package org.neustupov.concurrentcollections.blockingqueue;
import java.io.File;
import java.io.FileFilter;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
public class BlockingQueueDemo {
private final static int N_CONSUMERS = 10;
public static void startIndexing(File[] roots) {
BlockingQueue<File> queue = new LinkedBlockingQueue<>();
FileFilter filter = pathname -> true;
for (File root : roots) {
new Thread(new FileCrawler(queue, filter, root)).start();
}
for (int i = 0; i < N_CONSUMERS; i++) {
new Thread(new Indexer(queue)).start();
}
}
}
| [
"[email protected]"
] | |
34794495c3c172c4dfc67ee7afc8a654c03eb651 | eed48435284f2dc4c145067a4a88b4f2b0078831 | /RotatingRotors.java | 463f27135696126ff5b5de060833ecdb978dbd1f | [] | no_license | atmcnally/McNallyEnigma | b9fc1c84b01a07fac0da5e7908ca6ffc8969ce93 | 5f2ba3570b6fd486869ef00b731e5b975d5ef6b2 | refs/heads/master | 2021-07-18T14:56:25.751381 | 2019-08-25T19:12:07 | 2019-08-25T19:12:07 | 91,354,746 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 38 | java |
public class RotatingRotors {
}
| [
"[email protected]"
] | |
f31abf66cde08e0c5fb27b808d62987f40b98e31 | ca735160ddbdb007195c7442832f4e725e083db4 | /src/main/java/TicTacToe/model/FieldState.java | f2515237c5e7148b5376175472e90cb10bd6d689 | [] | no_license | PawelSosulski/TicTacToe | fb9269e8bc917e8100860386849c3547fee44cbf | 0f41a3c4612d78b8b34021ca2222b6cc68f3e0b0 | refs/heads/master | 2020-12-21T22:24:37.366251 | 2020-01-27T19:57:57 | 2020-01-27T19:57:57 | 236,581,301 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 268 | java | package TicTacToe.model;
public enum FieldState {
EMPTY(" "),
X("X"),
O("O");
private String symbol;
FieldState(String symbol) {
this.symbol = symbol;
}
@Override
public String toString() {
return symbol;
}
}
| [
"[email protected]"
] | |
6dde24b2dff03973829c2135b244d75a0562bb08 | b01332bd1b0eac2adb901ce121b0ba481e82a126 | /beike/ops-goods/src/main/java/com/meitianhui/goods/controller/GoodsTaskController.java | 231f7bd10a68a599a96c48b2b9cb654a50f0d55a | [] | no_license | xlh198593/resin | 5783690411bd23723c27f942b9ebaa6b992c4c3b | 9632d32feaeeac3792118269552d3ff5ba976b39 | refs/heads/master | 2022-12-21T00:17:43.048802 | 2019-07-17T02:13:54 | 2019-07-17T02:13:54 | 81,401,320 | 0 | 2 | null | 2022-12-16T05:02:24 | 2017-02-09T02:49:12 | Java | UTF-8 | Java | false | false | 11,396 | java | package com.meitianhui.goods.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.meitianhui.base.controller.BaseController;
import com.meitianhui.common.constant.ResultData;
import com.meitianhui.common.exception.BusinessException;
import com.meitianhui.common.exception.SystemException;
import com.meitianhui.common.util.RedisLock;
import com.meitianhui.common.util.RedisUtil;
import com.meitianhui.common.util.StringUtil;
import com.meitianhui.goods.constant.RspCode;
import com.meitianhui.goods.service.GoodsTaskService;
/**
* 商品管理定时任务
*
* @author Tiny
*
*/
@Controller
@RequestMapping("/goodsTask")
public class GoodsTaskController extends BaseController {
@Autowired
public RedisUtil redisUtil;
@Autowired
private GoodsTaskService goodsTaskService;
@Override
public void operate(HttpServletRequest request, HttpServletResponse response, Map<String, Object> paramsMap,
ResultData result) throws BusinessException, SystemException, Exception {
try {
String operateName = request.getParameter("service");
if ("goods.couponStatusRefresh".equals(operateName)) {
couponStatusRefresh(paramsMap, result);
} else if ("goods.ldActivitiesStatusRefresh".equals(operateName)) {
ldActivitiesStatusRefresh(paramsMap, result);
} else if ("goods.goodsViewCountSave".equals(operateName)) {
goodsViewCountSave(paramsMap, result);
} else if ("goods.updateDisabledGcActivity".equals(operateName)) {
updateDisabledGcActivity(paramsMap, result);
} else if ("goods.plActivityStatusRefresh".equals(operateName)) {
plActivityStatusRefresh(paramsMap, result);
} else if ("goods.gdBenefitStatusRefresh".equals(operateName)) {
gdBenefitStatusRefresh(paramsMap, result);
} else if ("goods.gdActivityStatusRefresh".equals(operateName)) {
gdActivityStatusRefresh(paramsMap, result);
} else if ("goods.psGoodsAutoOffline".equals(operateName)) {
psGoodsAutoOffline(paramsMap, result);
} else if ("goods.psGoodsAutoFlashSale".equals(operateName)) {//自动刷新限时抢购的开卖时间
psGoodsAutoFlashSale(paramsMap, result);
} else {
throw new BusinessException(RspCode.SYSTEM_SERVICE_ERROR,
RspCode.MSG.get(RspCode.SYSTEM_SERVICE_ERROR));
}
} catch (BusinessException e) {
throw e;
} catch (SystemException e) {
throw e;
} catch (Exception e) {
throw e;
}
}
/**
* 刷新失效优惠券状态
* @Title: couponStatusRefresh
* @param paramsMap
* @param result
* @throws BusinessException
* @throws SystemException
* @throws Exception
* @author tiny
*/
public void couponStatusRefresh(Map<String, Object> paramsMap, ResultData result)
throws BusinessException, SystemException, Exception {
RedisLock lock = null;
String lockKey = "[task_couponStatusRefresh]";
try {
lock = new RedisLock(redisUtil, lockKey, 10 * 1000);
lock.lock();
String lockValue = redisUtil.getStr(lockKey);
if (StringUtil.isNotEmpty(lockValue)) {
return;
}
redisUtil.setStr(lockKey, lockKey, 600);
goodsTaskService.couponStatusRefresh(paramsMap, result);
} catch (BusinessException e) {
throw e;
} catch (SystemException e) {
throw e;
} catch (Exception e) {
throw e;
} finally {
if (lock != null) {
lock.unlock();
}
if (StringUtil.isNotEmpty(lockKey)) {
redisUtil.del(lockKey);
}
}
}
/**
* 活动揭晓
* @Title: ldActivitiesStatusRefresh
* @param paramsMap
* @param result
* @throws BusinessException
* @throws SystemException
* @throws Exception
* @author tiny
*/
public void ldActivitiesStatusRefresh(Map<String, Object> paramsMap, ResultData result)
throws BusinessException, SystemException, Exception {
RedisLock lock = null;
String lockKey = "[task_ldActivitiesStatusRefresh]";
try {
lock = new RedisLock(redisUtil, lockKey, 10 * 1000);
lock.lock();
String lockValue = redisUtil.getStr(lockKey);
if (StringUtil.isNotEmpty(lockValue)) {
return;
}
redisUtil.setStr(lockKey, lockKey, 600);
goodsTaskService.ldActivitiesStatusRefresh(paramsMap, result);
} catch (BusinessException e) {
throw e;
} catch (SystemException e) {
throw e;
} catch (Exception e) {
throw e;
} finally {
if (lock != null) {
lock.unlock();
}
if (StringUtil.isNotEmpty(lockKey)) {
redisUtil.del(lockKey);
}
}
}
/**
* 同步商品流量数量
* @Title: goodsViewCountSave
* @param paramsMap
* @param result
* @throws BusinessException
* @throws SystemException
* @throws Exception
* @author tiny
*/
public void goodsViewCountSave(Map<String, Object> paramsMap, ResultData result)
throws BusinessException, SystemException, Exception {
RedisLock lock = null;
String lockKey = "[task_goodsViewCountSave]";
try {
lock = new RedisLock(redisUtil, lockKey, 10 * 1000);
lock.lock();
String lockValue = redisUtil.getStr(lockKey);
if (StringUtil.isNotEmpty(lockValue)) {
return;
}
redisUtil.setStr(lockKey, lockKey, 600);
goodsTaskService.goodsViewCountSave(paramsMap, result);
} catch (BusinessException e) {
throw e;
} catch (SystemException e) {
throw e;
} catch (Exception e) {
throw e;
} finally {
if (lock != null) {
lock.unlock();
}
if (StringUtil.isNotEmpty(lockKey)) {
redisUtil.del(lockKey);
}
}
}
/***
* 处理过期红包
* @Title: updateDisabledGcActivity
* @param paramsMap
* @param result
* @throws BusinessException
* @throws SystemException
* @throws Exception
* @author tiny
*/
public void updateDisabledGcActivity(Map<String, Object> paramsMap, ResultData result)
throws BusinessException, SystemException, Exception {
RedisLock lock = null;
String lockKey = "[task_updateDisabledGcActivity]";
try {
lock = new RedisLock(redisUtil, lockKey, 10 * 1000);
lock.lock();
String lockValue = redisUtil.getStr(lockKey);
if (StringUtil.isNotEmpty(lockValue)) {
return;
}
redisUtil.setStr(lockKey, lockKey, 600);
goodsTaskService.updateDisabledGcActivity(paramsMap, result);
} catch (BusinessException e) {
throw e;
} catch (SystemException e) {
throw e;
} catch (Exception e) {
throw e;
} finally {
if (lock != null) {
lock.unlock();
}
if (StringUtil.isNotEmpty(lockKey)) {
redisUtil.del(lockKey);
}
}
}
/**
* 抽奖活动状态更新
* @Title: plActivityStatusRefresh
* @param paramsMap
* @param result
* @throws BusinessException
* @throws SystemException
* @throws Exception
* @author tiny
*/
public void plActivityStatusRefresh(Map<String, Object> paramsMap, ResultData result)
throws BusinessException, SystemException, Exception {
RedisLock lock = null;
String lockKey = "[task_plActivityStatusRefresh]";
try {
lock = new RedisLock(redisUtil, lockKey, 10 * 1000);
lock.lock();
String lockValue = redisUtil.getStr(lockKey);
if (StringUtil.isNotEmpty(lockValue)) {
return;
}
redisUtil.setStr(lockKey, lockKey, 600);
goodsTaskService.plActivityStatusRefresh(paramsMap, result);
} catch (BusinessException e) {
throw e;
} catch (SystemException e) {
throw e;
} catch (Exception e) {
throw e;
} finally {
if (lock != null) {
lock.unlock();
}
if (StringUtil.isNotEmpty(lockKey)) {
redisUtil.del(lockKey);
}
}
}
/**
* 权益劵状态刷新
* @Title: gdBenefitStatusRefresh
* @param paramsMap
* @param result
* @throws BusinessException
* @throws SystemException
* @throws Exception
* @author tiny
*/
public void gdBenefitStatusRefresh(Map<String, Object> paramsMap, ResultData result)
throws BusinessException, SystemException, Exception {
RedisLock lock = null;
String lockKey = "[task_gdBenefitStatusRefresh]";
try {
lock = new RedisLock(redisUtil, lockKey, 10 * 1000);
lock.lock();
String lockValue = redisUtil.getStr(lockKey);
if (StringUtil.isNotEmpty(lockValue)) {
return;
}
redisUtil.setStr(lockKey, lockKey, 600);
goodsTaskService.gdBenefitStatusRefresh(paramsMap, result);
} catch (BusinessException e) {
throw e;
} catch (SystemException e) {
throw e;
} catch (Exception e) {
throw e;
} finally {
if (lock != null) {
lock.unlock();
}
if (StringUtil.isNotEmpty(lockKey)) {
redisUtil.del(lockKey);
}
}
}
/**
* 权益活动状态刷新
* @Title: gdActivityStatusRefresh
* @param paramsMap
* @param result
* @throws BusinessException
* @throws SystemException
* @throws Exception
* @author tiny
*/
public void gdActivityStatusRefresh(Map<String, Object> paramsMap, ResultData result)
throws BusinessException, SystemException, Exception {
RedisLock lock = null;
String lockKey = "[task_gdActivityStatusRefresh]";
try {
lock = new RedisLock(redisUtil, lockKey, 10 * 1000);
lock.lock();
String lockValue = redisUtil.getStr(lockKey);
if (StringUtil.isNotEmpty(lockValue)) {
return;
}
redisUtil.setStr(lockKey, lockKey, 600);
goodsTaskService.gdActivityStatusRefresh(paramsMap, result);
} catch (BusinessException e) {
throw e;
} catch (SystemException e) {
throw e;
} catch (Exception e) {
throw e;
} finally {
if (lock != null) {
lock.unlock();
}
if (StringUtil.isNotEmpty(lockKey)) {
redisUtil.del(lockKey);
}
}
}
/**
* 商品自动下架
* @Title: psGoodsAutoOffline
* @param paramsMap
* @param result
* @throws BusinessException
* @throws SystemException
* @throws Exception
* @author tiny
*/
public void psGoodsAutoOffline(Map<String, Object> paramsMap, ResultData result)
throws BusinessException, SystemException, Exception {
RedisLock lock = null;
String lockKey = "[task_psGoodsAutoOffline]";
try {
lock = new RedisLock(redisUtil, lockKey, 10 * 1000);
lock.lock();
String lockValue = redisUtil.getStr(lockKey);
if (StringUtil.isNotEmpty(lockValue)) {
return;
}
redisUtil.setStr(lockKey, lockKey, 600);
goodsTaskService.psGoodsAutoOffline(paramsMap, result);
} catch (BusinessException e) {
throw e;
} catch (SystemException e) {
throw e;
} catch (Exception e) {
throw e;
} finally {
if (lock != null) {
lock.unlock();
}
if (StringUtil.isNotEmpty(lockKey)) {
redisUtil.del(lockKey);
}
}
}
/**
* 限时抢购商品(刷新开卖时间)
*/
public void psGoodsAutoFlashSale(Map<String, Object> paramsMap, ResultData result)
throws BusinessException, SystemException, Exception {
RedisLock lock = null;
String lockKey = "[task_psGoodsAutoFlashSale]";
try {
lock = new RedisLock(redisUtil, lockKey, 10 * 1000);
lock.lock();
String lockValue = redisUtil.getStr(lockKey);
if (StringUtil.isNotEmpty(lockValue)) {
return;
}
redisUtil.setStr(lockKey, lockKey, 600);
goodsTaskService.psGoodsAutoFlashSale(paramsMap, result);
} catch (BusinessException e) {
throw e;
} catch (SystemException e) {
throw e;
} catch (Exception e) {
throw e;
} finally {
if (lock != null) {
lock.unlock();
}
if (StringUtil.isNotEmpty(lockKey)) {
redisUtil.del(lockKey);
}
}
}
}
| [
"[email protected]"
] | |
eeea413d6dffc687167e61727af3ea4943fa99be | a2ba745f4cf3097f8fa8ef92cb07ec93828db7ce | /lab06/cm3038/lab06/tictactoe/test/TestApplyAction.java | fde2d049f09838d3e50867f124e12c70ff6dadd6 | [] | no_license | tenaciousQCR/CM3038-FixedLabs | 5cbac05b8fc79b6c13bf6a3c6b602d55ef361182 | 6483eeef9060626be1bc150d82f3d6e13926b28d | refs/heads/master | 2020-04-25T22:16:29.471489 | 2019-03-24T15:53:47 | 2019-03-24T15:53:47 | 173,106,037 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 800 | java | package cm3038.lab06.tictactoe.test;
import cm3038.lab06.tictactoe.*;
public class TestApplyAction {
public static void main(String[] arg) {
int[][] symbol = {
{1, 0, 2},
{0, 0, 0},
{2, 0, 1},
};
TttState before = new TttState(symbol); //create a state
TttAction action = new TttAction(2, 1, Symbol.CROSS); //create action
TttState after = before.applyAction(action); //apply action to create next state
System.out.println("Before:\n" + before.toString());
System.out.println("Action:\n" + action.toString() + "\n");
System.out.println("After:\n" + after.toString());
}
}
| [
"[email protected]"
] | |
0ab2fd3e3a26de30bd87db4c82172269df7b84a2 | 3692d418554148b1fb9747d24b35a1cbca1d5ea2 | /AudioGUI/src/net/pwojcik/audio/flowhandler/SceneChangeFlowHandler.java | 5743822aee057585af76b71eb398c673eabb1b48 | [] | no_license | PawelWojcik/Audio | 80ea4badaa3704027599ac475ef25131f354bcc4 | a8b0e582b53baf8aef4954cac6885acb3df4c6f4 | refs/heads/master | 2021-01-10T16:02:48.037437 | 2015-11-24T20:37:13 | 2015-11-24T20:37:13 | 45,799,399 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,483 | java | package net.pwojcik.audio.flowhandler;
import java.util.Collection;
import java.util.Optional;
import java.util.function.Predicate;
import javafx.scene.control.Label;
import javafx.scene.layout.Pane;
import net.pwojcik.audio.exception.CanvasDataContainerException;
import net.pwojcik.audio.flowdata.FlowData;
import net.pwojcik.audio.flowdata.FlowHandler;
import net.pwojcik.audio.flowdata.SceneChangeFlowData;
import net.pwojcik.audio.gui.ModuleNotFoundException;
import net.pwojcik.audio.module.CanvasDataContainer;
import net.pwojcik.audio.module.DesktopCanvasDataContainer;
import net.pwojcik.audio.module.Module;
/**
*
* FlowHandler implementation that is responsible for changing scene in application.
* As scene changing we consider changing module to that one, which provides it's own GUI panel.
* @author Pawel Wojcik
* @version 1.0
*/
public final class SceneChangeFlowHandler implements FlowHandler {
private static final int SECOND_ELEMENT_INDEX = 1;
private final Collection<Module> allModules;
private final Pane mainBox;
private final Label canvasTitle;
public SceneChangeFlowHandler(Collection<Module> modules, Pane box, Label title) {
allModules = modules;
mainBox = box;
canvasTitle = title;
}
@Override
public void handle(FlowData flowData) {
SceneChangeFlowData data = (SceneChangeFlowData) flowData;
String moduleType = data.getModuleType();
Optional<Module> coupledModule = allModules.stream().filter(areModuleTypesEqual(moduleType)).findFirst();
if (!coupledModule.isPresent()) {
throw new ModuleNotFoundException(moduleType);
}
Module module = coupledModule.get();
CanvasDataContainer canvasDataContainer = module.getCanvasDataContainer();
if(!(canvasDataContainer instanceof DesktopCanvasDataContainer)) {
throw new CanvasDataContainerException();
}
DesktopCanvasDataContainer<?> desktopDataContainer = (DesktopCanvasDataContainer<?>) canvasDataContainer;
canvasTitle.setText(desktopDataContainer.getCanvasLabel());
Pane moduleCanvas = desktopDataContainer.getCanvas();
moduleCanvas.setPrefWidth(mainBox.widthProperty().get());
moduleCanvas.setPrefHeight(mainBox.heightProperty().get());
mainBox.getChildren().remove(SECOND_ELEMENT_INDEX);
mainBox.getChildren().add(moduleCanvas);
}
private Predicate<? super Module> areModuleTypesEqual(String moduleType) {
return module -> module.getType().equals(moduleType);
}
}
| [
"[email protected]"
] | |
a263dbbb5651fe71619ec7848552cd5c295e250e | fdfa7fec9a1876f6af1f697daaca64cb86c943d4 | /chapter_007/src/main/java/ru/asemenov/NonBlocking/NonBlock.java | c72b647147ef6a8fa20081e8e7bf84cdc3f4d18d | [
"Apache-2.0"
] | permissive | Apeksi1990/asemenov | a574875606a9e4a6e0167426f03b765c931c8f96 | 853db63344f499d816e7d30598ca638792fdc401 | refs/heads/master | 2020-06-13T05:36:30.235847 | 2017-10-01T14:59:50 | 2017-10-01T14:59:50 | 75,487,184 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,186 | java | package ru.asemenov.NonBlocking;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* Class NonBlock решение задачи части 007.
* @author asemenov
* @version 1
* @param <K>
* @param <V>
*/
public class NonBlock<K, V extends Model> {
/**
* Cache.
*/
private final Map<K, V> cache = new ConcurrentHashMap<>();
/**
* Add model.
* @param key model.
* @param model model.
*/
public void add(K key, V model) {
this.cache.put(key, model);
}
/**
* Update model.
* @param key model.
*/
public void update(K key) {
int version = this.cache.get(key).getVersion();
if (version == this.cache.get(key).getVersion()) {
this.cache.get(key).setVersion();
} else {
throw new OplimisticException();
}
}
/**
* Delete.
* @param key model.
*/
public void delete(K key) {
this.cache.remove(key);
}
/**
* Get model.
* @param key model.
* @return model.toString.
*/
public String getModel(K key) {
return this.cache.get(key).toString();
}
}
| [
"[email protected]"
] | |
691d3d46ac864998dfcc5802e7097d4db3420810 | e55e953f7afabdd221039fc674df45aa5345b6a3 | /app/src/main/java/com/licheedev/MMSSNK/Constants.java | 105b0048dee041a73448fdffbe7e07741a394096 | [] | no_license | kietvo2129/MMSAppSNK | 0ff5e2c7d73cd9e77bce30daeb30dc7d45130128 | 2e732f2085e8ee12961242b0a87e376d82109837 | refs/heads/master | 2022-11-27T15:57:16.495620 | 2020-08-03T08:04:49 | 2020-08-03T08:04:49 | 284,640,244 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 521 | java | package com.licheedev.MMSSNK;
class Constants {
// values have to be globally unique
static final String INTENT_ACTION_DISCONNECT = BuildConfig.APPLICATION_ID + ".Disconnect";
static final String NOTIFICATION_CHANNEL = BuildConfig.APPLICATION_ID + ".Channel";
static final String INTENT_CLASS_MAIN_ACTIVITY = BuildConfig.APPLICATION_ID + ".MainActivity";
// values have to be unique within each app
static final int NOTIFY_MANAGER_START_FOREGROUND_SERVICE = 1001;
private Constants() {}
}
| [
"[email protected]"
] | |
da5db9303046864d1f2abea0747c33415e2aff7d | 0c154b9dfda500df8562efd6eafb98216dfa2e25 | /microservices/lmslibrarian/src/main/java/com/smoothstack/lmslibrarian/dao/BookDao.java | 9789955212669d9f99b3acbb666070d6b777861b | [] | no_license | jander23/gcit-training | a8bd909f482688a4610a5050ab62d37a4288ce57 | 693d9ce6321cd580e4340174aae2e1347936957c | refs/heads/master | 2020-03-28T15:02:31.169468 | 2018-09-24T09:08:56 | 2018-09-24T09:08:56 | 148,549,723 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 727 | java | package com.smoothstack.lmslibrarian.dao;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import com.smoothstack.lmslibrarian.model.Author;
import com.smoothstack.lmslibrarian.model.Book;
@Repository
public interface BookDao extends JpaRepository<Book, Integer> {
@Query("SELECT b FROM Book b WHERE b.title = ?1 AND b.publisher.publisherName = ?2 AND b.author.authorName = ?3")
List<Book> findAllByTitleAuthorNamePublisherName(String title, String publisherName, String authorName);
@Query("SELECT b FROM Book b WHERE b.author = ?1")
List<Book> findAllByAuthor(Author au);
}
| [
"[email protected]"
] | |
cadbe3c13ce217b46366b96bebb7a55990c2316a | 0ba903ad259e346fb880e78dcca23660be0dce4b | /wfe-core/src/main/java/ru/runa/wfe/commons/CalendarInterval.java | 35e44856cee1e7ade1b57691d03bca79466ac246 | [] | no_license | ARyaskov/runawfe-server | c61eaff10945c99a8dab423c55faa1b5b6159e1d | f721a7613da95b9dd3ac2bf5a86d3cac7bca683e | refs/heads/master | 2021-05-03T06:09:36.209627 | 2017-02-06T13:19:47 | 2017-02-06T13:19:47 | 70,156,281 | 0 | 0 | null | 2016-10-06T13:25:41 | 2016-10-06T13:25:41 | null | UTF-8 | Java | false | false | 7,118 | java | package ru.runa.wfe.commons;
import java.util.Calendar;
import java.util.Date;
import com.google.common.base.Objects;
/**
* Contains 2 calendars.
*
* @author dofs
*/
public class CalendarInterval implements Comparable<CalendarInterval> {
private Calendar from;
private Calendar to;
/**
* Creates new calendar interval for whole day.
*/
public CalendarInterval(Calendar onDate) {
from = CalendarUtil.getZeroTimeCalendar(onDate);
to = CalendarUtil.getLastSecondTimeCalendar(onDate);
}
/**
* Creates new calendar interval by dates.
*/
public CalendarInterval(Date from, Date to) {
this(from, to, false);
}
/**
* Creates new calendar interval by dates.
*
* @param expandTimeInBounds
* if <code>true</code> then from time will be set to 00:00:00 and to time to 23:59:59
*/
public CalendarInterval(Date from, Date to, boolean expandTimeInBounds) {
this(CalendarUtil.dateToCalendar(from), CalendarUtil.dateToCalendar(to), expandTimeInBounds);
}
/**
* Creates new calendar interval by calendars.
*/
public CalendarInterval(Calendar from, Calendar to) {
this(from, to, false);
}
/**
* Creates new calendar interval by calendars.
*
* @param expandTimeInBounds
* if <code>true</code> then from time will be set to 00:00:00 and to time to 23:59:59
*/
public CalendarInterval(Calendar from, Calendar to, boolean expandTimeInBounds) {
this.from = CalendarUtil.clone(from);
this.to = CalendarUtil.clone(to);
if (expandTimeInBounds) {
CalendarUtil.setZeroTimeCalendar(this.from);
CalendarUtil.setLastSecondTimeCalendar(this.to);
}
}
public Calendar getFrom() {
return from;
}
public Calendar getTo() {
return to;
}
public void setFrom(Calendar from) {
this.from = from;
}
public void setTo(Calendar to) {
this.to = to;
}
/**
* Check the right ordering of the dates
*/
public boolean isValid() {
return to.after(from);
}
public double getDaysBetween() {
return CalendarUtil.daysBetween(from, to);
}
/**
* by default it is inclusive operation
*/
public boolean contains(Calendar calendar) {
return !calendar.before(from) && !calendar.after(to);
}
public boolean contains(Calendar calendar, boolean inclusive) {
if (inclusive) {
return !calendar.before(from) && !calendar.after(to);
} else {
return calendar.after(from) && calendar.before(to);
}
}
public boolean contains(CalendarInterval interval, boolean inclusive) {
if (inclusive) {
return !interval.getFrom().before(from) && !interval.getTo().after(to);
} else {
return interval.getFrom().after(from) && interval.getTo().before(to);
}
}
public boolean intersects(CalendarInterval interval) {
return interval.getFrom().before(to) && interval.getTo().after(from);
}
// returns true if there's an intersection or a gap between intervals is
// smaller than the gapInMillis
public boolean intersectsWithGapScale(CalendarInterval interval, int gapInMillis) {
CalendarInterval gap = this.getGapBetweenNotIntersecting(interval);
if (gap == null) {
return true;
}
if (gap.getLengthInMillis() <= gapInMillis) {
return true;
}
return false;
}
public CalendarInterval intersect(CalendarInterval interval) {
if (from.before(interval.getFrom())) {
from.setTimeInMillis(interval.getFrom().getTimeInMillis());
}
if (to.after(interval.getTo())) {
to.setTimeInMillis(interval.getTo().getTimeInMillis());
}
return this;
}
public CalendarInterval getIntersection(CalendarInterval interval) {
CalendarInterval target = CalendarUtil.clone(this);
target.intersect(interval);
return target;
}
public CalendarInterval getGapBetweenNotIntersecting(CalendarInterval interval) {
if (this.intersects(interval)) {
return null;
}
Calendar gapFrom = Calendar.getInstance();
Calendar gapTo = Calendar.getInstance();
if (from.before(interval.getFrom())) {
gapFrom.setTime(to.getTime());
gapTo.setTime(interval.getFrom().getTime());
} else {
gapFrom.setTime(interval.getTo().getTime());
gapTo.setTime(from.getTime());
}
return new CalendarInterval(gapFrom, gapTo);
}
public long getLengthInMillis() {
if (from != null && to != null) {
return to.getTimeInMillis() - from.getTimeInMillis();
}
return 0;
}
public int getLengthInMinutes() {
long millis = getLengthInMillis();
return CalendarUtil.countMinutesFromMillis(millis);
}
public int getLengthInSeconds() {
long millis = getLengthInMillis();
return CalendarUtil.countSecondsFromMillis(millis);
}
@Override
public String toString() {
return CalendarUtil.format(from, CalendarUtil.DATE_WITH_HOUR_MINUTES_SECONDS_FORMAT) + "-"
+ CalendarUtil.format(to, CalendarUtil.DATE_WITH_HOUR_MINUTES_SECONDS_FORMAT);
}
public String toDateRangeString() {
return CalendarUtil.formatDate(from) + "-" + CalendarUtil.formatDate(to);
}
public String toTimeRangeString() {
return CalendarUtil.formatTime(from) + "-" + CalendarUtil.formatTime(to);
}
public boolean hasEqualDates(CalendarInterval o) {
if (from != null && o.getFrom() != null) {
if (!CalendarUtil.areCalendarsEqualIgnoringTime(from, o.from)) {
return false;
}
} else if (from == null && o.getFrom() != null) {
return false;
} else if (o.getFrom() == null && from != null) {
return false;
}
if (to != null && o.getTo() != null) {
if (!CalendarUtil.areCalendarsEqualIgnoringTime(to, o.to)) {
return false;
}
} else if (to == null && o.getTo() != null) {
return false;
} else if (o.getTo() == null && to != null) {
return false;
}
return true;
}
@Override
public int hashCode() {
return Objects.hashCode(from, to);
}
@Override
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof CalendarInterval)) {
return false;
}
CalendarInterval o = (CalendarInterval) obj;
return Objects.equal(from, o.from) && Objects.equal(to, o.to);
}
@Override
public int compareTo(CalendarInterval interval) {
int res = from.compareTo(interval.getFrom());
if (res == 0) {
res = to.compareTo(interval.getTo());
}
return res;
}
}
| [
"[email protected]"
] | |
7784be0053ac6f8777cfe47b13cf0f9a1eebedd6 | 0ac05e3da06d78292fdfb64141ead86ff6ca038f | /OSWE/oswe/openCRX/rtjar/rt.jar.src/sun/font/Script.java | 4a993eda610a2f79f0cc80d0371b9742e04fe7f1 | [] | no_license | qoo7972365/timmy | 31581cdcbb8858ac19a8bb7b773441a68b6c390a | 2fc8baba4f53d38dfe9c2b3afd89dcf87cbef578 | refs/heads/master | 2023-07-26T12:26:35.266587 | 2023-07-17T12:35:19 | 2023-07-17T12:35:19 | 353,889,195 | 7 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,307 | java | package sun.font;
public final class Script {
public static final int INVALID_CODE = -1;
public static final int COMMON = 0;
public static final int INHERITED = 1;
public static final int ARABIC = 2;
public static final int ARMENIAN = 3;
public static final int BENGALI = 4;
public static final int BOPOMOFO = 5;
public static final int CHEROKEE = 6;
public static final int COPTIC = 7;
public static final int CYRILLIC = 8;
public static final int DESERET = 9;
public static final int DEVANAGARI = 10;
public static final int ETHIOPIC = 11;
public static final int GEORGIAN = 12;
public static final int GOTHIC = 13;
public static final int GREEK = 14;
public static final int GUJARATI = 15;
public static final int GURMUKHI = 16;
public static final int HAN = 17;
public static final int HANGUL = 18;
public static final int HEBREW = 19;
public static final int HIRAGANA = 20;
public static final int KANNADA = 21;
public static final int KATAKANA = 22;
public static final int KHMER = 23;
public static final int LAO = 24;
public static final int LATIN = 25;
public static final int MALAYALAM = 26;
public static final int MONGOLIAN = 27;
public static final int MYANMAR = 28;
public static final int OGHAM = 29;
public static final int OLD_ITALIC = 30;
public static final int ORIYA = 31;
public static final int RUNIC = 32;
public static final int SINHALA = 33;
public static final int SYRIAC = 34;
public static final int TAMIL = 35;
public static final int TELUGU = 36;
public static final int THAANA = 37;
public static final int THAI = 38;
public static final int TIBETAN = 39;
public static final int CANADIAN_ABORIGINAL = 40;
public static final int UCAS = 40;
public static final int YI = 41;
public static final int TAGALOG = 42;
public static final int HANUNOO = 43;
public static final int BUHID = 44;
public static final int TAGBANWA = 45;
public static final int CODE_LIMIT = 46;
}
/* Location: /Users/timmy/timmy/OSWE/oswe/openCRX/rt.jar!/sun/font/Script.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/ | [
"t0984456716"
] | t0984456716 |
a60dd188d7891af651178fcb60fd36f3a9b5725f | 4ffe7afa578bfdc7b518a4d2fd7459953262b2b7 | /study-springboot-thread/src/main/java/ldg/study/springboot/thread/support/ExecuteSupport.java | 3f99ab7f67123a7ba9d00eac3352542baae30921 | [] | no_license | lidegui46/study-springBoot | 4ab80c57d501d3ff004dea808a4fda4ef945a953 | 178d99614ecdd4cc940ff89342a346792784e19e | refs/heads/master | 2022-12-26T05:10:26.192459 | 2019-09-03T06:36:28 | 2019-09-03T06:36:28 | 143,255,718 | 0 | 0 | null | 2022-12-16T07:58:23 | 2018-08-02T07:02:54 | Java | UTF-8 | Java | false | false | 3,415 | java | package ldg.study.springboot.thread.support;
import ldg.study.springboot.thread.service.ExecuteService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* 线程管理类
*
* @author foursix
* @since 2017/12/13
*/
@Service
public class ExecuteSupport implements ExecuteService {
private static Logger logger = LoggerFactory.getLogger(ExecuteSupport.class);
//CyclicBarrier、Semaphore、ConcurrentHashMap和BlockingQueue
/*
线程工具:
1、CountDownLatch
定义:
能够使一个线程等待其他线程完成各自的工作后再执行.
原理:
CountDownLatch是通过一个计数器来实现的,计数器的初始值为线程的数量。
每当一个线程完成了自己的任务后,计数器的值就会减1。
当计数器值到达0时,它表示所有的线程已经完成了任务,然后在闭锁上等待的线程就可以恢复执行任务。
线程池:
1、newFixedThreadPool
定义:固定大小的线程池(一个线程池最多可同时执行N个线程)
2、newSingleThreadExecutor
定义:单线程池,相当于FixedThreadPool(1)
3、newCachedThreadPool
定义:可变大小线程池,按照任务数来分配线程
4、newScheduledThreadPool
定义:
*/
/**
* 固定大小线程池
*/
@Override
public void newFixedThreadPool() {
//线程池:一个线程池只允许3个线程同时执行
ExecutorService executorService = Executors.newFixedThreadPool(3);
final int count = 10; //并发次数
//设置累计1000个线程数,只允许设置一次(同步等待结果,不加时为异步处理)
final CountDownLatch countDownLatch = new CountDownLatch(count);
for (int i = 1; i <= count; i++) {
final int j = i;
System.out.println("[线程 初始化]: begin " + i);
//初始化总线程数
executorService.execute(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(1000);
System.out.println("[线程 执行业务]: " + j + " " + System.currentTimeMillis());
} catch (Exception ex) {
}
//一个线程执行完成后,线程总数减1
countDownLatch.countDown();
}
});
System.out.println("[线程 初始化]: end" + i);
}
try {
System.out.println("[线程 初始化]: 等待线程执行完成");
countDownLatch.await();//当累计线程数据大于0时,阻塞; 当累计线程数为0时,释放
System.out.println("[线程 线程执行完成]: ");
executorService.shutdown();//关闭线程池
System.out.println("[线程 关闭线程池]: ");
} catch (Exception e) {
logger.error("被打断", e);
}
logger.info("执行完成了。。。");
}
}
| [
"[email protected]"
] | |
b6715faf02e6e6a723319e06c356d8a41c397d23 | 1d928c3f90d4a0a9a3919a804597aa0a4aab19a3 | /java/lucene-solr/2018/4/ContentStreamBase.java | 33860ff2c7608b8b14b2726341190a0f92627472 | [] | no_license | rosoareslv/SED99 | d8b2ff5811e7f0ffc59be066a5a0349a92cbb845 | a062c118f12b93172e31e8ca115ce3f871b64461 | refs/heads/main | 2023-02-22T21:59:02.703005 | 2021-01-28T19:40:51 | 2021-01-28T19:40:51 | 306,497,459 | 1 | 1 | null | 2020-11-24T20:56:18 | 2020-10-23T01:18:07 | null | UTF-8 | Java | false | false | 8,380 | 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.apache.solr.common.util;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.StandardCharsets;
import java.util.Locale;
import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.client.solrj.request.RequestWriter;
/**
* Three concrete implementations for ContentStream - one for File/URL/String
*
*
* @since solr 1.2
*/
public abstract class ContentStreamBase implements ContentStream
{
public static final String DEFAULT_CHARSET = StandardCharsets.UTF_8.name();
protected String name;
protected String sourceInfo;
protected String contentType;
protected Long size;
//---------------------------------------------------------------------
//---------------------------------------------------------------------
public static String getCharsetFromContentType( String contentType )
{
if( contentType != null ) {
int idx = contentType.toLowerCase(Locale.ROOT).indexOf( "charset=" );
if( idx > 0 ) {
return contentType.substring( idx + "charset=".length() ).trim();
}
}
return null;
}
//------------------------------------------------------------------------
//------------------------------------------------------------------------
/**
* Construct a <code>ContentStream</code> from a <code>URL</code>
*
* This uses a <code>URLConnection</code> to get the content stream
* @see URLConnection
*/
public static class URLStream extends ContentStreamBase
{
private final URL url;
public URLStream( URL url ) {
this.url = url;
sourceInfo = "url";
}
@Override
public InputStream getStream() throws IOException {
URLConnection conn = this.url.openConnection();
contentType = conn.getContentType();
name = url.toExternalForm();
size = new Long( conn.getContentLength() );
return conn.getInputStream();
}
}
/**
* Construct a <code>ContentStream</code> from a <code>File</code>
*/
public static class FileStream extends ContentStreamBase
{
private final File file;
public FileStream( File f ) {
file = f;
contentType = null; // ??
name = file.getName();
size = file.length();
sourceInfo = file.toURI().toString();
}
@Override
public String getContentType() {
if(contentType==null) {
// TODO: this is buggy... does not allow for whitespace, JSON comments, etc.
InputStream stream = null;
try {
stream = new FileInputStream(file);
char first = (char)stream.read();
if(first == '<') {
return "application/xml";
}
if(first == '{') {
return "application/json";
}
} catch(Exception ex) {
} finally {
if (stream != null) try {
stream.close();
} catch (IOException ioe) {}
}
}
return contentType;
}
@Override
public InputStream getStream() throws IOException {
return new FileInputStream( file );
}
}
/**
* Construct a <code>ContentStream</code> from a <code>String</code>
*/
public static class StringStream extends ContentStreamBase
{
private final String str;
public StringStream( String str ) {
this(str, detect(str));
}
public StringStream( String str, String contentType ) {
this.str = str;
this.contentType = contentType;
name = null;
try {
size = new Long( str.getBytes(DEFAULT_CHARSET).length );
} catch (UnsupportedEncodingException e) {
// won't happen
throw new RuntimeException(e);
}
sourceInfo = "string";
}
public static String detect(String str) {
String detectedContentType = null;
int lim = str.length() - 1;
for (int i=0; i<lim; i++) {
char ch = str.charAt(i);
if (Character.isWhitespace(ch)) {
continue;
}
// first non-whitespace chars
if (ch == '#' // single line comment
|| (ch == '/' && (str.charAt(i + 1) == '/' || str.charAt(i + 1) == '*')) // single line or multi-line comment
|| (ch == '{' || ch == '[') // start of JSON object
)
{
detectedContentType = "application/json";
} else if (ch == '<') {
detectedContentType = "text/xml";
}
break;
}
return detectedContentType;
}
@Override
public InputStream getStream() throws IOException {
return new ByteArrayInputStream( str.getBytes(DEFAULT_CHARSET) );
}
/**
* If an charset is defined (by the contentType) use that, otherwise
* use a StringReader
*/
@Override
public Reader getReader() throws IOException {
String charset = getCharsetFromContentType( contentType );
return charset == null
? new StringReader( str )
: new InputStreamReader( getStream(), charset );
}
}
/**
* Base reader implementation. If the contentType declares a
* charset use it, otherwise use "utf-8".
*/
@Override
public Reader getReader() throws IOException {
String charset = getCharsetFromContentType( getContentType() );
return charset == null
? new InputStreamReader( getStream(), DEFAULT_CHARSET )
: new InputStreamReader( getStream(), charset );
}
//------------------------------------------------------------------
// Getters / Setters for overrideable attributes
//------------------------------------------------------------------
@Override
public String getContentType() {
return contentType;
}
public void setContentType(String contentType) {
this.contentType = contentType;
}
@Override
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public Long getSize() {
return size;
}
public void setSize(Long size) {
this.size = size;
}
@Override
public String getSourceInfo() {
return sourceInfo;
}
public void setSourceInfo(String sourceInfo) {
this.sourceInfo = sourceInfo;
}
public static ContentStream create(RequestWriter requestWriter, SolrRequest req) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
RequestWriter.ContentWriter contentWriter = requestWriter.getContentWriter(req);
contentWriter.write(baos);
return new ByteArrayStream(baos.toByteArray(), null,contentWriter.getContentType() );
}
/**
* Construct a <code>ContentStream</code> from a <code>File</code>
*/
public static class ByteArrayStream extends ContentStreamBase
{
private final byte[] bytes;
public ByteArrayStream( byte[] bytes, String source ) {
this(bytes,source, null);
}
public ByteArrayStream( byte[] bytes, String source, String contentType ) {
this.bytes = bytes;
this.contentType = contentType;
name = source;
size = new Long(bytes.length);
sourceInfo = source;
}
@Override
public InputStream getStream() throws IOException {
return new ByteArrayInputStream( bytes );
}
}
}
| [
"[email protected]"
] | |
c6d4600811057faf87f345a6eb65860d773df2a4 | fad37f41e9a7aae325e142303ef02e1a6b254e8f | /src/org/tranche/hash/BigHashMaker.java | 9cbf2a9cff3aac36be5c0228ae058b5d6ca9c4e4 | [] | no_license | augie/tranche | d832f59a262d397628030ff6be3103a2822450d6 | 65f2f995dadb7fe84c6210c95bde0b1295291fce | refs/heads/master | 2016-09-03T07:18:36.654875 | 2012-06-03T18:53:01 | 2012-06-03T18:53:01 | 32,666,015 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,469 | java | /*
* Copyright 2005 The Regents of the University of Michigan
*
* 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.tranche.hash;
import java.nio.ByteBuffer;
import org.bouncycastle.crypto.digests.*;
/**
* Class that actually creates the BigHash used for identifying files/projects.
* @author Jayson Falkner - [email protected]
*/
public final class BigHashMaker {
// make the hash functions
private MD5Digest md5Digest = new MD5Digest();
private SHA1Digest sha1Digest = new SHA1Digest();
private SHA256Digest sha256Digest = new SHA256Digest();
// the total length
private long totalLength = 0;
// previously this was an 'int' -- arg....
// we'll have to hack in a fall-back check that
// that uses an int rollover.
// int totalLengthBroken = 0;
/**
* Update BigHash with a given array of bytes at a particular offset and
* length.
* @param bytes
* @param offset
* @param length
*/
public final void update(byte[] bytes, int offset, int length) {
// write out the bytes to the hash functions
md5Digest.update(bytes, offset, length);
sha1Digest.update(bytes, offset, length);
sha256Digest.update(bytes, offset, length);
// track the total length
totalLength += length;
}
/**
* Create the BigHash return bytes of the BigHash.
* @return
*/
public final byte[] finish() {
// make the buffer for the bytes
byte[] bytes = new byte[BigHash.HASH_LENGTH];
// get the hash values
md5Digest.doFinal(bytes, BigHash.MD5_OFFSET);
sha1Digest.doFinal(bytes, BigHash.SHA1_OFFSET);
sha256Digest.doFinal(bytes, BigHash.SHA256_OFFSET);
// set the length
ByteBuffer bb = ByteBuffer.wrap(bytes, BigHash.LENGTH_OFFSET, BigHash.LENGTH_LENGTH);
bb.putLong(totalLength);
// return the big hash
return bytes;
}
}
| [
"augman85@4cde49d4-021f-11df-9f77-c71dee008b03"
] | augman85@4cde49d4-021f-11df-9f77-c71dee008b03 |
bfa10342240fa5b6306d47d37b56aab32883ef89 | 4312a71c36d8a233de2741f51a2a9d28443cd95b | /RawExperiments/DB/Lang39/AstorMain-lang39/src/variant-803/org/apache/commons/lang3/StringUtils.java | eb930ded5e303ed66a89be1151c1f14c4daecf08 | [] | no_license | SajjadZaidi/AutoRepair | 5c7aa7a689747c143cafd267db64f1e365de4d98 | e21eb9384197bae4d9b23af93df73b6e46bb749a | refs/heads/master | 2021-05-07T00:07:06.345617 | 2017-12-02T18:48:14 | 2017-12-02T18:48:14 | 112,858,432 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 74,460 | java | package org.apache.commons.lang3;
public class StringUtils {
public static final java.lang.String EMPTY = "";
public static final int INDEX_NOT_FOUND = -1;
private static final int PAD_LIMIT = 8192;
public StringUtils() {
super();
}
public static boolean isEmpty(java.lang.CharSequence str) {
return (str == null) || ((str.length()) == 0);
}
public static boolean isNotEmpty(java.lang.CharSequence str) {
return !(org.apache.commons.lang3.StringUtils.isEmpty(str));
}
public static boolean isBlank(java.lang.CharSequence str) {
int strLen;
if ((str == null) || ((strLen = str.length()) == 0)) {
return true;
}
for (int i = 0 ; i < strLen ; i++) {
if ((java.lang.Character.isWhitespace(str.charAt(i))) == false) {
return false;
}
}
return true;
}
public static boolean isNotBlank(java.lang.CharSequence str) {
return !(org.apache.commons.lang3.StringUtils.isBlank(str));
}
public static java.lang.String trim(java.lang.String str) {
return str == null ? null : str.trim();
}
public static java.lang.String trimToNull(java.lang.String str) {
java.lang.String ts = org.apache.commons.lang3.StringUtils.trim(str);
return org.apache.commons.lang3.StringUtils.isEmpty(ts) ? null : ts;
}
public static java.lang.String trimToEmpty(java.lang.String str) {
return str == null ? org.apache.commons.lang3.StringUtils.EMPTY : str.trim();
}
public static java.lang.String strip(java.lang.String str) {
return org.apache.commons.lang3.StringUtils.strip(str, null);
}
public static java.lang.String stripToNull(java.lang.String str) {
if (str == null) {
return null;
}
str = org.apache.commons.lang3.StringUtils.strip(str, null);
return (str.length()) == 0 ? null : str;
}
public static java.lang.String stripToEmpty(java.lang.String str) {
return str == null ? org.apache.commons.lang3.StringUtils.EMPTY : org.apache.commons.lang3.StringUtils.strip(str, null);
}
public static java.lang.String strip(java.lang.String str, java.lang.String stripChars) {
if (org.apache.commons.lang3.StringUtils.isEmpty(str)) {
return str;
}
str = org.apache.commons.lang3.StringUtils.stripStart(str, stripChars);
return org.apache.commons.lang3.StringUtils.stripEnd(str, stripChars);
}
public static java.lang.String stripStart(java.lang.String str, java.lang.String stripChars) {
int strLen;
if ((str == null) || ((strLen = str.length()) == 0)) {
return str;
}
int start = 0;
if (stripChars == null) {
while ((start != strLen) && (java.lang.Character.isWhitespace(str.charAt(start)))) {
start++;
}
} else {
if ((stripChars.length()) == 0) {
return str;
} else {
while ((start != strLen) && ((stripChars.indexOf(str.charAt(start))) != (-1))) {
start++;
}
}
}
return str.substring(start);
}
public static java.lang.String stripEnd(java.lang.String str, java.lang.String stripChars) {
int end;
if ((str == null) || ((end = str.length()) == 0)) {
return str;
}
if (stripChars == null) {
while ((end != 0) && (java.lang.Character.isWhitespace(str.charAt((end - 1))))) {
end--;
}
} else {
if ((stripChars.length()) == 0) {
return str;
} else {
while ((end != 0) && ((stripChars.indexOf(str.charAt((end - 1)))) != (-1))) {
end--;
}
}
}
return str.substring(0, end);
}
public static java.lang.String[] stripAll(java.lang.String[] strs) {
return org.apache.commons.lang3.StringUtils.stripAll(strs, null);
}
public static java.lang.String[] stripAll(java.lang.String[] strs, java.lang.String stripChars) {
int strsLen;
if ((strs == null) || ((strsLen = strs.length) == 0)) {
return strs;
}
java.lang.String[] newArr = new java.lang.String[strsLen];
for (int i = 0 ; i < strsLen ; i++) {
newArr[i] = org.apache.commons.lang3.StringUtils.strip(strs[i], stripChars);
}
return newArr;
}
public static java.lang.String stripAccents(java.lang.String input) {
if (input == null) {
return null;
}
if (org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast(1.6F)) {
try {
java.lang.Class normalizerFormClass = org.apache.commons.lang3.ClassUtils.getClass("java.text.Normalizer$Form", false);
java.lang.Class normalizerClass = org.apache.commons.lang3.ClassUtils.getClass("java.text.Normalizer", false);
java.lang.reflect.Method method = normalizerClass.getMethod("normalize", java.lang.CharSequence.class, normalizerFormClass);
java.lang.reflect.Field nfd = normalizerFormClass.getField("NFD");
java.lang.String decomposed = ((java.lang.String)(method.invoke(null, input, nfd.get(null))));
java.util.regex.Pattern accentPattern = java.util.regex.Pattern.compile("\\p{InCombiningDiacriticalMarks}+");
return accentPattern.matcher(decomposed).replaceAll("");
} catch (java.lang.ClassNotFoundException cnfe) {
throw new java.lang.RuntimeException("ClassNotFoundException occurred during 1.6 backcompat code" , cnfe);
} catch (java.lang.NoSuchMethodException nsme) {
throw new java.lang.RuntimeException("NoSuchMethodException occurred during 1.6 backcompat code" , nsme);
} catch (java.lang.NoSuchFieldException nsfe) {
throw new java.lang.RuntimeException("NoSuchFieldException occurred during 1.6 backcompat code" , nsfe);
} catch (java.lang.IllegalAccessException iae) {
throw new java.lang.RuntimeException("IllegalAccessException occurred during 1.6 backcompat code" , iae);
} catch (java.lang.IllegalArgumentException iae) {
throw new java.lang.RuntimeException("IllegalArgumentException occurred during 1.6 backcompat code" , iae);
} catch (java.lang.reflect.InvocationTargetException ite) {
throw new java.lang.RuntimeException("InvocationTargetException occurred during 1.6 backcompat code" , ite);
} catch (java.lang.SecurityException se) {
throw new java.lang.RuntimeException("SecurityException occurred during 1.6 backcompat code" , se);
}
} else {
throw new java.lang.UnsupportedOperationException("The stripAccents(String) method is not supported until Java 1.6");
}
}
public static boolean equals(java.lang.String str1, java.lang.String str2) {
return str1 == null ? str2 == null : str1.equals(str2);
}
public static boolean equalsIgnoreCase(java.lang.String str1, java.lang.String str2) {
return str1 == null ? str2 == null : str1.equalsIgnoreCase(str2);
}
public static int indexOf(java.lang.String str, char searchChar) {
if (org.apache.commons.lang3.StringUtils.isEmpty(str)) {
return -1;
}
return str.indexOf(searchChar);
}
public static int indexOf(java.lang.String str, char searchChar, int startPos) {
if (org.apache.commons.lang3.StringUtils.isEmpty(str)) {
return -1;
}
return str.indexOf(searchChar, startPos);
}
public static int indexOf(java.lang.String str, java.lang.String searchStr) {
if ((str == null) || (searchStr == null)) {
return -1;
}
return str.indexOf(searchStr);
}
public static int ordinalIndexOf(java.lang.String str, java.lang.String searchStr, int ordinal) {
if (((str == null) || (searchStr == null)) || (ordinal <= 0)) {
return org.apache.commons.lang3.StringUtils.INDEX_NOT_FOUND;
}
if ((searchStr.length()) == 0) {
return 0;
}
int found = 0;
int index = org.apache.commons.lang3.StringUtils.INDEX_NOT_FOUND;
do {
index = str.indexOf(searchStr, (index + 1));
if (index < 0) {
return index;
}
found++;
} while (found < ordinal );
return index;
}
public static int indexOf(java.lang.String str, java.lang.String searchStr, int startPos) {
if ((str == null) || (searchStr == null)) {
return -1;
}
if (((searchStr.length()) == 0) && (startPos >= (str.length()))) {
return str.length();
}
return str.indexOf(searchStr, startPos);
}
public static int lastIndexOf(java.lang.String str, char searchChar) {
if (org.apache.commons.lang3.StringUtils.isEmpty(str)) {
return -1;
}
return str.lastIndexOf(searchChar);
}
public static int lastIndexOf(java.lang.String str, char searchChar, int startPos) {
if (org.apache.commons.lang3.StringUtils.isEmpty(str)) {
return -1;
}
return str.lastIndexOf(searchChar, startPos);
}
public static int lastIndexOf(java.lang.String str, java.lang.String searchStr) {
if ((str == null) || (searchStr == null)) {
return -1;
}
return str.lastIndexOf(searchStr);
}
public static int lastIndexOf(java.lang.String str, java.lang.String searchStr, int startPos) {
if ((str == null) || (searchStr == null)) {
return -1;
}
return str.lastIndexOf(searchStr, startPos);
}
public static boolean contains(java.lang.String str, char searchChar) {
if (org.apache.commons.lang3.StringUtils.isEmpty(str)) {
return false;
}
return (str.indexOf(searchChar)) >= 0;
}
public static boolean contains(java.lang.String str, java.lang.String searchStr) {
if ((str == null) || (searchStr == null)) {
return false;
}
return (str.indexOf(searchStr)) >= 0;
}
public static boolean containsIgnoreCase(java.lang.String str, java.lang.String searchStr) {
if ((str == null) || (searchStr == null)) {
return false;
}
int len = searchStr.length();
int max = (str.length()) - len;
for (int i = 0 ; i <= max ; i++) {
if (str.regionMatches(true, i, searchStr, 0, len)) {
return true;
}
}
return false;
}
public static int indexOfAny(java.lang.String str, char[] searchChars) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.ArrayUtils.isEmpty(searchChars))) {
return -1;
}
for (int i = 0 ; i < (str.length()) ; i++) {
char ch = str.charAt(i);
for (int j = 0 ; j < (searchChars.length) ; j++) {
if ((searchChars[j]) == ch) {
return i;
}
}
}
return -1;
}
public static int indexOfAny(java.lang.String str, java.lang.String searchChars) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.StringUtils.isEmpty(searchChars))) {
return -1;
}
return org.apache.commons.lang3.StringUtils.indexOfAny(str, searchChars.toCharArray());
}
public static boolean containsAny(java.lang.String str, char[] searchChars) {
if ((((str == null) || ((str.length()) == 0)) || (searchChars == null)) || ((searchChars.length) == 0)) {
return false;
}
for (int i = 0 ; i < (str.length()) ; i++) {
char ch = str.charAt(i);
for (int j = 0 ; j < (searchChars.length) ; j++) {
if ((searchChars[j]) == ch) {
return true;
}
}
}
return false;
}
public static boolean containsAny(java.lang.String str, java.lang.String searchChars) {
if (searchChars == null) {
return false;
}
return org.apache.commons.lang3.StringUtils.containsAny(str, searchChars.toCharArray());
}
public static int indexOfAnyBut(java.lang.String str, char[] searchChars) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.ArrayUtils.isEmpty(searchChars))) {
return -1;
}
outer : for (int i = 0 ; i < (str.length()) ; i++) {
char ch = str.charAt(i);
for (int j = 0 ; j < (searchChars.length) ; j++) {
if ((searchChars[j]) == ch) {
continue outer;
}
}
return i;
}
return -1;
}
public static int indexOfAnyBut(java.lang.String str, java.lang.String searchChars) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.StringUtils.isEmpty(searchChars))) {
return -1;
}
for (int i = 0 ; i < (str.length()) ; i++) {
if ((searchChars.indexOf(str.charAt(i))) < 0) {
return i;
}
}
return -1;
}
public static boolean containsOnly(java.lang.String str, char[] valid) {
if ((valid == null) || (str == null)) {
return false;
}
if ((str.length()) == 0) {
return true;
}
if ((valid.length) == 0) {
return false;
}
return (org.apache.commons.lang3.StringUtils.indexOfAnyBut(str, valid)) == (-1);
}
public static boolean containsOnly(java.lang.String str, java.lang.String validChars) {
if ((str == null) || (validChars == null)) {
return false;
}
return org.apache.commons.lang3.StringUtils.containsOnly(str, validChars.toCharArray());
}
public static boolean containsNone(java.lang.String str, char[] invalidChars) {
if ((str == null) || (invalidChars == null)) {
return true;
}
int strSize = str.length();
int validSize = invalidChars.length;
for (int i = 0 ; i < strSize ; i++) {
char ch = str.charAt(i);
for (int j = 0 ; j < validSize ; j++) {
if ((invalidChars[j]) == ch) {
return false;
}
}
}
return true;
}
public static boolean containsNone(java.lang.String str, java.lang.String invalidChars) {
if ((str == null) || (invalidChars == null)) {
return true;
}
return org.apache.commons.lang3.StringUtils.containsNone(str, invalidChars.toCharArray());
}
public static int indexOfAny(java.lang.String str, java.lang.String[] searchStrs) {
if ((str == null) || (searchStrs == null)) {
return -1;
}
int sz = searchStrs.length;
int ret = java.lang.Integer.MAX_VALUE;
int tmp = 0;
for (int i = 0 ; i < sz ; i++) {
java.lang.String search = searchStrs[i];
if (search == null) {
continue;
}
tmp = str.indexOf(search);
if (tmp == (-1)) {
continue;
}
if (tmp < ret) {
ret = tmp;
}
}
return ret == (java.lang.Integer.MAX_VALUE) ? -1 : ret;
}
public static int lastIndexOfAny(java.lang.String str, java.lang.String[] searchStrs) {
if ((str == null) || (searchStrs == null)) {
return -1;
}
int sz = searchStrs.length;
int ret = -1;
int tmp = 0;
for (int i = 0 ; i < sz ; i++) {
java.lang.String search = searchStrs[i];
if (search == null) {
continue;
}
tmp = str.lastIndexOf(search);
if (tmp > ret) {
ret = tmp;
}
}
return ret;
}
public static java.lang.String substring(java.lang.String str, int start) {
if (str == null) {
return null;
}
if (start < 0) {
start = (str.length()) + start;
}
if (start < 0) {
start = 0;
}
if (start > (str.length())) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
return str.substring(start);
}
public static java.lang.String substring(java.lang.String str, int start, int end) {
if (str == null) {
return null;
}
if (end < 0) {
end = (str.length()) + end;
}
if (start < 0) {
start = (str.length()) + start;
}
if (end > (str.length())) {
end = str.length();
}
if (start > end) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
if (start < 0) {
start = 0;
}
if (end < 0) {
end = 0;
}
return str.substring(start, end);
}
public static java.lang.String left(java.lang.String str, int len) {
if (str == null) {
return null;
}
if (len < 0) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
if ((str.length()) <= len) {
return str;
}
return str.substring(0, len);
}
public static java.lang.String right(java.lang.String str, int len) {
if (str == null) {
return null;
}
if (len < 0) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
if ((str.length()) <= len) {
return str;
}
return str.substring(((str.length()) - len));
}
public static java.lang.String mid(java.lang.String str, int pos, int len) {
if (str == null) {
return null;
}
if ((len < 0) || (pos > (str.length()))) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
if (pos < 0) {
pos = 0;
}
if ((str.length()) <= (pos + len)) {
return str.substring(pos);
}
return str.substring(pos, (pos + len));
}
public static java.lang.String substringBefore(java.lang.String str, java.lang.String separator) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (separator == null)) {
return str;
}
if ((separator.length()) == 0) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
int pos = str.indexOf(separator);
if (pos == (-1)) {
return str;
}
return str.substring(0, pos);
}
public static java.lang.String substringAfter(java.lang.String str, java.lang.String separator) {
if (org.apache.commons.lang3.StringUtils.isEmpty(str)) {
return str;
}
if (separator == null) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
int pos = str.indexOf(separator);
if (pos == (-1)) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
return str.substring((pos + (separator.length())));
}
public static java.lang.String substringBeforeLast(java.lang.String str, java.lang.String separator) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.StringUtils.isEmpty(separator))) {
return str;
}
int pos = str.lastIndexOf(separator);
if (pos == (-1)) {
return str;
}
return str.substring(0, pos);
}
public static java.lang.String substringAfterLast(java.lang.String str, java.lang.String separator) {
if (org.apache.commons.lang3.StringUtils.isEmpty(str)) {
return str;
}
if (org.apache.commons.lang3.StringUtils.isEmpty(separator)) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
int pos = str.lastIndexOf(separator);
if ((pos == (-1)) || (pos == ((str.length()) - (separator.length())))) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
return str.substring((pos + (separator.length())));
}
public static java.lang.String substringBetween(java.lang.String str, java.lang.String tag) {
return org.apache.commons.lang3.StringUtils.substringBetween(str, tag, tag);
}
public static java.lang.String substringBetween(java.lang.String str, java.lang.String open, java.lang.String close) {
if (((str == null) || (open == null)) || (close == null)) {
return null;
}
int start = str.indexOf(open);
if (start != (-1)) {
int end = str.indexOf(close, (start + (open.length())));
if (end != (-1)) {
return str.substring((start + (open.length())), end);
}
}
return null;
}
public static java.lang.String[] substringsBetween(java.lang.String str, java.lang.String open, java.lang.String close) {
if (((str == null) || (org.apache.commons.lang3.StringUtils.isEmpty(open))) || (org.apache.commons.lang3.StringUtils.isEmpty(close))) {
return null;
}
int strLen = str.length();
if (strLen == 0) {
return org.apache.commons.lang3.ArrayUtils.EMPTY_STRING_ARRAY;
}
int closeLen = close.length();
int openLen = open.length();
java.util.List<java.lang.String> list = new java.util.ArrayList<java.lang.String>();
int pos = 0;
while (pos < (strLen - closeLen)) {
int start = str.indexOf(open, pos);
if (start < 0) {
break;
}
start += openLen;
int end = str.indexOf(close, start);
if (end < 0) {
break;
}
list.add(str.substring(start, end));
pos = end + closeLen;
}
if (list.isEmpty()) {
return null;
}
return list.toArray(new java.lang.String[list.size()]);
}
public static java.lang.String[] split(java.lang.String str) {
return org.apache.commons.lang3.StringUtils.split(str, null, (-1));
}
public static java.lang.String[] split(java.lang.String str, char separatorChar) {
return org.apache.commons.lang3.StringUtils.splitWorker(str, separatorChar, false);
}
public static java.lang.String[] split(java.lang.String str, java.lang.String separatorChars) {
return org.apache.commons.lang3.StringUtils.splitWorker(str, separatorChars, (-1), false);
}
public static java.lang.String[] split(java.lang.String str, java.lang.String separatorChars, int max) {
return org.apache.commons.lang3.StringUtils.splitWorker(str, separatorChars, max, false);
}
public static java.lang.String[] splitByWholeSeparator(java.lang.String str, java.lang.String separator) {
return org.apache.commons.lang3.StringUtils.splitByWholeSeparatorWorker(str, separator, (-1), false);
}
public static java.lang.String[] splitByWholeSeparator(java.lang.String str, java.lang.String separator, int max) {
return org.apache.commons.lang3.StringUtils.splitByWholeSeparatorWorker(str, separator, max, false);
}
public static java.lang.String[] splitByWholeSeparatorPreserveAllTokens(java.lang.String str, java.lang.String separator) {
return org.apache.commons.lang3.StringUtils.splitByWholeSeparatorWorker(str, separator, (-1), true);
}
public static java.lang.String[] splitByWholeSeparatorPreserveAllTokens(java.lang.String str, java.lang.String separator, int max) {
return org.apache.commons.lang3.StringUtils.splitByWholeSeparatorWorker(str, separator, max, true);
}
private static java.lang.String[] splitByWholeSeparatorWorker(java.lang.String str, java.lang.String separator, int max, boolean preserveAllTokens) {
if (str == null) {
return null;
}
int len = str.length();
if (len == 0) {
return org.apache.commons.lang3.ArrayUtils.EMPTY_STRING_ARRAY;
}
if ((separator == null) || (org.apache.commons.lang3.StringUtils.EMPTY.equals(separator))) {
return org.apache.commons.lang3.StringUtils.splitWorker(str, null, max, preserveAllTokens);
}
int separatorLength = separator.length();
java.util.ArrayList<java.lang.String> substrings = new java.util.ArrayList<java.lang.String>();
int numberOfSubstrings = 0;
int beg = 0;
int end = 0;
while (end < len) {
end = str.indexOf(separator, beg);
if (end > (-1)) {
if (end > beg) {
numberOfSubstrings += 1;
if (numberOfSubstrings == max) {
end = len;
substrings.add(str.substring(beg));
} else {
substrings.add(str.substring(beg, end));
beg = end + separatorLength;
}
} else {
if (preserveAllTokens) {
numberOfSubstrings += 1;
if (numberOfSubstrings == max) {
end = len;
substrings.add(str.substring(beg));
} else {
substrings.add(org.apache.commons.lang3.StringUtils.EMPTY);
}
}
beg = end + separatorLength;
}
} else {
substrings.add(str.substring(beg));
end = len;
}
}
return substrings.toArray(new java.lang.String[substrings.size()]);
}
public static java.lang.String[] splitPreserveAllTokens(java.lang.String str) {
return org.apache.commons.lang3.StringUtils.splitWorker(str, null, (-1), true);
}
public static java.lang.String[] splitPreserveAllTokens(java.lang.String str, char separatorChar) {
return org.apache.commons.lang3.StringUtils.splitWorker(str, separatorChar, true);
}
private static java.lang.String[] splitWorker(java.lang.String str, char separatorChar, boolean preserveAllTokens) {
if (str == null) {
return null;
}
int len = str.length();
if (len == 0) {
return org.apache.commons.lang3.ArrayUtils.EMPTY_STRING_ARRAY;
}
java.util.List<java.lang.String> list = new java.util.ArrayList<java.lang.String>();
int i = 0;
int start = 0;
boolean match = false;
boolean lastMatch = false;
while (i < len) {
if ((str.charAt(i)) == separatorChar) {
if (match || preserveAllTokens) {
list.add(str.substring(start, i));
match = false;
lastMatch = true;
}
start = ++i;
continue;
}
lastMatch = false;
match = true;
i++;
}
if (match || (preserveAllTokens && lastMatch)) {
list.add(str.substring(start, i));
}
return list.toArray(new java.lang.String[list.size()]);
}
public static java.lang.String[] splitPreserveAllTokens(java.lang.String str, java.lang.String separatorChars) {
return org.apache.commons.lang3.StringUtils.splitWorker(str, separatorChars, (-1), true);
}
public static java.lang.String[] splitPreserveAllTokens(java.lang.String str, java.lang.String separatorChars, int max) {
return org.apache.commons.lang3.StringUtils.splitWorker(str, separatorChars, max, true);
}
private static java.lang.String[] splitWorker(java.lang.String str, java.lang.String separatorChars, int max, boolean preserveAllTokens) {
if (str == null) {
return null;
}
int len = str.length();
if (len == 0) {
return org.apache.commons.lang3.ArrayUtils.EMPTY_STRING_ARRAY;
}
java.util.List<java.lang.String> list = new java.util.ArrayList<java.lang.String>();
int sizePlus1 = 1;
int i = 0;
int start = 0;
boolean match = false;
boolean lastMatch = false;
if (separatorChars == null) {
while (i < len) {
if (java.lang.Character.isWhitespace(str.charAt(i))) {
if (match || preserveAllTokens) {
lastMatch = true;
if ((sizePlus1++) == max) {
i = len;
lastMatch = false;
}
list.add(str.substring(start, i));
match = false;
}
start = ++i;
continue;
}
lastMatch = false;
match = true;
i++;
}
} else {
if ((separatorChars.length()) == 1) {
char sep = separatorChars.charAt(0);
while (i < len) {
if ((str.charAt(i)) == sep) {
if (match || preserveAllTokens) {
lastMatch = true;
if ((sizePlus1++) == max) {
i = len;
lastMatch = false;
}
list.add(str.substring(start, i));
match = false;
}
start = ++i;
continue;
}
lastMatch = false;
match = true;
i++;
}
} else {
while (i < len) {
if ((separatorChars.indexOf(str.charAt(i))) >= 0) {
if (match || preserveAllTokens) {
lastMatch = true;
if ((sizePlus1++) == max) {
i = len;
lastMatch = false;
}
list.add(str.substring(start, i));
match = false;
}
start = ++i;
continue;
}
lastMatch = false;
match = true;
i++;
}
}
}
if (match || (preserveAllTokens && lastMatch)) {
list.add(str.substring(start, i));
}
return list.toArray(new java.lang.String[list.size()]);
}
public static java.lang.String[] splitByCharacterType(java.lang.String str) {
return org.apache.commons.lang3.StringUtils.splitByCharacterType(str, false);
}
public static java.lang.String[] splitByCharacterTypeCamelCase(java.lang.String str) {
return org.apache.commons.lang3.StringUtils.splitByCharacterType(str, true);
}
private static java.lang.String[] splitByCharacterType(java.lang.String str, boolean camelCase) {
if (str == null) {
return null;
}
if ((str.length()) == 0) {
return org.apache.commons.lang3.ArrayUtils.EMPTY_STRING_ARRAY;
}
char[] c = str.toCharArray();
java.util.List<java.lang.String> list = new java.util.ArrayList<java.lang.String>();
int tokenStart = 0;
int currentType = java.lang.Character.getType(c[tokenStart]);
for (int pos = tokenStart + 1 ; pos < (c.length) ; pos++) {
int type = java.lang.Character.getType(c[pos]);
if (type == currentType) {
continue;
}
if ((camelCase && (type == (java.lang.Character.LOWERCASE_LETTER))) && (currentType == (java.lang.Character.UPPERCASE_LETTER))) {
int newTokenStart = pos - 1;
if (newTokenStart != tokenStart) {
list.add(new java.lang.String(c , tokenStart , (newTokenStart - tokenStart)));
tokenStart = newTokenStart;
}
} else {
list.add(new java.lang.String(c , tokenStart , (pos - tokenStart)));
tokenStart = pos;
}
currentType = type;
}
list.add(new java.lang.String(c , tokenStart , ((c.length) - tokenStart)));
return list.toArray(new java.lang.String[list.size()]);
}
public static java.lang.String join(java.lang.Object[] array) {
return org.apache.commons.lang3.StringUtils.join(array, null);
}
public static java.lang.String join(java.lang.Object[] array, char separator) {
if (array == null) {
return null;
}
return org.apache.commons.lang3.StringUtils.join(array, separator, 0, array.length);
}
public static java.lang.String join(java.lang.Object[] array, char separator, int startIndex, int endIndex) {
if (array == null) {
return null;
}
int bufSize = endIndex - startIndex;
if (bufSize <= 0) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
bufSize *= ((array[startIndex]) == null ? 16 : array[startIndex].toString().length()) + 1;
java.lang.StringBuilder buf = new java.lang.StringBuilder(bufSize);
for (int i = startIndex ; i < endIndex ; i++) {
if (i > startIndex) {
buf.append(separator);
}
if ((array[i]) != null) {
buf.append(array[i]);
}
}
return buf.toString();
}
public static java.lang.String join(java.lang.Object[] array, java.lang.String separator) {
if (array == null) {
return null;
}
return org.apache.commons.lang3.StringUtils.join(array, separator, 0, array.length);
}
public static java.lang.String join(java.lang.Object[] array, java.lang.String separator, int startIndex, int endIndex) {
if (array == null) {
return null;
}
if (separator == null) {
separator = org.apache.commons.lang3.StringUtils.EMPTY;
}
int bufSize = endIndex - startIndex;
if (bufSize <= 0) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
bufSize *= ((array[startIndex]) == null ? 16 : array[startIndex].toString().length()) + (separator.length());
java.lang.StringBuilder buf = new java.lang.StringBuilder(bufSize);
for (int i = startIndex ; i < endIndex ; i++) {
if (i > startIndex) {
buf.append(separator);
}
if ((array[i]) != null) {
buf.append(array[i]);
}
}
return buf.toString();
}
public static java.lang.String join(java.util.Iterator<?> iterator, char separator) {
if (iterator == null) {
return null;
}
if (!(iterator.hasNext())) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
java.lang.Object first = iterator.next();
if (!(iterator.hasNext())) {
return org.apache.commons.lang3.ObjectUtils.toString(first);
}
java.lang.StringBuilder buf = new java.lang.StringBuilder(256);
if (first != null) {
buf.append(first);
}
while (iterator.hasNext()) {
buf.append(separator);
java.lang.Object obj = iterator.next();
if (obj != null) {
buf.append(obj);
}
}
return buf.toString();
}
public static java.lang.String join(java.util.Iterator<?> iterator, java.lang.String separator) {
if (iterator == null) {
return null;
}
if (!(iterator.hasNext())) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
java.lang.Object first = iterator.next();
if (!(iterator.hasNext())) {
return org.apache.commons.lang3.ObjectUtils.toString(first);
}
java.lang.StringBuilder buf = new java.lang.StringBuilder(256);
if (first != null) {
buf.append(first);
}
while (iterator.hasNext()) {
if (separator != null) {
buf.append(separator);
}
java.lang.Object obj = iterator.next();
if (obj != null) {
buf.append(obj);
}
}
return buf.toString();
}
public static java.lang.String join(java.lang.Iterable<?> iterable, char separator) {
if (iterable == null) {
return null;
}
return org.apache.commons.lang3.StringUtils.join(iterable.iterator(), separator);
}
public static java.lang.String join(java.lang.Iterable<?> iterable, java.lang.String separator) {
if (iterable == null) {
return null;
}
return org.apache.commons.lang3.StringUtils.join(iterable.iterator(), separator);
}
public static java.lang.String deleteWhitespace(java.lang.String str) {
if (org.apache.commons.lang3.StringUtils.isEmpty(str)) {
return str;
}
int sz = str.length();
char[] chs = new char[sz];
int count = 0;
for (int i = 0 ; i < sz ; i++) {
if (!(java.lang.Character.isWhitespace(str.charAt(i)))) {
chs[(count++)] = str.charAt(i);
}
}
if (count == sz) {
return str;
}
return new java.lang.String(chs , 0 , count);
}
public static java.lang.String removeStart(java.lang.String str, java.lang.String remove) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.StringUtils.isEmpty(remove))) {
return str;
}
if (str.startsWith(remove)) {
return str.substring(remove.length());
}
return str;
}
public static java.lang.String removeStartIgnoreCase(java.lang.String str, java.lang.String remove) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.StringUtils.isEmpty(remove))) {
return str;
}
if (org.apache.commons.lang3.StringUtils.startsWithIgnoreCase(str, remove)) {
return str.substring(remove.length());
}
return str;
}
public static java.lang.String removeEnd(java.lang.String str, java.lang.String remove) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.StringUtils.isEmpty(remove))) {
return str;
}
if (str.endsWith(remove)) {
return str.substring(0, ((str.length()) - (remove.length())));
}
return str;
}
public static java.lang.String removeEndIgnoreCase(java.lang.String str, java.lang.String remove) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.StringUtils.isEmpty(remove))) {
return str;
}
if (org.apache.commons.lang3.StringUtils.endsWithIgnoreCase(str, remove)) {
return str.substring(0, ((str.length()) - (remove.length())));
}
return str;
}
public static java.lang.String remove(java.lang.String str, java.lang.String remove) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.StringUtils.isEmpty(remove))) {
return str;
}
return org.apache.commons.lang3.StringUtils.replace(str, remove, org.apache.commons.lang3.StringUtils.EMPTY, (-1));
}
public static java.lang.String remove(java.lang.String str, char remove) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || ((str.indexOf(remove)) == (-1))) {
return str;
}
char[] chars = str.toCharArray();
int pos = 0;
for (int i = 0 ; i < (chars.length) ; i++) {
if ((chars[i]) != remove) {
chars[(pos++)] = chars[i];
}
}
return new java.lang.String(chars , 0 , pos);
}
public static java.lang.String replaceOnce(java.lang.String text, java.lang.String searchString, java.lang.String replacement) {
return org.apache.commons.lang3.StringUtils.replace(text, searchString, replacement, 1);
}
public static java.lang.String replace(java.lang.String text, java.lang.String searchString, java.lang.String replacement) {
return org.apache.commons.lang3.StringUtils.replace(text, searchString, replacement, (-1));
}
public static java.lang.String replace(java.lang.String text, java.lang.String searchString, java.lang.String replacement, int max) {
if ((((org.apache.commons.lang3.StringUtils.isEmpty(text)) || (org.apache.commons.lang3.StringUtils.isEmpty(searchString))) || (replacement == null)) || (max == 0)) {
return text;
}
int start = 0;
int end = text.indexOf(searchString, start);
if (end == (-1)) {
return text;
}
int replLength = searchString.length();
int increase = (replacement.length()) - replLength;
increase = increase < 0 ? 0 : increase;
increase *= max < 0 ? 16 : max > 64 ? 64 : max;
java.lang.StringBuilder buf = new java.lang.StringBuilder(((text.length()) + increase));
while (end != (-1)) {
buf.append(text.substring(start, end)).append(replacement);
start = end + replLength;
if ((--max) == 0) {
break;
}
end = text.indexOf(searchString, start);
}
buf.append(text.substring(start));
return buf.toString();
}
public static java.lang.String replaceEach(java.lang.String text, java.lang.String[] searchList, java.lang.String[] replacementList) {
return org.apache.commons.lang3.StringUtils.replaceEach(text, searchList, replacementList, false, 0);
}
public static java.lang.String replaceEachRepeatedly(java.lang.String text, java.lang.String[] searchList, java.lang.String[] replacementList) {
int timeToLive = searchList == null ? 0 : searchList.length;
return org.apache.commons.lang3.StringUtils.replaceEach(text, searchList, replacementList, true, timeToLive);
}
private static java.lang.String replaceEach(java.lang.String text, java.lang.String[] searchList, java.lang.String[] replacementList, boolean repeat, int timeToLive) {
if ((((((text == null) || ((text.length()) == 0)) || (searchList == null)) || ((searchList.length) == 0)) || (replacementList == null)) || ((replacementList.length) == 0)) {
return text;
}
if (timeToLive < 0) {
throw new java.lang.IllegalStateException(((("TimeToLive of " + timeToLive) + " is less than 0: ") + text));
}
int searchLength = searchList.length;
int replacementLength = replacementList.length;
if (searchLength != replacementLength) {
throw new java.lang.IllegalArgumentException(((("Search and Replace array lengths don't match: " + searchLength) + " vs ") + replacementLength));
}
boolean[] noMoreMatchesForReplIndex = new boolean[searchLength];
int textIndex = -1;
int replaceIndex = -1;
int tempIndex = -1;
for (int i = 0 ; i < searchLength ; i++) {
if ((((noMoreMatchesForReplIndex[i]) || ((searchList[i]) == null)) || ((searchList[i].length()) == 0)) || ((replacementList[i]) == null)) {
continue;
}
tempIndex = text.indexOf(searchList[i]);
if (tempIndex == (-1)) {
noMoreMatchesForReplIndex[i] = true;
} else {
if ((textIndex == (-1)) || (tempIndex < textIndex)) {
textIndex = tempIndex;
replaceIndex = i;
}
}
}
if (textIndex == (-1)) {
return text;
}
int start = 0;
int increase = 0;
for (int i = 0 ; i < (searchList.length) ; i++) {
int greater = (replacementList[i].length()) - (searchList[i].length());
if (greater > 0) {
increase += 3 * greater;
}
}
increase = java.lang.Math.min(increase, ((text.length()) / 5));
java.lang.StringBuilder buf = new java.lang.StringBuilder(((text.length()) + increase));
while (textIndex != (-1)) {
for (int i = start ; i < textIndex ; i++) {
buf.append(text.charAt(i));
}
buf.append(replacementList[replaceIndex]);
start = textIndex + (searchList[replaceIndex].length());
textIndex = -1;
replaceIndex = -1;
tempIndex = -1;
for (int i = 0 ; i < searchLength ; i++) {
if ((((noMoreMatchesForReplIndex[i]) || ((searchList[i]) == null)) || ((searchList[i].length()) == 0)) || ((replacementList[i]) == null)) {
continue;
}
tempIndex = text.indexOf(searchList[i], start);
if (tempIndex == (-1)) {
noMoreMatchesForReplIndex[i] = true;
} else {
if ((textIndex == (-1)) || (tempIndex < textIndex)) {
textIndex = tempIndex;
replaceIndex = i;
}
throw new java.lang.UnsupportedOperationException();
}
}
}
int textLength = text.length();
for (int i = start ; i < textLength ; i++) {
buf.append(text.charAt(i));
}
java.lang.String result = buf.toString();
if (!repeat) {
return result;
}
return org.apache.commons.lang3.StringUtils.replaceEach(result, searchList, replacementList, repeat, (timeToLive - 1));
}
public static java.lang.String replaceChars(java.lang.String str, char searchChar, char replaceChar) {
if (str == null) {
return null;
}
return str.replace(searchChar, replaceChar);
}
public static java.lang.String replaceChars(java.lang.String str, java.lang.String searchChars, java.lang.String replaceChars) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.StringUtils.isEmpty(searchChars))) {
return str;
}
if (replaceChars == null) {
replaceChars = org.apache.commons.lang3.StringUtils.EMPTY;
}
boolean modified = false;
int replaceCharsLength = replaceChars.length();
int strLength = str.length();
java.lang.StringBuilder buf = new java.lang.StringBuilder(strLength);
for (int i = 0 ; i < strLength ; i++) {
char ch = str.charAt(i);
int index = searchChars.indexOf(ch);
if (index >= 0) {
modified = true;
if (index < replaceCharsLength) {
buf.append(replaceChars.charAt(index));
}
} else {
buf.append(ch);
}
}
if (modified) {
return buf.toString();
}
return str;
}
public static java.lang.String overlay(java.lang.String str, java.lang.String overlay, int start, int end) {
if (str == null) {
return null;
}
if (overlay == null) {
overlay = org.apache.commons.lang3.StringUtils.EMPTY;
}
int len = str.length();
if (start < 0) {
start = 0;
}
if (start > len) {
start = len;
}
if (end < 0) {
end = 0;
}
if (end > len) {
end = len;
}
if (start > end) {
int temp = start;
start = end;
end = temp;
}
return new java.lang.StringBuilder(((((len + start) - end) + (overlay.length())) + 1)).append(str.substring(0, start)).append(overlay).append(str.substring(end)).toString();
}
public static java.lang.String chomp(java.lang.String str) {
if (org.apache.commons.lang3.StringUtils.isEmpty(str)) {
return str;
}
if ((str.length()) == 1) {
char ch = str.charAt(0);
if ((ch == (org.apache.commons.lang3.CharUtils.CR)) || (ch == (org.apache.commons.lang3.CharUtils.LF))) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
return str;
}
int lastIdx = (str.length()) - 1;
char last = str.charAt(lastIdx);
if (last == (org.apache.commons.lang3.CharUtils.LF)) {
if ((str.charAt((lastIdx - 1))) == (org.apache.commons.lang3.CharUtils.CR)) {
lastIdx--;
}
} else {
if (last != (org.apache.commons.lang3.CharUtils.CR)) {
lastIdx++;
}
}
return str.substring(0, lastIdx);
}
public static java.lang.String chomp(java.lang.String str, java.lang.String separator) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (separator == null)) {
return str;
}
if (str.endsWith(separator)) {
return str.substring(0, ((str.length()) - (separator.length())));
}
return str;
}
public static java.lang.String chop(java.lang.String str) {
if (str == null) {
return null;
}
int strLen = str.length();
if (strLen < 2) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
int lastIdx = strLen - 1;
java.lang.String ret = str.substring(0, lastIdx);
char last = str.charAt(lastIdx);
if (last == (org.apache.commons.lang3.CharUtils.LF)) {
if ((ret.charAt((lastIdx - 1))) == (org.apache.commons.lang3.CharUtils.CR)) {
return ret.substring(0, (lastIdx - 1));
}
}
return ret;
}
public static java.lang.String repeat(java.lang.String str, int repeat) {
if (str == null) {
return null;
}
if (repeat <= 0) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
int inputLength = str.length();
if ((repeat == 1) || (inputLength == 0)) {
return str;
}
if ((inputLength == 1) && (repeat <= (org.apache.commons.lang3.StringUtils.PAD_LIMIT))) {
return org.apache.commons.lang3.StringUtils.padding(repeat, str.charAt(0));
}
int outputLength = inputLength * repeat;
switch (inputLength) {
case 1 :
char ch = str.charAt(0);
char[] output1 = new char[outputLength];
for (int i = repeat - 1 ; i >= 0 ; i--) {
output1[i] = ch;
}
return new java.lang.String(output1);
case 2 :
char ch0 = str.charAt(0);
char ch1 = str.charAt(1);
char[] output2 = new char[outputLength];
for (int i = (repeat * 2) - 2 ; i >= 0 ; i-- , i--) {
output2[i] = ch0;
output2[(i + 1)] = ch1;
}
return new java.lang.String(output2);
default :
java.lang.StringBuilder buf = new java.lang.StringBuilder(outputLength);
for (int i = 0 ; i < repeat ; i++) {
buf.append(str);
}
return buf.toString();
}
}
public static java.lang.String repeat(java.lang.String str, java.lang.String separator, int repeat) {
if ((str == null) || (separator == null)) {
return org.apache.commons.lang3.StringUtils.repeat(str, repeat);
} else {
java.lang.String result = org.apache.commons.lang3.StringUtils.repeat((str + separator), repeat);
return org.apache.commons.lang3.StringUtils.removeEnd(result, separator);
}
}
private static java.lang.String padding(int repeat, char padChar) throws java.lang.IndexOutOfBoundsException {
if (repeat < 0) {
throw new java.lang.IndexOutOfBoundsException(("Cannot pad a negative amount: " + repeat));
}
final char[] buf = new char[repeat];
for (int i = 0 ; i < (buf.length) ; i++) {
buf[i] = padChar;
}
return new java.lang.String(buf);
}
public static java.lang.String rightPad(java.lang.String str, int size) {
return org.apache.commons.lang3.StringUtils.rightPad(str, size, ' ');
}
public static java.lang.String rightPad(java.lang.String str, int size, char padChar) {
if (str == null) {
return null;
}
int pads = size - (str.length());
if (pads <= 0) {
return str;
}
if (pads > (org.apache.commons.lang3.StringUtils.PAD_LIMIT)) {
return org.apache.commons.lang3.StringUtils.rightPad(str, size, java.lang.String.valueOf(padChar));
}
return str.concat(org.apache.commons.lang3.StringUtils.padding(pads, padChar));
}
public static java.lang.String rightPad(java.lang.String str, int size, java.lang.String padStr) {
if (str == null) {
return null;
}
if (org.apache.commons.lang3.StringUtils.isEmpty(padStr)) {
padStr = " ";
}
int padLen = padStr.length();
int strLen = str.length();
int pads = size - strLen;
if (pads <= 0) {
return str;
}
if ((padLen == 1) && (pads <= (org.apache.commons.lang3.StringUtils.PAD_LIMIT))) {
return org.apache.commons.lang3.StringUtils.rightPad(str, size, padStr.charAt(0));
}
if (pads == padLen) {
return str.concat(padStr);
} else {
if (pads < padLen) {
return str.concat(padStr.substring(0, pads));
} else {
char[] padding = new char[pads];
char[] padChars = padStr.toCharArray();
for (int i = 0 ; i < pads ; i++) {
padding[i] = padChars[(i % padLen)];
}
return str.concat(new java.lang.String(padding));
}
}
}
public static java.lang.String leftPad(java.lang.String str, int size) {
return org.apache.commons.lang3.StringUtils.leftPad(str, size, ' ');
}
public static java.lang.String leftPad(java.lang.String str, int size, char padChar) {
if (str == null) {
return null;
}
int pads = size - (str.length());
if (pads <= 0) {
return str;
}
if (pads > (org.apache.commons.lang3.StringUtils.PAD_LIMIT)) {
return org.apache.commons.lang3.StringUtils.leftPad(str, size, java.lang.String.valueOf(padChar));
}
return org.apache.commons.lang3.StringUtils.padding(pads, padChar).concat(str);
}
public static java.lang.String leftPad(java.lang.String str, int size, java.lang.String padStr) {
if (str == null) {
return null;
}
if (org.apache.commons.lang3.StringUtils.isEmpty(padStr)) {
padStr = " ";
}
int padLen = padStr.length();
int strLen = str.length();
int pads = size - strLen;
if (pads <= 0) {
return str;
}
if ((padLen == 1) && (pads <= (org.apache.commons.lang3.StringUtils.PAD_LIMIT))) {
return org.apache.commons.lang3.StringUtils.leftPad(str, size, padStr.charAt(0));
}
if (pads == padLen) {
return padStr.concat(str);
} else {
if (pads < padLen) {
return padStr.substring(0, pads).concat(str);
} else {
char[] padding = new char[pads];
char[] padChars = padStr.toCharArray();
for (int i = 0 ; i < pads ; i++) {
padding[i] = padChars[(i % padLen)];
}
return new java.lang.String(padding).concat(str);
}
}
}
public static int length(java.lang.String str) {
return str == null ? 0 : str.length();
}
public static java.lang.String center(java.lang.String str, int size) {
return org.apache.commons.lang3.StringUtils.center(str, size, ' ');
}
public static java.lang.String center(java.lang.String str, int size, char padChar) {
if ((str == null) || (size <= 0)) {
return str;
}
int strLen = str.length();
int pads = size - strLen;
if (pads <= 0) {
return str;
}
str = org.apache.commons.lang3.StringUtils.leftPad(str, (strLen + (pads / 2)), padChar);
str = org.apache.commons.lang3.StringUtils.rightPad(str, size, padChar);
return str;
}
public static java.lang.String center(java.lang.String str, int size, java.lang.String padStr) {
if ((str == null) || (size <= 0)) {
return str;
}
if (org.apache.commons.lang3.StringUtils.isEmpty(padStr)) {
padStr = " ";
}
int strLen = str.length();
int pads = size - strLen;
if (pads <= 0) {
return str;
}
str = org.apache.commons.lang3.StringUtils.leftPad(str, (strLen + (pads / 2)), padStr);
str = org.apache.commons.lang3.StringUtils.rightPad(str, size, padStr);
return str;
}
public static java.lang.String upperCase(java.lang.String str) {
if (str == null) {
return null;
}
return str.toUpperCase();
}
public static java.lang.String upperCase(java.lang.String str, java.util.Locale locale) {
if (str == null) {
return null;
}
return str.toUpperCase(locale);
}
public static java.lang.String lowerCase(java.lang.String str) {
if (str == null) {
return null;
}
return str.toLowerCase();
}
public static java.lang.String lowerCase(java.lang.String str, java.util.Locale locale) {
if (str == null) {
return null;
}
return str.toLowerCase(locale);
}
public static java.lang.String capitalize(java.lang.String str) {
int strLen;
if ((str == null) || ((strLen = str.length()) == 0)) {
return str;
}
return new java.lang.StringBuilder(strLen).append(java.lang.Character.toTitleCase(str.charAt(0))).append(str.substring(1)).toString();
}
public static java.lang.String uncapitalize(java.lang.String str) {
int strLen;
if ((str == null) || ((strLen = str.length()) == 0)) {
return str;
}
return new java.lang.StringBuilder(strLen).append(java.lang.Character.toLowerCase(str.charAt(0))).append(str.substring(1)).toString();
}
public static java.lang.String swapCase(java.lang.String str) {
int strLen;
if ((str == null) || ((strLen = str.length()) == 0)) {
return str;
}
java.lang.StringBuilder buffer = new java.lang.StringBuilder(strLen);
char ch = 0;
for (int i = 0 ; i < strLen ; i++) {
ch = str.charAt(i);
if (java.lang.Character.isUpperCase(ch)) {
ch = java.lang.Character.toLowerCase(ch);
} else {
if (java.lang.Character.isTitleCase(ch)) {
ch = java.lang.Character.toLowerCase(ch);
} else {
if (java.lang.Character.isLowerCase(ch)) {
ch = java.lang.Character.toUpperCase(ch);
}
}
}
buffer.append(ch);
}
return buffer.toString();
}
public static int countMatches(java.lang.String str, java.lang.String sub) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.StringUtils.isEmpty(sub))) {
return 0;
}
int count = 0;
int idx = 0;
while ((idx = str.indexOf(sub, idx)) != (-1)) {
count++;
idx += sub.length();
}
return count;
}
public static boolean isAlpha(java.lang.String str) {
if (str == null) {
return false;
}
int sz = str.length();
for (int i = 0 ; i < sz ; i++) {
if ((java.lang.Character.isLetter(str.charAt(i))) == false) {
return false;
}
}
return true;
}
public static boolean isAlphaSpace(java.lang.String str) {
if (str == null) {
return false;
}
int sz = str.length();
for (int i = 0 ; i < sz ; i++) {
if (((java.lang.Character.isLetter(str.charAt(i))) == false) && ((str.charAt(i)) != ' ')) {
return false;
}
}
return true;
}
public static boolean isAlphanumeric(java.lang.String str) {
if (str == null) {
return false;
}
int sz = str.length();
for (int i = 0 ; i < sz ; i++) {
if ((java.lang.Character.isLetterOrDigit(str.charAt(i))) == false) {
return false;
}
}
return true;
}
public static boolean isAlphanumericSpace(java.lang.String str) {
if (str == null) {
return false;
}
int sz = str.length();
for (int i = 0 ; i < sz ; i++) {
if (((java.lang.Character.isLetterOrDigit(str.charAt(i))) == false) && ((str.charAt(i)) != ' ')) {
return false;
}
}
return true;
}
public static boolean isAsciiPrintable(java.lang.String str) {
if (str == null) {
return false;
}
int sz = str.length();
for (int i = 0 ; i < sz ; i++) {
if ((org.apache.commons.lang3.CharUtils.isAsciiPrintable(str.charAt(i))) == false) {
return false;
}
}
return true;
}
public static boolean isNumeric(java.lang.String str) {
if (str == null) {
return false;
}
int sz = str.length();
for (int i = 0 ; i < sz ; i++) {
if ((java.lang.Character.isDigit(str.charAt(i))) == false) {
return false;
}
}
return true;
}
public static boolean isNumericSpace(java.lang.String str) {
if (str == null) {
return false;
}
int sz = str.length();
for (int i = 0 ; i < sz ; i++) {
if (((java.lang.Character.isDigit(str.charAt(i))) == false) && ((str.charAt(i)) != ' ')) {
return false;
}
}
return true;
}
public static boolean isWhitespace(java.lang.String str) {
if (str == null) {
return false;
}
int sz = str.length();
for (int i = 0 ; i < sz ; i++) {
if ((java.lang.Character.isWhitespace(str.charAt(i))) == false) {
return false;
}
}
return true;
}
public static boolean isAllLowerCase(java.lang.String str) {
if ((str == null) || (org.apache.commons.lang3.StringUtils.isEmpty(str))) {
return false;
}
int sz = str.length();
for (int i = 0 ; i < sz ; i++) {
if ((java.lang.Character.isLowerCase(str.charAt(i))) == false) {
return false;
}
}
return true;
}
public static boolean isAllUpperCase(java.lang.String str) {
if ((str == null) || (org.apache.commons.lang3.StringUtils.isEmpty(str))) {
return false;
}
int sz = str.length();
for (int i = 0 ; i < sz ; i++) {
if ((java.lang.Character.isUpperCase(str.charAt(i))) == false) {
return false;
}
}
return true;
}
public static java.lang.String defaultString(java.lang.String str) {
return str == null ? org.apache.commons.lang3.StringUtils.EMPTY : str;
}
public static java.lang.String defaultString(java.lang.String str, java.lang.String defaultStr) {
return str == null ? defaultStr : str;
}
public static java.lang.String defaultIfEmpty(java.lang.String str, java.lang.String defaultStr) {
return org.apache.commons.lang3.StringUtils.isEmpty(str) ? defaultStr : str;
}
public static java.lang.String reverse(java.lang.String str) {
if (str == null) {
return null;
}
return new java.lang.StringBuilder(str).reverse().toString();
}
public static java.lang.String reverseDelimited(java.lang.String str, char separatorChar) {
if (str == null) {
return null;
}
java.lang.String[] strs = org.apache.commons.lang3.StringUtils.split(str, separatorChar);
org.apache.commons.lang3.ArrayUtils.reverse(strs);
return org.apache.commons.lang3.StringUtils.join(strs, separatorChar);
}
public static java.lang.String abbreviate(java.lang.String str, int maxWidth) {
return org.apache.commons.lang3.StringUtils.abbreviate(str, 0, maxWidth);
}
public static java.lang.String abbreviate(java.lang.String str, int offset, int maxWidth) {
if (str == null) {
return null;
}
if (maxWidth < 4) {
throw new java.lang.IllegalArgumentException("Minimum abbreviation width is 4");
}
if ((str.length()) <= maxWidth) {
return str;
}
if (offset > (str.length())) {
offset = str.length();
}
if (((str.length()) - offset) < (maxWidth - 3)) {
offset = (str.length()) - (maxWidth - 3);
}
if (offset <= 4) {
return (str.substring(0, (maxWidth - 3))) + "...";
}
if (maxWidth < 7) {
throw new java.lang.IllegalArgumentException("Minimum abbreviation width with offset is 7");
}
if ((offset + (maxWidth - 3)) < (str.length())) {
return "..." + (org.apache.commons.lang3.StringUtils.abbreviate(str.substring(offset), (maxWidth - 3)));
}
return "..." + (str.substring(((str.length()) - (maxWidth - 3))));
}
public static java.lang.String difference(java.lang.String str1, java.lang.String str2) {
if (str1 == null) {
return str2;
}
if (str2 == null) {
return str1;
}
int at = org.apache.commons.lang3.StringUtils.indexOfDifference(str1, str2);
if (at == (-1)) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
return str2.substring(at);
}
public static int indexOfDifference(java.lang.String str1, java.lang.String str2) {
if (str1 == str2) {
return -1;
}
if ((str1 == null) || (str2 == null)) {
return 0;
}
int i;
for (i = 0 ; (i < (str1.length())) && (i < (str2.length())) ; ++i) {
if ((str1.charAt(i)) != (str2.charAt(i))) {
break;
}
}
if ((i < (str2.length())) || (i < (str1.length()))) {
return i;
}
return -1;
}
public static int indexOfDifference(java.lang.String[] strs) {
if ((strs == null) || ((strs.length) <= 1)) {
return -1;
}
boolean anyStringNull = false;
boolean allStringsNull = true;
int arrayLen = strs.length;
int shortestStrLen = java.lang.Integer.MAX_VALUE;
int longestStrLen = 0;
for (int i = 0 ; i < arrayLen ; i++) {
if ((strs[i]) == null) {
anyStringNull = true;
shortestStrLen = 0;
} else {
allStringsNull = false;
shortestStrLen = java.lang.Math.min(strs[i].length(), shortestStrLen);
longestStrLen = java.lang.Math.max(strs[i].length(), longestStrLen);
}
}
if (allStringsNull || ((longestStrLen == 0) && (!anyStringNull))) {
return -1;
}
if (shortestStrLen == 0) {
return 0;
}
int firstDiff = -1;
for (int stringPos = 0 ; stringPos < shortestStrLen ; stringPos++) {
char comparisonChar = strs[0].charAt(stringPos);
for (int arrayPos = 1 ; arrayPos < arrayLen ; arrayPos++) {
if ((strs[arrayPos].charAt(stringPos)) != comparisonChar) {
firstDiff = stringPos;
break;
}
}
if (firstDiff != (-1)) {
break;
}
}
if ((firstDiff == (-1)) && (shortestStrLen != longestStrLen)) {
return shortestStrLen;
}
return firstDiff;
}
public static java.lang.String getCommonPrefix(java.lang.String[] strs) {
if ((strs == null) || ((strs.length) == 0)) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
int smallestIndexOfDiff = org.apache.commons.lang3.StringUtils.indexOfDifference(strs);
if (smallestIndexOfDiff == (-1)) {
if ((strs[0]) == null) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
return strs[0];
} else {
if (smallestIndexOfDiff == 0) {
return org.apache.commons.lang3.StringUtils.EMPTY;
} else {
return strs[0].substring(0, smallestIndexOfDiff);
}
}
}
public static int getLevenshteinDistance(java.lang.String s, java.lang.String t) {
if ((s == null) || (t == null)) {
throw new java.lang.IllegalArgumentException("Strings must not be null");
}
int n = s.length();
int m = t.length();
if (n == 0) {
return m;
} else {
if (m == 0) {
return n;
}
}
if (n > m) {
java.lang.String tmp = s;
s = t;
t = tmp;
n = m;
m = t.length();
}
int[] p = new int[n + 1];
int[] d = new int[n + 1];
int[] _d;
int i;
int j;
char t_j;
int cost;
for (i = 0 ; i <= n ; i++) {
p[i] = i;
}
for (j = 1 ; j <= m ; j++) {
t_j = t.charAt((j - 1));
d[0] = j;
for (i = 1 ; i <= n ; i++) {
cost = (s.charAt((i - 1))) == t_j ? 0 : 1;
d[i] = java.lang.Math.min(java.lang.Math.min(((d[(i - 1)]) + 1), ((p[i]) + 1)), ((p[(i - 1)]) + cost));
}
_d = p;
p = d;
d = _d;
}
return p[n];
}
public static boolean startsWith(java.lang.String str, java.lang.String prefix) {
return org.apache.commons.lang3.StringUtils.startsWith(str, prefix, false);
}
public static boolean startsWithIgnoreCase(java.lang.String str, java.lang.String prefix) {
return org.apache.commons.lang3.StringUtils.startsWith(str, prefix, true);
}
private static boolean startsWith(java.lang.String str, java.lang.String prefix, boolean ignoreCase) {
if ((str == null) || (prefix == null)) {
return (str == null) && (prefix == null);
}
if ((prefix.length()) > (str.length())) {
return false;
}
return str.regionMatches(ignoreCase, 0, prefix, 0, prefix.length());
}
public static boolean startsWithAny(java.lang.String string, java.lang.String[] searchStrings) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(string)) || (org.apache.commons.lang3.ArrayUtils.isEmpty(searchStrings))) {
return false;
}
for (int i = 0 ; i < (searchStrings.length) ; i++) {
java.lang.String searchString = searchStrings[i];
if (org.apache.commons.lang3.StringUtils.startsWith(string, searchString)) {
return true;
}
}
return false;
}
public static boolean endsWith(java.lang.String str, java.lang.String suffix) {
return org.apache.commons.lang3.StringUtils.endsWith(str, suffix, false);
}
public static boolean endsWithIgnoreCase(java.lang.String str, java.lang.String suffix) {
return org.apache.commons.lang3.StringUtils.endsWith(str, suffix, true);
}
private static boolean endsWith(java.lang.String str, java.lang.String suffix, boolean ignoreCase) {
if ((str == null) || (suffix == null)) {
return (str == null) && (suffix == null);
}
if ((suffix.length()) > (str.length())) {
return false;
}
int strOffset = (str.length()) - (suffix.length());
return str.regionMatches(ignoreCase, strOffset, suffix, 0, suffix.length());
}
}
| [
"[email protected]"
] | |
7a12201b3a370bd2ed55fda0f8addc1c8814f32c | 861bae744bc32ba09122bcd8072c43238d9aec81 | /004-complex-parameter/src/main/java/com/lyw/ComplexParameterApplication.java | 411408ff54d904c2bfcfb78c24d3edc6d10f1a7a | [] | no_license | ilsourcecode/reviewSpringboot | f2e3fdf74597a9ebf9e96a214e3fa54b4eb0f46f | f3644849bc5cc4c06848965b5b5c54b6188a09f3 | refs/heads/master | 2023-07-03T15:59:06.940486 | 2021-08-10T00:21:47 | 2021-08-10T00:21:47 | 389,501,734 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 323 | java | package com.lyw;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ComplexParameterApplication {
public static void main(String[] args) {
SpringApplication.run(ComplexParameterApplication.class, args);
}
}
| [
"[email protected]"
] | |
bcef8c4a545a5cac1a44c62919cc7cc5634a27ce | 31e0a8a77d7fa3dbe93936936a67fce7e1be9e20 | /src/test/java/com/mkifolio/concept/controller/RouteControllerTest.java | ed9c4aea2a1595bf29f86bdf824fb33ea518c78a | [] | no_license | alvinvictoria/ws_mkifolio_hateoas_route | c0be313fdb9fcc9dfc077071b77dd6e7444d5adb | 6b770db30f06ad1ae0608ef33ed0a63d9bc29a99 | refs/heads/master | 2021-05-15T23:12:50.792894 | 2017-10-13T02:39:03 | 2017-10-13T02:39:03 | 106,770,081 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,231 | java | package com.mkifolio.concept.controller;
import com.mkifolio.concept.controller.assembler.RouteResourceAssembler;
import com.mkifolio.concept.dto.RouteDTO;
import com.mkifolio.concept.manager.IRouteManager;
import org.apache.catalina.filters.CorsFilter;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.springframework.hateoas.MediaTypes;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import java.util.ArrayList;
import java.util.List;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.*;
public class RouteControllerTest {
private MockMvc mockMvc;
@Mock
private IRouteManager routeManager;
@Mock
private RouteResourceAssembler assembler;
@InjectMocks
private RouteController routeController;
@Before
public void init(){
MockitoAnnotations.initMocks(this);
mockMvc = MockMvcBuilders.standaloneSetup(routeController).addFilters(new CorsFilter()).build();
}
@Test
public void testGetRoutesWhenSuccess() throws Exception{
List<RouteDTO> listing = new ArrayList<RouteDTO>();
listing.add(RouteDTO.builder().routeId(1).name("test").description("test success").build());
Mockito.when(routeManager.getRoutes()).thenReturn(listing);
mockMvc.perform(get("/routes"))
.andExpect(status().isOk())
.andExpect(content().contentType("application/hal+json;charset=UTF-8"));
}
@Test
public void testGetRoutesWhenNoResource() throws Exception{
Mockito.when(routeManager.getRoutes()).thenReturn(new ArrayList<RouteDTO>());
mockMvc.perform(get("/routes"))
.andExpect(status().isNotFound());
}
}
| [
"[email protected]"
] | |
df3dd65e264510ae4bc29f801d8d843a4ff8269d | 129f58086770fc74c171e9c1edfd63b4257210f3 | /src/testcases/CWE81_XSS_Error_Message/CWE81_XSS_Error_Message__Servlet_listen_tcp_21.java | 8723ad0ff0181ef9234a203b3e699784903e681e | [] | no_license | glopezGitHub/Android23 | 1bd0b6a6c7ce3c7439a74f1e4dcef2c4c0fac4ba | 6215d0684c4fbdc7217ccfbedfccfca69824cc5e | refs/heads/master | 2023-03-07T15:14:59.447795 | 2023-02-06T13:59:49 | 2023-02-06T13:59:49 | 6,856,387 | 0 | 3 | null | 2023-02-06T18:38:17 | 2012-11-25T22:04:23 | Java | UTF-8 | Java | false | false | 13,082 | java | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE81_XSS_Error_Message__Servlet_listen_tcp_21.java
Label Definition File: CWE81_XSS_Error_Message__Servlet.label.xml
Template File: sources-sink-21.tmpl.java
*/
/*
* @description
* CWE: 81 Cross Site Scripting (XSS) in Error Message
* BadSource: listen_tcp Read data using a listening tcp connection
* GoodSource: A hardcoded string
* Sinks: sendErrorServlet
* GoodSink: $Sink.GoodSinkBody.description$
* BadSink : XSS in sendError
* Flow Variant: 21 Control flow: Flow controlled by value of a private variable. All functions contained in one file.
*
* */
package testcases.CWE81_XSS_Error_Message;
import testcasesupport.*;
import javax.servlet.http.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.net.Socket;
import java.net.ServerSocket;
import java.util.logging.Level;
import java.util.logging.Logger;
public class CWE81_XSS_Error_Message__Servlet_listen_tcp_21 extends AbstractTestCaseServlet
{
/* The variable below is used to drive control flow in the source function */
private boolean bad_private = false;
public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
String data;
bad_private = true;
data = bad_source(request, response);
if (data != null)
{
/* POTENTIAL FLAW: script code (e.g. id=<script>alert('xss')</script>) is sent to the client; The built-in J2EE server automatically does some HTML entity encoding. Therefore, to test this, change response.sendError to response.getWriter().println and remove the 404,
*/
response.sendError(404, "<br>bad() - Parameter name has value " + data);
}
}
private String bad_source(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
String data;
if(bad_private)
{
data = ""; /* Initialize data */
/* Read data using a listening tcp connection */
{
ServerSocket listener = null;
Socket sock = null;
BufferedReader buffread = null;
InputStreamReader instrread = null;
try
{
/* read input from socket */
listener = new ServerSocket(39543);
sock = listener.accept();
instrread = new InputStreamReader(sock.getInputStream(), "UTF-8");
buffread = new BufferedReader(instrread);
/* POTENTIAL FLAW: Read data using a listening tcp connection */
data = buffread.readLine();
}
catch( IOException ioe )
{
IO.logger.log(Level.WARNING, "Error with stream reading", ioe);
}
finally
{
/* Close stream reading objects */
try {
if( buffread != null )
{
buffread.close();
}
}
catch( IOException ioe )
{
IO.logger.log(Level.WARNING, "Error closing BufferedReader", ioe);
}
try {
if( instrread != null )
{
instrread.close();
}
}
catch( IOException ioe )
{
IO.logger.log(Level.WARNING, "Error closing InputStreamReader", ioe);
}
/* Close socket objects */
try {
if( sock != null )
{
sock.close();
}
}
catch( IOException e )
{
IO.logger.log(Level.WARNING, "Error closing Socket", e);
}
try {
if( listener != null )
{
listener.close();
}
}
catch( IOException e )
{
IO.logger.log(Level.WARNING, "Error closing ServerSocket", e);
}
}
}
}
else {
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
/* FIX: Use a hardcoded string */
data = "foo";
}
return data;
}
/* The variables below are used to drive control flow in the source functions. */
private boolean goodG2B1_private = false;
private boolean goodG2B2_private = false;
public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
goodG2B1(request, response);
goodG2B2(request, response);
}
/* goodG2B1() - use goodsource and badsink by setting the variable to false instead of true */
private void goodG2B1(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
String data;
goodG2B1_private = false;
data = goodG2B1_source(request, response);
if (data != null)
{
/* POTENTIAL FLAW: script code (e.g. id=<script>alert('xss')</script>) is sent to the client; The built-in J2EE server automatically does some HTML entity encoding. Therefore, to test this, change response.sendError to response.getWriter().println and remove the 404,
*/
response.sendError(404, "<br>bad() - Parameter name has value " + data);
}
}
private String goodG2B1_source(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
String data;
if(goodG2B1_private)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
data = ""; /* Initialize data */
/* Read data using a listening tcp connection */
{
ServerSocket listener = null;
Socket sock = null;
BufferedReader buffread = null;
InputStreamReader instrread = null;
try
{
/* read input from socket */
listener = new ServerSocket(39543);
sock = listener.accept();
instrread = new InputStreamReader(sock.getInputStream(), "UTF-8");
buffread = new BufferedReader(instrread);
/* POTENTIAL FLAW: Read data using a listening tcp connection */
data = buffread.readLine();
}
catch( IOException ioe )
{
IO.logger.log(Level.WARNING, "Error with stream reading", ioe);
}
finally
{
/* Close stream reading objects */
try {
if( buffread != null )
{
buffread.close();
}
}
catch( IOException ioe )
{
IO.logger.log(Level.WARNING, "Error closing BufferedReader", ioe);
}
try {
if( instrread != null )
{
instrread.close();
}
}
catch( IOException ioe )
{
IO.logger.log(Level.WARNING, "Error closing InputStreamReader", ioe);
}
/* Close socket objects */
try {
if( sock != null )
{
sock.close();
}
}
catch( IOException e )
{
IO.logger.log(Level.WARNING, "Error closing Socket", e);
}
try {
if( listener != null )
{
listener.close();
}
}
catch( IOException e )
{
IO.logger.log(Level.WARNING, "Error closing ServerSocket", e);
}
}
}
}
else {
/* FIX: Use a hardcoded string */
data = "foo";
}
return data;
}
/* goodG2B2() - use goodsource and badsink by reversing the blocks in the if in the sink function */
private void goodG2B2(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
String data;
goodG2B2_private = true;
data = goodG2B2_source(request, response);
if (data != null)
{
/* POTENTIAL FLAW: script code (e.g. id=<script>alert('xss')</script>) is sent to the client; The built-in J2EE server automatically does some HTML entity encoding. Therefore, to test this, change response.sendError to response.getWriter().println and remove the 404,
*/
response.sendError(404, "<br>bad() - Parameter name has value " + data);
}
}
private String goodG2B2_source(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
String data;
if(goodG2B2_private)
{
/* FIX: Use a hardcoded string */
data = "foo";
}
else {
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
data = ""; /* Initialize data */
/* Read data using a listening tcp connection */
{
ServerSocket listener = null;
Socket sock = null;
BufferedReader buffread = null;
InputStreamReader instrread = null;
try {
/* read input from socket */
listener = new ServerSocket(39543);
sock = listener.accept();
instrread = new InputStreamReader(sock.getInputStream(), "UTF-8");
buffread = new BufferedReader(instrread);
/* POTENTIAL FLAW: Read data using a listening tcp connection */
data = buffread.readLine();
}
catch( IOException ioe )
{
IO.logger.log(Level.WARNING, "Error with stream reading", ioe);
}
finally {
/* Close stream reading objects */
try {
if( buffread != null )
{
buffread.close();
}
}
catch( IOException ioe )
{
IO.logger.log(Level.WARNING, "Error closing BufferedReader", ioe);
}
try {
if( instrread != null )
{
instrread.close();
}
}
catch( IOException ioe )
{
IO.logger.log(Level.WARNING, "Error closing InputStreamReader", ioe);
}
/* Close socket objects */
try {
if( sock != null )
{
sock.close();
}
}
catch( IOException e )
{
IO.logger.log(Level.WARNING, "Error closing Socket", e);
}
try {
if( listener != null )
{
listener.close();
}
}
catch( IOException e )
{
IO.logger.log(Level.WARNING, "Error closing ServerSocket", e);
}
}
}
}
return data;
}
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
public static void main(String[] args) throws ClassNotFoundException,
InstantiationException, IllegalAccessException
{
mainFromParent(args);
}
}
| [
"[email protected]"
] | |
c8335ab045bcf2f64aef955227103b79494712cc | 353d0b002edc6a6dc09a1776b9ebe3fadb3ab0d9 | /app/src/main/java/com/example/specialistfinderapp/Interface/IBookingInfoLoadListener.java | 31e9905b0e5799273c7882757d33b9c5de99a0cd | [] | no_license | Sean7007/SpecialistFinderApp | 7ae7194c36ed9b3d62bf10db2464e1070893660f | b332ab32998394283cf5f5c8fd85934d7a5209a8 | refs/heads/master | 2021-03-31T08:25:41.925460 | 2020-06-09T20:59:52 | 2020-06-09T20:59:52 | 267,421,406 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 342 | java | package com.example.specialistfinderapp.Interface;
import com.example.specialistfinderapp.Model.BookingInformation;
public interface IBookingInfoLoadListener {
void onBookingInfoLoadEmpty();
void onBookingInfoLoadSuccess(BookingInformation bookingInformation, String documentId);
void onBookingInfoLoadFailed(String message);
}
| [
"[email protected]"
] | |
a0f491dbb520e0849ea96b2ae41fc7cb07c55e3a | 7ebcd5c3f0ef720d6631b9ae314468b3bf57767c | /Design_patterns/src/main/java/ChainOfResponsibility/Chain.java | b87c02c6276a776ef45ac3cc908c87db493f1ef2 | [] | no_license | jagadishwarik/KobbaJagadishwari_DesignPatterns | 0523b64332b0d3ed1dd1b255c2c71b0c8e1a9198 | c0015347b385f35254fa44fdf9d409271f77fb89 | refs/heads/master | 2021-03-05T04:24:39.607554 | 2020-03-09T17:10:43 | 2020-03-09T17:10:43 | 246,094,781 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 130 | java | package ChainOfResponsibility;
public interface Chain {
void setNextChain(Chain nextChain);
void dispense(Currency cur);
}
| [
"[email protected]"
] | |
6be857e323b4f0183c2dfe746cc8f99267c3261f | 985631fb7113ab95bd0318835742d906702eb293 | /lab1b.java | bba739e2543937d648e486d319d72141c8a61f67 | [] | no_license | yerkenov/OOP | da743a8b7d5f82f0a284bbf9143dd66602d428cb | e7c2aee82b82ea3d8ff47d9bb4d5c4dce5da56f2 | refs/heads/master | 2020-03-28T09:17:27.778968 | 2018-11-26T13:31:32 | 2018-11-26T13:31:32 | 148,026,721 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 426 | java | import java.util.Scanner;
public class lab1b {
public static void main(String args[]){
Scanner input = new Scanner(System.in);
int n1, n2, n3;
n1 = input.nextInt();
n2 = n1 + 1;
n3 = n1 - 1;
System.out.println("The next number for the number "+ n1 + " is " + n2 + ".");
System.out.println("The previous number for the number "+ n1 + " is " + n3 + ".");
}
}
| [
"[email protected]"
] | |
42f56453571e66ac177e804258d9dc97358b7ddb | 3612061cec86f30e66eb9846d7c926ec1783c202 | /src/main/java/com/recipeBook/recipebook/repositories/reactive/UnitOfMeasureReactiveRepository.java | b2294eb6508515ce7e86f57a9b17677541c9b2d1 | [] | no_license | IvanKrstic123/recipe-book-mongo | f8a176aac1ba87f31ddde4087476bf869fe5330e | a7114b750b76a490b5d1fbab9e7431c186bf6892 | refs/heads/master | 2023-08-22T19:16:47.289927 | 2021-09-20T23:31:15 | 2021-09-20T23:31:15 | 404,865,990 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 443 | java | package com.recipeBook.recipebook.repositories.reactive;
import com.recipeBook.recipebook.domain.Category;
import com.recipeBook.recipebook.domain.UnitOfMeasure;
import org.springframework.data.mongodb.repository.ReactiveMongoRepository;
import reactor.core.publisher.Mono;
public interface UnitOfMeasureReactiveRepository extends ReactiveMongoRepository<UnitOfMeasure, String> {
Mono<Category> findByDescription(String description);
}
| [
"[email protected]"
] | |
a1363abf1fec2153d2e10f93763de5fcb0ec6369 | 13c3f9bb15fde7aee80119d444c840670898582e | /app/src/main/java/com/example/rubensrodrigues/agenda/Localizador.java | b1cef18f71f6be9afc67a4a58cadd8310b6d31d0 | [] | no_license | rodriguesv2/Agenda-Android | 627d39f17411ef776092d8f1b5627948f0c14b6b | 1b3439505c04887be5541bce88322a702dc6948f | refs/heads/master | 2021-06-19T04:36:42.418039 | 2017-07-12T18:17:02 | 2017-07-12T18:17:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,834 | java | package com.example.rubensrodrigues.agenda;
import android.content.Context;
import android.location.Location;
import android.os.Bundle;
import android.support.annotation.Nullable;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.model.LatLng;
/**
* Created by rubens on 04/07/17.
*/
public class Localizador implements GoogleApiClient.ConnectionCallbacks, LocationListener{
private final GoogleMap mapa;
private GoogleApiClient client;
public Localizador(Context context, GoogleMap mapa){
client = new GoogleApiClient.Builder(context)
.addApi(LocationServices.API)
.addConnectionCallbacks(this)
.build();
client.connect();
this.mapa = mapa;
}
@Override
public void onConnected(@Nullable Bundle bundle) {
LocationRequest request = new LocationRequest();
request.setSmallestDisplacement(50);
request.setInterval(1000);
request.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
LocationServices.FusedLocationApi.requestLocationUpdates(client, request, this);
}
@Override
public void onConnectionSuspended(int i) {
}
@Override
public void onLocationChanged(Location location) {
LatLng coodernadas = new LatLng(location.getLatitude(), location.getLongitude());
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLng(coodernadas);
mapa.moveCamera(cameraUpdate);
}
}
| [
"[email protected]"
] | |
99d6b56a2bea7678305e2bf72ad38d5ba27bf4ed | 630fa461bab8db99a96f7341fa0cf44d02c677ac | /src/main/java/tk/caledonian/hybridsmp/commands/cheats/gamemodes/Spectator.java | 459e6379218100a63506ca428f3958d911cb3bc2 | [] | no_license | CaledonianEH/HybridSMP | 922d2d58ff9f209631f05e3b4b45c7bee496bea7 | 5c175b8ee6c4c2216c939f4e00c85fa99fb3adf8 | refs/heads/master | 2022-12-24T06:35:57.022678 | 2020-09-30T17:59:39 | 2020-09-30T17:59:39 | 293,867,328 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,906 | java | package tk.caledonian.hybridsmp.commands.cheats.gamemodes;
import me.clip.placeholderapi.PlaceholderAPI;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import tk.caledonian.hybridsmp.managers.CommandHandler;
import tk.caledonian.hybridsmp.utils.Files;
import tk.caledonian.hybridsmp.utils.Logger;
import tk.caledonian.hybridsmp.utils.Utils;
public class Spectator implements CommandHandler {
@Override
public void execute(CommandSender sender, Command command, String[] args) {
String prefix = Files.msgs.getString("prefix");
String gamemode = Files.msgs.getString("gamemodes.names.spectator");
if(sender instanceof Player){
Player p = (Player) sender;
if(args.length == 0){
// Player
if(p.hasPermission(Files.perms.getString("spectator.self"))){
String self = PlaceholderAPI.setPlaceholders(p, Files.msgs.getString("gamemodes.self").replace("%player%", p.getName()).replace("%prefix%", prefix).replace("%gamemode%", gamemode));
p.setGameMode(GameMode.SPECTATOR);
p.sendMessage(Utils.chat(self));
for (Player player : Bukkit.getOnlinePlayers()) {
if (player.hasPermission(Files.perms.getString("logs.gamemode"))) {
if(player.getName() != p.getName()){
player.sendMessage(Utils.chat(Files.msgs.getString("logs.gamemode.self").replace("%prefix%", prefix
).replace("%player%", p.getName()).replace("%gamemode%", gamemode)));
}
}else{return;}
}
}
}else if(args.length == 1){
if(p.hasPermission(Files.perms.getString("spectator.other"))){
Player t = Bukkit.getPlayer(args[0]);
if(t instanceof Player){
String target = PlaceholderAPI.setPlaceholders(p, Files.msgs.getString("gamemodes.target").replace("%prefix%", prefix)
.replace("%gamemode%", gamemode).replace("%target%", t.getName()).replace("%player%", p.getName()));
String s = PlaceholderAPI.setPlaceholders(t, Files.msgs.getString("gamemodes.sender").replace("%prefix%", prefix)
.replace("%gamemode%", gamemode).replace("%target%", t.getName()).replace("%player%", p.getName()));
t.setGameMode(GameMode.SPECTATOR);
t.sendMessage(Utils.chat(target));
p.sendMessage(Utils.chat(s));
for (Player player : Bukkit.getOnlinePlayers()) {
if (player.hasPermission(Files.perms.getString("logs.gamemode"))) {
if(player.getName() != p.getName()){
player.sendMessage(Utils.chat(Files.msgs.getString("logs.gamemode.other").replace("%prefix%", prefix
).replace("%player%", p.getName()).replace("%gamemode%", gamemode).replace("%target%", t.getName())));
}
}else{return;}
}
}else{p.sendMessage(Utils.chat(Files.msgs.getString("player-not-found").replace("%prefix%", prefix).replace("%player%", args[0])));}
}else{p.sendMessage(Utils.chat(Files.msgs.getString("no-permission").replace("%prefix%", prefix)));}
}else if(args.length > 1){p.sendMessage(Utils.chat(Files.msgs.getString("args").replace("%prefix%", prefix)));}
}else{
Logger.log(Logger.LogLevel.INFO, Files.msgs.getString("console-error"));
}
}
}
| [
"[email protected]"
] | |
8f660b29a9ac1187f509cc9558b44b410573470b | 1c30b7808d249c832eb1a481be9ac1292561b5c3 | /ch03-ioc-homework/src/main/java/com/bjpowernode/dao/UserDao.java | 5802dfd113d50fef674ed2dbb8f404ba73681cd4 | [] | no_license | tm6129/spring | b140b6f9049b9a63117e5b9f7cd933a325ce14a9 | c50dbfeb4514d84e50ae6e544b3a557200c2893f | refs/heads/master | 2023-07-04T23:09:21.608799 | 2021-08-24T01:29:09 | 2021-08-24T01:29:09 | 396,225,249 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 135 | java | package com.bjpowernode.dao;
import com.bjpowernode.domain.SysUser;
public interface UserDao {
void insertUser(SysUser user);
}
| [
"[email protected]"
] | |
116d43268120fe74af1b968a0b2752ccc9f61852 | 4864c201f706e4305ff2edf5449c86cfd4942ba5 | /gltAss3/org.xtext.robot.ui/xtend-gen/org/xtext/ui/labeling/RobotDescriptionLabelProvider.java | cfca552381a975004aca374fc4c76baf54968483 | [] | no_license | joostPieterse/glt | 322cf95604c13af147f68c8d0e803bb811f7f396 | dbbd49644e5305c62e49a9dc23335efbbca2baab | refs/heads/master | 2021-06-18T18:28:24.134701 | 2017-06-22T09:55:20 | 2017-06-22T09:55:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 420 | java | /**
* generated by Xtext 2.11.0
*/
package org.xtext.ui.labeling;
import org.eclipse.xtext.ui.label.DefaultDescriptionLabelProvider;
/**
* Provides labels for IEObjectDescriptions and IResourceDescriptions.
*
* See https://www.eclipse.org/Xtext/documentation/304_ide_concepts.html#label-provider
*/
@SuppressWarnings("all")
public class RobotDescriptionLabelProvider extends DefaultDescriptionLabelProvider {
}
| [
"[email protected]"
] | |
5b3db6b237d47e12dd71e5691bb3b937c6de36b7 | f3ccdf08d33cfb9694e12465d6f9c9f83bcdbc0b | /data/lab4/src/com/java/lab5/Lab4.java | be640fab71d4ad26b1a6393372ce9438049f94b2 | [] | no_license | attrib1/Data_Vu | 5cc148129b9a804c03707d4041977cfc0a1c709a | 38abb97641356a1eccd64b67d4a802ff8c9c35b0 | refs/heads/master | 2016-09-05T12:01:11.442242 | 2015-04-30T08:04:23 | 2015-04-30T08:04:23 | 34,841,992 | 0 | 0 | null | null | null | null | TIS-620 | Java | false | false | 985 | java | package com.java.lab5;
import java.util.Scanner;
public class Lab4 {
public static void main(String[] args) {
int a[] = input(5);
System.out.println("อยู่ตำแหน่งที่ "+search(a, 6));
System.out.println("ค่าเฉลีย " + mean(a));
}
public static float mean(int a[]) {
// TODO Auto-generated method stub
int num=0;
for (int i = 0; i < a.length; i++) {
num+=a[i];
}
num/=a.length;
return num;
}
public static int search(int[] a, int i) {
// TODO Auto-generated method stub
int numReturn = -1;
for (int j = 0; j < a.length; j++) {
if(a[j]==i){
numReturn = j;
}
}
return numReturn;
}
public static int[] input(int b) {
// TODO Auto-generated method stub
Scanner Sc = new Scanner(System.in);
int num[] = new int[b];
for (int i = 0; i < num.length; i++) {
System.out.print("Input Number " + (i + 1) + ": ");
num[i] = Sc.nextInt();
}
return num;
}
}
| [
"Com_Vu"
] | Com_Vu |
a61b13f49ee1cf34e75f7969aaea2485eeb9186b | 71f0b5e81ba3f7e3c402a1e24931806d8e595e4a | /TrainNotificator/app/src/main/java/com/dev/android/yuu/trainnotificator/TrainTimeTableModel.java | edab2b55bb052866526bd13ef9250499b9f081c3 | [] | no_license | yuuuuuyuuuu/trainnotificator | 1b1c60c9d446a152e106251bf7f96f3992d05b73 | 3b03233d312ef9aa020f8b2380e3792f22a499c3 | refs/heads/master | 2020-05-05T06:56:04.684871 | 2014-10-02T00:29:04 | 2014-10-02T00:29:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,469 | java | package com.dev.android.yuu.trainnotificator;
import android.content.Context;
import android.content.res.AssetManager;
import android.content.res.Resources;
import android.util.Log;
import com.dev.android.yuu.trainnotificator.utility.CalendarUtility;
import com.dev.android.yuu.trainnotificator.utility.TrainTimeTableUtility;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Calendar;
/**
* Created by Chieko on 8/31/14.
*/
public class TrainTimeTableModel
{
private Context mContext = null;
private ArrayList<TrainTimeData> mWeekdayTrainTimeDataList = null;
private ArrayList<TrainTimeData> mWeekendTrainTimeDataList = null;
/* test */
private static final String FILENAME_TIMETABLE_SOTESTU_RYOKUENTOSHI_WEEKDAY = "timetable_sotetsu_ryokuen.txt";
public TrainTimeTableModel(Context context)
{
Log.d(this.getClass().toString(), "TrainTimeTableModel()");
this.mContext = context;
this.loadTimeTable();
}
public TrainTimeData GetNextTrainTime()
{
Log.d(this.getClass().toString(), "GetNextTrainTime()");
Calendar calendar = Calendar.getInstance();
int hourOfDay = calendar.get(Calendar.HOUR_OF_DAY);
int minute = calendar.get(Calendar.MINUTE);
TrainTimeData nextTrainData = this.findNextTrainTime(hourOfDay, minute);
if(null == nextTrainData)
{
Log.d(this.getClass().toString(), "nextTrainData is null");
}
else
{
Log.d(this.getClass().toString(), "nextTrainData hourOfDay:" + nextTrainData.HourOfDay() + " minute:" + nextTrainData.Minute());
}
return nextTrainData;
}
public TrainTimeData GetNextTraimTime(int targetHourOfDay, int targetMinute)
{
Log.d(this.getClass().toString(), "GetNextTraimTime(" + targetHourOfDay + "," + targetMinute + ")");
TrainTimeData nextTrainData = this.findNextTrainTime(targetHourOfDay, targetMinute);
return nextTrainData;
}
public int GetTrainTimeDataNumber()
{
Log.d(this.getClass().toString(), "GetTrainTimeDataNumber");
return this.mWeekdayTrainTimeDataList.size();
}
private TrainTimeData findNextTrainTime(int hourOfDay, int minute)
{
Log.d(this.getClass().toString(), "findNextTrainTime(" + hourOfDay + ", " + minute + ")");
// search weekday time table
if(null == this.mWeekdayTrainTimeDataList)
{
Log.e(this.getClass().toString(), "mWeekdayTrainTimeDataList in null.");
return null;
}
TrainTimeData nextTrainTimeData = null;
for(TrainTimeData timeData : this.mWeekdayTrainTimeDataList)
{
// past time data
if(timeData.HourOfDay() < hourOfDay) continue;
// TODO: may be able to combine if statements
if(timeData.HourOfDay() == hourOfDay)
{
if(timeData.Minute() <= minute) continue;
// Next data found
nextTrainTimeData = timeData;
Log.d(this.getClass().toString(), "next data found. hourOfDay:" + timeData.HourOfDay() + " minute:" + timeData.Minute());
break;
}
else if(hourOfDay < timeData.HourOfDay())
{
// Next data found
nextTrainTimeData = timeData;
Log.d(this.getClass().toString(), "next data found. hourOfDay:" + timeData.HourOfDay() + " minute:" + timeData.Minute());
break;
}
}
if(null == nextTrainTimeData)
{
Log.d(this.getClass().toString(), "next data NOT found. Setting first train data");
nextTrainTimeData = this.mWeekdayTrainTimeDataList.get(0);
}
return nextTrainTimeData;
}
private void loadTimeTable()
{
Log.d(this.getClass().toString(), "loadTimeTable()");
this.mWeekdayTrainTimeDataList = new ArrayList<TrainTimeData>();
AssetManager am = this.mContext.getAssets();
InputStream is = null;
//String dataTableFileName = this.getTableDataFile();
String dataTableFileName = TrainTimeTableUtility.GetTodaysTimetable(this.mContext);
Log.d(this.getClass().toString(), "time table file: " + dataTableFileName);
//Log.d(this.getClass().toString(), "time table file test: " + dataTableFileNameTest);
try
{
is = am.open(dataTableFileName);
}
catch (IOException e)
{
e.printStackTrace();
}
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line = "";
while(null != line)
{
try
{
line = br.readLine();
}
catch (IOException e)
{
e.printStackTrace();
}
if(null == line) break;
if(!(line.equals("start") || line.equals("end")))
{
int hourOfDay = this.extractHourOfDay(line);
ArrayList<Integer> minuteArray = this.extractMinute(line);
for(Integer minuteData : minuteArray)
{
TrainTimeData newData = new TrainTimeData(hourOfDay, minuteData, 0, "");
this.mWeekdayTrainTimeDataList.add(newData);
}
}
Log.d(this.getClass().toString(), "line: " + line);
}
Log.d(this.getClass().toString(), "this.mWeekdayTrainTimeDataList.size(): " + this.mWeekdayTrainTimeDataList.size());
}
private int extractHourOfDay(String lineData)
{
Log.d(this.getClass().toString(), "extractHourOfDay(" + lineData + ")");
int hourOfDay = -1;
int EXPECTED_SPLITTED_NUMBER = 2;
String[] splitted = lineData.split(":");
if(EXPECTED_SPLITTED_NUMBER != splitted.length)
{
Log.e(this.getClass().toString(), "splitted.length is NOT 2 in extractHourOfDay");
return -1;
}
hourOfDay = Integer.parseInt(splitted[0]);
Log.d(this.getClass().toString(), "extracted hourOfDay: " + hourOfDay);
return hourOfDay;
}
private ArrayList<Integer> extractMinute(String lineData)
{
Log.d(this.getClass().toString(), "extractMinute(" + lineData + ")");
String[] splitted = lineData.split(":");
int EXPECTED_SPLITTED_NUMBER = 2;
if(EXPECTED_SPLITTED_NUMBER != splitted.length)
{
Log.e(this.getClass().toString(), "splitted.length is NOT 2 in extractMinute");
return null;
}
String minuteString = splitted[1];
Log.d(this.getClass().toString(), "minuteString: " + minuteString);
String[] minuteSplitted = minuteString.split(" ");
Log.d(this.getClass().toString(), "minuteSplitted.length: " + minuteSplitted.length);
ArrayList<Integer> minuteArray = new ArrayList<Integer>();
for(int i = 0; i < minuteSplitted.length; i++)
{
int minute = Integer.parseInt(minuteSplitted[i].replaceAll("[^0-9]", ""));
String type = minuteSplitted[i].replaceAll("[^A-z]", "");
Log.d(this.getClass().toString(), "minute: " + minute + " type:" + type);
minuteArray.add(minute);
}
return minuteArray;
}
private String getTableDataFile()
{
Log.d(this.getClass().toString(), "getTableDataFile");
String filename = "";
int currentDay = CalendarUtility.GetCurrentDay();
int directionType = UserDataManager.GetDirectionType(this.mContext);
Log.d(this.getClass().toString(), "currentDay:" + currentDay);
Resources res = this.mContext.getResources();
switch (currentDay)
{
case Calendar.SUNDAY:
if(Constants.DIRECTION_TYPE_1 == directionType)
{
filename = res.getString(R.string.file_timetable_direction1_holiday);
}
else
{
filename = res.getString(R.string.file_timetable_direction2_holiday);
}
break;
case Calendar.SATURDAY:
if(Constants.DIRECTION_TYPE_1 == directionType)
{
filename = res.getString(R.string.file_timetable_direction1_saturday);
}
else
{
filename = res.getString(R.string.file_timetable_direction2_saturday);
}
break;
case Calendar.MONDAY:
case Calendar.TUESDAY:
case Calendar.WEDNESDAY:
case Calendar.THURSDAY:
case Calendar.FRIDAY:
if(Constants.DIRECTION_TYPE_1 == directionType)
{
filename = res.getString(R.string.file_timetable_direction1_weekday);
}
else
{
filename = res.getString(R.string.file_timetable_direction2_weekday);
}
break;
default:
break;
}
Log.d(this.getClass().toString(), "filename: " + filename);
return filename;
}
}
| [
"[email protected]"
] | |
ad8221b737eb1a4c42c7c7950c621bf1bad561c2 | 4be10d89f4d94922dd75550b75f15b2f435ec8b5 | /app/src/test/java/com/kotrots/blescan/ExampleUnitTest.java | 92d43536ceb56d34ce04a834f3f2e4d2d660ccae | [] | no_license | kotrotskon/BLEScan | 126d05e1feb835d18d258fe5bdefbe8b6b49cdf6 | 93653b61c5b9b37ca69e1a85dbdb41322d279c95 | refs/heads/master | 2020-03-23T20:29:30.343646 | 2018-09-01T18:09:33 | 2018-09-01T18:09:33 | 142,044,475 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 380 | java | package com.kotrots.blescan;
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);
}
} | [
"[email protected]"
] | |
7592681691760a261998ea9b344c2346a83700bf | 4132c35d35057a23b521240cfcc5849d63cb4ef2 | /src/main/java/com/wyait/manage/service/basic/BoardService.java | fa8ce2096285b4d00db4b3a9763070167cd62ab1 | [] | no_license | SirLittleDonkey/rongjia | 225788f89aa358ae94606ce4702709b60ec8c4a9 | d8bb9b4af1d927f84513939abc9ba5139520c5c6 | refs/heads/master | 2020-04-05T22:12:13.221782 | 2018-11-30T10:50:00 | 2018-11-30T10:50:00 | 156,647,263 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 502 | java | package com.wyait.manage.service.basic;
import com.wyait.manage.entity.basic.BoardSearchDTO;
import com.wyait.manage.entity.basic.BoardVO;
import com.wyait.manage.pojo.basic.Board;
import com.wyait.manage.utils.PageDataResult;
public interface BoardService {
public PageDataResult getBoards(Integer page, Integer limit, BoardSearchDTO boardSearchDTO);
public String setDelBoard(Integer id, Integer isDel);
public BoardVO getBoard(Integer id);
public String setBoard(Board board);
}
| [
"[email protected]"
] | |
fd065e0b3cb9c48ba29bd8330b671cfd9def8b4f | d81c4ce0bb5e0ea1f2ca19216c42f9fa84d36e13 | /src/com/crudservlet/EditServlet2.java | e624af92aa47090a3080364c6d6bb192551507b2 | [] | no_license | PauloVictorLira/CRUDinServlet | d2dbd641e39f1cf9250dbc1768b0617aa46cf91f | dfa79ef3fe793d147dda5ddd33d7f63ebd4d6059 | refs/heads/main | 2023-01-22T18:38:56.508855 | 2020-12-01T19:59:58 | 2020-12-01T19:59:58 | 313,743,997 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,841 | java | // PAULO VICTOR LIRA SILVA 3003906
package com.crudservlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/EditServlet2")
public class EditServlet2 extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out=response.getWriter();
String sid=request.getParameter("id");
int id=Integer.parseInt(sid);
String nome=request.getParameter("nome");
String sunidadeCompra=request.getParameter("unidadeCompra");
int unidadeCompra=Integer.parseInt(sunidadeCompra);
String descricao=request.getParameter("descricao");
String sqtdPrevistoMes = request.getParameter("qtdPrevistoMes");
double qtdPrevistoMes = Double.parseDouble(sqtdPrevistoMes);
String sprecoMaxComprado=request.getParameter("precoMaxComprado");
double precoMaxComprado = Double.parseDouble(sprecoMaxComprado);
Emp e=new Emp();
e.setId(id);
e.setNome(nome);
e.setUnidadeCompra(unidadeCompra);
e.setDescricao(descricao);
e.setQtdPrevistoMes(qtdPrevistoMes);
e.setPrecoMaxComprado(precoMaxComprado);
int status=EmpDao.update(e);
if(status>0){
response.sendRedirect("ViewServlet");
}else{
out.println("Sorry! unable to update record");
}
out.close();
}
} | [
"[email protected]"
] | |
a5c33cedfd4809d94d84fbbd6d8815f9f07da504 | 9b631783a0f96ef9b05ed8320d06cf3ad4075f76 | /src/org/tempuri/ObtieneRetencion.java | e3d9527328ce422bf1189c05001fc4005f0d3941 | [] | no_license | njmube/adobe | cde61b9676ab999b9a0457f62acd8c202fef8e1c | af4b0cc023ce4a443d54f2f6f4e0407d5eb2d139 | refs/heads/master | 2022-11-14T18:39:36.007072 | 2019-09-19T15:46:17 | 2019-09-19T15:46:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,892 | java |
package org.tempuri;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Clase Java para anonymous complex type.
*
* <p>El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="usuarioIntegrador" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="rfcEmisor" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="folioUUID" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"usuarioIntegrador",
"rfcEmisor",
"folioUUID"
})
@XmlRootElement(name = "ObtieneRetencion")
public class ObtieneRetencion {
protected String usuarioIntegrador;
protected String rfcEmisor;
protected String folioUUID;
/**
* Obtiene el valor de la propiedad usuarioIntegrador.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUsuarioIntegrador() {
return usuarioIntegrador;
}
/**
* Define el valor de la propiedad usuarioIntegrador.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUsuarioIntegrador(String value) {
this.usuarioIntegrador = value;
}
/**
* Obtiene el valor de la propiedad rfcEmisor.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRfcEmisor() {
return rfcEmisor;
}
/**
* Define el valor de la propiedad rfcEmisor.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRfcEmisor(String value) {
this.rfcEmisor = value;
}
/**
* Obtiene el valor de la propiedad folioUUID.
*
* @return
* possible object is
* {@link String }
*
*/
public String getFolioUUID() {
return folioUUID;
}
/**
* Define el valor de la propiedad folioUUID.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setFolioUUID(String value) {
this.folioUUID = value;
}
}
| [
"[email protected]"
] | |
b2b18df41d115aa1d08a0f5bf489e9e68e043091 | 07b9bae452d9d8fa3b9590b6ada136f56c80bb1a | /API_MilenioCloud/src/main/java/com/api/mileniocloud/MyApplication.java | 12c01c9eec150168b70843a7d8c01248758a8087 | [] | no_license | desarrollomarquez/Proyecto_WebAPI | 3c4bceab250853c3d1ff5cc7cc2f62142cd2bdf4 | de013f9a103c6a5e4cd4d1558c169d7735f91fa0 | refs/heads/master | 2022-09-18T19:44:39.155177 | 2019-06-07T05:03:06 | 2019-06-07T05:03:06 | 161,356,406 | 0 | 0 | null | 2022-09-08T01:00:45 | 2018-12-11T15:43:04 | Java | UTF-8 | Java | false | false | 326 | java | package com.api.mileniocloud;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class MyApplication {
public static void main(String[] args) {
SpringApplication.run(MyApplication.class, args);
}
} | [
"[email protected]"
] | |
7ecd0251f55623eaa5cb055f381233a37969efdb | 70b0a4c43da1a2a5446ad6b4c5628debcc668533 | /src/main/java/com/demo/service/EmployeeService.java | d1291c6ee1b2d17e2aea24ad374b52a35b51a673 | [] | no_license | jcaviles/employee-management-api | c3645fdeac3b1526728cdce96e3ad1345dec4458 | f382583ae9cff2a5f9399feff73a0830eeca02ed | refs/heads/master | 2020-07-07T06:44:35.298186 | 2019-08-31T11:51:58 | 2019-08-31T11:51:58 | 203,281,126 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 399 | java | package com.demo.service;
import java.util.Collection;
import java.util.Optional;
import com.demo.model.Employee;
public interface EmployeeService {
public void createEmployee(Employee employee);
public Collection<Employee> getAllEmployees();
public Optional<Employee> findEmployeeById(int id);
public void deleteEmployeeById(int id);
public void updateEmployee(Employee employee);
}
| [
"[email protected]"
] | |
ab19709cb4e949f8ad2916850965d7a942d89ad8 | 81121cfd4c843e779575cb92e7bd953227332371 | /src/com/skilldistillery/blackjack/BlackjackHand.java | 13055cae534a470dd52eab3b3bda0a03be8ea14c | [] | no_license | rwasek/BlackjackProject | 6d78eb2772bd622198c1d36f624d98bd1170a35c | e994ab75c3c99bbc1757aba6c921ea4975cfbd14 | refs/heads/master | 2022-04-14T05:54:03.850631 | 2020-04-12T23:48:55 | 2020-04-12T23:48:55 | 254,691,864 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 582 | java | package com.skilldistillery.blackjack;
public class BlackjackHand extends Hand {
public BlackjackHand() {
}
@Override
public int getHandValue() {
int totalvalue = 0;
for (Card card : hand) {
int value = card.getValue();
totalvalue += value;
}
return totalvalue;
}
public boolean isBlackJack() {
if (getHandValue() == 21) {
return true;
} else {
return false;
}
}
public boolean isBust() {
if (getHandValue() > 21) {
return true;
} else {
return false;
}
}
@Override
public String toString() {
return "Hand " + hand;
}
}
| [
"[email protected]"
] | |
6770074713f869b2a92f57893e0b522fb25b2919 | aee40b579151aca1fb8a650afd5925ac2017846f | /Project/src/com/vcs/ws/floor/java/Floor.java | 16591ca44aaa88df75a0ac426d269c018e00b039 | [] | no_license | sureshchikuri/Jdbcapps | 8671c53e24a9b0a8659d71d8fba51ee8b95dd4c1 | 234c366fb7371457669a725b7e4bc3c62229ddaf | refs/heads/master | 2022-07-15T20:50:06.277266 | 2020-05-06T03:51:46 | 2020-05-06T03:51:46 | 261,645,500 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 551 | java | package com.vcs.ws.floor.java;
public class Floor {
private int floorId;
private String floorName;
private String floorDesc;
public void setFloorId(int floorId) {
this.floorId = floorId;
}
public int getFloorId() {
return floorId;
}
public void setFloorName(String floorName) {
this.floorName = floorName;
}
public String getFloorName() {
return floorName;
}
public void setFloorDesc(String floorDesc) {
this.floorDesc = floorDesc;
}
public String getFloorDesc() {
return floorDesc;
}
}
| [
"[email protected]"
] | |
c16d292e7f0df31d81c8d8482dff28363196dc43 | 051a0912c0474cc3e34c959ba0d00c52721924ed | /src/main/java/kniga/project/bookshop/services/GenreService.java | 74a603a4145ce28772c76bffdf3029d8bb334a2a | [] | no_license | AndrewChudiyevych/Architecture | 1a7e13356df42a99510422369834d002e560851a | f6995412afc052be67d2c5a3ae292ddb36fc7a76 | refs/heads/main | 2023-04-10T19:45:26.683670 | 2021-04-25T09:54:52 | 2021-04-25T09:54:52 | 338,844,821 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,352 | java | package kniga.project.bookshop.services;
import kniga.project.bookshop.dto.GenreRequest;
import kniga.project.bookshop.entity.Genre;
import kniga.project.bookshop.entity.Reports;
import kniga.project.bookshop.mappers.GenreMapper;
import kniga.project.bookshop.repos.GenreRepository;
import lombok.RequiredArgsConstructor;
import lombok.var;
import org.springframework.stereotype.Service;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
import java.util.Set;
@Service
@RequiredArgsConstructor
public class GenreService {
private final GenreRepository repository;
private final GenreMapper mapper;
public Genre save(Genre genre) {
return repository.save(genre);
}
public Genre getById(Long id) {
return repository.findById(id).orElseThrow(null);
}
public Set<Genre> getAll() {
List<Genre> list = repository.findAll();
return new HashSet<>(list);
}
public Genre update(Long id,Genre genre) {
Genre genre1 = repository.findById(id).orElseThrow(null);
genre1 = genre;
return repository.save(genre1);
}
public void delete(Long id) {
repository.deleteById(id);
}
public Genre create(GenreRequest request) {
var genre = mapper.fromRequest(request);
return repository.save(genre);
}
}
| [
"[email protected]"
] | |
8a72ec8c16ed0af3b6cc856aa94c0a266ffb0bc3 | 4c50778d853383ac8091319dd53418c77cd41e72 | /mes/src/main/java/Factory/Entities/Entity.java | 0260504602bd00862b4ec7e50933a8df735c5fb8 | [] | no_license | DiogoOliveiraFEUP/ii_project | 2dc26c87eacd1984a53ba6005522c80b13a1e0cd | 858e5cd1bd8033867dd18360d80e70370a0a85c7 | refs/heads/main | 2023-06-01T12:11:16.719045 | 2021-06-21T16:46:59 | 2021-06-21T16:46:59 | 343,713,727 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 629 | java | package Factory.Entities;
import java.util.Objects;
public abstract class Entity {
String name;
boolean isFree = true;
public Entity(String name) {
this.name = name;
}
@Override
public String toString() {
return name;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Entity entity = (Entity) o;
return isFree == entity.isFree && Objects.equals(name, entity.name);
}
@Override
public int hashCode() {
return Objects.hash(name);
}
}
| [
"[email protected]"
] | |
3d50240b27933c5baebc2f5050defbe2cdf9d59b | a59ad7714cc82215df54b2a685c8f1c8e5a45bc9 | /src/com/ckj/avchatsdk/BrodcastTask.java | f52c3f24c1cb57ee102cdb8dbd9680bdd2de7df0 | [] | no_license | gitcfly/AVChatSdkServer | f10f272575e1593e4b69588fff638bc3f142ef76 | 63676bf02e82783cbb43f30dea76121b60052676 | refs/heads/master | 2020-05-25T22:49:29.425275 | 2019-05-23T13:51:49 | 2019-05-23T13:51:49 | 188,022,476 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,268 | java | package com.ckj.avchatsdk;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.util.List;
import com.alibaba.fastjson.JSON;
public class BrodcastTask implements Runnable{
DatagramSocket serverSocket;
DatagramPacket recivedPacket;
public BrodcastTask(DatagramSocket serverSocket,DatagramPacket recivedPackt){
this.serverSocket=serverSocket;
this.recivedPacket=recivedPackt;
}
@Override
public void run() {
try{
long start=System.currentTimeMillis();
String message=new String(recivedPacket.getData(),0,recivedPacket.getLength());
RequestDataPack request=JSON.parseObject(message, RequestDataPack.class);
long parseEnd=System.currentTimeMillis();
DatagramPacket forwardPacket=new DatagramPacket(recivedPacket.getData(),recivedPacket.getLength(), recivedPacket.getAddress(),9999);
serverSocket.send(forwardPacket);
long End=System.currentTimeMillis();
System.out.println("allTime:"+(End-start)+" parseTime:"+(parseEnd-start));
System.out.println("return send data, data length:"+forwardPacket.getLength());
}catch (Exception e){
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
bba6b41392598f24b89b68c46a44371b1f909a43 | 613d590e6cb54acfb7ef5ed9a0cd504d3b38e412 | /src/javadasar/formUtama.java | 45b9857fdad54351b3fcf9043ee2985725d503d9 | [] | no_license | simonfredy/JavaDasarKhanza | 1027f28af23eb989dd1816fa27e949bedc8996bd | 596b54c6a9f4be83f22854fe293e8bce2ed48732 | refs/heads/main | 2023-08-18T03:43:35.748149 | 2021-09-24T14:29:18 | 2021-09-24T14:29:18 | 407,567,638 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,661 | 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 javadasar;
import java.awt.Dimension;
import java.awt.Toolkit;
/**
*
* @author GAME
*/
public class formUtama extends javax.swing.JFrame {
/**
* Creates new form formUtama
*/
public formUtama() {
initComponents();
}
/**
* 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() {
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
MenuDokter = new javax.swing.JMenuItem();
MenuObat = new javax.swing.JMenuItem();
MenuPoliklinik = new javax.swing.JMenuItem();
MenuCaraBayar = new javax.swing.JMenuItem();
jMenu3 = new javax.swing.JMenu();
jMenu4 = new javax.swing.JMenu();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("::[ Aplikasi SIMRS ]::");
jMenuBar1.setPreferredSize(new java.awt.Dimension(214, 26));
jMenu1.setForeground(new java.awt.Color(0, 100, 0));
jMenu1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/picture/17.png"))); // NOI18N
jMenu1.setText("Master");
jMenu1.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
MenuDokter.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
MenuDokter.setIcon(new javax.swing.ImageIcon(getClass().getResource("/picture/Doctor.png"))); // NOI18N
MenuDokter.setText("Dokter");
MenuDokter.setPreferredSize(new java.awt.Dimension(200, 26));
MenuDokter.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
MenuDokterActionPerformed(evt);
}
});
jMenu1.add(MenuDokter);
MenuObat.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
MenuObat.setIcon(new javax.swing.ImageIcon(getClass().getResource("/picture/Drug-basket-32.png"))); // NOI18N
MenuObat.setText("Obat");
MenuObat.setPreferredSize(new java.awt.Dimension(200, 26));
MenuObat.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
MenuObatActionPerformed(evt);
}
});
jMenu1.add(MenuObat);
MenuPoliklinik.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
MenuPoliklinik.setIcon(new javax.swing.ImageIcon(getClass().getResource("/picture/PatientFile.png"))); // NOI18N
MenuPoliklinik.setText("Poliklinik");
MenuPoliklinik.setPreferredSize(new java.awt.Dimension(200, 26));
MenuPoliklinik.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
MenuPoliklinikActionPerformed(evt);
}
});
jMenu1.add(MenuPoliklinik);
MenuCaraBayar.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
MenuCaraBayar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/picture/Money-32x32.png"))); // NOI18N
MenuCaraBayar.setText("Cara Bayar");
MenuCaraBayar.setPreferredSize(new java.awt.Dimension(200, 26));
MenuCaraBayar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
MenuCaraBayarActionPerformed(evt);
}
});
jMenu1.add(MenuCaraBayar);
jMenuBar1.add(jMenu1);
jMenu3.setText("jMenu3");
jMenuBar1.add(jMenu3);
jMenu4.setText("jMenu4");
jMenuBar1.add(jMenu4);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 400, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 274, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void MenuDokterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuDokterActionPerformed
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
formDokter dokter = new formDokter(this, false);
dokter.setSize(screen.width - 100, screen.height - 100);
dokter.setLocationRelativeTo(null);
dokter.setVisible(true);
}//GEN-LAST:event_MenuDokterActionPerformed
private void MenuObatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuObatActionPerformed
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
formObat obat = new formObat(this, false);
obat.setSize(screen.width - 100, screen.height - 100);
obat.setLocationRelativeTo(null);
obat.setVisible(true);
}//GEN-LAST:event_MenuObatActionPerformed
private void MenuPoliklinikActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuPoliklinikActionPerformed
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
formPoliklinik poliklinik = new formPoliklinik(this, false);
poliklinik.setSize(screen.width - 100, screen.height - 100);
poliklinik.setLocationRelativeTo(null);
poliklinik.setVisible(true);
}//GEN-LAST:event_MenuPoliklinikActionPerformed
private void MenuCaraBayarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuCaraBayarActionPerformed
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
formCaraBayar carabayar = new formCaraBayar(this, false);
carabayar.setSize(screen.width - 100, screen.height - 100);
carabayar.setLocationRelativeTo(null);
carabayar.setVisible(true);
}//GEN-LAST:event_MenuCaraBayarActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(formUtama.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(formUtama.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(formUtama.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(formUtama.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new formUtama().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JMenuItem MenuCaraBayar;
private javax.swing.JMenuItem MenuDokter;
private javax.swing.JMenuItem MenuObat;
private javax.swing.JMenuItem MenuPoliklinik;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu3;
private javax.swing.JMenu jMenu4;
private javax.swing.JMenuBar jMenuBar1;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
] | |
d818c5e1dc418ead0f27adb7fd06449ef285083d | b4ae03966728e322929f2b23e674ec45fd896fe1 | /src/main/java/competition/year2021/day20210418/Leetcode5735.java | 1f5a149cfa1db6d4394275238e25b475b3add38e | [] | no_license | markey92/leetcode | 21b4024cdffa4685ee583f6da0d766d5b8bcd6fe | c6efae4ca1dfd94da56442c2b049333ca7cff4dd | refs/heads/master | 2022-02-10T15:16:50.279446 | 2022-01-16T02:23:40 | 2022-01-16T02:23:40 | 210,847,391 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 623 | java | package competition.year2021.day20210418;
import java.util.Arrays;
/**
* @ProjectName: leetcode
* @Package: competition.day20210418
* @ClassName: Leetcode5735
* @Author: markey
* @Description:
* @Date: 2021/4/18 10:32
* @Version: 1.0
*/
public class Leetcode5735 {
public int maxIceCream(int[] costs, int coins) {
Arrays.sort(costs);
int count = 0;
for (int i = 0; i < costs.length; i++) {
if (coins >= costs[i]) {
coins -= costs[i];
count++;
} else {
break;
}
}
return count;
}
}
| [
"[email protected]"
] | |
3986537239d0bad6845c09924557a3184208709a | 2e855370c4523886e680f4ee61d65f70486b3904 | /Amoba/src/amoba/Field.java | 7b7d61a4a8794a8928751d11acbc1513c6ae1e81 | [] | no_license | NemesLaszlo/SpecialAmoba | 2b3da946e37e2822a364af18de67fdbc76eaf39a | 62a3977b1be0a61aa7fe53ae81575950af61fbfb | refs/heads/master | 2022-03-16T22:04:41.335157 | 2019-12-10T20:57:40 | 2019-12-10T20:57:40 | 197,834,172 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 371 | java | package amoba;
public class Field {
private Player owner;
public Field() {
this.owner = null;
}
/**
*
* @return
*/
public Player getOwner(){
return this.owner;
}
public void resetOwner() {
this.owner = null;
}
public void setMap(Player player){
this.owner = player;
}
}
| [
"[email protected]"
] | |
385b130a7528d28d51c90b4326dfb86c28fc3ad4 | 52ca09359b4bf217d780d80a2651fc1dbd3dfd7b | /microservicio/dominio/src/main/java/com/ceiba/consultorio/servicio/ServicioCrearPaciente.java | 95e172a60bdead059509a58b27f04fb329116dd1 | [] | no_license | Arevelo27/adn-ceiba | 4eab24c3d20adb59fa6b3cdaf77b485cc48099ff | 1b709e551ccca1dc491419b4b67e0199e4e31ed4 | refs/heads/master | 2023-06-15T03:42:34.151569 | 2021-07-08T13:45:46 | 2021-07-08T13:45:46 | 377,483,924 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 982 | java | package com.ceiba.consultorio.servicio;
import com.ceiba.consultorio.modelo.entidad.Paciente;
import com.ceiba.consultorio.puerto.repositorio.RepositorioPaciente;
import com.ceiba.dominio.excepcion.ExcepcionDuplicidad;
public class ServicioCrearPaciente {
public static final String EL_PACIENTE_YA_EXISTE_EN_EL_SISTEMA = "El paciente ya existe en el sistema";
private final RepositorioPaciente repositorioPaciente;
public ServicioCrearPaciente(RepositorioPaciente repositorioPaciente) {
this.repositorioPaciente = repositorioPaciente;
}
public Long ejecutar(Paciente paciente) {
validarExistenciaPrevia(paciente);
return this.repositorioPaciente.crear(paciente);
}
private void validarExistenciaPrevia(Paciente pago) {
boolean existe = this.repositorioPaciente.existe(pago.getIdentificacion());
if(existe) {
throw new ExcepcionDuplicidad(EL_PACIENTE_YA_EXISTE_EN_EL_SISTEMA);
}
}
}
| [
"[email protected]"
] | |
c00515b0dae6c2ebdef005caea5928f75e362eb7 | 89452c6d9123ab3a7e6509e8702bf930a08ce7a8 | /src/me/chagnwei/leetcode/MinStack155/MinStack.java | a2f68b2c2076f1dc7b5b0fd712d69485a78b6705 | [] | no_license | cw1997/LeetCode | f5fd38061272616e6f862405d32f0a0007f0d5d3 | 6623f7c1331adb1be6783b2a1c89eca090c59eeb | refs/heads/master | 2023-02-10T14:45:16.030550 | 2021-01-03T07:32:39 | 2021-01-03T07:32:39 | 293,904,654 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,020 | java | package me.chagnwei.leetcode.MinStack155;
import java.util.*;
/**
* @author cw1997 <[email protected]>
* @file null.java
* @date 2020/9/10 20:19
* @description
*/
class MinStack {
private Deque<Integer> stack;
private Deque<Integer> stackMin;
/** initialize your data structure here. */
public MinStack() {
this.stack = new ArrayDeque<>();
this.stackMin = new ArrayDeque<>();
}
public void push(int x) {
stack.push(x);
stackMin.push(Math.min(x, this.getMin()));
}
public void pop() {
stack.poll();
stackMin.poll();
}
public int top() {
return stack.peek();
}
public int getMin() {
Integer min = stackMin.peek();
return min == null ? Integer.MAX_VALUE : min;
}
public static void main(String[] args) {
MinStack minStack = new MinStack();
minStack.push(-1);
minStack.push(0);
minStack.push(-3);
System.out.println(minStack.getMin());
}
}
| [
"[email protected]"
] | |
de040dd8e540cc7cf1fe1d4a933cdeb6e0c2f2ee | 19e5c11f316e5c0c0fafc9319e73bb9cfaae7297 | /app/src/main/java/com/appbaba/iz/dialog/BaseDialog.java | 8281b11fe517dd101114a50f80290b9d3e104a30 | [] | no_license | ChansEbm/AiiZhuang | 99841f72cd3f35cc6d74d5d9106098ff4a83220a | cdef7b7c48e0c8d1f325f3fe4a82191193b2fa3b | refs/heads/master | 2021-01-21T04:35:31.410535 | 2016-06-30T08:57:35 | 2016-06-30T08:57:35 | 55,117,101 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 891 | java | package com.appbaba.iz.dialog;
import android.app.Dialog;
import android.content.Context;
import android.databinding.DataBindingUtil;
import android.databinding.ViewDataBinding;
import android.view.View;
import com.appbaba.iz.R;
/**
* Created by Administrator on 2016/4/21.
*/
public abstract class BaseDialog extends Dialog implements View.OnClickListener {
protected View parentView;
protected ViewDataBinding viewDataBinding;
public BaseDialog(Context context) {
super(context, R.style.dialogDefaultStyle);
viewDataBinding = DataBindingUtil.inflate(getLayoutInflater(), getContentView(), null,
false);
parentView = viewDataBinding.getRoot();
}
public abstract int getContentView();
@Override
public void onClick(View v) {
onClick(v.getId(), v);
}
public abstract void onClick(int id, View v);
}
| [
"[email protected]"
] | |
97fe828aaa40941efb95e2680e3348c730d271bb | 40770305d39cae596da7161a2dc8c817c23ae3ee | /src/main/java/util/hzUtil.java | 0bd165f10c048d19f86c873a1517141061a61856 | [] | no_license | iampkuhz/JavaCrawlerMultiThread | d98ab5e08e84057447d4e060c897da3d49b35c71 | 6c6f08322f0b51b3621fd8b872d4f1debd13191c | refs/heads/master | 2021-01-20T20:36:56.994365 | 2016-05-30T12:36:37 | 2016-05-30T12:36:37 | 60,009,019 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,445 | java | package util;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
/**
* 主要的函数文件
* Created by hanzhe on 16-5-28.
*/
public class hzUtil {
private static final Logger logger = hzUtil.getLogger();
/**
* 指定编码, 获取文件的 BufferedReader
* @param path
* @param encoding
* @return
*/
public static BufferedReader getBufferedReader(String path, String encoding) {
try{
File file = new File(path);
if(file.exists() == false){
logger.info("read file not exist:" + path);
return null;
}
BufferedReader reader = new BufferedReader(
new InputStreamReader(new FileInputStream(file), encoding));
return reader;
}catch( Exception e){
e.printStackTrace();
return null;
}
}
/**
* 程序暂停
* @param milliseconds
*/
public static void pause(int milliseconds) {
try {
Thread.sleep(milliseconds);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
}
/**
* 得到一个Logger
* @return Logger
*/
public static Logger getLogger() {
return LogManager.getRootLogger();
}
}
| [
"[email protected]"
] | |
4dfde1b69b099259c8223034faaaa73617b3fbfc | 642323b88f6a3f9050d3ce297b80c02715ba08db | /Java Fundamentals/Java-Advanced-RetakeExam-22-August-2016/src/AshesOfRosesWithOneMap.java | e563fe47fc4974d140feb81451ccb27c66c4b4cc | [] | no_license | VenelinBakalov/javaAdvanced | 5a9e418c6666f85fe8a8d1e65d587a863af367b9 | d890a84fa56af2e24669e60f48f6d776cf55e9ef | refs/heads/master | 2021-01-11T21:07:45.912758 | 2017-12-03T15:39:27 | 2017-12-03T15:39:27 | 79,252,307 | 8 | 8 | null | null | null | null | UTF-8 | Java | false | false | 2,369 | java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class AshesOfRosesWithOneMap {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String regex = "^Grow <(?<region>[A-Z][a-z]+)> <(?<color>[a-zA-Z0-9]+)> (?<amount>[0-9]+)$";
Pattern pattern = Pattern.compile(regex);
Map<String, Map<String, Long>> regions = new HashMap<>();
String line = "";
while (!"Icarus, Ignite!".equals(line = reader.readLine())) {
Matcher matcher = pattern.matcher(line);
if (matcher.find()) {
String region = matcher.group("region");
String color = matcher.group("color");
long amount = Long.parseLong(matcher.group("amount"));
if (!regions.containsKey(region)) {
regions.put(region, new HashMap<>());
}
if (!regions.get(region).containsKey(color)) {
regions.get(region).put(color, 0L);
}
regions.get(region).put(color, regions.get(region).get(color) + amount);
}
}
regions.entrySet().stream().sorted((region1, region2) -> {
long totalAmount1 = region1.getValue().values().stream().mapToLong(e -> e).sum();
long totalAmount2 = region2.getValue().values().stream().mapToLong(e -> e).sum();
if (totalAmount1 == totalAmount2) {
return region1.getKey().compareTo(region2.getKey());
}
return Long.compare(totalAmount2, totalAmount1);
}).forEach(region -> {
System.out.println(region.getKey());
region.getValue().entrySet().stream().sorted((color1, color2) -> {
if (Long.compare(color1.getValue(), color2.getValue()) == 0) {
return color1.getKey().compareTo(color2.getKey());
}
return Long.compare(color1.getValue(), color2.getValue());
}).forEach(color -> {
System.out.println("*--" + color.getKey() + " | " + color.getValue());
});
});
}
}
| [
"[email protected]"
] | |
96cd99618dc118f22db99db7fb63bcef1e3af48c | 9db3accfe863775c93655a386ae597c0c752b3ff | /ShoppingStore/src/shoppingstore/serviceImpl/UserServiceImpl.java | 7b511db160f28a777ea16bb342b0d257d6c5c2c8 | [] | no_license | Qbrother/zzz | 28c98a471774476502548e6eab3c1b6b84f976e2 | 8201a7171ad410bc847e0bef2f5f2d28c57bbb94 | refs/heads/master | 2020-04-26T09:49:26.203203 | 2019-03-02T16:12:39 | 2019-03-02T16:12:39 | 173,469,250 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,632 | java | package Test5.serviceImpl;
import java.util.List;
import Test5.Dao.UserDao;
import Test5.DaoImpl.UserDaoImpl;
import Test5.entity.PegeBean;
import Test5.entity.User;
import Test5.exception.MyException;
import Test5.service.UserService;
public class UserServiceImpl implements UserService {
private UserDao userDao=new UserDaoImpl();
@Override
public int insertUser(User user) throws MyException {
// TODO Auto-generated method stub
return userDao.insertUser(user);
}
@Override
public List<User> getAllUser() throws MyException {
// TODO Auto-generated method stub
return userDao.getAllUser();
}
@Override
public boolean existUser(String username) throws MyException {
// TODO Auto-generated method stub
return userDao.existUser(username);
}
@Override
public boolean isRightUser(String username, String password) throws MyException {
// TODO Auto-generated method stub
return userDao.isRightUser(username, password);
}
@Override
public User getUser(String username) throws MyException {
// TODO Auto-generated method stub
return userDao.getUser(username);
}
@Override
public int updateUserName(String newUserName, int uid) throws MyException {
// TODO Auto-generated method stub
return userDao.updateUserName(newUserName, uid);
}
@Override
public int updateUserPassword(String password, int uid) throws MyException {
// TODO Auto-generated method stub
return userDao.updateUserPassword(password, uid);
}
@Override
public int updateUserPhone(String phone, int uid) throws MyException {
// TODO Auto-generated method stub
return userDao.updateUserPhone(phone, uid);
}
@Override
public int updateBalance(double charge, int uid) throws MyException {
// TODO Auto-generated method stub
return userDao.updateBalance(charge, uid);
}
@Override
public PegeBean<User> getPageBeanUser(int pc, int ps) throws MyException {
// TODO Auto-generated method stub
return userDao.getPageBeanUser(pc, ps);
}
@Override
public int CountUser() throws MyException {
// TODO Auto-generated method stub
return userDao.CountUser();
}
@Override
public int updateUser(String newUserName, String newPassword, String newPhone, int uid) throws MyException {
// TODO Auto-generated method stub
return userDao.updateUser(newUserName, newPassword, newPhone, uid);
}
@Override
public User getSingleUser(int uid) throws MyException {
// TODO Auto-generated method stub
return userDao.getSingleUser(uid);
}
@Override
public int getSingleBalance(int uid) throws MyException {
// TODO Auto-generated method stub
return userDao.getSingleBalance(uid);
}
}
| [
"[email protected]"
] | |
d29121167c6752a17e6c461a007cf2c3df6de98c | 1a32d704493deb99d3040646afbd0f6568d2c8e7 | /BOOT-INF/lib/org/apache/commons/logging/impl/NoOpLog.java | 982eaa30e765a4fd9be324ae344685311aeba540 | [] | no_license | yanrumei/bullet-zone-server-2.0 | e748ff40f601792405143ec21d3f77aa4d34ce69 | 474c4d1a8172a114986d16e00f5752dc019cdcd2 | refs/heads/master | 2020-05-19T11:16:31.172482 | 2019-03-25T17:38:31 | 2019-03-25T17:38:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,041 | java | /* */ package org.apache.commons.logging.impl;
/* */
/* */ import java.io.Serializable;
/* */ import org.apache.commons.logging.Log;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class NoOpLog
/* */ implements Log, Serializable
/* */ {
/* */ private static final long serialVersionUID = 561423906191706148L;
/* */
/* */ public NoOpLog() {}
/* */
/* */ public NoOpLog(String name) {}
/* */
/* */ public void trace(Object message) {}
/* */
/* */ public void trace(Object message, Throwable t) {}
/* */
/* */ public void debug(Object message) {}
/* */
/* */ public void debug(Object message, Throwable t) {}
/* */
/* */ public void info(Object message) {}
/* */
/* */ public void info(Object message, Throwable t) {}
/* */
/* */ public void warn(Object message) {}
/* */
/* */ public void warn(Object message, Throwable t) {}
/* */
/* */ public void error(Object message) {}
/* */
/* */ public void error(Object message, Throwable t) {}
/* */
/* */ public void fatal(Object message) {}
/* */
/* */ public void fatal(Object message, Throwable t) {}
/* */
/* */ public final boolean isDebugEnabled()
/* */ {
/* 97 */ return false;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public final boolean isErrorEnabled()
/* */ {
/* 106 */ return false;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public final boolean isFatalEnabled()
/* */ {
/* 115 */ return false;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public final boolean isInfoEnabled()
/* */ {
/* 124 */ return false;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public final boolean isTraceEnabled()
/* */ {
/* 133 */ return false;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public final boolean isWarnEnabled()
/* */ {
/* 142 */ return false;
/* */ }
/* */ }
/* Location: C:\Users\ikatwal\Downloads\bullet-zone-server-2.0.jar!\BOOT-INF\lib\jcl-over-slf4j-1.7.25.jar!\org\apache\commons\logging\impl\NoOpLog.class
* Java compiler version: 5 (49.0)
* JD-Core Version: 0.7.1
*/ | [
"[email protected]"
] | |
a3130f2cd956f4db368a010603fcbdefcc3c6b66 | c66cf9f61b5fa6e01478639d647323868300ad10 | /taisf-mis-oms/src/main/java/com/taisf/web/oms/stats/controller/SupStatsController.java | e8283db44307595db40a176bc2b7f5cd57eddcd3 | [] | no_license | dingfangwen/taisf | c4a427f3489d550013d72c1f22fc9ed1513122db | 761ed130eedac07655804ca4b3ef7facc4476ca3 | refs/heads/master | 2023-01-05T00:18:32.604709 | 2020-11-09T10:13:38 | 2020-11-09T10:13:38 | 311,294,001 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 7,471 | java | package com.taisf.web.oms.stats.controller;
import com.jk.framework.base.entity.DataTransferObject;
import com.jk.framework.base.utils.Check;
import com.jk.framework.base.utils.DateUtil;
import com.jk.framework.base.utils.JsonEntityTransform;
import com.jk.framework.base.utils.ValueUtil;
import com.jk.framework.log.utils.LogUtil;
import com.taisf.services.enterprise.vo.*;
import com.taisf.services.order.api.OrderService;
import com.taisf.services.order.dto.EnterpriseStatsRequest;
import com.taisf.services.order.dto.SupStatsRequest;
import com.taisf.services.pay.api.RechargeOrderService;
import com.taisf.services.recharge.api.RechargeService;
import com.taisf.services.supplier.api.SupplierService;
import com.taisf.services.supplier.entity.SupplierEntity;
import com.taisf.web.oms.common.page.PageResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
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 javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* <p>企业的统计</p>
* <p/>
* <PRE>
* <BR> 修改记录
* <BR>-----------------------------------------------
* <BR> 修改日期 修改人 修改内容
* </PRE>
*
* @author afi on on 2017/10/20.
* @version 1.0
* @since 1.0
*/
@Controller
@RequestMapping("/stats")
public class SupStatsController {
private static final Logger LOGGER = LoggerFactory.getLogger(SupStatsController.class);
@Autowired
private RechargeService rechargeService;
@Autowired
private RechargeOrderService rechargeOrderService;
@Autowired
private OrderService orderService;
@Autowired
private SupplierService supplierService;
/**
* 企业的订单统计
* @param request
* @return
*/
@RequestMapping("/supStatsList")
public String supStatsList(HttpServletRequest request) {
return "stats/supStatsList";
}
/**
* 订单统计
* @author afi
* @param request
* @param supStatsRequest
* @return
*/
@RequestMapping("supStatsListPage")
@ResponseBody
public PageResult orderStatsListPage(HttpServletRequest request, SupStatsRequest supStatsRequest) {
PageResult pageResult = new PageResult();
try {
this.dealTime(supStatsRequest);
DataTransferObject<List<SupplierEntity>> allSupplierList = supplierService.getSupplierList(supStatsRequest.getSupplierCode());
List<SupplierEntity> listAll = allSupplierList.getData();
if (Check.NuNCollection(listAll)){
return pageResult;
}
//统计的list
List<SupStatsVO> supStatsVOList = new ArrayList<>();
//填充供应商信息
for (SupplierEntity supplierEntity : listAll) {
SupStatsVO supStatsVO = new SupStatsVO();
supStatsVO.setSupplierCode(supplierEntity.getSupplierCode());
supStatsVO.setSupplierName(supplierEntity.getSupplierName());
supStatsVO.setTime(getTime(supStatsRequest));
supStatsVOList.add(supStatsVO);
}
//统计订单信息
this.dealOrder(supStatsRequest,supStatsVOList);
//统计充值信息
this.dealSupRecharge(supStatsRequest,supStatsVOList);
//统计个人信息
this.dealSelfSupRecharge(supStatsRequest,supStatsVOList);
pageResult.setRows(supStatsVOList);
pageResult.setTotal(ValueUtil.getlongValue(supStatsVOList.size()));
} catch (Exception e) {
LogUtil.info(LOGGER, "params :{}", JsonEntityTransform.Object2Json(supStatsRequest));
LogUtil.error(LOGGER, "error :{}", e);
return new PageResult();
}
return pageResult;
}
/**
* 处理订单相关
* @param supStatsRequest
* @param listAll
*/
private void dealSelfSupRecharge(SupStatsRequest supStatsRequest,List<SupStatsVO> listAll){
if (Check.NuNCollection(listAll)){
return;
}
//统计个人充值
Map<String, SupRechargeStatsVO> selfRechargeSupStatsMap = rechargeOrderService.getSelfRechargeSupStatsMap(supStatsRequest);
for (SupStatsVO supStatsVO : listAll) {
String key = supStatsVO.getSupplierCode();
if (selfRechargeSupStatsMap.containsKey(key)){
SupRechargeStatsVO self = selfRechargeSupStatsMap.get(key);
supStatsVO.setOrderRechargeNum(self.getNum());
supStatsVO.setOrderRechargePrice(self.getPrice());
}
}
}
/**
* 处理订单相关
* @param supStatsRequest
* @param listAll
*/
private void dealSupRecharge(SupStatsRequest supStatsRequest,List<SupStatsVO> listAll){
if (Check.NuNCollection(listAll)){
return;
}
//统计订单信息
Map<String, SupRechargeStatsVO> supRechargeStatsMap = rechargeService.getSupRechargeStatsMap(supStatsRequest);
for (SupStatsVO supStatsVO : listAll) {
String key = supStatsVO.getSupplierCode();
if (supRechargeStatsMap.containsKey(key)){
SupRechargeStatsVO supRechargeStatsVO = supRechargeStatsMap.get(key);
supStatsVO.setRechargeNum(supRechargeStatsVO.getNum());
supStatsVO.setRechargePrice(supRechargeStatsVO.getPrice());
}
}
}
/**
* 处理订单相关
* @param supStatsRequest
* @param listAll
*/
private void dealOrder(SupStatsRequest supStatsRequest,List<SupStatsVO> listAll){
if (Check.NuNCollection(listAll)){
return;
}
//统计订单信息
Map<String, SupOrderStatsVO> supOrderStatsMap = orderService.getSupOrderStatsMap(supStatsRequest);
for (SupStatsVO supStatsVO : listAll) {
String key = supStatsVO.getSupplierCode();
if (supOrderStatsMap.containsKey(key)){
SupOrderStatsVO supOrderStatsVO = supOrderStatsMap.get(key);
supStatsVO.setPayBalance(supOrderStatsVO.getPayBalance());
supStatsVO.setPayMoney(supOrderStatsVO.getPayMoney());
}
}
}
/**
* 处理时间
* @author afi
* @param supStatsRequest
*/
private String getTime(SupStatsRequest supStatsRequest) {
//处理时间
dealTime(supStatsRequest);
String time = supStatsRequest.getStartStr() + " 至 "+ supStatsRequest.getEndStr();
return time;
}
/**
* 处理时间
* @author afi
* @param enterpriseStatsRequest
*/
private void dealTime(SupStatsRequest enterpriseStatsRequest) {
if (Check.NuNStr(enterpriseStatsRequest.getStartStr())){
enterpriseStatsRequest.setStartStr(DateUtil.timestampFormat(DateUtil.connectDate(DateUtil.jumpMonth(new Date(),-6),"00:00:00")));
}
if (Check.NuNStr(enterpriseStatsRequest.getEndStr())){
enterpriseStatsRequest.setEndStr(DateUtil.timestampFormat(DateUtil.connectDate(new Date(),"23:59:59")));
}
}
}
| [
"[email protected]"
] | |
50f2e288af7d7b5d9881cf80765a884df4c2b0d8 | fe5229f80da9e902e94983050bda42420417181d | /src/com/elephone/setupwizard/WifiConnDialog.java | 30aac764b0851f467556c9555a01b1a87d11bab8 | [] | no_license | jiao1121/setupwizard | b8d31247216c87759486033646d27c45da58d2d8 | 8754f7313c0c4c679816da6a13daf46fe6de8726 | refs/heads/master | 2020-03-08T09:09:18.356299 | 2018-04-04T09:30:34 | 2018-04-04T09:30:34 | 128,037,359 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,964 | java | package com.elephone.setupwizard;
import android.app.Dialog;
import android.content.Context;
import android.graphics.Point;
import android.net.wifi.ScanResult;
import android.os.Bundle;
import android.text.Editable;
import android.text.InputType;
import android.text.Selection;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import java.util.List;
import com.elephone.setupwizard.R;
public class WifiConnDialog extends Dialog {
private Context context;
private ScanResult scanResult;
private TextView txtWifiName;
private TextView txtBtnConn;
private TextView txtBtnCancel;
private EditText edtPassword;
private CheckBox cbxShowPass;
// wifi列表的listview
private ListView mListView;
// wifi列表item的指针
private int mPosition;
// wifi列表的适配器
private MyListViewAdapter mAdapter;
// wifi列表的数据
private List<ScanResult> mScanResultList;
private String wifiName;
private String securigyLevel;
private int level;
public WifiConnDialog(Context context, int theme) {
super(context, theme);
}
/**
* 传wifi名称和信号等构造函数
*
* @param context
* @param theme
* @param wifiName
* @param singlStren
* @param securityLevl
*/
private WifiConnDialog(Context context, int theme, String wifiName,
int singlStren, String securityLevl) {
super(context, theme);
this.context = context;
this.wifiName = wifiName;
this.level = singlStren;
this.securigyLevel = securityLevl;
}
/**
* 传当前wifi信息
*
* @param context
* @param theme
* @param scanResult
* @param onNetworkChangeListener
*/
public WifiConnDialog(Context context, int theme, ListView mListView,
int mPosition, MyListViewAdapter mAdapter, ScanResult scanResult,
List<ScanResult> mScanResultList,
OnNetworkChangeListener onNetworkChangeListener) {
this(context, theme, scanResult.SSID, scanResult.level,
scanResult.capabilities);
this.mListView = mListView;
this.mPosition = mPosition;
this.mAdapter = mAdapter;
this.scanResult = scanResult;
this.mScanResultList = mScanResultList;
this.onNetworkChangeListener = onNetworkChangeListener;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.view_wifi_conn);
setCanceledOnTouchOutside(false);
initView();
setListener();
}
private void setListener() {
edtPassword.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before,
int count) {
if (TextUtils.isEmpty(s)) {
txtBtnConn.setEnabled(false);
txtBtnConn.setTextColor(context.getResources().getColor(R.color.text_color));
cbxShowPass.setEnabled(false);
} else {
txtBtnConn.setEnabled(true);
txtBtnConn.setTextColor(context.getResources().getColor(R.color.red));
cbxShowPass.setEnabled(true);
}
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
}
@Override
public void afterTextChanged(Editable s) {
}
});
cbxShowPass.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
if (isChecked) {
// 文本正常显示
edtPassword
.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
Editable etable = edtPassword.getText();
Selection.setSelection(etable, etable.length());
} else {
// 文本以密码形式显示
edtPassword.setInputType(InputType.TYPE_CLASS_TEXT
| InputType.TYPE_TEXT_VARIATION_PASSWORD);
// 下面两行代码实现: 输入框光标一直在输入文本后面
Editable etable = edtPassword.getText();
Selection.setSelection(etable, etable.length());
}
}
});
txtBtnCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
System.out.println("txtBtnCancel");
WifiConnDialog.this.dismiss();
}
});
txtBtnConn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
WifiConnectUtils.WifiCipherType type = null;
if (scanResult.capabilities.toUpperCase().contains("WPA")) {
type = WifiConnectUtils.WifiCipherType.WIFICIPHER_WPA;
} else if (scanResult.capabilities.toUpperCase()
.contains("WEP")) {
type = WifiConnectUtils.WifiCipherType.WIFICIPHER_WEP;
} else {
type = WifiConnectUtils.WifiCipherType.WIFICIPHER_NOPASS;
}
// 去连接网络
WifiAdminUtils mWifiAdmin = new WifiAdminUtils(context);
/**是否去连接了 */
if (WifiConnDialog.this != null) {
dismiss();
}
boolean isConnect = mWifiAdmin.connect(scanResult.SSID, edtPassword.getText().toString().trim(), type);
Log.d("WifiListActivity", isConnect + "是否去连接的值");
if (isConnect) {
Log.d("WifiListActivity", "去连接wifi了");
onNetworkChangeListener.onNetWorkConnect();
} else {
Log.d("WifiListActivity", "没有去连接wifi");
onNetworkChangeListener.onNetWorkConnect();
}
// return isConnect;
}
});
}
private void initView() {
txtWifiName = (TextView) findViewById(R.id.txt_wifi_name);
edtPassword = (EditText) findViewById(R.id.edt_password);
cbxShowPass = (CheckBox) findViewById(R.id.cbx_show_pass);
txtBtnCancel = (TextView) findViewById(R.id.txt_btn_cancel);
txtBtnConn = (TextView) findViewById(R.id.txt_btn_connect);
txtWifiName.setText(wifiName);
txtBtnConn.setEnabled(false);
txtBtnConn.setTextColor(context.getResources().getColor(R.color.text_color));
cbxShowPass.setEnabled(false);
}
@Override
public void show() {
WindowManager wm = (WindowManager) getContext().getSystemService(
Context.WINDOW_SERVICE);
Point size = new Point();
wm.getDefaultDisplay().getSize(size);
super.show();
getWindow().setLayout((int) (size.x * 9 / 10),
ViewGroup.LayoutParams.WRAP_CONTENT);
}
private void showShortToast(String text) {
Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
}
private OnNetworkChangeListener onNetworkChangeListener;
}
| [
"[email protected]"
] | |
508fcf87d1a6350138e50a04e7c4641eacffb950 | 0689f3b456ddce965659abcd4d2de68903de59a1 | /src/main/java/com/example/jooq/demo_jooq/introduction/db/pg_catalog/routines/BoolOr.java | e07490373a71a82120ea7e404a815e547b3e35e7 | [] | no_license | vic0692/demo_spring_jooq | c92d2d188bbbb4aa851adab5cc301d1051c2f209 | a5c1fd1cb915f313f40e6f4404fdc894fffc8e70 | refs/heads/master | 2022-09-18T09:38:30.362573 | 2020-01-23T17:09:40 | 2020-01-23T17:09:40 | 220,638,715 | 0 | 0 | null | 2022-09-08T01:04:47 | 2019-11-09T12:25:46 | Java | UTF-8 | Java | false | true | 1,749 | java | /*
* This file is generated by jOOQ.
*/
package com.example.jooq.demo_jooq.introduction.db.pg_catalog.routines;
import com.example.jooq.demo_jooq.introduction.db.pg_catalog.PgCatalog;
import javax.annotation.Generated;
import org.jooq.Field;
import org.jooq.Parameter;
import org.jooq.impl.AbstractRoutine;
import org.jooq.impl.Internal;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.12.3"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class BoolOr extends AbstractRoutine<Boolean> {
private static final long serialVersionUID = -536069899;
/**
* The parameter <code>pg_catalog.bool_or.RETURN_VALUE</code>.
*/
public static final Parameter<Boolean> RETURN_VALUE = Internal.createParameter("RETURN_VALUE", org.jooq.impl.SQLDataType.BOOLEAN, false, false);
/**
* The parameter <code>pg_catalog.bool_or._1</code>.
*/
public static final Parameter<Boolean> _1 = Internal.createParameter("_1", org.jooq.impl.SQLDataType.BOOLEAN, false, true);
/**
* Create a new routine call instance
*/
public BoolOr() {
super("bool_or", PgCatalog.PG_CATALOG, org.jooq.impl.SQLDataType.BOOLEAN);
setReturnParameter(RETURN_VALUE);
addInParameter(_1);
}
/**
* Set the <code>_1</code> parameter IN value to the routine
*/
public void set__1(Boolean value) {
setValue(_1, value);
}
/**
* Set the <code>_1</code> parameter to the function to be used with a {@link org.jooq.Select} statement
*/
public void set__1(Field<Boolean> field) {
setField(_1, field);
}
}
| [
"[email protected]"
] | |
ba997ade8ced92e2704a8ee0405623887d359b3c | 6ebedd3086cc95de00f392280d5730216c754b5f | /app/src/main/gen/com/example/krist/myapplication/R.java | 88d9cfffdbd11963f3b381097def6454ff4dab96 | [] | no_license | niuxe/android_fitnessApp | 2e508e5573824718b0dc703bc42dcee69cba4d1a | 9d2c1173ad3704006a1b41131a1ddcb3f17fc70d | refs/heads/master | 2020-04-03T09:46:23.593571 | 2018-11-21T07:05:25 | 2018-11-21T07:05:25 | 155,175,589 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 187 | java | /*___Generated_by_IDEA___*/
package com.example.krist.myapplication;
/* This stub is only used by the IDE. It is NOT the R class actually packed into the APK */
public final class R {
} | [
"[email protected]"
] | |
e197ffe44831066a47d25f38d788e7c5af9f5d63 | 27898ac2655155535ef6fba74a46e9e5fb8fd108 | /src/com/syntax/class23/StudentTest.java | fcdc20980afda6d0fc3ebf2f7b55831ac3487db7 | [] | no_license | sushilsharma77/JavaBasic | ebb4424a183b319ced8af9b75f3f26d7b88a5a9f | 83fa5de3e944faaa0ba340813fc71016640dbefa | refs/heads/master | 2021-04-09T22:03:04.512689 | 2020-06-02T20:50:10 | 2020-06-02T20:50:10 | 248,367,746 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 670 | java | package com.syntax.class23;
public class StudentTest {
public static void main(String[] args) {
System.out.println("---- Student Object and Reference Student Type");
Student student=new Student();
student.study();
student.doHomework();
System.out.println("---- SyntaxStudent Object and Reference SyntaxStudent Type");
SyntaxStudent syntax=new SyntaxStudent();
syntax.doHomework();
syntax.study();
syntax.accessParentOverridenMethod();
syntax.getJob();
System.out.println("---- SyntaxStudent Object and Student Reference Type");
Student st=new SyntaxStudent();
st.study();
st.doHomework();
//SyntaxStudent st1=new Student();
}
}
| [
"[email protected]"
] | |
bc23adc0c447f2ad8ec66d822de072f7350bab03 | acc9f78803873945b9d4148012bf0d3b836a6265 | /AppTest.java | b5d24b605a6c3ac9d7b54d176d797cabd6b16e6f | [] | no_license | sahithi2411/TASK-12 | 9872e7e6e0988f95f220375f6d2663dcb24d58fb | 4961c1bac2b08f9e8321accd8f2b52bde9e02171 | refs/heads/master | 2022-11-24T03:54:58.477517 | 2020-07-26T12:27:12 | 2020-07-26T12:27:12 | 282,643,665 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 673 | java | package com.epam.lambdas_streams;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}
© 2020 GitHub, Inc.
| [
"[email protected]"
] | |
9fb0ac1c953f4dfb71bccc2c12ec4e1b7816841f | b35bdb88bba82bdd5dfb0a3ecac64c922f2709bc | /src/main/java/ar/com/ada/api/pooflixmongo/models/responses/GenericResponse.java | 1cedabffda840ab47b8cb1cef6b329a6c300dd95 | [] | no_license | floromer/Pooflix | 23a8cf32c126ab00db04ae42df8c1c94a222cc51 | 12c52f327b0cbbfb5d2d84a2c0fd2d5e971cba7c | refs/heads/master | 2022-12-22T00:42:17.944272 | 2020-09-22T14:44:14 | 2020-09-22T14:44:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 395 | java | package ar.com.ada.api.pooflixmongo.models.responses;
import org.bson.types.ObjectId;
public class GenericResponse {
public ObjectId _id;
public String message;
public boolean isOk;
public GenericResponse(){
}
public GenericResponse(ObjectId id, String message, boolean isOk){
this._id = id;
this.message = message;
this.isOk = isOk;
}
}
| [
"[email protected]"
] | |
95e33532a2ac9dc83b3655f5a415fac2a6142252 | dbc7ed4005761a8c523c29aad719b75255b2f413 | /src/samples/docx4j/org/docx4j/samples/TocUpdateDemo.java | fc756665532146613ae2a5d6c2194fd495c54439 | [
"Apache-2.0"
] | permissive | Chesspiece22/docx4j | 67523f34e08cc1d900425912d65ea0cc7f6b2b76 | fb961ee170876d8ba79b701c90e1fadf10a0e0af | refs/heads/master | 2021-04-28T08:30:02.908998 | 2018-02-08T07:38:54 | 2018-02-08T07:38:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,921 | java | /*
* Copyright 2013-2016, Plutext Pty Ltd.
*
* This file is part of docx4j.
docx4j is 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.docx4j.samples;
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
import org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart;
import org.docx4j.samples.AbstractSample;
import org.docx4j.toc.Toc;
import org.docx4j.toc.TocGenerator;
public class TocUpdateDemo {
static boolean update = false;
public static void main(String[] args) throws Exception{
String input_DOCX = System.getProperty("user.dir") + "/sample-docs/word/toc.docx";
// Load input_template.docx
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(
new java.io.File(input_DOCX));
MainDocumentPart documentPart = wordMLPackage.getMainDocumentPart();
TocGenerator tocGenerator = new TocGenerator(wordMLPackage);
// to generate page numbers, you should install your own local instance of Plutext PDF Converter,
// and point to that in docx4j.properties
// Toc.setTocHeadingText("Sumário");
tocGenerator.updateToc( false); // true --> skip page numbering; its currently much faster
wordMLPackage.save(new java.io.File(System.getProperty("user.dir") + "/OUT_TocUpdateDemo.docx") );
}
}
| [
"[email protected]"
] | |
fc60478db987bb8b872a3fdebf6119170f17d941 | fc3e13631ca47ae0bd5a1188a538ba6a30ee9127 | /Week4/HomeWork07UpdateBoard.java | fde93bc04dc5d57e87123dd32822775f14e015ad | [] | no_license | Saukes/algorithm020 | 5234152f67709679f02cdd2c7d68a6467f1a003f | 9f36f9bc52cd561c5f93ff24a99467d6584b6294 | refs/heads/main | 2023-06-18T11:43:52.163772 | 2021-07-18T02:32:38 | 2021-07-18T02:32:38 | 312,298,418 | 0 | 0 | null | 2020-11-12T14:18:07 | 2020-11-12T14:18:07 | null | UTF-8 | Java | false | false | 2,922 | java | import java.util.LinkedList;
import java.util.Queue;
public class HomeWork07UpdateBoard {
int[] dx = {-1, 1, 0, 0, -1, 1, -1, 1};
int[] dy = {0, 0, -1, 1, -1, 1, 1, -1};
public char[][] updateBoard1(char[][] board, int[] click) {
int x = click[0];
int y = click[1];
if (board[x][y] == 'M') {
board[x][y] = 'X';
} else {
dfs(board, x, y);
}
return board;
}
private void dfs(char[][] board, int i, int j) {
int cnt = 0;
for (int k = 0; k < 8; k++) {
int x = i + dx[k];
int y = j + dy[k];
if (x < 0 || x >= board.length || y < 0 || y >= board[0].length) {
continue;
}
if (board[x][y] == 'M') {
cnt++;
}
}
if (cnt > 0) {
board[i][j] = (char) (cnt + '0');
return;
}
board[i][j] = 'B';
for (int k = 0; k < 8; k++) {
int x = i + dx[k];
int y = j + dy[k];
if (x < 0 || x >= board.length || y < 0 || y >= board[0].length || board[x][y] != 'E') {
continue;
}
dfs(board, x, y);
}
}
public char[][] updateBoard2(char[][] board, int[] click) {
int x = click[0];
int y = click[1];
if (board[x][y] == 'M') {
board[x][y] = 'X';
return board;
}
int m = board.length;
int n = board[0].length;
boolean[][] visited = new boolean[m][n];
visited[x][y] = true;
Queue<int[]> queue = new LinkedList<>();
queue.offer(new int[]{x, y});
while (!queue.isEmpty()) {
int[] point = queue.poll();
int i = point[0], j = point[1];
int cnt = 0;
for (int k = 0; k < 8; k++) {
int newX = i + dx[k];
int newY = j + dy[k];
if (newX < 0 || newX >= board.length ||
newY < 0 || newY >= board[0].length) {
continue;
}
if (board[newX][newY] == 'M') {
cnt++;
}
}
if (cnt > 0) {
board[i][j] = (char) (cnt + '0');
} else {
board[i][j] = 'B';
for (int k = 0; k < 8; k++) {
int newX = i + dx[k];
int newY = j + dy[k];
if (newX < 0 || newX >= board.length ||
newY < 0 || newY >= board[0].length ||
board[newX][newY] != 'E' || visited[newX][newY]) {
continue;
}
visited[newX][newY] = true;
queue.offer(new int[]{newX, newY});
}
}
}
return board;
}
}
| [
"[email protected]"
] | |
b2b29edc0d3d1607786bc5dc4e6958cb250731fc | 01ebbc94cd4d2c63501c2ebd64b8f757ac4b9544 | /backend/gxqpt-exchange/gxqpt-exchange-repository/src/main/java/com/hengyunsoft/platform/exchange/entity/system/domain/FlowDemanListDO.java | 953d8ee921e5da8e30336b2a5f677f59ed1563ed | [] | no_license | KevinAnYuan/gxq | 60529e527eadbbe63a8ecbbad6aaa0dea5a61168 | 9b59f4e82597332a70576f43e3f365c41d5cfbee | refs/heads/main | 2023-01-04T19:35:18.615146 | 2020-10-27T06:24:37 | 2020-10-27T06:24:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,792 | java | package com.hengyunsoft.platform.exchange.entity.system.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* com.hengyunsoft.platform.exchange.entity.system.domain
* gxqpt
* 版权:中科恒运软件科技股份有限公司贵阳分公司
* 描述:
* 修改人:zhaopengfei
* 修改时间:2018/4/25
* 修改内容:
*/
@Data
public class FlowDemanListDO {
@ApiModelProperty(value = "流程taskId")
private Long id;
@ApiModelProperty(value = "申请编码")
private String applyCode;
@ApiModelProperty(value = "需求Id")
private Long demandId;
@ApiModelProperty(value = "apiId")
private Long apiId;
@ApiModelProperty(value = "单位名称")
private String name;
@ApiModelProperty(value = "单位类型")
private String unitType;
@ApiModelProperty(value = "统一社会信用代码")
private String creditCode;
@ApiModelProperty(value = "联系人姓名")
private String contName;
@ApiModelProperty(value = "联系人电话")
private String contTel;
@ApiModelProperty(value = "联系人邮箱")
private String contEmail;
@ApiModelProperty(value = "申请时间")
private Date createTime;
@ApiModelProperty(value = "需求内容")
private String content;
@ApiModelProperty(value = "用途")
private String purpose;
@ApiModelProperty(value = "申请原因")
private String applyReason;
@ApiModelProperty(value = "处理状态名称")
private String hdStatus;
@ApiModelProperty(value = "处理状态,用于操作按钮的判断(1,待审批;2,已驳回;3,通过,待封装API;4,已封装API)")
private Integer status;
}
| [
"[email protected]"
] | |
d2d71ad0890cccb614a004910d07f433a15f4262 | 20eb62855cb3962c2d36fda4377dfd47d82eb777 | /IntroClassJava/dataset/smallest/9083480332b4a5e4274f3bf5ef8bd5d1bd75048c0c066e574c27a2de6d919d658efc519e8b6a230a074eb5f2957d5768f4dc981a8e926c3a72993bc448a017f7/005/mutations/248/smallest_90834803_005.java | b87f5374d609bb360bddd547e99349facd5db299 | [] | no_license | ozzydong/CapGen | 356746618848065cce4e253e5d3c381baa85044a | 0ba0321b6b1191443276021f1997833342f02515 | refs/heads/master | 2023-03-18T20:12:02.923428 | 2020-08-21T03:08:28 | 2020-08-21T03:08:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,368 | java | package introclassJava;
class IntObj {
public int value;
public IntObj () {
} public IntObj (int i) {
value = i;
}
}
class FloatObj {
public float value;
public FloatObj () {
} public FloatObj (float i) {
value = i;
}
}
class LongObj {
public long value;
public LongObj () {
} public LongObj (long i) {
value = i;
}
}
class DoubleObj {
public double value;
public DoubleObj () {
} public DoubleObj (double i) {
value = i;
}
}
class CharObj {
public char value;
public CharObj () {
} public CharObj (char i) {
value = i;
}
}
public class smallest_90834803_005 {
public java.util.Scanner scanner;
public String output = "";
public static void main (String[]args) throws Exception {
smallest_90834803_005 mainClass = new smallest_90834803_005 ();
String output;
if (args.length > 0) {
mainClass.scanner = new java.util.Scanner (args[0]);
} else {
mainClass.scanner = new java.util.Scanner (System.in);
}
mainClass.exec ();
System.out.println (mainClass.output);
}
public void exec () throws Exception {
IntObj a = new IntObj (), b = new IntObj (), c = new IntObj (), d =
new IntObj (), sm = new IntObj ();
output +=
(String.format ("Please enter 4 numbers separated by spaces > "));
a.value = scanner.nextInt ();
b.value = scanner.nextInt ();
c.value = scanner.nextInt ();
d.value = scanner.nextInt ();
if (a.value < b.value && a.value < c.value && a.value < d.value) {
output += (String.format ("%d is the smallest\n", a.value));
} else if (b.value < a.value && b.value < c.value && b.value < d.value) {
output += (String.format ("%d is the smallest\n", b.value));
} else if ((a.value) < (c.value) && c.value < b.value && c.value < d.value) {
output += (String.format ("%d is the smallest\n", c.value));
} else if (d.value < a.value && d.value < b.value && d.value < c.value) {
output += (String.format ("%d is the smallest\n", d.value));
} else {
output += (String.format ("They have to be different numbers"));
}
if (true)
return;;
}
}
| [
"[email protected]"
] | |
54a331cd7b27aaa27f58d9c4e99805d42190cff3 | 82467291a3d593b016d18282e519b7cd43de0f9f | /Workspace/org.miip.waterway/src/org/miip/waterway/model/Waterway.java | 32057bc5f2d174e3697bbbdef4574b2383eec658 | [
"Apache-2.0"
] | permissive | Matthew-ye-zhang/mip2017 | 343509e2f901be10c81e5a9ad54264edce88a3b0 | 75ea35117f2e8d18da3cbb97b8e9f8962956c669 | refs/heads/master | 2023-04-03T17:31:46.134371 | 2021-04-16T13:18:45 | 2021-04-16T13:18:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,765 | java | package org.miip.waterway.model;
import java.util.ArrayList;
import java.util.Collection;
import java.util.logging.Logger;
import org.condast.commons.autonomy.model.AbstractModel;
import org.condast.commons.autonomy.model.IPhysical;
import org.condast.commons.data.latlng.LatLng;
import org.condast.commons.data.latlng.LatLngUtils;
import org.condast.commons.data.latlng.LatLngUtilsDegrees;
import org.condast.commons.data.plane.Field;
import org.condast.commons.data.plane.IField;
public class Waterway extends AbstractModel<Object>{
private static final int DEFAULT_NR_OF_SHIPS = 1;
private static final int MARGIN_X = 20;//The margin with which ships can disappear behind the visible waterway
private Collection<IVessel> ships;
private int nrOfShips;
private IField field;
//The distance travelled since the start button was pressed
private long travelled;
private Logger logger = Logger.getLogger( this.getClass().getName() );
public Waterway( long id, LatLng latlng, Field field) {
this( id, latlng, field, DEFAULT_NR_OF_SHIPS );
}
public Waterway( long id, LatLng latlng, IField field, int nrOfShips) {
super( id, IPhysical.ModelTypes.WATERWAY, latlng );
this.field = field;
this.nrOfShips = nrOfShips;
ships = new ArrayList<IVessel>();
this.initialise();
}
protected void initialise(){
createShips( 20, (int)(this.nrOfShips/2) );
createShips( field.getLength()-200, (int)( this.nrOfShips/2) );
}
public void clear(){
this.ships.clear();
this.travelled = 0;
}
public IField getField() {
return field;
}
public long getTravelled() {
return travelled;
}
public int getNrOfShips() {
return nrOfShips;
}
public void setNrOfShips(int nrOfShips) {
this.nrOfShips = nrOfShips;
}
public IVessel[] getShips(){
return ships.toArray( new Ship[ ships.size() ]);
}
@Override
public boolean isInCriticalDistance(IPhysical physical) {
return false;
}
protected void createShips( long xposition, int amount ){
if( this.ships.size() >= nrOfShips )
return;
Field newfield = new Field( super.getLocation(), field.getLength(), field.getWidth() );
for( int i=this.ships.size(); i< amount; i++){
long yposition = (long) ( Math.random() * newfield.getWidth());
LatLng lnglat = newfield.transform( xposition, yposition );
Ship ship = Ship.createShip( lnglat, "newShip" );
logger.fine("Adding ship: " + ship.getLocation() + " bearing " + ship.getHeading());
logger.fine( "Distance to centre: " + LatLngUtils.getDistance( newfield.getCentre(), ship.getLocation()));
ships.add( ship );
}
}
public void update( long interval, double distance ){
this.travelled += distance;
Field newField = new Field( super.getLocation(), field.getLength(), field.getWidth() );
for( IVessel vessel: getShips() ){
Ship ship = (Ship) vessel;
LatLng ll = ship.move( interval );
if( !newField.isInField(ll, MARGIN_X ))
ships.remove( ship );
//logger.info( "New Position for spped:" + ship.getSpeed() + ",\n\t" + ship.getLnglat() );
//logger.info( "Diff " + (position.getLongitude() - ship.getLnglat().getLongitude() ));
//logger.info( "Diff " + LatLngUtils.distance(position, ship.getLnglat() ));
}
createShips( 0, 20);//(int)(this.nrOfShips/2) );
createShips( this.getField().getLength() -100, 1 );//(int)(this.nrOfShips/2) );
super.setLocation( LatLngUtilsDegrees.extrapolate( super.getLocation(), LatLng.Compass.EAST.getAngle(), distance));
logger.fine( "Update Position " + super.getLocation() );
}
@Override
public IPhysical clone() throws CloneNotSupportedException {
// TODO Auto-generated method stub
return null;
}
}
| [
"[email protected]"
] | |
943bebdb8dd4f2099e43513e86a0bf1d1a755c1e | 26b784d3a18c6b0527e0838d1821f5ab7cd7a90a | /im4j-pojo/src/main/java/com/im4j/example/UserExample.java | 0efd918276c6e8cc36990b9fbeba41d12d9a0531 | [] | no_license | chenzp1/im4j-parent | 1d09f3ba736369100f5115d91fda024e4e41925c | ae25ff243e85ab33b617d1ee2221e16a4fe784f5 | refs/heads/master | 2021-01-01T18:35:40.820531 | 2017-11-08T02:50:27 | 2017-11-08T02:50:27 | 76,965,206 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,007 | java | package com.im4j.example;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class UserExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public UserExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(String value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(String value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(String value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(String value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(String value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(String value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdLike(String value) {
addCriterion("id like", value, "id");
return (Criteria) this;
}
public Criteria andIdNotLike(String value) {
addCriterion("id not like", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(String value1, String value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(String value1, String value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andPasswordIsNull() {
addCriterion("password is null");
return (Criteria) this;
}
public Criteria andPasswordIsNotNull() {
addCriterion("password is not null");
return (Criteria) this;
}
public Criteria andPasswordEqualTo(String value) {
addCriterion("password =", value, "password");
return (Criteria) this;
}
public Criteria andPasswordNotEqualTo(String value) {
addCriterion("password <>", value, "password");
return (Criteria) this;
}
public Criteria andPasswordGreaterThan(String value) {
addCriterion("password >", value, "password");
return (Criteria) this;
}
public Criteria andPasswordGreaterThanOrEqualTo(String value) {
addCriterion("password >=", value, "password");
return (Criteria) this;
}
public Criteria andPasswordLessThan(String value) {
addCriterion("password <", value, "password");
return (Criteria) this;
}
public Criteria andPasswordLessThanOrEqualTo(String value) {
addCriterion("password <=", value, "password");
return (Criteria) this;
}
public Criteria andPasswordLike(String value) {
addCriterion("password like", value, "password");
return (Criteria) this;
}
public Criteria andPasswordNotLike(String value) {
addCriterion("password not like", value, "password");
return (Criteria) this;
}
public Criteria andPasswordIn(List<String> values) {
addCriterion("password in", values, "password");
return (Criteria) this;
}
public Criteria andPasswordNotIn(List<String> values) {
addCriterion("password not in", values, "password");
return (Criteria) this;
}
public Criteria andPasswordBetween(String value1, String value2) {
addCriterion("password between", value1, value2, "password");
return (Criteria) this;
}
public Criteria andPasswordNotBetween(String value1, String value2) {
addCriterion("password not between", value1, value2, "password");
return (Criteria) this;
}
public Criteria andEmailIsNull() {
addCriterion("email is null");
return (Criteria) this;
}
public Criteria andEmailIsNotNull() {
addCriterion("email is not null");
return (Criteria) this;
}
public Criteria andEmailEqualTo(String value) {
addCriterion("email =", value, "email");
return (Criteria) this;
}
public Criteria andEmailNotEqualTo(String value) {
addCriterion("email <>", value, "email");
return (Criteria) this;
}
public Criteria andEmailGreaterThan(String value) {
addCriterion("email >", value, "email");
return (Criteria) this;
}
public Criteria andEmailGreaterThanOrEqualTo(String value) {
addCriterion("email >=", value, "email");
return (Criteria) this;
}
public Criteria andEmailLessThan(String value) {
addCriterion("email <", value, "email");
return (Criteria) this;
}
public Criteria andEmailLessThanOrEqualTo(String value) {
addCriterion("email <=", value, "email");
return (Criteria) this;
}
public Criteria andEmailLike(String value) {
addCriterion("email like", value, "email");
return (Criteria) this;
}
public Criteria andEmailNotLike(String value) {
addCriterion("email not like", value, "email");
return (Criteria) this;
}
public Criteria andEmailIn(List<String> values) {
addCriterion("email in", values, "email");
return (Criteria) this;
}
public Criteria andEmailNotIn(List<String> values) {
addCriterion("email not in", values, "email");
return (Criteria) this;
}
public Criteria andEmailBetween(String value1, String value2) {
addCriterion("email between", value1, value2, "email");
return (Criteria) this;
}
public Criteria andEmailNotBetween(String value1, String value2) {
addCriterion("email not between", value1, value2, "email");
return (Criteria) this;
}
public Criteria andPhoneIsNull() {
addCriterion("phone is null");
return (Criteria) this;
}
public Criteria andPhoneIsNotNull() {
addCriterion("phone is not null");
return (Criteria) this;
}
public Criteria andPhoneEqualTo(String value) {
addCriterion("phone =", value, "phone");
return (Criteria) this;
}
public Criteria andPhoneNotEqualTo(String value) {
addCriterion("phone <>", value, "phone");
return (Criteria) this;
}
public Criteria andPhoneGreaterThan(String value) {
addCriterion("phone >", value, "phone");
return (Criteria) this;
}
public Criteria andPhoneGreaterThanOrEqualTo(String value) {
addCriterion("phone >=", value, "phone");
return (Criteria) this;
}
public Criteria andPhoneLessThan(String value) {
addCriterion("phone <", value, "phone");
return (Criteria) this;
}
public Criteria andPhoneLessThanOrEqualTo(String value) {
addCriterion("phone <=", value, "phone");
return (Criteria) this;
}
public Criteria andPhoneLike(String value) {
addCriterion("phone like", value, "phone");
return (Criteria) this;
}
public Criteria andPhoneNotLike(String value) {
addCriterion("phone not like", value, "phone");
return (Criteria) this;
}
public Criteria andPhoneIn(List<String> values) {
addCriterion("phone in", values, "phone");
return (Criteria) this;
}
public Criteria andPhoneNotIn(List<String> values) {
addCriterion("phone not in", values, "phone");
return (Criteria) this;
}
public Criteria andPhoneBetween(String value1, String value2) {
addCriterion("phone between", value1, value2, "phone");
return (Criteria) this;
}
public Criteria andPhoneNotBetween(String value1, String value2) {
addCriterion("phone not between", value1, value2, "phone");
return (Criteria) this;
}
public Criteria andUserNameIsNull() {
addCriterion("user_name is null");
return (Criteria) this;
}
public Criteria andUserNameIsNotNull() {
addCriterion("user_name is not null");
return (Criteria) this;
}
public Criteria andUserNameEqualTo(String value) {
addCriterion("user_name =", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameNotEqualTo(String value) {
addCriterion("user_name <>", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameGreaterThan(String value) {
addCriterion("user_name >", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameGreaterThanOrEqualTo(String value) {
addCriterion("user_name >=", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameLessThan(String value) {
addCriterion("user_name <", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameLessThanOrEqualTo(String value) {
addCriterion("user_name <=", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameLike(String value) {
addCriterion("user_name like", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameNotLike(String value) {
addCriterion("user_name not like", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameIn(List<String> values) {
addCriterion("user_name in", values, "userName");
return (Criteria) this;
}
public Criteria andUserNameNotIn(List<String> values) {
addCriterion("user_name not in", values, "userName");
return (Criteria) this;
}
public Criteria andUserNameBetween(String value1, String value2) {
addCriterion("user_name between", value1, value2, "userName");
return (Criteria) this;
}
public Criteria andUserNameNotBetween(String value1, String value2) {
addCriterion("user_name not between", value1, value2, "userName");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("status is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("status is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(String value) {
addCriterion("status =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(String value) {
addCriterion("status <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(String value) {
addCriterion("status >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(String value) {
addCriterion("status >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(String value) {
addCriterion("status <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(String value) {
addCriterion("status <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLike(String value) {
addCriterion("status like", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotLike(String value) {
addCriterion("status not like", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<String> values) {
addCriterion("status in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<String> values) {
addCriterion("status not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(String value1, String value2) {
addCriterion("status between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(String value1, String value2) {
addCriterion("status not between", value1, value2, "status");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"[email protected]"
] | |
aa96dea84adb9eccf5624b8b9d1fdf2258b4c83f | ec4b2c5bd2f59e676c2baeecb25911c569b34882 | /src/main/java/br/com/ame/planets/PlanetsApplication.java | 0a3010172fd5980d2e63d27e9b942420a7e885cc | [] | no_license | antoniocvaraujo1/Planets | 4d0b559af8041ad8aa7d6590c2fb38062b3adf56 | 5bb08a89ea4f964f9e175d0dae941c38084753e8 | refs/heads/main | 2023-05-04T23:14:52.457690 | 2021-05-26T16:24:47 | 2021-05-26T16:24:47 | 368,275,066 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 535 | java | package br.com.ame.planets;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.mongodb.repository.config.EnableReactiveMongoRepositories;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableSwagger2
@EnableReactiveMongoRepositories
@SpringBootApplication
public class PlanetsApplication {
public static void main(String[] args) {
SpringApplication.run(PlanetsApplication.class, args);
}
}
| [
"[email protected]"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.