blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 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 684M ⌀ | 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 132
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 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d80f813b3cda8bd13cb6a82e5391b9916a1773ae | 39ad563d48e2307bd7fd29f09e4312d216fd03b5 | /Programming Exercise 7/Primepalidrome.java | 36287c8b857a82f8cfee96b12f0d38d1d55be9d8 | [] | no_license | ABrown338/CST-105_Assignments | 882a4067305f6099ea603e631e2bc4ab7693c581 | eebc20b5bd9ff7b531cd8fc3d87a905812bda8c3 | refs/heads/master | 2020-03-09T07:48:58.891236 | 2018-05-21T06:11:59 | 2018-05-21T06:11:59 | 128,673,419 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,485 | 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 primepalidrome;
/**
*
* @author Alex Brown
*
* This is all of my work
*/
public class Primepalidrome {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int primeCounter = 1;
System.out.println("Palindromic Primes");
for (int myNumber = 2; myNumber <= 1000000; myNumber++) {
if(isPrime(myNumber)) {
if (isPalindromic(myNumber)) {
//System.out.print(myNumber + " ");
System.out.format("%-5d ", myNumber);
if (primeCounter % 4 == 0) {
System.out.println(" ");
}
primeCounter++;
}
} else {
//System.out.println(myNumber + " is not prime");
}
}
System.out.println(" ");
}
/**
*
* @param myNumber
* @return
*/
public static boolean isPrime (int myNumber) {
int mySqrt = (int) Math.rint(Math.sqrt(myNumber));
for (int i = 2; i <= mySqrt; i++) {
int currentRemainder = myNumber % i;
//System.out.println("mySqrt " + mySqrt + " currentRemainder " + currentRemainder + " myNumber " + myNumber + " i " + i);
if (currentRemainder == 0) {
return false;
}
}
return true;
}
//This work is done by me, ALex Brown, it i smy work
/**
*
* @param myNumber
* @return
*/
public static boolean isPalindromic (int myNumber) {
String numberString = String.valueOf(myNumber);
int length = numberString.length();
int beginCount = 0;
int endCount = length;
if (length == 1) {
return true;
} else {
while (endCount - beginCount > 1) {
String beginChar = numberString.substring(beginCount,beginCount + 1);
String endChar = numberString.substring(endCount - 1, endCount);
if (beginChar == null ? endChar != null : !beginChar.equals(endChar)) {
return false;
}
beginCount++;
endCount--;
}
return true;
}
}
}
| [
"ABrown338@my.gcu.edu"
] | ABrown338@my.gcu.edu |
ecdc129a4024feee9c8f283b57f5355a0568d82e | 3796dd97448c382f79caf6a37637218d636324e9 | /app/src/main/java/com/codepath/oobal/instagram/data/model/Post.java | 74d3c61b2dbe79b14b8b4fddf69bb97414f3925f | [
"Apache-2.0"
] | permissive | justdave001/instagramClone | fd239adaa248f67a4cdb761ef7f536a7e6d0d978 | 98d6faef71b92c8fa10871b4a956435eb55950e4 | refs/heads/master | 2023-03-26T03:19:42.694385 | 2021-03-26T10:08:33 | 2021-03-26T10:08:33 | 375,246,545 | 1 | 0 | null | 2021-06-09T06:15:01 | 2021-06-09T06:15:01 | null | UTF-8 | Java | false | false | 1,011 | java | package com.codepath.oobal.instagram.data.model;
import com.parse.ParseClassName;
import com.parse.ParseFile;
import com.parse.ParseFileUtils;
import com.parse.ParseObject;
import com.parse.ParseUser;
@ParseClassName("Post")
public class Post extends ParseObject {
public static final String KEY_DESCRIPTION = "Description";
public static final String KEY_IMAGE = "Image";
public static final String KEY_USER = "User";
public static final String KEY_CREATED_KEY = "createdAt";
public String getDescription() {
return getString(KEY_DESCRIPTION);
}
public void setDescription(String description) {
put(KEY_DESCRIPTION, description);
}
public ParseFile getImage() {
return getParseFile(KEY_IMAGE);
}
public void setImage(ParseFile parseFile) {
put(KEY_IMAGE, parseFile);
}
public ParseUser getUser() {
return getParseUser(KEY_USER);
}
public void setUser(ParseUser user) {
put(KEY_USER, user);
}
}
| [
"oolaniran3586@myasu.alasu.edu"
] | oolaniran3586@myasu.alasu.edu |
d112736992f4c63754a1194c52b23845df1aeea2 | 446a67bade6429415eba72ac8799bd8b7d7471f0 | /src/Client.java | 4a858689b527a44f9e186d74984b398d060a4c43 | [] | no_license | dudebot/BattleTanks | 30071ab51b1d6a4732ad5459ab76d8889026c390 | 1c87f9a896316b9adeabf54d08b790938072e8d4 | refs/heads/main | 2023-04-14T00:09:18.724946 | 2023-03-17T22:11:35 | 2023-03-17T22:11:35 | 6,452,115 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,116 | java | package BattleTanks;
import java.io.*;
import java.net.*;
import javax.swing.JOptionPane;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.awt.event.*;
import java.util.ArrayList;
import javax.swing.JOptionPane;
/**
*this class is the client section of the system.
*it gets information from the server (list of projectiles/tanks)
*finds which tank this client is controlling, and then finally
*draws all of the world based off where that tank is.
*
*the second threaded task of this class is to send the server
*what keys are being pressed that the server needs to know
*ie: wasd, clicking, where the mouse is on the world.
*
*in a communication sense, the class that represends the opposite
*(server sending) is Tank
*any changes to what this class sends (number of bytes), Client.size
*NEEDS to change and the next byte needs to be implemented in Client.getData
*and the ClientData constructor (also other methods to get that data)
*and finally in world, do something with that data in World.move
*
*
*currently working on making the view dynamic:
* change where everything is drawn
* change where the mouse location is based on where the tank is
* (relative change)
* zoom maybe?
*
*also working on:
* automatic client selection wooo!
*/
public class Client extends Frame implements MouseMotionListener,KeyListener,MouseListener
{
public static final int size=6; //number of bytes being sent to the server
MulticastListener listener;
MulticastSender sender;
MulticastSender specialSender;
MulticastListener specialListener;
//Config config;
byte client;//what THIS client is
byte team;
Coordinate mouseLocation;
Screen screen;
boolean forward;
boolean backward;
boolean left;
boolean right;
boolean shoot,specialShoot;
ArrayList<Integer> keys;
ArrayList<Solid> solids;
public Client(int channel)
{
//read this from server :/
//String mapName="defaultmap";
keys=new ArrayList<Integer>();
listener = new MulticastListener(channel,Util.servSend);
sender= new MulticastSender(channel,Util.servListen);
//specialListener = new MulticastListener(channel,Util.servSendSpec);
//specialSender = new MulticastSender(channel,Util.servListenSpec);
mouseLocation=new Coordinate();
addKeyListener(this);
addMouseMotionListener(this);
addMouseListener(this);
setTitle("BattleTanks Client");
setUndecorated(true);
listener.start();
screen = new Screen();
setUndecorated(true);
setSize(screen.getWidth(),screen.getHeight());
team=0;
//System.out.println("recieved client number of " + client);
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0); }});
}
public void paint(Graphics g){}
private void makeBG(Graphics g)
{
g.setColor(Color.white);
g.fillRect(0,0,getWidth(),getHeight());
/*
*/
}
public void run()
{
Graphics2D buffer,radarBuffer,scoreBuffer, bgBuffer;
BufferedImage image,radarImage,scoreImage, bgImage;
image=new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB);
buffer=image.createGraphics();
//radarImage=new BufferedImage(screen.getWidth()/5,screen.getWidth()/5, BufferedImage.TYPE_INT_ARGB);
//radarBuffer=radarImage.createGraphics();
//radarBuffer.setComposite(AlphaComposite.getInstance(AlphaComposite.CLEAR, .7F));
bgImage=new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB);
bgBuffer=bgImage.createGraphics();
makeBG(bgBuffer);
byte[] byteData=Util.waitForBytes(listener,10);
boolean[] clientsTaken=new boolean[128];
int numTanks=Util.getInt(byteData[1],byteData[2]);
//choose a client number
System.out.println("List of existing clients:");
for(int i=0;i<numTanks;i++)
{
byte temp=byteData[World.size+8+i*Tank.size];
if(temp!=-128)
{
clientsTaken[temp]=true;
System.out.println(temp);
}
}
//now choose the client
boolean found=false;
for(int i=0;i<128&&!found;i++)
{
if (!clientsTaken[i])
{
client=(byte)i;
found=true;
}
}
if(!found)
{
JOptionPane.showMessageDialog(null,"The server is full, try getting one of the 128 people off the server");
System.exit(0);
}
//while((byteData=Util.waitForBytes(listener,10))[0]!=(byte)1);//heh
//wait for server to pop out map info
while(byteData[0]!=(byte)1)
byteData=Util.waitForBytes(listener,10);
numTanks=Util.getInt(byteData[1],byteData[2]);
int numProjectiles=Util.getInt(byteData[3],byteData[4]);
int numItems=Util.getInt(byteData[5],byteData[6]);
int previousBytes=numTanks*Tank.size+
numProjectiles*Projectile.size+
numItems*Item.size+
World.size;
solids= Util.getSolids(Util.getInt(byteData[previousBytes],byteData[previousBytes+1]),
Util.getInt(byteData[previousBytes+2],byteData[previousBytes+3]));
if (solids==null)
System.exit(1);
setVisible(true);
while (true)
{
byteData=Util.waitForBytes(listener,10);
//System.out.println("byte data is " + byteData.length+ " bytes from listener in client");
numTanks=Util.getInt(byteData[1],byteData[2]);
numProjectiles=Util.getInt(byteData[3],byteData[4]);
numItems=Util.getInt(byteData[5],byteData[6]);
Coordinate center = new Coordinate();
//***************************************** START DRAWING
buffer.drawImage(bgImage,0,0,this);
buffer.setColor(Color.gray);
int line=(int)(500*screen.getZoom());
int tempX=(int)((screen.getCenterX()*screen.getZoom())%line);
int tempY=(int)((screen.getCenterY()*screen.getZoom())%line);
//for(int i=(int)(-screen.getZoom()*tempX);i<screen.halfX();i+=screen.getZoom()*line)
for(int i=-1;i<(int)(screen.getWidth()/line/screen.getZoom());i++)
{
buffer.fillRect(screen.halfX()+i*line-tempX,0,(int)(25*screen.getZoom()),getHeight());
buffer.fillRect(screen.halfX()-i*line-tempX,0,(int)(25*screen.getZoom()),getHeight());
}
for(int i=-1;i<(int)(screen.getHeight()/line/screen.getZoom());i++)
{
buffer.fillRect(0,screen.halfY()+i*line-tempY,getWidth(),(int)(25*screen.getZoom()));
buffer.fillRect(0,screen.halfY()-i*line-tempY,getWidth(),(int)(25*screen.getZoom()));
}
for(Solid s:solids)
{
s.draw(buffer,screen);
}
try{
//radarBuffer.setColor(Color.white);
//radarBuffer.fillOval(0,0,screen.getWidth()/5,screen.getWidth()/5);
buffer.setColor(new Color(70,70,70,70));
buffer.fillOval(0,0,screen.getWidth()/5,screen.getWidth()/5);
previousBytes=World.size;
for(int i=0;i<numTanks;i++)//ignore first 4 bytes because those are the number tanks and projectiles
{
byte[] tank = new byte[Tank.size];
for(int p=0;p<Tank.size;p++)
tank[p]=byteData[i*Tank.size+previousBytes+p];
int[] data=Tank.draw(buffer,tank,screen);
if (tank[8]==client)
{
team=tank[7];
center.set(Util.getInt(tank[0],tank[1]),Util.getInt(tank[2],tank[3]));
}
if(screen.getCenter().getDistance(data[1],data[2])<screen.getWidth()/2*3)
{
if(data[4]!=team)
buffer.setColor(Color.red);
else if (tank[8]!=client)
buffer.setColor(Color.green);
else
buffer.setColor(Color.blue);
buffer.fillOval(screen.halfX()/5+(data[1]-screen.getCenterX())/(3*5)-3,screen.halfX()/5+(data[2]-screen.getCenterY())/(3*5)-3,6,6);
}
}
previousBytes+=numTanks*Tank.size;
for(int i=0;i<numProjectiles;i++)
{
byte[] projectile=new byte[Projectile.size];
for(int p=0;p<Projectile.size;p++)
projectile[p]=byteData[i*Projectile.size+previousBytes+p];
Projectile.draw(buffer,projectile,screen);
}
previousBytes+=numProjectiles*Projectile.size;
for(int i=0;i<numItems;i++)
{
byte[] item=new byte[Item.size];
for(int p=0;p<Item.size;p++)
item[p]=byteData[i*Item.size+previousBytes+p];
Item.draw(buffer,item,screen);
}
}catch(IndexOutOfBoundsException e)
{
System.out.println("failed to properly draw world because of stream corruption");
}
//set the center from that found in tank loop
screen.setCenter(center);
//buffer.drawImage(radarImage,0,0,Color.white,this);
getGraphics().drawImage(image,0,0,this);
try{
passiveAnalyzeKeys();
sender.send(getData());
}catch(Exception e)
{
System.out.println("goodbye");
return;
}
}
}
private byte[] getData()
{
byte[] x=Util.getBytes(screen.translateXToWorld(mouseLocation.xInt()));
byte[] y=Util.getBytes(screen.translateYToWorld(mouseLocation.yInt()));
byte[] bytes= new byte[size];
bytes[0]=client;
bytes[1]=Util.getByte(forward,backward,left,right,shoot,specialShoot,false,false);
bytes[2]=x[0];
bytes[3]=x[1];
bytes[4]=y[0];
bytes[5]=y[1];
shoot=false;//dont repeat :)
specialShoot=false;
return bytes;
}
public void mouseMoved(MouseEvent e)
{
//mouseLocation.set(screen.translateXToWorld(e.getX()),screen.translateYToWorld(e.getY()));
mouseLocation.set(e.getX(),e.getY());
}
public void mouseDragged(MouseEvent e)
{
mouseMoved(e);
}
public void keyPressed(KeyEvent e)
{
//System.out.println(e.getKeyCode());
int lastKey=e.getKeyCode();
if (!keys.contains(lastKey))
keys.add(lastKey);
activeAnalyzeKeys();
}
public void keyReleased(KeyEvent e)
{
keys.remove((Object)e.getKeyCode());
}
public void keyTyped(KeyEvent e){}
public void mouseExited(MouseEvent e){}
public void mouseEntered(MouseEvent e){ }
public void mouseReleased(MouseEvent e) {}
public void mouseClicked(MouseEvent e){}
public void mousePressed(MouseEvent e)
{
if(e.getButton()==1)
shoot=true;
else if(e.getButton()==3)
specialShoot=true;
}
/**
*this is called at the end of every frame
*/
public void passiveAnalyzeKeys()
{
forward=keys.contains(87);
backward=keys.contains(83);
if(forward&&backward)
{
backward=false;
forward=false;
}
right=keys.contains(68);
left=keys.contains(65);
if(right&&left)
{
left=false;
right=false;
}
/*boolean in,out;//super secret dont look
in=keys.contains(45);
out=keys.contains(61);
if(in^out)
{
if(in)
screen.zoom(0.8);
else
screen.zoom(1.25);
}*/
}
/**
*this method is called after every key pressing event
*/
private void activeAnalyzeKeys()
{
if(keys.contains(27))
exitServer();
}
private void exitServer()
{
//Util.sendDisconnect(client,sender);
listener.close();
sender.close();
System.exit(0);
}
public static void main(String[] args)
{
Client f= new Client(2);
f.run();
}
}
| [
"connor.k.taylor@gmail.com"
] | connor.k.taylor@gmail.com |
223bc51c10a86f180b7ead51afc9e02dacd62788 | 9cec0879f337b2242c44e3ca9ec6847551f1ef4b | /backend/src/main/java/com/github/performancemonitor/model/mapper/DepartmentToDepartmentDtoMapper.java | 40928fc66ada0d59d33c162fcafc6223515e9163 | [] | no_license | mostafaism1/qeema-interview-task | 5f21d07f42a55d043e6fdf2cb3537d56e0dd0199 | d7ffd03211da70fc18a9aa92aa2dc321d480a4d2 | refs/heads/main | 2023-06-15T20:51:47.337293 | 2021-07-03T00:29:34 | 2021-07-03T00:29:34 | 380,548,298 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 651 | java | package com.github.performancemonitor.model.mapper;
import java.util.function.Function;
import com.github.performancemonitor.model.dto.DepartmentDto;
import com.github.performancemonitor.model.entity.Department;
import org.springframework.stereotype.Component;
@Component
public class DepartmentToDepartmentDtoMapper implements Function<Department, DepartmentDto> {
@Override
public DepartmentDto apply(Department department) {
return department == null ? null
: DepartmentDto.builder().id(department.getId()).name(department.getName())
.logoUrl(department.getLogoUrl()).build();
}
}
| [
"me.cssign@gmail.com"
] | me.cssign@gmail.com |
6f685678860404b7c4505598e2694e824716e6de | 4d8a31b33842732e05d1e59fbd99397ad4f50563 | /Implementation/src/initialTests/Password/PasswordCheckerTest.java | 536e98b37821d482546dab46bc661d5fa35a10c3 | [] | no_license | AiridasKutra/UnitTesting | 6d68d32e38e6ded03c64a955ff55585d84c5b9b3 | f136b044b12165543be67fe3b64695c36572be5a | refs/heads/master | 2023-07-30T13:56:34.016363 | 2021-10-02T16:01:40 | 2021-10-02T16:01:40 | 406,081,209 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 712 | java | package initialTests.Password;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import initialImplementation.PasswordChecker;
public class PasswordCheckerTest {
PasswordChecker passwordChecker;
@BeforeEach
void setUp() {
passwordChecker = new PasswordChecker();
}
@Test
void TestChecklength() {
assertTrue(passwordChecker.CheckLength("Slapt", 4));
}
@Test
void TestCheckUppercase() {
assertTrue(passwordChecker.CheckUppercase("Slaptazodis"));
}
@Test
void TestCheckSymbols() {
assertFalse(passwordChecker.CheckSymbols("Slaptazodis"));
}
}
| [
"airidas.kutra@mif.stud.vu.lt"
] | airidas.kutra@mif.stud.vu.lt |
b85293a8be66e39afede067b4fbf1282004719e4 | f3c35ce8ca93ad644f523ca19171478dd0ec95da | /ib-engine/src/main/java/com/dwidasa/engine/service/AppVersionService.java | 9ee5a3e02e4c408d6c241047fcea5b317e3b7cc9 | [] | no_license | depot-air/internet-banking | da049da2f6288a388bd9f2d33a9e8e57f5954269 | 25a5e0038c446536eca748e18f35b7a6a8224604 | refs/heads/master | 2022-12-21T03:54:50.227565 | 2020-01-16T11:15:31 | 2020-01-16T11:15:31 | 234,302,680 | 0 | 1 | null | 2022-12-09T22:33:28 | 2020-01-16T11:12:17 | Java | UTF-8 | Java | false | false | 629 | java | package com.dwidasa.engine.service;
import com.dwidasa.engine.model.AppVersion;
/**
* Created by IntelliJ IDEA.
* User: ryoputranto
* Date: 1/30/12
* Time: 10:18 AM
*/
public interface AppVersionService extends GenericService<AppVersion, Long> {
/**
* Get latest version for particular device/platform and version
* @param deviceType string represent device/platform type, eg BlackBerry (10), Android (11), Iphone (12)
* @param versionId version identification number
* @return app version of the latest version
*/
public AppVersion getLatestVersion(String deviceType, Long versionId);
}
| [
"gunungloli@gmail.com"
] | gunungloli@gmail.com |
467e3693c15b69a07a9697a92fb5198229761a7a | f34602b407107a11ce0f3e7438779a4aa0b1833e | /professor/dvl/roadnet-client/src/main/java/com/roadnet/apex/IAdministrationServiceUploadCustomReportTransferErrorCodeFaultMessage.java | 0011b159e06aa407b9529e18398aef165b37bda0 | [] | no_license | ggmoura/treinar_11836 | a447887dc65c78d4bd87a70aab2ec9b72afd5d87 | 0a91f3539ccac703d9f59b3d6208bf31632ddf1c | refs/heads/master | 2022-06-14T13:01:27.958568 | 2020-04-04T01:41:57 | 2020-04-04T01:41:57 | 237,103,996 | 0 | 2 | null | 2022-05-20T21:24:49 | 2020-01-29T23:36:21 | Java | UTF-8 | Java | false | false | 1,572 | java |
package com.roadnet.apex;
import javax.xml.ws.WebFault;
/**
* This class was generated by Apache CXF 3.2.4
* 2020-03-15T13:07:02.574-03:00
* Generated source version: 3.2.4
*/
@WebFault(name = "TransferErrorCode", targetNamespace = "http://roadnet.com/apex/DataContracts/")
public class IAdministrationServiceUploadCustomReportTransferErrorCodeFaultMessage extends Exception {
private com.roadnet.apex.datacontracts.TransferErrorCode transferErrorCode;
public IAdministrationServiceUploadCustomReportTransferErrorCodeFaultMessage() {
super();
}
public IAdministrationServiceUploadCustomReportTransferErrorCodeFaultMessage(String message) {
super(message);
}
public IAdministrationServiceUploadCustomReportTransferErrorCodeFaultMessage(String message, java.lang.Throwable cause) {
super(message, cause);
}
public IAdministrationServiceUploadCustomReportTransferErrorCodeFaultMessage(String message, com.roadnet.apex.datacontracts.TransferErrorCode transferErrorCode) {
super(message);
this.transferErrorCode = transferErrorCode;
}
public IAdministrationServiceUploadCustomReportTransferErrorCodeFaultMessage(String message, com.roadnet.apex.datacontracts.TransferErrorCode transferErrorCode, java.lang.Throwable cause) {
super(message, cause);
this.transferErrorCode = transferErrorCode;
}
public com.roadnet.apex.datacontracts.TransferErrorCode getFaultInfo() {
return this.transferErrorCode;
}
}
| [
"gleidson.gmoura@gmail.com"
] | gleidson.gmoura@gmail.com |
b9ffa25e582a8dc6b2bc87b279eb5fc33d5333f1 | a6c9e23b0bd6a6513cd681a1aae188118df62cce | /src/main/java/com/vaadin/database/frontend/forms/BalanceForm.java | 0c1964fbaa85e2868c72ad97ca70960c64d7f151 | [
"Unlicense"
] | permissive | Savanmi/database | f3795ea9c0516ca4bebfcc12f916e8802188d22b | 83b76eff585a458bb8f41484aea7827c00143bc1 | refs/heads/main | 2023-05-09T06:18:50.711253 | 2021-05-28T11:22:10 | 2021-05-28T11:22:10 | 344,504,039 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,126 | java | package com.vaadin.database.frontend.forms;
import com.vaadin.database.data.entity.Address;
import com.vaadin.database.data.entity.Balances;
import com.vaadin.database.data.entity.Callers;
import com.vaadin.flow.component.ComponentEvent;
import com.vaadin.flow.component.ComponentEventListener;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.button.ButtonVariant;
import com.vaadin.flow.component.combobox.ComboBox;
import com.vaadin.flow.component.datepicker.DatePicker;
import com.vaadin.flow.component.formlayout.FormLayout;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.textfield.IntegerField;
import com.vaadin.flow.component.textfield.NumberField;
import com.vaadin.flow.component.textfield.TextField;
import com.vaadin.flow.data.binder.BeanValidationBinder;
import com.vaadin.flow.data.binder.Binder;
import com.vaadin.flow.shared.Registration;
import java.util.List;
public class BalanceForm extends FormLayout {
ComboBox<Callers> caller_ID = new ComboBox<>("Id звонящего");
DatePicker subscription_debt_date = new DatePicker("Дата задолженности");
DatePicker long_dist_debt_date = new DatePicker("Дата задолженности межгород");
IntegerField penalty_interest = new IntegerField("Пеня");
IntegerField long_distance_calls_debt = new IntegerField("Задолженность за межгород");
Button save = new Button("Сохранить");
Button delete = new Button("Удалить");
Button close = new Button("Отмена");
Binder<Balances> binder = new BeanValidationBinder<>(Balances.class);
public BalanceForm(List<Callers> callers) {
addClassName("contact-form");
binder.bindInstanceFields(this);
caller_ID.setItems(callers);
caller_ID.setItemLabelGenerator(Callers::getIdStr);
add(subscription_debt_date,
long_dist_debt_date,
penalty_interest,
long_distance_calls_debt,
caller_ID,
createButtonsLayout());
}
public void setBalance (Balances balances){
binder.setBean(balances);
}
private HorizontalLayout createButtonsLayout() {
save.addThemeVariants(ButtonVariant.LUMO_SUCCESS);
delete.addThemeVariants(ButtonVariant.LUMO_ERROR);
close.addThemeVariants(ButtonVariant.LUMO_CONTRAST);
save.addClickListener(buttonClickEvent -> validateAndSave());
delete.addClickListener(event -> fireEvent(new BalanceForm.DeleteEvent(this, binder.getBean())));
close.addClickListener(event -> fireEvent(new BalanceForm.CloseEvent(this)));
return new HorizontalLayout(save, delete, close);
}
private void validateAndSave() {
if (binder.isValid()){
fireEvent(new BalanceForm.SaveEvent(this,binder.getBean()));
}
}
// Events
public static abstract class BalanceFormEvent extends ComponentEvent<BalanceForm> {
private Balances balances;
protected BalanceFormEvent(BalanceForm source, Balances balances) {
super(source, false);
this.balances = balances;
}
public Balances getBalance() {
return balances;
}
}
public static class SaveEvent extends BalanceForm.BalanceFormEvent {
SaveEvent(BalanceForm source, Balances balances) {
super(source, balances);
}
}
public static class DeleteEvent extends BalanceForm.BalanceFormEvent {
DeleteEvent(BalanceForm source, Balances a) {
super(source, a);
}
}
public static class CloseEvent extends BalanceForm.BalanceFormEvent {
CloseEvent(BalanceForm source) {
super(source, null);
}
}
public <T extends ComponentEvent<?>> Registration addListener(Class<T> eventType,
ComponentEventListener<T> listener) {
return getEventBus().addListener(eventType, listener);
}
}
| [
"a.savrova@g.nsu.ru"
] | a.savrova@g.nsu.ru |
d645bf9f52e5691e19f944b6608511854d4143a6 | f3daf582d5a3f6b762d42c6fe3b4fe5f3634d17a | /ITTLibs/VersionMonitorMsg/src/com/cats/version/msg/IMessageVersionCheckRsp.java | 1b2f1e1c6e3ff2312e732af27dfc2425cdc1e099 | [] | no_license | HisenLee/AppAutoTest | 57d39d4226553648ee1f57bea53f77c4491e5ab4 | ad88f8868bdba09e61d37f49629d31cba3648a7b | refs/heads/master | 2020-04-02T09:15:35.223367 | 2018-10-23T07:41:35 | 2018-10-23T07:41:35 | 154,284,317 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,938 | java | /*
* Copyright 2015 lixiaobo
*
* VersionUpgrade project 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 com.cats.version.msg;
import java.util.List;
import com.cats.version.VersionInfoDetail;
/**
* @author xblia2 Jun 10, 2015
*/
public class IMessageVersionCheckRsp extends IMessage
{
private static final long serialVersionUID = 3646409830480271901L;
private String softName;
private int currVersionCode;
private String currVersionName;
private int latestVersionCode;
private String latestVersionName;
private String needUpdate;
private List<VersionInfoDetail> versionInfoDetail;
private BroadcastMsg broadcastMsg;
public String getSoftName()
{
return softName;
}
public void setSoftName(String softName)
{
this.softName = softName;
}
public int getCurrVersionCode()
{
return currVersionCode;
}
public void setCurrVersionCode(int currVersionCode)
{
this.currVersionCode = currVersionCode;
}
public String getCurrVersionName()
{
return currVersionName;
}
public void setCurrVersionName(String currVersionName)
{
this.currVersionName = currVersionName;
}
public int getLatestVersionCode()
{
return latestVersionCode;
}
public void setLatestVersionCode(int latestVersionCode)
{
this.latestVersionCode = latestVersionCode;
}
public String getLatestVersionName()
{
return latestVersionName;
}
public void setLatestVersionName(String latestVersionName)
{
this.latestVersionName = latestVersionName;
}
public String getNeedUpdate()
{
return needUpdate;
}
public void setNeedUpdate(String needUpdate)
{
this.needUpdate = needUpdate;
}
public List<VersionInfoDetail> getVersionInfoDetail()
{
return versionInfoDetail;
}
public void setVersionInfoDetail(List<VersionInfoDetail> versionInfoDetail)
{
this.versionInfoDetail = versionInfoDetail;
}
public BroadcastMsg getBroadcastMsg()
{
return broadcastMsg;
}
public void setBroadcastMsg(BroadcastMsg broadcastMsg)
{
this.broadcastMsg = broadcastMsg;
}
@Override
public String toString()
{
return "IMessageVersionCheckRsp [softName=" + softName
+ ", currVersionCode=" + currVersionCode + ", currVersionName="
+ currVersionName + ", latestVersionCode=" + latestVersionCode
+ ", latestVersionName=" + latestVersionName + ", needUpdate="
+ needUpdate + ", versionInfoDetail=" + versionInfoDetail + "]";
}
}
| [
"Hisen.lee.iverson@gmail.com"
] | Hisen.lee.iverson@gmail.com |
0205932fda682a0949949614fe41bb4ce627ad69 | bcba70bc12b5576a02b78d2b3ddff191df4634f8 | /app/src/main/java/com/example/tabsactivity/ui/notifications/NotificationsFragment.java | a828f618b95e1ee7f72af34a207d243dee90ca8b | [] | no_license | BeaNielfa/TabsActivity | d32dab3f79ad671d4f90f466aec36f3b60159a1a | 10be0d389ebb7af1eb1e56553d09755ea04eeb88 | refs/heads/master | 2021-05-18T20:13:57.366500 | 2020-03-30T18:50:02 | 2020-03-30T18:50:02 | 251,398,851 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 809 | java | package com.example.tabsactivity.ui.notifications;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import com.example.tabsactivity.R;
public class NotificationsFragment extends Fragment {
private NotificationsViewModel notificationsViewModel;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_notifications, container, false);
return root;
}
} | [
"beanielfa1396@gmail.com"
] | beanielfa1396@gmail.com |
3b7ac88bc7c2126d4fdd921acaca357874da6324 | e51059dd16cc9f703a3b298c833ae5c9a74744a8 | /customerInfoManagement/src/test/java/com/ericcsson/customerInfo/CustomerInfoApplicationTests.java | 9b54f316d812c3d4c5414bdbc93660d52c1d553b | [] | no_license | Subzzy/subhayuRepository | 3200e843e024f2c8e128bdde91787251c700c182 | d5b813e2f8e0dab02d0a7bb9a5b156926dd48676 | refs/heads/master | 2020-11-27T00:25:04.861122 | 2019-12-22T10:18:50 | 2019-12-22T10:18:50 | 229,242,616 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 224 | java | package com.ericcsson.customerInfo;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class CustomerInfoApplicationTests {
@Test
void contextLoads() {
}
}
| [
"mukherjee.subhayu86@gmail.com"
] | mukherjee.subhayu86@gmail.com |
7a025562a907dfa7e601ea42c91050536b81874b | 2aa261d247550159d8cf0d94b85cf6d55b81a403 | /FireBaseIntro/app/src/androidTest/java/com/example/meterstoinches/firebaseintro/ExampleInstrumentedTest.java | 8e12595e9b135be184538a1c601ab83e8ae8a279 | [] | no_license | cheeenn/App_Design_CareSpot | 9ade1b0a5b5ff6e6a234234c020e4300aae6a99d | cf77e5dd623cc50cb1c6a60ef77b068b33419666 | refs/heads/master | 2020-04-30T12:55:36.437557 | 2019-03-24T21:24:34 | 2019-03-24T21:24:34 | 176,839,485 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 764 | java | package com.example.meterstoinches.firebaseintro;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.meterstoinches.firebaseintro", appContext.getPackageName());
}
}
| [
"36244856+cheeenn@users.noreply.github.com"
] | 36244856+cheeenn@users.noreply.github.com |
c1a3dfb7c7f334562adf4f20efdf64077add7fe4 | 5eae683a6df0c4b97ab1ebcd4724a4bf062c1889 | /bin/ext-content/cmsfacades/src/de/hybris/platform/cmsfacades/navigations/service/functions/DefaultNavigationEntryMediaModelConversionFunction.java | ce879dc6fe125499bb06c11872a192a83fb7039e | [] | no_license | sujanrimal/GiftCardProject | 1c5e8fe494e5c59cca58bbc76a755b1b0c0333bb | e0398eec9f4ec436d20764898a0255f32aac3d0c | refs/heads/master | 2020-12-11T18:05:17.413472 | 2020-01-17T18:23:44 | 2020-01-17T18:23:44 | 233,911,127 | 0 | 0 | null | 2020-06-18T15:26:11 | 2020-01-14T18:44:18 | null | UTF-8 | Java | false | false | 2,238 | java | /*
* [y] hybris Platform
*
* Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package de.hybris.platform.cmsfacades.navigations.service.functions;
import de.hybris.platform.cms2.servicelayer.services.admin.CMSAdminSiteService;
import de.hybris.platform.cmsfacades.data.NavigationEntryData;
import de.hybris.platform.core.model.media.MediaModel;
import de.hybris.platform.servicelayer.dto.converter.ConversionException;
import de.hybris.platform.servicelayer.exceptions.AmbiguousIdentifierException;
import de.hybris.platform.servicelayer.exceptions.UnknownIdentifierException;
import de.hybris.platform.servicelayer.media.MediaService;
import java.util.function.Function;
import org.springframework.beans.factory.annotation.Required;
/**
* Default implementation for conversion of {@link NavigationEntryData} into {@link MediaModel}.
* @deprecated since 1811 - no longer needed
*/
@Deprecated
public class DefaultNavigationEntryMediaModelConversionFunction implements Function<NavigationEntryData, MediaModel>
{
private MediaService mediaService;
private CMSAdminSiteService cmsAdminSiteService;
@Override
public MediaModel apply(final NavigationEntryData navigationEntryData)
{
try
{
return getMediaService().getMedia(getCmsAdminSiteService().getActiveCatalogVersion(), navigationEntryData.getItemId());
}
catch (AmbiguousIdentifierException | UnknownIdentifierException e)
{
throw new ConversionException("Invalid Media: " + navigationEntryData.getItemId(), e);
}
}
protected MediaService getMediaService()
{
return mediaService;
}
@Required
public void setMediaService(final MediaService mediaService)
{
this.mediaService = mediaService;
}
protected CMSAdminSiteService getCmsAdminSiteService()
{
return cmsAdminSiteService;
}
@Required
public void setCmsAdminSiteService(CMSAdminSiteService cmsAdminSiteService)
{
this.cmsAdminSiteService = cmsAdminSiteService;
}
}
| [
"travis.d.crawford@accenture.com"
] | travis.d.crawford@accenture.com |
080912e5c0dc62557d7b7dae5df644f7dc79f0ec | eb3ad750a23be626d4190eeb48d1047cb8e32c3e | /BWCategorizer/src/main/java/com/nvarghese/beowulf/scs/categorizers/SingleSetCategorizer.java | af6f23848bb21592c06f4066a1e366dc5f65ad4c | [] | no_license | 00mjk/beowulf-1 | 1ad29e79e2caee0c76a8b0bd5e15c24c22017d56 | d28d7dfd6b9080130540fc7427bfe7ad01209ade | refs/heads/master | 2021-05-26T23:07:39.561391 | 2013-01-23T03:09:44 | 2013-01-23T03:09:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,496 | java | package com.nvarghese.beowulf.scs.categorizers;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.code.morphia.Datastore;
import com.nvarghese.beowulf.common.scan.model.WebScanDocument;
import com.nvarghese.beowulf.common.webtest.WebTestType;
import com.nvarghese.beowulf.common.webtest.dao.TestModuleMetaDataDAO;
import com.nvarghese.beowulf.common.webtest.model.TestModuleMetaDataDocument;
import com.nvarghese.beowulf.scs.ScsManager;
/**
*
*
*/
public abstract class SingleSetCategorizer extends Categorizer {
protected WebTestType testType;
protected Set<Long> moduleNumbers;
static Logger logger = LoggerFactory.getLogger(SingleSetCategorizer.class);
public SingleSetCategorizer(Datastore ds, WebScanDocument webScanDocument, WebTestType testType) {
super(ds, webScanDocument);
this.testType = testType;
moduleNumbers = new HashSet<Long>();
}
@Override
public void initialize() {
TestModuleMetaDataDAO testModuleMetaDataDAO = new TestModuleMetaDataDAO(ScsManager.getInstance().getDataStore());
List<TestModuleMetaDataDocument> testModuleMetaDataDocs = testModuleMetaDataDAO.findByTestType(testType);
for (TestModuleMetaDataDocument metaDoc : testModuleMetaDataDocs) {
if (getEnabledTestModuleNumbers().contains(metaDoc.getModuleNumber())) {
moduleNumbers.add(metaDoc.getModuleNumber());
}
}
}
}
| [
"nibin012@gmail.com"
] | nibin012@gmail.com |
d839502fe1db6175311f30cf15e5695e05017ef9 | 513c1eb639ae80c0c3e9eb0a617cd1d00e2bc034 | /src/net/demilich/metastone/game/events/EnrageChangedEvent.java | 623843cee65207c351cd98e044db8cbda3942b69 | [
"MIT"
] | permissive | hillst/MetaStone | a21b63a1d2d02646ee3b6226261b4eb3304c175a | 5882d834d32028f5f083543f0700e59ccf1aa1fe | refs/heads/master | 2021-05-28T22:05:42.911637 | 2015-06-05T00:58:06 | 2015-06-05T00:58:06 | 36,316,023 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 528 | java | package net.demilich.metastone.game.events;
import net.demilich.metastone.game.GameContext;
import net.demilich.metastone.game.entities.Entity;
public class EnrageChangedEvent extends GameEvent {
private final Entity target;
public EnrageChangedEvent(GameContext context, Entity target) {
super(context);
this.target = target;
}
@Override
public Entity getEventTarget() {
return target;
}
@Override
public GameEventType getEventType() {
return GameEventType.ENRAGE_CHANGED;
}
}
| [
"hillst@onid.oregonstate.edu"
] | hillst@onid.oregonstate.edu |
1d375f3b66da6f7c276a5200ad37829fdf31f353 | ba44e8867d176d74a6ca0a681a4f454ca0b53cad | /component/entity/SAPMBOCreationWizard.java | 35e26f4a9770b288135758fb6bd2765f57a11cc3 | [] | no_license | eric2323223/FATPUS | 1879e2fa105c7e7683afd269965d8b59a7e40894 | 989d2cf49127d88fdf787da5ca6650e2abd5a00e | refs/heads/master | 2016-09-15T19:10:35.317021 | 2012-06-29T02:32:36 | 2012-06-29T02:32:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,511 | java | package component.entity;
import com.rational.test.ft.object.interfaces.GuiSubitemTestObject;
import com.rational.test.ft.script.RationalTestScript;
import com.sybase.automation.framework.widget.DOF;
import com.sybase.automation.framework.widget.helper.TreeHelper;
import component.dialog.EditDefaultValueDialog;
import component.dialog.SAPOperationSelectionDialog;
import component.entity.model.VerificationCriteria;
import component.wizard.page.LoadParameterPage;
import component.wizard.page.OperationParameterPage;
import component.wizard.page.ParameterPage;
public class SAPMBOCreationWizard extends ACW{
@Override
public void start(String string) {
DOF.getWNTree().click(RIGHT, atPath(WN.projectNameWithVersion(string)));
DOF.getContextMenu().click(atPath("New->Mobile Business Object"));
}
public void setBapiOperation(String str){
SAPOperationSelectionDialog.setBapiOperation(str, dialog());
}
public void verifyParameterDefaultValue(VerificationCriteria vc){
GuiSubitemTestObject tree = DOF.getTree(DOF.getDualHeadersTree(dialog()));
String parameter = vc.getExpected().split(",")[0];
String expected = vc.getExpected().split(",")[1];
String value = TreeHelper.getCellValue(tree, parameter, "Default Value");
if(expected.equals(value) && vc.isContinueWhenMatch()){
this.canContinue = true;
logInfo("VP passed");
}else{
this.canContinue = false;
if(!expected.equals(value)){
logError("VP Fails. Expected=["+expected+"] Actual=["+value+"]");
}
}
}
public void setActivateVerify(String str){
//do nothing, just a trigger.
}
public int getPageIndexOfOperation(String operation){
if(operation.equals("setName"))
return 0;
if(operation.equals("setConnectionProfile"))
return 1;
if(operation.equals("setDataSourceType"))
return 1;
if(operation.equals("setAttribute"))
return 2;
if(operation.equals("setOperation"))
return 2;
if(operation.equals("setBapiOperation"))
return 2;
if(operation.equals("setParameter"))
return 2;
if(operation.equals("setActivateVerify"))
return 3;
if(operation.equals("setParameterValue"))
return 3;
else
throw new RuntimeException("Unknown operation name: "+operation);
}
@Override
public String getDependOperation(String operation) {
if(operation.equals("setActivateVerify")){
return "verifyParameterDefaultValue";
}
return null;
}
public void setOperation(String str){
SAPOperationSelectionDialog.setOperation(str, dialog());
}
public void setAttribute(String str){
super.setAttribute(str);
}
public void setParameter(String str){
SAPOperationSelectionDialog.setParameter(str, dialog());
}
public void setParameterValue(String str) {
// OperationParameterPage.setParameterDefaultValue(str, dialog());
for(String entry:str.split(":")){
LoadParameterPage.setParameterDefaultValue(entry, dialog());
}
}
@Override
public void setConnectionProfile(String string) {
super.setConnectionProfile(string);
}
@Override
public void setDataSourceType(String string) {
super.setDataSourceType(string);
}
@Override
public void setName(String string) {
super.setName(string);
}
public void finish(){
RationalTestScript.sleep(1);
DOF.getButton(dialog(), "&Finish").click();
LongOperationMonitor.waitForProgressBarVanish(dialog());
LongOperationMonitor.waitForDialogToVanish("Progress Information");
while(true){
if(dialog()!=null){
sleep(1);
}else{
break;
}
}
MainMenu.saveAll();
}
}
| [
"eric2323223@gmail.com"
] | eric2323223@gmail.com |
0f21a92d97a7d6e808a88234a26b250644da47e1 | 70a051499d8fdc45208bf6c983294f54a202eea6 | /src/main/java/com/griefdefender/api/event/FlagPermissionEvent.java | 9a85afaff305eda0541bf41e418366c18a4aa562 | [
"MIT"
] | permissive | andrepl/GriefDefenderAPI | 3af92c7d8377968f0887a6a8eed185e87995aac3 | 2663329cb51dea48773aa2afd71e4d8732eec72d | refs/heads/master | 2020-09-14T06:37:53.401571 | 2019-09-06T16:29:06 | 2019-09-06T16:29:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,633 | java | /*
* This file is part of GriefDefenderAPI, licensed under the MIT License (MIT).
*
* Copyright (c) bloodmc
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.griefdefender.api.event;
import com.griefdefender.api.Tristate;
import com.griefdefender.api.permission.flag.Flag;
public interface FlagPermissionEvent extends PermissionEvent {
interface ClearAll extends FlagPermissionEvent { }
interface Clear extends FlagPermissionEvent { }
interface Set extends FlagPermissionEvent {
Flag getFlag();
Tristate getValue();
}
}
| [
"jdroque@gmail.com"
] | jdroque@gmail.com |
3cddf610bb84efd6938eeb0482b005e29bbb008b | 36b51e61e73eb7e924154be0be5243af3f42857c | /com.francetelecom.tr69client.datamodel/src/com/francetelecom/tr157/gen/TemperatureStatus.java | 1d8e95d89bd4a5776af2138b24e272be278c00c7 | [] | no_license | Treesith/ClientTR69 | 67e7043780d34417aceb3c262f9aaf1ff8702066 | 0eb33bc8f5681742c767b47fb85550c26a0ce59a | refs/heads/master | 2020-12-25T05:07:14.736397 | 2014-07-12T06:30:29 | 2014-07-12T06:30:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,416 | java | /*--------------------------------------------------------
* Product Name : modus TR-069
* Version : 1.1
* Module Name : DataModelBundle
*
* Copyright © 2011 France Telecom
*
* This software is distributed 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 or see the "license.txt" file for
* more details
*
* 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.
*
* Author : Orange Labs R&D O.Beyler
* Generated : 21 oct. 2009 by GenModel
*/
package com.francetelecom.tr157.gen;
import com.francetelecom.admindm.model.*;
import com.francetelecom.admindm.api.StorageMode;
import com.francetelecom.admindm.soap.Fault;
/**
* Class TemperatureStatus.
* @author OrangeLabs R&D
*/
public class TemperatureStatus {
/** The data. */
private final IParameterData data;
/** The base path. */
private final String basePath;
/**
* Default constructor.
* @param pData data model
* @param pBasePath base path of attribute
* @param pPersist persistence
*/
public TemperatureStatus(
final IParameterData pData,
final String pBasePath) {
super();
this.data = pData;
this.basePath = pBasePath;
}
/**
* Get the data.
* @return the data
*/
public final IParameterData getData() {
return data;
}
/**
* Get the basePath.
* @return the basePath
*/
public final String getBasePath() {
return basePath;
}
/**
* Initialiser.
*/
public void initialize() throws Fault {
com.francetelecom.admindm.model.Parameter param;
param = data.createOrRetrieveParameter(basePath);
param.setType(ParameterType.ANY);
paramTemperatureSensor = createTemperatureSensor();
paramTemperatureSensorNumberOfEntries = createTemperatureSensorNumberOfEntries();
}
/**
*
*/
private com.francetelecom.admindm.model.Parameter paramTemperatureSensor;
/**
* Getter method of TemperatureSensor.
* @return _TemperatureSensor
*/
public final com.francetelecom.admindm.model.Parameter
getParamTemperatureSensor() {
return paramTemperatureSensor;
}
/**
* Create the parameter TemperatureSensor
* @return TemperatureSensor
* @throws Fault exception
*/
public final com.francetelecom.admindm.model.Parameter
createTemperatureSensor() throws Fault {
com.francetelecom.admindm.model.Parameter param;
param = data.createOrRetrieveParameter(basePath + "TemperatureSensor");
param.setNotification(0);
param.setStorageMode(StorageMode.DM_ONLY);
param.setType(ParameterType.ANY);
param.setWritable(false);
return param;
}
/**
*
*/
private com.francetelecom.admindm.model.Parameter paramTemperatureSensorNumberOfEntries;
/**
* Getter method of TemperatureSensorNumberOfEntries.
* @return _TemperatureSensorNumberOfEntries
*/
public final com.francetelecom.admindm.model.Parameter
getParamTemperatureSensorNumberOfEntries() {
return paramTemperatureSensorNumberOfEntries;
}
/**
* Create the parameter TemperatureSensorNumberOfEntries
* @return TemperatureSensorNumberOfEntries
* @throws Fault exception
*/
public final com.francetelecom.admindm.model.Parameter
createTemperatureSensorNumberOfEntries() throws Fault {
com.francetelecom.admindm.model.Parameter param;
param = data.createOrRetrieveParameter(basePath + "TemperatureSensorNumberOfEntries");
param.setNotification(0);
param.setStorageMode(StorageMode.DM_ONLY);
param.setType(ParameterType.UINT);
param.addCheck(new CheckMinimum(0));
param.addCheck(new CheckMaximum(4294967295L));
param.setValue(new Long(0));
param.setWritable(false);
return param;
}
} | [
"obeyler@e6fce60f-1bb4-4b06-9e73-886240b3b755"
] | obeyler@e6fce60f-1bb4-4b06-9e73-886240b3b755 |
c88229531b79121984164eee2d9141238cc25b9f | 8391988a971f8d33b46c9aaa44aff45c51c8ac83 | /src/main/java/Person.java | e8b103b46fcdf650cac3ec27e6597618ea05f5e6 | [] | no_license | Han-Lin-zc/Lambdas2-ZCW | a36f0fbef46835f31aeb023304f028b7c5777b1c | 863bb27c551c501a8610fecba9557cb1fa2bd147 | refs/heads/master | 2021-04-14T01:33:20.717614 | 2020-03-22T16:26:59 | 2020-03-22T16:26:59 | 249,200,364 | 0 | 0 | null | 2020-03-22T14:26:15 | 2020-03-22T14:26:14 | null | UTF-8 | Java | false | false | 1,285 | java | import java.time.LocalDate;
import java.time.Period;
public class Person implements CheckPerson{
public enum Sex {
MALE, FEMALE
}
String name;
LocalDate birthday;
Sex gender;
String emailAddress;
public Person() {}
public Person(String name, LocalDate birthday, Sex gender, String emailAddress) {
this.name = name;
this.birthday = birthday;
this.gender = gender;
this.emailAddress = emailAddress;
}
public int getAge() {
return Period.between(birthday, LocalDate.now()).getYears();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public LocalDate getBirthday() {
return birthday;
}
public void setBirthday(LocalDate birthday) {
this.birthday = birthday;
}
public Sex getGender() {
return gender;
}
public String getEmailAddress() {
return emailAddress;
}
public void setEmailAddress(String emailAddress) {
this.emailAddress = emailAddress;
}
public void printPerson() {
System.out.println("Person: " + name);
}
@Override
public boolean test(Person p) {
return p.getAge() > 20;
}
} | [
"Zxsaqw12@&$"
] | Zxsaqw12@&$ |
5750ecd6419f33458ec7dd40514de0d7c6037a5d | c148cc8c215dc089bd346b0e4c8e21a2b8665d86 | /google-ads/src/main/java/com/google/ads/googleads/v0/services/CustomerManagerLinkServiceSettings.java | 22703d313a7731893b1a28aa9b87323535dfcd6e | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | permissive | duperran/google-ads-java | 39ae44927d64ceead633b2f3a47407f4e9ef0814 | da810ba8e1b5328a4b9b510eb582dc692a071408 | refs/heads/master | 2020-04-07T13:57:37.899838 | 2018-11-16T16:37:48 | 2018-11-16T16:37:48 | 158,428,852 | 0 | 0 | Apache-2.0 | 2018-11-20T17:42:50 | 2018-11-20T17:42:50 | null | UTF-8 | Java | false | false | 7,447 | java | /*
* Copyright 2018 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.ads.googleads.v0.services;
import com.google.ads.googleads.v0.resources.CustomerManagerLink;
import com.google.ads.googleads.v0.services.stub.CustomerManagerLinkServiceStubSettings;
import com.google.api.core.ApiFunction;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.GoogleCredentialsProvider;
import com.google.api.gax.core.InstantiatingExecutorProvider;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.ClientSettings;
import com.google.api.gax.rpc.TransportChannelProvider;
import com.google.api.gax.rpc.UnaryCallSettings;
import java.io.IOException;
import java.util.List;
import javax.annotation.Generated;
// AUTO-GENERATED DOCUMENTATION AND CLASS
/**
* Settings class to configure an instance of {@link CustomerManagerLinkServiceClient}.
*
* <p>The default instance has everything set to sensible defaults:
*
* <ul>
* <li>The default service address (googleads.googleapis.com) and default port (443) are used.
* <li>Credentials are acquired automatically through Application Default Credentials.
* <li>Retries are configured for idempotent methods but not for non-idempotent methods.
* </ul>
*
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
* build() is called, the tree of builders is called to create the complete settings object. For
* example, to set the total timeout of getCustomerManagerLink to 30 seconds:
*
* <pre>
* <code>
* CustomerManagerLinkServiceSettings.Builder customerManagerLinkServiceSettingsBuilder =
* CustomerManagerLinkServiceSettings.newBuilder();
* customerManagerLinkServiceSettingsBuilder.getCustomerManagerLinkSettings().getRetrySettings().toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30));
* CustomerManagerLinkServiceSettings customerManagerLinkServiceSettings = customerManagerLinkServiceSettingsBuilder.build();
* </code>
* </pre>
*/
@Generated("by gapic-generator")
@BetaApi
public class CustomerManagerLinkServiceSettings
extends ClientSettings<CustomerManagerLinkServiceSettings> {
/** Returns the object with the settings used for calls to getCustomerManagerLink. */
public UnaryCallSettings<GetCustomerManagerLinkRequest, CustomerManagerLink>
getCustomerManagerLinkSettings() {
return ((CustomerManagerLinkServiceStubSettings) getStubSettings())
.getCustomerManagerLinkSettings();
}
public static final CustomerManagerLinkServiceSettings create(
CustomerManagerLinkServiceStubSettings stub) throws IOException {
return new CustomerManagerLinkServiceSettings.Builder(stub.toBuilder()).build();
}
/** Returns a builder for the default ExecutorProvider for this service. */
public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
return CustomerManagerLinkServiceStubSettings.defaultExecutorProviderBuilder();
}
/** Returns the default service endpoint. */
public static String getDefaultEndpoint() {
return CustomerManagerLinkServiceStubSettings.getDefaultEndpoint();
}
/** Returns the default service scopes. */
public static List<String> getDefaultServiceScopes() {
return CustomerManagerLinkServiceStubSettings.getDefaultServiceScopes();
}
/** Returns a builder for the default credentials for this service. */
public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
return CustomerManagerLinkServiceStubSettings.defaultCredentialsProviderBuilder();
}
/** Returns a builder for the default ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return CustomerManagerLinkServiceStubSettings.defaultGrpcTransportProviderBuilder();
}
public static TransportChannelProvider defaultTransportChannelProvider() {
return CustomerManagerLinkServiceStubSettings.defaultTransportChannelProvider();
}
@BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
return CustomerManagerLinkServiceStubSettings.defaultApiClientHeaderProviderBuilder();
}
/** Returns a new builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}
/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
}
/** Returns a builder containing all the values of this settings class. */
public Builder toBuilder() {
return new Builder(this);
}
protected CustomerManagerLinkServiceSettings(Builder settingsBuilder) throws IOException {
super(settingsBuilder);
}
/** Builder for CustomerManagerLinkServiceSettings. */
public static class Builder
extends ClientSettings.Builder<CustomerManagerLinkServiceSettings, Builder> {
protected Builder() throws IOException {
this((ClientContext) null);
}
protected Builder(ClientContext clientContext) {
super(CustomerManagerLinkServiceStubSettings.newBuilder(clientContext));
}
private static Builder createDefault() {
return new Builder(CustomerManagerLinkServiceStubSettings.newBuilder());
}
protected Builder(CustomerManagerLinkServiceSettings settings) {
super(settings.getStubSettings().toBuilder());
}
protected Builder(CustomerManagerLinkServiceStubSettings.Builder stubSettings) {
super(stubSettings);
}
public CustomerManagerLinkServiceStubSettings.Builder getStubSettingsBuilder() {
return ((CustomerManagerLinkServiceStubSettings.Builder) getStubSettings());
}
// NEXT_MAJOR_VER: remove 'throws Exception'
/**
* Applies the given settings updater function to all of the unary API methods in this service.
*
* <p>Note: This method does not support applying settings to streaming methods.
*/
public Builder applyToAllUnaryMethods(
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) throws Exception {
super.applyToAllUnaryMethods(
getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
return this;
}
/** Returns the builder for the settings used for calls to getCustomerManagerLink. */
public UnaryCallSettings.Builder<GetCustomerManagerLinkRequest, CustomerManagerLink>
getCustomerManagerLinkSettings() {
return getStubSettingsBuilder().getCustomerManagerLinkSettings();
}
@Override
public CustomerManagerLinkServiceSettings build() throws IOException {
return new CustomerManagerLinkServiceSettings(this);
}
}
}
| [
"nbirnie@google.com"
] | nbirnie@google.com |
caac611b26095173247fb8adcb06b8f5028b2b70 | 2bf16cf31f11ded80a777a59c8773106e4f38997 | /src/main/java/aiss/SoundCloud/Apps.java | 1fc363e9fa6e69406c753f00263b1514c01ba203 | [] | no_license | achaghirc/WikiFilmProject | 1f0bf18c5d2799226e8d6fceeb4eb8c9a32d8c33 | 2a4f8c17765f650060025cbf85246062698becbc | refs/heads/master | 2020-05-17T01:15:51.459210 | 2019-04-25T11:49:08 | 2019-04-25T11:49:08 | 183,421,271 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,835 | java |
package aiss.SoundCloud;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"id",
"kind",
"name",
"uri",
"permalink_url",
"external_url",
"creator"
})
public class Apps {
@JsonProperty("id")
private Integer id;
@JsonProperty("kind")
private String kind;
@JsonProperty("name")
private String name;
@JsonProperty("uri")
private String uri;
@JsonProperty("permalink_url")
private String permalinkUrl;
@JsonProperty("external_url")
private String externalUrl;
@JsonProperty("creator")
private String creator;
@JsonIgnore
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
/**
* No args constructor for use in serialization
*
*/
public Apps() {
}
/**
*
* @param id
* @param permalinkUrl
* @param name
* @param externalUrl
* @param uri
* @param kind
* @param creator
*/
public Apps(Integer id, String kind, String name, String uri, String permalinkUrl, String externalUrl, String creator) {
super();
this.id = id;
this.kind = kind;
this.name = name;
this.uri = uri;
this.permalinkUrl = permalinkUrl;
this.externalUrl = externalUrl;
this.creator = creator;
}
@JsonProperty("id")
public Integer getId() {
return id;
}
@JsonProperty("id")
public void setId(Integer id) {
this.id = id;
}
@JsonProperty("kind")
public String getKind() {
return kind;
}
@JsonProperty("kind")
public void setKind(String kind) {
this.kind = kind;
}
@JsonProperty("name")
public String getName() {
return name;
}
@JsonProperty("name")
public void setName(String name) {
this.name = name;
}
@JsonProperty("uri")
public String getUri() {
return uri;
}
@JsonProperty("uri")
public void setUri(String uri) {
this.uri = uri;
}
@JsonProperty("permalink_url")
public String getPermalinkUrl() {
return permalinkUrl;
}
@JsonProperty("permalink_url")
public void setPermalinkUrl(String permalinkUrl) {
this.permalinkUrl = permalinkUrl;
}
@JsonProperty("external_url")
public String getExternalUrl() {
return externalUrl;
}
@JsonProperty("external_url")
public void setExternalUrl(String externalUrl) {
this.externalUrl = externalUrl;
}
@JsonProperty("creator")
public String getCreator() {
return creator;
}
@JsonProperty("creator")
public void setCreator(String creator) {
this.creator = creator;
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
@JsonAnySetter
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}
}
| [
"amine-10@hotmail.es"
] | amine-10@hotmail.es |
1807dfa1ada3ca71f90ac67047d2ed7f6dbd5f6a | 1fe5a4406ae1687f609dfa508e29844901ee766b | /src/controller/ClientFrame.java | d59eb90c7e1ed528bd15c1a0648c626d2cf09c38 | [] | no_license | dokaka1997/chat_system | 43a5e441cbf47e6b87f23ac6ca8a7fcfd1cfb461 | dfed0f13b97c0f2224e5d958519fee5fdee46fba | refs/heads/master | 2023-06-15T14:38:34.571763 | 2021-07-15T15:24:25 | 2021-07-15T15:24:25 | 386,336,388 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 33,980 | 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 controller;
import view.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.*;
import java.net.Socket;
import java.util.Hashtable;
import java.util.StringTokenizer;
import java.util.logging.Level;
import java.util.logging.Logger;
//CHÚ Ý: do chat = đồ họa nên ko cần vòng lặp while nữa
//nếu chat trên console thì phải dùng while để chờ server (hoặc client) gửi tin sau đó client hiển thị (hoặc server gửi lại)
//bây giờ client gửi tin tới server sau khi ấn nút send, do đó ko cần while nữa
public class ClientFrame extends JFrame implements Runnable {
String serverHost;
public static final String NICKNAME_EXIST = "This nickname is already login in another place! Please using another nickname";
public static final String NICKNAME_INVALID = "Nickname or password is incorrect";
public static final String ACCOUNT_EXIST = "This nickname has been used! Please use another nickname!";
String name;
String room;
Socket socketOfClient;
BufferedWriter bw;
BufferedReader br;
JPanel mainPanel;
LoginPanel loginPanel;
ClientPanel clientPanel;
WelcomePanel welcomePanel;
SignUpPanel signUpPanel;
RoomPanel roomPanel;
Thread clientThread;
boolean isRunning;
JMenuBar menuBar;
JMenu menuShareFile;
JMenuItem itemSendFile;
JMenu menuAccount;
JMenuItem itemLeaveRoom, itemLogout, itemChangePass;
StringTokenizer tokenizer;
DefaultListModel<String> listModel, listModelThisRoom, listModel_rp;
boolean isConnectToServer;
int timeClicked = 0; ///biến này để kiểm tra xem người dùng vừa click hay vừa double-click vào jList.
//Thuật toán kiểm tra rất đơn giản: khi click thì tăng biến này lên 1 và đếm 500ms, nếu trong 500ms đó
//người dùng click tiếp thì đó là double-click, nếu ko thì chỉ là click
Hashtable<String, PrivateChat> listReceiver;
public ClientFrame(String name) {
this.name = name;
socketOfClient = null;
bw = null;
br = null;
isRunning = true;
listModel = new DefaultListModel<>();
listModelThisRoom = new DefaultListModel<>();
listModel_rp = new DefaultListModel<>();
isConnectToServer = false;
listReceiver = new Hashtable<>();
mainPanel = new JPanel();
loginPanel = new LoginPanel();
clientPanel = new ClientPanel();
welcomePanel = new WelcomePanel();
signUpPanel = new SignUpPanel();
roomPanel = new RoomPanel();
welcomePanel.setVisible(true);
signUpPanel.setVisible(false);
loginPanel.setVisible(false);
roomPanel.setVisible(false);
clientPanel.setVisible(false);
mainPanel.add(welcomePanel);
mainPanel.add(signUpPanel);
mainPanel.add(loginPanel);
mainPanel.add(roomPanel);
mainPanel.add(clientPanel);
addEventsForWelcomePanel();
addEventsForSignUpPanel();
addEventsForLoginPanel();
addEventsForClientPanel();
addEventsForRoomPanel();
menuBar = new JMenuBar(); //menuBar
menuShareFile = new JMenu(); //menu, cái này là item của menuBar
menuAccount = new JMenu();
itemLeaveRoom = new JMenuItem();
itemLogout = new JMenuItem();
itemChangePass = new JMenuItem();
itemSendFile = new JMenuItem(); //menuItem: cái này là item của menu
menuAccount.setText("Account");
itemLogout.setText("Logout");
itemLeaveRoom.setText("Leave room");
itemChangePass.setText("Change password");
menuAccount.add(itemLeaveRoom);
menuAccount.add(itemChangePass);
menuAccount.add(itemLogout);
itemSendFile.setText("Send a file");
menuShareFile.add(itemSendFile);
menuBar.add(menuAccount);
itemLeaveRoom.addActionListener(ae -> { // bạn có muốn thoát khỏi room k
int kq = JOptionPane.showConfirmDialog(ClientFrame.this, "Are you sure to leave this room?", "Notice", JOptionPane.YES_NO_OPTION);
if (kq == JOptionPane.YES_OPTION) {
leaveRoom();
}
});
itemChangePass.addActionListener(ae -> {
});
itemLogout.addActionListener(ae -> { // logout, bạn có muốn đăng xuất k
int kq = JOptionPane.showConfirmDialog(ClientFrame.this, "Are you sure to logout?", "Notice", JOptionPane.YES_NO_OPTION);
if (kq == JOptionPane.YES_OPTION) {
try {
isConnectToServer = false;
socketOfClient.close();
ClientFrame.this.setVisible(false);
} catch (IOException ex) {
Logger.getLogger(ClientFrame.class.getName()).log(Level.SEVERE, null, ex);
}
new ClientFrame(null).setVisible(true);
}
});
itemSendFile.addActionListener(ae -> { // thông báo chát riêng mới gửi file dc.
JOptionPane.showMessageDialog(ClientFrame.this, "This function has changed! Go to private chat to send a file", "Info", JOptionPane.INFORMATION_MESSAGE);
});
menuBar.setVisible(false);
setJMenuBar(menuBar);
pack();
add(mainPanel);
setSize(570, 520);
setLocation(400, 100);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setTitle(name);
}
private void addEventsForWelcomePanel() { // giao diện welcome cả signup và login
welcomePanel.getBtLogin_welcome().addActionListener(ae -> {
welcomePanel.setVisible(false);
signUpPanel.setVisible(false);
loginPanel.setVisible(true);
clientPanel.setVisible(false);
roomPanel.setVisible(false);
});
welcomePanel.getBtSignUp_welcome().addActionListener(ae -> {
welcomePanel.setVisible(false);
signUpPanel.setVisible(true);
loginPanel.setVisible(false);
clientPanel.setVisible(false);
roomPanel.setVisible(false);
});
}
private void addEventsForSignUpPanel() { // giao diện signup
signUpPanel.getLbBack_signup().addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent me) {
welcomePanel.setVisible(true);
signUpPanel.setVisible(false);
loginPanel.setVisible(false);
clientPanel.setVisible(false);
roomPanel.setVisible(false);
}
});
signUpPanel.getBtSignUp().addActionListener(ae -> btSignUpEvent());
}
private void addEventsForLoginPanel() { // giao diện login
loginPanel.getTfNickname().addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent ke) {
if (ke.getKeyCode() == KeyEvent.VK_ENTER) btOkEvent();
}
});
loginPanel.getTfPass().addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent ke) {
if (ke.getKeyCode() == KeyEvent.VK_ENTER) btOkEvent();
}
});
loginPanel.getBtOK().addActionListener(ae -> btOkEvent());
loginPanel.getLbBack_login().addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent me) {
welcomePanel.setVisible(true);
signUpPanel.setVisible(false);
loginPanel.setVisible(false);
clientPanel.setVisible(false);
roomPanel.setVisible(false);
}
});
}
private void addEventsForClientPanel() { // có tạo ra 2 buton send và exit
clientPanel.getBtSend().addActionListener(ae -> btSendEvent());
clientPanel.getBtExit().addActionListener(ae -> btExitEvent());
clientPanel.getTaInput().addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent ke) {
if (ke.getKeyCode() == KeyEvent.VK_ENTER) {
btSendEvent();
btClearEvent();
}
}
});
//events for emotion icons:
clientPanel.getLbLike().addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent me) {
sendToServer("CMD_ICON|LIKE");
}
});
clientPanel.getLbDislike().addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent me) {
sendToServer("CMD_ICON|DISLIKE");
}
});
clientPanel.getLbPacMan().addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent me) {
sendToServer("CMD_ICON|PAC_MAN");
}
});
clientPanel.getLbCry().addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent me) {
sendToServer("CMD_ICON|CRY");
}
});
clientPanel.getLbGrin().addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent me) {
sendToServer("CMD_ICON|GRIN");
}
});
clientPanel.getLbSmile().addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent me) {
sendToServer("CMD_ICON|SMILE");
}
});
clientPanel.getOnlineList().addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent me) {
openPrivateChatInsideRoom();
}
});
}
// các room trong giao diện
private void addEventsForRoomPanel() {
roomPanel.getLbRoom1().addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent me) {
ClientFrame.this.room = roomPanel.getLbRoom1().getText();
labelRoomEvent();
}
});
roomPanel.getLbRoom2().addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent me) {
ClientFrame.this.room = roomPanel.getLbRoom2().getText();
labelRoomEvent();
}
});
roomPanel.getLbRoom3().addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent me) {
ClientFrame.this.room = roomPanel.getLbRoom3().getText();
labelRoomEvent();
}
});
roomPanel.getLbRoom4().addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent me) {
ClientFrame.this.room = roomPanel.getLbRoom4().getText();
labelRoomEvent();
}
});
roomPanel.getLbRoom5().addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent me) {
ClientFrame.this.room = roomPanel.getLbRoom5().getText();
labelRoomEvent();
}
});
roomPanel.getLbRoom6().addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent me) {
ClientFrame.this.room = roomPanel.getLbRoom6().getText();
labelRoomEvent();
}
});
roomPanel.getLbRoom7().addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent me) {
ClientFrame.this.room = roomPanel.getLbRoom7().getText();
labelRoomEvent();
}
});
roomPanel.getLbRoom8().addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent me) {
ClientFrame.this.room = roomPanel.getLbRoom8().getText();
labelRoomEvent();
}
});
roomPanel.getOnlineList_rp().addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent me) {
openPrivateChatOutsideRoom();
}
});
}
// mở phần chát privatechat
private void openPrivateChatInsideRoom() {
timeClicked++;
if (timeClicked == 1) {
Thread countingTo500ms = new Thread(counting);
countingTo500ms.start();
}
if (timeClicked == 2) { //nếu như countingTo500ms chưa thực hiện xong, tức là timeClicked vẫn = 2:
String nameClicked = clientPanel.getOnlineList().getSelectedValue();
if (nameClicked.equals(ClientFrame.this.name)) {
JOptionPane.showMessageDialog(ClientFrame.this, "Can't send a message to yourself!", "Info", JOptionPane.INFORMATION_MESSAGE);
return;
}
if (!listReceiver.containsKey(nameClicked)) { //nếu đây là lần đầu tiên nhắn tin với người mà ta vừa double-click vào
PrivateChat pc = new PrivateChat(name, nameClicked, serverHost, bw, br);
pc.getLbReceiver().setText("Private chat with \"" + pc.receiver + "\""); // chat riêng
pc.setTitle(pc.receiver);
pc.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
pc.setVisible(true);
listReceiver.put(nameClicked, pc);
} else {
PrivateChat pc = listReceiver.get(nameClicked);
pc.setVisible(true);
}
}
}
private void openPrivateChatOutsideRoom() {
timeClicked++;
if (timeClicked == 1) {
Thread countingTo500ms = new Thread(counting);
countingTo500ms.start();
}
if (timeClicked == 2) { //nếu như countingTo500ms chưa thực hiện xong, tức là timeClicked vẫn = 2:
String privateReceiver = roomPanel.getOnlineList_rp().getSelectedValue();
PrivateChat pc = listReceiver.get(privateReceiver);
if (pc == null) { //nếu đây là lần đầu tiên nhắn tin với người mà ta vừa double-click vào
pc = new PrivateChat(name, privateReceiver, serverHost, bw, br);
pc.getLbReceiver().setText("Private chat with \"" + pc.receiver + "\"");
pc.setTitle(pc.receiver);
pc.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
pc.setVisible(true);
listReceiver.put(privateReceiver, pc);
} else {
pc.setVisible(true);
}
}
}
Runnable counting = () -> {
try {
Thread.sleep(500);
} catch (InterruptedException ex) {
Logger.getLogger(ClientFrame.class.getName()).log(Level.SEVERE, null, ex);
}
timeClicked = 0;
};
private void labelRoomEvent() {
this.clientPanel.getTpMessage().setText("");
this.sendToServer("CMD_ROOM|" + this.room);
try {
Thread.sleep(200); //chờ
} catch (InterruptedException ex) {
Logger.getLogger(ClientFrame.class.getName()).log(Level.SEVERE, null, ex);
}
this.roomPanel.setVisible(false);
this.clientPanel.setVisible(true);
this.setTitle("\"" + this.name + "\" - " + this.room);
clientPanel.getLbRoom().setText(this.room);
}
private void leaveRoom() {
this.sendToServer("CMD_LEAVE_ROOM|" + this.room);
try {
Thread.sleep(200); //chờ tý cho nó đỡ lỗi!
} catch (InterruptedException ex) {
Logger.getLogger(ClientFrame.class.getName()).log(Level.SEVERE, null, ex);
}
this.roomPanel.setVisible(true);
this.clientPanel.setVisible(false);
//clear the textPane message:
clientPanel.getTpMessage().setText("");
this.setTitle("\"" + this.name + "\"");
}
////////////////////////Events////////////////////////////
private void btOkEvent() {
String hostname = loginPanel.getTfHost().getText().trim();
String nickname = loginPanel.getTfNickname().getText().trim();
String pass = loginPanel.getTfPass().getText().trim();
this.serverHost = hostname;
this.name = nickname;
if (hostname.equals("") || nickname.equals("") || pass.equals("")) {
JOptionPane.showMessageDialog(this, "Please fill up all fields", "Notice!", JOptionPane.WARNING_MESSAGE);
return;
}
if (!isConnectToServer) {
isConnectToServer = true; //nghĩa là khi chạy file ClientFrame.java này thì chỉ connect tới server duy nhất 1 lần thôi,
//sau đó ko phải connect nữa vì đã có kết nối tới server rồi. Nếu cứ connect nhiều lần (do nhập sai account)
//thì sẽ tạo ra nhiều socket kết nối tới server mỗi lần bấm OK, sau đó socket tự ý close dẫn tới việc lỗi!
this.connectToServer(hostname); //tạo 1 socket kết nối tói server
}
this.sendToServer("CMD_CHECK_NAME|" + this.name + "|" + pass); //sau đó gửi tên đến để yêu cầu đăng nhập = tên đó
//server phản hồi rằng tên vừa nhập có hợp lệ hay ko:
String response = this.recieveFromServer();
if (response != null) {
if (response.equals(NICKNAME_EXIST) || response.equals(NICKNAME_INVALID)) {
JOptionPane.showMessageDialog(this, response, "Error", JOptionPane.ERROR_MESSAGE);
//loginPanel.getBtOK().setText("OK");
} else {
//Tên hợp lệ, vào chon phòng chat:
loginPanel.setVisible(false);
roomPanel.setVisible(true);
clientPanel.setVisible(false);
this.setTitle("\"" + name + "\"");
menuBar.setVisible(true);
//1 thread của client đc tạo ra để giao tiếp với server, chú ý rằng nhiệm vụ của thread này chỉ chờ server gửi tin tới
//và in kq lên textarea, còn việc gửi tin tới server dùng sự kiện của btSend
clientThread = new Thread(this);
clientThread.start();
this.sendToServer("CMD_ROOM|" + this.room); //yêu cầu ds các user đang online để có thể chat private
System.out.println("this is \"" + name + "\"");
}
} else System.out.println("[btOkEvent()] Server is not open yet, or already closed!");
}
private void btSignUpEvent() {
String pass = this.signUpPanel.getTfPass().getText();
String pass2 = this.signUpPanel.getTfPass2().getText();
if (!pass.equals(pass2)) {
JOptionPane.showMessageDialog(this, "Passwords don't match", "Error", JOptionPane.ERROR_MESSAGE);
} else {
String nickname = signUpPanel.getTfID().getText().trim();
String hostName = signUpPanel.getTfHost().getText().trim();
if (hostName.equals("") || nickname.equals("") || pass.equals("") || pass2.equals("")) {
JOptionPane.showMessageDialog(this, "Please fill up all fields", "Notice!", JOptionPane.WARNING_MESSAGE);
return;
}
if (!isConnectToServer) {
isConnectToServer = true; //nghĩa là khi chạy file ClientFrame.java này thì chỉ connect tới server duy nhất 1 lần thôi,
//sau đó ko phải connect nữa vì đã có kết nối tới server rồi. Nếu cứ connect nhiều lần (do nhập sai account)
//thì sẽ tạo ra nhiều socket kết nối tới server mỗi lần bấm OK, sau đó socket tự ý close dẫn tới việc lỗi!
this.connectToServer(hostName); //tạo 1 socket kết nối tói server
}
this.sendToServer("CMD_SIGN_UP|" + nickname + "|" + pass); //sau đó gửi tên đến để yêu cầu đăng nhập = tên đó
String response = this.recieveFromServer();
if (response != null) {
if (response.equals(NICKNAME_EXIST) || response.equals(ACCOUNT_EXIST)) {
JOptionPane.showMessageDialog(this, response, "Error", JOptionPane.ERROR_MESSAGE);
} else {
JOptionPane.showMessageDialog(this, response + "\nYou can now go back and login to join chat room", "Success!", JOptionPane.INFORMATION_MESSAGE);
signUpPanel.clearTf();
}
}
}
}
private void btSendEvent() {
String message = clientPanel.getTaInput().getText().trim();
if (message.equals("")) clientPanel.getTaInput().setText("");
else {
this.sendToServer("CMD_CHAT|" + message); //gửi data tới server
this.btClearEvent();
}
//chú ý rằng việc chờ server phản hồi thực hiện trong hàm run của thread chứ ko phải ở đây
}
private void btClearEvent() {
clientPanel.getTaInput().setText("");
}
private void btExitEvent() {
try {
isRunning = false;
System.exit(0);
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
////////////////////////End of Events////////////////////////////
public void connectToServer(String hostAddress) { //mỗi lần connect tới server là khởi tạo lại thuộc tính socketOfClient
try {
socketOfClient = new Socket(hostAddress, 9999);
bw = new BufferedWriter(new OutputStreamWriter(socketOfClient.getOutputStream()));
br = new BufferedReader(new InputStreamReader(socketOfClient.getInputStream()));
} catch (java.net.UnknownHostException e) {
JOptionPane.showMessageDialog(this, "Host IP is not correct.\nPlease try again!", "Failed to connect to server", JOptionPane.ERROR_MESSAGE);
} catch (java.net.ConnectException e) {
JOptionPane.showMessageDialog(this, "Server is unreachable, maybe server is not open yet, or can't find this host.\nPlease try again!", "Failed to connect to server", JOptionPane.ERROR_MESSAGE);
} catch (java.net.NoRouteToHostException e) {
JOptionPane.showMessageDialog(this, "Can't find this host!\nPlease try again!", "Failed to connect to server", JOptionPane.ERROR_MESSAGE);
} catch (IOException ex) {
Logger.getLogger(ClientFrame.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void sendToServer(String line) {
try {
this.bw.write(line);
this.bw.newLine(); //phải có newLine thì mới dùng đc hàm readLine()
this.bw.flush();
} catch (java.net.SocketException e) {
JOptionPane.showMessageDialog(this, "Server is closed, can't send message!", "Error", JOptionPane.ERROR_MESSAGE);
} catch (java.lang.NullPointerException e) {
System.out.println("[sendToServer()] Server is not open yet, or already closed!");
} catch (IOException ex) {
Logger.getLogger(ClientFrame.class.getName()).log(Level.SEVERE, null, ex);
}
}
public String recieveFromServer() {
try {
return this.br.readLine(); //chú ý rằng chỉ nhận 1 dòng từ server gửi về thôi, nếu server gửi nhiều dòng thì các dòng sau ko đọc
} catch (java.lang.NullPointerException e) {
System.out.println("[recieveFromServer()] Server is not open yet, or already closed!");
} catch (IOException ex) {
Logger.getLogger(ClientFrame.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
Logger.getLogger(ClientFrame.class.getName()).log(Level.SEVERE, null, ex);
}
ClientFrame client = new ClientFrame(null);
client.setVisible(true);
}
@Override
public void run() {
String response;
String sender, receiver, fileName, thePersonIamChattingWith, thePersonSendFile;
String msg;
String cmd, icon;
PrivateChat pc;
while (isRunning) {
response = this.recieveFromServer(); //nhận phản hồi từ server sau khi đã gửi data ở trên
tokenizer = new StringTokenizer(response, "|");
cmd = tokenizer.nextToken();
switch (cmd) {
case "CMD_CHAT": //giả sử nhận được gói tin: CMD_CHAT|anh tu: today is very cool!
sender = tokenizer.nextToken();
msg = response.substring(cmd.length() + sender.length() + 2, response.length());
if (sender.equals(this.name))
this.clientPanel.appendMessage(sender + ": ", msg, Color.BLACK, new Color(0, 102, 204));
else this.clientPanel.appendMessage(sender + ": ", msg, Color.MAGENTA, new Color(56, 224, 0));
//phải lằng nhằng như trên vì tránh trường hợp tin nhắn có ký tự |, nếu cứ dùng StringTokenizer và lấy ký tự '|' làm cái phân chia thì tin nhắn ko thể hiển thị kí tự | đc
break;
case "CMD_PRIVATECHAT": //khi server gửi message của sender, đứng ở góc nhìn của thằng client này
//thì thằng gửi tới đó chính là thằng nhận, vì thằng client này chat với thằng gửi đó,
//nên thằng gửi đó sẽ nhận tin từ thằng này
sender = tokenizer.nextToken();
msg = response.substring(cmd.length() + sender.length() + 2, response.length());
pc = listReceiver.get(sender);
if (pc == null) {
pc = new PrivateChat(name, sender, serverHost, bw, br);
pc.sender = name;
pc.receiver = sender;
pc.serverHost = this.serverHost;
pc.bw = ClientFrame.this.bw;
pc.br = ClientFrame.this.br;
pc.getLbReceiver().setText("Private chat with \"" + pc.receiver + "\"");
pc.setTitle(pc.receiver);
pc.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
pc.setVisible(true); //nếu cái pc đó đang Visible rồi thì lệnh này cho focus vào cái frame này
listReceiver.put(sender, pc);
} else {
pc.setVisible(true);
}
pc.appendMessage_Left(sender + ": ", msg);
break;
case "CMD_ONLINE_USERS":
listModel.clear();
listModel_rp.clear();
while (tokenizer.hasMoreTokens()) {
cmd = tokenizer.nextToken();
listModel.addElement(cmd);
listModel_rp.addElement(cmd);
}
clientPanel.getOnlineList().setModel(listModel);
listModel_rp.removeElement(this.name);
roomPanel.getOnlineList_rp().setModel(listModel_rp);
break;
case "CMD_ONLINE_THIS_ROOM":
listModelThisRoom.clear();
while (tokenizer.hasMoreTokens()) {
cmd = tokenizer.nextToken();
listModelThisRoom.addElement(cmd);
}
clientPanel.getOnlineListThisRoom().setModel(listModelThisRoom);
break;
case "CMD_FILEAVAILABLE":
System.out.println("file available");
fileName = tokenizer.nextToken();
thePersonIamChattingWith = tokenizer.nextToken();
thePersonSendFile = tokenizer.nextToken();
pc = listReceiver.get(thePersonIamChattingWith);
if (pc == null) {
sender = this.name;
receiver = thePersonIamChattingWith;
pc = new PrivateChat(sender, receiver, serverHost, bw, br);
pc.getLbReceiver().setText("Private chat with \"" + pc.receiver + "\"");
pc.setTitle(pc.receiver);
pc.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
listReceiver.put(receiver, pc);
}
pc.setVisible(true); //nếu cái pc đó đang Visible rồi thì lệnh này cho focus vào cái frame này
pc.insertButton(thePersonSendFile, fileName);
break;
case "CMD_ICON":
icon = tokenizer.nextToken();
cmd = tokenizer.nextToken(); //cmd = sender
if (cmd.equals(this.name))
this.clientPanel.appendMessage(cmd + ": ", "\n ", Color.BLACK, Color.BLACK);
else this.clientPanel.appendMessage(cmd + ": ", "\n ", Color.MAGENTA, Color.MAGENTA);
switch (icon) {
case "LIKE":
this.clientPanel.getTpMessage().insertIcon(new ImageIcon(getClass().getResource("/images/like2.png")));
break;
case "DISLIKE":
this.clientPanel.getTpMessage().insertIcon(new ImageIcon(getClass().getResource("/images/dislike.png")));
break;
case "PAC_MAN":
this.clientPanel.getTpMessage().insertIcon(new ImageIcon(getClass().getResource("/images/pacman.png")));
break;
case "SMILE":
this.clientPanel.getTpMessage().insertIcon(new ImageIcon(getClass().getResource("/images/smile.png")));
break;
case "GRIN":
this.clientPanel.getTpMessage().insertIcon(new ImageIcon(getClass().getResource("/images/grin.png")));
break;
case "CRY":
this.clientPanel.getTpMessage().insertIcon(new ImageIcon(getClass().getResource("/images/cry.png")));
break;
default:
throw new AssertionError("The icon is invalid, or can't find icon!");
}
break;
default:
if (!response.startsWith("CMD_")) { //trường hợp response chỉ là 1 tin nhắn thông thường
if (response.equals("Warnning: Server has been closed!")) {
this.clientPanel.appendMessage(response, Color.RED);
} else this.clientPanel.appendMessage(response, new Color(153, 153, 153));
}
//do bên server có hàm notifyToAllUsers(clientName+" has just entered!");
//hàm trên ko có định dạng nào cả, tức là ko có CMD_ ở đầu message, nên ta chỉ cần in ra thông điệp server gửi tới là đc
}
}
System.out.println("Disconnected to server!");
}
}
/*
Chat trong room: khi 1 thằng ấn send thì nội dung tin nhắn đc gửi đến server, sau đó server gửi lại tin đó
cho tất cả các thằng trong room đó, bao gồm cả thằng gửi, sau đó các thằng nhận đc tin nhắn mới hiển thị tin
lên textpane, nghĩa là thằng gửi tin cũng phải chờ server phản hồi về mới hiển thị tin nhắn nó vừa gửi lên
cái textpane của nó.
Chat private giữa 2 thằng: sender hiển thị tin nhắn của nó lên textpane sau đó mới gửi tin tới server, server chỉ
gửi tin lại thằng nhận thôi, ko gửi lại cho sender nữa. Khi gửi tin thì dùng PrivateChat để gửi, nhưng khi nhận tin thì
dùng ClientFrame để nhận, sau đó ClientFrame lấy cái JFrame PrivateChattìm từ cái tên đứa gửi trong listReceiver và
hiển thị tin lên cái frame đó. Chú ý là 1 người có thể có nhiều Frame PrivateChat để chat riêng với các người khác nhau,
do đó cần listReceiver để lưu các Frame tương ứng với người đó lại
Vậy listReceiver là danh sách các đối tượng đang chat riêng với người dùng đó, với key là tên của người chat và value là
cái Frame chat ứng với người chat đó
*/
| [
"dodv@smartosc.com"
] | dodv@smartosc.com |
3bb3ac26876a275d174769de897c6617ab695d0a | 49a6b21cc816214128dcc8a6c436a498fe484a50 | /src/main/java/com/kaybo/app/model/GameInfo.java | 0c254e72e677d576123f909f2b9093ae5e8f3b93 | [] | no_license | smunchang/app | 9015ee33776db9f80c7100eae63d824ea1f7e807 | 74b57bfd8fbcb1222a441b18d8ec5e6496f6f7e1 | refs/heads/master | 2020-03-25T08:35:44.408849 | 2018-09-01T17:22:55 | 2018-09-01T17:22:55 | 143,622,047 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 902 | java | package com.kaybo.app.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
@JsonInclude(JsonInclude.Include.NON_NULL)
public class GameInfo {
private String gameNo;
private String gameNm;
private String gameUrl;
private String gameCash;
public String getGameNo() {
return gameNo;
}
public void setGameNo(String gameNo) {
this.gameNo = gameNo;
}
public String getGameNm() {
return gameNm;
}
public void setGameNm(String gameNm) {
this.gameNm = gameNm;
}
public String getGameUrl() {
return gameUrl;
}
public void setGameUrl(String gameUrl) {
this.gameUrl = gameUrl;
}
public String getGameCash() {
return gameCash;
}
public void setGameCash(String gameCash) {
this.gameCash = gameCash;
}
}
| [
"munchang@Muns-MacBook-Pro.local"
] | munchang@Muns-MacBook-Pro.local |
802a1c82698374c2606b4693cf5d7f8f4c1d13d9 | b2147bb00fcf91a1e0311d298c98a14a96418b2b | /src/main/java/cn/richinfo/richadmin/common/vo/project/DiagnosticLevelVo.java | faaef6d2874e81b6d558afdf76a9bb39d8e8b677 | [] | no_license | liuruibinggit/RichAdmin | 1012ca6deec360814af22a6a40679d57709ad3a6 | 9c742c35870fade464f3300c56cf3d71104a47e1 | refs/heads/master | 2020-05-13T14:47:22.785206 | 2019-04-17T02:10:01 | 2019-04-17T02:10:01 | 181,633,157 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,740 | java | package cn.richinfo.richadmin.common.vo.project;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* Created by LiuRuibing on 2019/4/4 0004.
*/
public class DiagnosticLevelVo {
List<Map<?,?>> costList=new ArrayList<Map<?,?>>(); //成本等级list
List<Map<?,?>> speedList=new ArrayList<Map<?,?>>(); //进度等级list
List<Map<?,?>> manhourList=new ArrayList<Map<?,?>>();
List<Map<?,?>> paymentList=new ArrayList<Map<?,?>>();
List<Map<?,?>> grossprofitList=new ArrayList<>();
List<Map<?,?>> settlementrList=new ArrayList<Map<?,?>>();
public List<Map<?, ?>> getCostList() {
return costList;
}
public void setCostList(List<Map<?, ?>> costList) {
this.costList = costList;
}
public List<Map<?, ?>> getSpeedList() {
return speedList;
}
public void setSpeedList(List<Map<?, ?>> speedList) {
this.speedList = speedList;
}
public List<Map<?, ?>> getManhourList() {
return manhourList;
}
public void setManhourList(List<Map<?, ?>> manhourList) {
this.manhourList = manhourList;
}
public List<Map<?, ?>> getPaymentList() {
return paymentList;
}
public void setPaymentList(List<Map<?, ?>> paymentList) {
this.paymentList = paymentList;
}
public List<Map<?, ?>> getGrossprofitList() {
return grossprofitList;
}
public void setGrossprofitList(List<Map<?, ?>> grossprofitList) {
this.grossprofitList = grossprofitList;
}
public List<Map<?, ?>> getSettlementrList() {
return settlementrList;
}
public void setSettlementrList(List<Map<?, ?>> settlementrList) {
this.settlementrList = settlementrList;
}
}
| [
"2675247482@qq.com"
] | 2675247482@qq.com |
2c1dedb342a7026acd9f9814e785e3ed98cd25a2 | 90dab0b0e39226aa997eeb131da92f867e5e410e | /CommonUtils/src/me/lagbug/common/CommonUtils.java | 02c191683c5353b945217f34f85c4854058da836 | [] | no_license | LagBug/CommonUtils | 554f3f42342d96264f7c6a25716e01dcb7a6459f | 3289f35c769a3b0f613ec8dc334e123a31bdde1a | refs/heads/master | 2020-07-28T09:25:10.824464 | 2019-09-19T10:52:05 | 2019-09-19T10:52:05 | 209,379,046 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,612 | java | package me.lagbug.common;
import java.awt.Color;
import java.util.List;
import java.util.Random;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.plugin.java.JavaPlugin;
import org.spigotmc.SpigotConfig;
public class CommonUtils {
private static final String alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
private static String pluginName = "Plugin";
private static JavaPlugin plugin = null;
public static String randomString(int length) {
String result = ""; Random r = new Random();
for (int i = 0; i < length; i++) {
result = result + alphabet.charAt(r.nextInt(alphabet.length()));
}
return result;
}
public static int randomInteger(int min, int max) {
if (min >= max) {
throw new IllegalArgumentException("max must be greater than min");
}
return new Random().nextInt((max - min) + 1) + min;
}
public static String listToString(List<?> list) {
return list.toString().replace("[", "").replace("]", "").replace(",", "");
}
public static Color colorFromString(String colorName) {
Color color;
try {
color = (Color) Class.forName("java.awt.Color").getField(colorName).get(null);
} catch (NoSuchFieldException | SecurityException | ClassNotFoundException | IllegalArgumentException | IllegalAccessException e) {
return Color.BLACK;
}
return color;
}
public static String materialToString(Material material) {
String result = "";
for (String s : material.name().split("_")) {
result += s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase() + " ";
}
return result.substring(0, result.length() - 1);
}
public static boolean isPluginEnabled(String plugin) {
return Bukkit.getPluginManager().getPlugin(plugin) != null && Bukkit.getPluginManager().getPlugin(plugin).isEnabled();
}
public static boolean isBungee() {
return SpigotConfig.bungee && (!(Bukkit.getServer().getOnlineMode()));
}
public static void log(String... text) {
for (String current : text) {
System.out.println("[" + pluginName + "] " + current + ".");
}
}
public static void forceLog(String... text) {
for (String current : text) {
System.out.println("[" + pluginName + "] " + current + ".");
}
}
public static void setPluginName(String name) {
pluginName = name;
}
public static void setPlugin(JavaPlugin pluginN) {
plugin = pluginN;
}
public static JavaPlugin getPlugin() {
return plugin;
}
public static String getPluginName() {
return pluginName;
}
} | [
"achihait@gmail.com"
] | achihait@gmail.com |
6a3acc1fb081ab93eba975671e371130f1bd5d83 | 1a3073840ac16e160ff6f351b77d4658b5ce8bc7 | /components/camel-kafka/src/test/java/org/apache/camel/component/kafka/MockProducerInterceptor.java | 10520406a636251f95daa1f121412a4430917d61 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-unknown",
"Apache-2.0"
] | permissive | fastfishio/camel | 84d5f4af6a71398cdb64d8a5aa5a9ef38bd51a29 | 0e20f47645becc2eb72a97b8564546dfe218ff2e | refs/heads/master | 2021-09-14T22:53:17.000689 | 2020-12-21T16:41:48 | 2020-12-21T16:41:48 | 81,466,332 | 0 | 0 | Apache-2.0 | 2021-06-28T13:22:51 | 2017-02-09T15:47:24 | Java | UTF-8 | Java | false | false | 1,676 | 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.camel.component.kafka;
import java.util.ArrayList;
import java.util.Map;
import org.apache.kafka.clients.producer.ProducerInterceptor;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.clients.producer.RecordMetadata;
public class MockProducerInterceptor implements ProducerInterceptor<String, String> {
public static ArrayList<ProducerRecord<String, String>> recordsCaptured = new ArrayList<>();
@Override
public ProducerRecord<String, String> onSend(ProducerRecord<String, String> producerRecord) {
recordsCaptured.add(producerRecord);
return producerRecord;
}
@Override
public void onAcknowledgement(RecordMetadata recordMetadata, Exception e) {
}
@Override
public void close() {
}
@Override
public void configure(Map<String, ?> map) {
}
} | [
"lmk@square-8.com"
] | lmk@square-8.com |
d4611504e8631143c0a5e81933cd7d6de586eef9 | ea0fd50cb6145fe782921af77daf14074863af2c | /app/src/androidTest/java/com/compapp/app/contactapp/ExampleInstrumentedTest.java | f8c17d970ca5e85e3d3c680e2f2a154efd219566 | [] | no_license | Heokyoungjun/ContactApp | 8ec3b75067bb98671410f5da72ec195ce47c2ccd | 0dac38e16532d28b7769e5f8555ab37370c64979 | refs/heads/master | 2021-01-22T05:10:13.561281 | 2017-02-18T09:20:26 | 2017-02-18T09:20:26 | 81,625,636 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 756 | java | package com.compapp.app.contactapp;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.compapp.app.contactapp", appContext.getPackageName());
}
}
| [
"ggaia.heo@gmail.com"
] | ggaia.heo@gmail.com |
ffe5e74f35d9320faba9574711726ae89d325084 | 421f0a75a6b62c5af62f89595be61f406328113b | /generated_tests/model_seeding/2_a4j-net.kencochrane.a4j.beans.ListingProductInfo-1.0-1/net/kencochrane/a4j/beans/ListingProductInfo_ESTest_scaffolding.java | e4cdeb3d16b7a1698fb4ced68851ef4998183b26 | [] | no_license | tigerqiu712/evosuite-model-seeding-empirical-evaluation | c78c4b775e5c074aaa5e6ca56bc394ec03c2c7c6 | 11a920b8213d9855082d3946233731c843baf7bc | refs/heads/master | 2020-12-23T21:04:12.152289 | 2019-10-30T08:02:29 | 2019-10-30T08:02:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 550 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Thu Oct 24 12:27:09 GMT 2019
*/
package net.kencochrane.a4j.beans;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import org.evosuite.runtime.sandbox.Sandbox;
import org.evosuite.runtime.sandbox.Sandbox.SandboxMode;
@EvoSuiteClassExclude
public class ListingProductInfo_ESTest_scaffolding {
// Empty scaffolding for empty test suite
}
| [
"pderakhshanfar@bsr01.win.tue.nl"
] | pderakhshanfar@bsr01.win.tue.nl |
9e5f6022569c7901f09d8b123cb0c93ab27da39e | 69234b188002fab4fded71b169b26c36b41c1e0a | /hystrix-dashboad-8050/src/main/java/com/ye/controller/DeptController.java | 40ac29eddf5363622f65faa4d083257d97137384 | [] | no_license | wanru0622/wodetian | 5b5566939e41e3d11e78e8dc733718414870a5ea | b2b7265a5a389edb6a3a0c32faf63650b095e25d | refs/heads/master | 2021-06-20T21:32:39.329040 | 2019-10-01T16:29:16 | 2019-10-01T16:29:16 | 212,145,077 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 682 | java | package com.ye.controller;
import domain.impl.FeignDept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class DeptController {
@Autowired
private FeignDept feignDept;
@RequestMapping("/index/{id}")
// @HystrixCommand(fallbackMethod = "fallbackMethod")
String dept(@PathVariable("id") int id){
String dept = feignDept.dept(id);
return dept;
}
public String fallbackMethod(){
return "fail";
}
}
| [
"1004504941@qq.com"
] | 1004504941@qq.com |
1d932798c16b95f4d648ea795e36d1b5ea85512f | bccfccc1d383a893a6e85c3a05822905c215e7eb | /pds.xdi/src/main/java/pds/xdi/events/XdiResolutionEndpointEvent.java | 810b053a018724e8122d18d08ed14711ad2e3b17 | [] | no_license | peacekeeper/personaldatastore | 67124bdd13d0382a7a604d6ca23fff2c13272cbb | f50fa15b5d5ddd6cc171f295d8f1794e24dca2c8 | refs/heads/master | 2016-09-02T00:31:32.989926 | 2013-04-23T20:24:08 | 2013-04-23T20:24:08 | 793,984 | 8 | 2 | null | null | null | null | UTF-8 | Java | false | false | 685 | java | package pds.xdi.events;
public class XdiResolutionEndpointEvent extends XdiResolutionEvent {
private static final long serialVersionUID = 824251490724932897L;
private String endpoint;
private String inumber;
public XdiResolutionEndpointEvent(Object source, String endpoint, String inumber) {
super(source);
this.endpoint = endpoint;
this.inumber = inumber;
}
public String getEndpoint() {
return this.endpoint;
}
public void setEndpoint(String endpoint) {
this.endpoint = endpoint;
}
public String getInumber() {
return this.inumber;
}
public void setInumber(String inumber) {
this.inumber = inumber;
}
}
| [
"Markus@192.168.0.196"
] | Markus@192.168.0.196 |
7a821cec4ae9db545c13d9b3a3dba40a0e513b0a | b91abf5c70284848354694385b7dae3f1dc5d353 | /springboot-yanki-wallet/src/main/java/com/everis/springboot/yankiwallet/service/impl/YankiWalletServiceImpl.java | 2274c0325131c266cff48ae69d3d35d5630d7ca1 | [] | no_license | ilazosol/everis-proyecto-3-servicios | c5e346a8a23436bce3fdebb9d205187f23c46fac | 552f2894664dbea6af56331ce81b227a6a34161e | refs/heads/master | 2023-07-15T17:48:00.765937 | 2021-09-01T20:55:57 | 2021-09-01T20:55:57 | 398,117,194 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,257 | java | package com.everis.springboot.yankiwallet.service.impl;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.kafka.requestreply.ReplyingKafkaTemplate;
import org.springframework.kafka.requestreply.RequestReplyFuture;
import org.springframework.stereotype.Service;
import com.everis.springboot.yankiwallet.dao.YankiWalletDao;
import com.everis.springboot.yankiwallet.document.ClientDocument;
import com.everis.springboot.yankiwallet.document.YankiWalletDocument;
import com.everis.springboot.yankiwallet.exception.ValidatorWalletException;
import com.everis.springboot.yankiwallet.service.YankiWalletService;
import com.everis.springboot.yankiwallet.util.Validations;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@Service
public class YankiWalletServiceImpl implements YankiWalletService {
@Autowired
private YankiWalletDao yankiWalletDao;
@Autowired
private Validations validations;
@Value("${kafka.request.topic}")
private String topicNewClient;
@Value("${kafka.request.topic2}")
private String topicExistingClient;
@Autowired
@Qualifier("createNewClientTemplate")
private ReplyingKafkaTemplate<String,Map<String, Object>,Map<String, String>> createNewClientTemplate;
@Autowired
@Qualifier("findClientTemplate")
private ReplyingKafkaTemplate<String,Map<String, Object>,Map<String, String>> findClientTemplate;
@Override
public Mono<ResponseEntity<Map<String, Object>>> createWalletClient(ClientDocument client) throws InterruptedException, ExecutionException, JsonMappingException, JsonProcessingException, JSONException {
Map<String, Object> response = new HashMap<>();
System.out.println("Entro a la implementacion de la creacion de la billetera");
if(client.getId() == null) {
System.out.println("Entro aca no hay id");
try {
validations.validateClientWallet(client);
Map<String, Object> request = new HashMap<>();
request.put("client", client);
ProducerRecord<String, Map<String, Object>> record = new ProducerRecord<>(topicNewClient, request);
RequestReplyFuture<String, Map<String, Object>, Map<String, String>> future = createNewClientTemplate.sendAndReceive(record);
ConsumerRecord<String, Map<String, String>> res = future.get();
/*return res.value().flatMap( nc -> {
YankiWalletDocument wallet = YankiWalletDocument.builder()
.createdAt(new Date())
.balance(0.0)
.idClient(nc.getId())
.build();
return yankiWalletDao.save(wallet).flatMap( w ->{
response.put("mensaje", "se registro correctamente la billetera Tunki para el cliente: "+nc.getFirstName()+" "+nc.getLastName());
response.put("wallet", w);
return Mono.just(new ResponseEntity<>(response, HttpStatus.OK));
});
});*/
return Mono.just(new ResponseEntity<>(response, HttpStatus.OK));
} catch (ValidatorWalletException e) {
response.put("mensaje", e.getMensajeValidacion());
return Mono.just(new ResponseEntity<>(response, HttpStatus.BAD_REQUEST));
}
}else {
System.out.println("Entro aca si hay");
Map<String, Object> request = new HashMap<>();
request.put("idClient", client.getId());
ObjectMapper mapper = new ObjectMapper();
ProducerRecord<String, Map<String, Object>> record = new ProducerRecord<>(topicExistingClient, request);
RequestReplyFuture<String, Map<String, Object>, Map<String, String>> future = findClientTemplate.sendAndReceive(record);
ConsumerRecord<String, Map<String, String>> res = future.get();
System.out.println("Abajo se va a imprimir el valor del evento");
System.out.println(res.value().get("client").toString());
ClientDocument ec = mapper.readValue(res.value().get("client").toString(), ClientDocument.class);
System.out.println(ec.toString());
YankiWalletDocument wallet = YankiWalletDocument.builder()
.createdAt(new Date())
.balance(0.0)
.idClient(ec.getId())
.build();
return yankiWalletDao.save(wallet).flatMap( w ->{
response.put("mensaje", "se registro correctamente la billetera Tunki para el cliente: "+ec.getFirstName()+" "+ec.getLastName());
response.put("wallet", w);
return Mono.just(new ResponseEntity<>(response, HttpStatus.OK));
});
}
}
@Override
public Flux<YankiWalletDocument> findAllWallet() {
return yankiWalletDao.findAll();
}
@Override
public Mono<YankiWalletDocument> getWalletById(Integer id) {
// TODO Auto-generated method stub
return null;
}
}
| [
"ilazosol@everis.com"
] | ilazosol@everis.com |
22dfb10e897ddd7289cb2c0948e6d5cdbb641b6c | a935a5347b67b4c1946aca9a1ecd8ff397b4577c | /driverstation/src/DriverStationController.java | 1a92c7e6c65b4a84be050f4c1fa416d2068203a4 | [
"BSD-3-Clause"
] | permissive | bokken12/allwpilib | ac74c6ca20e339e33037d262457dfa96f714d0e8 | e980576463da339a6c7283dd9bf8771b044b164a | refs/heads/master | 2021-01-18T16:08:47.868923 | 2017-07-23T18:15:15 | 2017-07-23T18:15:15 | 86,715,060 | 0 | 0 | null | 2017-03-30T14:54:18 | 2017-03-30T14:54:18 | null | UTF-8 | Java | false | false | 83 | java | /**
*
*/
/**
* @author joel
*
*/
public class DriverStationController {
}
| [
"stopwatchj@gmail.com"
] | stopwatchj@gmail.com |
9371ac86364ec9003a9d4596931329ce0e2c8d55 | a7d3734ba51d32d1214bd68c9f71f0799e95bafe | /src/main/java/com/telemedine/models/Patient.java | 86f104b962e883bda4fb9e228bb763d031549dfc | [] | no_license | mory-moussa/spring-boot-spring-security-jwt-authentication | 89294f29d177a91528f9daa3b63e771b5cd9b501 | 4c732831a0a54da0505e0348691dd648fcf2e33d | refs/heads/master | 2023-02-09T17:35:16.029631 | 2021-01-04T16:35:19 | 2021-01-04T16:35:19 | 283,512,684 | 0 | 0 | null | 2020-07-29T13:54:24 | 2020-07-29T13:54:23 | null | UTF-8 | Java | false | false | 1,060 | java | package com.telemedine.models;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import com.sun.istack.Nullable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Entity
@Table( name = "patient")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Patient {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@OneToOne(mappedBy = "patient")
private User user;
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable( name = "patient_rendezVous",
joinColumns = @JoinColumn(name = "patient_id"),
inverseJoinColumns = @JoinColumn(name = "rendezVous_id"))
private Set<RendezVous> rendezVous = new HashSet<>();
}
| [
"mmcamara30@gmail.com"
] | mmcamara30@gmail.com |
941b9d14a4640817e00dd94b6dbc48426568fe7d | 52cc6fb9ce342afcdfeb7e6d5cf9e2da1902f551 | /uleam-arquitectura/src/main/java/components/windowDialog.java | c8b0aa00ddd987b53e4ede521ae69bf21c39078c | [
"Unlicense"
] | permissive | gggabo/ULEAM_APPS | 900636cb04c310e316851f3928513edb439dfb6e | dc776c1bdd2784de9d26f8e01a0386c1c5869599 | refs/heads/master | 2023-01-27T15:42:05.302219 | 2019-09-22T03:40:35 | 2019-09-22T03:40:35 | 190,326,068 | 0 | 0 | null | 2023-01-07T09:45:41 | 2019-06-05T04:31:16 | CSS | UTF-8 | Java | false | false | 2,747 | java | package components;
import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.button.ButtonVariant;
import com.vaadin.flow.component.dialog.Dialog;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.html.Label;
import com.vaadin.flow.component.icon.Icon;
import com.vaadin.flow.component.icon.VaadinIcon;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
public class windowDialog extends Dialog{
private static final long serialVersionUID = 1L;
private Div windowLayout = new Div();
private Div windowHeader = new Div();
private Div windowHeaderContain = new Div();
private Div contentLayout = new Div();
private Button succes = new Button("Aceptar");
private Button cancel = new Button("Cancelar");
private HorizontalLayout buttonsLayout = new HorizontalLayout();
private Div buttonsRoot = new Div();
public Div getButtonsRoot() {
return buttonsRoot;
}
public void setButtonsRoot(Div buttonsRoot) {
this.buttonsRoot = buttonsRoot;
}
private Label title = new Label();
private Icon icon;
public windowDialog() {
setConfig();
}
private void setConfig() {
succes.addThemeVariants(ButtonVariant.LUMO_PRIMARY, ButtonVariant.LUMO_SMALL);
succes.setIcon(VaadinIcon.CHECK_CIRCLE.create());
cancel.addThemeVariants(ButtonVariant.LUMO_ERROR, ButtonVariant.LUMO_SMALL);
cancel.setIcon(VaadinIcon.CLOSE.create());
buttonsLayout.add(cancel, succes);
buttonsLayout.setPadding(false);
icon = new Icon(VaadinIcon.FORM);
icon.setClassName("window-title-icon");
title.setClassName("window-title");
windowHeaderContain.add(icon,title);
windowHeader.add(windowHeaderContain);
windowHeader.addClassName("window-header");
buttonsRoot.addClassName("window-footer");
buttonsRoot.setWidthFull();
buttonsRoot.add(buttonsLayout);
windowLayout.add(windowHeader,contentLayout, buttonsRoot);
add(windowLayout);
}
public Div getContentLayout() {
return contentLayout;
}
public void setContentLayout(Div contentLayout) {
this.contentLayout = contentLayout;
}
public Button getSucces() {
return succes;
}
public void setSucces(Button succes) {
this.succes = succes;
}
public Button getCancel() {
return cancel;
}
public void setCancel(Button cancel) {
this.cancel = cancel;
}
public void setContent(Component c) {
contentLayout.add(c);
}
public void setTitle(String title) {
this.title.setText(title);
}
public void setIcon(VaadinIcon icon) {
this.icon.getElement().setAttribute("icon", "vaadin:"+icon.name().toLowerCase());
}
}
| [
"Gabriel S@DESKTOP-S8LNC5G"
] | Gabriel S@DESKTOP-S8LNC5G |
97277003b42745987a810e67da3c0df94b569119 | 4d386d7ba45b9dc46165077528d8d15e84080410 | /taotao-portal/src/main/java/com/taotao/portal/pojo/AdNode.java | 8c700b0e0a764e10cd44fa2cb1437d6a22d87778 | [] | no_license | qibill/taotao | 137c99a558dcc6a3400d47e0f62ba5ec75f40087 | 8548ff545e0e83a7b107f95d66ae6fb22f7a4d71 | refs/heads/master | 2021-05-15T12:00:33.351309 | 2018-01-10T16:26:32 | 2018-01-10T16:26:32 | 108,389,117 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,139 | java | package com.taotao.portal.pojo;
public class AdNode {
private int height;
private int width;
private String src;
private int heightB;
private int widthB;
private String srcB;
private String alt;
private String href;
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public String getSrc() {
return src;
}
public void setSrc(String src) {
this.src = src;
}
public int getHeightB() {
return heightB;
}
public void setHeightB(int heightB) {
this.heightB = heightB;
}
public int getWidthB() {
return widthB;
}
public void setWidthB(int widthB) {
this.widthB = widthB;
}
public String getSrcB() {
return srcB;
}
public void setSrcB(String srcB) {
this.srcB = srcB;
}
public String getAlt() {
return alt;
}
public void setAlt(String alt) {
this.alt = alt;
}
public String getHref() {
return href;
}
public void setHref(String href) {
this.href = href;
}
}
| [
"870937917@qq.com"
] | 870937917@qq.com |
cdf37ba601363f0fc70b5b561f9e0c7aff227b2a | e72f817b2e2d80125784bb9a8171b9ccd995903c | /app/src/main/java/f/star/iota/milk/ui/magmoe/mag/MagFragment.java | 5d7a29979ae57298406869b833dceb6d22dcb258 | [] | no_license | qqq58452077/milk-fresco | 9803252ad85a62a0b523c71e9d77c10af73c690b | fd50f3ac0a54f383d9b731f56effd0888d57b7a1 | refs/heads/master | 2021-12-07T09:01:14.581608 | 2021-11-29T08:11:19 | 2021-11-29T08:11:19 | 206,455,246 | 9 | 5 | null | 2019-09-05T02:12:42 | 2019-09-05T02:12:42 | null | UTF-8 | Java | false | false | 660 | java | package f.star.iota.milk.ui.magmoe.mag;
import android.os.Bundle;
import f.star.iota.milk.base.ScrollImageFragment;
public class MagFragment extends ScrollImageFragment<MagPresenter, MagAdapter> {
public static MagFragment newInstance(String url) {
MagFragment fragment = new MagFragment();
Bundle bundle = new Bundle();
bundle.putString("base_url", url);
fragment.setArguments(bundle);
return fragment;
}
@Override
protected MagPresenter getPresenter() {
return new MagPresenter(this);
}
@Override
protected MagAdapter getAdapter() {
return new MagAdapter();
}
}
| [
"iota.9star@foxmail.com"
] | iota.9star@foxmail.com |
f056bbc160c19e904fd619c4cf984ff2baec84af | 2b5e16be2f7ffc5d0c1c9a6de61ac4d160c2f53b | /src/main/java/com/mitocode/security/User.java | cc382a8f48f410cb7cdfdfd3da2700fa2710d811 | [] | no_license | DragShot/mitocode-springreactivo-final | 97ce9bf2779b1c47354bd3e846080127bcfad55c | a403168bfbc7b67607f1a70f9eabc672f681ff6a | refs/heads/master | 2022-12-18T01:47:25.453426 | 2020-09-01T01:00:55 | 2020-09-01T01:00:55 | 291,849,061 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,004 | java | package com.mitocode.security;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
//Clase S1
public class User implements UserDetails {
private static final long serialVersionUID = 1L;
private String username;
private String password;
private Boolean enabled;
private List<String> roles;
public User(String username, String password, Boolean enabled, List<String> authorities) {
super();
this.username = username;
this.password = password;
this.enabled = enabled;
this.roles = authorities;
}
@Override
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
@Override
public boolean isAccountNonExpired() {
return false;
}
@Override
public boolean isAccountNonLocked() {
return false;
}
@Override
public boolean isCredentialsNonExpired() {
return false;
}
@Override
public boolean isEnabled() {
return this.enabled;
}
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
return this.roles.stream().map(authority -> new SimpleGrantedAuthority(authority)).collect(Collectors.toList());
}
@JsonIgnore
@Override
public String getPassword() {
return password;
}
@JsonProperty
public void setPassword(String password) {
this.password = password;
}
public List<String> getRoles() {
return roles;
}
public void setRoles(List<String> roles) {
this.roles = roles;
}
public Boolean getEnabled() {
return enabled;
}
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
} | [
"the.drag.shot@gmail.com"
] | the.drag.shot@gmail.com |
1a52322691659b2f113518efe0087bce2e716978 | fcf17fe159a655a321ef8097038b7283af313dca | /src/lesson11/Logik01.java | 7a596ad19b8ca2c08ac926ff26f1de10a1524a82 | [] | no_license | alextopolcean/Java13Morning | c83a4905ea3165d0c785fdbb6faab05bfa5c43a2 | 2214360242e55067e30fdd6e62215c32e9811fe9 | refs/heads/master | 2022-12-07T05:33:29.834688 | 2020-08-18T19:52:36 | 2020-08-18T19:52:36 | 286,563,779 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 386 | java | package lesson11;
public class Logik01 {
public static void main(String[] args) {
System.out.println(doorbell(true,true)); // false
System.out.println(doorbell(false,false)); // false
System.out.println(doorbell(true,false)); // true
}
public static boolean doorbell (boolean klingel, boolean klingel2){
return klingel ^ klingel2;
}
}
| [
"alextopolcean@gmail.com"
] | alextopolcean@gmail.com |
052c8b051882e006d969ac81761e54c94136ccc9 | 60416f42b29925568d1d9d8a984ffebee9b2cd83 | /play_tp16/test/fluent/FonctionalFluentTest.java | 42b8216df873cacfdfd4da41746ef6d93706fdec | [
"MIT"
] | permissive | fmaturel/PlayTraining | 55e006c6f78df40bdd17bd9ae618e966d9da87b7 | 5783aec150d28d46a011f1a3dfbb585858f2e31f | refs/heads/master | 2021-01-25T04:02:59.800109 | 2015-03-05T13:22:54 | 2015-03-05T13:22:54 | 18,328,072 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,777 | java | package fluent;
import models.User;
import org.junit.Test;
import play.Logger;
import play.db.jpa.JPA;
import play.libs.F.Callback;
import play.libs.F.Function0;
import play.test.TestBrowser;
import static org.fest.assertions.Assertions.assertThat;
import static play.test.Helpers.*;
/**
* Sample "integration" test, using the functioning webapp.
*
* @author Philip Johnson
*/
public class FonctionalFluentTest {
/**
* The port to be used for testing.
*/
private final int port = 3333;
/**
* Sample test that submits a form and then checks that form data was echoed to page.
*/
@Test
public void test() {
running(testServer(port, fakeApplication(inMemoryDatabase())), HTMLUNIT, new Callback<TestBrowser>() {
public void invoke(TestBrowser browser) throws Throwable {
final User admin = new User();
admin.email = "admin@play.com";
admin.name = "administrateur";
admin.password = "laformationplay";
JPA.withTransaction(new Function0<Void>() {
@Override
public Void apply() throws Throwable {
admin.save();
return null;
}
});
LoginPage loginPage = new LoginPage(browser.getDriver(), port, "/bo");
browser.goTo(loginPage);
Logger.of("tests").info(browser.pageSource());
loginPage.isAt();
loginPage.submitForm(admin.email, admin.password);
Logger.of("tests").info(browser.pageSource());
assertThat(browser.pageSource()).contains("Bonjour " + admin.email);
}
});
}
}
| [
"francoismaturel@gmail.com"
] | francoismaturel@gmail.com |
208de9728e6d6c178868d43ec49f8effa62cc9d5 | 03dd7016a766a81e033c466f9437d207283d15ed | /Order-api/src/main/java/it/uniroma3/RejectOrderCommand.java | 569313d8a557fe47c75a05dbea5ad1d9a3184255 | [] | no_license | ElenaBernardi/Sagas_Example | 82b1a1925090336787da08e551011800d9bdf5a4 | c755827f0e4d7fa51e3a33250913e477f8ab0131 | refs/heads/master | 2020-05-18T17:18:56.915196 | 2019-05-02T09:14:05 | 2019-05-02T09:14:05 | 184,550,980 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 425 | java | package it.uniroma3;
import io.eventuate.tram.commands.common.Command;
public class RejectOrderCommand implements Command {
private Long orderId;
private RejectOrderCommand() {
}
public RejectOrderCommand(long orderId) {
this.orderId = orderId;
}
public Long getOrderId() {
return orderId;
}
public void setOrderId(Long orderId) {
this.orderId = orderId;
}
}
| [
"elenabernardi15@gmail.com"
] | elenabernardi15@gmail.com |
d071c1104cbb364e0ebb9c720f517f0b62b14707 | 2506d59c522808a253321407a8b148baae03b24c | /src/main/java/eisenwave/inv/event/ClickEvent.java | 5ca88178368a28bbcfd43d029b37efd754549058 | [] | no_license | Eisenwave/eisen-inventories | 0f3939375d4c1e59bb4675b698d798bd6581bf82 | e04505c987fcc9e0177b8a4144b91fdd47b80c2c | refs/heads/master | 2021-10-08T10:59:58.829605 | 2018-12-11T11:59:10 | 2018-12-11T11:59:10 | 110,969,434 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 491 | java | package eisenwave.inv.event;
import eisenwave.inv.view.View;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.jetbrains.annotations.NotNull;
public class ClickEvent extends ViewEvent {
protected final ClickType type;
public ClickEvent(@NotNull View view, @NotNull Player player, ClickType type) {
super(view, player);
this.type = type;
}
public ClickType getClick() {
return type;
}
}
| [
"janschultke@gmail.com"
] | janschultke@gmail.com |
3567bfc1003a70ea592a657b5c2fdb7b09687930 | 383d566703953fae4b1cab99cdd7e79ad1880d86 | /src/test/java/com/example/springbootdemo/GreetingControllerTests.java | b78b613bcd939d0ec2aec0602cbe268745c2e7f5 | [] | no_license | xiedfchn/spring-boot-demo | 478d0aa80860772edfd75dbf6c2431e3720270d6 | 195d402ae8d0910e395184bf737e74c7950e79b4 | refs/heads/main | 2023-06-06T23:50:03.386174 | 2021-07-03T22:58:14 | 2021-07-03T22:58:14 | 373,977,786 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,394 | java | package com.example.springbootdemo;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.web.servlet.MockMvc;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
@SpringBootTest
@AutoConfigureMockMvc
public class GreetingControllerTests {
@Autowired
private MockMvc mockMvc;
@Test
public void noParamGreetingShouldReturnDefaultMessage() throws Exception {
this.mockMvc.perform(get("/greeting")).andDo(print()).andExpect(status().isOk())
.andExpect(jsonPath("$.content").value("Hello, World!"));
}
@Test
public void paramGreetingShouldReturnTailoredMessage() throws Exception {
this.mockMvc.perform(get("/greeting").param("name", "Spring Community"))
.andDo(print()).andExpect(status().isOk())
.andExpect(jsonPath("$.content").value("Hello, Spring Community!"));
}
}
| [
"xiedf.chn@gmail.com"
] | xiedf.chn@gmail.com |
dc4a11be5083a6e9ecded59d60f9bb21e84c2455 | a8f321f35ede04291d38d23c92454778230e5965 | /app/src/main/java/com/peter/volley/toolbox/NoCache.java | dc2f315693e8919b4a4dd7a84a083b4f5b7b2afd | [] | no_license | javalive09/shuihu | 628ca5d72df737dfd05a0eaa558e71ae82a2b3c7 | b982bdae5fccc98cefba310daf6c74301a404b44 | refs/heads/master | 2021-01-10T08:56:29.916695 | 2016-05-01T10:05:27 | 2016-05-01T10:05:27 | 47,816,887 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,146 | java | /*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.peter.volley.toolbox;
import com.peter.volley.Cache;
/**
* A cache that doesn't.
*/
public class NoCache implements Cache {
@Override
public void clear() {
}
@Override
public Entry get(String key) {
return null;
}
@Override
public void put(String key, Entry entry) {
}
@Override
public void invalidate(String key, boolean fullExpire) {
}
@Override
public void remove(String key) {
}
@Override
public void initialize() {
}
}
| [
"javalive09@163.com"
] | javalive09@163.com |
8729502f13e949c3e739181de307e182b5233c9c | 1a27288a8976b629b40c54ef1757f7787e413494 | /app/src/main/java/com/sjx/Action/BatteryReceiver.java | a71ed4661f42e318fab7b88c04ff0f85a9e2bcab | [] | no_license | jklm23/MobileMonitor | 64e518725c1f57e0edc8d190258b00d685c569cf | 0e96fa3c1f46312331c8d898cc7e057db5eb5b3e | refs/heads/master | 2022-02-27T10:20:20.598114 | 2019-09-24T02:23:15 | 2019-09-24T02:23:15 | 207,595,710 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,018 | java | package com.sjx.Action;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
public class BatteryReceiver extends BroadcastReceiver {
int mCurrentLevel=0;
int m_total=0;
String m_strPercent;
@Override
public void onReceive(Context context, Intent intent) {
final String action=intent.getAction();
if(action.equalsIgnoreCase(Intent.ACTION_BATTERY_CHANGED))
Log.i("battery","get battter change broad");
mCurrentLevel=intent.getIntExtra("level",0);//当前电量
m_total=intent.getExtras().getInt("scale");//总电量
int percent=mCurrentLevel*100/m_total;//百分比
m_strPercent=percent+"%";
Log.i("当前电量:",mCurrentLevel+"");
}
public int getmCurrentLevel() {
return mCurrentLevel;
}
public int getM_total() {
return m_total;
}
public String getM_strPercent() {
return m_strPercent;
}
}
| [
"947830193@qq.com"
] | 947830193@qq.com |
9743d9a2422ebcb70e0fa0a87c7af7dec42cbc90 | e50df3b9df4cdbe23c8e91aeba0ccba04aa64c65 | /lib/src/main/java/com/lody/virtual/client/hook/proxies/location/MockLocationHelper.java | f772c7646d4a77a4336e9a5b5a8ffd4920d2a00f | [] | no_license | sudami/VirtualApp10 | 17d093840a2aa36cea7ec12ec4e523fe3c2d2002 | 3d9f1b86b96881121a33ff23b7435881ad2261cb | refs/heads/master | 2022-11-14T21:40:08.182057 | 2020-07-09T07:31:39 | 2020-07-09T07:31:39 | 280,354,929 | 1 | 3 | null | 2020-07-17T07:17:16 | 2020-07-17T07:17:15 | null | UTF-8 | Java | false | false | 10,732 | java | package com.lody.virtual.client.hook.proxies.location;
import android.util.Log;
import com.lody.virtual.client.env.VirtualGPSSatalines;
import com.lody.virtual.client.ipc.VirtualLocationManager;
import com.lody.virtual.helper.utils.Reflect;
import com.lody.virtual.remote.vloc.VLocation;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import mirror.android.location.LocationManager;
public class MockLocationHelper {
public static void invokeNmeaReceived(Object listener) {
if (listener != null) {
VirtualGPSSatalines satalines = VirtualGPSSatalines.get();
try {
VLocation location = VirtualLocationManager.get().getLocation();
if (location != null) {
String date = new SimpleDateFormat("HHmmss:SS", Locale.US).format(new Date());
String lat = getGPSLat(location.latitude);
String lon = getGPSLat(location.longitude);
String latNW = getNorthWest(location);
String lonSE = getSouthEast(location);
String $GPGGA = checksum(String.format("$GPGGA,%s,%s,%s,%s,%s,1,%s,692,.00,M,.00,M,,,", date, lat, latNW, lon, lonSE, satalines.getSvCount()));
String $GPRMC = checksum(String.format("$GPRMC,%s,A,%s,%s,%s,%s,0,0,260717,,,A,", date, lat, latNW, lon, lonSE));
if (LocationManager.GnssStatusListenerTransport.onNmeaReceived != null) {
LocationManager.GnssStatusListenerTransport.onNmeaReceived.call(listener, System.currentTimeMillis(), "$GPGSV,1,1,04,12,05,159,36,15,41,087,15,19,38,262,30,31,56,146,19,*73");
LocationManager.GnssStatusListenerTransport.onNmeaReceived.call(listener, System.currentTimeMillis(), $GPGGA);
LocationManager.GnssStatusListenerTransport.onNmeaReceived.call(listener, System.currentTimeMillis(), "$GPVTG,0,T,0,M,0,N,0,K,A,*25");
LocationManager.GnssStatusListenerTransport.onNmeaReceived.call(listener, System.currentTimeMillis(), $GPRMC);
LocationManager.GnssStatusListenerTransport.onNmeaReceived.call(listener, System.currentTimeMillis(), "$GPGSA,A,2,12,15,19,31,,,,,,,,,604,712,986,*27");
} else if (LocationManager.GpsStatusListenerTransport.onNmeaReceived != null) {
LocationManager.GpsStatusListenerTransport.onNmeaReceived.call(listener, System.currentTimeMillis(), "$GPGSV,1,1,04,12,05,159,36,15,41,087,15,19,38,262,30,31,56,146,19,*73");
LocationManager.GpsStatusListenerTransport.onNmeaReceived.call(listener, System.currentTimeMillis(), $GPGGA);
LocationManager.GpsStatusListenerTransport.onNmeaReceived.call(listener, System.currentTimeMillis(), "$GPVTG,0,T,0,M,0,N,0,K,A,*25");
LocationManager.GpsStatusListenerTransport.onNmeaReceived.call(listener, System.currentTimeMillis(), $GPRMC);
LocationManager.GpsStatusListenerTransport.onNmeaReceived.call(listener, System.currentTimeMillis(), "$GPGSA,A,2,12,15,19,31,,,,,,,,,604,712,986,*27");
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
public static void setGpsStatus(Object locationManager) {
VirtualGPSSatalines satalines = VirtualGPSSatalines.get();
Method setStatus = null;
int svCount = satalines.getSvCount();
float[] snrs = satalines.getSnrs();
int[] prns = satalines.getPrns();
float[] elevations = satalines.getElevations();
float[] azimuths = satalines.getAzimuths();
Object mGpsStatus = Reflect.on(locationManager).get("mGpsStatus");
try {
setStatus = mGpsStatus.getClass().getDeclaredMethod("setStatus", Integer.TYPE, int[].class, float[].class, float[].class, float[].class, Integer.TYPE, Integer.TYPE, Integer.TYPE);
setStatus.setAccessible(true);
int ephemerisMask = satalines.getEphemerisMask();
int almanacMask = satalines.getAlmanacMask();
int usedInFixMask = satalines.getUsedInFixMask();
setStatus.invoke(mGpsStatus, svCount, prns, snrs, elevations, azimuths, ephemerisMask, almanacMask, usedInFixMask);
} catch (Exception e) {
}
if (setStatus == null) {
try {
setStatus = mGpsStatus.getClass().getDeclaredMethod("setStatus", Integer.TYPE, int[].class, float[].class, float[].class, float[].class, int[].class, int[].class, int[].class);
setStatus.setAccessible(true);
svCount = satalines.getSvCount();
int length = satalines.getPrns().length;
elevations = satalines.getElevations();
azimuths = satalines.getAzimuths();
int[] ephemerisMask = new int[length];
for (int i = 0; i < length; i++) {
ephemerisMask[i] = satalines.getEphemerisMask();
}
int[] almanacMask = new int[length];
for (int i = 0; i < length; i++) {
almanacMask[i] = satalines.getAlmanacMask();
}
int[] usedInFixMask = new int[length];
for (int i = 0; i < length; i++) {
usedInFixMask[i] = satalines.getUsedInFixMask();
}
setStatus.invoke(mGpsStatus, svCount, prns, snrs, elevations, azimuths, ephemerisMask, almanacMask, usedInFixMask);
} catch (Exception e) {
e.printStackTrace();
}
}
}
public static void invokeSvStatusChanged(Object transport) {
if (transport != null) {
VirtualGPSSatalines satalines = VirtualGPSSatalines.get();
try {
Class<?> aClass = transport.getClass();
int svCount;
float[] snrs;
float[] elevations;
float[] azimuths;
float[] carrierFreqs;
if (aClass == LocationManager.GnssStatusListenerTransport.TYPE) {
svCount = satalines.getSvCount();
int[] prnWithFlags = satalines.getPrnWithFlags();
snrs = satalines.getSnrs();
elevations = satalines.getElevations();
azimuths = satalines.getAzimuths();
carrierFreqs = new float[0];
} else if (aClass == LocationManager.GpsStatusListenerTransport.TYPE) {
svCount = satalines.getSvCount();
int[] prns = satalines.getPrns();
snrs = satalines.getSnrs();
elevations = satalines.getElevations();
azimuths = satalines.getAzimuths();
int ephemerisMask = satalines.getEphemerisMask();
int almanacMask = satalines.getAlmanacMask();
int usedInFixMask = satalines.getUsedInFixMask();
if (LocationManager.GpsStatusListenerTransport.onSvStatusChanged != null) {
LocationManager.GpsStatusListenerTransport.onSvStatusChanged.call(transport, svCount, prns, snrs, elevations, azimuths, ephemerisMask, almanacMask, usedInFixMask);
} else if (LocationManager.GpsStatusListenerTransportVIVO.onSvStatusChanged != null) {
LocationManager.GpsStatusListenerTransportVIVO.onSvStatusChanged.call(transport, svCount, prns, snrs, elevations, azimuths, ephemerisMask, almanacMask, usedInFixMask, new long[svCount]);
} else if (LocationManager.GpsStatusListenerTransportSumsungS5.onSvStatusChanged != null) {
LocationManager.GpsStatusListenerTransportSumsungS5.onSvStatusChanged.call(transport, svCount, prns, snrs, elevations, azimuths, ephemerisMask, almanacMask, usedInFixMask, new int[svCount]);
} else if (LocationManager.GpsStatusListenerTransportOPPO_R815T.onSvStatusChanged != null) {
int len = prns.length;
int[] ephemerisMasks = new int[len];
for (int i = 0; i < len; i++) {
ephemerisMasks[i] = satalines.getEphemerisMask();
}
int[] almanacMasks = new int[len];
for (int i = 0; i < len; i++) {
almanacMasks[i] = satalines.getAlmanacMask();
}
int[] usedInFixMasks = new int[len];
for (int i = 0; i < len; i++) {
usedInFixMasks[i] = satalines.getUsedInFixMask();
}
LocationManager.GpsStatusListenerTransportOPPO_R815T.onSvStatusChanged.call(transport, svCount, prns, snrs, elevations, azimuths, ephemerisMasks, almanacMasks, usedInFixMasks, svCount);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
private static String getSouthEast(VLocation location) {
if (location.longitude > 0.0d) {
return "E";
}
return "W";
}
private static String getNorthWest(VLocation location) {
if (location.latitude > 0.0d) {
return "N";
}
return "S";
}
public static String getGPSLat(double v) {
int du = (int) v;
double fen = (v - (double) du) * 60.0d;
return du + leftZeroPad((int) fen, 2) + ":" + String.valueOf(fen).substring(2);
}
private static String leftZeroPad(int num, int size) {
return leftZeroPad(String.valueOf(num), size);
}
private static String leftZeroPad(String num, int size) {
StringBuilder sb = new StringBuilder(size);
int i;
if (num == null) {
for (i = 0; i < size; i++) {
sb.append('0');
}
} else {
for (i = 0; i < size - num.length(); i++) {
sb.append('0');
}
sb.append(num);
}
return sb.toString();
}
public static String checksum(String nema) {
String checkStr = nema;
if (nema.startsWith("$")) {
checkStr = nema.substring(1);
}
int sum = 0;
for (int i = 0; i < checkStr.length(); i++) {
sum ^= (byte) checkStr.charAt(i);
}
return nema + "*" + String.format("%02X", sum).toLowerCase();
}
} | [
"hangjun.he@ecarx.com.cn"
] | hangjun.he@ecarx.com.cn |
4483205a24b9ed6e47d1d2137eb302a776cd2212 | b88c67a62d35eca5d7125242346c93ab05b48af4 | /app/src/main/java/com/example/peter/spider/Game/Master.java | 85ba51052be160b4f0d77d8e53688432c17240e9 | [] | no_license | peteu1/Spider | ab8b07b981bac0674c8b69fd19975cd39ecb16bf | 1fa78936b7404c5d18350acfbfd8227d4cb5e9c8 | refs/heads/master | 2021-05-18T21:12:47.041622 | 2020-06-22T21:56:56 | 2020-06-22T21:56:56 | 251,423,563 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 22,069 | java | package com.example.peter.spider.Game;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.util.Log;
import com.example.peter.spider.Game.CardDeck.Card;
import com.example.peter.spider.Game.CardDeck.Const;
import com.example.peter.spider.Game.CardDeck.Deck;
import com.example.peter.spider.Game.CardDeck.Hint;
import com.example.peter.spider.Game.CardDeck.Stack;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Random;
public class Master {
/**
* This class contains the GameMaster and a list of the Stacks
* It holds the list of Stacks, and passes stack objects to the game masters to
* be the main dictator between actions received and updates to the game
*/
private static final String TAG = "Master";
public int difficulty;
private long seed;
private Stack[] stacks; // Holds 10 stacks: 8 in play, 1 unplayed, 1 complete
HistoryTracker historyTracker;
public int textPaintSize;
int screenWidth, screenHeight, non_playing_stack_y, maxStackHeight;
private int stackWidth, cardWidth, cardHeight, stackSpacing, edgeMargin;
private float tappedX, tappedY; // Store initial touch coords to see if screen was tapped
// The following are used to track a moving stack
private Stack movingStack = null;
private int originalStack; // This is the stack where a moving stack was taken from
// Refers to a stack where the arrow was touched to display cards too tall for screen
public int displayFullStack;
// Store and track hints list
ArrayList<Hint> currentHints;
int hintPosition;
Master(int screenWidth, int screenHeight, int difficulty,
HashMap<Integer, Drawable> mStore) {
// Constructor for starting a new game
this.difficulty = difficulty;
this.screenWidth = screenWidth;
this.screenHeight = screenHeight;
generateSeed();
initialize(mStore);
}
Master(int screenWidth, int screenHeight, HashMap<Integer, Drawable> mStore,
ArrayList<String> savedData) {
// Constructor for resuming a saved game
long timeElapsed = 0;
int numMoves = 0;
int score = 0;
boolean lastActionRemove = false;
ArrayList<HistoryObject> history = new ArrayList<HistoryObject>();
// Parse saved data
for (String line : savedData) {
String[] data = line.split(",");
if (data[0].equals("difficulty")) {
this.difficulty = Integer.parseInt(data[1]);
} else if (data[0].equals("seed")) {
this.seed = Long.parseLong(data[1]);
} else if (data[0].equals("timeElapsed")) {
timeElapsed = Long.parseLong(data[1]);
} else if (data[0].equals("numMoves")) {
numMoves = Integer.parseInt(data[1]);
} else if (data[0].equals("lastActionRemove")) {
lastActionRemove = Boolean.parseBoolean(data[1]);
} else if (data[0].equals("score")) {
score = Integer.parseInt(data[1]);
}
else {
// Get history object
HistoryObject ho = new HistoryObject();
int numCards = Integer.parseInt(data[2]);
int from = Integer.parseInt(data[0]);
int to = Integer.parseInt(data[1]);
ho.recordMove(numCards, from, to);
history.add(ho);
}
}
// Re-initialize stacks/etc to initial set-up
this.screenWidth = screenWidth;
this.screenHeight = screenHeight;
initialize(mStore);
// Restore historyTracker and re-create all moves
restoreHistory(history, timeElapsed, numMoves, score, lastActionRemove);
}
private void generateSeed() {
// Generate random seed so exact shuffle can be restored
Random rand = new Random();
this.seed = rand.nextLong();
}
private void initialize(HashMap<Integer, Drawable> mStore) {
// Helper for new -- and restored -- master constructors
if (screenWidth > screenHeight) {
// Landscape
edgeMargin = (int) (screenWidth * Const.EDGE_MARGIN_PCT_LANDSCAPE);
} else {
// Portrait
edgeMargin = (int) (screenWidth * Const.EDGE_MARGIN_PCT);
}
stackWidth = (int) ((screenWidth - edgeMargin*2) / 8);
if (screenWidth > screenHeight) {
// Landscape
stackSpacing = (int) (screenWidth * Const.STACK_SPACING_PCT_LANDSCAPE);
} else {
// Portrait
stackSpacing = (int) (screenWidth * Const.STACK_SPACING_PCT);
}
cardWidth = stackWidth - stackSpacing;
cardHeight = (int) (cardWidth * Const.CARD_WH_RATIO);
non_playing_stack_y = (int) (Const.NON_PLAYING_STACK_Y_PCT * screenHeight);
Deck deck = new Deck(difficulty, seed, mStore);
stacks = deck.dealStacks();
historyTracker = new HistoryTracker();
arrangeStacks();
textPaintSize = (int) (non_playing_stack_y * Const.MENU_PAINT_PCT);
displayFullStack = -1;
currentHints = new ArrayList<>();
hintPosition = -1;
}
public int updateOrientation(int screenWidth, int screenHeight) {
// Called when the screen is rotated, re-arrange stack spacing
this.screenWidth = screenWidth;
this.screenHeight = screenHeight;
if (screenWidth > screenHeight) {
// Landscape
edgeMargin = (int) (screenWidth * Const.EDGE_MARGIN_PCT_LANDSCAPE);
} else {
// Portrait
edgeMargin = (int) (screenWidth * Const.EDGE_MARGIN_PCT);
}
stackWidth = (int) ((screenWidth - edgeMargin*2) / 8);
if (screenWidth > screenHeight) {
// Landscape
stackSpacing = (int) (screenWidth * Const.STACK_SPACING_PCT_LANDSCAPE);
} else {
// Portrait
stackSpacing = (int) (screenWidth * Const.STACK_SPACING_PCT);
}
cardWidth = stackWidth - stackSpacing;
cardHeight = (int) (cardWidth * Const.CARD_WH_RATIO);
non_playing_stack_y = (int) (Const.NON_PLAYING_STACK_Y_PCT * screenHeight);
// Re-arrange stacks with new dimensions
arrangeStacks();
textPaintSize = (int) (non_playing_stack_y * Const.MENU_PAINT_PCT);
return textPaintSize;
}
private void arrangeStacks() {
// Sets the screen location for all the stacks based on screen size
int stackTop = (non_playing_stack_y * 2) + cardHeight;
// Assign location to each of the stacks
double stackLeft = edgeMargin;
for (int j=0; j<8; ++j) {
Stack stack = stacks[j];
stack.assignPosition((int) stackLeft, stackTop, cardWidth);
stackLeft += stackWidth;
}
// Initiate un-played cards and stack locations
int unplayedMargin = (int) (screenWidth * Const.NON_PLAYING_EDGE_MARGIN_PCT);
stacks[8].assignPosition((screenWidth - unplayedMargin), non_playing_stack_y, cardWidth);
stacks[9].assignPosition(unplayedMargin, non_playing_stack_y, cardWidth);
}
void setBottomMenuY(float bottomMenuY) {
// Called from GameView.initPaints(), to know where max stack height is.
maxStackHeight = ((int) bottomMenuY) - cardHeight - (2 * non_playing_stack_y);
// Loop through stacks and update maxHeight
for (Stack s : stacks) {
s.setMaxHeight(maxStackHeight);
}
}
void draw(Canvas canvas) {
/**
* This method is constantly being called
* Every stack draws itself where its supposed to be
*/
for (Stack stack : stacks) {
stack.drawStack(canvas);
}
// Highlight hints
if (hintPosition >= 0) {
Hint hint = currentHints.get(hintPosition);
Stack fromStack = stacks[hint.getFromStack()];
fromStack.drawHint(canvas, hint.getCardsBelow(), false);
Stack toStack = stacks[hint.getToStack()];
toStack.drawHint(canvas, 1, true);
}
if (movingStack != null) {
// Draw moving stack as finger drags
movingStack.drawStack(canvas);
}
}
boolean legalTouch(float x, float y) {
/**
* - Gets called when the screen is touched
* - Finds the card that was touched
* - If the card was legal, movingStack becomes the cards from
* the card touched to the end of the stack. Otherwise movingStack
* remains null.
* @return True if a legal card was touched, False otherwise
*/
// Check if a legal touch was initiated and get card stack
// NOTE: Moving stack has stackId -1
if (displayFullStack >= 0) {
// Stop displaying full stack when screen is touched again
stacks[displayFullStack].showingFullStack = false;
displayFullStack = -1;
}
// Loop through stacks to see if any cards were touched
for (Stack stack : stacks) {
movingStack = stack.touchContained(x, y);
if (movingStack != null) {
if (movingStack.stackId == -2) {
// New cards clicked, add one to end of each stack
return distributeNewCards();
} else {
// Legal move initiated, store coords to check for tap (no click & drag)
movingStack.assignPosition((int) x, (int) y, cardWidth);
originalStack = stack.stackId;
tappedX = x;
tappedY = y;
return true;
}
}
}
return false;
}
void moveStack(float x, float y) {
// Updates position of moving stack while dragging finger
if (movingStack != null) {
movingStack.assignPosition(x, y);
}
}
private int processTap() {
/**
* Called when the screen is tapped. Finds the best stack
* for current movingStack to move to.
* @return the ID of the stack to add current moving stack to
*/
int bestStack = -1;
int bestRating = 0;
Card topCard = movingStack.head;
for (int j=0; j<8; ++j) {
if (j != originalStack) {
Stack stack = stacks[j];
int rating = stack.rateDrop(topCard);
if (rating > bestRating) {
bestStack = j;
bestRating = rating;
}
}
}
if (bestStack >= 0) {
return bestStack;
} else {
return originalStack;
}
}
boolean endStackMotion(float x, float y) {
/**
* This is only called when cards are in motion and touch released
* Checks if valid drop
* Updates moving cards (adds to new stack or reverts to original stack)
* @return true if game was won; false otherwise
*/
int addTo = originalStack; // Indicates which stack id to add moving stack to
// Check if screen was tapped
boolean tapped = false;
if (x == tappedX && y == tappedY) {
addTo = processTap();
tapped = true;
} else {
// Screen was clicked and dragged
int legal = -1;
// TODO: Move 0.25 to Const
x = movingStack.left + ((int) (0.25*stackWidth));
y = movingStack.top;
int topCardValue = movingStack.head.cardValue;
// Find which stack it landed on, and whether move is valid
for (int j=0; j<8; ++j) {
Stack stack = stacks[j];
legal = stack.legalDrop(x, y, topCardValue);
// Lock into place if legal move, else go back to initial location
// -1: wrong stack; 0: right stack, illegal; 1: legal drop
if (legal == 1) {
// Add moving stack to current stack
addTo = j;
j = 8; // break loop
}
else if (legal == 0) {
// Illegal placement: restore moving stack to original stack
j = 8; // break loop
}
// else, didn't land here, keep looping
}
}
return updateStacks(addTo, tapped);
}
private boolean updateStacks(int newStackIdx, boolean showAnimation) {
/**
* - Called after finger is released (endStackMotion).
* - Current moving stack is added to the specified stack.
* - Logic for the move has already been checked, so just update
* the stacks and record the move if new stack is different from
* original.
* @param showAnimation (boolean): when stack is tapped, animate stack motion
* @return true if game is over; false otherwise.
*/
Stack completedStack = stacks[newStackIdx].addStack(movingStack);
// Move completed stack to stacks[9] if full stack was made
if (completedStack != null) {
stacks[9].addStack(completedStack);
if (stacks[9].getNumCards() == 52) {
movingStack = null;
return true;
}
}
if (newStackIdx != originalStack) {
// Add move to history if legal
HistoryObject move = new HistoryObject();
move.recordMove(movingStack.head.cardsBelow(), originalStack, newStackIdx);
if (completedStack != null) {
move.completedStackIds.add(newStackIdx);
}
// Flip over newly revealed card
boolean cardFlipped = stacks[originalStack].flipBottomCard();
move.cardRevealed = cardFlipped;
move.computeScore(historyTracker.getMillisElapsed());
historyTracker.record(move);
}
hintPosition = -1;
movingStack = null;
return false;
}
public boolean arrowTouched(float x, float y) {
// Checks if the arrow above any stacks that are too tall was pressed
for (Stack stack : stacks) {
if (stack.arrowTouched(x, y)) {
displayFullStack = stack.stackId;
return true;
}
}
return false;
}
private boolean distributeNewCards() {
/**
* When a new set of cards is clicked in the top-right, 8 un-played
* cards are taken and distributed: 1 to each of the in-play stacks.
* @return true if cards were distributed;
* false if no un-played cards left.
*/
HistoryObject move = new HistoryObject();
Card currentCard = movingStack.head;
Card nextCard;
for (int i=0; i<8; ++i) {
nextCard = currentCard.next; // Save next card
currentCard.next = null;
Stack completedStack = stacks[i].addCard(currentCard);
// Move stack if a complete stack was made
if (completedStack != null) {
// Completed stack was created
stacks[9].addStack(completedStack);
// Record which stack was completed in history
move.completedStackIds.add(i);
}
currentCard = nextCard;
}
move.recordMove(8, 8, -3);
historyTracker.record(move);
movingStack = null;
hintPosition = -1;
return false; // NOTE: return false because cards aren't in motion
}
private boolean getHints() {
/**
* Create list of hints
* @return emptySpace: whether there are any empty spaces available
*/
currentHints = new ArrayList<>();
boolean emptySpace = false;
for (int i=0; i<8; ++i) {
Stack fromStack = stacks[i];
// For each stack, get highest card that can be moved
Card card = fromStack.getTopMovableCard();
if (card == null) {
continue;
}
// Loop through other stacks to see where card can go
for (int j=0; j<8; ++j) {
if (i == j) {
continue;
}
int rating = stacks[j].rateDrop(card);
if (rating > 2) {
Hint h = new Hint(i, j, card, rating);
currentHints.add(h);
} else if (rating == 1) {
// Empty space available
Log.e(TAG, "Rating 1");
emptySpace = true;
}
}
}
return emptySpace;
}
String showHint() {
/**
* Called from GameView when hint button is clicked
* @ return gets Toasted by GameView; null if hints are available
*/
Log.e(TAG, "Number of hints: " + currentHints.size());
Log.e(TAG, "Hint pos: " + hintPosition);
if (hintPosition < 0) {
// Create/update list of hints
boolean emptySpace = getHints();
if (currentHints.size() == 0) {
// Use empty space
if (emptySpace) {
Log.e(TAG, "Empty Space");
// TODO: Highlight empty space
return "Empty Space Available";
}
// Check if any un-played cards
if (stacks[8].head != null) {
// TODO: Highlight stacks
return "Draw new stack";
}
return "No Suggestions";
}
// Sort on rating, then number of cards being moved
Collections.sort(currentHints, (h1, h2) -> {
if (h1.getRating() != h2.getRating()) {
return h2.getRating() - h1.getRating();
}
return h2.getCardsBelow() - h1.getCardsBelow();
});
hintPosition = 0;
} else {
// increment hint position
hintPosition++;
if (hintPosition >= currentHints.size()) {
hintPosition = 0;
}
}
return null;
}
boolean undo() {
// Un-does a move when undo is clicked
hintPosition = -1;
if (historyTracker.isEmpty()) {
return false;
}
HistoryObject move = historyTracker.pop();
// First, revert stacks that were completed (if any)
for (int i=0; i<move.completedStackIds.size(); ++i) {
int stackId = move.completedStackIds.get(i);
// remove bottom 13 cards from completed stack
Stack newStack = stacks[9].removeStack(13);
// add back to original stack
stacks[stackId].replaceStack(newStack);
}
if (move.originalStack != 8) {
// Remove moved stack from the destination
Stack origStack = stacks[move.newStack].removeStack(move.numCards);
// Re-hide revealed card on original stack
if (move.cardRevealed) {
stacks[move.originalStack].head.bottomCard().hidden = true;
}
// Add back to original stack
stacks[move.originalStack].addStack(origStack);
}
else {
// Undo distribute cards
Card head = stacks[0].removeBottomCard();
// Remove bottom card from all playing stacks
Card next = head;
for (int i=1; i<8; ++i) {
next.next = stacks[i].removeBottomCard();
next = next.next;
}
// Add cards back to un-played stack
Stack replaceStack = new Stack(-3, head);
stacks[8].addStack(replaceStack);
}
return true;
}
// Methods for saving data and restoring saved game state
ArrayList<String> getGameState() {
/**
* Compiles all game information necessary to re-create current game state.
* - Information is stored in the file: GameView.GAME_STATE_FILE_NAME
* - Game state will be restored when app is quit and user pressed "Resume"
* from the main menu.
* Fields:
* (1 value): difficulty, seed, timeElapsed, numMoves, lastActionRemove
* history fields: from,to,numCards
*/
// Stop any cards in motion
if (movingStack != null) {
endStackMotion(-9999, -9999);
}
ArrayList<String> data = new ArrayList<String>();
data.add("difficulty," + difficulty);
data.add("seed," + seed);
data = historyTracker.storeState(data);
return data;
}
private void restoreHistory(ArrayList<HistoryObject> history, long timeElapsed,
int numMoves, int score, boolean lastActionRemove) {
/**
* Restores game to saved game state by looping through all moves in history
* and re-doing them. Also restores historyTracker to previous state.
*/
// Loop backwards because most recent move first
for (int i=history.size()-1; i>=0; --i) {
HistoryObject move = history.get(i);
originalStack = move.originalStack;
movingStack = stacks[originalStack].removeStack(move.numCards);
if (move.originalStack == 8) {
distributeNewCards();
} else {
updateStacks(move.newStack, false);
}
}
// Restores time elapsed, numMoves in historyTracker
Log.e(TAG, "Restoring history, numMoves = " + numMoves);
historyTracker.restoreProperties(timeElapsed, numMoves, score, lastActionRemove);
}
}
| [
"peteu@vt.edu"
] | peteu@vt.edu |
1f0e73d16349009e32a82473b4e2c398575469a6 | 31d4d2f4670b7fb0510c32083b488cee3201c1df | /src/main/java/cn/com/shangyi/api/paint/service/impl/PaintServiceImpl.java | 71497f785f2f207a1f032f73ff498481a7d207ce | [] | no_license | cuiguanghe/ShangYi | b6753b031302fd0d00ec741f602e5547eac066ee | d3563076458d51059a61caa7f4b78ba81cbca233 | refs/heads/master | 2020-06-05T20:59:31.549780 | 2014-11-07T05:53:01 | 2014-11-07T05:53:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 367 | java | package cn.com.shangyi.api.paint.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.com.shangyi.api.paint.dao.PaintDAO;
import cn.com.shangyi.api.paint.service.PaintService;
@Service
public class PaintServiceImpl implements PaintService {
@Autowired
private PaintDAO paintDao;
}
| [
"1115425699@qq.com"
] | 1115425699@qq.com |
c97cd59b8f74096da3774b8f90d9007051bb3dc5 | 57607e93decc0c8d6564402fe80fed85f7c36c10 | /AlgoAndDS/src/com/implement/multithreading/distributed/producers/CoffeeProducer.java | f766f000b5c35417face34ff8215758ea966887e | [] | no_license | ashutosh16/Practice | 59e7b174b1b254a0262b6292f4e8d74f59b004e5 | 7f77a7e301e21d62ae52fb228fd00aae158e8d48 | refs/heads/master | 2023-06-15T06:56:06.027589 | 2021-07-13T17:40:07 | 2021-07-13T17:40:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 846 | java | package com.implement.multithreading.distributed.producers;
import com.implement.multithreading.distributed.model.OrderQueue;
public class CoffeeProducer implements Runnable {
protected OrderQueue<String> queue = null;
protected String name;
public CoffeeProducer(OrderQueue<String> queue) {
this.queue = queue;
}
public void run() {
try {
Thread.currentThread().setName("coffee-producer");
System.out.println(Thread.currentThread().getName()
+ ": Started and creating orders...");
for (int i = 1; i < 11; i++) {
queue.getQueue().put("# " + i);
Thread.sleep(500);
}
Thread.sleep(2000);
for (int i = 11; i < 16; i++) {
queue.getQueue().put("# " + i);
Thread.sleep(500);
}
queue.getQueue().put("#");
} catch (InterruptedException e) {
e.printStackTrace();
}
}
} | [
"kapil.sadhwani@spacetimeinsight.com"
] | kapil.sadhwani@spacetimeinsight.com |
7aa1d30b73818ae693e87c56dbec746158644a56 | 8efa2aacaf2ec548ea8da52f7fadc52b207b1072 | /src/com/crowdscanner/controller/CrowdScannerNavigationMobile.java | af74d6b4ad7f889773c2f71231c17fb983b7e4d5 | [] | no_license | amonter/backend_peoplehunt | f4a44e0b3d81eec749d75a1680810c6c1074232e | 9e356388b3bab37dd3bce7839d8e1481697d381d | refs/heads/master | 2021-01-10T22:44:42.376510 | 2016-10-08T23:07:52 | 2016-10-08T23:07:52 | 70,361,948 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,401 | java | package com.crowdscanner.controller;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class CrowdScannerNavigationMobile {
@RequestMapping(value="/mobile", method=RequestMethod.GET)
public String renderFrontPageMobile(HttpServletRequest request, ModelMap model) {
model.addAttribute("title", "CrowdScanner");
return "front_mobile";
}
@RequestMapping(value="/mobile/aboutus", method=RequestMethod.GET)
public String renderAboutusMobile(ModelMap model) {
return "aboutus_mobile";
}
@RequestMapping(value="/mobile/howitworks", method=RequestMethod.GET)
public String renderHowtoUse(ModelMap model) {
return "howitworks_mobile";
}
@RequestMapping(value="/mobile/howtouse", method=RequestMethod.GET)
public String howtouse(ModelMap model) {
return "howtouse_mobile";
}
@RequestMapping(value="/mobile/jobs", method=RequestMethod.GET)
public String jobs(ModelMap model) {
return "jobs_mobile";
}
@RequestMapping(value="/mobile/peoplehunt", method=RequestMethod.GET)
public String peoplehunt(ModelMap model) {
return "peoplehunt_mobile";
}
}
| [
"adriano@Adrians-MacBook-Pro-2.local"
] | adriano@Adrians-MacBook-Pro-2.local |
c546ef83efc94f176a7d1d815a113cbaf7cc836b | e0a65c63e007fbfa534cff1db9212bc6a869a333 | /src/StringtoIntger.java | 6e20818097c0cbe72dc139b3b2e6a87de8cf37b3 | [] | no_license | mashique/Test | 4e39ce569cc8aff20f74453925f0fa65226b6383 | 8d3240fb66e21f1fb7184a30ea79e1d9b9a17f86 | refs/heads/master | 2022-10-09T00:22:21.593397 | 2020-06-02T19:18:55 | 2020-06-02T19:18:55 | 268,883,661 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 241 | java |
public class StringtoIntger {
public static void main(String[] args) {
String str ="65";
int x = Integer.parseInt(str);
System.out.println(x);
System.out.println(str);
System.out.println(String.valueOf(x));
}
}
| [
"ashique299@yahoo.com"
] | ashique299@yahoo.com |
74319acf9d418d838bf642e38dd78a5806840470 | 1c7451bc65ea7f393f825ca99aaf16b7177e2b29 | /MensagensSemanais/src/mensagenssemanais/Mensagem.java | 6677d0d440a5a5ef48c894819bd6afe3ce57fd48 | [] | no_license | Weidecj/padroes-projeto-atividades | 655fc2a5d483b2839259a8f4b56d2c6904beebf1 | b7a8d0f0c2a0316f8ddf2bd3d84fe8d9b1367283 | refs/heads/master | 2021-01-19T13:47:15.387769 | 2017-05-04T00:14:13 | 2017-05-04T00:14:13 | 88,109,130 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 526 | java | package mensagenssemanais;
public class Mensagem {
private String dia;
private String mensagem;
public Mensagem(String dia, String mensagem){
this.dia = dia;
this.mensagem = mensagem;
}
public void setDia(String dia){
this.dia = dia;
}
public String getDia(){
return this.dia;
}
public void setMensagem(String mensagem){
this.mensagem = mensagem;
}
public String getMensagem(){
return this.mensagem;
}
}
| [
"00715111213@JIPA-LABIN05-21.ifro.local"
] | 00715111213@JIPA-LABIN05-21.ifro.local |
a3998ef3eb93d4e615ad419adced1d9332e28c4a | 6253283b67c01a0d7395e38aeeea65e06f62504b | /decompile/app/SystemUI/src/main/java/com/fyusion/sdk/common/ext/filter/a/l.java | 4cdfede10cc7324df0ada5b12bb7a9a531924cd8 | [] | no_license | sufadi/decompile-hw | 2e0457a0a7ade103908a6a41757923a791248215 | 4c3efd95f3e997b44dd4ceec506de6164192eca3 | refs/heads/master | 2023-03-15T15:56:03.968086 | 2017-11-08T03:29:10 | 2017-11-08T03:29:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,140 | java | package com.fyusion.sdk.common.ext.filter.a;
import com.fyusion.sdk.common.ext.filter.BlockFilter;
import com.fyusion.sdk.common.ext.filter.ImageFilter;
import com.fyusion.sdk.common.t;
import fyusion.vislib.BuildConfig;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;
/* compiled from: Unknown */
public class l {
s a = new s();
public boolean b = true;
public boolean c = true;
private Map<Integer, ImageFilter> d = new TreeMap();
private boolean e = true;
private int f;
private int g;
private t h = new t();
private String a(int i, String str) {
return "highp vec4 applyFilter" + i + " (highp vec4 input_color, highp vec2 texture_coordinate)" + "{" + str + "}";
}
private String a(ImageFilter imageFilter, String str, String str2) {
return (imageFilter.isEnabled() && str2 != null) ? str + str2 : str;
}
private String b(int i) {
return "color = applyFilter" + i + " (color, texture_coordinate);";
}
public int a() {
return this.g;
}
void a(int i) {
for (a aVar : this.d.values()) {
if (aVar.isEnabled()) {
aVar.a(i);
}
}
}
public void a(t tVar) {
this.h = tVar;
this.f = this.h.e();
this.g = this.h.f();
for (a aVar : this.d.values()) {
if (aVar.isEnabled() && (aVar instanceof BlockFilter)) {
((BlockFilter) aVar).setTextureContainer(this.h);
}
}
}
public void a(Collection<ImageFilter> collection) {
for (ImageFilter imageFilter : collection) {
this.d.put(Integer.valueOf(imageFilter.getLayer()), imageFilter);
}
}
public void a(o[] oVarArr, boolean z) {
int i = -99;
if (!z) {
i = oVarArr[0].b;
}
int i2 = i;
o oVar = new o(oVarArr[0]);
if (!(oVarArr[1] == null || oVarArr[1].b == i2)) {
oVarArr[1].b();
}
oVarArr[1] = new o(oVarArr[0]);
o[] oVarArr2 = new o[]{oVar, oVarArr[1]};
for (a a : this.d.values()) {
a.a(oVarArr2, oVarArr2[0].b != i2, this.a);
oVarArr2[0].a(oVarArr2[1]);
}
oVarArr[1].a(oVarArr2[0]);
if (!(oVarArr2[1] == null || oVarArr2[1].b == i2 || oVarArr2[1].b == oVarArr[1].b)) {
oVarArr2[1].b();
}
if (oVarArr[0].b != i2 && oVarArr[0].b != oVarArr[1].b) {
oVarArr[0].b();
}
}
public int b() {
return this.f;
}
public synchronized boolean c() {
return this.e;
}
public Collection<ImageFilter> d() {
return !c() ? Collections.emptyList() : Collections.unmodifiableCollection(this.d.values());
}
void e() {
for (a aVar : this.d.values()) {
if (aVar.isEnabled()) {
aVar.a = this.b;
aVar.b = this.c;
aVar.a();
}
}
this.b = false;
}
void f() {
for (a aVar : this.d.values()) {
if (aVar.isEnabled()) {
aVar.b();
}
}
}
public String g() {
String str = BuildConfig.FLAVOR;
Iterator it = this.d.values().iterator();
while (true) {
String str2 = str;
if (!it.hasNext()) {
return str2;
}
a aVar = (a) it.next();
str = a(aVar, str2, aVar.d());
}
}
public String h() {
String str = BuildConfig.FLAVOR;
Iterator it = this.d.values().iterator();
while (true) {
String str2 = str;
if (!it.hasNext()) {
return str2;
}
a aVar = (a) it.next();
str = a(aVar, str2, aVar.e());
}
}
public String i() {
String str = BuildConfig.FLAVOR;
Iterator it = this.d.values().iterator();
while (true) {
String str2 = str;
if (!it.hasNext()) {
return str2;
}
a aVar = (a) it.next();
str = a(aVar, str2, aVar.f());
}
}
public String j() {
String str = BuildConfig.FLAVOR;
Iterator it = this.d.values().iterator();
while (true) {
String str2 = str;
if (!it.hasNext()) {
return str2;
}
a aVar = (a) it.next();
str = a(aVar, str2, a(aVar.getLayer() + 1, aVar.g()));
}
}
String k() {
String str = BuildConfig.FLAVOR;
Iterator it = this.d.values().iterator();
while (true) {
String str2 = str;
if (!it.hasNext()) {
return str2;
}
a aVar = (a) it.next();
str = a(aVar, str2, b(aVar.getLayer() + 1));
}
}
public void l() {
for (a aVar : this.d.values()) {
if (aVar.isEnabled()) {
aVar.h();
}
}
}
}
| [
"liming@droi.com"
] | liming@droi.com |
e39d00d88bba74fd6212b5f0f5035bafe81a2b94 | 73458087c9a504dedc5acd84ecd63db5dfcd5ca1 | /src/jcifs/dcerpc/DcerpcBinding.java | 2abd9dc297446b32b6f193917f11d16b02bf73c0 | [] | no_license | jtap60/com.estr | 99ff2a6dd07b02b41a9cc3c1d28bb6545e68fb27 | 8b70bf2da8b24c7cef5973744e6054ef972fc745 | refs/heads/master | 2020-04-14T02:12:20.424436 | 2018-12-30T10:56:45 | 2018-12-30T10:56:45 | 163,578,360 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,638 | java | package jcifs.dcerpc;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
import jcifs.dcerpc.msrpc.lsarpc;
import jcifs.dcerpc.msrpc.netdfs;
import jcifs.dcerpc.msrpc.samr;
import jcifs.dcerpc.msrpc.srvsvc;
public class DcerpcBinding
{
private static HashMap INTERFACES = new HashMap();
String endpoint = null;
int major;
int minor;
HashMap options = null;
String proto;
String server;
UUID uuid = null;
static
{
INTERFACES.put("srvsvc", srvsvc.getSyntax());
INTERFACES.put("lsarpc", lsarpc.getSyntax());
INTERFACES.put("samr", samr.getSyntax());
INTERFACES.put("netdfs", netdfs.getSyntax());
}
DcerpcBinding(String paramString1, String paramString2)
{
proto = paramString1;
server = paramString2;
}
public static void addInterface(String paramString1, String paramString2)
{
INTERFACES.put(paramString1, paramString2);
}
Object getOption(String paramString)
{
if (paramString.equals("endpoint")) {
return endpoint;
}
if (options != null) {
return options.get(paramString);
}
return null;
}
void setOption(String paramString, Object paramObject)
{
if (paramString.equals("endpoint"))
{
endpoint = paramObject.toString().toLowerCase();
if (endpoint.startsWith("\\pipe\\"))
{
paramString = (String)INTERFACES.get(endpoint.substring(6));
if (paramString != null)
{
int i = paramString.indexOf(':');
int j = paramString.indexOf('.', i + 1);
uuid = new UUID(paramString.substring(0, i));
major = Integer.parseInt(paramString.substring(i + 1, j));
minor = Integer.parseInt(paramString.substring(j + 1));
return;
}
}
throw new DcerpcException("Bad endpoint: " + endpoint);
}
if (options == null) {
options = new HashMap();
}
options.put(paramString, paramObject);
}
public String toString()
{
String str = proto + ":" + server + "[" + endpoint;
Object localObject1 = str;
if (options != null)
{
Iterator localIterator = options.keySet().iterator();
for (;;)
{
localObject1 = str;
if (!localIterator.hasNext()) {
break;
}
localObject1 = localIterator.next();
Object localObject2 = options.get(localObject1);
str = str + "," + localObject1 + "=" + localObject2;
}
}
return (String)localObject1 + "]";
}
}
/* Location:
* Qualified Name: jcifs.dcerpc.DcerpcBinding
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"reverseengineeringer@hackeradmin.com"
] | reverseengineeringer@hackeradmin.com |
4136c92d9bc73033114576a29957874b65951c24 | 7784ef372e1be8a208362fd2675278ef08393687 | /Hope/src/com/ada/factory/DateFormatFactory.java | 78eb9d30361605b9b9822df611cc2400f732e2f6 | [] | no_license | lchcoming/cng1985 | df8eb473ecf6e8d716cd2936c16a60ab718c2c11 | d122b878b9aa3c242f3d12d2ce65761f09666b6d | refs/heads/master | 2016-09-05T12:07:03.838786 | 2011-08-31T00:53:05 | 2011-08-31T00:53:05 | 41,707,910 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,156 | java | package com.ada.factory;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Locale;
/**
* 字母 日期或时间元素 表示 示例 G Era 标志符 Text AD y 年 Year 1996; 96 M 年中的月份 Month July; Jul;
* 07 w 年中的周数 Number 27 W 月份中的周数 Number 2 D 年中的天数 Number 189 d 月份中的天数 Number 10
* F 月份中的星期 Number 2 E 星期中的天数 Text Tuesday; Tue a Am/pm 标记 Text PM H
* 一天中的小时数(0-23) Number 0 k 一天中的小时数(1-24) Number 24 K am/pm 中的小时数(0-11) Number 0
* h am/pm 中的小时数(1-12) Number 12 m 小时中的分钟数 Number 30 s 分钟中的秒数 Number 55 S 毫秒数
* Number 978 z 时区 General time zone Pacific Standard Time; PST; GMT-08:00 Z 时区
* RFC 822 time zone -0800
*/
public class DateFormatFactory {
private DateFormatFactory() {
}
/**
* yyyy年MM月dd号 HH点mm分ss秒
*/
public static DateFormat createChineseDate() {
SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd号HH点mm分ss秒",Locale.CHINA);
return format;
}
}
| [
"cng1985@4a583d68-532f-11de-8b28-e1b452efc53a"
] | cng1985@4a583d68-532f-11de-8b28-e1b452efc53a |
d6e733eeb42dab6011196f2fd39f2349453542ce | c101573897c6e8f9117c65218a8f0f9815804ea3 | /UI/app/src/main/java/com/example/helperapp/User.java | cc5f681db59449b8e853cc739bf07be49bfc372d | [] | no_license | huukhangapcs/MidtermProject | 9e822efb7fe8249479a7f29dfd4c64bfd57a7eb8 | ce3418d4b6a0e4c027b30196dce37c3c68abb198 | refs/heads/master | 2022-12-08T08:14:57.091016 | 2020-08-23T06:56:55 | 2020-08-23T06:56:55 | 289,162,869 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 456 | java | package com.example.helperapp;
public class User {
String name;
String email;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String email() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public User(String name, String email) {
this.name = name;
this.email = email;
}
} | [
"51012277+longcualonglonglong11@users.noreply.github.com"
] | 51012277+longcualonglonglong11@users.noreply.github.com |
b70401cac8c2f858ab0cb398cfa39aeda0a5444b | 6a77a6b5fbc5c6322bd9d8d1e1d317d0a53879ee | /src/main/java/com/jk/service/test/TestServiceImpl.java | ac7d951fb9049580787401deac357aa4c91e1c48 | [] | no_license | 15510229796/feign-demo1 | f607630547ca35f6f617c0faca996cb0c2e0b1dc | 48ca3ebbc97813293295315173a226be26fbd67d | refs/heads/master | 2021-09-09T06:52:11.560104 | 2018-03-14T06:03:19 | 2018-03-14T06:03:19 | 124,530,004 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 376 | java | package com.jk.service.test;
import com.jk.mapper.TestMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class TestServiceImpl implements TestService {
@Autowired
private TestMapper testMapper;
@Override
public int getCount() {
return testMapper.getCount();
}
}
| [
"gaos_wan@126.com"
] | gaos_wan@126.com |
d7f89c8da0ef1b3255ed7b1d62d88a92691a01ed | 81f3a5c83d19baa3e3f6247bc553c0d9640b1339 | /src/test/java/com/emmardo/p5/medicalrecord/MedicalRecordServiceTest.java | 7e314d2def22715c9ff43ccb3439093c5657f459 | [] | no_license | emmardo/P5_Ricardo_Diaz_Cornejo | fb2092c8ac2596308ca14c991a8814fc7d60f116 | a02e143a10dac1d321a868da4403fc76c2e6eaba | refs/heads/master | 2022-06-02T05:24:54.716795 | 2020-03-18T18:16:16 | 2020-03-18T18:16:16 | 230,342,826 | 0 | 1 | null | 2022-05-20T21:19:24 | 2019-12-26T23:51:49 | Java | UTF-8 | Java | false | false | 13,224 | java | package com.emmardo.p5.medicalrecord;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.*;
public class MedicalRecordServiceTest {
private MedicalRecordRepository repository;
private MedicalRecordService service;
@Before
public void setup() {
repository = new MedicalRecordRepository();
service = new MedicalRecordService(repository);
String firstName1 = "Fulano";
String lastName1 = "Mengano";
String birthDate1 = "11/09/2002";
List<String> medications1 = new ArrayList<>();
List<String> allergies1 = new ArrayList<>();
medications1.add("Medication1");
medications1.add("Medication2");
allergies1.add("Allergy1");
allergies1.add("Allergy2");
String firstName2 = "John";
String lastName2 = "Doe";
String birthDate2 = "11/09/1901";
List<String> medications2 = new ArrayList<>();
List<String> allergies2 = new ArrayList<>();
medications2.add("MedicationA");
medications2.add("MedicationB");
allergies2.add("AllergyA");
allergies2.add("AllergyB");
MedicalRecord medicalRecord1 = new MedicalRecord(firstName1, lastName1, birthDate1, medications1, allergies1);
MedicalRecord medicalRecord2 = new MedicalRecord(firstName2, lastName2, birthDate2, medications2, allergies2);
repository.createMedicalRecord(medicalRecord1);
repository.createMedicalRecord(medicalRecord2);
}
@Test
public void getAllMedicalRecords() {
//Arrange in setup
//Act
List<MedicalRecord> records = service.getAllMedicalRecords();
//Assert
assertEquals(2, records.size());
}
@Test
public void getMedicalRecord_MedicalRecordExists_MedicalRecordReturned() {
//Arrange
//Act
MedicalRecord record = service.getMedicalRecord("Fulano", "Mengano");
//Arrange
assertEquals("11/09/2002", record.getBirthdate());
}
@Test
public void getMedicalRecord_FirstNameError_NothingHappens() {
//Arrange
//Act
MedicalRecord record = service.getMedicalRecord("Heike", "Mengano");
//Arrange
assertTrue(record.getFirstName().isEmpty());
}
@Test
public void getMedicalRecord_LastNameError_NothingHappens() {
//Arrange
//Act
MedicalRecord record = service.getMedicalRecord("Fulano", "Meyer");
//Arrange
assertTrue(record.getFirstName().isEmpty());
}
@Test
public void getMedicalRecord_MedicalRecordNonexistent_NothingHappens() {
//Arrange
//Act
MedicalRecord record = service.getMedicalRecord("Heike", "Meyer");
//Arrange
assertTrue(record.getFirstName().isEmpty());
}
@Test
public void createMedicalRecord_PersonNonexistent_MedicalRecordCreated() {
//Arrange
String firstName = "Heike";
String lastName = "Meyer";
String birthDate = "01/01/2000";
List<String> medications = new ArrayList<>();
List<String> allergies = new ArrayList<>();
MedicalRecord medicalRecord = new MedicalRecord(firstName, lastName, birthDate, medications, allergies);
assertEquals(2, service.getAllMedicalRecords().size());
//Act
service.createMedicalRecord(medicalRecord);
MedicalRecord record = service.getMedicalRecord("Heike", "Meyer");
//Arrange
assertEquals(3, service.getAllMedicalRecords().size());
assertEquals(birthDate, record.getBirthdate());
}
@Test
public void createMedicalRecord_FirstNameAlreadyExistst_MedicalRecordCreated() {
//Arrange
String firstName = "Fulano";
String lastName = "Meyer";
String birthDate = "01/01/2000";
List<String> medications = new ArrayList<>();
List<String> allergies = new ArrayList<>();
MedicalRecord medicalRecord = new MedicalRecord(firstName, lastName, birthDate, medications, allergies);
assertEquals(2, service.getAllMedicalRecords().size());
//Act
service.createMedicalRecord(medicalRecord);
MedicalRecord record = service.getMedicalRecord("Fulano", "Meyer");
//Arrange
assertEquals(3, service.getAllMedicalRecords().size());
assertEquals(birthDate, record.getBirthdate());
}
@Test
public void createMedicalRecord_LastNameAlreadyExistst_MedicalRecordCreated() {
//Arrange
String firstName = "Heike";
String lastName = "Mengano";
String birthDate = "01/01/2000";
List<String> medications = new ArrayList<>();
List<String> allergies = new ArrayList<>();
MedicalRecord medicalRecord = new MedicalRecord(firstName, lastName, birthDate, medications, allergies);
assertEquals(2, service.getAllMedicalRecords().size());
//Act
service.createMedicalRecord(medicalRecord);
MedicalRecord record = service.getMedicalRecord("Heike", "Mengano");
//Arrange
assertEquals(3, service.getAllMedicalRecords().size());
assertEquals(birthDate, record.getBirthdate());
}
@Test
public void createMedicalRecord_MedicalRecordAlreadyExistst_NothingHappens() {
//Arrange
String firstName = "Fulano";
String lastName = "Mengano";
String birthDate = "11/09/2001";
List<String> medications = new ArrayList<>();
List<String> allergies = new ArrayList<>();
MedicalRecord medicalRecord = new MedicalRecord(firstName, lastName, birthDate, medications, allergies);
assertEquals(2, service.getAllMedicalRecords().size());
//Act
service.createMedicalRecord(medicalRecord);
//Arrange
assertEquals(2, service.getAllMedicalRecords().size());
}
@Test
public void updateMedicalRecord_MedicalRecordExists_MedicalRecordUpdated() {
//Arrange
String firstName = "Fulano";
String lastName = "Mengano";
String newBirthDate = "01/01/2000";
List<String> newMedications = new ArrayList<>();
List<String> newAllergies = new ArrayList<>();
String firstMedication = "MedicationI";
String secondMedication = "MedicationII";
String firstAllergy = "Allergy.";
String secondAllergy = "Allergy..";
newMedications.add(firstMedication);
newMedications.add(secondMedication);
newAllergies.add(firstAllergy);
newAllergies.add(secondAllergy);
MedicalRecord medicalRecord = new MedicalRecord(firstName, lastName, newBirthDate, newMedications, newAllergies);
assertEquals("11/09/2002", service.getMedicalRecord(firstName, lastName).getBirthdate());
//Act
service.updateMedicalRecord(medicalRecord);
MedicalRecord record = service.getMedicalRecord(firstName, lastName);
//Arrange
assertEquals(newBirthDate, record.getBirthdate());
assertEquals(secondMedication, service.getMedicalRecord(firstName, lastName).getMedications().get(1));
assertEquals(firstAllergy, service.getMedicalRecord(firstName, lastName).getAllergies().get(0));
}
@Test
public void updateMedicalRecord_FirstNameError_NothingHappens() {
//Arrange
String firstName = "Heike";
String lastName = "Mengano";
String newBirthDate = "01/01/2000";
List<String> newMedications = new ArrayList<>();
List<String> newAllergies = new ArrayList<>();
String firstMedication = "MedicationI";
String secondMedication = "MedicationII";
String firstAllergy = "Allergy.";
String secondAllergy = "Allergy..";
newMedications.add(firstMedication);
newMedications.add(secondMedication);
newAllergies.add(firstAllergy);
newAllergies.add(secondAllergy);
MedicalRecord medicalRecord = new MedicalRecord(firstName, lastName, newBirthDate, newMedications, newAllergies);
assertEquals("11/09/2002", service.getMedicalRecord("Fulano", "Mengano").getBirthdate());
//Act
service.updateMedicalRecord(medicalRecord);
MedicalRecord record = service.getMedicalRecord("Fulano", "Mengano");
//Arrange
assertNotEquals(newBirthDate, record.getBirthdate());
assertNull(service.getMedicalRecord("Fulano", "Mengano").getAllergy(firstAllergy));
assertNull(service.getMedicalRecord("Fulano", "Mengano").getMedication(secondMedication));
}
@Test
public void updateMedicalRecord_LastNameError_NothingHappens() {
//Arrange
String firstName = "Fulano";
String lastName = "Meyer";
String newBirthDate = "01/01/2000";
List<String> newMedications = new ArrayList<>();
List<String> newAllergies = new ArrayList<>();
String firstMedication = "MedicationI";
String secondMedication = "MedicationII";
String firstAllergy = "Allergy.";
String secondAllergy = "Allergy..";
newMedications.add(firstMedication);
newMedications.add(secondMedication);
newAllergies.add(firstAllergy);
newAllergies.add(secondAllergy);
MedicalRecord medicalRecord = new MedicalRecord(firstName, lastName, newBirthDate, newMedications, newAllergies);
assertEquals("11/09/2002", service.getMedicalRecord("Fulano", "Mengano").getBirthdate());
//Act
service.updateMedicalRecord(medicalRecord);
MedicalRecord record = service.getMedicalRecord("Fulano", "Mengano");
//Arrange
assertNotEquals(newBirthDate, record.getBirthdate());
assertNull(service.getMedicalRecord("Fulano", "Mengano").getAllergy(firstAllergy));
assertNull(service.getMedicalRecord("Fulano", "Mengano").getMedication(secondMedication));
}
@Test
public void updateMedicalRecord_MedicalRecordInexistent_NothingHappens() {
//Arrange
String firstName = "Heike";
String lastName = "Meyer";
String newBirthDate = "01/01/2000";
List<String> newMedications = new ArrayList<>();
List<String> newAllergies = new ArrayList<>();
String firstMedication = "MedicationI";
String secondMedication = "MedicationII";
String firstAllergy = "Allergy.";
String secondAllergy = "Allergy..";
newMedications.add(firstMedication);
newMedications.add(secondMedication);
newAllergies.add(firstAllergy);
newAllergies.add(secondAllergy);
MedicalRecord medicalRecord = new MedicalRecord(firstName, lastName, newBirthDate, newMedications, newAllergies);
assertEquals("11/09/2002", service.getMedicalRecord("Fulano", "Mengano").getBirthdate());
//Act
service.updateMedicalRecord(medicalRecord);
MedicalRecord record = service.getMedicalRecord("Fulano", "Mengano");
//Arrange
assertNotEquals(newBirthDate, record.getBirthdate());
assertNull(service.getMedicalRecord("Fulano", "Mengano").getAllergy(firstAllergy));
assertNull(service.getMedicalRecord("Fulano", "Mengano").getMedication(secondMedication));
}
@Test
public void deleteMedicalRecord_MedicalRecordExists_MedicalRecordDeleted() {
//Arrange
String firstName = "Fulano";
String lastName = "Mengano";
assertEquals(2, repository.findAll().size());
//Act
service.deleteMedicalRecord(firstName, lastName);
//Assert
assertEquals(1, repository.findAll().size());
assertTrue(repository.findAll().get(0).getFirstName() != firstName);
}
@Test
public void deleteMedicalRecord_FirstNameError_NothingHappens() {
//Arrange
String firstName = "Heike";
String lastName = "Mengano";
assertEquals(2, service.getAllMedicalRecords().size());
//Act
service.deleteMedicalRecord(firstName, lastName);
//Assert
assertEquals(2, service.getAllMedicalRecords().size());
assertNotNull(service.getMedicalRecord("Fulano", lastName));
}
@Test
public void deleteMedicalRecord_LastNameError_NothingHappens() {
//Arrange
String firstName = "Fulano";
String lastName = "Meyer";
assertEquals(2, service.getAllMedicalRecords().size());
//Act
service.deleteMedicalRecord(firstName, lastName);
//Assert
assertEquals(2, service.getAllMedicalRecords().size());
assertNotNull(service.getMedicalRecord(firstName, "Mengano"));
}
@Test
public void deleteMedicalRecord_MedicalRecordInexistent_NothingHappens() {
//Arrange
String firstName = "Heike";
String lastName = "Meyer";
assertEquals(2, service.getAllMedicalRecords().size());
assertTrue(service.getMedicalRecord(firstName, lastName).getFirstName().isEmpty());
//Act
service.deleteMedicalRecord(firstName, lastName);
//Assert
assertEquals(2, service.getAllMedicalRecords().size());
}
}
| [
"emmardo@gmail.com"
] | emmardo@gmail.com |
0bf25e3e8c68d25fc66768e22b1c4b43b53e6736 | 11e97bdb743f9245d9118dbedfbd67b952916495 | /library/src/main/java/com/linheimx/app/library/utils/RectD.java | 7673cdb1ba8b97706e5bcc27ac7ed6e5d4997646 | [
"Apache-2.0"
] | permissive | shb695/LChart | 8e722d46f3abd4962505af9702a54530186e9085 | ce295b01a260ecde6de0a393373ee11248b850a3 | refs/heads/master | 2021-01-23T22:10:23.580455 | 2017-02-22T00:57:31 | 2017-02-22T00:57:31 | 83,118,500 | 1 | 0 | null | 2017-02-25T08:36:50 | 2017-02-25T08:36:49 | null | UTF-8 | Java | false | false | 1,027 | java | package com.linheimx.app.library.utils;
/**
* 数据视图
* ---------------------------
* 约定:
* left 必须小于 right
* bottom 必须小于 top
* Created by lijian on 2017/1/26.
*/
public class RectD {
public double left;
public double top;
public double right;
public double bottom;
public RectD() {
}
public RectD(double left, double top, double right, double bottom) {
this.left = left;
this.top = top;
this.right = right;
this.bottom = bottom;
}
public RectD(RectD rectD) {
setRectD(rectD);
}
public void setRectD(RectD rectD) {
left = rectD.left;
top = rectD.top;
right = rectD.right;
bottom = rectD.bottom;
}
public double width() {
return right - left;
}
public double height() {
return top - bottom;
}
public String toString() {
return "RectD(" + left + ", " + top + ", "
+ right + ", " + bottom + ")";
}
}
| [
"linheimx333666"
] | linheimx333666 |
82cdec54caa3b15f60c55151d0a71e73e75cfdad | 471d34e1b7c88e72cae1f6012664bdf2212567f1 | /src/main/java/juc/lock/SynchronizedDemo3.java | 7ad3db81aef5870bc7d562c7589013a49ead740a | [] | no_license | dzw1113/jvm | 69bdd7e577ce6ae6791eba55ca0441925517edd3 | 095c3c93a693e8523dde617c76ffef93dc9543bf | refs/heads/master | 2021-10-24T02:35:24.156410 | 2019-03-21T13:24:51 | 2019-03-21T13:24:51 | 176,949,475 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,470 | java | package juc.lock;
/**
* 修饰代码块,只锁住代码块的执行顺序。代码块级别串行。(例如上面的方法1和方法2没能串行,因为锁住的是同一个对象,但是同步代码块只包住了方法中的一部分)
* @author dzw
*
*/
public class SynchronizedDemo3 {
public void method1(){
System.out.println("进入方法1");
try {
synchronized (this) {
System.out.println("方法1执行");
Thread.sleep(3000);
}
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("方法1 end");
}
public void method2(){
System.out.println("进入方法2");
try {
synchronized (this) {
System.out.println("方法2执行");
Thread.sleep(1000);
}
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("方法2 end");
}
public static void main(String[] args) {
final SynchronizedDemo3 demo = new SynchronizedDemo3();
new Thread(new Runnable() {
@Override
public void run() {
demo.method1();
}
}).start();
new Thread(new Runnable() {
@Override
public void run() {
demo.method2();
}
}).start();
}
}
| [
"dzw566951"
] | dzw566951 |
10c2375c2c37c3b9d790d2dd2620c791f6c8602b | 772c2558d2c4ad50ec011e80f20134715cbc3939 | /weiqitv-interfaces/src/test/java/de/dagnu/weiqitv/beans/criterion/test/HandicapCriterionTestCase.java | 0ff19ddab89a95e0b3ac2a52acaab145dcc82faf | [] | no_license | BackupTheBerlios/weiqitv | ce1e62dd0f80712d112ef80bbbd216dfe4187348 | 282f458c61a6729c19fea3d43423df8a526078d8 | refs/heads/master | 2016-09-15T20:24:16.204707 | 2010-03-15T13:59:09 | 2010-03-15T13:59:09 | 39,715,248 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,033 | java | package de.dagnu.weiqitv.beans.criterion.test;
import net.sf.twip.TwiP;
import net.sf.twip.Values;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import de.dagnu.weiqitv.beans.criterion.HandicapCriterion;
@RunWith(TwiP.class)
public class HandicapCriterionTestCase {
public static final String[] HANDICAPS_VALID = { "0", "9" };
public static final String[] HANDICAPS_INVALID = { null, "-1", "10" };
private HandicapCriterion cut;
@Before
public void setup() {
cut = new HandicapCriterion() {
@Override
public String getName() {
return "handicapCriterion";
}
};
}
@Test
public void validHandicap(@Values("HANDICAPS_VALID") String rank) {
cut.setValue(rank);
}
@Test(expected = IllegalArgumentException.class)
public void invalidHandicap(@Values("HANDICAPS_INVALID") String rank)
throws Exception {
cut.setValue(rank);
}
@Test(expected = IllegalArgumentException.class)
public void noHandicap(String rank) throws Exception {
cut.setValue(rank);
}
}
| [
"danny@sweety.(none)"
] | danny@sweety.(none) |
dfebba4267a2904337684cd793a1a0159b0a17ed | 00469ed47c6b24cb9c72cdebc4933bb729dbd584 | /blok2/jpa-demo/jpa-with-jse-relational/src/main/java/com/example/dao/ContactDao.java | 317fe24c7ca063a40012ad5bb593b51d8f739a2b | [] | no_license | maninder98/bd2021 | 2a74976683c26bb863a04183f57d39bec48a9dd2 | 56c76af87e455ff5465bc2b3e5a02923b82cc3ea | refs/heads/master | 2023-03-21T06:43:12.937765 | 2021-03-16T18:43:29 | 2021-03-16T18:43:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,528 | java | package com.example.dao;
import com.example.domain.Contact;
import org.slf4j.Logger;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
import java.util.List;
// Dao which uses DI through CDI. Corresponding ..IT has to use Weld therefore.
public class ContactDao {
@Inject
private Logger log;
@Inject
private EntityManager em;
public ContactDao() { }
public void insert(Contact p) {
try {
em.getTransaction().begin();
em.persist(p); // in persistence context
em.getTransaction().commit();
em.detach(p);
} catch (Exception e) {
em.getTransaction().rollback();
throw e;
}
}
public void insertWithoutCatchAndRollback(Contact c) {
em.getTransaction().begin();
em.persist(c); // in persistence context
em.getTransaction().commit();
em.detach(c);
}
public Contact select(long id) {
log.debug("Finding Contact with id " + id);
Contact contact = em.find(Contact.class, id);
if (contact != null) em.detach(contact);
return contact; // 1
}
public List<Contact> selectAll() {
TypedQuery<Contact> query = em.createQuery("select p from Contact p", Contact.class);
return query.getResultList(); // 2
}
public List<Contact> selectAll(String name) {
TypedQuery<Contact> query = em.createQuery("select p from Contact p where p.name = :firstarg", Contact.class);
query.setParameter("firstarg", name);
return query.getResultList(); // 3
}
public List<Contact> selectAllNamed() {
TypedQuery<Contact> findAll = em.createNamedQuery("findAll", Contact.class);
return findAll.getResultList();
}
public List<Contact> selectTempEmployees() {
TypedQuery<Contact> query = em.createQuery("select p from Contact p where type(p) = TemporaryEmployee", Contact.class);
return query.getResultList(); // 2
}
public void delete(long id) {
Contact select = em.find(Contact.class, id);
if (select != null) {
em.getTransaction().begin();
em.remove(select);
em.getTransaction().commit();
}
}
public Contact updateFirstname(long id, String name) {
Contact p = select(id);
if (p != null) {
em.getTransaction().begin();
p.setName(name);
em.getTransaction().commit();
}
return p;
}
public Contact update(Contact p) {
em.getTransaction().begin();
Contact merged = em.merge(p);
em.getTransaction().commit();
return merged;
}
public List<Contact> findByPhone(long phoneId) {
TypedQuery<Contact> query = em.createQuery(
"SELECT p " +
"FROM Contact p " +
"JOIN p.phones ps " +
"WHERE ps.id = :phoneId",
Contact.class);
query.setParameter("phoneId", phoneId);
return query.getResultList(); // findBy on OneToMany (with join)
}
public List<Contact> findWithPhones(boolean eager) {
String fetch = eager ? "FETCH" : "";
return em.createQuery(
"SELECT DISTINCT emp " +
"FROM Contact emp " +
"JOIN " + fetch + " emp.phones", Contact.class)
.getResultList();
}
public List<Tuple> findEmployeeDepartments() {
return em.createQuery(
"SELECT new com.example.dao.Tuple(emp.name, dep.name) " +
"FROM Contact emp " +
"JOIN emp.worksAt dep", Tuple.class)
.getResultList();
}
// Criteria API ---------
public List<Contact> findUsingCriteriaAPI(String name, String email) {
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Contact> q = cb.createQuery(Contact.class);
Root<Contact> emp = q.from(Contact.class);
q.select(emp).distinct(true)
.where(cb.or(
cb.equal(emp.get("naam"), name),
cb.equal(emp.get("emailAddress"), email)
)
);
return em.createQuery(q).getResultList();
}
}
| [
"bram.janssens@infosupport.com"
] | bram.janssens@infosupport.com |
3060b29f3d702497535298f57b21f618a075c9f3 | 9f2f1bfaa13437a7a9ab44e59aa9b29d601513ee | /company-api/src/main/java/co/edu/uniandes/csw/company/mappers/EJBExceptionMapper.java | a683e1f988b8ed3a3d3289fd9c5fb5a07b736051 | [
"MIT"
] | permissive | Uniandes-ISIS2603-backup/company_back | da4ed12b13828fe1caefebef36f676cfd97ad2b1 | 51051debbe6913f082ecada2d1cdd63c7ac6a41c | refs/heads/master | 2021-06-07T16:21:00.293515 | 2016-10-27T15:12:43 | 2016-10-27T15:12:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 934 | java | package co.edu.uniandes.csw.company.mappers;
import javax.ejb.EJBException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
@Provider
public class EJBExceptionMapper implements ExceptionMapper<EJBException> {
@Override
public Response toResponse(EJBException exception) {
return Response.serverError()
.entity(getInitCause(exception).getLocalizedMessage())
.type(MediaType.TEXT_PLAIN_TYPE)
.build();
}
/**
* Recursively retrieves the root cause of an exception.
*
* @param e Thrown exception
* @return Root cause
*/
private Throwable getInitCause(Throwable e) {
if (e.getCause() != null) {
return getInitCause(e.getCause());
} else {
return e;
}
}
}
| [
"rcasalla@uniandes.edu.co"
] | rcasalla@uniandes.edu.co |
a7c5945c74a816a3d900ee2c67eb7bce16e4cf7c | fc6925c978ca1326c1e15e5af8bac88e5d324ad9 | /adventure-lib/src/main/java/com/adam/adventure/entity/component/event/ComponentEvent.java | b4f0016e3fa31fd53c3e574dfd15df0f323b2f70 | [] | no_license | Adam-Higginson/AnotherAdventureGame | bda9b5b823e3e971ff67582e5abc13decf11e887 | 575f7670ce47706e93cb1424d59ea2d3e443fff4 | refs/heads/master | 2023-04-28T21:29:24.698903 | 2019-10-13T22:23:19 | 2019-10-13T22:23:19 | 90,482,122 | 1 | 0 | null | 2023-04-18T11:40:46 | 2017-05-06T18:10:45 | Java | UTF-8 | Java | false | false | 93 | java | package com.adam.adventure.entity.component.event;
public abstract class ComponentEvent {
}
| [
"adam.higginson555@gmail.com"
] | adam.higginson555@gmail.com |
1e664ebb03822a3c2356629123bf4f0435f39756 | 3198f64839b21d54d038d1ab4fa0c8f42ee6a4e4 | /app/src/test/java/kr/generic/wifianalyzer/vendor/model/VendorServiceTest.java | 80d3edf1b095e42cb7fd447a45cbdc05b8c396a3 | [] | no_license | Ohmiz/WiFi-Analyzer | 299d088ce33790e171a21ced39436346d72dfbc8 | df056dcbdd3ae8ceb091ca1f04569abebc3543e4 | refs/heads/master | 2021-01-12T02:21:23.235189 | 2017-01-10T07:20:19 | 2017-01-10T07:20:19 | 78,505,567 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,040 | java | /*
* WiFi Analyzer
* Copyright (C) 2016 VREM Software Development <VREMSoftwareDevelopment@gmail.com>
*
* 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 kr.co.generic.wifianalyzer.vendor.model;
import android.support.annotation.NonNull;
import kr.co.generic.wifianalyzer.MainContextHelper;
import org.apache.commons.lang3.StringUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import java.util.Arrays;
import java.util.List;
import java.util.SortedMap;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class)
public class VendorServiceTest {
private static final String MAC_IN_RANGE1 = "00:23:AB:8C:DF:10";
private static final String MAC_IN_RANGE2 = "00:23:AB:00:DF:1C";
private static final String VENDOR_NAME = "CISCO SYSTEMS, INC.";
private static final String EXPECTED_VENDOR_NAME = "CISCO SYSTEMS INC";
@Mock
private RemoteCall remoteCall;
private Database database;
private VendorService fixture;
@Before
public void setUp() {
database = MainContextHelper.INSTANCE.getDatabase();
fixture = new VendorService();
fixture.setRemoteCall(remoteCall);
}
@After
public void tearDown() {
fixture.clear();
MainContextHelper.INSTANCE.restore();
}
@Test
public void testFindWithNameFound() throws Exception {
// setup
when(database.find(MAC_IN_RANGE1)).thenReturn(VENDOR_NAME);
// execute
String actual = fixture.findVendorName(MAC_IN_RANGE1);
// validate
assertEquals(EXPECTED_VENDOR_NAME, actual);
verify(database).find(MAC_IN_RANGE1);
}
@Test
public void testFindWithNameNotFound() throws Exception {
// execute
String actual = fixture.findVendorName(MAC_IN_RANGE1);
when(database.find(MAC_IN_RANGE1)).thenReturn(null);
// validate
verify(database).find(MAC_IN_RANGE1);
verify(remoteCall).execute(MAC_IN_RANGE1);
assertEquals(StringUtils.EMPTY, actual);
assertSame(StringUtils.EMPTY, actual);
}
@Test
public void testFindWithMacAddressesBelongToSameVendor() throws Exception {
// setup
fixture.findVendorName(MAC_IN_RANGE1);
// execute
String actual = fixture.findVendorName(MAC_IN_RANGE2);
fixture.findVendorName(MAC_IN_RANGE2.toLowerCase());
// validate
verify(database).find(MAC_IN_RANGE1);
verify(remoteCall).execute(MAC_IN_RANGE1);
verify(remoteCall, never()).execute(MAC_IN_RANGE2);
verify(remoteCall, never()).execute(MAC_IN_RANGE2.toLowerCase());
assertEquals(StringUtils.EMPTY, actual);
assertSame(StringUtils.EMPTY, actual);
}
@Test
public void testFindAll() throws Exception {
// setup
List<VendorData> vendorDatas = withVendorDatas();
when(database.findAll()).thenReturn(vendorDatas);
// execute
SortedMap<String, List<String>> actual = fixture.findAll();
// validate
verify(database).findAll();
assertEquals(3, actual.size());
assertEquals(1, actual.get(VendorNameUtils.cleanVendorName(vendorDatas.get(0).getName())).size());
assertEquals(3, actual.get(VendorNameUtils.cleanVendorName(vendorDatas.get(1).getName())).size());
assertEquals(1, actual.get(VendorNameUtils.cleanVendorName(vendorDatas.get(4).getName())).size());
List<String> macs = actual.get(VendorNameUtils.cleanVendorName(vendorDatas.get(1).getName()));
assertEquals(vendorDatas.get(3).getMac(), macs.get(0));
assertEquals(vendorDatas.get(1).getMac(), macs.get(1));
assertEquals(vendorDatas.get(2).getMac(), macs.get(2));
}
@NonNull
private List<VendorData> withVendorDatas() {
return Arrays.asList(
new VendorData(3, VENDOR_NAME + " 3", "Mac3"),
new VendorData(4, VENDOR_NAME + " 1", "Mac1-2"),
new VendorData(1, VENDOR_NAME + " 1", "Mac1-3"),
new VendorData(2, VENDOR_NAME + " 1", "Mac1-1"),
new VendorData(5, VENDOR_NAME + " 2", "Mac2"));
}
} | [
"12345"
] | 12345 |
baf6800de9f1fcf90b0657b32a77b432df905fbd | af028c3aeccc7e24244c7258f0044ff392378ebf | /src/test/java/com/bdi/fondation/web/rest/UserJWTControllerIntTest.java | 47ba9835e2cda3d69502575c29402691f8359577 | [] | no_license | BulkSecurityGeneratorProject/TastFondation | 3da9a92eade4ef565ad9d12d538535b3b728ee28 | 75ef2596294252052062056489fb922b3f2e1765 | refs/heads/master | 2022-12-16T19:31:12.666472 | 2018-05-27T01:00:13 | 2018-05-27T01:00:13 | 296,554,262 | 0 | 0 | null | 2020-09-18T08:00:28 | 2020-09-18T08:00:27 | null | UTF-8 | Java | false | false | 4,869 | java | package com.bdi.fondation.web.rest;
import com.bdi.fondation.TastFondationApp;
import com.bdi.fondation.domain.User;
import com.bdi.fondation.repository.UserRepository;
import com.bdi.fondation.security.jwt.TokenProvider;
import com.bdi.fondation.web.rest.vm.LoginVM;
import com.bdi.fondation.web.rest.errors.ExceptionTranslator;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.transaction.annotation.Transactional;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header;
import static org.hamcrest.Matchers.nullValue;
import static org.hamcrest.Matchers.isEmptyString;
import static org.hamcrest.Matchers.not;
/**
* Test class for the UserJWTController REST controller.
*
* @see UserJWTController
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = TastFondationApp.class)
public class UserJWTControllerIntTest {
@Autowired
private TokenProvider tokenProvider;
@Autowired
private AuthenticationManager authenticationManager;
@Autowired
private UserRepository userRepository;
@Autowired
private PasswordEncoder passwordEncoder;
@Autowired
private ExceptionTranslator exceptionTranslator;
private MockMvc mockMvc;
@Before
public void setup() {
UserJWTController userJWTController = new UserJWTController(tokenProvider, authenticationManager);
this.mockMvc = MockMvcBuilders.standaloneSetup(userJWTController)
.setControllerAdvice(exceptionTranslator)
.build();
}
@Test
@Transactional
public void testAuthorize() throws Exception {
User user = new User();
user.setLogin("user-jwt-controller");
user.setEmail("user-jwt-controller@example.com");
user.setActivated(true);
user.setPassword(passwordEncoder.encode("test"));
userRepository.saveAndFlush(user);
LoginVM login = new LoginVM();
login.setUsername("user-jwt-controller");
login.setPassword("test");
mockMvc.perform(post("/api/authenticate")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(login)))
.andExpect(status().isOk())
.andExpect(jsonPath("$.id_token").isString())
.andExpect(jsonPath("$.id_token").isNotEmpty())
.andExpect(header().string("Authorization", not(nullValue())))
.andExpect(header().string("Authorization", not(isEmptyString())));
}
@Test
@Transactional
public void testAuthorizeWithRememberMe() throws Exception {
User user = new User();
user.setLogin("user-jwt-controller-remember-me");
user.setEmail("user-jwt-controller-remember-me@example.com");
user.setActivated(true);
user.setPassword(passwordEncoder.encode("test"));
userRepository.saveAndFlush(user);
LoginVM login = new LoginVM();
login.setUsername("user-jwt-controller-remember-me");
login.setPassword("test");
login.setRememberMe(true);
mockMvc.perform(post("/api/authenticate")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(login)))
.andExpect(status().isOk())
.andExpect(jsonPath("$.id_token").isString())
.andExpect(jsonPath("$.id_token").isNotEmpty())
.andExpect(header().string("Authorization", not(nullValue())))
.andExpect(header().string("Authorization", not(isEmptyString())));
}
@Test
@Transactional
public void testAuthorizeFails() throws Exception {
LoginVM login = new LoginVM();
login.setUsername("wrong-user");
login.setPassword("wrong password");
mockMvc.perform(post("/api/authenticate")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(login)))
.andExpect(status().isUnauthorized())
.andExpect(jsonPath("$.id_token").doesNotExist())
.andExpect(header().doesNotExist("Authorization"));
}
}
| [
"jhipster-bot@users.noreply.github.com"
] | jhipster-bot@users.noreply.github.com |
747612d06e853459bb04dd363cc9b777057a201d | a49186a173fec63bd5d9c2446dae5a8f0ed1897e | /src/main/java/com/exercise/infra/util/Adapter/SelectVisitorAdapter.java | 05c1f2c87a92d8640d88204762d390cff4d73954 | [] | no_license | lijianglong0916/exercise | 7d332ab95d0843be6755890e88cacfd50c06247a | 8e995fa4ef660072f4ff001e0704c115ebf62c63 | refs/heads/master | 2023-02-20T20:32:14.486603 | 2021-01-20T08:06:17 | 2021-01-20T08:06:17 | 328,639,884 | 0 | 0 | null | 2021-01-20T08:15:09 | 2021-01-11T11:19:12 | Java | UTF-8 | Java | false | false | 3,402 | java | package com.exercise.infra.util.Adapter;
import net.sf.jsqlparser.expression.Expression;
import net.sf.jsqlparser.statement.select.*;
import net.sf.jsqlparser.statement.values.ValuesStatement;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* @author jianglong.li@hand-china.com
* @date 2020-12-24 14:41
**/
public class SelectVisitorAdapter implements SelectVisitor {
private ExpressionVisitorAdapter expressionVisitorAdapter;
private Logger logger = LoggerFactory.getLogger(SelectVisitorAdapter.class);
private List<Expression> expressions;
private void init() {
expressionVisitorAdapter = new ExpressionVisitorAdapter();
expressions = new ArrayList<>(4);
}
public SelectVisitorAdapter() {
init();
}
@Override
public void visit(PlainSelect plainSelect) {
if (!CollectionUtils.isEmpty(plainSelect.getJoins())) {
plainSelect.getJoins().forEach(e -> {
if (Objects.nonNull(e.getOnExpression())){
e.getOnExpression().accept(expressionVisitorAdapter);
}
if (Objects.nonNull(e.getRightItem())){
e.getRightItem().accept(expressionVisitorAdapter.getFromItemVisitorAdapter());
}
});
}
if (Objects.nonNull(plainSelect.getWhere())) {
plainSelect.getWhere().accept(expressionVisitorAdapter);
}
if (Objects.nonNull(plainSelect.getFromItem())) {
plainSelect.getFromItem().accept(expressionVisitorAdapter.getFromItemVisitorAdapter());
}
if (Objects.nonNull(plainSelect.getHaving())) {
plainSelect.getHaving().accept(expressionVisitorAdapter);
}
if (!Objects.isNull(plainSelect.getGroupBy())) {
if (CollectionUtils.isEmpty(plainSelect.getGroupBy().getGroupByExpressions())){
plainSelect.getGroupBy().getGroupByExpressions().forEach(e -> e.accept(expressionVisitorAdapter));
}
}
if (Objects.nonNull(plainSelect.getLimit())) {
if (Objects.nonNull(plainSelect.getLimit().getOffset())) {
plainSelect.getLimit().getOffset().accept(expressionVisitorAdapter);
}
if (Objects.nonNull(plainSelect.getLimit().getRowCount())) {
plainSelect.getLimit().getRowCount().accept(expressionVisitorAdapter);
}
}
if (!CollectionUtils.isEmpty(plainSelect.getSelectItems())) {
plainSelect.getSelectItems().forEach(e -> e.accept(new ExpressionVisitorAdapter() {
@Override
public void visit(SubSelect subSelect) {
expressions.add(subSelect);
logger.info("字段子查询:" + subSelect.toString());
}
}));
}
}
@Override
public void visit(SetOperationList setOpList) {
}
@Override
public void visit(WithItem withItem) {
}
public ExpressionVisitorAdapter getExpressionVisitorAdapter() {
return expressionVisitorAdapter;
}
public List<Expression> getExpressions() {
return expressions;
}
@Override
public void visit(ValuesStatement aThis) {
}
}
| [
"jianglong.li@hand-china.com"
] | jianglong.li@hand-china.com |
f6be5a7cb338857a2e3e2a90f76fb9f4b5262ca7 | e5d8693cb94767350e34d47223a5ee294d88a869 | /src/main/java/projects/encryptor/model/BasicCryptosystem.java | 49ab179a4e0edf3226d0826547dc5bd9ba6402d5 | [
"MIT"
] | permissive | manu-p-1/Portable-Cryptographer | dec5dcd6fc031157d086a7b37d5b5f9cdd008c4d | 2f238692e22610d786ce5a36617c0e3c5700b7d8 | refs/heads/master | 2023-08-11T05:35:03.490198 | 2023-07-27T02:27:55 | 2023-07-27T02:27:55 | 163,994,278 | 2 | 0 | null | 2019-02-02T03:03:37 | 2019-01-03T16:03:26 | Java | UTF-8 | Java | false | false | 5,085 | java | package projects.encryptor.model;
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
/**
* Defines basic functions and methods for building a cryptographer.
*
* @author Manu Puduvalli
*
*/
public interface BasicCryptosystem {
String CHARSET_UTF8 = "UTF-8";
String ALGORITHM_AES = "AES";
String MESSAGE_DIGEST_SHA256 = "SHA-256";
String MESSAGE_DIGEST_SHA1 = "SHA-1";
String CIPHER_TSFM_ACN = "AES/CBC/NoPadding";
String CIPHER_TSFM_ACP = "AES/CBC/PKCS5Padding";
String CIPHER_TSFM_AEN = "AES/ECB/NoPadding";
String CIPHER_TSFM_AEP = "AES/ECB/PKCS5Padding";
/**
* Encrypts a piece of text given a Key and a Cipher. The encrypted
* value is encoded to a string using Base64.
*
* @param plainTxt the text to encrypt
* @param key the secret key
* @param cipher the cryptographic cipher
* @return a new string with the encrypted value
* @throws InvalidKeyException if the key is not recognized by the {@link javax.crypto.Cipher}
* @throws IllegalBlockSizeException if the length of data does not match the Cipher's block size
* @throws BadPaddingException if the String text is not padded properly
* @throws UnsupportedEncodingException if the encoding is not supported
*/
default String encrypt(String plainTxt, Key key, Cipher cipher) throws InvalidKeyException, IllegalBlockSizeException,
BadPaddingException, UnsupportedEncodingException
{
cipher.init(Cipher.ENCRYPT_MODE, key);
byte[] encrypted = cipher.doFinal(plainTxt.getBytes(CHARSET_UTF8));
String encodedVal = Base64.getEncoder().encodeToString(encrypted);
return new String(encodedVal);
}
/**
* Decrypts a piece of text given a Key and a Cipher. The decrypted
* value is encoded to a String using Base64.
*
* @param encrypted the encrypted String to decrypt
* @param key the secret key
* @param cipher the cryptographic cipher
* @return a new String with the decrypted plain text
* @throws InvalidKeyException if the key is not recognized by the {@link javax.crypto.Cipher}
* @throws IllegalBlockSizeException if the length of data does not match the Cipher's block size
* @throws BadPaddingException if the String text is not padded properly
*/
default String decrypt(String encrypted, Key key, Cipher cipher) throws InvalidKeyException, IllegalBlockSizeException,
BadPaddingException
{
cipher.init(Cipher.DECRYPT_MODE, key);
byte[] decodedVal = Base64.getDecoder().decode(encrypted);
return new String(cipher.doFinal(decodedVal));
}
/**
* Generates a SecretKey as a Base64 encoded string, given an supported algorithm.
*
* @param algo the algorithm recognized by {@link javax.crypto.KeyGenerator}
* @return a SecretKey instance as a String object
* @throws NoSuchAlgorithmException if the algorithm <code>algo</code> does not exist
*/
static String generateSecretKey(String algo) throws NoSuchAlgorithmException {
KeyGenerator keyGen = KeyGenerator.getInstance(algo);
keyGen.init(256); // for example
SecretKey secretKey = keyGen.generateKey();
return convertSecretKeyToString(secretKey);
}
/**
* Converts a Key to a Base64 encoded String.
* @param sk the {@link java.security.Key}
* @return a new String secret key
*/
static String convertSecretKeyToString(Key sk) {
return Base64.getEncoder()
.encodeToString(sk.getEncoded());
}
/*
* Forces and implementor to carry the following instances.
*/
/**
* Returns a {@link java.security.Key} instance
*
* @return an instance of {@link java.security.Key}
*/
Key getSecretKeySpec();
/**
* Returns a {@link javax.crypto.Cipher} instance
*
* @return an instance of {@link javax.crypto.Cipher}
*/
Cipher getCipher();
/**
* Sets a secret key as a String.
*
* @param key the secret key as a String
*/
void setKey(String secretKey);
/**
* Gets a secret key.
*
* @return a secret key as a String.
*/
String getKey();
/**
* Sets a Key given a String secret key, an algorithm recognized by a
* {@link java.security.Key} instance, and a supported
* {@link java.security.MessageDigest} instance.
*
* @param keystr a secret key as a String
* @param algo an algorithm recognized by a {@link java.security.Key} instance
* @param messageDigest a message digest supported by a {@link java.security.MessageDigest} instance
* @throws NoSuchAlgorithmException if the algorithm <code>algo</code> does not exist
* @throws UnsupportedEncodingException if the charset is not recognized
*/
void setSecretKeyFromString(String keystr, String algo, String messageDigest, String charset)
throws NoSuchAlgorithmException, UnsupportedEncodingException;
/**
* Sets a Cipher.
*
* @param cipher the Cipher instance
*/
void setCipher(Cipher cipher);
}
| [
"28782438+manu-p-1@users.noreply.github.com"
] | 28782438+manu-p-1@users.noreply.github.com |
23297342f6fa19b07fcf8bc966c43ea76803852d | 2a3f19a4a2b91d9d715378aadb0b1557997ffafe | /sources/org/acra/CrashReportFileNameParser.java | 9beee54cdf5788d589015efd8e46c550f29c6270 | [] | no_license | amelieko/McDonalds-java | ce5062f863f7f1cbe2677938a67db940c379d0a9 | 2fe00d672caaa7b97c4ff3acdb0e1678669b0300 | refs/heads/master | 2022-01-09T22:10:40.360630 | 2019-04-21T14:47:20 | 2019-04-21T14:47:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 385 | java | package org.acra;
final class CrashReportFileNameParser {
CrashReportFileNameParser() {
}
public final boolean isSilent(String reportFileName) {
return reportFileName.contains(ACRAConstants.SILENT_SUFFIX);
}
public final boolean isApproved(String reportFileName) {
return isSilent(reportFileName) || reportFileName.contains("-approved");
}
}
| [
"makfc1234@gmail.com"
] | makfc1234@gmail.com |
93ba0885338db15e8c5788b12eee8b3f8ed577f6 | 60db3a7a12378e45828a199ef6825d08720b6380 | /Assignment2/app/src/main/java/edu/floridapoly/cop4656/spring19/kuhn/MainActivity.java | 6c24ed5284528f141dac253aa84474a1e82cac32 | [] | no_license | Brent-Kuhn/mobile_device_apps | 1fe067be8eb169155be8aa9f95a2bd8370398aaa | 3d14ee1d8909f7846f4656434e6e7f1bcc20618d | refs/heads/master | 2020-04-17T04:57:37.605818 | 2019-04-05T04:10:39 | 2019-04-05T04:10:39 | 166,255,177 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,381 | java | package edu.floridapoly.cop4656.spring19.kuhn;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.List;
import edu.floridapoly.cop4656.spring19.kuhn.RecyclerTouchListener;
public class MainActivity extends AppCompatActivity {
private NotesAdapter mAdapter;
private List<Note> notesList = new ArrayList<>();
private CoordinatorLayout coordinatorLayout;
private RecyclerView recyclerView;
private TextView noNotesView;
private DatabaseHelper db;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
recyclerView = findViewById(R.id.notesList);
coordinatorLayout = findViewById(R.id.coordinator_layout);
// Get all
db = new DatabaseHelper(this);
notesList.addAll(db.getAllNotes());
mAdapter = new NotesAdapter(this, notesList);
RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getApplicationContext());
recyclerView.setLayoutManager(mLayoutManager);
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(mAdapter);
FloatingActionButton fab = findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivityForResult(new Intent(MainActivity.this, NoteActivity.class), 0);
}
});
recyclerView.addOnItemTouchListener(new RecyclerTouchListener(this,
recyclerView, new RecyclerTouchListener.ClickListener() {
@Override
public void onClick(View view, final int position) {
}
@Override
public void onLongClick(View view, int position) {
Intent i = new Intent(MainActivity.this, EditNoteActivity.class);
String positionString = String.valueOf(position);
Bundle extras = new Bundle();
extras.putInt("position", position);
extras.putString("note", notesList.get(position).getNote());
i.putExtras(extras);
startActivityForResult(i, 0);
Log.v("position", notesList.get(position).getNote());
}
}));
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// if(resultCode != Activity.RESULT_OK) { return;}
if(resultCode == 0) {
long id = data.getExtras().getLong("new_note_id");
Note n = db.getNote(id);
if (n != null) {
// adding new note to array list at 0 position
notesList.add(0, n);
// refreshing the list
mAdapter.notifyDataSetChanged();
}
}
if (resultCode == 1) {
int position = data.getExtras().getInt("position");
String note = data.getExtras().getString("note");
Note n = notesList.get(position);
n.setNote(note);
db.updateNote(n);
notesList.set(position, n);
mAdapter.notifyItemChanged(position);
}
if (resultCode == 2) {
int position = data.getExtras().getInt("position");
// deleting the note from db
db.deleteNote(notesList.get(position));
// removing the note from the list
notesList.remove(position);
mAdapter.notifyItemRemoved(position);
// refreshing the list
mAdapter.notifyDataSetChanged();
}
}
}
| [
"bkuhn4669@flpoly.org"
] | bkuhn4669@flpoly.org |
5a0fb066272b30dac728f9671e5f806e0f0e58ff | 99c7920038f551b8c16e472840c78afc3d567021 | /aliyun-java-sdk-dataworks-public-v5/src/main/java/com/aliyuncs/v5/dataworks_public/model/v20200518/ListConnectionsRequest.java | 0b481ec87d8562cb56b03b19962f21c4bdfbda49 | [
"Apache-2.0"
] | permissive | aliyun/aliyun-openapi-java-sdk-v5 | 9fa211e248b16c36d29b1a04662153a61a51ec88 | 0ece7a0ba3730796e7a7ce4970a23865cd11b57c | refs/heads/master | 2023-03-13T01:32:07.260745 | 2021-10-18T08:07:02 | 2021-10-18T08:07:02 | 263,800,324 | 4 | 2 | NOASSERTION | 2022-05-20T22:01:22 | 2020-05-14T02:58:50 | Java | UTF-8 | Java | false | false | 3,420 | java | /*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.aliyuncs.v5.dataworks_public.model.v20200518;
import com.aliyuncs.v5.RpcAcsRequest;
import com.aliyuncs.v5.http.MethodType;
import com.aliyuncs.v5.dataworks_public.Endpoint;
/**
* @author auto create
* @version
*/
public class ListConnectionsRequest extends RpcAcsRequest<ListConnectionsResponse> {
private Integer pageNumber;
private String subType;
private String name;
private Integer envType;
private Integer pageSize;
private String connectionType;
private Long projectId;
private String status;
public ListConnectionsRequest() {
super("dataworks-public", "2020-05-18", "ListConnections", "dide");
setMethod(MethodType.GET);
try {
com.aliyuncs.v5.AcsRequest.class.getDeclaredField("productEndpointMap").set(this, Endpoint.endpointMap);
com.aliyuncs.v5.AcsRequest.class.getDeclaredField("productEndpointRegional").set(this, Endpoint.endpointRegionalType);
} catch (Exception e) {}
}
public Integer getPageNumber() {
return this.pageNumber;
}
public void setPageNumber(Integer pageNumber) {
this.pageNumber = pageNumber;
if(pageNumber != null){
putQueryParameter("PageNumber", pageNumber.toString());
}
}
public String getSubType() {
return this.subType;
}
public void setSubType(String subType) {
this.subType = subType;
if(subType != null){
putQueryParameter("SubType", subType);
}
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
if(name != null){
putQueryParameter("Name", name);
}
}
public Integer getEnvType() {
return this.envType;
}
public void setEnvType(Integer envType) {
this.envType = envType;
if(envType != null){
putQueryParameter("EnvType", envType.toString());
}
}
public Integer getPageSize() {
return this.pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
if(pageSize != null){
putQueryParameter("PageSize", pageSize.toString());
}
}
public String getConnectionType() {
return this.connectionType;
}
public void setConnectionType(String connectionType) {
this.connectionType = connectionType;
if(connectionType != null){
putQueryParameter("ConnectionType", connectionType);
}
}
public Long getProjectId() {
return this.projectId;
}
public void setProjectId(Long projectId) {
this.projectId = projectId;
if(projectId != null){
putQueryParameter("ProjectId", projectId.toString());
}
}
public String getStatus() {
return this.status;
}
public void setStatus(String status) {
this.status = status;
if(status != null){
putQueryParameter("Status", status);
}
}
@Override
public Class<ListConnectionsResponse> getResponseClass() {
return ListConnectionsResponse.class;
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
480c02ba2f572e7f2892fa4506c7644d62c2c1ad | 960570d7599cd511dfb5631dbc77cddeaf214a6a | /src/main/java/com/whishkey/tictactoe/Board.java | 33fe22912507da9a477d322b3dde79d2e8177d53 | [] | no_license | jansenmtan/TTToe | 0c8bb5136f5f4fa377ff0a96713f9668b9a74d28 | ef29134c5ce06319788befd5348cf9dd29568675 | refs/heads/master | 2021-05-01T16:03:05.601413 | 2018-02-24T17:49:01 | 2018-02-24T17:49:01 | 121,044,289 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,291 | java | package com.whishkey.tictactoe;
import java.util.Arrays;
import java.util.ArrayList;
// TODO : make parcelable
public class Board {
private int[][][] board;
Board() {
board = Fill(new int[3][3][3], -1);
}
int[][] getGrid(int x) {
return board[x];
}
public int getState(int x, int y, int z) {
return board[x][y][z];
}
public void setState(int x, int y, int z, int state) {
board[x][y][z] = state;
}
public void reset() {
board = Fill(board, -1);
}
private int[][][] Fill(int[][][] arr, int n) {
for (int[][] z: arr) {
for (int[] y: z) {
Arrays.fill(y, n);
}
}
return arr;
}
/**
* Place board states into an arraylist
* @return L : Arraylist encoded from the board
*/
public ArrayList<Integer> toArr() {
ArrayList<Integer> L = new ArrayList<Integer>();
for (int[][] z: board) {
for (int[] y: z) {
for (int x: y) {
L.add(x);
}
}
}
return L;
}
/**
* Reconstructs board from arraylist made from toArr
* @param L : Arraylist to decode into the board
*/
public void fromArr(ArrayList<Integer> L) {
for (int i = 0; i < L.size(); i++) {
board[(i / 3) / 3][(i / 3) % 3][i % 3] = L.get(i);
}
}
}
| [
"jansenmtan@gmail.com"
] | jansenmtan@gmail.com |
6e1967d96c198dba57c2c08f0e1a7ce9a617dfb0 | d05fb268c6c25b0ddd799d02c1a2d146ee2246ae | /apm/src/main/java/io/fabric8/apmagent/metrics/ThreadContextMethodMetricsStack.java | 2f0f6008615d5381539fc59b876de05cc2321946 | [
"Apache-2.0"
] | permissive | jknoepfler/fabric8 | 0a31dc4f0b761a1c3d2723aa36904802062833a8 | 1d85f9763a905fbb8e2077b107f6689e9db50add | refs/heads/master | 2020-12-14T10:18:05.751775 | 2014-06-30T12:06:40 | 2014-06-30T15:56:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,943 | java | /*
* Copyright 2005-2014 Red Hat, Inc.
* Red Hat 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 io.fabric8.apmagent.metrics;
class ThreadContextMethodMetricsStack {
private ThreadContextMethodMetrics[] stack;
private int pointer;
ThreadContextMethodMetricsStack() {
stack = new ThreadContextMethodMetrics[2];
}
ThreadContextMethodMetrics push(ThreadContextMethodMetrics value) {
if (pointer + 1 >= stack.length) {
resizeStack(stack.length * 2);
}
stack[pointer++] = value;
return value;
}
ThreadContextMethodMetrics getLast() {
if (pointer > 0) {
return stack[pointer - 1];
}
return null;
}
ThreadContextMethodMetrics pop() {
final ThreadContextMethodMetrics result = stack[--pointer];
stack[pointer] = null;
return result;
}
int size() {
return pointer;
}
boolean isEmpty() {
return pointer == 0;
}
private void resizeStack(int newCapacity) {
ThreadContextMethodMetrics[] newStack = new ThreadContextMethodMetrics[newCapacity];
System.arraycopy(stack, 0, newStack, 0, Math.min(pointer, newCapacity));
stack = newStack;
}
public String toString() {
StringBuffer result = new StringBuffer("[");
for (int i = 0; i < pointer; i++) {
if (i > 0) {
result.append(", ");
}
result.append(stack[i]);
}
result.append(']');
return result.toString();
}
}
| [
"jon@fusesource.com"
] | jon@fusesource.com |
43964cce177476b7ac3f6a8a973dafeba3ef7e5c | 4c6adf0ce6ef3f02dcef9c345e0e5e4ff139d886 | /Common/FO/fo-jar/fo-withdraw/src/main/java/com/pay/fundout/withdraw/dao/ruleconfig/impl/BatchRuleConfigDAOImpl.java | 65c2b68889dccf657d5c0431c458788423227e29 | [] | no_license | happyjianguo/pay-1 | 8631906be62707316f0ed3eb6b2337c90d213bc0 | 40ae79738cfe4e5d199ca66468f3a33e9d8f2007 | refs/heads/master | 2020-07-27T19:51:54.958859 | 2016-12-19T07:34:24 | 2016-12-19T07:34:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,126 | java | /**
* File: WithDrawRuleConfigDaoImpl.java
* Description:
* Copyright 2010 -2010 pay Corporation. All rights reserved.
* 2010-9-16 darv Changes
*
*
*/
package com.pay.fundout.withdraw.dao.ruleconfig.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.pay.fundout.withdraw.dao.ruleconfig.BatchRuleConfigDAO;
import com.pay.fundout.withdraw.dto.ruleconfig.RuleConfigQueryDTO;
import com.pay.fundout.withdraw.model.ruleconfig.BatchRuleConfig;
import com.pay.inf.dao.Page;
import com.pay.inf.dao.impl.BaseDAOImpl;
/**
* @author darv
*
*/
public class BatchRuleConfigDAOImpl extends BaseDAOImpl implements
BatchRuleConfigDAO {
@Override
public long createBatchRuleConfig(BatchRuleConfig batchRuleConfig) {
this.create("create", batchRuleConfig);
return batchRuleConfig.getSequenceId();
}
@Override
public Long getSeqId() {
return (Long) this.getSqlMapClientTemplate().queryForObject(
namespace.concat("getSeqId"));
}
@SuppressWarnings("unchecked")
@Override
public List getBatchRuleConfigList() {
return this.getSqlMapClientTemplate().queryForList(
namespace.concat("findBatchRuleConfigList"));
}
@Override
public Page<RuleConfigQueryDTO> getRuleConfigList(
Page<RuleConfigQueryDTO> page, Map params) {
return (Page<RuleConfigQueryDTO>) findByQuery("getRuleConfigList",
page, params);
}
@Override
public RuleConfigQueryDTO getRuleConfigById(Long sequenceId) {
return (RuleConfigQueryDTO) getSqlMapClientTemplate().queryForObject(
namespace.concat("getRuleConfigById"), sequenceId);
}
@Override
public void updateRuleConfigById(BatchRuleConfig ruleConfig) {
this.update(ruleConfig);
}
/**
* 通过时间配置ID获得有效的规则
*
* @param timeId
* @return
*/
@SuppressWarnings("unchecked")
@Override
public List<BatchRuleConfig> getBatchRuleByTimeId(Long timeId) {
Map<String, Object> params = new HashMap();
params.put("batchTimeConfId", timeId);
params.put("status", 1);
return getSqlMapClientTemplate().queryForList(
namespace.concat("findBySelective"), params);
}
}
| [
"stanley.zou@hrocloud.com"
] | stanley.zou@hrocloud.com |
4001276abf8ae96255cfd3c60b531d922e5aea5b | b89a7d4a3909a06159ff2b7273312f97a3455766 | /hot-swap-jvm-book/src/main/java/xyz/dsvshx/hotswap/ClassModifier.java | b0395358a3cc2e3767a1eb74272e5c9618af0895 | [
"MIT"
] | permissive | dongzhonghua/lets-hotfix | 1bcf27c85c431eb7d82645de4ceb9615de8d33a3 | eb5308f46323cec97d8bc6fc09f1d61de17d4ada | refs/heads/master | 2023-07-09T11:37:08.554754 | 2021-07-03T12:49:42 | 2021-07-03T12:49:42 | 306,056,564 | 0 | 0 | MIT | 2020-10-21T14:45:34 | 2020-10-21T14:45:33 | null | UTF-8 | Java | false | false | 1,850 | java | package xyz.dsvshx.hotswap;
/**
* 修改Class文件,暂时只提供修改常量池常量的功能
*
* @author dongzhonghua
* Created on 2021-06-08
*/
public class ClassModifier {
private static final int CONSTANT_POOL_COUNT_INDEX = 8;
private static final int CONSTANT_Utf8_info = 1;
private static final int[] CONSTANT_ITEM_LENGTH = {-1, -1, -1, 5, 5, 9, 9, 3, 3, 5, 5, 5, 5};
private static final int u1 = 1;
private static final int u2 = 2;
private byte[] classByte;
public ClassModifier(byte[] classByte) {
this.classByte = classByte;
}
public byte[] modifyUTF8Constant(String oldStr, String newStr) {
int cpc = getConstantPoolCount();
int offset = CONSTANT_POOL_COUNT_INDEX + u2;
for (int i = 0; i < cpc; i++) {
int tag = ByteUtils.bytes2Int(classByte, offset, u1);
if (tag == CONSTANT_Utf8_info) {
int len = ByteUtils.bytes2Int(classByte, offset + u1, u2);
offset += (u1 + u2);
String str = ByteUtils.bytes2String(classByte, offset, len);
if (str.equalsIgnoreCase(oldStr)) {
byte[] strBytes = ByteUtils.string2Bytes(newStr);
byte[] strLen = ByteUtils.int2Bytes(newStr.length(), u2);
classByte = ByteUtils.bytesReplace(classByte, offset - u2, u2, strLen);
classByte = ByteUtils.bytesReplace(classByte, offset, len, strBytes);
return classByte;
} else {
offset += len;
}
} else {
offset += CONSTANT_ITEM_LENGTH[tag];
}
}
return classByte;
}
public int getConstantPoolCount() {
return ByteUtils.bytes2Int(classByte, CONSTANT_POOL_COUNT_INDEX, u2);
}
}
| [
"dongzhonghua03@kuaishou.com"
] | dongzhonghua03@kuaishou.com |
aed6d8a515c3f1d6e43ee645f945c21a6ab7b8e4 | e993c159a3bb168fd0cd384fe1bb2e02c7abd716 | /JAVA/Fundamentals/DataTypesAnd VariablesLab/SpecialNumbers10.java | a549b442d7532e64e339129b71af3932f8b96089 | [] | no_license | invjee/SoftUni-Software-Engineering | e6bc27761fce18d3da713c820c761663bf80b7ad | db47e2a7d3d8ab7f1e1881b87b5b113252b4c207 | refs/heads/main | 2023-03-29T16:39:26.987182 | 2021-04-02T05:43:59 | 2021-04-02T05:43:59 | 321,411,394 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 635 | java | package DataTypesAndVariables;
import java.util.Scanner;
public class SpecialNumbers10 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = Integer.parseInt(scanner.nextLine());
for (int i = 1; i <= n; i++) {
int number = i;
int sum = 0;
while(number>0){
sum+= number%10;
number /=10;
}
if(sum==5||sum==7||sum==11){
System.out.printf("%d -> True%n",i);
}else{
System.out.printf("%d -> False%n",i);
}
}
}
}
| [
"invjee@gmail.com"
] | invjee@gmail.com |
74e50daeb6a98f7cf124f3443b74318b958726ef | 1788d94fa6eec25643288ea23cd04fcf91ebcc8e | /MyStore/MyStorefacades/src/com/epam/kiev/mystore/facades/constants/YtelcoacceleratorfacadesConstants.java | 1a30cd48fd2036098b126e71e581c3ec3e60cc29 | [] | no_license | VANDAT/Ivan-Lukashchuk-EPAM-stud | 7cc24f150ada2b0665f344e4f789ddd1e35cc481 | 3b3065e8a337e140aea743453fb942a1cc3b773e | refs/heads/master | 2021-01-01T16:56:31.796293 | 2014-07-01T13:15:47 | 2014-07-01T13:15:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 690 | java | /*
*
* [y] hybris Platform
*
* Copyright (c) 2000-2011 hybris AG
* All rights reserved.
*
* This software is the confidential and proprietary information of hybris
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with hybris.
*
*/
package com.epam.kiev.mystore.facades.constants;
@SuppressWarnings("PMD")
public class YtelcoacceleratorfacadesConstants extends GeneratedYtelcoacceleratorfacadesConstants
{
public static final String EXTENSIONNAME = "MyStorefacades";
private YtelcoacceleratorfacadesConstants()
{
//empty
}
}
| [
"lujack@mail.ru"
] | lujack@mail.ru |
fe64829a4ef14005c0fd94846660ee338849d081 | 8ab7d1c670da881a4c1b75263039716ffdbc39d3 | /app/src/main/java/com/example/tesis/Ubicacion.java | 777472280475e6e792de20b4f8302fe8411edd63 | [] | no_license | von322/Tesis2 | de58d046a801986540d7281aab31571a20dec5a1 | 995ac00c0b7800cfaed184ed0c531a9ff4da834a | refs/heads/master | 2022-11-11T00:13:11.441474 | 2020-06-16T18:15:40 | 2020-06-16T18:15:40 | 275,879,178 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 574 | java | package com.example.tesis;
public class Ubicacion {
private double latitud;
private double longitud;
public Ubicacion() {
}
public Ubicacion(double latitud, double longitud) {
this.latitud = latitud;
this.longitud = longitud;
}
public double getLatitud() {
return latitud;
}
public void setLatitud(double latitud) {
this.latitud = latitud;
}
public double getLongitud() {
return longitud;
}
public void setLongitud(double longitud) {
this.longitud = longitud;
}
}
| [
"ricardovl31@gmail.com"
] | ricardovl31@gmail.com |
aedbbf916ed05114a76078d6ed6ed3b5852be395 | 7d6eb338f60f04b20f9ca02e245b98855485b86a | /src/mea/plugin/ConfigWriter.java | c65b80d2eb31d4a2c00bc1d9257e8ad231de2c2e | [] | no_license | Sayshal/meaSuite | 82f262fa4cc28ab18469a9fa44d4a06133081276 | 0d463572e5be889164d7d34eca056d101c9db286 | refs/heads/master | 2016-09-10T20:07:02.603481 | 2011-12-12T14:39:49 | 2011-12-12T14:39:49 | 2,965,947 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,967 | java | /* meaSuite is copyright 2011/2012 of Turt2Live Programming and Sayshal Productions
*
* Modifications of the code, or any use of the code must be preauthorized by Travis
* Ralston (Original author) before any modifications can be used. If any code is
* authorized for use, this header must retain it's original state. The authors (Travis
* Ralston and Tyler Heuman) can request your code at any time. Upon code request you have
* 24 hours to present code before we will ask you to not use our code.
*
* Contact information:
* Travis Ralston
* email: minecraft@turt2live.com
*
* Tyler Heuman
* email: contact@sayshal.com
*/
package mea.plugin;
import java.io.File;
import java.io.IOException;
import mea.Logger.MeaLogger;
import org.bukkit.plugin.java.JavaPlugin;
public class ConfigWriter {
private JavaPlugin plugin;
public ConfigWriter(JavaPlugin plugin){
this.plugin = plugin;
}
public void reload(){
plugin.reloadConfig();
}
public void write(){
try{
File d = plugin.getDataFolder();
d.mkdirs();
File f2 = new File(plugin.getDataFolder()+"/config.yml");
if(!f2.exists()){
f2.createNewFile();
if(plugin.getConfig().getString("meaSuite.author") == null){
plugin.getConfig().set("meaSuite.author", "Travis Ralston : minecraft@turt2live.com");
plugin.getConfig().set("meaSuite.downloadDevVersions", "false");
plugin.getConfig().set("meaSuite.prename", "meaSuite");
plugin.getConfig().set("meaSuite.colorVariable", "&");
plugin.getConfig().set("meaSuite.SQL.username", "meaCraft");
plugin.getConfig().set("meaSuite.SQL.password", "meaCraft");
plugin.getConfig().set("meaSuite.SQL.host", "localhost");
plugin.getConfig().set("meaSuite.SQL.port", "3306");
plugin.getConfig().set("meaSuite.SQL.database", "meaSuite");
plugin.saveConfig();
}
}
d = new File(plugin.getDataFolder()+"/meaGreylister/applications");
d.mkdirs();
checkForGreylister();
d = new File(plugin.getDataFolder()+"/meaFreeze/frozen_players");
d.mkdirs();
checkForFreeze();
//d = new File(plugin.getDataFolder()+"/RandomTP");
//d.mkdirs();
checkForRandomTP();
d = new File(plugin.getDataFolder()+"/meaChat/player_information");
d.mkdirs();
checkForChat();
d = new File(plugin.getDataFolder()+"/meaGoodies");
d.mkdirs();
checkForGoodies();
d = new File(plugin.getDataFolder()+"/meaHook");
d.mkdirs();
checkForHook();
d = new File(plugin.getDataFolder()+"/meaLottery");
d.mkdirs();
checkForLottery();
d = new File(plugin.getDataFolder()+"/meaLogger");
d.mkdirs();
d = new File(plugin.getDataFolder()+"/meaLogger/temp");
d.mkdirs();
d = new File(plugin.getDataFolder()+"/meaLogger/old_logs");
d.mkdirs();
checkForLogger();
}catch (Exception e){
e.printStackTrace();
MeaLogger.log(e.getMessage(), new File(plugin.getDataFolder()+"/meaLogger/log.txt"));
}
reload();
}
public void checkForGreylister() throws IOException{
if(plugin.getConfig().getString("meaGreylister.author") == null){
plugin.getConfig().set("meaGreylister.messages.onApplySent", "Your app was sent");
plugin.getConfig().set("meaGreylister.messages.onApplyHave", "Your app was already sent");
plugin.getConfig().set("meaGreylister.messages.onApplyExempt", "You are exempt");
plugin.getConfig().set("meaGreylister.messages.onGuestJoin", "Welcome guest!");
plugin.getConfig().set("meaGreylister.messages.onApplicantJoin", "Welcome applicant!");
plugin.getConfig().set("meaGreylister.messages.onApplyError", "Nice try :)");
plugin.getConfig().set("meaGreylister.messages.onAppError", "Nice try :)");
plugin.getConfig().set("meaGreylister.messages.onConsoleSend", "You must be in-game!");
plugin.getConfig().set("meaGreylister.messages.newApplication", "There is a new application from %PLAYER% (%NEWAPPS% applications)");
//plugin.getConfig().set("meaGreylister.messages.colorVariable", "&");
plugin.getConfig().set("meaGreylister.messages.notEnoughArgs", "You must supply enough arguments: %HELPMENU%");
plugin.getConfig().set("meaGreylister.messages.onEnable", "meaGreylister enabled!");
plugin.getConfig().set("meaGreylister.messages.onDisable", "meaGreylister disabled!");
plugin.getConfig().set("meaGreylister.onAcceptCommads.command1", "perm global addgroup Default %PLAYER%");
plugin.getConfig().set("meaGreylister.onAcceptCommads.command2", "perm global rmgroup Guest %PLAYER%");
plugin.getConfig().set("meaGreylister.onDeclineCommads.command1", "broadcast %PLAYER% fails!");
plugin.getConfig().set("meaGreylister.adminView.var1", "age");
plugin.getConfig().set("meaGreylister.adminView.var2", "rules");
plugin.getConfig().set("meaGreylister.adminView.var3", "message");
plugin.getConfig().set("meaGreylister.adminView.label1", "age");
plugin.getConfig().set("meaGreylister.adminView.label2", "rules");
plugin.getConfig().set("meaGreylister.adminView.label3", "message");
plugin.getConfig().set("meaGreylister.adminView.return1", "Age: %age%");
plugin.getConfig().set("meaGreylister.adminView.return2", "Rules: %rules%");
plugin.getConfig().set("meaGreylister.adminView.return3", "Message: %message%");
plugin.getConfig().set("meaGreylister.author", "Travis Ralston : minecraft@turt2live.com");
plugin.getConfig().set("meaGreylister.enabled", "true");
plugin.saveConfig();
}
}
public void checkForFreeze() throws IOException{
if(plugin.getConfig().getString("meaFreeze.author") == null){
//plugin.getConfig().set("meaFreeze.messages.colorVariable", "&");
plugin.getConfig().set("meaFreeze.messages.notEnoughArgs", "You must supply enough arguments: %HELPMENU%");
plugin.getConfig().set("meaFreeze.messages.onEnable", "meaFreeze enabled!");
plugin.getConfig().set("meaFreeze.messages.onDisable", "meaFreeze disabled!");
plugin.getConfig().set("meaFreeze.messages.onFreeze", "You are frozen!");
plugin.getConfig().set("meaFreeze.messages.onUnfreeze", "You are free!");
plugin.getConfig().set("meaFreeze.messages.onCodeFreeze", "You are frozen! Type /code %CODE% to unfreeze!");
plugin.getConfig().set("meaFreeze.messages.onFreezeCommand", "nocmd");
plugin.getConfig().set("meaFreeze.messages.onUnfreezeCommand", "nocmd");
plugin.getConfig().set("meaFreeze.messages.notFrozen", "%PLAYER% is not frozen!");
plugin.getConfig().set("meaFreeze.messages.freezeInfo.line1", "Frozen By: %WHOFROZE%");
plugin.getConfig().set("meaFreeze.messages.freezeInfo.line2", "Frozen Until: %FROZENUNTIL%");
plugin.getConfig().set("meaFreeze.messages.freezeInfo.line3", "Code Frozen: %CODEFROZEN%");
plugin.getConfig().set("meaFreeze.messages.freezeInfo.line4", "Frozen On: %FROZENON%");
plugin.getConfig().set("meaFreeze.messages.onFrozenLogin", "You are frozen until %FROZENUNTIL%");
plugin.getConfig().set("meaFreeze.messages.onExempt", "%PLAYER% is exempt!");
plugin.getConfig().set("meaFreeze.timestamp.format", "dd/MMM/YYYY @ hh:mm:ss z");
plugin.getConfig().set("meaFreeze.code.characters", "abcdefghijklmnopqrstuvwxyz0123456789");
plugin.getConfig().set("meaFreeze.code.randomUppercase", "true");
plugin.getConfig().set("meaFreeze.code.length", "8");
plugin.getConfig().set("meaFreeze.settings.lagReduction", "false");
plugin.getConfig().set("meaFreeze.settings.iceDome", "true");
plugin.getConfig().set("meaFreeze.author", "Travis Ralston : minecraft@turt2live.com");
plugin.getConfig().set("meaFreeze.enabled", "true");
plugin.saveConfig();
}
}
public void checkForRandomTP() throws IOException{
if(plugin.getConfig().getString("meaRandomTP.author") == null){
plugin.getConfig().set("meaRandomTP.author", "Travis Ralston : minecraft@turt2live.com");
plugin.getConfig().set("meaRandomTP.enabled", "true");
plugin.getConfig().set("meaRandomTP.onDisabledError", "We disabled teleports for now, sorry!");
//plugin.getConfig().set("meaRandomTP.colorVariable", "&");
plugin.getConfig().set("meaRandomTP.onTP", "Woosh!");
plugin.getConfig().set("meaRandomTP.onEnable", "RandomTP enabled");
plugin.getConfig().set("meaRandomTP.onDisable", "RandomTP disabled");
plugin.getConfig().set("meaRandomTP.noPerms", "You can't do that!");
plugin.getConfig().set("meaRandomTP.minX", "250");
plugin.getConfig().set("meaRandomTP.minY", "250");
plugin.getConfig().set("meaRandomTP.maxX", "500");
plugin.getConfig().set("meaRandomTP.maxY", "500");
plugin.saveConfig();
}
}
public void checkForChat() throws IOException{
if(plugin.getConfig().getString("meaChat.author") == null){
plugin.getConfig().set("meaChat.author", "Travis Ralston : minecraft@turt2live.com");
plugin.getConfig().set("meaChat.irc.server", "irc.esper.net");
plugin.getConfig().set("meaChat.irc.channel", "turt2live");
plugin.getConfig().set("meaChat.irc.MinecraftToIRC", true);
plugin.getConfig().set("meaChat.irc.IRCToMinecraft", true);
plugin.saveConfig();
}
}
public void checkForGoodies() throws IOException{
if(plugin.getConfig().getString("meaGoodies.author") == null){
plugin.getConfig().set("meaGoodies.author", "Travis Ralston : minecraft@turt2live.com");
plugin.getConfig().set("meaGoodies.noCaps", "true");
plugin.getConfig().set("meaGoodies.cancelSuggestionMessage", "true");
plugin.getConfig().set("meaGoodies.messages.onSuggestion", "Thank you for your suggestion.");
plugin.getConfig().set("meaGoodies.messages.onNoSuggestion", "Dumbass.");
plugin.getConfig().set("meaGoodies.timeFormat", "EEE, d MMM yyyy HH:mm:ss Z");
plugin.getConfig().set("meaGoodies.suggestionFormat", "[%TIMESTAMP%] %PLAYER% suggested %SUGGESTION%");
plugin.getConfig().set("meaGoodies.wrapSuggestionInQuotes", "true");
plugin.getConfig().set("meaGoodies.allCapsSuffix", "[Pony Rider]");
plugin.saveConfig();
}
}
public void checkForHook() throws IOException{
if(plugin.getConfig().getString("meaHook.author") == null){
//plugin.getConfig().set("meaHook.author", "Travis Ralston : minecraft@turt2live.com"); //TODO: TEMP
plugin.getConfig().set("meaHook.forceMeaEconomy", "false");
plugin.getConfig().set("meaHook.enableAdmins", "true");
//plugin.getConfig().set("meaHook.allowClientSideFormatting", "true"); //Force: true
plugin.getConfig().set("meaHook.formats.irc", "[&9|T&f] <&9|P&f>: &e|M");
plugin.getConfig().set("meaHook.formats.minecraft", "[&5|T&f] |R <&5|P&f>: &e|M");
plugin.getConfig().set("meaHook.formats.meaChat", "[&a|T&f] <&a|P&f>: &e|M");
plugin.getConfig().set("meaHook.formats.meaPM", "[&5meaPM&f] [&a|T&f] <&a|P&f>: &e|M");
plugin.getConfig().set("meaHook.formats.LQJ.minecraft", "[&5|T&f] |R <&5|P&f> &e|M");
plugin.getConfig().set("meaHook.formats.LQJ.meaChat", "[&a|T&f] <&a|P&f> &e|M");
plugin.getConfig().set("meaHook.formats.LQJ.meaPM", "[&5meaPM&f] [&a|T&f] <&a|P&f> &e|M");
plugin.getConfig().set("meaHook.formats.command", "[&a|T&f] |R <&a|P&f> &e|M");
plugin.getConfig().set("meaHook.formats.rank", "&f[^R&f]");
plugin.getConfig().set("meaHook.formats.showRanks", "true"); //If off, remove "double spaces" in frmt
plugin.getConfig().set("meaHook.enableAdmins", "true");
plugin.saveConfig();
}
}
public void checkForLottery() throws IOException{
if(plugin.getConfig().getString("meaLottery.author") == null){
plugin.getConfig().set("meaLottery.author", "Travis Ralston : minecraft@turt2live.com");
plugin.getConfig().set("meaLottery.enabled", "true");
plugin.getConfig().set("meaLottery.costOfTicket", 5.0);
plugin.getConfig().set("meaLottery.maxTicketsPerAccount", -1);
plugin.getConfig().set("meaLottery.onlineToWinMode", true);
plugin.saveConfig();
}
}
public void checkForLogger() throws IOException{
if(plugin.getConfig().getString("meaLogger.author") == null){
plugin.getConfig().set("meaLogger.author", "Travis Ralston : minecraft@turt2live.com");
plugin.saveConfig();
}
}
}
| [
"travpc@gmail.com"
] | travpc@gmail.com |
356d48d1b4033df60df38eccbab75065100069a1 | 4cf04fcf6967adba7f70bb6269b40ba1dd630554 | /app/src/main/java/com/ebabu/ach/Activity/LoginActivity.java | c82db2850834e87d1fad8dbbb5fb61ffab928dd4 | [] | no_license | tantuwaySourabh/ACH | a1c395171e8aae0dc8ab18fd9bc319cf72767809 | e7c4b49ff4aab2b347901d244603f4a5ae9e4f62 | refs/heads/master | 2020-06-01T02:20:22.858471 | 2017-06-12T13:06:51 | 2017-06-12T13:06:51 | 94,058,616 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,499 | java | package com.ebabu.ach.Activity;
import android.content.Context;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
import com.androidquery.AQuery;
import com.androidquery.callback.AjaxCallback;
import com.androidquery.callback.AjaxStatus;
import com.ebabu.ach.R;
import com.ebabu.ach.Utils.AppPreference;
import com.ebabu.ach.Utils.Utils;
import com.ebabu.ach.constants.IKeyConstants;
import com.ebabu.ach.constants.IUrlConstants;
import com.ebabu.ach.customview.CustomEditText;
import com.ebabu.ach.customview.CustomTextView;
import com.ebabu.ach.customview.MyLoading;
import org.json.JSONException;
import org.json.JSONObject;
public class LoginActivity extends AppCompatActivity {
private Context context;
private Intent intent = null;
private CustomEditText etMobileNum;
private String mobileNum, userId;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
context = LoginActivity.this;
initView();
}
private void initView() {
etMobileNum = (CustomEditText) findViewById(R.id.et_login_mobile);
findViewById(R.id.btn_signup).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
intent = new Intent(context, SignupFirstActivity.class);
startActivity(intent);
}
});
findViewById(R.id.btn_login).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (areFieldsValid()) {
verifyMobileNum();
}
}
});
}
private void verifyMobileNum() {
final MyLoading myLoading = new MyLoading(context);
myLoading.show("Verifying Mobile Number");
final JSONObject input = new JSONObject();
try {
input.put("mobile", mobileNum);
} catch (JSONException e) {
e.printStackTrace();
}
new AQuery(context).post(IUrlConstants.LOGIN, input, JSONObject.class, new AjaxCallback<JSONObject>() {
@Override
public void callback(String url, JSONObject json, AjaxStatus status) {
if (json != null) {
try {
if ((IKeyConstants.SUCCESS).equalsIgnoreCase(json.getString("status"))) {
Intent intent;
userId = json.getString("user_id");
Toast.makeText(context, "Message = " + json.getString("message"), Toast.LENGTH_SHORT).show();
intent = new Intent(context, OtpActivity.class);
intent.putExtra(IKeyConstants.USERID, userId);
intent.putExtra(IKeyConstants.MOBILE, mobileNum);
startActivity(intent);
} else {
Toast.makeText(context, "ERROR " + json.getString("message"), Toast.LENGTH_SHORT).show();
}
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(context, "EMPTY JSON", Toast.LENGTH_SHORT).show();
}
}
myLoading.dismiss();
}
});
}
private boolean areFieldsValid() {
mobileNum = etMobileNum.getText().toString();
if (mobileNum.isEmpty()) {
etMobileNum.setError("Mobile number cannot be blank");
return false;
}
if (mobileNum.length() != 10) {
etMobileNum.setError("Mobile number must be of 10 digits");
return false;
}
int firstNumber = mobileNum.charAt(0);
if (firstNumber < 7) {
etMobileNum.setError("Mobile number is not valid");
return false;
}
if (!Utils.isNetworkConnected(context)) {
Toast.makeText(context, getString(R.string.network_error), Toast.LENGTH_SHORT).show();
return false;
}
return true;
}
}
| [
"sourabhtan102@gmail.com"
] | sourabhtan102@gmail.com |
8d8114d1cedb8c04541eddf08f14076c079c6354 | 0ca3fb706c62745f674f4f9234c7200a3ebf5f70 | /BigApp/BigApps/src/com/example/bigapps/horizonlist/HorizonListActivity3.java | 86c359d13bfe36972e7f678b3edcf39e80632c41 | [] | no_license | YC-YC/TestApplications | 3205084fb6da5f73fce42a03777faf3ecc512eb1 | b15f7d874e7356fc6c69697d5f1ab1fe2d7e2131 | refs/heads/master | 2020-05-30T07:19:30.702952 | 2017-04-20T08:11:30 | 2017-04-20T08:11:30 | 68,898,780 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,000 | java | /**
*
*/
package com.example.bigapps.horizonlist;
import java.util.ArrayList;
import java.util.List;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Toast;
import com.example.bigapps.R;
import com.example.bigapps.horizonlist.MyHorizontalScollView.CurrentImageChangeListener;
import com.example.bigapps.horizonlist.MyHorizontalScollView.OnItemClickListener;
/**
* @author YC
* @time 2016-3-29 上午9:22:35
*/
public class HorizonListActivity3 extends Activity {
private static final String TAG = "HorizonListActivity";
private List<CityItem> cityList;
private MyHorizontalScollView mHorizontalScollView;
private HorizontalScrollViewAdapter mAdapter;
private LayoutInflater mInflater;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mInflater = LayoutInflater.from(this);
setContentView(R.layout.main_horizonlist3);
setData();
initViews();
}
private void initViews() {
mHorizontalScollView = (MyHorizontalScollView) findViewById(R.id.id_horizontalscollview);
mAdapter = new HorizontalScrollViewAdapter(this, cityList);
mHorizontalScollView.setAdapter(mAdapter);
mHorizontalScollView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onClick(View view, int pos) {
Toast.makeText(getApplicationContext(), "点击了第" + pos +"项", Toast.LENGTH_SHORT).show();
}
});
mHorizontalScollView.setCurrentImageChangeListener(new CurrentImageChangeListener() {
@SuppressLint("NewApi")
@Override
public void onCurrentImgChanged(int position, View viewIndicator) {
Log.i(TAG, "第一个显示项是" + position);
// viewIndicator.setScaleX(2.5f);
// viewIndicator.setScaleY(2.5f);
viewIndicator.setBackgroundResource(R.drawable.ic_launcher);
}
});
}
private void setData() {
cityList = new ArrayList<CityItem>();
CityItem item = new CityItem("深圳", "0755", R.drawable.china);
cityList.add(item);
item = new CityItem("上海", "021", R.drawable.china);
cityList.add(item);
item = new CityItem("广州", "020", R.drawable.china);
cityList.add(item);
item = new CityItem("北京", "010", R.drawable.china);
cityList.add(item);
item = new CityItem("武汉", "027", R.drawable.china);
cityList.add(item);
item = new CityItem("孝感", "0712", R.drawable.china);
cityList.add(item);
cityList.addAll(cityList);
}
public class CityItem {
private String cityName;
private String cityCode;
private int imgID;
public CityItem(String cityName, String cityCode, int imgID) {
super();
this.cityName = cityName;
this.cityCode = cityCode;
this.imgID = imgID;
}
public String getCityName() {
return cityName;
}
public String getCityCode() {
return cityCode;
}
public int getImgID() {
return imgID;
}
}
}
| [
"yellowc.yc@aliyun.com"
] | yellowc.yc@aliyun.com |
d35f71595830a2b7e99fcb28f4ad2005778e008d | 2d4f8a262c92c6864a3a243fc1dcd34989f38a76 | /hybris/bin/custom/tm/tmstorefront/web/src/com/tm/storefront/controllers/pages/PickupInStoreController.java | 0c42775504e6ccd6ef6e52d46a9daf96a88a036f | [] | no_license | ianilprasad/TM | 201f9e3d0eabee99bc736dbb2cb6ef3606b36207 | 28493a76e81d9dc1c247ac2bb59e64cc53203db4 | refs/heads/master | 2020-04-04T17:52:42.348824 | 2018-11-05T01:05:36 | 2018-11-05T01:05:36 | 156,140,005 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,802 | java | /*
* [y] hybris Platform
*
* Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package com.tm.storefront.controllers.pages;
import de.hybris.platform.acceleratorfacades.customerlocation.CustomerLocationFacade;
import de.hybris.platform.acceleratorservices.store.data.UserLocationData;
import de.hybris.platform.acceleratorstorefrontcommons.controllers.pages.AbstractSearchPageController;
import de.hybris.platform.acceleratorstorefrontcommons.controllers.util.GlobalMessages;
import de.hybris.platform.acceleratorstorefrontcommons.forms.PickupInStoreForm;
import de.hybris.platform.commercefacades.order.CartFacade;
import de.hybris.platform.commercefacades.order.data.CartModificationData;
import de.hybris.platform.commercefacades.product.ProductFacade;
import de.hybris.platform.commercefacades.product.ProductOption;
import de.hybris.platform.commercefacades.product.data.ProductData;
import de.hybris.platform.commercefacades.storefinder.StoreFinderStockFacade;
import de.hybris.platform.commercefacades.storefinder.data.StoreFinderStockSearchPageData;
import de.hybris.platform.commercefacades.storelocator.data.PointOfServiceStockData;
import de.hybris.platform.commerceservices.order.CommerceCartModificationException;
import de.hybris.platform.commerceservices.order.CommerceCartModificationStatus;
import de.hybris.platform.commerceservices.store.data.GeoPoint;
import de.hybris.platform.servicelayer.config.ConfigurationService;
import com.tm.storefront.controllers.ControllerConstants;
import com.tm.storefront.security.cookie.CustomerLocationCookieGenerator;
import java.util.Arrays;
import java.util.Collections;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.validation.ObjectError;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
@Controller
@RequestMapping("/store-pickup")
public class PickupInStoreController extends AbstractSearchPageController
{
private static final String QUANTITY_REDUCED_NUMBER_OF_ITEMS_ADDED = "basket.information.quantity.reducedNumberOfItemsAdded.";
private static final String TYPE_MISMATCH_ERROR_CODE = "typeMismatch";
private static final String ERROR_MSG_TYPE = "errorMsg";
private static final String QUANTITY_INVALID_BINDING_MESSAGE_KEY = "basket.error.quantity.invalid.binding";
private static final String POINTOFSERVICE_DISPLAY_SEARCH_RESULTS_COUNT = "pointofservice.display.search.results.count";
private static final Logger LOG = Logger.getLogger(PickupInStoreController.class);
private static final String PRODUCT_CODE_PATH_VARIABLE_PATTERN = "/{productCode:.*}";
private static final String GOOGLE_API_KEY_ID = "googleApiKey";
private static final String GOOGLE_API_VERSION = "googleApiVersion";
@Resource(name = "cartFacade")
private CartFacade cartFacade;
@Resource(name = "productVariantFacade")
private ProductFacade productFacade;
@Resource(name = "customerLocationFacade")
private CustomerLocationFacade customerLocationFacade;
@Resource(name = "storeFinderStockFacade")
private StoreFinderStockFacade<PointOfServiceStockData, StoreFinderStockSearchPageData<PointOfServiceStockData>> storeFinderStockFacade;
@Resource(name = "customerLocationCookieGenerator")
private CustomerLocationCookieGenerator cookieGenerator;
@Resource(name = "configurationService")
private ConfigurationService configurationService;
@ModelAttribute("googleApiVersion")
public String getGoogleApiVersion()
{
return configurationService.getConfiguration().getString(GOOGLE_API_VERSION);
}
@ModelAttribute("googleApiKey")
public String getGoogleApiKey(final HttpServletRequest request)
{
final String googleApiKey = getHostConfigService().getProperty(GOOGLE_API_KEY_ID, request.getServerName());
if (StringUtils.isEmpty(googleApiKey))
{
LOG.warn("No Google API key found for server: " + request.getServerName());
}
return googleApiKey;
}
@RequestMapping(value = PRODUCT_CODE_PATH_VARIABLE_PATTERN + "/pointOfServices", method = RequestMethod.POST)
public String getPointOfServiceForStorePickupSubmit(@PathVariable("productCode") final String encodedProductCode, // NOSONAR
@RequestParam(value = "locationQuery", required = false) final String locationQuery,
@RequestParam(value = "latitude", required = false) final Double latitude,
@RequestParam(value = "longitude", required = false) final Double longitude,
@RequestParam(value = "page", defaultValue = "0") final int page,
@RequestParam(value = "show", defaultValue = "Page") final AbstractSearchPageController.ShowMode showMode,
@RequestParam(value = "sort", required = false) final String sortCode,
@RequestParam(value = "cartPage", defaultValue = "Page") final Boolean cartPage,
@RequestParam(value = "entryNumber", defaultValue = "0") final Long entryNumber,
@RequestParam(value = "qty", defaultValue = "0") final Long qty, final HttpServletResponse response, final Model model)
{
GeoPoint geoPoint = null;
if (longitude != null && latitude != null)
{
geoPoint = new GeoPoint();
geoPoint.setLongitude(longitude.doubleValue());
geoPoint.setLatitude(latitude.doubleValue());
}
model.addAttribute("qty", qty);
return getPointOfServiceForStorePickup(decodeWithScheme(encodedProductCode, UTF_8), locationQuery, geoPoint, page, showMode, sortCode,
cartPage, entryNumber, model, RequestMethod.POST, response);
}
@RequestMapping(value = PRODUCT_CODE_PATH_VARIABLE_PATTERN + "/pointOfServices", method = RequestMethod.GET)
public String getPointOfServiceForStorePickupClick(@PathVariable("productCode") final String encodedProductCode, // NOSONAR
@RequestParam(value = "page", defaultValue = "0") final int page,
@RequestParam(value = "show", defaultValue = "Page") final AbstractSearchPageController.ShowMode showMode,
@RequestParam(value = "sort", required = false) final String sortCode,
@RequestParam(value = "cartPage") final Boolean cartPage, @RequestParam(value = "entryNumber") final Long entryNumber,
final HttpServletResponse response, final Model model)
{
final UserLocationData userLocationData = customerLocationFacade.getUserLocationData();
String location = "";
GeoPoint geoPoint = null;
if (userLocationData != null)
{
location = userLocationData.getSearchTerm();
geoPoint = userLocationData.getPoint();
}
return getPointOfServiceForStorePickup(decodeWithScheme(encodedProductCode, UTF_8), location, geoPoint, page, showMode, sortCode,
cartPage, entryNumber, model, RequestMethod.GET, response);
}
protected String getPointOfServiceForStorePickup(final String productCode, final String locationQuery, // NOSONAR
final GeoPoint geoPoint, final int page, final AbstractSearchPageController.ShowMode showMode, final String sortCode,
final Boolean cartPage, final Long entryNumber, final Model model, final RequestMethod requestMethod,
final HttpServletResponse response)
{
final int pagination = getSiteConfigService().getInt(POINTOFSERVICE_DISPLAY_SEARCH_RESULTS_COUNT, 6);
final ProductData productData = new ProductData();
productData.setCode(productCode);
final StoreFinderStockSearchPageData<PointOfServiceStockData> storeFinderStockSearchPageData;
if (StringUtils.isNotBlank(locationQuery))
{
storeFinderStockSearchPageData = storeFinderStockFacade.productSearch(locationQuery, productData,
createPageableData(page, pagination, sortCode, showMode));
model.addAttribute("locationQuery", locationQuery.trim());
if (RequestMethod.POST.equals(requestMethod)
&& storeFinderStockSearchPageData.getPagination().getTotalNumberOfResults() > 0)
{
final UserLocationData userLocationData = new UserLocationData();
if (geoPoint != null)
{
userLocationData.setPoint(geoPoint);
}
userLocationData.setSearchTerm(locationQuery);
customerLocationFacade.setUserLocationData(userLocationData);
cookieGenerator.addCookie(response, generatedUserLocationDataString(userLocationData));
}
}
else if (geoPoint != null)
{
storeFinderStockSearchPageData = storeFinderStockFacade.productSearch(geoPoint, productData,
createPageableData(page, pagination, sortCode, showMode));
model.addAttribute("geoPoint", geoPoint);
if (RequestMethod.POST.equals(requestMethod)
&& storeFinderStockSearchPageData.getPagination().getTotalNumberOfResults() > 0)
{
final UserLocationData userLocationData = new UserLocationData();
userLocationData.setPoint(geoPoint);
customerLocationFacade.setUserLocationData(userLocationData);
cookieGenerator.addCookie(response, generatedUserLocationDataString(userLocationData));
}
}
else
{
storeFinderStockSearchPageData = emptyStoreFinderResult(productData);
}
populateModel(model, storeFinderStockSearchPageData, showMode);
model.addAttribute("cartPage", cartPage);
model.addAttribute("entryNumber", entryNumber);
return ControllerConstants.Views.Fragments.Product.StorePickupSearchResults;
}
protected StoreFinderStockSearchPageData<PointOfServiceStockData> emptyStoreFinderResult(final ProductData productData)
{
final StoreFinderStockSearchPageData<PointOfServiceStockData> storeFinderStockSearchPageData;
storeFinderStockSearchPageData = new StoreFinderStockSearchPageData<>();
storeFinderStockSearchPageData.setProduct(productData);
storeFinderStockSearchPageData.setResults(Collections.<PointOfServiceStockData> emptyList());
storeFinderStockSearchPageData.setPagination(createEmptyPagination());
return storeFinderStockSearchPageData;
}
protected String generatedUserLocationDataString(final UserLocationData userLocationData)
{
final StringBuilder builder = new StringBuilder();
final GeoPoint geoPoint = userLocationData.getPoint();
String latitudeAndLongitudeString = "";
if (geoPoint != null)
{
latitudeAndLongitudeString = builder.append(geoPoint.getLatitude())
.append(CustomerLocationCookieGenerator.LATITUDE_LONGITUDE_SEPARATOR).append(geoPoint.getLongitude()).toString();
}
builder.setLength(0);
builder.append(userLocationData.getSearchTerm()).append(CustomerLocationCookieGenerator.LOCATION_SEPARATOR)
.append(latitudeAndLongitudeString);
return builder.toString();
}
@RequestMapping(value = "/cart/add", method = RequestMethod.POST, produces = "application/json")
public String addToCartPickup(@RequestParam("productCodePost") final String code,
@RequestParam("storeNamePost") final String storeId, final Model model, @Valid final PickupInStoreForm form,
final BindingResult bindingErrors)
{
if (bindingErrors.hasErrors())
{
return getViewWithBindingErrorMessages(model, bindingErrors);
}
final long qty = form.getHiddenPickupQty();
if (qty <= 0)
{
model.addAttribute(ERROR_MSG_TYPE, "basket.error.quantity.invalid");
return ControllerConstants.Views.Fragments.Cart.AddToCartPopup;
}
try
{
final CartModificationData cartModification = cartFacade.addToCart(code, qty, storeId);
model.addAttribute("quantity", Long.valueOf(cartModification.getQuantityAdded()));
model.addAttribute("entry", cartModification.getEntry());
if (cartModification.getQuantityAdded() == 0L)
{
model.addAttribute(ERROR_MSG_TYPE, "basket.information.quantity.noItemsAdded." + cartModification.getStatusCode());
}
else if (cartModification.getQuantityAdded() < qty)
{
model.addAttribute(ERROR_MSG_TYPE, QUANTITY_REDUCED_NUMBER_OF_ITEMS_ADDED + cartModification.getStatusCode());
}
// Put in the cart again after it has been modified
model.addAttribute("cartData", cartFacade.getSessionCart());
}
catch (final CommerceCartModificationException ex)
{
model.addAttribute(ERROR_MSG_TYPE, "basket.error.occurred");
model.addAttribute("quantity", Long.valueOf(0L));
LOG.warn("Couldn't add product of code " + code + " to cart.", ex);
}
final ProductData productData = productFacade.getProductForCodeAndOptions(code,
Arrays.asList(ProductOption.BASIC, ProductOption.PRICE));
model.addAttribute("product", productData);
model.addAttribute("cartData", cartFacade.getSessionCart());
return ControllerConstants.Views.Fragments.Cart.AddToCartPopup;
}
protected String getViewWithBindingErrorMessages(final Model model, final BindingResult bindingErrors)
{
for (final ObjectError error : bindingErrors.getAllErrors())
{
if (isTypeMismatchError(error))
{
model.addAttribute(ERROR_MSG_TYPE, QUANTITY_INVALID_BINDING_MESSAGE_KEY);
}
else
{
model.addAttribute(ERROR_MSG_TYPE, error.getDefaultMessage());
}
}
return ControllerConstants.Views.Fragments.Cart.AddToCartPopup;
}
protected boolean isTypeMismatchError(final ObjectError error)
{
return error.getCode().equals(TYPE_MISMATCH_ERROR_CODE);
}
@RequestMapping(value = "/cart/update", method = RequestMethod.POST, produces = "application/json")
public String updateCartQuantities(@RequestParam("storeNamePost") final String storeId,
@RequestParam("entryNumber") final long entryNumber, @RequestParam("hiddenPickupQty") final long quantity,
final RedirectAttributes redirectModel) throws CommerceCartModificationException
{
final CartModificationData cartModificationData = cartFacade.updateCartEntry(entryNumber, storeId);
if (entryNumber == cartModificationData.getEntry().getEntryNumber().intValue())
{
final CartModificationData cartModification = cartFacade.updateCartEntry(entryNumber, quantity);
if (cartModification.getQuantity() == quantity)
{
// Success
if (cartModification.getQuantity() == 0)
{
// Success in removing entry
GlobalMessages.addFlashMessage(redirectModel, GlobalMessages.CONF_MESSAGES_HOLDER, "basket.page.message.remove");
}
else
{
// Success in update quantity
GlobalMessages.addFlashMessage(redirectModel, GlobalMessages.CONF_MESSAGES_HOLDER,
"basket.page.message.update.pickupinstoreitem");
}
}
else
{
// Less than successful
GlobalMessages.addFlashMessage(redirectModel, GlobalMessages.ERROR_MESSAGES_HOLDER,
QUANTITY_REDUCED_NUMBER_OF_ITEMS_ADDED + cartModification.getStatusCode());
}
}
else if (!CommerceCartModificationStatus.SUCCESS.equals(cartModificationData.getStatusCode()))
{
//When update pickupInStore happens to be same as existing entry with POS and SKU and that merged POS has lower stock
GlobalMessages.addFlashMessage(redirectModel, GlobalMessages.ERROR_MESSAGES_HOLDER,
QUANTITY_REDUCED_NUMBER_OF_ITEMS_ADDED + cartModificationData.getStatusCode());
}
return REDIRECT_PREFIX + "/cart";
}
@RequestMapping(value = "/cart/update/delivery", method =
{ RequestMethod.GET, RequestMethod.POST })
public String updateToDelivery(@RequestParam("entryNumber") final long entryNumber, final RedirectAttributes redirectModel)
throws CommerceCartModificationException
{
final CartModificationData cartModificationData = cartFacade.updateCartEntry(entryNumber, null);
if (CommerceCartModificationStatus.SUCCESS.equals(cartModificationData.getStatusCode()))
{
// Success in update quantity
GlobalMessages.addFlashMessage(redirectModel, GlobalMessages.CONF_MESSAGES_HOLDER,
"basket.page.message.update.pickupinstoreitem.toship");
}
else
{
// Less than successful
GlobalMessages.addFlashMessage(redirectModel, GlobalMessages.ERROR_MESSAGES_HOLDER,
QUANTITY_REDUCED_NUMBER_OF_ITEMS_ADDED + cartModificationData.getStatusCode());
}
return REDIRECT_PREFIX + "/cart";
}
} | [
"anil.prasad@ameri100.com"
] | anil.prasad@ameri100.com |
a101f6fea30caeb97592818ee851eee98999e05e | a9e8766f7c203a58b60be6e73a342ec56229b607 | /src/main/java/com/corejava/Employee.java | fdbf17e88ae0b7a6c0f96387b889d854a26aeb90 | [] | no_license | VimalVDS/MyProject_HMS | c9116a49444832232b9ddc357f3dcf995f342ead | 8cf61348c987d176b4f182ffbb190ef88b05e7f2 | refs/heads/master | 2020-04-29T03:34:05.274318 | 2019-03-15T12:38:56 | 2019-03-15T12:38:56 | 175,811,084 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,309 | java | package com.corejava;
public class Employee {
int empId;
double sal;
String empName;
String address;
public Employee() {
// TODO Auto-generated constructor stub
}
public Employee(int empId,double sal1,String empName1,String address1){
this.empId=empId;
sal=sal1;
empName=empName1;
address=address1;
}
public int getEmpId() {
return empId;
}
public void setEmpId(int empId) {
this.empId = empId;
}
public double getSal() {
return sal;
}
public void setSal(double sal) {
this.sal = sal;
}
public String getEmpName() {
return empName;
}
public void setEmpName(String empName) {
this.empName = empName;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
@Override
public String toString() {
// TODO Auto-generated method stub
return empId+" "+empName+" "+sal+" "+address;
}
public static void main(String[] args) {
Employee e=new Employee();
System.out.println(e.empId);
System.out.println(e.sal);
System.out.println(e.empName);
System.out.println(e.address);
Employee e1=new Employee(10,50000.00,"baskar","jntu");
System.out.println(e1.empId);
System.out.println(e1.sal);
System.out.println(e1.empName);
System.out.println(e1.address);
}
}
| [
"vimal.vnlds@gmail.com"
] | vimal.vnlds@gmail.com |
a60d671a4db5367f3beeea1c3be94fdee17f8aca | 3da61a8075ea4d114307dca53b395031db671f1b | /src/main/java/ru/tehkode/permissions/sql/SQLConnectionManager.java | 7d5c999b418dcae657cfddb87b0224ac8d7c282b | [] | no_license | flames/PermissionsEx | 86d634d649a963553d0e06cb38b5ac859338eb53 | 13aa8bd4a88e0061599dbcca1e04baceadfd5073 | refs/heads/master | 2021-01-24T00:27:23.363396 | 2011-05-23T20:30:17 | 2011-05-23T20:30:17 | 1,789,811 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,468 | java | /*
* PermissionsEx - Permissions plugin for Bukkit
* Copyright (C) 2011 t3hk0d3 http://www.tehkode.ru
*
* 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 2
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package ru.tehkode.permissions.sql;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Arrays;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import ru.tehkode.utils.StringUtils;
/**
*
* @author code
*/
public class SQLConnectionManager {
protected Connection db;
public SQLConnectionManager(String uri, String user, String password, String dbDriver) {
try {
Class.forName(getDriverClass(dbDriver)).newInstance();
db = DriverManager.getConnection("jdbc:" + uri, user, password);
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
@Override
protected void finalize() throws Throwable {
super.finalize();
try {
db.close();
} catch (SQLException e) {
Logger.getLogger("Minecraft").log(Level.WARNING, "Error while disconnecting from database: {0}", e.getMessage());
} finally {
db = null;
}
}
public ResultSet selectQuery(String sql, Object... params) throws SQLException {
PreparedStatement stmt = this.db.prepareStatement(sql);
if (params != null) {
this.bindParams(stmt, params);
}
return stmt.executeQuery();
}
public Object selectQueryOne(String sql, Object fallback, Object... params) {
try {
ResultSet result = this.selectQuery(sql, params);
if (!result.next()) {
return fallback;
}
return result.getObject(1);
} catch (SQLException e) {
Logger.getLogger("Minecraft").severe("SQL Error: " + e.getMessage());
}
return fallback;
}
public void updateQuery(String sql, Object... params) {
try {
PreparedStatement stmt = this.db.prepareStatement(sql);
if (params != null) {
this.bindParams(stmt, params);
}
stmt.executeUpdate();
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
public void insert(String table, String[] fields, List<Object[]> rows) throws SQLException {
String[] fieldValues = new String[fields.length];
Arrays.fill(fieldValues, "?");
String sql = "INSERT INTO " + table + " (" + StringUtils.implode(fields, ", ") + ") VALUES (" + StringUtils.implode(fieldValues, ", ") + ");";
PreparedStatement stmt = this.db.prepareStatement(sql);
for (Object[] params : rows) {
this.bindParams(stmt, params);
stmt.execute();
}
}
public boolean isTableExist(String tableName) {
try {
return this.db.getMetaData().getTables(null, null, tableName, null).next();
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
protected static String getDriverClass(String alias) {
if (alias.equals("mysql")) {
alias = "com.mysql.jdbc.Driver";
} else if (alias.equals("sqlite")) {
alias = "org.sqlite.JDBC";
} else if (alias.equals("postgre")) {
alias = "org.postgresql.Driver";
}
return alias;
}
protected void bindParams(PreparedStatement stmt, Object[] params) throws SQLException {
for (int i = 1; i <= params.length; i++) {
Object param = params[i - 1];
stmt.setObject(i, param);
}
}
}
| [
"clouster@yandex.ru"
] | clouster@yandex.ru |
06ad552cc67da3939c144b4f640f139e7dfad310 | f9c637ab9501b0a68fa0d18a061cbd555abf1f79 | /test/import-data/KafkaSparkProducer/src/com/adr/bigdata/dataimport/logic/impl/docgen/DocGenerationJobFactory.java | 266613e6e807407832a8d6a6f1b921e0569fb077 | [] | no_license | minha361/leanHTMl | c05000a6447b31f7869b75c532695ca2b0cd6968 | dc760e7d149480c0b36f3c7064b97d0f3d4b3872 | refs/heads/master | 2022-06-01T02:54:46.048064 | 2020-08-11T03:20:34 | 2020-08-11T03:20:34 | 48,735,593 | 0 | 0 | null | 2022-05-20T20:49:57 | 2015-12-29T07:55:48 | Java | UTF-8 | Java | false | false | 1,116 | java | package com.adr.bigdata.dataimport.logic.impl.docgen;
import java.io.Serializable;
import org.apache.spark.SparkConf;
public final class DocGenerationJobFactory implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
public static DocGenerationJob getDocGenerationJob(int type) {
switch (type) {
case 1:
return new BrandDocGenerationJob();
case 2:
return new CategoryDocGenerationJob();
case 3:
//return new AttributeDocGenerationJob();
throw new IllegalArgumentException("Type AttributeDocGenerationJob no longer supported " + type);
case 4:
return new AttributeValueDocGenerationJob();
case 5:
return new MerchantDocGenerationJob();
case 6:
return new WarehouseDocGenerationJob();
case 7:
return new PromotionDocGenerationJob();
case 8:
return new PromotionProductItemMappingDocGenerationJob();
case 9:
return new WarehouseProductItemMappingDocGenerationJob();
case 10:
return new ProductItemDocGenerationJob();
default:
throw new IllegalArgumentException("Type not supported " + type);
}
}
}
| [
"v.minhlq2@adayroi.com"
] | v.minhlq2@adayroi.com |
26d2df7fd2628396045edf6ed501dced78854cae | 5592ef8541eab074a26dc91b72af94af7853d432 | /formula/src/main/java/org/conceptoriented/bistro/formula/Formula.java | 73604b9d09fbec52a0e18579a73fd857201f73d8 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | asavinov/bistro | a6079ccc580479ca4c45fed72a46e65580c189c5 | 0fc854dd8e390ccfde89021cb43e273e362295d7 | refs/heads/master | 2018-09-22T02:09:25.154220 | 2018-09-07T15:50:25 | 2018-09-07T15:50:25 | 110,134,042 | 343 | 11 | null | null | null | null | UTF-8 | Java | false | false | 601 | java | package org.conceptoriented.bistro.formula;
import org.conceptoriented.bistro.core.ColumnPath;
import org.conceptoriented.bistro.core.EvalCalculate;
import java.util.List;
public interface Formula extends Expression {
public static String Exp4j = "org.conceptoriented.bistro.core.formula.FormulaExp4j";
public static String Evalex = "org.conceptoriented.bistro.core.formula.FormulaEvalex";
public static String Mathparser = "org.conceptoriented.bistro.core.formula.FormulaMathparser";
public static String JavaScript = "org.conceptoriented.bistro.core.formula.FormulaJavaScript";
}
| [
"savinov@conceptoriented.org"
] | savinov@conceptoriented.org |
36f288f96aed1f07defc03a443e6c28cfad2635a | 02de7ce8a5dc57236402102071da656e40ffc4e7 | /src/main/java/com/biwork/po/request/AddCoinPojo.java | 7ff33ccc7a8336c9c98b110be6873c4aadbf5557 | [] | no_license | guoshijiang/biwork_service | afd97b26d809e76573d53424f3890d68431a470f | bdf3a5a666a6b87c59fa43145a7e314703193cd7 | refs/heads/master | 2020-05-02T18:19:37.900632 | 2019-03-29T07:45:59 | 2019-03-29T07:45:59 | 178,126,046 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 666 | java | package com.biwork.po.request;
public class AddCoinPojo {
private String searchMark;
private String likeQueryName;
private String contractAddress;
public String getSearchMark() {
return searchMark;
}
public void setSearchMark(String searchMark)
{
this.searchMark = searchMark;
}
public String getLikeQueryName() {
return likeQueryName;
}
public void setLikeQueryName(String likeQueryName) {
this.likeQueryName = likeQueryName;
}
public String getContractAddress() {
return contractAddress;
}
public void setContractAddress(String contractAddress) {
this.contractAddress = contractAddress;
}
}
| [
"guoshijiang2012@163.com"
] | guoshijiang2012@163.com |
ea911ed462028d6389f6067f6d008fe4317f6a0f | 7be443c750e351492d321f5f349ab3ffd8c02825 | /src/main/java/com/e1708/cms/service/ArticleService.java | 0a8d8c2fa768135fdc5c78edcdb2134afb90d1c5 | [] | no_license | moteinstorm/cms-1708e | 306f2443a70be2219194962b97919faffb083aa5 | 0603f9c11759f5cf03d58092720634caf40ea39f | refs/heads/master | 2022-12-22T12:08:03.172631 | 2019-12-23T05:19:43 | 2019-12-23T05:19:43 | 227,017,053 | 1 | 1 | null | 2022-12-16T04:54:05 | 2019-12-10T03:02:36 | JavaScript | UTF-8 | Java | false | false | 2,481 | java | package com.e1708.cms.service;
import java.util.List;
import javax.validation.Valid;
import com.e1708.cms.entity.Article;
import com.e1708.cms.entity.Category;
import com.e1708.cms.entity.Channel;
import com.e1708.cms.entity.Comment;
import com.e1708.cms.entity.Complain;
import com.e1708.cms.entity.Slide;
import com.github.pagehelper.PageInfo;
/**
*
* @author zhuzg
*
*/
public interface ArticleService {
/**
* 根据用户列出文章
* @param id
* @param page
* @return
*/
PageInfo<Article> listByUser(Integer id, int page);
/**
* 删除文章
* @param id
* @return
*/
int delete(int id);
/**
* 获取所有的栏目
* @return
*/
List<Channel> getChannels();
List<Category> getCategorisByCid(int cid);
/**
* 发布文章
* @param article
*/
int add(Article article);
/**
* 根据文章id获取文章对象
* @param id
* @return
*/
Article getById(int id);
/**
* 获取文章的简要信息 常常用于判断文章的存在性
* @param id
* @return
*/
Article getInfoById(int id);
/**
*
* @param article
* @param id
* @return
*/
int update(Article article, Integer id);
/**
* 获取文章列表
* @param status
* @param page
* @return
*/
PageInfo<Article> list(int status, int page);
int setHot(int id, int status);
int setCheckStatus(int id, int status);
/**
* 获取热门文章
* @param page
* @return
*/
PageInfo<Article> hotList(int page);
/**
* 获取最新文章NAG
* @return
*/
List<Article> lastList();
/**
* 获取轮播图
* @return
*/
List<Slide> getSlides();
/**
* 获取栏目下的文章
* @param channleId
* @param catId
* @param page
* @return
*/
PageInfo<Article> getArticles(int channleId, int catId, int page);
/**
* 获取栏目下的分类
* @param channleId
* @return
*/
List<Category> getCategoriesByChannelId(int channleId);
/**
* 发表评论
* @param comment
* @return
*/
int addComment(Comment comment);
/**
* 根据文章id获取评论
* @param id
* @param page
* @return
*/
PageInfo<Comment> getComments(int articleId, int page);
int addComplian( Complain complain);
/**
* 获取投书
* @param articleId
* @param page
* @return
*/
PageInfo<Complain> getComplains(int articleId, int page);
}
| [
"454665830@qq.com"
] | 454665830@qq.com |
a57df0284db53a9d99b217106dea885e4900162c | 5aedbfc7af641b0accd4ea7e6bdc8d8e7c52c9df | /core/src/com/dreamwalker/assets/AssetPaths.java | 2ba4dd7b831bc29a8509592ef0337092c9df4645 | [] | no_license | bloodwi11/Crewman | 7dbd095906ac80c4adccd1528d7efa014bcf7967 | f449c7a9a03e0c3e076b27edb8d9c77b93111dd3 | refs/heads/master | 2020-03-19T16:15:02.595436 | 2018-06-09T11:48:28 | 2018-06-09T11:48:28 | 136,707,337 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 359 | java | package com.dreamwalker.assets;
public class AssetPaths {
public static final String TILE_GRID = "32x_tilegrid.png";
public static final String GLASS_TILE = "32xGlassTileMap.atlas";
public static final String NULL_TILE = "32xNullTileMap.atlas";
public static final String PLATE_TILE = "32xPlateTileMap.atlas";
private AssetPaths() {}
}
| [
"bloodwi11Gmail.com"
] | bloodwi11Gmail.com |
09ed2870f3c5d1b2462dc459f3f7e57a3dd84e66 | 424c6b322b0bb89f80e31e0a1bff9b2aae55f757 | /lhx-persistence/src/main/java/com/lhx/system/org/model/Org.java | f47b8ab977bcef7ffb57de011eaefda8ef8d9031 | [] | no_license | baijianjun123456/lhxProject | 473cb9a5a5f51c595a3e927255b32734754fc15b | b65829ee36951b52d6d3605f6827f3623521c7fe | refs/heads/master | 2021-01-15T12:59:17.614497 | 2017-08-13T11:49:38 | 2017-08-13T11:49:38 | 99,640,191 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,521 | java | package com.lhx.system.org.model;
import java.io.Serializable;
import com.lhx.common.mybatis.BaseModel;
/**
* 组织机构定义模型;
* @author liangshu
*/
public class Org extends BaseModel implements Serializable {
private static final long serialVersionUID = 1L;
//上级机构ID
private String pid;
//部门机构标识(1:机构;0部门)
private String flag;
//机构/部门名称全拼
private String spell;
//机构层级码
private String level_;
//机构识别码
private String identy;
//排序
private String orderBy;
public static Org newInstance(String id__,String flag_,String name_,String level__,String identy_){
Org org = new Org();
org.setId_(id__);
org.setFlag(flag_);
org.setName(name_);
org.setLevel_(level__);
org.setIdenty(identy_);
return org;
}
public String getPid(){
return this.pid;
}
public void setPid(String pid_){
this.pid = pid_;
}
public String getFlag(){
return this.flag;
}
public void setFlag(String flag_){
this.flag = flag_;
}
public String getSpell(){
return this.spell;
}
public void setSpell(String spell_){
this.spell = spell_;
}
public String getLevel_(){
return this.level_;
}
public void setLevel_(String level__){
this.level_ = level__;
}
public String getIdenty(){
return this.identy;
}
public void setIdenty(String identy_){
this.identy = identy_;
}
public String getOrderBy(){
return this.orderBy;
}
public void setOrderBy(String orderBy_){
this.orderBy = orderBy_;
}
}
| [
"1054392287@qq.com"
] | 1054392287@qq.com |
a3bc5e73fb32456bafce83776aec52e6c42595a2 | dc6640e35462c373967ff4005bfe89b7168c42c8 | /prog/Encrypt.java | f948de86b056f2a6ee5e8fc7a00ad6997e8c2613 | [] | no_license | 125philos/TDD | 61b970ba13719eaba11b24ccaadd2cf7add3d7f7 | 1122e9ceef4c7abf1a9a0ba636cc698cc30f076c | refs/heads/master | 2020-03-07T23:14:02.997101 | 2018-04-04T13:00:06 | 2018-04-04T13:00:06 | 127,752,428 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,280 | java | package prog;
import java.io.IOException;
public class Encrypt {
private Word key;
//constructor
public Encrypt()
{
key = null;
}
public Word getWord() {
return key;
}
public void setWord(Word key) {
this.key = key;
}
/*
* Метод, направленный на замену символ из базового алфавита на символ из алфавита замены,
* который находитс¤ в соответствующей позиции.
* Ѕазовый алфавит и алфавит замены определ¤ютс¤ объектом.
* @param toEncrypt - символ, который требуетс¤ заменить,
* @return - символ замены, если замена удалась,
* если не удалось найти символ замены или алфавит не определен.
* */
public char encryptChar(char toEncrypt) {
// TODO Auto-generated method stub
char[] elem = key.getElements();
if (elem == null) {
return Word.NULL_SYMBOL;
}
for (int i = 0; i < elem.length; i++) {
if (i > key.getChangeSymbol().length - 1) {
return Word.NULL_SYMBOL;
}
if (elem[i] == toEncrypt) {
return key.getChangeSymbol()[i];
}
}
return Word.NULL_SYMBOL;
}
public char decryptChar(char toDecrypt) {
// TODO Auto-generated method stub
char[] elem = key.getChangeSymbol();
if (elem == null) {
return Word.NULL_SYMBOL;
}
for (int i = 0; i < elem.length; i++) {
if (i > key.getElements().length - 1) {
return Word.NULL_SYMBOL;
}
if (elem[i] == toDecrypt) {
return key.getElements()[i];
}
}
return Word.NULL_SYMBOL;
}
/*
* Зашифровывать заданную строку, использу¤ ключ, установленный дл¤ объекта класса Encrypt.
* @param toEncrypt - строка, которую требуетс¤ зашифровать, тип String,
* @return builder.toString() - результат зашифрованной строки, если удалось зашифровать, тип String.
* */
public String encrypt(String toEncrypt) {
StringBuilder builder = new StringBuilder();
if (key.getElements() == null) {
int shear = key.getShearing();
for (int i = 0; i < toEncrypt.length(); i++) {
builder.append((char) (shear + Word.DEFAULT_SYMBOL.get(toEncrypt.charAt(i))));
}
} else {
for (int i = 0; i < toEncrypt.length(); i++) {
char symb = toEncrypt.charAt(i);
builder.append(encryptChar(symb));
}
}
return builder.toString();
}
/*
* Метод, который расшифровывает заданную строку, использу¤ ключ, установленный дл¤
* объекта класса Encrypt.
* @param toDecrypt - строка, которую требуетс¤ расшифровать, тип String,
* @return - результат расшифровки, если удалось расшифровать, тип String.
* Возвращает нулевое значение, если строка toDecrypt пуста¤ или ¤вл¤етс¤ нулевой.
* */
public String decrypt(String toDecrypt) {
if (toDecrypt == null || toDecrypt.equals("")) {
return null;
}
StringBuilder builder = new StringBuilder();
if (key.getChangeSymbol() == null) {
int shear = key.getShearing();
for (int i = 0; i < toDecrypt.length(); i++) {
builder.append((char) (Word.DEFAULT_SYMBOL.get(toDecrypt.charAt(i)) - shear));
}
} else {
for (int i = 0; i < toDecrypt.length(); i++) {
char symb = toDecrypt.charAt(i);
builder.append(decryptChar(symb));
}
}
return builder.toString();
}
}
| [
"philos.dec@gmail.com"
] | philos.dec@gmail.com |
b6491a9494e8864ae63e1d0b3f48478998ac0121 | f22acb2262a5d4e80de44177ff691bc7d3492841 | /design-pattern/src/main/java/org/marco/designpattern/gof/structural/adapter/Target.java | 86c39dc6815cc02f6454c5f12e7af1cb382aaf7b | [] | no_license | zyr3536/java-learn | 5e64ef2111b978916ba47132c1aee19d1eb807f9 | 78a87860476c02e5ef9a513fff074768ecb2b262 | refs/heads/master | 2022-06-21T19:03:46.028993 | 2019-06-21T13:21:04 | 2019-06-21T13:21:04 | 184,074,885 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 176 | java | package org.marco.designpattern.gof.structural.adapter;
/**
* @author: zyr
* @date: 2019/6/4
* @description: todo
*/
public interface Target {
void input(String s);
}
| [
"yurenzhang@ctrip.com"
] | yurenzhang@ctrip.com |
f0dd55090728442f8f304bce75dd83b9eb7248b3 | 51b7aa8ca8dedd69039d17959701bec7cd99a4c1 | /http-client-spi/src/main/java/software/amazon/awssdk/http/async/SdkAsyncHttpClientFactory.java | a946adad8798cd9dea746bafb07aac9cd50a0281 | [
"Apache-2.0"
] | permissive | MatteCarra/aws-sdk-java-v2 | 41d711ced0943fbd6b5a709e50f78b6564b5ed21 | af9fb86db6715b1dbea79028aa353292559d5876 | refs/heads/master | 2021-06-30T05:21:08.988292 | 2017-09-18T15:33:38 | 2017-09-18T15:33:38 | 103,685,332 | 0 | 1 | null | 2017-09-15T17:45:50 | 2017-09-15T17:45:50 | null | UTF-8 | Java | false | false | 1,449 | java | /*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package software.amazon.awssdk.http.async;
import software.amazon.awssdk.http.SdkHttpConfigurationOption;
import software.amazon.awssdk.utils.AttributeMap;
/**
* Interface for creating an {@link SdkAsyncHttpClient} with service specific defaults applied.
*
* <p>Implementations must be thread safe.</p>
*/
public interface SdkAsyncHttpClientFactory {
/**
* Create an {@link SdkAsyncHttpClient} with service specific defaults applied. Applying service defaults is optional
* and some options may not be supported by a particular implementation.
*
* @param serviceDefaults Service specific defaults. Keys will be one of the constants defined in
* {@link SdkHttpConfigurationOption}.
* @return Created client
*/
SdkAsyncHttpClient createHttpClientWithDefaults(AttributeMap serviceDefaults);
}
| [
"millem@amazon.com"
] | millem@amazon.com |
c1b584cff5cdd80cf50cb3e17d0f01ae875dd434 | 996375fabd9659d048bf4e7f15b2f06006e56fc9 | /WhackAMoleApp/app/build/generated/source/buildConfig/debug/com/dhamu/whackamole/BuildConfig.java | 50365f014b79c989c331160b63c05a5f5d1d0060 | [] | no_license | dham0018/WhackAMoleApp | ec00ed06bc26b2481eb828c103dbada5992516fc | 0e97f5ccaf3a8a26699c53a0355d2f8cdf350c48 | refs/heads/master | 2020-07-06T13:49:14.851224 | 2019-08-18T17:54:39 | 2019-08-18T17:54:39 | 203,037,563 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 447 | java | /**
* Automatically generated file. DO NOT MODIFY
*/
package com.dhamu.whackamole;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "com.dhamu.whackamole";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "1.0";
}
| [
"dhameliyahemish@gmail.com"
] | dhameliyahemish@gmail.com |
4f5c73f25ec6a390f423a8dbe369886a3511e9c2 | eb612e4e13f8df44e8dd45716e0fe0977ef4354b | /src/com/ibaguo/nlp/corpus/dictionary/item/SimpleItem.java | 4072f7a402a368323415f381cb520874cb14688d | [
"Apache-2.0"
] | permissive | Growingluffy/mqa | 295d3b2502363cc7b20961c34f5544783a6acb71 | 26c4254175ff0a626296f70fbdb57966e7924459 | refs/heads/master | 2020-05-04T17:52:04.734222 | 2016-01-22T08:57:44 | 2016-01-22T08:57:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,985 | java |
package com.ibaguo.nlp.corpus.dictionary.item;
import java.util.*;
public class SimpleItem
{
public Map<String, Integer> labelMap;
public SimpleItem()
{
labelMap = new TreeMap<String, Integer>();
}
public void addLabel(String label)
{
Integer frequency = labelMap.get(label);
if (frequency == null)
{
frequency = 1;
}
else
{
++frequency;
}
labelMap.put(label, frequency);
}
public void addLabel(String label, Integer frequency)
{
Integer innerFrequency = labelMap.get(label);
if (innerFrequency == null)
{
innerFrequency = frequency;
}
else
{
innerFrequency += frequency;
}
labelMap.put(label, innerFrequency);
}
public boolean containsLabel(String label)
{
return labelMap.containsKey(label);
}
public int getFrequency(String label)
{
Integer frequency = labelMap.get(label);
if (frequency == null) return 0;
return frequency;
}
@Override
public String toString()
{
final StringBuilder sb = new StringBuilder();
ArrayList<Map.Entry<String, Integer>> entries = new ArrayList<Map.Entry<String, Integer>>(labelMap.entrySet());
Collections.sort(entries, new Comparator<Map.Entry<String, Integer>>()
{
@Override
public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2)
{
return -o1.getValue().compareTo(o2.getValue());
}
});
for (Map.Entry<String, Integer> entry : entries)
{
sb.append(entry.getKey());
sb.append(' ');
sb.append(entry.getValue());
sb.append(' ');
}
return sb.toString();
}
public static SimpleItem create(String param)
{
if (param == null) return null;
String[] array = param.split(" ");
return create(array);
}
public static SimpleItem create(String param[])
{
if (param.length % 2 == 1) return null;
SimpleItem item = new SimpleItem();
int natureCount = (param.length) / 2;
for (int i = 0; i < natureCount; ++i)
{
item.labelMap.put(param[2 * i], Integer.parseInt(param[1 + 2 * i]));
}
return item;
}
public void combine(SimpleItem other)
{
for (Map.Entry<String, Integer> entry : other.labelMap.entrySet())
{
addLabel(entry.getKey(), entry.getValue());
}
}
public int getTotalFrequency()
{
int frequency = 0;
for (Integer f : labelMap.values())
{
frequency += f;
}
return frequency;
}
public String getMostLikelyLabel()
{
return labelMap.entrySet().iterator().next().getKey();
}
}
| [
"thyferny@163.com"
] | thyferny@163.com |
3cc5f2c425be7eb24655f802c5be18e7dd1f0085 | c47e2055289b0306800e2bfdfa2e8f8ad174b563 | /src/main/java/com/kodilla/kodilla_4_6_kalkulator/Calculator.java | b7a799d6efe8d183792dd7e7a57ec3230102e3ac | [] | no_license | ADKraw93/kalkulator_kodilla | 171e2f07c3f8beb02d30fa14dcc76cd96f3b2510 | 213d761470824452402b20ee75fcaa4ea530bdc8 | refs/heads/main | 2023-08-22T08:28:28.608732 | 2021-10-04T09:10:48 | 2021-10-04T09:10:48 | 413,339,249 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 516 | java | package com.kodilla.kodilla_4_6_kalkulator;
public class Calculator {
public double addNumbers(double a, double b){
return a + b;
}
public double subtractNumbers(double a, double b){
return a - b;
}
public static void main(String args[]){
Calculator calc = new Calculator();
double result1 = calc.addNumbers(1.5, 2.33);
System.out.println(result1);
double result2 = calc.subtractNumbers(1.5, 2.33);
System.out.println(result2);
}
}
| [
"artur.damian.krawczyk@gmail.com"
] | artur.damian.krawczyk@gmail.com |
257a6283aa4b96e13eadfd05787aea78be2d4e7d | 716b231c89805b3e1217c6fc0a4ff9fbcdcdb688 | /train-order-service/src/com/l9e/transaction/dao/PassengerDao.java | 7cf1e64147ba6601a4d61110377a4900d927b8f5 | [] | no_license | d0l1u/train_ticket | 32b831e441e3df73d55559bc416446276d7580be | c385cb36908f0a6e9e4a6ebb9b3ad737edb664d7 | refs/heads/master | 2020-06-14T09:00:34.760326 | 2019-07-03T00:30:46 | 2019-07-03T00:30:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 348 | java | package com.l9e.transaction.dao;
import java.util.List;
import java.util.Map;
import com.l9e.transaction.vo.Passenger;
/**
* 乘客-车票信息持久
* @author licheng
*
*/
public interface PassengerDao {
/**
* 查询乘客-车票信息
* @param params
* @return
*/
List<Passenger> selectPassenger(Map<String, Object> params);
}
| [
"meizs"
] | meizs |
13af4fb90500097824b0e0546c6a627a7d7acedd | 99c343d51bb9dbdf3075164b58ba97d83511c91a | /src/main/java/com/pcschool/ocp/d08/case3/Yorkshire.java | 12d3c0ad13e237c402884c99a6c1eb5e8c6b61fe | [] | no_license | uwen-yang/Java0123 | 317b5bdbad0776fe71e0a46558af40db3456f91a | f66d2ee8efa45b5a4916f0baf9862d783b8163ca | refs/heads/master | 2022-12-08T06:05:45.615589 | 2020-08-27T06:12:36 | 2020-08-27T06:12:36 | 286,371,722 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 161 | java | package com.pcschool.ocp.d08.case3;
public class Yorkshire extends Dog {
public void skill() {
System.out.println("坐下");
}
}
| [
"MB-study@192.168.1.109"
] | MB-study@192.168.1.109 |
4002d413cbad213c34d08ae37d78d4a519caddbe | 8738d9c1513d503a724e53085b1aa0a242c06a34 | /lab3_tron/Server/src/main/java/ru/nsu/dyuganov/server/Model/Direction/Direction.java | 4c41577670b34f58a3ff89d10e4276a1f23c8339 | [] | no_license | dyuganov/oop_java | ffe02f79d92fee2de16ecaf01858e7ce821d5905 | 19b17b28864f029d31e5baf4aff82466162f9089 | refs/heads/master | 2023-07-21T23:55:43.709465 | 2021-09-03T16:38:08 | 2021-09-03T16:38:08 | 337,071,420 | 0 | 0 | null | 2021-06-20T07:36:45 | 2021-02-08T12:39:03 | Java | UTF-8 | Java | false | false | 744 | java | package main.java.ru.nsu.dyuganov.server.Model.Direction;
public enum Direction {
UP("U"),
DOWN("D"),
LEFT("L"),
RIGHT("R");
private final String textRepresentation;
private Direction(String textRepresentation) {
this.textRepresentation = textRepresentation;
}
@Override public String toString() {
return textRepresentation;
}
public boolean isOpposite(Direction other){
if(this == Direction.DOWN && other == Direction.UP) return true;
else if(this == Direction.UP && other == Direction.DOWN) return true;
else if(this == Direction.LEFT && other == Direction.RIGHT) return true;
else return (this == Direction.RIGHT && other == Direction.LEFT);
}
} | [
"dyuganov.n@gmail.com"
] | dyuganov.n@gmail.com |
15d4ef0e3cf9fd2d3bab13d6972cf94e40c98448 | 43758901073e9193b084e3420dac09b57de936eb | /src/main/java/fotostrana/ru/network/requests/fotostrana/rating/RequestLevelPoints.java | fbe75cc6c23abc8e008d238af2dd898bb4e6d0b7 | [] | no_license | sherniki/fotostrana | 063949dee0b2e93de6b311f3f6a35ec23d372607 | 412fc7ad1d0f6285e2be5d4aefc0eb628cb89962 | refs/heads/master | 2021-01-10T03:47:18.514522 | 2015-12-22T22:59:34 | 2015-12-22T22:59:34 | 43,260,697 | 0 | 0 | null | 2015-12-07T18:16:19 | 2015-09-27T19:11:57 | Java | UTF-8 | Java | false | false | 4,587 | java | package fotostrana.ru.network.requests.fotostrana.rating;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
import fotostrana.ru.ParserJSON;
import fotostrana.ru.events.Event;
import fotostrana.ru.events.network.EventBan;
import fotostrana.ru.events.network.EventIsNotAuthorization;
import fotostrana.ru.events.network.EventRequestExecutedSuccessfully;
import fotostrana.ru.network.Request;
import fotostrana.ru.network.requests.fotostrana.RequestFotostrana;
public class RequestLevelPoints extends RequestFotostrana {
/**
* «Нравится», поставленное к чужому фото
*/
public static final int POINTS_LIKE = 0;
/**
* Просмотр фото в конкурсе «Лицо с обложки»
*/
public static final int POINTS_VIEW_PHOTO = 1;
public static final String[] nameItem = {
"«Нравится», поставленное к чужому фото",
"Просмотр фото в конкурсе «Лицо с обложки»" };
public static final int[] pointsPerItem = { 2, 1 };
private static String s1 = "activity-log-item-title\\\">\\n";
private static String s2 = "activity-log-item-info\\\">+ ";
public int levelPoints = -1;
public boolean isDoublePoints = false;
private Map<String, Integer> historyPoints;
public RequestLevelPoints(RequestFotostrana parrentRequest) {
super(parrentRequest);
historyPoints = new HashMap<String, Integer>();
}
@Override
public String getURL() {
return "http://fotostrana.ru/activityRating/ajax/infoPopup/?_ajax=1&userId="
+ user.id;
}
@Override
public void setResult(String result) {
Event event = null;
if (loginFilter.filtrate(result)) {
if (bannedFilter.filtrate(result)) {
String slevelpoints = removeSpace(ParserJSON.getSubstring(
result, "activity-info-level-points\\\">", " "));
try {
levelPoints = Integer.parseInt(slevelpoints);
} catch (Exception e) {
slevelpoints = removeSpace(ParserJSON.getSubstring(result,
"activity-info-top-item-points\\\"><strong>",
"<\\/strong>"));
try {
levelPoints = Integer.parseInt(slevelpoints);
} catch (Exception e2) {
}
}
isDoublePoints = result.indexOf("activity-multiply-points") > -1;
int i = result.indexOf(s1);
if (i == -1) {
System.out.println(Request.uXXXX(result));
}
try {
System.out.println("------------");
while (i > -1) {
// String s = result.substring(i);
// System.out.println(s);
String title = RequestLevelPoints.uXXXX(ParserJSON
.getSubstring(result, s1, "<\\/td>", i).trim());
String sValue = removeSpace(ParserJSON.getSubstring(
result, s2, "<\\/td>", i));
Integer value = Integer.parseInt(sValue);
historyPoints.put(title, value);
i = result.indexOf(s1, i + 1);
System.out.println(title + "=" + value);
}
System.out.println("------------");
} catch (Exception e) {
e.printStackTrace();
}
event = new EventRequestExecutedSuccessfully(this);
} else
event = new EventBan(this);
} else
event = new EventIsNotAuthorization(this);
eventListener.handleEvent(event);
}
@Override
public Map<String, String> headers() {
Map<String, String> result = new TreeMap<String, String>();
result.put("Host", "fotostrana.ru");
result.put("X-Requested-With", "XMLHttpRequest");
result.put("Referer", "http://fotostrana.ru/user/" + user.id
+ "/?from=header.menu");
return result;
}
private static String removeSpace(String s) {
String result = s;
int i = result.indexOf(" ");
while (i > 0) {
result = result.substring(0, i) + result.substring(i + 1);
i = result.indexOf(" ");
}
return result;
}
/**
* Возращает количество заработаных балов в категории
*
* @param nameItem
* имя категории
* @return
*/
public int getPoints(String nameItem) {
Integer result = historyPoints.get(nameItem);
if (result != null)
return result;
else
return 0;
}
/**
* Возращает количество заработаных балов в категории
*
* @param nameItem
* индекс категории
* @return
*/
public int getPoints(int item) {
return getPoints(nameItem[item]);
}
public static int getPointsPerItem(int item) {
return pointsPerItem[item];
}
}
| [
"yaroslavsagach@gmail.com"
] | yaroslavsagach@gmail.com |
0f7f059284036c9aed47bc41eae350add5b83e4b | cbb75ebbee3fb80a5e5ad842b7a4bb4a5a1ec5f5 | /org/apache/http/conn/params/ConnManagerPNames.java | 342e66032fb29dcb69609bcb3a84866bd5fb62b6 | [] | no_license | killbus/jd_decompile | 9cc676b4be9c0415b895e4c0cf1823e0a119dcef | 50c521ce6a2c71c37696e5c131ec2e03661417cc | refs/heads/master | 2022-01-13T03:27:02.492579 | 2018-05-14T11:21:30 | 2018-05-14T11:21:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 371 | java | package org.apache.http.conn.params;
@Deprecated
/* compiled from: TbsSdkJava */
public interface ConnManagerPNames {
public static final String MAX_CONNECTIONS_PER_ROUTE = "http.conn-manager.max-per-route";
public static final String MAX_TOTAL_CONNECTIONS = "http.conn-manager.max-total";
public static final String TIMEOUT = "http.conn-manager.timeout";
}
| [
"13511577582@163.com"
] | 13511577582@163.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.