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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8e96eeb53cd33ddb98d571ec9507bed7bd6889c4 | a0673be25ecc992785e4c81e901a5250cf1aa5f0 | /src/Main.java | 27ce346b2896bbfc76361f1b046da80965ba36ad | [] | no_license | NickLekkas01/Pacman | 29c39f0275998869c42b2dbc9f6530e3c01e806d | 9475c96029d380bb049554724665e0d5a9ec3a08 | refs/heads/master | 2021-02-10T06:43:31.222385 | 2020-03-07T15:46:17 | 2020-03-07T15:46:17 | 244,357,541 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,238 | java | import javax.swing.*;
import java.awt.event.*;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Random;
import java.util.Scanner;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import static java.lang.Thread.sleep;
public class Main implements KeyListener, ActionListener{
public static int HEIGHT = 42;
public static int WIDTH = 40;
public static int prevPacmanPosX = 25;
public static int prevPacmanPosY = 19;
public static int PacmanPosX = 25;
public static int PacmanPosY = 19;
public static int prevInkyPosX = 6;
public static int prevInkyPosY = 4;
public static int InkyPosX = 6;
public static int InkyPosY = 4;
public static int prevBlinkyPosX = 6;
public static int prevBlinkyPosY = 35;
public static int BlinkyPosX = 6;
public static int BlinkyPosY = 35;
public static int prevPinkyPosX = 38;
public static int prevPinkyPosY = 4;
public static int PinkyPosX = 38;
public static int PinkyPosY = 4;
public static int prevClydePosX = 38;
public static int prevClydePosY = 35;
public static int ClydePosX = 38;
public static int ClydePosY = 35;
public static char[][] PACMAN_TABLE;
public static int direction;
static JFrame frame;
static JTextField tf;
static JLabel lbl;
static JButton btn;
public Main() {
frame = new JFrame();
lbl = new JLabel();
tf = new JTextField(15);
tf.addKeyListener(this);
btn = new JButton("Clear");
btn.addActionListener(this);
JPanel panel = new JPanel();
panel.add(tf);
panel.add(btn);
frame.setLayout(new BorderLayout());
frame.add(lbl, BorderLayout.NORTH);
frame.add(panel, BorderLayout.SOUTH);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(300, 100);
frame.setVisible(true);
}
public static void main(String args[]) throws IOException, InterruptedException {
new Main();
PACMAN_TABLE = new char[HEIGHT][WIDTH];
/* Read pacman map from file pac.txt */
readFromFile("pac.txt", PACMAN_TABLE);
//Printing the pacman map
clearScreen();
printMap();
while(true){
/*Check if Lost */
if(Lost()){
System.out.println("You lost. GAME OVER");
return;
}
/*Check if Won*/
if(Won()){
System.out.println("You won. Congratulations!");
return;
}
/* Move pacman with wasd or WASD */
int [] pacmanPos = {PacmanPosX, PacmanPosY};
prevPacmanPosX = PacmanPosX;
prevPacmanPosY = PacmanPosY;
pacmanPos = PacManMovement(PACMAN_TABLE, pacmanPos);
PacmanPosX = pacmanPos[0];
PacmanPosY = pacmanPos[1];
/* Inky ghost*/
int [] inkyPos = {InkyPosX, InkyPosY};
prevInkyPosX = InkyPosX;
prevInkyPosY = InkyPosY;
inkyPos = ghostMovementChase(PACMAN_TABLE, inkyPos);
InkyPosX = inkyPos[0];
InkyPosY = inkyPos[1];
/* Blinky ghost*/
int [] blinkyPos = {BlinkyPosX, BlinkyPosY};
prevBlinkyPosX = BlinkyPosX;
prevBlinkyPosY = BlinkyPosY;
blinkyPos = ghostMovement(PACMAN_TABLE, blinkyPos);
BlinkyPosX = blinkyPos[0];
BlinkyPosY = blinkyPos[1];
/* Pinky ghost*/
int [] pinkyPos = {PinkyPosX, PinkyPosY};
prevPinkyPosX = PinkyPosX;
prevPinkyPosY = PinkyPosY;
pinkyPos = ghostMovement(PACMAN_TABLE, pinkyPos);
PinkyPosX = pinkyPos[0];
PinkyPosY = pinkyPos[1];
/* Clyde ghost*/
int [] clydePos = {ClydePosX, ClydePosY};
prevClydePosX = ClydePosX;
prevClydePosY = ClydePosY;
clydePos = ghostMovement(PACMAN_TABLE, clydePos);
ClydePosX = clydePos[0];
ClydePosY = clydePos[1];
clearScreen();
//Printing the pacman map
printMap();
sleep(400);
}
}
@Override
public void keyTyped(KeyEvent e) {
int key = e.getKeyCode();
if (key == KeyEvent.VK_LEFT) {
if(PacmanPosY-1 >=0 && PACMAN_TABLE[PacmanPosX][PacmanPosY - 1] != '#' && PACMAN_TABLE[PacmanPosX][PacmanPosY - 1] != 'x')
direction = 0;
}
if (key == KeyEvent.VK_RIGHT) {
if(PacmanPosY+1 < WIDTH && PACMAN_TABLE[PacmanPosX][PacmanPosY + 1] != '#' && PACMAN_TABLE[PacmanPosX][PacmanPosY + 1] != 'x')
direction = 1;
}
if (key == KeyEvent.VK_UP) {
if(PacmanPosX-1 >= 0 && PACMAN_TABLE[PacmanPosX - 1 ][PacmanPosY ] != '#' && PACMAN_TABLE[PacmanPosX - 1 ][PacmanPosY ] != 'x')
direction = 2;
}
if (key == KeyEvent.VK_DOWN) {
if(PacmanPosX+1 < HEIGHT && PACMAN_TABLE[PacmanPosX+1][PacmanPosY] != '#' && PACMAN_TABLE[PacmanPosX+1][PacmanPosY] != 'x')
direction = 3;
}
}
@Override
public void keyPressed(KeyEvent e) {
int key = e.getKeyCode();
if (key == KeyEvent.VK_LEFT) {
if(PacmanPosY-1 >=0 && PACMAN_TABLE[PacmanPosX][PacmanPosY - 1] != '#' && PACMAN_TABLE[PacmanPosX][PacmanPosY - 1] != 'x')
direction = 0;
}
if (key == KeyEvent.VK_RIGHT) {
if(PacmanPosY+1 < WIDTH && PACMAN_TABLE[PacmanPosX][PacmanPosY + 1] != '#' && PACMAN_TABLE[PacmanPosX][PacmanPosY + 1] != 'x')
direction = 1;
}
if (key == KeyEvent.VK_UP) {
if(PacmanPosX-1 >= 0 && PACMAN_TABLE[PacmanPosX - 1 ][PacmanPosY ] != '#' && PACMAN_TABLE[PacmanPosX - 1 ][PacmanPosY ] != 'x')
direction = 2;
}
if (key == KeyEvent.VK_DOWN) {
if(PacmanPosX+1 < HEIGHT && PACMAN_TABLE[PacmanPosX+1][PacmanPosY] != '#' && PACMAN_TABLE[PacmanPosX+1][PacmanPosY] != 'x')
direction = 3;
}
}
@Override
public void keyReleased(KeyEvent e) {
int key = e.getKeyCode();
if (key == KeyEvent.VK_LEFT) {
if(PacmanPosY-1 >=0 && PACMAN_TABLE[PacmanPosX][PacmanPosY - 1] != '#' && PACMAN_TABLE[PacmanPosX][PacmanPosY - 1] != 'x')
direction = 0;
}
if (key == KeyEvent.VK_RIGHT) {
if(PacmanPosY+1 < WIDTH && PACMAN_TABLE[PacmanPosX][PacmanPosY + 1] != '#' && PACMAN_TABLE[PacmanPosX][PacmanPosY + 1] != 'x')
direction = 1;
}
if (key == KeyEvent.VK_UP) {
if(PacmanPosX-1 >= 0 && PACMAN_TABLE[PacmanPosX - 1 ][PacmanPosY ] != '#' && PACMAN_TABLE[PacmanPosX - 1 ][PacmanPosY ] != 'x')
direction = 2;
}
if (key == KeyEvent.VK_DOWN) {
if(PacmanPosX+1 < HEIGHT && PACMAN_TABLE[PacmanPosX+1][PacmanPosY] != '#' && PACMAN_TABLE[PacmanPosX+1][PacmanPosY] != 'x')
direction = 3;
}
}
@Override
public void actionPerformed(ActionEvent ae) {
tf.setText("");
}
private static void clearScreen() throws IOException, InterruptedException {
final String os = System.getProperty("os.name");
if (os.contains("Windows"))
new ProcessBuilder("cmd", "/c", "cls").inheritIO().start().waitFor();
else {
System.out.print("\033[H\033[2J");
System.out.flush();
}
}
private static void printMap() {
for(int i = 0; i < HEIGHT; i++){
for(int j = 0; j < WIDTH; j++) {
if(i == InkyPosX && j == InkyPosY) System.out.print("\u001B[31m"+"1");
else if(i == BlinkyPosX && j == BlinkyPosY) System.out.print("\u001B[32m"+"2");
else if(i == PinkyPosX && j == PinkyPosY) System.out.print("\u001B[35m"+"3");
else if(i == ClydePosX && j == ClydePosY) System.out.print("\u001B[36m"+"4");
else if(PACMAN_TABLE[i][j] == '#')System.out.print("\u001B[34m"+PACMAN_TABLE[i][j]);
else if(PACMAN_TABLE[i][j] == 'C') System.out.print("\u001B[33m"+PACMAN_TABLE[i][j]);
else System.out.print("\u001B[37m"+PACMAN_TABLE[i][j]);
}
System.out.println();
}
}
private static void readFromFile(String file, char [][]Table){
try{
File obj = new File(file);
Scanner myReader = new Scanner(obj);
int i = 0;
while (myReader.hasNextLine()) {
String data = myReader.nextLine();
for(int j = 0; j < data.length(); j++){
// System.out.print(data.charAt(j));
Table[i][j] = data.charAt(j);
}
// System.out.println();
i++;
}
myReader.close();
} catch (FileNotFoundException e) {
System.out.println("An error occurred.");
e.printStackTrace();
}
}
private static int []ghostMovementChase(char[][] pacman_table, int []ghostPos) {
Random r = new Random();
int num;
while(true){
// num = r.nextInt(4);
if(ghostPos[0] <= PacmanPosX && ghostPos[1] <= PacmanPosY){
num = r.nextInt(2);
if(num == 0){
if(ghostPos[0] + 1 < HEIGHT && pacman_table[ghostPos[0]+1][ghostPos[1]] != '#'){
ghostPos[0] = ghostPos[0] + 1;
break;
}
}
else if(num == 1){
if(ghostPos[1] + 1 < WIDTH && pacman_table[ghostPos[0]][ghostPos[1]+1] != '#' ){
ghostPos[1] = ghostPos[1] + 1;
break;
}
}
if(pacman_table[ghostPos[0]+1][ghostPos[1]] == '#' && pacman_table[ghostPos[0]][ghostPos[1]+1] == '#'){
while(true){
num = r.nextInt(2);
if(num == 0) {
ghostPos[0] = ghostPos[0] - 1;
break;
}else {
ghostPos[1] = ghostPos[1] - 1;
break;
}
}
}
}
else if( ghostPos[0] <= PacmanPosX && ghostPos[1] > PacmanPosY) {
num = r.nextInt(2);
if (num == 0) {
if(ghostPos[0] + 1 < HEIGHT && pacman_table[ghostPos[0]+1][ghostPos[1]] != '#'){
ghostPos[0] = ghostPos[0] + 1;
break;
}
} else if (num == 1) {
if(ghostPos[1] - 1 >= 0 && pacman_table[ghostPos[0]][ghostPos[1]-1] != '#'){
ghostPos[1] = ghostPos[1] - 1;
break;
}
}
if(pacman_table[ghostPos[0]+1][ghostPos[1]] == '#' && pacman_table[ghostPos[0]][ghostPos[1]-1] == '#'){
while(true){
num = r.nextInt(2);
if(num == 0) {
ghostPos[0] = ghostPos[0] - 1;
break;
}else {
ghostPos[1] = ghostPos[1] + 1;
break;
}
}
}
}
else if( ghostPos[0] > PacmanPosX && ghostPos[1] <= PacmanPosY) {
num = r.nextInt(2);
if (num == 0) {
if(ghostPos[0] - 1 >= 0 && pacman_table[ghostPos[0]-1][ghostPos[1]] != '#'){
ghostPos[0] = ghostPos[0] - 1;
break;
}
} else if (num == 1) {
if(ghostPos[1] + 1 < WIDTH && pacman_table[ghostPos[0]][ghostPos[1]+1] != '#' ){
ghostPos[1] = ghostPos[1] + 1;
break;
}
}
if(pacman_table[ghostPos[0]-1][ghostPos[1]] == '#' && pacman_table[ghostPos[0]][ghostPos[1]+1] == '#'){
while(true){
num = r.nextInt(2);
if(num == 0) {
ghostPos[0] = ghostPos[0] + 1;
break;
}else {
ghostPos[1] = ghostPos[1] - 1;
break;
}
}
}
}
else if( ghostPos[0] > PacmanPosX && ghostPos[1] > PacmanPosY ){
num = r.nextInt(2);
if (num == 0) {
if(ghostPos[0] - 1 >= 0 && pacman_table[ghostPos[0]-1][ghostPos[1]] != '#'){
ghostPos[0] = ghostPos[0] - 1;
break;
}
} else if (num == 1) {
if(ghostPos[1] - 1 >= 0 && pacman_table[ghostPos[0]][ghostPos[1]-1] != '#'){
ghostPos[1] = ghostPos[1] - 1;
break;
}
}
if(pacman_table[ghostPos[0]-1][ghostPos[1]] == '#' && pacman_table[ghostPos[0]][ghostPos[1]-1] == '#'){
while(true){
num = r.nextInt(2);
if(num == 0) {
ghostPos[0] = ghostPos[0] + 1;
break;
}else {
ghostPos[1] = ghostPos[1] + 1;
break;
}
}
}
}
}
return ghostPos;
}
private static int []ghostMovement(char[][] pacman_table, int []ghostPos) {
Random r = new Random();
int num;
while(true){
num = r.nextInt(4);
if(num == 0){
if(ghostPos[1] - 1 >= 0 && pacman_table[ghostPos[0]][ghostPos[1]-1] != '#'){
ghostPos[1] = ghostPos[1] - 1;
break;
}
}
else if(num == 1){
if(ghostPos[1] + 1 < WIDTH && pacman_table[ghostPos[0]][ghostPos[1]+1] != '#' ){
ghostPos[1] = ghostPos[1] + 1;
break;
}
}
else if(num == 2){
if(ghostPos[0] - 1 >= 0 && pacman_table[ghostPos[0]-1][ghostPos[1]] != '#'){
ghostPos[0] = ghostPos[0] - 1;
break;
}
}
else if(num == 3){
if(ghostPos[0] + 1 < HEIGHT && pacman_table[ghostPos[0]+1][ghostPos[1]] != '#'){
ghostPos[0] = ghostPos[0] + 1;
break;
}
}
}
return ghostPos;
}
private static int []PacManMovement(char[][] pacman_table, int []pacmanPos) {
// Scanner keyboard = new Scanner(System.in);
pacman_table[pacmanPos[0]][pacmanPos[1]] = ' ';
// while(true){
// char ch = keyboard.next().charAt(0);
if(direction == 0){
// if(ch == 'A' || ch == 'a'){
if(pacmanPos[1] - 1 >= 0 && pacman_table[pacmanPos[0]][pacmanPos[1]-1] != '#' && pacman_table[pacmanPos[0]][pacmanPos[1]-1] != 'x'){
pacmanPos[1] = pacmanPos[1] - 1;
// break;
}
}
else if(direction == 1){
// else if(ch == 'D' || ch == 'd'){
if(pacmanPos[1] + 1 < HEIGHT && pacman_table[pacmanPos[0]][pacmanPos[1]+1] != '#' && pacman_table[pacmanPos[0]][pacmanPos[1]+1] != 'x'){
pacmanPos[1] = pacmanPos[1] + 1;
// break;
}
}
else if(direction == 2){
// else if(ch == 'W' || ch == 'w'){
if(pacmanPos[0] - 1 >= 0 && pacman_table[pacmanPos[0]-1][pacmanPos[1]] != '#' && pacman_table[pacmanPos[0]-1][pacmanPos[1]] != 'x'){
pacmanPos[0] = pacmanPos[0] - 1;
// break;
}
}
else if(direction == 3){
// else if(ch == 'S' || ch == 's'){
if(pacmanPos[0] + 1 < WIDTH && pacman_table[pacmanPos[0]+1][pacmanPos[1]] != '#' && pacman_table[pacmanPos[0]+1][pacmanPos[1]] != 'x'){
pacmanPos[0] = pacmanPos[0] + 1;
// break;
}
}
// }
pacman_table[pacmanPos[0]][pacmanPos[1]] = 'C';
return pacmanPos;
}
private static boolean Won() {
boolean won = true;
for(int i = 0; i < HEIGHT; i++){
for (int j = 0; j < WIDTH; j++){
if(PACMAN_TABLE[i][j] == '.') {
won = false;
return won;
}
}
}
return won;
}
private static boolean Lost() {
if(PacmanPosX == InkyPosX && PacmanPosY == InkyPosY)
return true;
if(PacmanPosX == BlinkyPosX && PacmanPosY == BlinkyPosY)
return true;
if(PacmanPosX == PinkyPosX && PacmanPosY == PinkyPosY)
return true;
if(PacmanPosX == ClydePosX && PacmanPosY == ClydePosY)
return true;
if(prevPacmanPosX == InkyPosX && prevPacmanPosY == InkyPosY)
return true;
if(prevPacmanPosX == BlinkyPosX && prevPacmanPosY == BlinkyPosY)
return true;
if(prevPacmanPosX == PinkyPosX && prevPacmanPosY == PinkyPosY)
return true;
if(prevPacmanPosX == ClydePosX && prevPacmanPosY == ClydePosY)
return true;
if(PacmanPosX == prevInkyPosX && PacmanPosY == prevInkyPosY)
return true;
if(PacmanPosX == prevBlinkyPosX && PacmanPosY == prevBlinkyPosY)
return true;
if(PacmanPosX == prevPinkyPosX && PacmanPosY == prevPinkyPosY)
return true;
if(PacmanPosX == prevClydePosX && PacmanPosY == prevClydePosY)
return true;
return false;
}
}
| [
"sdi1600089@di.uoa.gr"
] | sdi1600089@di.uoa.gr |
bc528fbcd23008eb4ca269b845c313074c026a69 | d4cc2d7f53db31bf0204c662b21cfb3416ac1bbe | /applications/NetBeansModules/ScriptEngine/src/org/chuk/lee/scriptengine/console/EditableAtEndDocument.java | e8d2b15e6ee61e44efd27d340ede9cc37fad7161 | [] | no_license | zeroboo/java-scripting-rhino-jdk8 | 5f5b3bd45c814f00f7558d13a3936458404b666e | 099fe6f96120e379b60cc9e1f82f7386b131d3e4 | refs/heads/master | 2020-06-26T10:53:25.873700 | 2019-07-31T09:50:32 | 2019-07-31T09:50:32 | 199,612,958 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,674 | java | /*
Copyright � 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California
95054, U.S.A. All rights reserved.U.S. Government Rights - Commercial software.
Government users are subject to the Sun Microsystems, Inc. standard license agreement
and applicable provisions of the FAR and its supplements. Use is subject to license
terms. Sun, Sun Microsystems, the Sun logo, Java and Jini are trademarks or registered
trademarks of Sun Microsystems, Inc. in the U.S. and other countries. This product is
covered and controlled by U.S. Export Control laws and may be subject to the export or import
laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime
end uses or end users, whether direct or indirect, are strictly prohibited. Export or reexport
to countries subject to U.S. embargo or to entities identified on U.S. Export exclusion lists,
including, but not limited to, the denied persons and specially designated nationals lists is
strictly prohibited.
Copyright � 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054,
Etats-Unis. Tous droits r�serv�s.L'utilisation est soumise aux termes de la Licence.Sun, Sun
Microsystems, le logo Sun, Java et Jini sont des marques de fabrique ou des marques
d�pos�es de Sun Microsystems, Inc. aux Etats-Unis et dans d'autres pays.Ce produit est soumis
� la l�gislation am�ricaine en mati�re de contr�le des exportations et peut �tre soumis � la
r�glementation en vigueur dans d'autres pays dans le domaine des exportations et importations.
Les utilisations, ou utilisateurs finaux, pour des armes nucl�aires,des missiles, des armes
biologiques et chimiques ou du nucl�aire maritime, directement ou indirectement, sont
strictement interdites. Les exportations ou r�exportations vers les pays sous embargo
am�ricain, ou vers des entit�s figurant sur les listes d'exclusion d'exportation am�ricaines,
y compris, mais de mani�re non exhaustive, la liste de personnes qui font objet d'un ordre de
ne pas participer, d'une fa�on directe ou indirecte, aux exportations des produits ou des
services qui sont r�gis par la l�gislation am�ricaine en mati�re de contr�le des exportations
et la liste de ressortissants sp�cifiquement d�sign�s, sont rigoureusement interdites.
*/
/*
* @(#)EditableAtEndDocument.java 1.1 06/04/19 08:43:44
*
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* -Redistribution of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* -Redistribution in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN")
* AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE
* AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
* DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST
* REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,
* INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY
* OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed, licensed or intended
* for use in the design, construction, operation or maintenance of any
* nuclear facility.
*/
package org.chuk.lee.scriptengine.console;
import javax.swing.text.*;
/** This class implements a special type of document in which edits
* can only be performed at the end, from "mark" to the end of the
* document. This is used in ScriptShellPanel class as document for editor.
*/
public class EditableAtEndDocument extends PlainDocument {
private int mark;
public void insertString(int offset, String text, AttributeSet a)
throws BadLocationException {
int len = getLength();
super.insertString(len, text, a);
}
public void remove(int offs, int len) throws BadLocationException {
int start = offs;
int end = offs + len;
int markStart = mark;
int markEnd = getLength();
if ((end < markStart) || (start > markEnd)) {
// no overlap
return;
}
// Determine interval intersection
int cutStart = Math.max(start, markStart);
int cutEnd = Math.min(end, markEnd);
super.remove(cutStart, cutEnd - cutStart);
}
public void setMark() {
mark = getLength();
}
public String getMarkedText() throws BadLocationException {
return getText(mark, getLength() - mark);
}
/** Used to reset the contents of this document */
public void clear() {
try {
super.remove(0, getLength());
setMark();
} catch (BadLocationException e) {
}
}
}
| [
"sundararajana@03d6dbfd-e0f2-6d84-cd2b-8a81ba2ddabe"
] | sundararajana@03d6dbfd-e0f2-6d84-cd2b-8a81ba2ddabe |
3720bde35c619a9b16150f258191a9f0a7d060ef | a321bfbb426722b8b2ea7dd9277bfdd7fe129ea1 | /app/src/test/java/com/example/tabdab/VendorTest.java | 0e6ad50284869e66bc769dccbde3162262a62525 | [] | no_license | SCCapstone/TabDab | d9eb01c684b55323765f77d46cf027eea87e60ca | 113e9d0b68d9b576b360786b7a0fcb161deb7ad2 | refs/heads/master | 2023-04-14T06:49:45.288038 | 2021-04-27T05:31:31 | 2021-04-27T05:31:31 | 289,468,297 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,556 | java | package com.example.tabdab;
import org.junit.Assert;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import static java.util.Arrays.asList;
import static org.junit.Assert.*;
public class VendorTest {
/**
* Test Vendor Default constructor
* create default object and
* assert equals test
* all parameters should be blank
*/
@Test
public void testDefaultConstructor() {
Vendor vendor = new Vendor();
//assert equals vendor ID
assertEquals("", vendor.getVendorId());
//assert equals vendor name
assertEquals("", vendor.getName());
//assert equals menu
List<BillItem> menu = new ArrayList<>();
assertEquals(menu, vendor.getMenu());
}
/**
* Test vendor with paramaterized vendor name
* create vendor object with just paramater name
* assert equals test
* all parameters should be blank besides name
*/
@Test
public void testConstructorWithName() {
//create string for name
String vendorName = "Bobs Burgers";
//create vendor object with just name param
Vendor vendor = new Vendor(vendorName);
//assert equals name
assertEquals(vendorName, vendor.getName());
//test name in a different way
assertEquals("Bobs Burgers", vendor.getName());
assertNotEquals("Bobbys Burgers", vendor.getName());
//assert equals vendor ID
assertEquals("", vendor.getVendorId());
//assert equals menu
List<BillItem> menu = new ArrayList<>();
assertEquals(menu, vendor.getMenu());
}
/**
* Test vendor with paramertized vendor id and name
* Create vendor objet with paramters id and name
* assert equals test
* menu will be blank
*/
@Test
public void testConstructorWithSomeParams() {
String vendorName = "Dog Hut";
String vendorId = "-MPig_oRflyYiyF7B-KQ";
//create vendor object with params: id and name
Vendor vendor = new Vendor(vendorId, vendorName);
//assert equals vendor ID 2 different ways
assertEquals(vendorId, vendor.getVendorId());
assertEquals("-MPig_oRflyYiyF7B-KQ", vendor.getVendorId());
//assert equals vendor name 2 different ways
assertEquals(vendorName, vendor.getName());
assertEquals("Dog Hut", vendor.getName());
//assert equals menu
List<BillItem> menu = new ArrayList<>();
assertEquals(menu, vendor.getMenu());
}
/**
* Test vendor with full parametrized constructor
* Create vendor Object with all parameters
* assert euqls test on all params
*/
@Test
public void testParamConstructor() {
String vendorName = "RedBull Hut";
String vendorId = "-MPig_oRflyYiyF7B-KQ";
List<BillItem> menu = new ArrayList<>();
//create and add item to menu
String itemName = "RedBull";
double price = 5.0;
BillItem item = new BillItem(price, itemName);
menu.add(item);
//create and add another item to menu
itemName = "BlueBerry RedBull";
price = 6.0;
item = new BillItem(price, itemName);
menu.add(item);
//create and add last item to menu
itemName = "Sugar Free RedBull";
price = 5.5;
item = new BillItem(price, itemName);
menu.add(item);
//create venodr object with all parameters
Vendor vendor = new Vendor(vendorId, vendorName, menu);
//assert equals vendor ID 2 different ways
assertEquals(vendorId, vendor.getVendorId());
assertEquals("-MPig_oRflyYiyF7B-KQ", vendor.getVendorId());
//assert equals vendor name 2 different ways
assertEquals(vendorName, vendor.getName());
assertEquals("RedBull Hut", vendor.getName());
//assert equals vendor menu
assertEquals(menu, vendor.getMenu());
}
/**
* Test set vendor ID
* create new default vendor object
* set a new vendor id and test it
* repeat setter to ensure success
*/
@Test
public void testSetVendorId() {
Vendor vendor = new Vendor();
String vendorId = "-MPig_oRflyYiyF7P-KQ";
//set the vendorId through assigned vendorId string and assert equal test
vendor.setVendorId(vendorId);
assertEquals(vendorId, vendor.getVendorId());
//set the vendorId through created string and assert equal test
vendor.setVendorId("-MLjg_oRflyYiyF7P-KQ");
assertNotEquals(vendorId, vendor.getVendorId());
assertEquals("-MLjg_oRflyYiyF7P-KQ", vendor.getVendorId());
}
/**
* Test set Vendor name
* create new default vendor object
* set a new vendor name and test it
* repeat setter and test to ensure success
*/
@Test
public void testSetVendorName() {
Vendor vendor = new Vendor();
String name = "McDubs";
//set the vendor name through assigned name string and assert equal test
vendor.setName(name);
assertEquals(name, vendor.getName());
//set the name through created string and assert equal test
vendor.setName("China hut #1");
assertNotEquals(name, vendor.getName());
assertEquals("China hut #1", vendor.getName());
}
/**
* Test Vendor set menu
* create new default vendor object
* create a menu and test it
* append to it and test to ensure success
*/
@Test
public void testSetMenu() {
Vendor vendor = new Vendor();
List<BillItem> menu = new ArrayList<>();
//create a single item menu and test it
String itemName = "Hot-Dog";
double price = 5.0;
BillItem item = new BillItem(price, itemName);
menu.add(item);
vendor.setMenu(menu);
//vendor menu should be the same as the created menu here
assertEquals(menu, vendor.getMenu());
//append the menu and reset it
itemName = "Monster Taco";
price = 3.50;
item = new BillItem(price, itemName);
menu.add(item);
vendor.setMenu(menu);
//vendor menu should be the same ass the created menu here
assertEquals(menu, vendor.getMenu());
//append one more item and reset it
itemName = "Egg Roll";
price = 2.0;
item = new BillItem(price, itemName);
menu.add(item);
vendor.setMenu(menu);
//vendor menu should be the same ass the created menu here
assertEquals(menu, vendor.getMenu());
}
/**
* Test vendor menuToString
* create a menu and run the toString
* create a string to replicate results
*/
@Test
public void testMenuToString() {
Vendor vendor = new Vendor();
List<BillItem> menu = new ArrayList<>();
//create a single item menu
String itemName = "Ice Cream";
double price = 5.0;
BillItem item = new BillItem(price, itemName);
menu.add(item);
//append another item
itemName = "SpongeBob Popsicle";
price = 3.50;
item = new BillItem(price, itemName);
menu.add(item);
vendor.setMenu(menu);
//create the anticipated String
String ret = "";
for (int i = 0; i < menu.size(); i++) {
ret += menu.get(i).getName() + ": " + menu.get(i).getPrice() + "\n";
}
//test it
assertEquals(ret, vendor.menuToString());
}
}
| [
"shatleymtyler@gmail.com"
] | shatleymtyler@gmail.com |
de544fec70e2cf49a16a77d167d0a3e347e7825a | 3168a667c28dfc428f678e220152ef97bda2c3dd | /src/main/java/cn/com/evo/integration/wasu/sdk/PaySDK.java | 791be87de24b25496adf85083cdd80bb74e7220b | [] | no_license | jooejooe/evo_spider | 61396155e606b10a9709cda458e5b0ae21857bf5 | 78dfb6f28c9e46fb22a60eae7cbc5c52de2a6e3d | refs/heads/master | 2023-05-09T22:22:51.032013 | 2020-05-12T05:35:58 | 2020-05-12T05:35:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,871 | java | package cn.com.evo.integration.wasu.sdk;
import cn.com.evo.cms.utils.HttpUtil;
import cn.com.evo.cms.utils.OrderUtils;
import cn.com.evo.integration.common.ConstantFactory;
import cn.com.evo.integration.wasu.common.ConstantEnum;
import cn.com.evo.integration.wasu.common.pay.PayRequestContent;
import cn.com.evo.integration.wasu.common.pay.PayResponse;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.frameworks.utils.DateUtil;
import com.google.common.collect.Lists;
import com.maywide.payplat.request.CommonRequest;
import com.maywide.payplat.request.reqcontent.PayplatPayCustInfo;
import com.maywide.payplat.request.reqcontent.PayplatPayOrderInfo;
import com.maywide.payplat.request.reqcontent.PayplatPayProductInfo;
import com.maywide.payplat.response.CommonResponse;
import java.util.List;
import java.util.Map;
/**
* @Description: 支付类接口封装
* @author: lu.xin
* @create: 2019-05-28 10:02 AM
**/
public class PaySDK {
/**
* 支付接口
*
* @param ppvId 产品id
* @param payMoney 产品价格 单位:分
* @param productName 产品名称
* @param custName 客户名称
* @param custId 客户编号
* @param cardNo 智能卡号
* @param area 业务区标识
* @param city 区域标识
* @return PayResponse
*/
public static PayResponse pay(String ppvId, double payMoney, String productName,
String custName, String custId, String cardNo, String area,
String city) {
// 订单号
String orderNo = OrderUtils.createOrderNo(3);
CommonRequest request = createRequestContent(ppvId, payMoney, orderNo,
productName, custName, custId,
cardNo, area, city, ConstantFactory.map.get(ConstantEnum.callback.getKey()));
JSONObject params = (JSONObject) JSON.toJSON(request);
String resultStr = HttpUtil.post(ConstantFactory.map.get(ConstantEnum.payUrl.getKey()), params,
"请求华数二维码支付接口");
// 响应参数格式化
CommonResponse commonResponse = JSONObject.parseObject(resultStr, CommonResponse.class);
Map<String, String> outPut = (Map) commonResponse.getOutput();
PayResponse response = new PayResponse(commonResponse.getStatus(), commonResponse.getMessage(), commonResponse.getRequestid(), orderNo,
outPut.get("codeContent"), outPut.get("codeImgUrl"));
return response;
}
/**
* 创建请求内容对象
*
* @param ppvId 产品id
* @param payMoney 支付金额
* @param orderNo 订单号
* @param productName 产品名称
* @param custName 客户名称
* @param custId 客户编号
* @param cardNo 智能卡号
* @param area 业务区标识
* @param city 区域标识
* @param callBackUrl 回调接口地址
*/
private static CommonRequest createRequestContent(String ppvId, double payMoney, String orderNo,
String productName, String custName, String custId,
String cardNo, String area, String city, String callBackUrl) {
CommonRequest request = new CommonRequest();
request.setVersion("01");
request.setClienttype("01");
request.setClientcode(ConstantFactory.map.get(ConstantEnum.clientCode.getKey()));
request.setClientpwd(ConstantFactory.map.get(ConstantEnum.clientPwd.getKey()));
// 支付接口编码
request.setServicecode("SimpleCode");
// 请求流水号 规则:clientcode+YYYYMMDD+8位流水
String requestId = ConstantFactory.map.get(ConstantEnum.clientCode.getKey()) +
DateUtil.getDateTime(DateUtil.DATE_PATTERN.YYYYMMDD) + OrderUtils.getRandom8();
request.setRequestid(requestId);
PayRequestContent requestContent = new PayRequestContent(ppvId + ":" + payMoney);
// 订单信息(页面展示)
PayplatPayOrderInfo orderInfo = createOrderInfo(orderNo, productName, payMoney);
requestContent.setOrderInfo(orderInfo);
// 客户信息
PayplatPayCustInfo custInfo = createCustInfo(custName, custId, cardNo, area, city);
requestContent.setCustInfo(custInfo);
// 支付总金额
requestContent.setTotalFee(payMoney);
// 支付方式;空
requestContent.setPayments("");
// 前台通知接口
requestContent.setRedirectUrl("");
// 后台通知接口
requestContent.setNoticeAction(callBackUrl);
// 订单号
requestContent.setOrderNo(orderNo);
// 01缴费业务;02一次性业务
requestContent.setOrderType("02");
// Y或N 是否Boss订单确认
requestContent.setIsOrder("N");
// 是否直接返回二维码
requestContent.setOnlyQrCodeUrl("Y");
// 请求参数
request.setRequestContent(requestContent);
try {
// 参数加密
request.sign(ConstantFactory.map.get(ConstantEnum.payPrivateKey.getKey()));
return request;
} catch (Exception e) {
throw new RuntimeException("参数加签名异常" + e.getMessage(), e);
}
}
/**
* 创建订单对象
*
* @param orderNo 订单号
* @param productName 产品名称
* @param payMoney 支付金额
* @return
*/
private static PayplatPayOrderInfo createOrderInfo(String orderNo, String productName, double payMoney) {
PayplatPayOrderInfo orderInfo = new PayplatPayOrderInfo();
orderInfo.setOrderNo(orderNo);
List<PayplatPayProductInfo> productList = Lists.newArrayList();
PayplatPayProductInfo productInfo = new PayplatPayProductInfo();
productInfo.setProductName(productName);
productInfo.setFee(payMoney);
productList.add(productInfo);
orderInfo.setProductList(productList);
return orderInfo;
}
/**
* 创建客户对象
*
* @param custName 客户名称
* @param custId 客户编码
* @param cardNo 智能卡号
* @param area 业务区标识
* @param city 区域标识
* @return
*/
private static PayplatPayCustInfo createCustInfo(String custName, String custId, String cardNo,
String area, String city) {
PayplatPayCustInfo custInfo = new PayplatPayCustInfo();
custInfo.setCustname(custName);
custInfo.setCustid(custId);
custInfo.setCardNo(cardNo);
custInfo.setArea(area);
custInfo.setCity(city);
return custInfo;
}
}
| [
"liuhailong927@sina.com"
] | liuhailong927@sina.com |
8fa4b9d9162f4f1f003376df196d37ade46ebac4 | b0ce2a44d939f7ca550cc69d00fa3e2a4d744397 | /src/main/java/com/piotrek/CommutePlanner.java | f8edd2be25a3927cc3d0d7df69b302106709bccb | [] | no_license | piotrholda/CommuteQueueForAndroid | a7c0333e945439292c144d8a1dda1d681ad71731 | ac5c90ac27e38efaec0886ee0a7849734202d7ec | refs/heads/master | 2021-01-23T04:58:33.223291 | 2017-03-26T20:03:42 | 2017-03-26T20:03:42 | 86,259,435 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,466 | java | package com.piotrek;
import com.piotrek.calendar.DaysOfWeek;
import com.piotrek.planning.DatePlanner;
import org.joda.time.LocalDate;
import io.reactivex.annotations.NonNull;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Predicate;
/**
* Created by Piotrek on 2016-10-15.
*/
class CommutePlanner {
private final DaysOfWeek daysOfWeek;
private final DatePlanner datePlanner;
CommutePlanner(DaysOfWeek daysOfWeek, DatePlanner datePlanner) {
this.daysOfWeek = daysOfWeek;
this.datePlanner = datePlanner;
}
DrivePlan plan(CommuteCalendar commuteCalendar) {
final DrivePlan drivePlan = new DrivePlan();
commuteCalendar.getDates()
.filter(
new Predicate<LocalDate>() {
@Override
public boolean test(@NonNull LocalDate date) throws Exception {
return daysOfWeek.contains(date.getDayOfWeek());
}
}
)
.subscribe(
new Consumer<LocalDate>() {
@Override
public void accept(@NonNull LocalDate date) throws Exception {
datePlanner.planTheDay(drivePlan, date);
}
}
);
return drivePlan;
}
}
| [
"pholda@gmail.com"
] | pholda@gmail.com |
359209b2e62334e526b692006685e74db78c5c39 | f9a46de92ad816b138885558f7ad4320a2bc37cd | /console/src/com/thoughtworks/classes/Rover.java | c4199f2519da510e55dfd2cbb0602336e7e769a6 | [] | no_license | linzhixiong/mars_rover | 09fa6181020f04794fcb082927b02842dd965843 | 5e9132dc807ed73a2c4f3cc1150699459a51afec | refs/heads/master | 2021-01-10T20:21:30.204550 | 2011-10-08T13:59:38 | 2011-10-08T13:59:38 | 2,486,861 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,650 | java | package com.thoughtworks.classes;
public class Rover {
private Heading heading;
private Position position;
public Rover(Position position, Heading heading) {
this.position = position;
this.heading = heading;
}
public Heading getHeading() {
return heading;
}
public Rover(int x, int y, Heading heading) {
this.heading = heading;
}
public void turnLeft() {
heading = heading.turnLeft();
}
public Position getPosition() {
return position;
}
public void move() {
switch (heading) {
case N:
position.move(0, 1);
break;
case W:
position.move(-1, 0);
break;
case S:
position.move(0, -1);
break;
case E:
position.move(1, 0);
break;
}
}
@Override
public String toString() {
return position.toString() + " " + heading.toString(); //To change body of overridden methods use File | Settings | File Templates
}
public void executeCommand(char command) {
if (command == 'L') {
turnLeft();
}
if (command == 'R') {
turnRight();
}
if (command == 'M') {
move();
}
}
public void executeCommands(String commands) {
char[] commandArray = commands.toCharArray();
for (char command : commandArray) {
executeCommand(command);
}
}
public void turnRight() {
heading = heading.turnRight();
}
}
| [
"darlinglele@gmail.com"
] | darlinglele@gmail.com |
1db58469b7b147621072cc98989f1398cc5041b0 | 0a2682194bf07830665a86b7aa82f4205bed4c87 | /src/livingCreatures/Ponyville/LiveHorseshoe.java | f11c7fdb2a2b3215b15ced5b38c80a304e7ffae0 | [] | no_license | Roclh/CatsAndPonies | f92c0b23dcd22caca1920bc7fd4cff399998f11a | 539b15a4ca71de8deb05dc1f72751ebcffa5fb8b | refs/heads/master | 2021-03-01T13:21:49.032664 | 2020-03-08T08:26:09 | 2020-03-08T08:26:09 | 245,788,878 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,400 | java | package livingCreatures.Ponyville;
import enums.Locations;
import enums.Rarity;
import livingCreatures.ALivingCreatures;
import skills.DeadlyAttack;
import skills.EvilEnergy;
import skills.SurpriseAttack;
import skills.healingSkills.AngelDust;
public class LiveHorseshoe extends ALivingCreatures {
public LiveHorseshoe(String name, float health, float strength, float protection, float agility) {
super(name, health, strength, protection, agility);
}
public LiveHorseshoe(){
super("Живая подкова", 60, 5,0,0);
this.setId("enemy_livehorseshoe");
this.setLocations(Locations.PONYVILLE);
this.setRarity(Rarity.COMMON);
}
private DeadlyAttack skill1 = new DeadlyAttack();
private SurpriseAttack skill2 = new SurpriseAttack();
private EvilEnergy skill3 = new EvilEnergy();
@Override
public void chooseSkill(ALivingCreatures gainer) {
switch ((int) (Math.floor(Math.random() * 3))) {
case 0:
skill1.cast(this, gainer);
break;
case 1:
skill2.cast(this, gainer);
break;
case 2:
skill3.cast(this, gainer);
break;
default:
System.out.println("ОШИБКА С РАНДОМОМ В ВЫБОРЕ УМЕНИЯ");
break;
}
}
}
| [
"lubitelJop@yandex.ru"
] | lubitelJop@yandex.ru |
1c24e145dd78c599026c09851bd88f4e45e0bd49 | a9093294e46ad910a3f50621ac25aa149f3b49f6 | /src/main/java/com/ang/model/ErrorDetail.java | f6efee8e49a3b561d01f6eb108ce7c490d9fe6ef | [] | no_license | diveshpremdeep/ang-test-backend | 0c9448c91ea8cf44b15ad2f2d665ea8282dc1d54 | 0080c76e4985c744bf8554df2ff6ea856c3ef4c8 | refs/heads/master | 2020-04-28T09:44:19.719412 | 2019-03-15T03:56:41 | 2019-03-15T03:56:41 | 175,178,297 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 426 | java | package com.ang.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Builder;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@RequiredArgsConstructor
@Builder
public class ErrorDetail {
private final String location;
private final String param;
@JsonProperty("msg")
private final String message;
private final String value;
}
| [
"diveshpremdeep@gmail.com"
] | diveshpremdeep@gmail.com |
a18e0f4d213dc5b78b0e31b2c1eff5c8b6acaa8f | e8a974ce87c2da13a51f385879f56fe154728cde | /src/livraria_para_programadores_api/controle/ControleAtualizar.java | 056742cd2362f6e9e11703779a66a9a2f91d31fe | [] | no_license | lucastrindade222/livraria_para_programadores | bf6b6a8bfd11f0aee233f5685fae03696cefee4f | 80184ba70c809eda282b7c397da1ae1f865e195b | refs/heads/main | 2023-01-10T12:04:28.848764 | 2020-11-19T00:43:53 | 2020-11-19T00:43:53 | 313,464,796 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 662 | java | package livraria_para_programadores_api.controle;
import livraria_para_programadores_api.banco.livrosDAO;
import livraria_para_programadores_api.model.Autor;
import livraria_para_programadores_api.model.Livros;
public class ControleAtualizar {
public void atualizar(Livros livros) {
try {
livrosDAO doa= livrosDAO.getInstance();
doa.atualizar(livros);
} catch (Exception e) {
e.printStackTrace();
}
}
public void atualizarAutor(Autor autor) {
try {
livrosDAO doa= livrosDAO.getInstance();
doa.atualizarAutor(autor);
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"55842839+lucastrindade222@users.noreply.github.com"
] | 55842839+lucastrindade222@users.noreply.github.com |
3efb154353a278705d5018c55032fe874e5ef7da | 26306cde939e087c487637d82d744e4e33cb8613 | /server/tests/src/test/java/org/infinispan/server/functional/BackupManagerIT.java | f28a25b47abaf29554a8a6a82b2f7c7e85769f38 | [
"LicenseRef-scancode-dco-1.1",
"Apache-2.0"
] | permissive | jermarchand/infinispan | 247196f1b348da55eb03d413082b42fbfead2570 | cb510481d1bf6dd54018e63f87a0b0ba5db560bf | refs/heads/master | 2023-01-04T04:20:41.189815 | 2020-09-29T15:22:39 | 2020-09-30T13:52:18 | 300,214,470 | 0 | 0 | Apache-2.0 | 2020-10-01T09:02:59 | 2020-10-01T09:02:59 | null | UTF-8 | Java | false | false | 16,498 | java | package org.infinispan.server.functional;
import static org.infinispan.functional.FunctionalTestUtils.await;
import static org.infinispan.util.concurrent.CompletionStages.join;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletionStage;
import java.util.function.BiFunction;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import org.infinispan.client.rest.RestCacheClient;
import org.infinispan.client.rest.RestCacheManagerClient;
import org.infinispan.client.rest.RestClient;
import org.infinispan.client.rest.RestClusterClient;
import org.infinispan.client.rest.RestCounterClient;
import org.infinispan.client.rest.RestEntity;
import org.infinispan.client.rest.RestResponse;
import org.infinispan.client.rest.RestTaskClient;
import org.infinispan.commons.dataconversion.MediaType;
import org.infinispan.commons.dataconversion.internal.Json;
import org.infinispan.commons.test.CommonsTestingUtil;
import org.infinispan.commons.util.Util;
import org.infinispan.configuration.cache.ConfigurationBuilder;
import org.infinispan.counter.api.Storage;
import org.infinispan.counter.configuration.Element;
import org.infinispan.test.TestingUtil;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
/**
* @author Ryan Emerson
* @since 12.0
*/
public class BackupManagerIT extends AbstractMultiClusterIT {
static final File WORKING_DIR = new File(CommonsTestingUtil.tmpDirectory(BackupManagerIT.class));
static final int NUM_ENTRIES = 10;
public BackupManagerIT() {
super("configuration/ClusteredServerTest.xml");
}
@BeforeClass
public static void setup() {
WORKING_DIR.mkdirs();
}
@AfterClass
public static void teardown() {
Util.recursiveFileRemove(WORKING_DIR);
}
@Test
public void testManagerBackupUpload() throws Exception {
String backupName = "testManagerBackup";
performTest(
client -> {
RestCacheManagerClient cm = client.cacheManager("clustered");
RestResponse response = await(cm.createBackup(backupName));
assertEquals(202, response.getStatus());
return awaitOk(() -> cm.getBackup(backupName, false));
},
client -> await(client.cacheManager("clustered").deleteBackup(backupName)),
(zip, client) -> client.cacheManager("clustered").restore(zip),
this::assertWildcardContent
);
}
@Test
public void testManagerBackupFromFile() throws Exception {
String backupName = "testManagerBackup";
performTest(
client -> {
RestCacheManagerClient cm = client.cacheManager("clustered");
RestResponse response = await(cm.createBackup(backupName));
assertEquals(202, response.getStatus());
response.close();
return awaitOk(() -> cm.getBackup(backupName, false));
},
client -> await(client.cacheManager("clustered").deleteBackup(backupName)),
(zip, client) -> client.cacheManager("clustered").restore(zip.getPath(), null),
this::assertWildcardContent
);
}
@Test
public void testManagerBackupParameters() throws Exception {
String backupName = "testManagerBackupParameters";
performTest(
client -> {
Map<String, List<String>> params = new HashMap<>();
params.put("caches", Collections.singletonList("*"));
params.put("counters", Collections.singletonList("weak-volatile"));
RestCacheManagerClient cm = client.cacheManager("clustered");
RestResponse response = await(cm.createBackup(backupName, params));
assertEquals(202, response.getStatus());
return awaitOk(() -> cm.getBackup(backupName, false));
},
client -> await(client.cacheManager("clustered").deleteBackup(backupName)),
(zip, client) -> {
Map<String, List<String>> params = new HashMap<>();
params.put("caches", Collections.singletonList("cache1"));
params.put("counters", Collections.singletonList("*"));
return client.cacheManager("clustered").restore(zip, params);
},
client -> {
// Assert that only caches and the specified "weak-volatile" counter have been backed up. Internal caches will still be present
assertEquals("[\"___protobuf_metadata\",\"memcachedCache\",\"cache1\",\"___script_cache\"]", await(client.caches()).getBody());
assertEquals("[\"weak-volatile\"]", await(client.counters()).getBody());
assertEquals(404, await(client.schemas().get("schema.proto")).getStatus());
assertEquals("[]", await(client.tasks().list(RestTaskClient.ResultType.USER)).getBody());
}
);
}
@Test
public void testCreateDuplicateBackupResources() throws Exception {
String backupName = "testCreateDuplicateBackupResources";
// Start the source cluster
startSourceCluster();
RestClient client = source.getClient();
populateContainer(client);
RestCacheManagerClient cm = client.cacheManager("clustered");
RestResponse response = await(cm.createBackup(backupName));
assertEquals(202, response.getStatus());
response = await(cm.createBackup(backupName));
assertEquals(409, response.getStatus());
response = await(cm.deleteBackup(backupName));
// Expect a 202 response as the previous backup will be in progress, so the request is accepted for now
assertEquals(202, response.getStatus());
// Now wait until the backup has actually been deleted so that we successfully create another with the same name
awaitStatus(() -> cm.deleteBackup(backupName), 202, 404);
response = await(cm.createBackup(backupName));
assertEquals(202, response.getStatus());
// Wait for the backup operation to finish
awaitOk(() -> cm.getBackup(backupName, false));
response = await(cm.deleteBackup(backupName));
assertEquals(204, response.getStatus());
}
@Test
public void testManagerRestoreParameters() throws Exception {
String backupName = "testManagerRestoreParameters";
performTest(
client -> {
// Create a backup of all container content
RestCacheManagerClient cm = client.cacheManager("clustered");
RestResponse response = await(cm.createBackup(backupName));
assertEquals(202, response.getStatus());
return awaitOk(() -> cm.getBackup(backupName, false));
},
client -> await(client.cacheManager("clustered").deleteBackup(backupName)),
(zip, client) -> {
// Request that only the 'test.js' script is restored
Map<String, List<String>> params = new HashMap<>();
params.put("scripts", Collections.singletonList("test.js"));
return client.cacheManager("clustered").restore(zip, params);
},
client -> {
// Assert that the test.js script has been restored
List<Json> scripts = Json.read(await(client.tasks().list(RestTaskClient.ResultType.USER)).getBody()).asJsonList();
assertEquals(1, scripts.size());
assertEquals("test.js", scripts.iterator().next().at("name").asString());
// Assert that no other content has been restored
assertEquals("[\"___protobuf_metadata\",\"memcachedCache\",\"___script_cache\"]", await(client.caches()).getBody());
assertEquals("[]", await(client.counters()).getBody());
assertEquals(404, await(client.schemas().get("schema.proto")).getStatus());
}
);
}
@Test
public void testClusterBackupUpload() throws Exception {
String backupName = "testClusterBackup";
performTest(
client -> {
RestClusterClient cluster = client.cluster();
RestResponse response = await(cluster.createBackup(backupName));
assertEquals(202, response.getStatus());
return awaitOk(() -> cluster.getBackup(backupName, false));
},
client -> await(client.cacheManager("clustered").deleteBackup(backupName)),
(zip, client) -> client.cluster().restore(zip),
this::assertWildcardContent
);
}
@Test
public void testClusterBackupFromFile() throws Exception {
String backupName = "testClusterBackup";
performTest(
client -> {
RestClusterClient cluster = client.cluster();
RestResponse response = await(cluster.createBackup(backupName));
assertEquals(202, response.getStatus());
return awaitOk(() -> cluster.getBackup(backupName, false));
},
client -> await(client.cacheManager("clustered").deleteBackup(backupName)),
(zip, client) -> client.cluster().restore(zip.getPath()),
this::assertWildcardContent
);
}
private RestResponse awaitOk(Supplier<CompletionStage<RestResponse>> request) {
return awaitStatus(request, 202, 200);
}
private RestResponse awaitStatus(Supplier<CompletionStage<RestResponse>> request, int pendingStatus, int completeStatus) {
int count = 0;
RestResponse response;
while ((response = await(request.get())).getStatus() == pendingStatus || count++ < 100) {
TestingUtil.sleepThread(10);
response.close();
}
assertEquals(completeStatus, response.getStatus());
return response;
}
private void performTest(Function<RestClient, RestResponse> backupAndDownload,
Function<RestClient, RestResponse> delete,
BiFunction<File, RestClient, CompletionStage<RestResponse>> restore,
Consumer<RestClient> assertTargetContent) throws Exception {
// Start the source cluster
startSourceCluster();
RestClient client = source.getClient();
// Populate the source container
populateContainer(client);
// Perform the backup and download
RestResponse getResponse = backupAndDownload.apply(client);
String fileName = getResponse.getHeader("Content-Disposition").split("=")[1];
// Delete the backup from the server
RestResponse deleteResponse = delete.apply(client);
assertEquals(204, deleteResponse.getStatus());
deleteResponse.close();
// Ensure that all of the backup files have been deleted from the source cluster
// We must wait for a short period time here to ensure that the returned entity has actually been removed from the filesystem
Thread.sleep(50);
assertNoServerBackupFilesExist(source);
// Shutdown the source cluster
stopSourceCluster();
// Start the target cluster
startTargetCluster();
client = target.getClient();
// Copy the returned zip bytes to the local working dir
File backupZip = new File(WORKING_DIR, fileName);
try (InputStream is = getResponse.getBodyAsStream()) {
Files.copy(is, backupZip.toPath(), StandardCopyOption.REPLACE_EXISTING);
}
getResponse.close();
// Upload the backup to the target cluster
deleteResponse = await(restore.apply(backupZip, client));
assertEquals(deleteResponse.getBody(), 204, deleteResponse.getStatus());
deleteResponse.close();
// Assert that all content has been restored as expected
assertTargetContent.accept(client);
// Ensure that the backup files have been deleted from the target cluster
assertNoServerBackupFilesExist(target);
stopTargetCluster();
}
private void populateContainer(RestClient client) throws Exception {
String cacheName = "cache1";
createCache(cacheName, new ConfigurationBuilder(), client);
RestCacheClient cache = client.cache(cacheName);
for (int i = 0; i < NUM_ENTRIES; i++) {
join(cache.put(String.valueOf(i), String.valueOf(i)));
}
assertEquals(NUM_ENTRIES, getCacheSize(cacheName, client));
createCounter("weak-volatile", Element.WEAK_COUNTER, Storage.VOLATILE, client, 0);
createCounter("weak-persistent", Element.WEAK_COUNTER, Storage.PERSISTENT, client, -100);
createCounter("strong-volatile", Element.STRONG_COUNTER, Storage.VOLATILE, client, 50);
createCounter("strong-persistent", Element.STRONG_COUNTER, Storage.PERSISTENT, client, 0);
addSchema(client);
try (InputStream is = BackupManagerIT.class.getResourceAsStream("/scripts/test.js")) {
String script = CommonsTestingUtil.loadFileAsString(is);
RestResponse rsp = await(client.tasks().uploadScript("test.js", RestEntity.create(MediaType.APPLICATION_JAVASCRIPT, script)));
assertEquals(200, rsp.getStatus());
}
}
private void assertWildcardContent(RestClient client) {
String cacheName = "cache1";
assertEquals(Integer.toString(NUM_ENTRIES), await(client.cache(cacheName).size()).getBody());
assertCounter(client, "weak-volatile", Element.WEAK_COUNTER, Storage.VOLATILE, 0);
assertCounter(client, "weak-persistent", Element.WEAK_COUNTER, Storage.PERSISTENT, -100);
assertCounter(client, "strong-volatile", Element.STRONG_COUNTER, Storage.VOLATILE, 50);
assertCounter(client, "strong-persistent", Element.STRONG_COUNTER, Storage.PERSISTENT, 0);
RestResponse rsp = await(client.schemas().get("schema.proto"));
assertEquals(200, rsp.getStatus());
assertTrue(rsp.getBody().contains("message Person"));
rsp = await(client.tasks().list(RestTaskClient.ResultType.USER));
assertEquals(200, rsp.getStatus());
Json json = Json.read(rsp.getBody());
assertTrue(json.isArray());
List<Json> tasks = json.asJsonList();
assertEquals(1, tasks.size());
assertEquals("test.js", tasks.get(0).at("name").asString());
}
private void createCounter(String name, Element type, Storage storage, RestClient client, long delta) {
String config = String.format("{\n" +
" \"%s\":{\n" +
" \"initial-value\":0,\n" +
" \"storage\":\"%s\"\n" +
" }\n" +
"}", type, storage.toString());
RestCounterClient counterClient = client.counter(name);
RestResponse rsp = await(counterClient.create(RestEntity.create(MediaType.APPLICATION_JSON, config)));
assertEquals(200, rsp.getStatus());
if (delta != 0) {
rsp = await(counterClient.add(delta));
assertEquals(name, name.contains("strong") ? 200 : 204, rsp.getStatus());
assertNotNull(rsp.getBody());
}
}
private void assertCounter(RestClient client, String name, Element type, Storage storage, long expectedValue) {
RestResponse rsp = await(client.counter(name).configuration());
assertEquals(200, rsp.getStatus());
String content = rsp.getBody();
Json config = Json.read(content).at(type.toString());
assertEquals(name, config.at("name").asString());
assertEquals(storage.toString(), config.at("storage").asString());
assertEquals(0, config.at("initial-value").asInteger());
rsp = await(client.counter(name).get());
assertEquals(200, rsp.getStatus());
assertEquals(expectedValue, Long.parseLong(rsp.getBody()));
}
private void assertNoServerBackupFilesExist(Cluster cluster) {
for (int i = 0; i < 2; i++) {
Path root = cluster.driver.getRootDir().toPath();
File workingDir = root.resolve(Integer.toString(i)).resolve("data").resolve("backup-manager").toFile();
assertTrue(workingDir.isDirectory());
String[] files = workingDir.list();
assertNotNull(files);
assertEquals(Arrays.toString(files), 0, files.length);
}
}
}
| [
"william.a.burns@gmail.com"
] | william.a.burns@gmail.com |
594d292cb6a4ebb755fdc4bde4b376e8b4e10767 | 5fbe7d798df059d980044a25bc653232ae2c8fda | /CarrinhoComprasApp/src/br/com/carrinho/carrinhocomprasapp/CarrinhoAlarmReceiver.java | ca4ed9b2bb7ca0945cfa30e191ce183ef400c2e3 | [] | no_license | hernandazevedo/carrinho-de-compras | 72c42214ccb7c990a4b1d9587b52075783eaadd8 | 7f8004a18b6814da64d2adaef5fbd694caa9177c | refs/heads/master | 2016-09-03T06:37:34.403181 | 2014-05-04T20:46:57 | 2014-05-04T20:46:57 | 32,824,272 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 588 | java | package br.com.carrinho.carrinhocomprasapp;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
public class CarrinhoAlarmReceiver extends BroadcastReceiver {
// onReceive must be very quick and not block, so it just fires up a Service
@Override
public void onReceive(Context context, Intent intent) {
Log.i(Constants.LOG_TAG, "DealAlarmReceiver invoked, starting DealService in background");
context.startService(new Intent(context, SyncService.class));
}
}
| [
"hernand.azevedo@gmail.com@212d080f-729e-9039-a2dd-4b18e2f23d7e"
] | hernand.azevedo@gmail.com@212d080f-729e-9039-a2dd-4b18e2f23d7e |
05d7f0d2f1758eedd1b3ba7570e315d4679425d1 | f4a9a9448ac4463ad99380e740e2e8bba449af4d | /Mengli_Ding/src/main/java/beach/tw/handlers/DepositHandler.java | f29d33a6c22d429175b69e9e6861c0866d814906 | [] | no_license | zhangyuyu/BeachProject | e07cb81b1c87f979d83da63549dfbe337f73fc1e | 611e7aa02ceaf91b8ada3ea2b7b722cafe41e14c | refs/heads/master | 2021-01-16T21:28:07.789961 | 2015-08-21T07:44:41 | 2015-08-21T07:44:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,032 | java | package beach.tw.handlers;
import beach.tw.entity.Account;
import beach.tw.entity.Customer;
import beach.tw.requests.CustomerRequest;
import java.util.Calendar;
import java.util.Date;
/**
* Created by mlding on 8/16/15.
*/
public class DepositHandler implements RequestHandler {
@Override
public void handle(CustomerRequest request) {
Customer customer = request.getCustomer();
Account account = customer.getAccount();
if (isCustomerBeenWithBankOverTwoYears(customer) && !customer.isGetBonus()){
account.add(request.getBill() + 5);
customer.setIsGetBonus(true);
}
else{
account.add(request.getBill());
}
}
private boolean isCustomerBeenWithBankOverTwoYears(Customer customer) {
Calendar joiningDate = customer.getJoiningDate();
Calendar calendar2 = Calendar.getInstance();
calendar2.setTime(new Date());
joiningDate.add(Calendar.YEAR, 2);
return joiningDate.before(calendar2);
}
}
| [
"dingding199389@163.com"
] | dingding199389@163.com |
32f4277d1a477b605abdb3b99dd8808dc0072ca0 | 605ed3179fe2e2fef3b8479f11b77997c912b818 | /hibernateCascadeType/src/main/java/com/hibernate/model/Student.java | 88b6ee295e2153c42edb2640970d448b9fd28d50 | [] | no_license | scharanjit/DesignPatterns | 9659846e3a9a2c64f3909d69cc889daed6bd4a74 | be7e767ff4ed2931868b4cd7a59ce014bd87ff47 | refs/heads/master | 2022-12-24T02:26:11.784165 | 2022-02-08T04:21:43 | 2022-02-08T04:21:43 | 101,736,521 | 1 | 0 | null | 2022-12-16T06:30:08 | 2017-08-29T08:12:35 | Java | UTF-8 | Java | false | false | 1,121 | java | package com.hibernate.model;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;
@Entity
@Table(name="student")
public class Student {
@Id
private int s_id;
private String name;
private int age;
@OneToOne(cascade= { CascadeType.REMOVE }) //it removes the subject too while we delete the student
private Subject subj;
public int getS_id() {
return s_id;
}
public void setS_id(int s_id) {
this.s_id = s_id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public Subject getSubj() {
return subj;
}
public void setSubj(Subject subj) {
this.subj = subj;
}
@Override
public String toString() {
return "Student [s_id=" + s_id + ", name=" + name + ", age=" + age + ", subj=" + subj + "]";
}
} | [
"charanjit.singh90@gmail.com"
] | charanjit.singh90@gmail.com |
376a7854387963db56daa84c83341cab3013ed7d | 5ca626cbd3de8f5e21cc3c24ca066cd927225a9d | /src/main/java/com/sjzxy/quartz/util/ScheduleUtils.java | 4e3eb3c5dfcbabe769b2f53b7e3bf464a7c1ef37 | [] | no_license | shijiazhuangwsq/quartz-test | 658b4e2fe50567160b18ba071e33a365a65cd0c5 | 32e5ac9a263175cdf67ca0e50554dda1a88f9870 | refs/heads/master | 2022-06-28T08:41:47.484977 | 2020-01-15T01:44:40 | 2020-01-15T01:44:40 | 233,964,922 | 4 | 0 | null | 2022-06-17T02:49:30 | 2020-01-15T00:39:50 | Java | UTF-8 | Java | false | false | 5,568 | java | package com.sjzxy.quartz.util;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.quartz.CronScheduleBuilder;
import org.quartz.CronTrigger;
import org.quartz.JobBuilder;
import org.quartz.JobDataMap;
import org.quartz.JobDetail;
import org.quartz.JobKey;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.TriggerBuilder;
import org.quartz.TriggerKey;
import com.sjzxy.quartz.entity.ScheduleJobEntity;
/**
* 定时任务工具类
*
* @author asiainfo
*
* @date 2016年11月30日 下午12:44:59
*/
public class ScheduleUtils {
private final static String JOB_NAME = "TASK_";
// public static ExecutorService service = Executors.newSingleThreadExecutor();
public static ExecutorService service = Executors.newFixedThreadPool(5);
/**
* 获取触发器key
*/
public static TriggerKey getTriggerKey(Long jobId) {
return TriggerKey.triggerKey(JOB_NAME + jobId);
}
/**
* 获取jobKey
*/
public static JobKey getJobKey(Long jobId) {
return JobKey.jobKey(JOB_NAME + jobId);
}
/**
* 获取表达式触发器
*/
public static CronTrigger getCronTrigger(Scheduler scheduler, Long jobId) {
try {
return (CronTrigger) scheduler.getTrigger(getTriggerKey(jobId));
} catch (SchedulerException e) {
throw new RRException("获取定时任务CronTrigger出现异常", e);
}
}
/**
* 创建定时任务
*/
public static void createScheduleJob(Scheduler scheduler, ScheduleJobEntity scheduleJob) {
try {
//构建job信息
JobDetail jobDetail = JobBuilder.newJob(ScheduleJob.class).withIdentity(getJobKey(scheduleJob.getJobId())).build();
//放入参数,运行时的方法可以获取
jobDetail.getJobDataMap().put(ScheduleJobEntity.JOB_PARAM_KEY, scheduleJob);
//表达式调度构建器
// CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(scheduleJob.getCronExpression()).withMisfireHandlingInstructionDoNothing();
CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(scheduleJob.getCronExpression());
//按新的cronExpression表达式构建一个新的trigger
CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity(getTriggerKey(scheduleJob.getJobId())).withSchedule(scheduleBuilder).build();
scheduler.scheduleJob(jobDetail, trigger);
//暂停任务
if(scheduleJob.getStatus() == Constant.ScheduleStatus.PAUSE.getValue()){
pauseJob(scheduler, scheduleJob.getJobId());
}
} catch (SchedulerException e) {
throw new RRException("创建定时任务失败", e);
}
}
/**
* 更新定时任务
*/
public static void updateScheduleJob(Scheduler scheduler, ScheduleJobEntity scheduleJob) {
try {
TriggerKey triggerKey = getTriggerKey(scheduleJob.getJobId());
//表达式调度构建器
// CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(scheduleJob.getCronExpression()).withMisfireHandlingInstructionDoNothing();
CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(scheduleJob.getCronExpression());
CronTrigger trigger = getCronTrigger(scheduler, scheduleJob.getJobId());
//按新的cronExpression表达式重新构建trigger
trigger = trigger.getTriggerBuilder().withIdentity(triggerKey).withSchedule(scheduleBuilder).build();
//参数
trigger.getJobDataMap().put(ScheduleJobEntity.JOB_PARAM_KEY, scheduleJob);
scheduler.rescheduleJob(triggerKey, trigger);
//暂停任务
if(scheduleJob.getStatus() == Constant.ScheduleStatus.PAUSE.getValue()){
pauseJob(scheduler, scheduleJob.getJobId());
}
} catch (SchedulerException e) {
throw new RRException("更新定时任务失败", e);
}
}
/**
* 立即执行任务
*/
public static void run(Scheduler scheduler, ScheduleJobEntity scheduleJob) {
try {
//参数
JobDataMap dataMap = new JobDataMap();
dataMap.put(ScheduleJobEntity.JOB_PARAM_KEY, scheduleJob);
scheduler.triggerJob(getJobKey(scheduleJob.getJobId()), dataMap);
} catch (SchedulerException e) {
throw new RRException("立即执行定时任务失败", e);
}
}
/**
* 暂停任务
*/
public static void pauseJob(Scheduler scheduler, Long jobId) {
try {
scheduler.pauseJob(getJobKey(jobId));
} catch (SchedulerException e) {
throw new RRException("暂停定时任务失败", e);
}
}
/**
* 恢复任务
*/
public static void resumeJob(Scheduler scheduler, Long jobId) {
try {
scheduler.resumeJob(getJobKey(jobId));
} catch (SchedulerException e) {
throw new RRException("恢复定时任务失败", e);
}
}
/**
* 删除定时任务
*/
public static void deleteScheduleJob(Scheduler scheduler, Long jobId) {
try {
scheduler.deleteJob(getJobKey(jobId));
} catch (SchedulerException e) {
throw new RRException("删除定时任务失败", e);
}
}
}
| [
"shiyuanwangshiqi@aliyun.com"
] | shiyuanwangshiqi@aliyun.com |
fb66c486793217fcd4ec41cec28a4172dadeb3a2 | 55f8ee8a2da4c88d14dd2ea14c4aea819f27c734 | /app/src/main/java/com/matrix/yukun/matrix/qrcode_module/decoding/DecodeThread.java | c78f046ae9645f16956adddd9aea9fea5366149c | [] | no_license | Dummyurl/VideoSpecial | 924619e87fa8c7a55945ece96bc97d77cad0de36 | 3903e7f1c316f92ae9a0e00719539f5bc4e2e559 | refs/heads/master | 2020-04-10T21:55:19.343452 | 2018-12-11T09:22:52 | 2018-12-11T09:22:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,614 | java | /*
* Copyright (C) 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.matrix.yukun.matrix.qrcode_module.decoding;
import android.os.Handler;
import android.os.Looper;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.DecodeHintType;
import com.google.zxing.ResultPointCallback;
import com.matrix.yukun.matrix.qrcode_module.QRCodeActivity;
import java.util.Hashtable;
import java.util.Vector;
import java.util.concurrent.CountDownLatch;
/**
* This thread does all the heavy lifting of decoding the images.
*/
final class DecodeThread extends Thread {
public static final String BARCODE_BITMAP = "barcode_bitmap";
private final QRCodeActivity activity;
private final Hashtable<DecodeHintType, Object> hints;
private Handler handler;
private final CountDownLatch handlerInitLatch;
DecodeThread(QRCodeActivity activity,
Vector<BarcodeFormat> decodeFormats,
String characterSet,
ResultPointCallback resultPointCallback) {
this.activity = activity;
handlerInitLatch = new CountDownLatch(1);
hints = new Hashtable<DecodeHintType, Object>(3);
if (decodeFormats == null || decodeFormats.isEmpty()) {
decodeFormats = new Vector<BarcodeFormat>();
decodeFormats.addAll(DecodeFormatManager.ONE_D_FORMATS);
decodeFormats.addAll(DecodeFormatManager.QR_CODE_FORMATS);
decodeFormats.addAll(DecodeFormatManager.DATA_MATRIX_FORMATS);
}
hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);
if (characterSet != null) {
hints.put(DecodeHintType.CHARACTER_SET, characterSet);
}
hints.put(DecodeHintType.NEED_RESULT_POINT_CALLBACK, resultPointCallback);
}
Handler getHandler() {
try {
handlerInitLatch.await();
} catch (InterruptedException ie) {
// continue?
}
return handler;
}
@Override
public void run() {
Looper.prepare();
handler = new DecodeHandler(activity, hints);
handlerInitLatch.countDown();
Looper.loop();
}
}
| [
"yuku@spap.com"
] | yuku@spap.com |
15045670ff9ee7e6c91dac872abc3573cbef76b3 | 57e08782d4d39ee871037f600b45ba8fb623fd54 | /ebank/src/main/java/pe/openebusiness/ebank/service/AssestTypeService.java | 73e70035b7475fb08872dd49ad7ed20422458136 | [] | no_license | samHuaman/ebank | 244390599d91bbd875e83f87bf64db578a842576 | bcd39600fdeab5aa84ed211423428a8a70016771 | refs/heads/master | 2020-12-02T06:18:58.632302 | 2017-08-22T14:59:33 | 2017-08-22T14:59:33 | 96,815,909 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 195 | java | package pe.openebusiness.ebank.service;
import pe.openebusiness.ebank.model.AssestType;
import java.util.List;
public interface AssestTypeService {
List<AssestType> getAllAssestType();
}
| [
"paco9194_gc@hotmail.com"
] | paco9194_gc@hotmail.com |
3f205227b4d3fb9474c310e0825eaf2a8ef5025b | 91b878cac077c5f682358a7e2f896275b6edde13 | /Baekjoon/solved/1182/Main.java | 8c0b2ec4b538591dab64e4c4f9104242974a0c05 | [] | no_license | ku-alps/cse17_keunbum | 0151a8d8d9f62dc48201c830cbc60cd7d3322bc9 | f144766a6bf723bb7453875d909808676e61ac3a | refs/heads/master | 2020-04-28T17:29:39.071134 | 2020-03-24T13:41:29 | 2020-03-24T13:41:29 | 175,448,761 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 801 | java | import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
void solve() {
}
FastScanner in;
PrintWriter out;
void run() {
in = new FastScanner();
out = new PrintWriter(System.out);
solve();
out.close();
}
class FastScanner {
BufferedReader br;
StringTokenizer st;
public FastScanner() {
br = new BufferedReader(new InputStreamReader(System.in), 32768);
st = null;
}
public String next() {
while (st == null || !st.hasMoreTokens()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return st.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
}
public static void main(String[] args) {
new Main().run();
}
}
| [
"rkeunbum@gmail.com"
] | rkeunbum@gmail.com |
93b76cfb4c57c57bbe5f25b1363013a353186764 | 2a7e413a4ad79443f55b1806f53ed96b846ab2b2 | /GeoProblemSolving-back/src/main/java/cn/edu/njnu/geoproblemsolving/Dao/metrics/MetricsDaoImpl.java | b212b221e2b9bd5d9e3f258ac172b95624f424ad | [] | no_license | SuilandCoder/GeoProblemSolving_CMIP | 62cfebea4c29ba8f0e8f87e9f5485da33756d93a | 9ed5ed60aebe6d871f44aa832a2d6907cce97739 | refs/heads/master | 2022-12-13T14:57:16.425669 | 2020-04-19T06:50:16 | 2020-04-19T06:50:16 | 211,809,738 | 0 | 0 | null | 2022-12-10T06:30:15 | 2019-09-30T08:13:58 | JavaScript | UTF-8 | Java | false | false | 1,929 | java | package cn.edu.njnu.geoproblemsolving.Dao.metrics;
import cn.edu.njnu.geoproblemsolving.Entity.Metrics;
import cn.edu.njnu.geoproblemsolving.Entity.Template;
import jdk.nashorn.internal.objects.annotations.Where;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.UUID;
/**
* @Author: SongJie
* @Description:
* @Date: Created in 20:09 2019/10/2
* @Modified By:
**/
@Service
public class MetricsDaoImpl implements IMetricsDao {
private final MongoTemplate mongoTemplate;
public MetricsDaoImpl(MongoTemplate mongoTemplate) {
this.mongoTemplate = mongoTemplate;
}
@Override
public List<Metrics> findAll() {
List<Metrics> all = mongoTemplate.findAll(Metrics.class);
return all;
}
@Override
public Metrics findMetricsByOid(String oid) {
Query q = Query.query(Criteria.where("oid").is(oid));
Metrics metric = mongoTemplate.findOne(q,Metrics.class);
return metric;
}
@Override
public Metrics createMetrics(Metrics metrics) {
String oid = UUID.randomUUID().toString();
metrics.setOid(oid);
Date date = new Date();
metrics.setUpdateTime(date);
mongoTemplate.save(metrics);
return metrics;
}
@Override
public List<Metrics> findMetricsByIdList(List<String> idList) {
return null;
}
@Override
public Metrics updateMetrics(Metrics mr) {
return null;
}
@Override
public List<Metrics> getMetrics(String key, String value) {
Query query = Query.query(Criteria.where(key).regex(value));
List<Metrics> metrics = mongoTemplate.find(query, Metrics.class);
return metrics;
}
}
| [
"jie77474966@qq.com"
] | jie77474966@qq.com |
1e4f997328761e554a644a36871e2a4e5e1b4b91 | 3a95b49239d8b6655a9c2bdbe6e8fae589b58b59 | /src/main/java/com/android/update/fir/FirUpdaterUtils.java | cfb2b2e3e185c34df25f5e08aba4f72f98f56ec2 | [] | no_license | chenyanmo/autoupdate | 9af3451848f7765a39123fb6d770e7053abeefbc | 7236b09b3f2dfeccb5d6ddbc508797460339dd2a | refs/heads/master | 2020-03-22T19:43:21.013925 | 2018-07-11T08:39:01 | 2018-07-11T08:39:01 | 140,546,241 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,478 | java | package com.android.update.fir;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.support.v4.content.FileProvider;
import android.text.TextUtils;
import android.util.Log;
import java.io.Closeable;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
public class FirUpdaterUtils {
public static String TAG = "FirUpdater";
public static boolean enableLog = true;
public static void logger(String log) {
if (enableLog && !TextUtils.isEmpty(log)) {
Log.d(TAG, log);
}
}
public static void loggerError(String log) {
if (enableLog && !TextUtils.isEmpty(log)) {
Log.e(TAG, log);
}
}
public static void loggerError(Exception e) {
if (enableLog && e != null) {
e.printStackTrace();
if (!TextUtils.isEmpty(e.getMessage())) {
Log.e(TAG, e.getMessage());
}
}
}
public static String getPackageName(Context context) {
return context.getPackageName();
}
public static String getName(Context context) {
return getName(context, getPackageName(context));
}
public static String getName(Context context, String packageName) {
try {
PackageManager pm = context.getPackageManager();
PackageInfo pi = pm.getPackageInfo(packageName, 0);
return pi == null ? null : pi.applicationInfo.loadLabel(pm).toString();
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
return null;
}
}
public static Drawable getIcon(Context context) {
return getIcon(context, getPackageName(context));
}
public static Drawable getIcon(Context context, String packageName) {
try {
PackageManager pm = context.getPackageManager();
PackageInfo pi = pm.getPackageInfo(packageName, 0);
return pi == null ? null : pi.applicationInfo.loadIcon(pm);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
return null;
}
}
public static int getVersionCode(Context context) {
return getVersionCode(context, getPackageName(context));
}
public static int getVersionCode(Context context, String packageName) {
try {
PackageManager pm = context.getPackageManager();
PackageInfo pi = pm.getPackageInfo(packageName, 0);
return pi == null ? -1 : pi.versionCode;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
return -1;
}
}
public static String getVersionName(Context context) {
return getVersionName(context, getPackageName(context));
}
public static String getVersionName(Context context, String packageName) {
try {
PackageManager pm = context.getPackageManager();
PackageInfo pi = pm.getPackageInfo(packageName, 0);
return pi == null ? null : pi.versionName;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
return null;
}
}
public static boolean isAppForeground(Context context) {
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
if (manager == null) {
return false;
}
List<ActivityManager.RunningAppProcessInfo> appProcesses = manager.getRunningAppProcesses();
if (appProcesses == null || appProcesses.size() == 0) {
return false;
}
for (ActivityManager.RunningAppProcessInfo processInfo : appProcesses) {
if (processInfo == null) {
continue;
}
if (processInfo.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND) {
return processInfo.processName.equals(getPackageName(context));
}
}
return false;
}
public static Intent getInstallApkIntent(Context context, String apkPath) {
try {
File apkFile = new File(apkPath);
if (!apkFile.exists()) {
throw new FileNotFoundException("Apk file does not exist!");
}
String comm = "chmod 777 " + apkFile.getAbsolutePath();
Runtime.getRuntime().exec(comm);
Uri apkUri;
Intent intent;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
apkUri = FileProvider.getUriForFile(context, getPackageName(context) + ".update.fileProvider", apkFile);
intent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
intent.setData(apkUri);
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
} else {
intent = new Intent(Intent.ACTION_VIEW);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
apkUri = Uri.fromFile(apkFile);
intent.setDataAndType(apkUri, "application/vnd.android.package-archive");
}
return intent;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public static void installApk(Context context, String apkPath) {
context.startActivity(getInstallApkIntent(context, apkPath));
}
public static void closeQuietly(final Closeable... closeables) {
if (closeables == null || closeables.length == 0) {
return;
}
for (Closeable closeable : closeables) {
if (closeable == null) {
continue;
}
try {
closeable.close();
} catch (IOException ignored) {
}
}
}
@SuppressLint("DefaultLocale")
public static String getMeasureSize(long byteCount) {
if (byteCount <= 0) {
return "0B";
} else if (byteCount < 1024) {
return String.format("%.2fB", (double) byteCount);
} else if (byteCount < 1048576) {
return String.format("%.2fKB", (double) byteCount / 1024);
} else if (byteCount < 1073741824) {
return String.format("%.2fMB", (double) byteCount / 1048576);
} else {
return String.format("%.2fGB", (double) byteCount / 1073741824);
}
}
private static final Handler handler = new Handler(Looper.getMainLooper());
public static void runOnMainThread(Runnable runnable) {
if (runnable != null) {
if (Looper.myLooper() != Looper.getMainLooper()) {
handler.post(runnable);
} else {
runnable.run();
}
}
}
private static SharedPreferences sharedPreferences;
private static final String SP_NAME = "fir_downloader_progress_file_name";
public static SharedPreferences getSharedPreferences(Context context) {
if (sharedPreferences == null) {
sharedPreferences = context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE);
}
return sharedPreferences;
}
public static void putCurrLengthValue(Context context, String key, int value) {
getSharedPreferences(context)
.edit()
.putInt("curr_" + key, value)
.apply();
}
public static int getCurrLengthValue(Context context, String key) {
return getSharedPreferences(context).getInt("curr_" + key, 0);
}
public static void putFileLengthValue(Context context, String key, int value) {
getSharedPreferences(context)
.edit()
.putInt("file_" + key, value)
.apply();
}
public static int getFileLengthValue(Context context, String key) {
return getSharedPreferences(context).getInt("file_" + key, 0);
}
public static boolean isAppInstalled(Context context, String appPackageName) {
PackageManager manager = context.getPackageManager();
if (manager == null) {
return false;
}
List<PackageInfo> infos = manager.getInstalledPackages(0);
if (infos != null) {
for (int i = 0; i < infos.size(); i++) {
String packageName = infos.get(i).packageName;
if (packageName.equals(appPackageName)) {
return true;
}
}
}
return false;
}
public static boolean startApp(Context context, String appPackageName) {
try {
PackageManager manager = context.getPackageManager();
if (manager == null) {
return false;
}
Intent intent = manager.getLaunchIntentForPackage(appPackageName);
if (intent != null) {
context.startActivity(intent);
return true;
}
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
}
| [
"master@chenyanmo.com"
] | master@chenyanmo.com |
6b7545d90d506a9a6554ebc5f3c7c7eca56f2953 | 1216273c97535726b005591dfe187e89f7ee6209 | /rahul/naveenAutomation/src/corejava/Ssplit.java | 6cb692d69f4991408f9ff2aae153460dee9ea9bd | [] | no_license | rahulrj810/selenium | ed6fc998efd3bc082fa64a6dd99c8262f0478bd7 | 086f44f68087622d061b68653e89ee33dd0cb602 | refs/heads/master | 2020-09-03T15:46:16.818300 | 2019-11-18T13:46:55 | 2019-11-18T13:46:55 | 219,501,923 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 199 | java | package corejava;
public class Ssplit {
public static void main(String args[]) {
String ob="a,s,d,d,f,d,s,";
String obj= ob.replaceAll(",","5") ;
System.out.print(obj);
}
}
| [
"dell@192.168.56.1"
] | dell@192.168.56.1 |
69f1ab000af33db20e22f7eea01c1e86a67e3ed3 | 1f4114d035b2302d930f512aaac0e3edf2ee0e4f | /showroom/src/bismillah/TambahPelanggan.java | 6e427b8fbdf24777064a176d1cb6a4430bd7b1d2 | [] | no_license | husnulhidayat/showroom | a207bb653824709b1c238542c90fdde26c712720 | 3db19990e988d521769fc5b051babdb0484916b6 | refs/heads/master | 2021-06-17T07:03:23.454072 | 2017-05-14T08:57:15 | 2017-05-14T08:57:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,829 | 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 bismillah;
/**
*
* @author Husnul Hidayat
*/
public class TambahPelanggan extends javax.swing.JFrame {
/**
* Creates new form TambahKendaraan
*/
public TambahPelanggan() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
private void backPelanggan(){
pelangganForm p = new pelangganForm();
p.setVisible(true);
this.dispose();
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
submitBtn = new javax.swing.JButton();
idField = new javax.swing.JTextField();
namaField = new javax.swing.JTextField();
alamatField = new javax.swing.JTextField();
menuButton = new javax.swing.JButton();
jLabel4 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel2.setText("Nama :");
jLabel3.setText("Alamat :");
submitBtn.setText("Submit");
submitBtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
submitBtnActionPerformed(evt);
}
});
menuButton.setText("Back to Menu");
menuButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
menuButtonActionPerformed(evt);
}
});
jLabel4.setText("ID :");
jButton1.setText("Back");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(109, 109, 109)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(jLabel2)
.addComponent(jLabel4))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(idField, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(namaField, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(alamatField, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(141, 141, 141))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(menuButton)
.addGap(18, 18, 18))
.addGroup(layout.createSequentialGroup()
.addGap(90, 90, 90)
.addComponent(submitBtn)
.addGap(70, 70, 70)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(75, 75, 75)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(idField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(namaField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(alamatField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel1)
.addGap(52, 52, 52)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(submitBtn)
.addComponent(jButton1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 96, Short.MAX_VALUE)
.addComponent(menuButton)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void submitBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_submitBtnActionPerformed
// TODO add your handling code here:
Pelanggan p = new Pelanggan();
p.setId(Integer.parseInt(idField.getText()));
p.setNama(namaField.getText());
p.setAlamat(alamatField.getText());
p.savePelanggan();
javax.swing.JOptionPane.showMessageDialog(null,"Submit Pelanggan Berhasil");
namaField.setText("");
alamatField.setText("");
idField.setText("");
backPelanggan();
}//GEN-LAST:event_submitBtnActionPerformed
private void menuButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuButtonActionPerformed
// TODO add your handling code here:
mainForm m = new mainForm();
m.setVisible(true);
this.dispose();
}//GEN-LAST:event_menuButtonActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
pelangganForm p = new pelangganForm();
p.setVisible(true);
this.dispose();
}//GEN-LAST:event_jButton1ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(TambahPelanggan.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(TambahPelanggan.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(TambahPelanggan.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(TambahPelanggan.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new TambahPelanggan().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTextField alamatField;
private javax.swing.JTextField idField;
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JButton menuButton;
private javax.swing.JTextField namaField;
private javax.swing.JButton submitBtn;
// End of variables declaration//GEN-END:variables
}
| [
"Husnul Hidayat"
] | Husnul Hidayat |
ed6d75ffd7ab42a40ee57fe80754b3831f99d160 | e9341fcf8b4777b74e9c3370124d576294fceeb7 | /app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/android/support/fragment/R.java | 75882acb4aa7a2bcc51a58e966d2e894d6822037 | [] | no_license | benmadinebuisness/MGDCoursework2019 | 61ef569ad7f3e2f4ee0ad385fd3d05b75b1ffa5e | 7852e36ba720e51a6473fb2966c865f0eb74066d | refs/heads/master | 2020-05-07T20:16:43.279448 | 2019-04-11T18:10:58 | 2019-04-11T18:10:58 | 180,848,559 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,397 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package android.support.fragment;
public final class R {
private R() {}
public static final class attr {
private attr() {}
public static final int alpha = 0x7f030027;
public static final int coordinatorLayoutStyle = 0x7f030070;
public static final int font = 0x7f03008b;
public static final int fontProviderAuthority = 0x7f03008d;
public static final int fontProviderCerts = 0x7f03008e;
public static final int fontProviderFetchStrategy = 0x7f03008f;
public static final int fontProviderFetchTimeout = 0x7f030090;
public static final int fontProviderPackage = 0x7f030091;
public static final int fontProviderQuery = 0x7f030092;
public static final int fontStyle = 0x7f030093;
public static final int fontVariationSettings = 0x7f030094;
public static final int fontWeight = 0x7f030095;
public static final int keylines = 0x7f0300a5;
public static final int layout_anchor = 0x7f0300a9;
public static final int layout_anchorGravity = 0x7f0300aa;
public static final int layout_behavior = 0x7f0300ab;
public static final int layout_dodgeInsetEdges = 0x7f0300d5;
public static final int layout_insetEdge = 0x7f0300de;
public static final int layout_keyline = 0x7f0300df;
public static final int statusBarBackground = 0x7f03011e;
public static final int ttcIndex = 0x7f030151;
}
public static final class color {
private color() {}
public static final int notification_action_color_filter = 0x7f050043;
public static final int notification_icon_bg_color = 0x7f050044;
public static final int ripple_material_light = 0x7f05004f;
public static final int secondary_text_default_material_light = 0x7f050051;
}
public static final class dimen {
private dimen() {}
public static final int compat_button_inset_horizontal_material = 0x7f06004e;
public static final int compat_button_inset_vertical_material = 0x7f06004f;
public static final int compat_button_padding_horizontal_material = 0x7f060050;
public static final int compat_button_padding_vertical_material = 0x7f060051;
public static final int compat_control_corner_material = 0x7f060052;
public static final int compat_notification_large_icon_max_height = 0x7f060053;
public static final int compat_notification_large_icon_max_width = 0x7f060054;
public static final int notification_action_icon_size = 0x7f060064;
public static final int notification_action_text_size = 0x7f060065;
public static final int notification_big_circle_margin = 0x7f060066;
public static final int notification_content_margin_start = 0x7f060067;
public static final int notification_large_icon_height = 0x7f060068;
public static final int notification_large_icon_width = 0x7f060069;
public static final int notification_main_column_padding_top = 0x7f06006a;
public static final int notification_media_narrow_margin = 0x7f06006b;
public static final int notification_right_icon_size = 0x7f06006c;
public static final int notification_right_side_padding_top = 0x7f06006d;
public static final int notification_small_icon_background_padding = 0x7f06006e;
public static final int notification_small_icon_size_as_large = 0x7f06006f;
public static final int notification_subtext_size = 0x7f060070;
public static final int notification_top_pad = 0x7f060071;
public static final int notification_top_pad_large_text = 0x7f060072;
}
public static final class drawable {
private drawable() {}
public static final int notification_action_background = 0x7f070059;
public static final int notification_bg = 0x7f07005a;
public static final int notification_bg_low = 0x7f07005b;
public static final int notification_bg_low_normal = 0x7f07005c;
public static final int notification_bg_low_pressed = 0x7f07005d;
public static final int notification_bg_normal = 0x7f07005e;
public static final int notification_bg_normal_pressed = 0x7f07005f;
public static final int notification_icon_background = 0x7f070060;
public static final int notification_template_icon_bg = 0x7f070061;
public static final int notification_template_icon_low_bg = 0x7f070062;
public static final int notification_tile_bg = 0x7f070063;
public static final int notify_panel_notification_icon_bg = 0x7f070064;
}
public static final class id {
private id() {}
public static final int action_container = 0x7f08000f;
public static final int action_divider = 0x7f080011;
public static final int action_image = 0x7f080012;
public static final int action_text = 0x7f080018;
public static final int actions = 0x7f080019;
public static final int async = 0x7f08001f;
public static final int blocking = 0x7f080022;
public static final int bottom = 0x7f080023;
public static final int chronometer = 0x7f08002d;
public static final int end = 0x7f08003e;
public static final int forever = 0x7f080045;
public static final int icon = 0x7f08004b;
public static final int icon_group = 0x7f08004c;
public static final int info = 0x7f08004f;
public static final int italic = 0x7f080051;
public static final int left = 0x7f080053;
public static final int line1 = 0x7f080054;
public static final int line3 = 0x7f080055;
public static final int none = 0x7f08005f;
public static final int normal = 0x7f080060;
public static final int notification_background = 0x7f080061;
public static final int notification_main_column = 0x7f080062;
public static final int notification_main_column_container = 0x7f080063;
public static final int right = 0x7f08006d;
public static final int right_icon = 0x7f08006e;
public static final int right_side = 0x7f08006f;
public static final int start = 0x7f08008d;
public static final int tag_transition_group = 0x7f080092;
public static final int tag_unhandled_key_event_manager = 0x7f080093;
public static final int tag_unhandled_key_listeners = 0x7f080094;
public static final int text = 0x7f080095;
public static final int text2 = 0x7f080096;
public static final int time = 0x7f080099;
public static final int title = 0x7f08009b;
public static final int top = 0x7f08009e;
}
public static final class integer {
private integer() {}
public static final int status_bar_notification_info_maxnum = 0x7f090004;
}
public static final class layout {
private layout() {}
public static final int notification_action = 0x7f0a0020;
public static final int notification_action_tombstone = 0x7f0a0021;
public static final int notification_template_custom_big = 0x7f0a0028;
public static final int notification_template_icon_group = 0x7f0a0029;
public static final int notification_template_part_chronometer = 0x7f0a002d;
public static final int notification_template_part_time = 0x7f0a002e;
}
public static final class string {
private string() {}
public static final int status_bar_notification_info_overflow = 0x7f0c0029;
}
public static final class style {
private style() {}
public static final int TextAppearance_Compat_Notification = 0x7f0d00f0;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0d00f1;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0d00f3;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0d00f6;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0d00f8;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0d0162;
public static final int Widget_Compat_NotificationActionText = 0x7f0d0163;
public static final int Widget_Support_CoordinatorLayout = 0x7f0d0164;
}
public static final class styleable {
private styleable() {}
public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f030027 };
public static final int ColorStateListItem_android_color = 0;
public static final int ColorStateListItem_android_alpha = 1;
public static final int ColorStateListItem_alpha = 2;
public static final int[] CoordinatorLayout = { 0x7f0300a5, 0x7f03011e };
public static final int CoordinatorLayout_keylines = 0;
public static final int CoordinatorLayout_statusBarBackground = 1;
public static final int[] CoordinatorLayout_Layout = { 0x10100b3, 0x7f0300a9, 0x7f0300aa, 0x7f0300ab, 0x7f0300d5, 0x7f0300de, 0x7f0300df };
public static final int CoordinatorLayout_Layout_android_layout_gravity = 0;
public static final int CoordinatorLayout_Layout_layout_anchor = 1;
public static final int CoordinatorLayout_Layout_layout_anchorGravity = 2;
public static final int CoordinatorLayout_Layout_layout_behavior = 3;
public static final int CoordinatorLayout_Layout_layout_dodgeInsetEdges = 4;
public static final int CoordinatorLayout_Layout_layout_insetEdge = 5;
public static final int CoordinatorLayout_Layout_layout_keyline = 6;
public static final int[] FontFamily = { 0x7f03008d, 0x7f03008e, 0x7f03008f, 0x7f030090, 0x7f030091, 0x7f030092 };
public static final int FontFamily_fontProviderAuthority = 0;
public static final int FontFamily_fontProviderCerts = 1;
public static final int FontFamily_fontProviderFetchStrategy = 2;
public static final int FontFamily_fontProviderFetchTimeout = 3;
public static final int FontFamily_fontProviderPackage = 4;
public static final int FontFamily_fontProviderQuery = 5;
public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f03008b, 0x7f030093, 0x7f030094, 0x7f030095, 0x7f030151 };
public static final int FontFamilyFont_android_font = 0;
public static final int FontFamilyFont_android_fontWeight = 1;
public static final int FontFamilyFont_android_fontStyle = 2;
public static final int FontFamilyFont_android_ttcIndex = 3;
public static final int FontFamilyFont_android_fontVariationSettings = 4;
public static final int FontFamilyFont_font = 5;
public static final int FontFamilyFont_fontStyle = 6;
public static final int FontFamilyFont_fontVariationSettings = 7;
public static final int FontFamilyFont_fontWeight = 8;
public static final int FontFamilyFont_ttcIndex = 9;
public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 };
public static final int GradientColor_android_startColor = 0;
public static final int GradientColor_android_endColor = 1;
public static final int GradientColor_android_type = 2;
public static final int GradientColor_android_centerX = 3;
public static final int GradientColor_android_centerY = 4;
public static final int GradientColor_android_gradientRadius = 5;
public static final int GradientColor_android_tileMode = 6;
public static final int GradientColor_android_centerColor = 7;
public static final int GradientColor_android_startX = 8;
public static final int GradientColor_android_startY = 9;
public static final int GradientColor_android_endX = 10;
public static final int GradientColor_android_endY = 11;
public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 };
public static final int GradientColorItem_android_color = 0;
public static final int GradientColorItem_android_offset = 1;
}
}
| [
"benmadine@gmail.com"
] | benmadine@gmail.com |
38aa718cdb21b9ae9d466840ce5c0df6d8654f1e | aff9e8d1358e69f8775c411fb500eab4a200da25 | /WeForYouFoundation/app/src/main/java/com/grepthor/weforyoufoundation/MainActivity.java | 0bfbe563076cc34ced492a0c7a2ad746ec67116b | [] | no_license | anjalidesireddy/Android-project | af054a3bea0f0ff0e53afd7e65317a531bd390c0 | ee815c9b91631e506c4cb3deef9aefb97eda3c18 | refs/heads/master | 2021-05-14T19:04:18.498416 | 2018-01-03T06:43:38 | 2018-01-03T06:43:38 | 116,099,556 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,735 | java | package com.grepthor.weforyoufoundation;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.view.View;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
import android.widget.Toast;
import com.mikepenz.actionitembadge.library.ActionItemBadge;
public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
TextView text;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
}
@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_cart, menu);
ActionItemBadge.update(this, menu.findItem(R.id.action_cart_1), getResources().getDrawable(R.drawable.ic_notification), ActionItemBadge.BadgeStyles.YELLOW_LARGE, "1");
//this.menu = menu;
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
onBackPressed();
return true;
case R.id.action_cart_1:
Intent i = new Intent(MainActivity.this, NotificationActivity.class);
startActivityForResult(i, 1);
MainActivity.this.overridePendingTransition(R.anim.slide_in_right, R.anim.fade_out);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
if (id == R.id.nav_home) {
// Handle the camera action
}else if (id == R.id.nav_contact) {
startActivity(new Intent(MainActivity.this,ContactUsActivity.class));
} else if (id == R.id.nav_about) {
startActivity(new Intent(MainActivity.this,AboutUsActivity.class));
} else if (id == R.id.nav_mission) {
startActivity(new Intent(MainActivity.this,ActivityMission.class));
} else if (id == R.id.nav_gallary) {
} else if (id == R.id.nav_event) {
} else if (id == R.id.nav_founder) {
startActivity(new Intent(MainActivity.this,ActivityFounder.class));
} else if (id == R.id.nav_donate) {
} else if (id == R.id.nav_valuanteer) {
} else if (id == R.id.nav_notification) {
startActivity(new Intent(MainActivity.this,NotificationActivity.class));
}
else if (id == R.id.nav_logout) {
startActivity(new Intent(MainActivity.this,LoginActivity.class));
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
}
| [
"anjalidesireddy@gmail.com"
] | anjalidesireddy@gmail.com |
d775407733af7d73ae1c589aead849a5737cef38 | 750d06d12ce6e408301fdf9bdbb08ddef0b6f1f1 | /Databases_Advanced/JSON-Processing/src/main/java/demos/springdata/restdemo/service/PostService.java | cca4e43382a8fac35b84f6b2924c321b70e47e21 | [] | no_license | Deianov/Java-DB | e16245af70527a33efa9789d03276b449bbee70c | e7023500f76e84f220f621a598e460177ce327d3 | refs/heads/master | 2022-07-31T02:31:18.508054 | 2022-06-23T11:06:28 | 2022-06-23T11:06:28 | 239,293,956 | 1 | 3 | null | 2022-06-23T11:06:29 | 2020-02-09T11:35:24 | Java | UTF-8 | Java | false | false | 303 | java | package demos.springdata.restdemo.service;
import demos.springdata.restdemo.model.Post;
import java.util.Collection;
public interface PostService {
Collection<Post> getPosts();
Post addPost(Post post);
Post updatePost(Post post);
Post deletePost(Long id);
long getPostsCount();
}
| [
"44973718+Deianov@users.noreply.github.com"
] | 44973718+Deianov@users.noreply.github.com |
5f6257a3a266e0445bcde5ed22494f337c743772 | eaa0d0aa55d65e0d23d11dd9d2a39719eb2a8053 | /Java_basic/a_Zadania/c_Dzien_3/a_Pakiety_Importy/Main3.java | 65e617052e2e7b2284419bdec6a1d5e43da0e856 | [] | no_license | KosmiderPrzemyslaw/Java_basic_issue | aa6a3b5226432458c74b0e36a03a70c679c49a07 | 74f5a66fa1e9f2130bb94e8ca678ad62da0fc385 | refs/heads/master | 2022-04-12T17:16:43.990202 | 2020-04-01T19:23:08 | 2020-04-01T19:23:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 187 | java | package a_Zadania.c_Dzien_3.a_Pakiety_Importy;
import static java.lang.System.out;
public class Main3 {
public static void main(String[] args) {
out.println("text");
}
} | [
"kosmiderprzemyslaw91@gmail.com"
] | kosmiderprzemyslaw91@gmail.com |
fa4e8fd305d32988ed2583f3e4eca4be3496c92b | b029df50460fe7068f907bc327316b01623dee8a | /android/app/src/main/java/com/app/firebase_chat/MainActivity.java | 781dba296e36736e2c56d9978d6d4d4727905a4a | [] | no_license | KishanBusa8/ChatApp-Flutter_FireBase | 2b057c08c973f93da34712dbd2979a01ee402eea | 425541b001dfa7cb00a101ea99b365ddfcff3cf0 | refs/heads/main | 2023-01-23T00:10:22.296590 | 2020-11-27T06:13:23 | 2020-11-27T06:13:23 | 316,406,713 | 0 | 1 | null | 2020-11-27T06:13:24 | 2020-11-27T05:17:41 | Dart | UTF-8 | Java | false | false | 140 | java | package com.app.firebase_chat;
import io.flutter.embedding.android.FlutterActivity;
public class MainActivity extends FlutterActivity {
}
| [
"dev020.weboccult@gmail.com"
] | dev020.weboccult@gmail.com |
5d277932a1b9f537feac47d678ea2a1dffbcf71f | 0248cfb7c1ec8cc549c224ebc79811a7e90652c3 | /wf/src/main/java/org/jboss/forge/addon/as/jboss/wf/WildFlyProvider.java | 1da4a40d202e96880dd8c1c86fecf31e9938bf6b | [] | no_license | jerr/jboss-as-addon | 068b529c3391e8a3be9a5c05b2864798ba3e3fea | 680ae4ffa135e4359c41b613da1df36732b6ad57 | refs/heads/master | 2021-01-10T09:06:11.271904 | 2015-11-04T02:42:48 | 2015-11-04T03:04:52 | 45,348,647 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 7,347 | java | /*
* Copyright 2014 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Eclipse Public License version 1.0, available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.jboss.forge.addon.as.jboss.wf;
import java.io.File;
import java.net.InetAddress;
import java.net.UnknownHostException;
import javax.inject.Inject;
import org.jboss.as.controller.client.ModelControllerClient;
import org.jboss.forge.addon.as.jboss.common.JBossProvider;
import org.jboss.forge.addon.as.jboss.common.deployment.Deployment;
import org.jboss.forge.addon.as.jboss.common.deployment.Deployment.Type;
import org.jboss.forge.addon.as.jboss.common.deployment.DeploymentFailureException;
import org.jboss.forge.addon.as.jboss.common.server.ConnectionInfo;
import org.jboss.forge.addon.as.jboss.common.server.Server;
import org.jboss.forge.addon.as.jboss.common.ui.JBossConfigurationWizard;
import org.jboss.forge.addon.as.jboss.common.util.Messages;
import org.jboss.forge.addon.as.jboss.wf.server.StandaloneDeployment;
import org.jboss.forge.addon.as.jboss.wf.ui.WildFlyConfigurationWizard;
import org.jboss.forge.addon.projects.Project;
import org.jboss.forge.addon.projects.facets.PackagingFacet;
import org.jboss.forge.addon.ui.context.UIContext;
import org.jboss.forge.addon.ui.result.Failed;
import org.jboss.forge.addon.ui.result.Result;
import org.jboss.forge.addon.ui.result.Results;
/**
* The application server provider for WildFly 8
*
* @author Jeremie Lagarde
*/
public class WildFlyProvider extends JBossProvider<WildFlyConfiguration> implements ConnectionInfo
{
@Inject
private WildFlyServerController serverController;
@Inject
private WildFlyConfiguration configuration;
private final Messages messages = Messages.INSTANCE;
@Override
public String getName()
{
return "wildfly";
}
@Override
public String getDescription()
{
return "WildFly";
}
@Override
protected Class<? extends JBossConfigurationWizard> getConfigurationWizardClass()
{
return WildFlyConfigurationWizard.class;
}
@Override
protected WildFlyConfiguration getConfig()
{
return configuration;
}
@Override
public Result start(UIContext context)
{
Result result = null;
if ((serverController.hasServer() && serverController.getServer().isRunning()) || false)// getState().isRunningState())
{
result = Results.fail(messages.getMessage("server.already.running"));
}
else
{
try
{
if (!serverController.hasServer())
createServer(context);
Server<ModelControllerClient> server = serverController.getServer();
// Start the server
server.start();
server.checkServerState();
if (server.isRunning())
{
result = Results.success(messages.getMessage("server.start.success", configuration.getVersion()));
}
else
{
result = Results.fail(messages.getMessage("server.start.failed", configuration.getVersion()));
}
}
catch (Exception e)
{
result = Results.fail(messages.getMessage("server.start.failed.exception", configuration.getVersion(),
e.getLocalizedMessage()));
}
if (result instanceof Failed)
{
// closeConsoleOutput();
}
}
return result;
}
private Server<ModelControllerClient> createServer(UIContext context)
{
final File jbossHome = new File(configuration.getPath());
final String modulesPath = null;
final Server<ModelControllerClient> server = serverController.createServer(this, jbossHome,
configuration.getJavaHome(), configuration.getJvmArgs(),
modulesPath, configuration.getServerConfigFile(), configuration.getServerPropertiesFile(),
(long) configuration.getTimeout(), context
.getProvider().getOutput().out());
// Close any previously connected clients
serverController.closeClient();
serverController.setServer(server);
return server;
}
@Override
public Result shutdown(UIContext context)
{
try
{
if (!serverController.hasServer())
{
createServer(context);
}
return serverController.shutdownServer();
}
catch (Exception e)
{
return Results.fail(e.getLocalizedMessage());
}
finally
{
serverController.closeClient();
}
}
@Override
public int getPort()
{
return configuration.getPort();
}
@Override
public InetAddress getHostAddress()
{
try
{
return InetAddress.getByName(configuration.getHostname());
}
catch (UnknownHostException e)
{
throw new IllegalArgumentException(String.format("Host name '%s' is invalid.", configuration.getHostname()), e);
}
}
@Override
public Result deploy(UIContext context)
{
return processDeployment(getFaceted(), (String) context.getAttributeMap().get("path"), Type.DEPLOY);
}
@Override
public Result undeploy(UIContext context)
{
return processDeployment(getFaceted(), (String) context.getAttributeMap().get("path"),
Type.UNDEPLOY);
}
protected Result processDeployment(Project project, String path, Type type)
{
Result result;
// The server must be running
if (serverController.hasServer() && serverController.getServer().isRunning())
{
final PackagingFacet packagingFacet = project.getFacet(PackagingFacet.class);
// Can't deploy what doesn't exist
if (!packagingFacet.getFinalArtifact().exists())
throw new DeploymentFailureException(messages.getMessage("deployment.not.found", path, type));
final File content;
if (path == null)
{
content = new File(packagingFacet.getFinalArtifact().getFullyQualifiedName());
}
else if (path.startsWith("/"))
{
content = new File(path);
}
else
{
// TODO this might not work for EAR deployments
content = new File(packagingFacet.getFinalArtifact().getParent().getFullyQualifiedName(), path);
}
try
{
final ModelControllerClient client = serverController.getClient();
final Deployment deployment = StandaloneDeployment.create(client, content, null, type, null, null);
deployment.execute();
result = Results.success(messages.getMessage("deployment.successful", type));
}
catch (Exception e)
{
if (e.getCause() != null)
{
result = Results.fail(e.getLocalizedMessage() + ": " + e.getCause()
.getLocalizedMessage());
}
else
{
result = Results.fail(e.getLocalizedMessage());
}
}
}
else
{
result = Results.fail(messages.getMessage("server.not.running", configuration.getHostname(),
configuration.getPort()));
}
return result;
}
} | [
"jer@printstacktrace.org"
] | jer@printstacktrace.org |
837324d16ef355136dfe7fc340bf08cb8b3ea6f5 | 1b320a9c693d27b899da0831a05acc6100b44d0e | /src/main/java/io/seanforfun/seckill/config/resolver/UserResolver.java | d259c09f02e71407b409a9f68708d19abd917a07 | [] | no_license | Seanforfun/Second-Kill | 9d5a7e12448013c955c038a5f1fdc83530b60f60 | dc47a27327235e5c76064348c3c0d37ae7243d9c | refs/heads/master | 2020-04-18T08:56:36.747570 | 2019-03-01T23:11:44 | 2019-03-01T23:11:44 | 167,415,716 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,284 | java | package io.seanforfun.seckill.config.resolver;
import io.seanforfun.seckill.entity.domain.User;
import io.seanforfun.seckill.service.UserService;
import io.seanforfun.seckill.service.ebi.UserEbi;
import io.seanforfun.seckill.utils.CookieUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.MethodParameter;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.support.WebDataBinderFactory;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.method.support.ModelAndViewContainer;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* @author: Seanforfun
* @date: Created in 2019/1/31 10:12
* @description: ${description}
* @modified:
* @version: 0.0.1
*/
@Service
public class UserResolver implements HandlerMethodArgumentResolver {
@Autowired
private UserEbi userService;
@Override
public boolean supportsParameter(MethodParameter methodParameter) {
return methodParameter.getParameterType().equals(User.class);
}
@Override
public Object resolveArgument(MethodParameter methodParameter, ModelAndViewContainer modelAndViewContainer, NativeWebRequest nativeWebRequest, WebDataBinderFactory webDataBinderFactory) throws Exception {
HttpServletRequest request = nativeWebRequest.getNativeRequest(HttpServletRequest.class);
HttpServletResponse response = nativeWebRequest.getNativeResponse(HttpServletResponse.class);
String requestToken = request.getParameter(User.USER_TOKEN);
Cookie[] cookies = request.getCookies();
String cookieToken = CookieUtils.getValueFromCookie(cookies, User.USER_TOKEN);
if(StringUtils.isEmpty(requestToken) && StringUtils.isEmpty(cookieToken)){
return null;
}
String token = StringUtils.isEmpty(requestToken) ? cookieToken : requestToken;
User userByToken = userService.getUserByToken(response, token);
modelAndViewContainer.addAttribute("user", userByToken);
return userByToken;
}
}
| [
"32276204+Seanforfun@users.noreply.github.com"
] | 32276204+Seanforfun@users.noreply.github.com |
93fd18e715dbcf818ffc4d9e1bd9285d0284ab96 | d188dc63da0d842f77a358bb4fa7cebd21569ab5 | /rigai-rigeye-server/rigeye-server-common/src/main/java/com/rigai/rigeye/common/dao/mysql/DataSetRuleDao.java | a4dd64e9b04db69fa8ed08edbd411d9eb56126a6 | [] | no_license | lcc214321/RigEye | 5b96ee4b97292e0be8b09da47bc71c72d0ed12c8 | 3164f18c65c631f37f5867d96ab2fa0283041153 | refs/heads/main | 2023-03-16T08:32:42.813292 | 2021-03-10T10:44:19 | 2021-03-10T10:44:19 | 411,621,461 | 0 | 1 | null | 2021-09-29T10:03:42 | 2021-09-29T10:03:41 | null | UTF-8 | Java | false | false | 465 | java | package com.rigai.rigeye.common.dao.mysql;
import com.rigai.rigeye.common.model.DataSetRule;
import com.em.fx.core.dao.BaseDao;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author Admin
* @date 2018/08/01
*/
@Mapper
public interface DataSetRuleDao extends BaseDao<DataSetRule> {
int save(DataSetRule dataSetRule);
int updateDataSet(DataSetRule dataSetRule);
List<DataSetRule> selectByPage(DataSetRule dataSetRule);
}
| [
"79572397+zgjdzwhy@users.noreply.github.com"
] | 79572397+zgjdzwhy@users.noreply.github.com |
c2912ff4297edb91e0e29ab3d840b77d0b623d3d | 10913fa470997aa5b549abe828e2cf377a0a503b | /app/src/main/java/com/github/hailouwang/demosforapi/router/page/testservice/SingleService.java | 529f475856464028c7eb6f129fc5e74871ec0c33 | [
"Apache-2.0"
] | permissive | linliff/AndroidGo | 65baaa116aa614917a01dc599ebd7350b13803e9 | 44468571181dc11559a82f2904c8a1c5b9ef1b22 | refs/heads/master | 2022-10-07T06:29:37.261957 | 2020-05-29T05:45:05 | 2020-06-04T06:42:42 | 269,279,085 | 0 | 0 | NOASSERTION | 2020-06-04T06:32:22 | 2020-06-04T06:32:21 | null | UTF-8 | Java | false | false | 748 | java | package com.github.hailouwang.demosforapi.router.page.testservice;
import android.content.Context;
import android.widget.Toast;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.facade.template.IProvider;
/**
* 测试单类注入
*
* @author zhilong <a href="mailto:zhilong.lzl@alibaba-inc.com">Contact me.</a>
* @version 1.0
* @since 2017/4/24 下午9:04
*/
@Route(path = "/yourservicegroupname/single")
public class SingleService implements IProvider {
Context mContext;
public void sayHello(String name) {
Toast.makeText(mContext, "Hello " + name, Toast.LENGTH_SHORT).show();
}
@Override
public void init(Context context) {
mContext = context;
}
}
| [
"xinghe@ibantang.com"
] | xinghe@ibantang.com |
336ed739db963cfa3e764d7d3fa55004898225c4 | f25920b69bc52cd5f08b300c4cb0ebcf41e6f15c | /src/main/java/org/brylex/logging/Log4JLoggingSystem.java | b5d784fcb6abeabd28c663b031009033bf4fde24 | [] | no_license | runepeter/executable-gshell-war | 66408b018741b00a50ec70dce715ead5ef4e8934 | f36af2360d4fb715e606701571f0e5568d9fcfe5 | refs/heads/master | 2020-04-28T09:44:04.996073 | 2012-08-28T16:23:44 | 2012-08-28T16:23:44 | 1,781,989 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,343 | java | package org.brylex.logging;
import org.apache.log4j.LogManager;
import org.slf4j.LoggerFactory;
import org.sonatype.gshell.logging.Component;
import org.sonatype.gshell.logging.Level;
import org.sonatype.gshell.logging.Logger;
import org.sonatype.gshell.logging.LoggingSystem;
import javax.inject.Singleton;
import java.util.*;
@Singleton
public class Log4JLoggingSystem implements LoggingSystem
{
private final Map<String, Level> levelMap;
public Log4JLoggingSystem()
{
Object factoryRef = LoggerFactory.getILoggerFactory();
if (!"org.slf4j.impl.Log4jLoggerFactory".equals(factoryRef.getClass().getName()))
{
throw new IllegalStateException("SLF4J is NOT configured to use log4j (but [" + factoryRef.getClass().getName() + "])");
}
org.apache.log4j.Level[] source = {
org.apache.log4j.Level.ALL,
org.apache.log4j.Level.TRACE,
org.apache.log4j.Level.DEBUG,
org.apache.log4j.Level.INFO,
org.apache.log4j.Level.WARN,
org.apache.log4j.Level.ERROR,
org.apache.log4j.Level.FATAL,
org.apache.log4j.Level.OFF
};
Map<String, Level> map = new HashMap<String, Level>(source.length);
for (org.apache.log4j.Level level : source)
{
map.put(level.toString().toUpperCase(), new LevelImpl(level));
}
this.levelMap = Collections.unmodifiableMap(map);
}
public Level getLevel(final String name)
{
assert name != null;
Level level = levelMap.get(name.toUpperCase());
if (level == null)
{
throw new RuntimeException("Invalid level name: " + name);
}
return level;
}
public Collection<? extends Level> getLevels()
{
return levelMap.values();
}
public Logger getLogger(String loggerName)
{
return new LoggerImpl(org.apache.log4j.Logger.getLogger(loggerName));
}
public Collection<String> getLoggerNames()
{
List<String> list = new ArrayList<String>();
Enumeration enumeration = LogManager.getCurrentLoggers();
while (enumeration.hasMoreElements())
{
org.apache.log4j.Logger logger = (org.apache.log4j.Logger) enumeration.nextElement();
list.add(logger.getName());
}
return Collections.unmodifiableCollection(list);
}
public Collection<? extends Component> getComponents()
{
return Collections.emptySet();
}
private class LevelImpl implements Level
{
private final org.apache.log4j.Level level;
public LevelImpl(final org.apache.log4j.Level level)
{
this.level = level;
}
public String getName()
{
return level.toString();
}
@Override
public int hashCode()
{
return getName().hashCode();
}
@Override
public String toString()
{
return getName();
}
private org.apache.log4j.Level getLog4jLevel()
{
return level;
}
}
private class LoggerImpl implements Logger
{
private final org.apache.log4j.Logger targetLogger;
public LoggerImpl(org.apache.log4j.Logger targetLogger)
{
this.targetLogger = targetLogger;
}
public String getName()
{
return targetLogger.getName();
}
public Level getLevel()
{
org.apache.log4j.Level log4jLevel = targetLogger.getLevel();
return levelMap.get(log4jLevel.toString().toUpperCase());
}
public void setLevel(Level level)
{
targetLogger.setLevel(((LevelImpl) level).getLog4jLevel());
}
public void setLevel(String levelName)
{
setLevel(levelMap.get(levelName));
}
public boolean isRoot()
{
return org.apache.log4j.Logger.getRootLogger().equals(targetLogger);
}
@Override
public int hashCode()
{
return getName().hashCode();
}
@Override
public String toString()
{
return getName();
}
}
}
| [
"runepeter@gmail.com"
] | runepeter@gmail.com |
09c9f23473fe86d38146187f6689270322bba85b | d02a292c9a1e2f74f9d73b7160f8a92c46d949f8 | /src/main/java/org/cascomio/springbatchexample/SchedulerConfiguration.java | 28b6139724eb7f0173965496f3c48afa12baba30 | [] | no_license | victorarbuesmallada/spring-batch-example | 39912b62c6cf8f1f0d376d83a4d059997ff794bd | f6a7c067f3a413b7a1b0daff91f31b9bd116f2ba | refs/heads/master | 2023-05-02T16:06:52.359420 | 2017-04-26T16:02:18 | 2017-04-26T16:02:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,841 | java | package org.cascomio.springbatchexample;
import org.cascomio.springbatchexample.jobs.PropertiesBatchJob;
import org.quartz.JobDataMap;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.quartz.CronTriggerFactoryBean;
import org.springframework.scheduling.quartz.JobDetailFactoryBean;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
@Configuration
@EnableBatchProcessing
public class SchedulerConfiguration {
@Autowired
private JobLauncher jobLauncher;
@Autowired
private Job importProperties;
@Bean
public JobDetailFactoryBean jobDetailFactory() {
JobDataMap jobDataMap = new JobDataMap();
jobDataMap.put("jobLauncher", jobLauncher);
jobDataMap.put("importPropertiesJob", importProperties);
JobDetailFactoryBean jobFactory = new JobDetailFactoryBean();
jobFactory.setJobClass(PropertiesBatchJob.class);
jobFactory.setJobDataMap(jobDataMap);
return jobFactory;
}
@Bean
public CronTriggerFactoryBean batchJobFactory() {
CronTriggerFactoryBean jobFactory = new CronTriggerFactoryBean();
jobFactory.setCronExpression("0/30 * * * * ?");
jobFactory.setJobDetail(jobDetailFactory().getObject());
return jobFactory;
}
@Bean
public SchedulerFactoryBean schedulerFactory() {
SchedulerFactoryBean scheduler = new SchedulerFactoryBean();
scheduler.setTriggers(batchJobFactory().getObject());
return scheduler;
}
}
| [
"painyjames@gmail.com"
] | painyjames@gmail.com |
3fea7d2d571aca4eb1d95888b1391b7873dfbe88 | e6d8ca0907ff165feb22064ca9e1fc81adb09b95 | /src/main/java/com/vmware/vim25/HostFirewallDefaultPolicy.java | 6a61329c60fcc7b94d9d76ac5c6a3af32301da4c | [
"BSD-3-Clause",
"Apache-2.0"
] | permissive | incloudmanager/incloud-vijava | 5821ada4226cb472c4e539643793bddeeb408726 | f82ea6b5db9f87b118743d18c84256949755093c | refs/heads/inspur | 2020-04-23T14:33:53.313358 | 2019-07-02T05:59:34 | 2019-07-02T05:59:34 | 171,236,085 | 0 | 1 | BSD-3-Clause | 2019-02-20T02:08:59 | 2019-02-18T07:32:26 | Java | UTF-8 | Java | false | false | 2,277 | java | /*================================================================================
Copyright (c) 2013 Steve Jin. All Rights Reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the names of copyright holders nor the names of its contributors may be used
to endorse or promote products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
================================================================================*/
package com.vmware.vim25;
/**
* @author Steve Jin (http://www.doublecloud.org)
* @version 5.1
*/
@SuppressWarnings("all")
public class HostFirewallDefaultPolicy extends DynamicData {
public Boolean incomingBlocked;
public Boolean outgoingBlocked;
public Boolean getIncomingBlocked() {
return this.incomingBlocked;
}
public Boolean getOutgoingBlocked() {
return this.outgoingBlocked;
}
public void setIncomingBlocked(Boolean incomingBlocked) {
this.incomingBlocked=incomingBlocked;
}
public void setOutgoingBlocked(Boolean outgoingBlocked) {
this.outgoingBlocked=outgoingBlocked;
}
} | [
"sjin2008@3374d856-466b-4dc9-8cc5-e1e8506a9ea1"
] | sjin2008@3374d856-466b-4dc9-8cc5-e1e8506a9ea1 |
bf8e6e352fc229d3780d4a75f8ce7d193e6886b0 | 6eb9945622c34e32a9bb4e5cd09f32e6b826f9d3 | /src/org/apache/http/HttpServerConnection.java | 4fc93004d714004b11bd704778433125735e6444 | [] | no_license | alexivaner/GadgetX-Android-App | 6d700ba379d0159de4dddec4d8f7f9ce2318c5cc | 26c5866be12da7b89447814c05708636483bf366 | refs/heads/master | 2022-06-01T09:04:32.347786 | 2020-04-30T17:43:17 | 2020-04-30T17:43:17 | 260,275,241 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,000 | java | // Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
package org.apache.http;
import java.io.IOException;
// Referenced classes of package org.apache.http:
// HttpConnection, HttpException, HttpEntityEnclosingRequest, HttpRequest,
// HttpResponse
public interface HttpServerConnection
extends HttpConnection
{
public abstract void flush()
throws IOException;
public abstract void receiveRequestEntity(HttpEntityEnclosingRequest httpentityenclosingrequest)
throws HttpException, IOException;
public abstract HttpRequest receiveRequestHeader()
throws HttpException, IOException;
public abstract void sendResponseEntity(HttpResponse httpresponse)
throws HttpException, IOException;
public abstract void sendResponseHeader(HttpResponse httpresponse)
throws HttpException, IOException;
}
| [
"hutomoivan@gmail.com"
] | hutomoivan@gmail.com |
e60041c9fb638a51447fcaf32485045e04924e27 | 51c97429503b574ec0a36d2578bd82da7c118e08 | /app/src/main/java/com/example/anzhuo/weibo/DBHeiper.java | c94c80cc6c36f7faa8984292c00af26a5cdd74dc | [] | no_license | kobeky/Weibo | 13f3c48701654f019a7a0d32ff18604dca6be494 | fe3a9fdc8ff4b76cad68c40475fd34eacb5762b1 | refs/heads/master | 2020-09-15T20:30:09.755478 | 2016-09-06T01:52:55 | 2016-09-06T01:52:55 | 67,463,937 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,020 | java | package com.example.anzhuo.weibo;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.DatabaseErrorHandler;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
/**
* Created by anzhuo on 2016/8/31.
*/
public class DBHeiper extends SQLiteOpenHelper {
static final String DB_NAME="coll.db";
private static final String TBL_NAME="CollTbl";
private static final int VERSION=1;
private static final String CREATE_TBL=" create table "
+" CollTbl(_id integer primary key autoincrement,name text,words text)";
private SQLiteDatabase db;
public DBHeiper(Context context) {
super(context, DB_NAME, null, VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
this.db=db;
db.execSQL(CREATE_TBL);
}
public void insert(ContentValues values)
{
//获得SQLiteDatabase实例
SQLiteDatabase db=getWritableDatabase();
//插入
db.insert(TBL_NAME, null, values);
//关闭
db.close();
}
/*
* 查询方法
*/
public Cursor query(String dbName, Object o, Object o1, Object o2, Object o3, Object o4, Object o5)
{
//获得SQLiteDatabase实例
SQLiteDatabase db=getWritableDatabase();
//查询获得Cursor
Cursor c=db.query(TBL_NAME, null, null, null, null, null, null);
return c;
}
/*
* 删除方法
*/
public void del(int id)
{
if(db==null)
{
//获得SQLiteDatabase实例
db=getWritableDatabase();
}
//执行删除
db.delete(TBL_NAME, "_id=?", new String[]{String.valueOf(id)});
}
/*
* 关闭数据库
*/
public void colse()
{
if(db!=null)
{
db.close();
}
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
}
| [
"362390701@qq.com"
] | 362390701@qq.com |
ea6896e85ad9a2f0425bd809ecbe2a3782af3b04 | 2cc9ebba504a612447db62b4ee752a96aca7f666 | /src/test/test1.java | 6f857eace2f9e906d1933e7109e866fdf094181e | [] | no_license | wqs12399/wqs | fab5d422be3318d7753bd053e8c2a4b28fb1ece4 | ac84432e8dd99f6e8579c293ebd4dd567bb0ccf5 | refs/heads/master | 2022-09-27T04:55:04.745617 | 2020-06-03T08:11:55 | 2020-06-03T08:11:55 | 269,011,649 | 0 | 0 | null | 2020-06-03T08:30:11 | 2020-06-03T06:49:29 | Java | UTF-8 | Java | false | false | 171 | java | package test;
public class test1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("hello world");
}
}
| [
"1023323910@qq.com"
] | 1023323910@qq.com |
d0941a9ffe4200b6440c18db1c2c8549dac213ea | 6c1097cb3b68f8dd800350a2535c76bc8c5f8187 | /todo/src/test/java/org/study/StreamTest.java | fff0d8d8fb17ae33eef3ef5d0d0af7b0b0471596 | [] | no_license | db117/study | 0955198ea5ba50ba93b42f8418c4e72a7cdb43d3 | 5da4648e9417846322093231975dca1dbf6831c7 | refs/heads/master | 2021-07-24T01:33:35.519465 | 2018-10-12T03:15:14 | 2018-10-12T03:15:14 | 152,688,110 | 1 | 0 | null | 2020-04-27T03:43:41 | 2018-10-12T03:18:16 | Java | UTF-8 | Java | false | false | 1,692 | java | package org.study;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* Stream表达式
*
* @author 大兵
* @date 2018-07-12 23:32
**/
public class StreamTest {
private List<A> list;
@Test
public void mapTest() {
init();
//提出字段
List<Integer> idList = list.stream().map(A::getId).collect(Collectors.toList());
System.out.println(idList);
//提取不重复字段
List<Integer> ageList = list.stream().map(A::getAge).distinct().collect(Collectors.toList());
System.out.println(ageList);
//排序
List<Integer> collect = ageList.stream().sorted().collect(Collectors.toList());
System.out.println(collect);
}
/**
* 初始化数据
*/
public void init() {
list = new ArrayList<>();
for (int i = 0; i < 777; i++) {
A a = new A();
a.setAge((int) (Math.random() * 100));
a.setId(i);
a.setName("我叫" + i * (Math.random() * 100));
list.add(a);
}
}
static class A {
private Integer id;
private Integer age;
private String name;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
}
| [
"z351622948@163.com"
] | z351622948@163.com |
a574bc6c8f8bf791a349842158d9bbb1284ec3a1 | 043703eaf27a0d5e6f02bf7a9ac03c0ce4b38d04 | /subject_systems/Struts2/src/struts-2.5.2/src/core/src/main/java/com/opensymphony/xwork2/ognl/accessor/XWorkListPropertyAccessor.java | 5640a95f49e2ee59a55201028eb385c78d4bc16e | [] | no_license | MarceloLaser/arcade_console_test_resources | e4fb5ac4a7b2d873aa9d843403569d9260d380e0 | 31447aabd735514650e6b2d1a3fbaf86e78242fc | refs/heads/master | 2020-09-22T08:00:42.216653 | 2019-12-01T21:51:05 | 2019-12-01T21:51:05 | 225,093,382 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 129 | java | version https://git-lfs.github.com/spec/v1
oid sha256:85c5447c34da51a2ae59c802da4d7969f5392b912ef194e36ffaa37b99dbc889
size 6948
| [
"marcelo.laser@gmail.com"
] | marcelo.laser@gmail.com |
70837be5c7aae524e67056cb6d3980105e7ec3f1 | bf1172f8d9807b967ed15e9c4a0260eecaa3ad85 | /DeviceToClazz/device/control/microsoft/MediaRenderer/RenderingControl.java | 488fe39db14fb35cf1d973bb017d5d0e66cf8f7a | [
"MIT"
] | permissive | jxfengzi/UpnpDeviceGenerator | a45d32b286600fc86e953fbcd91757e9125982ff | 1f8109a90a6042326b591eb7d3f7d9562406a8f8 | refs/heads/master | 2021-01-15T15:36:28.664155 | 2016-11-04T09:10:58 | 2016-11-04T09:10:58 | 48,569,359 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,723 | java | /* Automatic generated by DeviceToClazz */
package miot.api.device.xiaomi;
import android.util.Log;
import java.util.List;
import jing.api.ctrlpoint.CtrlPointManager;
import jing.api.ctrlpoint.Manipulator;
import jing.api.ctrlpoint.device.AbstractService;
import jing.typedef.ReturnCode;
import jing.typedef.device.Argument;
import jing.typedef.device.Service;
import jing.typedef.device.PropertyChanged;
import jing.typedef.device.invocation.ActionInvocation;
import jing.typedef.device.invocation.ActionInvocationFactory;
import jing.typedef.property.Property;
public class RenderingControl extends AbstractService {
private static final String TAG = "RenderingControl";
public RenderingControl(Service service) {
super(service);
}
//-------------------------------------------------------
// Action Names (6)
//-------------------------------------------------------
public static final String ACTION_ListPresets = "ListPresets";
public static final String _ListPresets_ARG_InstanceID = "InstanceID";
public static final String _ListPresets_ARG_CurrentPresetNameList = "CurrentPresetNameList";
public static final String ACTION_SetVolume = "SetVolume";
public static final String _SetVolume_ARG_InstanceID = "InstanceID";
public static final String _SetVolume_ARG_Channel = "Channel";
public static final String _SetVolume_ARG_DesiredVolume = "DesiredVolume";
public static final String ACTION_SetMute = "SetMute";
public static final String _SetMute_ARG_InstanceID = "InstanceID";
public static final String _SetMute_ARG_Channel = "Channel";
public static final String _SetMute_ARG_DesiredMute = "DesiredMute";
public static final String ACTION_GetVolume = "GetVolume";
public static final String _GetVolume_ARG_InstanceID = "InstanceID";
public static final String _GetVolume_ARG_Channel = "Channel";
public static final String _GetVolume_ARG_CurrentVolume = "CurrentVolume";
public static final String ACTION_GetMute = "GetMute";
public static final String _GetMute_ARG_InstanceID = "InstanceID";
public static final String _GetMute_ARG_Channel = "Channel";
public static final String _GetMute_ARG_CurrentMute = "CurrentMute";
public static final String ACTION_SelectPreset = "SelectPreset";
public static final String _SelectPreset_ARG_InstanceID = "InstanceID";
public static final String _SelectPreset_ARG_PresetName = "PresetName";
//-------------------------------------------------------
// Property Name (7)
//-------------------------------------------------------
public static final String PROPERTY_PresetNameList = "PresetNameList";
public static final String PROPERTY_Volume = "Volume";
public static final String PROPERTY_Mute = "Mute";
public static final String PROPERTY_A_ARG_TYPE_PresetName = "A_ARG_TYPE_PresetName";
public static final String PROPERTY_A_ARG_TYPE_InstanceID = "A_ARG_TYPE_InstanceID";
public static final String PROPERTY_A_ARG_TYPE_Channel = "A_ARG_TYPE_Channel";
public static final String PROPERTY_LastChange = "LastChange";
//-------------------------------------------------------
// Property value defined (3)
//-------------------------------------------------------
public enum PresetNameList {
UNDEFINED,
V_FactoryDefaults;
private static final String CONST_UNDEFINED = "UNDEFINED";
private static final String CONST_V_FactoryDefaults = "FactoryDefaults";
public static PresetNameList retrieveType(String value) {
if (value.equals(CONST_UNDEFINED)) {
return UNDEFINED;
}
if (value.equals(CONST_V_FactoryDefaults)) {
return V_FactoryDefaults;
}
return UNDEFINED;
}
public String getValue() {
String value = null;
switch (this) {
case V_FactoryDefaults:
value = CONST_V_FactoryDefaults;
break;
default:
break;
}
return value;
}
}
public enum A_ARG_TYPE_PresetName {
UNDEFINED,
V_FactoryDefaults;
private static final String CONST_UNDEFINED = "UNDEFINED";
private static final String CONST_V_FactoryDefaults = "FactoryDefaults";
public static A_ARG_TYPE_PresetName retrieveType(String value) {
if (value.equals(CONST_UNDEFINED)) {
return UNDEFINED;
}
if (value.equals(CONST_V_FactoryDefaults)) {
return V_FactoryDefaults;
}
return UNDEFINED;
}
public String getValue() {
String value = null;
switch (this) {
case V_FactoryDefaults:
value = CONST_V_FactoryDefaults;
break;
default:
break;
}
return value;
}
}
public enum A_ARG_TYPE_Channel {
UNDEFINED,
V_Master;
private static final String CONST_UNDEFINED = "UNDEFINED";
private static final String CONST_V_Master = "Master";
public static A_ARG_TYPE_Channel retrieveType(String value) {
if (value.equals(CONST_UNDEFINED)) {
return UNDEFINED;
}
if (value.equals(CONST_V_Master)) {
return V_Master;
}
return UNDEFINED;
}
public String getValue() {
String value = null;
switch (this) {
case V_Master:
value = CONST_V_Master;
break;
default:
break;
}
return value;
}
}
//-------------------------------------------------------
// ActionList (6)
//-------------------------------------------------------
public interface ListPresets_CompletedHandler {
void onSucceed(PresetNameList theCurrentPresetNameList);
void onFailed(int errCode, String description);
}
public int ListPresets(Long InstanceID, final ListPresets_CompletedHandler handler) {
int ret = 0;
do {
ActionInvocation action = ActionInvocationFactory.create(service, ACTION_ListPresets);;
if (action == null) {
ret = ReturnCode.E_ACTION_NOT_SUPPORT;
break;
}
if (!action.setArgumentValue(_ListPresets_ARG_InstanceID, InstanceID, Argument.Direction.IN)) {
ret = ReturnCode.E_ARGUMENT_INVALID;
break;
}
ret = CtrlPointManager.getManipulator().invoke(action, new Manipulator.InvokeCompletionHandler() {
@Override
public void onSucceed(ActionInvocation invocation) {
do {
Property pCurrentPresetNameList = invocation.getResult(_ListPresets_ARG_CurrentPresetNameList);
if (pCurrentPresetNameList == null) {
Log.d(TAG, String.format("%s not found", _ListPresets_ARG_CurrentPresetNameList));
break;
}
PresetNameList theCurrentPresetNameList = PresetNameList.retrieveType(pCurrentPresetNameList.getCurrentValue().toString());
handler.onSucceed(theCurrentPresetNameList);
} while (false);
}
@Override
public void onFailed(final int errCode, final String description) {
handler.onFailed(errCode, description);
}
});
} while (false);
return ret;
}
public interface SetVolume_CompletedHandler {
void onSucceed();
void onFailed(int errCode, String description);
}
public int SetVolume(Long InstanceID, A_ARG_TYPE_Channel Channel, Integer DesiredVolume, final SetVolume_CompletedHandler handler) {
int ret = 0;
do {
ActionInvocation action = ActionInvocationFactory.create(service, ACTION_SetVolume);;
if (action == null) {
ret = ReturnCode.E_ACTION_NOT_SUPPORT;
break;
}
if (!action.setArgumentValue(_SetVolume_ARG_InstanceID, InstanceID, Argument.Direction.IN)) {
ret = ReturnCode.E_ARGUMENT_INVALID;
break;
}
if (!action.setArgumentValue(_SetVolume_ARG_Channel, Channel.getValue(), Argument.Direction.IN)) {
ret = ReturnCode.E_ARGUMENT_INVALID;
break;
}
if (!action.setArgumentValue(_SetVolume_ARG_DesiredVolume, DesiredVolume, Argument.Direction.IN)) {
ret = ReturnCode.E_ARGUMENT_INVALID;
break;
}
ret = CtrlPointManager.getManipulator().invoke(action, new Manipulator.InvokeCompletionHandler() {
@Override
public void onSucceed(ActionInvocation invocation) {
handler.onSucceed();
}
@Override
public void onFailed(final int errCode, final String description) {
handler.onFailed(errCode, description);
}
});
} while (false);
return ret;
}
public interface SetMute_CompletedHandler {
void onSucceed();
void onFailed(int errCode, String description);
}
public int SetMute(Long InstanceID, A_ARG_TYPE_Channel Channel, Boolean DesiredMute, final SetMute_CompletedHandler handler) {
int ret = 0;
do {
ActionInvocation action = ActionInvocationFactory.create(service, ACTION_SetMute);;
if (action == null) {
ret = ReturnCode.E_ACTION_NOT_SUPPORT;
break;
}
if (!action.setArgumentValue(_SetMute_ARG_InstanceID, InstanceID, Argument.Direction.IN)) {
ret = ReturnCode.E_ARGUMENT_INVALID;
break;
}
if (!action.setArgumentValue(_SetMute_ARG_Channel, Channel.getValue(), Argument.Direction.IN)) {
ret = ReturnCode.E_ARGUMENT_INVALID;
break;
}
if (!action.setArgumentValue(_SetMute_ARG_DesiredMute, DesiredMute, Argument.Direction.IN)) {
ret = ReturnCode.E_ARGUMENT_INVALID;
break;
}
ret = CtrlPointManager.getManipulator().invoke(action, new Manipulator.InvokeCompletionHandler() {
@Override
public void onSucceed(ActionInvocation invocation) {
handler.onSucceed();
}
@Override
public void onFailed(final int errCode, final String description) {
handler.onFailed(errCode, description);
}
});
} while (false);
return ret;
}
public interface GetVolume_CompletedHandler {
void onSucceed(Integer theCurrentVolume);
void onFailed(int errCode, String description);
}
public int GetVolume(Long InstanceID, A_ARG_TYPE_Channel Channel, final GetVolume_CompletedHandler handler) {
int ret = 0;
do {
ActionInvocation action = ActionInvocationFactory.create(service, ACTION_GetVolume);;
if (action == null) {
ret = ReturnCode.E_ACTION_NOT_SUPPORT;
break;
}
if (!action.setArgumentValue(_GetVolume_ARG_InstanceID, InstanceID, Argument.Direction.IN)) {
ret = ReturnCode.E_ARGUMENT_INVALID;
break;
}
if (!action.setArgumentValue(_GetVolume_ARG_Channel, Channel.getValue(), Argument.Direction.IN)) {
ret = ReturnCode.E_ARGUMENT_INVALID;
break;
}
ret = CtrlPointManager.getManipulator().invoke(action, new Manipulator.InvokeCompletionHandler() {
@Override
public void onSucceed(ActionInvocation invocation) {
do {
Property pCurrentVolume = invocation.getResult(_GetVolume_ARG_CurrentVolume);
if (pCurrentVolume == null) {
Log.d(TAG, String.format("%s not found", _GetVolume_ARG_CurrentVolume));
break;
}
Integer theCurrentVolume = (Integer) pCurrentVolume.getCurrentValue();
handler.onSucceed(theCurrentVolume);
} while (false);
}
@Override
public void onFailed(final int errCode, final String description) {
handler.onFailed(errCode, description);
}
});
} while (false);
return ret;
}
public interface GetMute_CompletedHandler {
void onSucceed(Boolean theCurrentMute);
void onFailed(int errCode, String description);
}
public int GetMute(Long InstanceID, A_ARG_TYPE_Channel Channel, final GetMute_CompletedHandler handler) {
int ret = 0;
do {
ActionInvocation action = ActionInvocationFactory.create(service, ACTION_GetMute);;
if (action == null) {
ret = ReturnCode.E_ACTION_NOT_SUPPORT;
break;
}
if (!action.setArgumentValue(_GetMute_ARG_InstanceID, InstanceID, Argument.Direction.IN)) {
ret = ReturnCode.E_ARGUMENT_INVALID;
break;
}
if (!action.setArgumentValue(_GetMute_ARG_Channel, Channel.getValue(), Argument.Direction.IN)) {
ret = ReturnCode.E_ARGUMENT_INVALID;
break;
}
ret = CtrlPointManager.getManipulator().invoke(action, new Manipulator.InvokeCompletionHandler() {
@Override
public void onSucceed(ActionInvocation invocation) {
do {
Property pCurrentMute = invocation.getResult(_GetMute_ARG_CurrentMute);
if (pCurrentMute == null) {
Log.d(TAG, String.format("%s not found", _GetMute_ARG_CurrentMute));
break;
}
Boolean theCurrentMute = (Boolean) pCurrentMute.getCurrentValue();
handler.onSucceed(theCurrentMute);
} while (false);
}
@Override
public void onFailed(final int errCode, final String description) {
handler.onFailed(errCode, description);
}
});
} while (false);
return ret;
}
public interface SelectPreset_CompletedHandler {
void onSucceed();
void onFailed(int errCode, String description);
}
public int SelectPreset(Long InstanceID, A_ARG_TYPE_PresetName PresetName, final SelectPreset_CompletedHandler handler) {
int ret = 0;
do {
ActionInvocation action = ActionInvocationFactory.create(service, ACTION_SelectPreset);;
if (action == null) {
ret = ReturnCode.E_ACTION_NOT_SUPPORT;
break;
}
if (!action.setArgumentValue(_SelectPreset_ARG_InstanceID, InstanceID, Argument.Direction.IN)) {
ret = ReturnCode.E_ARGUMENT_INVALID;
break;
}
if (!action.setArgumentValue(_SelectPreset_ARG_PresetName, PresetName.getValue(), Argument.Direction.IN)) {
ret = ReturnCode.E_ARGUMENT_INVALID;
break;
}
ret = CtrlPointManager.getManipulator().invoke(action, new Manipulator.InvokeCompletionHandler() {
@Override
public void onSucceed(ActionInvocation invocation) {
handler.onSucceed();
}
@Override
public void onFailed(final int errCode, final String description) {
handler.onFailed(errCode, description);
}
});
} while (false);
return ret;
}
//-------------------------------------------------------
// Event
//-------------------------------------------------------
public interface CompletionHandler {
void onSucceed();
void onFailed(int errCode, String description);
}
public interface EventListener {
void onSubscriptionExpired();
void onLastChangeChanged(String currentValue);
}
public int subscribe(final CompletionHandler handler, final EventListener listener) {
int ret = ReturnCode.OK;
do {
if (this.service.isSubscribed()) {
ret = ReturnCode.E_EVENT_SUBSCRIBED;
break;
}
if (handler == null) {
ret = ReturnCode.E_INVALID_PARAM;
break;
}
if (listener == null) {
ret = ReturnCode.E_INVALID_PARAM;
break;
}
ret = CtrlPointManager.getManipulator().subscribe(this.service,
new Manipulator.GenericCompletionHandler() {
@Override
public void onSucceed() {
handler.onSucceed();
}
@Override
public void onFailed(int errCode, String description) {
handler.onFailed(errCode, description);
}
},
new Manipulator.EventListener() {
@Override
public void onSubscriptionExpired(String serviceId) {
listener.onSubscriptionExpired();
}
@Override
public void onEvent(String serviceId, List<PropertyChanged> list) {
for (PropertyChanged c : list) {
if (c.getName().equals(PROPERTY_LastChange)) {
listener.onLastChangeChanged(c.getValue());
}
}
}
});
} while (false);
return ret;
}
public int unsubscribe(final CompletionHandler handler) {
int ret = ReturnCode.OK;
do {
if (! this.service.isSubscribed()) {
ret = ReturnCode.E_EVENT_SUBSCRIBED;
break;
}
if (handler == null) {
ret = ReturnCode.E_INVALID_PARAM;
break;
}
ret = CtrlPointManager.getManipulator().unsubscribe(this.service,
new Manipulator.GenericCompletionHandler() {
@Override
public void onSucceed() {
handler.onSucceed();
}
@Override
public void onFailed(int errCode, String description) {
handler.onFailed(errCode, description);
}
});
} while (false);
return ret;
}
}
| [
"ouyangchengfeng@xiaomi.com"
] | ouyangchengfeng@xiaomi.com |
33c31a0bd52ef25c85eb73911b94896892bcd11d | 4328a3ca696882421d2034f2eaa274f2966d7e38 | /app/src/main/java/com/example/encryptioninfo/MainActivity.java | c5a70166e64a8bbdbb6713d0e3a4ed7c36352a0f | [
"Apache-2.0"
] | permissive | androlua/EncryptionInfo | d4890674e9e822065c8c0c21d92f3688ce926daf | 2c8ceaf8c676bfad4b57e864cc46a4ca2512ddeb | refs/heads/master | 2020-06-19T03:57:38.879765 | 2019-05-30T06:14:43 | 2019-05-30T06:14:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,517 | java | package com.example.encryptioninfo;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import java.security.interfaces.RSAPublicKey;
import fairy.easy.encryptioninformation.EncryptionHelper;
import fairy.easy.encryptioninformation.code.Base64Helper;
public class MainActivity extends AppCompatActivity {
public static final String TAG = MainActivity.class.getSimpleName();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViewById(R.id.tv).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.i(TAG, "MD5结果为:" + EncryptionHelper.getMd5Param(ENCRYPT_VALUE));
Log.i(TAG, "SHA256结果为:" + EncryptionHelper.getSha256Param(ENCRYPT_VALUE));
Log.i(TAG, "HmacMD5结果为:" + EncryptionHelper.getHmacMd5Param(ENCRYPT_VALUE, ENCRYPT_KEY));
Log.i(TAG, "HmacSHA256结果为:" + EncryptionHelper.getHmacSha256Param(ENCRYPT_VALUE, ENCRYPT_KEY));
String aesResult = EncryptionHelper.encryptAesParam(ENCRYPT_VALUE, AES_ENCRYPT_KEY);
Log.i(TAG, "AES加密HexString结果为:" + aesResult);
Log.i(TAG, "AES解密HexString结果为:" + EncryptionHelper.decryptAesParam(aesResult, AES_ENCRYPT_KEY));
String rsaResult = EncryptionHelper.encryptRsaParamWithPublicKeyToHexString(ENCRYPT_VALUE, RSA_PUBLIC_KEY);
Log.i(TAG, "RSA加密HexString结果为:" + rsaResult);
Log.i(TAG, "RSA解密HexString结果为:" + EncryptionHelper.decryptHexStringRsaParamWithPrivateKey(rsaResult, RSA_PRIVATE_KEY));
String rsa2Result = EncryptionHelper.encryptRsaParamWithPublicKey2ToBase64ToString(ENCRYPT_VALUE, RSA_PUBLIC_KEY);
Log.i(TAG, "RSA加密Base64结果为:" + rsa2Result);
Log.i(TAG, "RSA解密Base64结果为:" + EncryptionHelper.decryptBase64RsaParamWithPrivateKey2(rsa2Result, RSA_PRIVATE_KEY));
byte[] aesBytes=EncryptionHelper.encryptAesParam(ENCRYPT_VALUE.getBytes(),AES_ENCRYPT_KEY.getBytes());
byte[] result=EncryptionHelper.decryptAesParam(aesBytes,AES_ENCRYPT_KEY.getBytes());
Log.i(TAG,"AES Bytes解密结果为:"+new String(result));
byte[] rsaBytes=EncryptionHelper.encryptRsaParamBytes(ENCRYPT_VALUE.getBytes(), Base64Helper.decode(RSA_PUBLIC_KEY.getBytes()));
byte[] rsaBytesResult=EncryptionHelper.decryptRsaParamBytes(rsaBytes,Base64Helper.decode(RSA_PRIVATE_KEY.getBytes()));
Log.i(TAG,"RSA Bytes解密结果为:"+new String(rsaBytesResult));
}
});
}
private static final String ENCRYPT_VALUE = "test";
private static final String ENCRYPT_KEY = "123";
private static final String AES_ENCRYPT_KEY = "0000000000000000";
private static final String RSA_PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDwk5AZ9I4TdWwm0yiujztlU2ym\n" +
"htYnKdCJ/BznuHI1zDq1K+6Nxde12/zPdd/gXuTCNVH4hznzmy9LeQdA3EitXAnh\n" +
"vzAETj3qOSrU8w54CibmS95HG3ueii3otDGWYpb9Xur8v2st+Cryi128HwwUGQ7X\n" +
"yX2fitEG5nEnpGsJMQIDAQAB";
private static final String RSA_PRIVATE_KEY = "MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAPCTkBn0jhN1bCbT\n" +
"KK6PO2VTbKaG1icp0In8HOe4cjXMOrUr7o3F17Xb/M913+Be5MI1UfiHOfObL0t5\n" +
"B0DcSK1cCeG/MAROPeo5KtTzDngKJuZL3kcbe56KLei0MZZilv1e6vy/ay34KvKL\n" +
"XbwfDBQZDtfJfZ+K0QbmcSekawkxAgMBAAECgYAz5vIQ13ULd6rUmXvOZTJgQuZO\n" +
"6woqute13UFzMJTbTGtiCM9XoNZP8t0Q+RJKus5Jo+1CXBJBnzpN4xeQg7Xd3cBu\n" +
"hnACUy4CNBTbcE6DTrluheHoNRA0+6XPq0w4mfHZCEa6muUEMbFgx46vVDHg28Ws\n" +
"aiZJxhiLm7EDlXSuTQJBAP3j0RL/C4UPQ1I478p0lvCI7P8TeWDYQRhgtIzUhHeL\n" +
"Duj/apmtpCKts8MJDJlGqwhf4nij00kXtwuOjdQnU+cCQQDyk2uH183oVib2wBOG\n" +
"ZAoIh6BphMAF/NNfB4kM8u9L7GQu6bnqNwJ2BjnuatTOC9wUmlBo+Sik+ZNG/Aji\n" +
"kJcnAkB80fAMAs/LDwHt/ogFZOSARREfJpfaAPef4ItjYWfuzbL64feqri+vzO4/\n" +
"yMck5BVZ/Kn+3awWl04qpF8eGmepAkEAmVYMzALjWvFSkfmangIQwZGSGgFbLK3D\n" +
"ozdtL61FDLYyIeGGrwH04UxQRGBtgo3GoZNmLuUJBzfoHB/nMeh6UwJBAOKOWa4+\n" +
"trU/2WoGeY4D2BzOX8hmnhD5mWeuxIpXm7erRtM7SEKw3Y3KEO4mPx0alNq+VNUg\n" +
"LTycWNuMYHw0T0c=";
}
| [
"gunaonian@geetest.com"
] | gunaonian@geetest.com |
fcf9e33a26edd9b129deebd39055716b8e8104ce | 64066cce9b09f1dae65733eaf98907c0562cc852 | /Våren/Hemuppgift 11/GraphSearch/src/kth/csc/inda/MatrixGraph.java | 0965f4dbc817b0243eb36696b73b0833a75072cf | [] | no_license | Milvan/Inda_Uppgifter | 2f76bad4328c0ea55a40d223ebae49c56e25e5d3 | 565eefc207059a70ff504c11f48ed10f569ca561 | refs/heads/master | 2020-03-29T23:34:40.069868 | 2014-04-22T20:49:38 | 2014-04-22T20:49:38 | 17,833,315 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,263 | java | package kth.csc.inda;
import java.util.NoSuchElementException;
/**
* A graph with a fixed number of vertices implemented using an adjacency
* matrix. Space complexity is Θ(n<sup>2</sup>), where n is the number of
* vertices.
*
* @author Stefan Nilsson
* @version 2013-01-01
*/
public class MatrixGraph implements Graph {
/** Number of vertices in the graph. */
private final int numVertices;
/** Number of edges in the graph. */
private int numEdges;
/**
* Adjaceny matrix: adj[v][w] is EMPTY if v is not adjacent to w, otherwise
* adj[v][w] is NO_COST or the non-negative cost of the edge.
*/
private final int[][] adj;
private final static int EMPTY = -2; // no edge
/**
* Constructs a MatrixGraph with n vertices and no edges. Time complexity:
* O(n<sup>2</sup>)
*
* @throws IllegalArgumentException
* if n < 0
*/
public MatrixGraph(int n) {
if (n < 0)
throw new IllegalArgumentException("n = " + n);
numVertices = n;
adj = new int[n][n];
for (int i = n - 1; i >= 0; i--) {
int[] row = adj[i];
for (int j = n - 1; j >= 0; j--)
row[j] = EMPTY;
}
}
/**
* {@inheritDoc Graph} Time complexity: O(1).
*/
@Override
public int numVertices() {
return numVertices;
}
/**
* {@inheritDoc Graph} Time complexity: O(1).
*/
@Override
public int numEdges() {
return numEdges;
}
/**
* {@inheritDoc Graph} Time complexity: O(n), where n is the number of
* vertices.
*/
@Override
public int degree(int v) throws IllegalArgumentException {
checkVertexParameter(v);
int d = 0;
int[] row = adj[v];
for (int i = numVertices - 1; i >= 0; i--)
if (row[i] != EMPTY)
d++;
return d;
}
/**
* {@inheritDoc Graph} Time complexity: O(n), where n is the number of
* vertices.
*/
@Override
public VertexIterator neighbors(int v) throws IllegalArgumentException {
checkVertexParameter(v);
return new NeighborIterator(v);
}
private class NeighborIterator implements VertexIterator {
int[] row;
final int n;
int nextPos = -1;
NeighborIterator(int v) {
row = adj[v];
n = row.length;
findNext();
}
private void findNext() {
nextPos++;
while (nextPos < n && row[nextPos] == EMPTY)
nextPos++;
}
@Override
public boolean hasNext() {
return nextPos < n;
}
@Override
public int next() {
int pos = nextPos;
if (pos < n) {
findNext();
return pos;
}
throw new NoSuchElementException(
"This iterator has no more elements.");
}
}
/**
* {@inheritDoc Graph} Time complexity: O(1).
*/
@Override
public boolean hasEdge(int v, int w) throws IllegalArgumentException {
checkVertexParameters(v, w);
return adj[v][w] != EMPTY;
}
/**
* {@inheritDoc Graph} Time complexity: O(1).
*/
@Override
public int cost(int v, int w) throws IllegalArgumentException {
checkVertexParameters(v, w);
return Math.max(NO_COST, adj[v][w]);
}
/**
* {@inheritDoc Graph} Time complexity: O(1).
*/
@Override
public void add(int from, int to) throws IllegalArgumentException {
checkVertexParameters(from, to);
addEdge(from, to, NO_COST);
}
/**
* {@inheritDoc Graph} Time complexity: O(1).
*/
@Override
public void add(int from, int to, int c) throws IllegalArgumentException {
checkVertexParameters(from, to);
checkNonNegativeCost(c);
addEdge(from, to, c);
}
/**
* {@inheritDoc Graph} Time complexity: O(1).
*/
@Override
public void addBi(int v, int w) throws IllegalArgumentException {
checkVertexParameters(v, w);
addEdge(v, w, NO_COST);
if (v == w)
return;
addEdge(w, v, NO_COST);
}
/**
* {@inheritDoc Graph} Time complexity: O(1).
*/
@Override
public void addBi(int v, int w, int c) throws IllegalArgumentException {
checkVertexParameters(v, w);
checkNonNegativeCost(c);
addEdge(v, w, c);
if (v == w)
return;
addEdge(w, v, c);
}
/**
* Add an edge without checking parameters.
*/
private void addEdge(int from, int to, int c) {
int[] row = adj[from];
if (row[to] == EMPTY)
numEdges++;
row[to] = c;
}
/**
* {@inheritDoc Graph} Time complexity: O(1).
*/
@Override
public void remove(int from, int to) throws IllegalArgumentException {
checkVertexParameters(from, to);
removeEdge(from, to);
}
/**
* {@inheritDoc Graph} Time complexity: O(1).
*/
@Override
public void removeBi(int v, int w) throws IllegalArgumentException {
checkVertexParameters(v, w);
removeEdge(v, w);
if (v == w)
return;
removeEdge(w, v);
}
/**
* Remove an edge without checking parameters.
*/
private void removeEdge(int from, int to) {
int[] row = adj[from];
if (row[to] != EMPTY) {
row[to] = EMPTY;
numEdges--;
}
}
/**
* Returns a string representation of this graph.
*
* @return a String representation of this graph
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
for (int i = 0; i < numVertices; i++) {
int[] row = adj[i];
for (int j = 0; j < numVertices; j++) {
int x = row[j];
switch (x) {
case EMPTY:
break;
case NO_COST:
sb.append("(" + i + "," + j + "), ");
break;
default:
sb.append("(" + i + "," + j + "," + x + "), ");
}
}
}
if (numEdges > 0)
sb.setLength(sb.length() - 2); // Remove trailing ", "
sb.append("}");
return sb.toString();
}
/**
* Checks a single vertex parameter v.
*
* @throws IllegalArgumentException
* if v is out of range
*/
private void checkVertexParameter(int v) {
if (v < 0 || v >= numVertices)
throw new IllegalArgumentException("Out of range: v = " + v + ".");
}
/**
* Checks two vertex parameters v and w.
*
* @throws IllegalArgumentException
* if v or w is out of range
*/
private void checkVertexParameters(int v, int w) {
if (v < 0 || v >= numVertices || w < 0 || w >= numVertices)
throw new IllegalArgumentException("Out of range: v = " + v
+ ", w = " + w + ".");
}
/**
* Checks that the cost c is non-negative.
*
* @throws IllegalArgumentException
* if c < 0
*/
private void checkNonNegativeCost(int c) {
if (c < 0)
throw new IllegalArgumentException("Illegal cost: c = " + c + ".");
}
}
| [
"marcus.larson@live.com"
] | marcus.larson@live.com |
0106196e59031aead5b248a413860a8be3df6e8c | 2d88b708c22c32b00f97dd69a867b3feb232877c | /Day62/intfloatstring.java | 70872b4879e942b4cf3b90f17c65fe3a3d6b4f91 | [] | no_license | marykchiev/CYbertek | 4174ec6fd2cf7fb220e370e3fada49aa09ab8a4e | a5f4e07031e1fb59dee79b34c3428da85a18502e | refs/heads/master | 2020-06-03T19:28:29.129294 | 2019-08-01T15:56:03 | 2019-08-01T15:56:03 | 191,702,455 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 212 | java | package Day62;
public class intfloatstring {
public static void main(String[] args) {
int a=12;
float b=(float)a;
System.out.println(b);
String c=Float.toString(b);
System.out.println(c);
}
}
| [
"marykchiev@PLT-2.HSADVANCEMENT.ORG"
] | marykchiev@PLT-2.HSADVANCEMENT.ORG |
6f6382c311b4ab1e4ecf01342f00581d58cc25ae | 7f544aa05bda1a6016665bbf184074e259489e65 | /Test Codes/Java Json Api/AndroidTestMySQLAll/app/src/main/java/com/example/shovan21/androidtestmysqlall/Koneksi.java | 00b05e331335711adc993f160814dba9e57eaf23 | [
"MIT"
] | permissive | smishadhin/SpdU | 13062daa14679b91892ec9b2a2246009a6c7626e | da2987f8a5d414c3cf4aa7e5e70a4caa52f08946 | refs/heads/master | 2020-08-11T02:45:32.008400 | 2019-11-06T12:45:19 | 2019-11-06T12:45:19 | 214,474,929 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,047 | java | package com.example.shovan21.androidtestmysqlall;
/**
* Created by Shovan21 on 26-Nov-16.
*/
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
public class Koneksi {
public String call(String url) {
int BUFFER_SIZE = 2000;
InputStream in = null;
try {
in = OpenHttpConnection(url);
} catch (IOException e) {
e.printStackTrace();
return "";
}
InputStreamReader isr = new InputStreamReader(in);
int charRead;
String str = "";
char[] inputBuffer = new char[BUFFER_SIZE];
try {
while ((charRead = isr.read(inputBuffer)) > 0) {
String readString = String.copyValueOf(inputBuffer, 0, charRead);
str += readString;
inputBuffer = new char[BUFFER_SIZE];
}
in.close();
} catch (IOException e) {
// Handle Exception
e.printStackTrace();
return "";
}
return str;
}
private InputStream OpenHttpConnection(String url) throws IOException {
InputStream in = null;
int response = -1;
URL url1 = new URL(url);
URLConnection conn = url1.openConnection();
if (!(conn instanceof HttpURLConnection))
throw new IOException("Not An Http Connection");
try {
HttpURLConnection httpconn = (HttpURLConnection) conn;
httpconn.setAllowUserInteraction(false);
httpconn.setInstanceFollowRedirects(true);
httpconn.setRequestMethod("GET");
httpconn.connect();
response = httpconn.getResponseCode();
if (response == HttpURLConnection.HTTP_OK) {
in = httpconn.getInputStream();
}
} catch (Exception e) {
throw new IOException("Error connecting2");
}
return in;
}
}
| [
"smi.shadhin@gmail.com"
] | smi.shadhin@gmail.com |
606e45b7a6f7eb561164f0c2e63e874b3182d1d5 | 003a6ee01d39c3d5e7d3e57f0bac56bc411d2bd5 | /TigerGolf004/TGolfer/src/main/java/com/boha/golfpractice/player/dto/GolfCourseDTO.java | f9b897f3fe26ec27195302d0c9d1f9c67f11d07e | [] | no_license | malengatiger/TigerGolf004 | e9ee4c7b88f384907670971b7e21d5f66a22e096 | 16c7e5afa26711bf2aab70fc9685cca983d9a2c7 | refs/heads/master | 2021-01-18T23:43:35.285638 | 2016-06-08T13:07:47 | 2016-06-08T13:07:47 | 54,854,472 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,725 | 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 com.boha.golfpractice.player.dto;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author aubreymalabie
*/
public class GolfCourseDTO implements Serializable, Comparable<GolfCourseDTO> {
private static final long serialVersionUID = 1L;
private Integer golfCourseID;
private String golfCourseName;
private Double latitude;
private Double longitude, distance;
private String email;
private String cellphone;
private List<HoleDTO> holeList;
private List<PracticeSessionDTO> practiceSessionList;
public GolfCourseDTO() {
}
public Double getDistance() {
return distance;
}
public void setDistance(Double distance) {
this.distance = distance;
}
public Integer getGolfCourseID() {
return golfCourseID;
}
public void setGolfCourseID(Integer golfCourseID) {
this.golfCourseID = golfCourseID;
}
public String getGolfCourseName() {
return golfCourseName;
}
public void setGolfCourseName(String golfCourseName) {
this.golfCourseName = golfCourseName;
}
public Double getLatitude() {
return latitude;
}
public void setLatitude(Double latitude) {
this.latitude = latitude;
}
public Double getLongitude() {
return longitude;
}
public void setLongitude(Double longitude) {
this.longitude = longitude;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getCellphone() {
return cellphone;
}
public void setCellphone(String cellphone) {
this.cellphone = cellphone;
}
public List<HoleDTO> getHoleList() {
if (holeList == null) {
holeList = new ArrayList<>();
}
return holeList;
}
public void setHoleList(List<HoleDTO> holeList) {
this.holeList = holeList;
}
public List<PracticeSessionDTO> getPracticeSessionList() {
if (practiceSessionList == null) {
practiceSessionList = new ArrayList<>();
}
return practiceSessionList;
}
public void setPracticeSessionList(List<PracticeSessionDTO> practiceSessionList) {
this.practiceSessionList = practiceSessionList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (golfCourseID != null ? golfCourseID.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof GolfCourseDTO)) {
return false;
}
GolfCourseDTO other = (GolfCourseDTO) object;
if ((this.golfCourseID == null && other.golfCourseID != null) || (this.golfCourseID != null && !this.golfCourseID.equals(other.golfCourseID))) {
return false;
}
return true;
}
@Override
public String toString() {
return "com.boha.golfpractice.data.GolfCourse[ golfCourseID=" + golfCourseID + " ]";
}
@Override
public int compareTo(GolfCourseDTO another) {
if (distance == null) {
return this.getGolfCourseName().compareTo(another.golfCourseName);
}
if (distance < another.distance) {
return -1;
}
if (distance > another.distance) {
return 1;
}
return 0;
}
}
| [
"malengatiger@gmail.com"
] | malengatiger@gmail.com |
4c4d950143f8cbe6b6f7dd62aecababf4d62e51d | 95c764bab3fb8e6946d47b9c1f4f6e7d66d88ca6 | /app/src/test/java/com/theshatz/guess/ExampleUnitTest.java | 48d3f1f65650b3fa6a3fc2f147be4c4a4fb45567 | [] | no_license | majorshatz/GuessingGame | f7f151c5bc17e0be29b07a7e1e571d0d466f5ff5 | 92795ce622bc5c44edae0ffdb3690d2d97afea49 | refs/heads/master | 2021-04-15T17:53:37.014786 | 2018-03-23T21:11:31 | 2018-03-23T21:11:31 | 126,539,246 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 396 | java | package com.theshatz.guess;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"theshatz@gmail.com"
] | theshatz@gmail.com |
521735bde46025f505ba1c88638d71af8d03b4ac | 939db89fb332a557831a17bdb2192d0f3ae5a3fa | /Zenefits/src/Verify_Preorder_Sequence_in_Binary_Search_Tree.java | fbaf684068f2912305acc7d4d6c19bb03d1708e2 | [] | no_license | Lorreina/Coding_Challenge | a3f7df50c589fa2798dbb86df7fc78c5f5cd0967 | b1bf0539571abc5bd4393293e174a2cb420efffc | refs/heads/master | 2021-01-24T17:45:49.496242 | 2016-10-22T02:04:15 | 2016-10-22T02:04:15 | 53,908,823 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,107 | java | //import java.util.Stack;
/**
* LeetCode
* 255. Verify Preorder Sequence in Binary Search Tree
* @author lorreina
*
*/
public class Verify_Preorder_Sequence_in_Binary_Search_Tree {
// Solution 1: using a stack with O(n) space complexity
// public boolean verifyPreorder(int[] preorder) {
// if (preorder == null || preorder.length <= 1) {
// return true;
// }
//
// Stack<Integer> stack = new Stack<Integer> ();
// stack.push(preorder[0]);
//
// int minValue = Integer.MIN_VALUE;
// for (int i = 1; i < preorder.length; i++) {
// if (preorder[i] < minValue) {
// return false;
// }
// if (preorder[i] < stack.peek()) {
// stack.push(preorder[i]);
// } else {
// while (preorder[i] > stack.peek()) {
// minValue = stack.pop();
// if (stack.isEmpty()) {
// stack.push(preorder[i]);
// break;
// }
// }
// if (preorder[i] > minValue) {
// stack.push(preorder[i]);
// } else {
// return false;
// }
// }
// }
// return true;
// }
// Solution 2: O(1) space complexity
// using the original preorder array as stack, use i as index flag
public boolean verifyPreorder(int[] preorder) {
if (preorder == null || preorder.length <= 1) {
return true;
}
int minValue = Integer.MIN_VALUE;
int i = -1;
for (int p : preorder) {
if (p < minValue) {
return false;
}
while (i >= 0 && p > preorder[i]) {
minValue = preorder[i];
i--;
}
i++;
preorder[i] = p;
}
return true;
}
public static class TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNode(int x) { val = x; }
}
}
| [
"lorreina@sina.com.cn"
] | lorreina@sina.com.cn |
1b3d4db417fce6a56828897756496d299b08d7ed | c2711dc45c822bf6caa759cf57c75cfa7418098b | /src/main/java/com/aaa/mapper/TrolemenuMapper.java | 121118201004632fed580ffc15ed7ae62d7d7739 | [] | no_license | aaaaajianye/express-project | 70b73f07b5bc87b5ac65c8bc58450b1e25a4f716 | fac52d22ced5596b0f0f705c05dc2603bda8aa45 | refs/heads/master | 2023-05-06T21:09:24.455550 | 2021-05-21T07:48:48 | 2021-05-21T07:48:48 | 349,255,715 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 153 | java | package com.aaa.mapper;
import com.aaa.entity.Trolemenu;
import com.aaa.util.MyMapper;
public interface TrolemenuMapper extends MyMapper<Trolemenu> {
} | [
"840818534@qq.com"
] | 840818534@qq.com |
98175e6694515aef7fbc74238cc80e284f99cb3b | 0379aa3f649e8451947b1732c25672884fb20ebb | /src/DP/ConnectedIslands.java | aebc4bf6554a88f8107667ab0921388c39885495 | [] | no_license | kasimzaman/ds | edf9a033e42dc4ce1d36c25b14bf7da3f551078b | e1a40de28f77920fd463d4eb7fa5e07e75fc2307 | refs/heads/master | 2020-04-27T05:19:20.414589 | 2019-03-06T05:44:43 | 2019-03-06T05:44:43 | 174,078,230 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,800 | java | package DP;
public class ConnectedIslands
{
public static void main (String[] args) throws java.lang.Exception
{
int M[][]= new int[][] {{1, 1, 0, 0, 0},
{0, 1, 0, 0, 1},
{1, 0, 0, 1, 1},
{0, 0, 0, 0, 0},
{1, 0, 1, 0, 1}
};
System.out.println("Number of islands is: "+ countIslands(M));
}
static final int ROW = 5, COL = 5;
static boolean isSafe(int M[][], int row, int col,
boolean visited[][])
{
return (row >= 0) && (row < ROW) &&
(col >= 0) && (col < COL) &&
(M[row][col]==1 && !visited[row][col]);
}
static void DFS(int M[][], int row, int col, boolean visited[][])
{
int rowNbr[] = new int[] {-1, -1, -1, 0, 0, 1, 1, 1};
int colNbr[] = new int[] {-1, 0, 1, -1, 1, -1, 0, 1};
visited[row][col] = true;
for (int k = 0; k < 8; ++k)
if (isSafe(M, row + rowNbr[k], col + colNbr[k], visited) )
DFS(M, row + rowNbr[k], col + colNbr[k], visited);
}
static int countIslands(int M[][])
{
boolean visited[][] = new boolean[ROW][COL];
int count = 0;
for (int i = 0; i < ROW; ++i)
for (int j = 0; j < COL; ++j)
if (M[i][j]==1 && !visited[i][j]) // If a cell with
{ // value 1 is not
// visited yet, then new island found, Visit all
// cells in this island and increment island count
DFS(M, i, j, visited);
++count;
}
return count;
}
}
| [
"ali@alis-mbp.attlocal.net"
] | ali@alis-mbp.attlocal.net |
f26ecc72bed30928bfff5444956ad539667752a5 | ac8b018414cb96138e0a2dc906e69b46c01305ce | /ancillaryscreens/src/main/java/com/samagra/ancillaryscreens/screens/splash/SplashContract.java | 35b327fde4aaaa17cbf4d143903c1ce8159925c8 | [] | no_license | lexbernier/demo_tutorial_app | 1a46ab561ae4105efd8e42c7f4c6e0f2b1585eb9 | bcaaf6c79207bf3abec9c2640d891a8b4d31143f | refs/heads/master | 2022-07-08T01:23:22.517780 | 2020-05-14T07:37:50 | 2020-05-14T07:37:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,724 | java | package com.samagra.ancillaryscreens.screens.splash;
import android.content.pm.PackageInfo;
import com.samagra.ancillaryscreens.base.MvpInteractor;
import com.samagra.ancillaryscreens.base.MvpPresenter;
import com.samagra.ancillaryscreens.base.MvpView;
import com.samagra.commons.MainApplication;
/**
* The interface contract for Splash Screen. This interface contains the methods that the Model, View & Presenter
* for Splash Screen must implement
*
* @author Pranav Sharma
*/
public interface SplashContract {
interface View extends MvpView {
void endSplashScreen();
/**
* This function configures the Splash Screen
* and renders it on screen. This includes the Splash screen image and other UI configurations.
*
*/
void showSimpleSplash();
void finishActivity();
/**
* This function sets the activity layout and binds the UI Views.
* This function should be called after the relevant permissions are granted to the app by the user
*/
void showActivityLayout();
}
interface Interactor extends MvpInteractor {
boolean isFirstRun();
boolean isShowSplash();
/**
* This function updates the version number and sets firstRun flag to true.
* Call this method if you have for some reason updated the version code of the app.
*
* @param packageInfo - {@link PackageInfo} to get the the current version code of the app.
* @return boolean - {@code true} if current package version code is higher than the stored version code
* (indicating an app update), {@code false} otherwise
*/
boolean updateVersionNumber(PackageInfo packageInfo);
/**
* Updates the first Run flag according to the conditions.
*
* @param value - the updated value of the first run flag
*/
void updateFirstRunFlag(boolean value);
boolean isLoggedIn();
}
interface Presenter<V extends View, I extends Interactor> extends MvpPresenter<V, I> {
/**
* Decides the next screen and moves to the decided screen.
* This decision is based on the Login status which is managed by the {@link com.samagra.ancillaryscreens.screens.login.LoginActivity}
* in this module.
*
* @see com.samagra.ancillaryscreens.screens.login.LoginActivity
* @see com.samagra.ancillaryscreens.data.prefs.CommonsPrefsHelperImpl
*/
void moveToNextScreen();
void startUnzipTask();
void downloadFirebaseRemoteStorageConfigFile();
void init();
void requestStoragePermissions();
}
}
| [
"umangbhola@samagragovernance.in"
] | umangbhola@samagragovernance.in |
7293bc30baf69f127e0d8909576d9666733d70f3 | fa93c9be2923e697fb8a2066f8fb65c7718cdec7 | /sources/com/google/android/gms/internal/gtm/zzin.java | 7c7d0088ae3c727f44748c932fc9668956da246b | [] | no_license | Auch-Auch/avito_source | b6c9f4b0e5c977b36d5fbc88c52f23ff908b7f8b | 76fdcc5b7e036c57ecc193e790b0582481768cdc | refs/heads/master | 2023-05-06T01:32:43.014668 | 2021-05-25T10:19:22 | 2021-05-25T10:19:22 | 370,650,685 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,092 | java | package com.google.android.gms.internal.gtm;
import com.avito.android.util.preferences.db_preferences.Types;
import com.google.android.gms.ads.AdError;
import com.google.android.gms.common.internal.Preconditions;
public final class zzin extends zzhb {
@Override // com.google.android.gms.internal.gtm.zzhb
public final zzoa<?> zza(zzfl zzfl, zzoa<?>... zzoaArr) {
String str;
Preconditions.checkArgument(true);
Preconditions.checkArgument(zzoaArr.length == 1);
Preconditions.checkArgument(!(zzoaArr[0] instanceof zzol));
Preconditions.checkArgument(true ^ zzoo.zzm(zzoaArr[0]));
zzoa<?> zzoa = zzoaArr[0];
if (zzoa == zzog.zzaum) {
str = AdError.UNDEFINED_DOMAIN;
} else if (zzoa instanceof zzod) {
str = Types.BOOLEAN;
} else if (zzoa instanceof zzoe) {
str = "number";
} else if (zzoa instanceof zzom) {
str = Types.STRING;
} else {
str = zzoa instanceof zzof ? "function" : "object";
}
return new zzom(str);
}
}
| [
"auchhunter@gmail.com"
] | auchhunter@gmail.com |
3d2c7783d1f549fd2f166d40aa0e1f831bf247c4 | e4730297d0762f6246a606ce7e0831ba3c26b398 | /BigDinosaur-Core/src/org/bd/core/content/database/BdtreeMultipleNode.java | e2f8184e37d4eaaeca7c26e713f3fc1a2476797d | [] | no_license | Bijaye/BigDinosaur | a280c86a877861eb3cc5d2534e70aef63bca2d3f | a86e9dc7a0d9415eadf8bf1875ca3146241ae17f | refs/heads/master | 2021-01-12T08:17:24.340060 | 2015-10-12T06:54:34 | 2015-10-12T06:54:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 945 | java | package org.bd.core.content.database;
public class BdtreeMultipleNode
{
public BdtreeMultipleNode( BdFileDirSingleVm x)
{
leftnode = null;
this.x = x;
}
BdtreeMultipleNode leftnode;
BdtreeMultipleNode rightnode;
BdFileDirSingleVm x;
public BdFileDirSingleVm getX()
{
return x;
}
public BdtreeMultipleNode getleft()
{
return leftnode;
}
public BdtreeMultipleNode add(BdtreeMultipleNode node,BdFileDirSingleVm data,int checker){
if(node==null){
node =new BdtreeMultipleNode(data);
}
else{
if(checker==1){
BdtreeMultipleNode left= node.leftnode;
BdtreeMultipleNode nodeleft= add(left, data,checker);
node.leftnode=nodeleft;
}
else{
BdtreeMultipleNode left= node.rightnode;
BdtreeMultipleNode nodeleft= add(left, data,checker);
node.rightnode=nodeleft;
}
}
return node;
}
}
| [
"abishkar@abishkar-PC"
] | abishkar@abishkar-PC |
69e4c5a57be9cd1226bb649d275e844504451b63 | 818568b6e3f656c62715369d988582411249c459 | /cloud-consumerzk-order80/src/main/java/com/atguigu/springcloud/OrderZKMain80.java | 0a8008da23770a87fa7e1b8fc0d23bc6c76ebe85 | [
"Apache-2.0"
] | permissive | xtymbbt/spring-cloud-YangZhou | 0eaac914964007b5db9d7fbb57698f796fbbcf1b | 5bdc837ded76ee196a6e94cc0caa2b6330a0c6ed | refs/heads/main | 2023-01-01T09:59:31.008393 | 2020-10-27T01:11:25 | 2020-10-27T01:11:25 | 306,577,710 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 485 | java | package com.atguigu.springcloud;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
/**
* @author Bridge Wang
* @version 1.0
* @date 2020/4/22 9:21
*/
@SpringBootApplication
@EnableDiscoveryClient
public class OrderZKMain80 {
public static void main(String[] args) {
SpringApplication.run(OrderZKMain80.class, args);
}
}
| [
"tiandilingxin@qq.com"
] | tiandilingxin@qq.com |
4dedf8b8f42eee847ee23137073cbcf2c76e673c | a0728a167e1cb883255a34e055cac4ac60309f20 | /docu/can_boa/src/snis/can_boa/boatstd/d06000002/activity/SaveTotalEduSchd.java | 123ccc4352a8cd48ffac1f6c1543621fcadbe88a | [] | no_license | jingug1004/pythonBasic | 3d3c6c091830215c8be49cc6280b7467fd19dc76 | 554e3d1a9880b4f74872145dc4adaf0b099b0845 | refs/heads/master | 2023-03-06T06:24:05.671015 | 2022-03-09T08:16:58 | 2022-03-09T08:16:58 | 179,009,504 | 0 | 0 | null | 2023-03-03T13:09:01 | 2019-04-02T06:02:44 | Java | UHC | Java | false | false | 13,834 | java | /*================================================================================
* 시스템 : 학사관리
* 소스파일 이름 : snis.can.system.d06000002.activity.SaveTotalEduSchd.java
* 파일설명 : 종합교육일정
* 작성자 : 최문규
* 버전 : 1.0.0
* 생성일자 : 2007-01-03
* 최종수정일자 :
* 최종수정자 :
* 최종수정내용 :
=================================================================================*/
package snis.can_boa.boatstd.d06000002.activity;
import com.posdata.glue.biz.constants.PosBizControlConstants;
import com.posdata.glue.context.PosContext;
import com.posdata.glue.dao.vo.PosParameter;
import com.posdata.glue.miplatform.vo.PosDataset;
import com.posdata.glue.miplatform.vo.PosRecord;
import snis.can_boa.common.util.SnisActivity;
import snis.can_boa.common.util.Util;
/**
* 이 클래스는 클라이언트로부터의 저장 데이타셋을 받아 해당 Query의 조건절에 맞는 파라미터를
* 매핑하여 게시물을 저장(입력/수정)및 삭제하는 클래스이다.
* @auther 최문규
* @version 1.0
*/
public class SaveTotalEduSchd extends SnisActivity
{
public SaveTotalEduSchd() { }
/**
* <p> SaveStates Activity를 실행시키기 위한 메소드 </p>
* @param ctx PosContext 저장소
* @return SUCCESS String sucess 문자열
* @throws none
*/
public String runActivity(PosContext ctx)
{
//사용자 정보 확인
if ( !setUserInfo(ctx).equals(PosBizControlConstants.SUCCESS) ) {
Util.setSvcMsgCode(ctx, "L_COM_ALT_0028");
return PosBizControlConstants.SUCCESS;
}
PosDataset ds1;
PosDataset ds2;
int nSize1 = 0;
int nSize2 = 0;
String sDsName1 = "";
String sDsName2 = "";
sDsName1 = "dsOutEduOutl";
if ( ctx.get(sDsName1) != null ) {
ds1 = (PosDataset)ctx.get(sDsName1);
nSize1 = ds1.getRecordCount();
for ( int i = 0; i < nSize1; i++ )
{
PosRecord record = ds1.getRecord(i);
logger.logInfo("dsOutEduOutl------------------->"+record);
}
}
sDsName2 = "dsOutEduAssign";
if ( ctx.get(sDsName2) != null ) {
ds2 = (PosDataset)ctx.get(sDsName2);
nSize2= ds2.getRecordCount();
for ( int i = 0; i < nSize2; i++ )
{
PosRecord record = ds2.getRecord(i);
logger.logInfo("dsOutEduAssign------------------->"+record);
}
}
logger.logInfo("nSize1------------------->"+nSize1);
logger.logInfo("nSize2------------------->"+nSize2);
if(nSize1 > 0){
saveStateEduOutl(ctx);
}
if(nSize2 > 0){
saveStateEduAssign(ctx);
}
return PosBizControlConstants.SUCCESS;
}
/**
* <p> 하나의 데이타셋을 가져와 한 레코드씩 looping하면서 DML 메소드를 호출하기 위한 메소드 </p>
* @param ctx PosContext 저장소
* @return none
* @throws none
*/
protected void saveStateEduOutl(PosContext ctx)
{
int nSaveCount = 0;
int nDeleteCount = 0;
PosDataset ds;
int nSize = 0;
int nTempCnt = 0;
// 교육개요 저장
ds = (PosDataset)ctx.get("dsOutEduOutl");
nSize = ds.getRecordCount();
for ( int i = 0; i < nSize; i++ )
{
PosRecord record = ds.getRecord(i);
if ( record.getType() == com.posdata.glue.miplatform.vo.PosRecord.UPDATE
|| record.getType() == com.posdata.glue.miplatform.vo.PosRecord.INSERT)
{
if ( (nTempCnt = updateEduOutl(record)) == 0 ) {
nTempCnt = insertEduOutl(record);
}
nSaveCount = nSaveCount + nTempCnt;
}
}
Util.setSaveCount (ctx, nSaveCount );
Util.setDeleteCount(ctx, nDeleteCount );
}
/**
* <p> 하나의 데이타셋을 가져와 한 레코드씩 looping하면서 DML 메소드를 호출하기 위한 메소드 </p>
* @param ctx PosContext 저장소
* @return none
* @throws none
*/
protected void saveStateEduAssign(PosContext ctx)
{
// 시간배정표 저장
int nSaveCount = 0;
int nDeleteCount = 0;
PosDataset ds = (PosDataset) ctx.get("dsOutEduAssign");
int nSize = ds.getRecordCount();
for ( int i = 0; i < nSize; i++ )
{
PosRecord record = ds.getRecord(i);
logger.logInfo("recordType==================>"+record.getType());
logger.logInfo(String.valueOf(com.posdata.glue.miplatform.vo.PosRecord.UPDATE));
switch (record.getType())
{
case com.posdata.glue.miplatform.vo.PosRecord.UPDATE:
updateEduAssign(record);
nSaveCount = nSaveCount + 1;
break;
case com.posdata.glue.miplatform.vo.PosRecord.INSERT:
insertEduAssign(record);
nSaveCount = nSaveCount + 1;
break;
case com.posdata.glue.miplatform.vo.PosRecord.DELETE:
deleteEduAssign(record);
nDeleteCount = nDeleteCount + 1;
break;
}
}
Util.setSaveCount (ctx, nSaveCount );
Util.setDeleteCount(ctx, nDeleteCount );
}
/**
* <p> 교육개요 입력 </p>
* @param record PosRecord 데이타셋에 대한 하나의 레코드
* @return dmlcount int insert 레코드 개수
* @throws none
*/
protected int insertEduOutl(PosRecord record)
{
logger.logInfo("========================== 교육개요 입력 ============================");
PosParameter param = new PosParameter();
int i = 0;
param.setValueParamter(i++, Util.trim(record.getAttribute("RACER_PERIO_NO")));
param.setValueParamter(i++, Util.trim(record.getAttribute("EDU_STR_DT")));
param.setValueParamter(i++, Util.trim(record.getAttribute("EDU_END_DT")));
param.setValueParamter(i++, record.getAttribute("EDU_MM"));
param.setValueParamter(i++, (record.getAttribute("TOT_EDU_TIME")));
param.setValueParamter(i++, (record.getAttribute("EDU_PERS_NO")));
param.setValueParamter(i++, (record.getAttribute("EDU_MAN_NO")));
param.setValueParamter(i++, (record.getAttribute("EDU_WOMAN_NO")));
param.setValueParamter(i++, SESSION_USER_ID);
int dmlcount = this.getDao("candao").insert("tbdn_cmpt_edu_outl_d06000002_in001", param);
return dmlcount;
}
/**
* <p> 시간배정표 입력 </p>
* @param record PosRecord 데이타셋에 대한 하나의 레코드
* @return dmlcount int insert 레코드 개수
* @throws none
*/
protected int insertEduAssign(PosRecord record)
{
PosParameter param = new PosParameter();
int i = 0;
logger.logInfo("=================== 시간배정표 입력 =====================");
logger.logInfo(record.getAttribute("RACER_PERIO_NO"));
logger.logInfo(record.getAttribute("SECTN_CD"));
logger.logInfo(record.getAttribute("CRS_CD"));
logger.logInfo(record.getAttribute("EDU_TIME"));
logger.logInfo(record.getAttribute("LECTR"));
logger.logInfo(record.getAttribute("BLNG"));
logger.logInfo(record.getAttribute("RMK"));
logger.logInfo(SESSION_USER_ID);
logger.logInfo("=================== 시간배정표 입력 ======================");
param.setValueParamter(i++, Util.trim(record.getAttribute("RACER_PERIO_NO")));
param.setValueParamter(i++, Util.trim(record.getAttribute("SECTN_CD")));
param.setValueParamter(i++, Util.trim(record.getAttribute("CRS_CD")));
param.setValueParamter(i++, (record.getAttribute("EDU_TIME")));
param.setValueParamter(i++, Util.trim(record.getAttribute("LECTR")));
param.setValueParamter(i++, Util.trim(record.getAttribute("BLNG")));
param.setValueParamter(i++, Util.trim(record.getAttribute("RMK")));
param.setValueParamter(i++, SESSION_USER_ID);
int dmlcount = this.getDao("candao").insert("tbdn_cmpt_edu_outl_d06000002_in002", param);
return dmlcount;
}
/**
* <p> 교육개요 갱신 </p>
* @param record PosRecord 데이타셋에 대한 하나의 레코드
* @return dmlcount int update 레코드 개수
* @throws none
*/
protected int updateEduOutl(PosRecord record)
{
PosParameter param = new PosParameter();
int i = 0;
logger.logInfo("================= 교육개요 갱신 ===================");
logger.logInfo(record.getAttribute("EDU_STR_DT"));
logger.logInfo(record.getAttribute("EDU_END_DT"));
logger.logInfo(record.getAttribute("EDU_MM"));
logger.logInfo(record.getAttribute("TOT_EDU_TIME"));
logger.logInfo(record.getAttribute("EDU_PERS_NO"));
logger.logInfo(SESSION_USER_ID);
logger.logInfo(record.getAttribute("RACER_PERIO_NO"));
logger.logInfo("=================== 교육개요 갱신 ====================");
param.setValueParamter(i++, Util.trim(record.getAttribute("EDU_STR_DT")));
param.setValueParamter(i++, Util.trim(record.getAttribute("EDU_END_DT")));
param.setValueParamter(i++, (record.getAttribute("EDU_MM")));
param.setValueParamter(i++, (record.getAttribute("TOT_EDU_TIME")));
param.setValueParamter(i++, (record.getAttribute("EDU_PERS_NO")));
param.setValueParamter(i++, (record.getAttribute("EDU_MAN_NO")));
param.setValueParamter(i++, (record.getAttribute("EDU_WOMAN_NO")));
param.setValueParamter(i++, SESSION_USER_ID);
i = 0;
param.setWhereClauseParameter(i++, Util.trim(record.getAttribute("RACER_PERIO_NO")));
int dmlcount = this.getDao("candao").update("tbdn_cmpt_edu_outl_d06000002_un001", param);
return dmlcount;
}
/**
* <p> 시간배정표 갱신 </p>
* @param record PosRecord 데이타셋에 대한 하나의 레코드
* @return dmlcount int update 레코드 개수
* @throws none
*/
protected int updateEduAssign(PosRecord record)
{
PosParameter param = new PosParameter();
int i = 0;
logger.logInfo("==================== 시간배정표 갱신 ============================");
logger.logInfo(record.getAttribute("EDU_TIME"));
logger.logInfo(record.getAttribute("LECTR"));
logger.logInfo(record.getAttribute("BLNG"));
logger.logInfo(record.getAttribute("RMK"));
logger.logInfo(SESSION_USER_ID);
logger.logInfo(record.getAttribute("RACER_PERIO_NO"));
logger.logInfo(record.getAttribute("SECTN_CD"));
logger.logInfo(record.getAttribute("CRS_CD"));
logger.logInfo("==================== 시간배정표 갱신 ============================");
param.setValueParamter(i++, (record.getAttribute("EDU_TIME")));
param.setValueParamter(i++, Util.trim(record.getAttribute("LECTR")));
param.setValueParamter(i++, Util.trim(record.getAttribute("BLNG")));
param.setValueParamter(i++, Util.trim(record.getAttribute("RMK")));
param.setValueParamter(i++, SESSION_USER_ID);
i=0;
param.setWhereClauseParameter(i++, Util.trim(record.getAttribute("RACER_PERIO_NO")));
param.setWhereClauseParameter(i++, Util.trim(record.getAttribute("SECTN_CD")));
param.setWhereClauseParameter(i++, Util.trim(record.getAttribute("CRS_CD")));
int dmlcount = this.getDao("candao").update("tbdn_cmpt_edu_outl_d06000002_un002", param);
return dmlcount;
}
/**
* <p> 시간배정표 삭제</p>
* @param record PosRecord 데이타셋에 대한 하나의 레코드
* @return dmlcount int delete 레코드 개수
* @throws none
*/
protected int deleteEduAssign(PosRecord record)
{
logger.logInfo("====================== 시간배정표 삭제 ===========================");
logger.logInfo(record.getAttribute("RACER_PERIO_NO"));
logger.logInfo(record.getAttribute("SECTN_CD"));
logger.logInfo(record.getAttribute("CRS_CD"));
logger.logInfo("===================== 시간배정표 삭제 ============================");
PosParameter param = new PosParameter();
int i = 0;
param.setWhereClauseParameter(i++, Util.trim(record.getAttribute("RACER_PERIO_NO")));
param.setWhereClauseParameter(i++, Util.trim(record.getAttribute("SECTN_CD")));
param.setWhereClauseParameter(i++, Util.trim(record.getAttribute("CRS_CD")));
int dmlcount = this.getDao("candao").delete("tbdn_cmpt_edu_outl_d06000002_dn001", param);
return dmlcount;
}
}
| [
"jingug1004@gmail.com"
] | jingug1004@gmail.com |
5a7fc53ea524a50cb3e52f3d9703310b88e2698e | dfa1cc25b314c41522d5ec93f6a85081733a9653 | /city/src/androidTest/java/com/gdc/it99/city/ExampleInstrumentedTest.java | 67dbd78bff7258ad2ebcf46dcef044c4af69bd51 | [] | no_license | Caoyaping/Sunshine | 9cad69cf7f2b2e5a8a24052fc5d7013c6db47e34 | 8e62dca008c26d0a0df77790ee0d5031a1d20ed7 | refs/heads/master | 2021-04-15T18:44:30.413163 | 2018-03-31T04:07:24 | 2018-03-31T04:07:24 | 126,350,003 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 735 | java | package com.gdc.it99.city;
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() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.gdc.it99.city", appContext.getPackageName());
}
}
| [
"1012957507@qq.com"
] | 1012957507@qq.com |
1ce1915f1f73972a3797be80a2d60efe5ef39b90 | ad64b41c59478d7ef5532a9c5168000031b8a126 | /src/main/java/com/enjoy/spring12/Config12.java | 0fcad27b29fde512a445d19f45027f4533c5c7b1 | [] | no_license | snowofcloud/spring-project | 0109c80f8f1a96b5df9d28e124c28b5e765dfb13 | eca6de321f0240b1059ce3e1d09dc40911645380 | refs/heads/master | 2022-07-15T14:41:13.568309 | 2019-07-01T16:32:31 | 2019-07-01T16:32:31 | 183,046,402 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 438 | java | package com.enjoy.spring12;
import com.enjoy.spring9.bean.Moon;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
/**
* @auther xuxq
* @date 2019/5/10 22:57
*/
@Configuration
@ComponentScan("com.enjoy.spring12")
public class Config12 {
@Bean
public Moon getMoon(){
return new Moon();
}
}
| [
"xuxq1015@163.com"
] | xuxq1015@163.com |
1bbb3cfc722b31cff6f42297fc76f9fecceed62f | 1ce45d6046c2cb37740c2cc65c1d42f2e9bd97b2 | /src/chap13/textbook/s130601/Person.java | d0026c525b5372ae41a1b8a5659ce658fe18d509 | [] | no_license | hyelee-jo/java20200929 | 52f9c06078586abaa79179ed18df6834513897d0 | e4b29bd0b51e07e6ee6e014bd52a497f84dad354 | refs/heads/master | 2023-02-20T19:11:46.953681 | 2021-01-15T03:29:24 | 2021-01-15T03:29:24 | 299,485,580 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 202 | java | package chap13.textbook.s130601;
public class Person {
private String name;
public Person(String name) {
this.name = name;
}
@Override
public String toString() {
return this.name;
}
}
| [
"harbor_@naver.com"
] | harbor_@naver.com |
38464440e0a123229293121a33d8d160bcfdbe2c | 2bcb7d4ffa60aa8fa86f9c2120c08006b79cc05c | /webapp/src/main/java/net/friendface/friendface/model/dao/messages/PrivateMessageDAO.java | 3081dfe8192852b57343d78a306b0e9ea40bcd9b | [] | no_license | fink-stanislav/friendface | 898e2c6b0e14f118c5fa0fadc77da3d34ad00526 | b5248c8009ea7284134ae3ebd36179f38a8ef974 | refs/heads/master | 2016-09-11T09:30:12.742469 | 2011-06-12T20:14:52 | 2011-06-12T20:14:52 | 1,267,158 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 601 | java | package net.friendface.friendface.model.dao.messages;
import net.friendface.friendface.model.entities.PrivateMessage;
import net.friendface.friendface.model.entities.User;
import javax.jcr.RepositoryException;
import java.util.List;
/**
* Author: S. Fink
* Date: 04.06.11
* Time: 0:37
*/
public interface PrivateMessageDAO {
PrivateMessage getById(Integer id) throws RepositoryException;
void insertMessage(PrivateMessage message);
List<PrivateMessage> getUserMessages(User receiver, User sender) throws RepositoryException;
public List<User> getConversations(User user);
}
| [
"ravenhollm@gmail.com"
] | ravenhollm@gmail.com |
9b55fb62886c1f146db8ee46c885d497c281a4f0 | 2852e7b30b6a773087a6e6ead8363cf91af51c76 | /webStudy01/src/kr/or/ddit/servlet03/GetBTSMemberPageServlet.java | 61bba8a755035e1cc6a6cc66278d75e313b7857a | [] | no_license | dlgjsdl26/JSP-Spring | 5b02e43e649bf14476226a1ba81a91515db8fc33 | f8bc25e12a182768e74f05725aa0249461ef2d75 | refs/heads/master | 2022-12-14T08:22:37.442082 | 2020-09-07T09:06:39 | 2020-09-07T09:06:39 | 291,228,403 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,323 | java | package kr.or.ddit.servlet03;
import java.io.IOException;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
@WebServlet("/bts/getMemberPage.do")
public class GetBTSMemberPageServlet extends HttpServlet{
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
Map<String, String[]> btsMap = (Map<String, String[]>) getServletContext().getAttribute("btsMap");
String member = req.getParameter("member");
int statusCode = HttpServletResponse.SC_OK;
String msg = null;
if(StringUtils.isBlank(member)) {
statusCode = HttpServletResponse.SC_BAD_REQUEST;
msg = "필수 파라미터 누락";
}else {
if(!btsMap.containsKey(member)) {
statusCode = HttpServletResponse.SC_NOT_FOUND;
msg = member+" 은 존재하지 않습니다. ";
}
}
if(statusCode!=200) {
resp.sendError(statusCode, msg);
}else {
String[] memberInfo = btsMap.get(member);
String url = memberInfo[1];
req.getRequestDispatcher(url).forward(req, resp);
// resp.sendRedirect(req.getContextPath() + url);
}
}
}
| [
"dlgjsdl26@gmail.com"
] | dlgjsdl26@gmail.com |
dc47dea4c4a1eb0cdb29577459d469d6a8c51274 | c21bcbd2532f8b03a7d9d0de3db32fe75bd265e9 | /6-LinkedList/demo.java | 0950e1047464dfdc6aee558ef5e2bbb7a7638e74 | [] | no_license | dirchev/java-notes | 7f8a4f141191d27f740dc61d481c5d8f339caa78 | 5768ba8e53cc5eacf579a8e00c52f84d14e8bb7a | refs/heads/master | 2021-05-28T15:53:59.370005 | 2015-03-24T21:16:45 | 2015-03-24T21:16:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 569 | java | import java.util.*;
class Demo{
public static void main(String[] args){
String[] things = {"apples", "noobs", "pwnge", "bacon", "goATS"};
List<String> list1 = new LinkedList<String>();
for(String x: things){
list1.add(x);
}
String[] things2 = {"sausage", "bacon", "goats", "harrypotter"};
List<String> list2 = new LinkedList<String>();
for(String y: things2){
list2.add(y);
}
list1.addAll(list2);
list2 = null;
printMe(list1);
removeStuff(list1, 2, 5);
printMe(list1);
reverseMe(list1);
}
}
| [
"dimitar.mirchev96@gmail.com"
] | dimitar.mirchev96@gmail.com |
611b30f15d78a058adc03127f04bbc2c1104d603 | e9aae95929ef3b35a2e641ab9a80f74181635b4b | /Tree/src/myTree/ZKW.java | 368eb7772bd220010a79556940863d7166717e5c | [] | no_license | Yaser-wyx/Arithmetic | 24e91c2d8bb575019edc93b2eee9deb6d9c6b641 | c3f5d9e3ba1f808f4e9b68cef13f84de65def78a | refs/heads/master | 2021-09-11T15:24:04.108767 | 2018-04-09T07:27:00 | 2018-04-09T07:27:00 | 115,115,867 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,106 | java | package myTree;
/**
* Created with IntelliJ IDEA.
*
* @author wanyu
* @Date: 2018-01-25
* @Time: 22:59
* To change this template use File | Settings | File Templates.
* @desc 非递归版线段树
*/
public class ZKW {
private int[] tree;
private int M;
public ZKW(int n, int arr[]) {
int j = 0;
tree = new int[n << 2];
for (M = 1; M <= n + 1; M <<= 1) ;
for (int i = M + 1; i <= M + n; i++) tree[i] = arr[j++];
for (int i = M - 1; i != 0; i--) pushUp(i);
}
private void pushUp(int rt) {
tree[rt] = tree[rt << 1] + tree[rt << 1 | 1];
}
public void update(int p, int data) {
p += M;
tree[p] = data;
for (p >>= 1; p != 0; p >>= 1) pushUp(p);
}
public int query(int l, int r) {
int res = 0;
for (l = l + M - 1, r = r + M + 1; (l ^ r ^ 1) != 0; l >>= 1, r >>= 1) {
if ((~l & 1) != 0) {
res += tree[l ^ 1];
}
if ((r & 1) != 0) {
res += tree[r ^ 1];
}
}
return res;
}
}
| [
"gylxx51w@126.com"
] | gylxx51w@126.com |
fe9f14fb9207a4095bd9ad5665042430af7671bd | 5230a9000f4aaf29f3e3aabfcb61268510187dba | /src/main/java/com/gocardless/resources/CreditorBankAccount.java | 83b52784c0ad33742c39dff3829f4c47114d7540 | [
"MIT"
] | permissive | iandres/gocardless-pro-java | f27f55080e1a1e11d68274907a21c57a144bf0fa | a084db532eec7549ebd69693308ad991fbb57380 | refs/heads/master | 2021-01-22T23:16:20.886882 | 2016-04-14T11:07:56 | 2016-04-14T11:07:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,370 | java | package com.gocardless.resources;
import java.util.Map;
/**
* Represents a creditor bank account resource returned from the API.
*
* Creditor Bank Accounts hold the bank details of a
* [creditor](#whitelabel-partner-endpoints-creditors). These are the bank accounts which your
* [payouts](#core-endpoints-payouts) will be sent to.
*
* Note that creditor bank accounts must be
* unique, and so you will encounter a `bank_account_exists` error if you try to create a duplicate
* bank account. You may wish to handle this by updating the existing record instead, the ID of which
* will be provided as `links[creditor_bank_account]` in the error response.
*/
public class CreditorBankAccount {
private CreditorBankAccount() {
// blank to prevent instantiation
}
private String accountHolderName;
private String accountNumberEnding;
private String bankName;
private String countryCode;
private String createdAt;
private String currency;
private Boolean enabled;
private String id;
private Links links;
private Map<String, String> metadata;
/**
* Name of the account holder, as known by the bank. Usually this is the same as the name stored with
* the linked [creditor](#whitelabel-partner-endpoints-creditors). This field will be transliterated,
* upcased and truncated to 18 characters.
*/
public String getAccountHolderName() {
return accountHolderName;
}
/**
* Last two digits of account number.
*/
public String getAccountNumberEnding() {
return accountNumberEnding;
}
/**
* Name of bank, taken from the bank details.
*/
public String getBankName() {
return bankName;
}
/**
* [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)
* alpha-2 code. Defaults to the country code of the `iban` if supplied, otherwise is required.
*/
public String getCountryCode() {
return countryCode;
}
/**
* Fixed [timestamp](#overview-time-zones-dates), recording when this resource was created.
*/
public String getCreatedAt() {
return createdAt;
}
/**
* [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code, defaults to national
* currency of `country_code`.
*/
public String getCurrency() {
return currency;
}
/**
* Boolean value showing whether the bank account is enabled or disabled.
*/
public Boolean getEnabled() {
return enabled;
}
/**
* Unique identifier, beginning with "BA".
*/
public String getId() {
return id;
}
public Links getLinks() {
return links;
}
/**
* Key-value store of custom data. Up to 3 keys are permitted, with key names up to 50 characters and
* values up to 500 characters.
*/
public Map<String, String> getMetadata() {
return metadata;
}
public static class Links {
private Links() {
// blank to prevent instantiation
}
private String creditor;
/**
* ID of the [creditor](#whitelabel-partner-endpoints-creditors) that owns this bank account.
*/
public String getCreditor() {
return creditor;
}
}
}
| [
"robot+crankshaft@gocardless.com"
] | robot+crankshaft@gocardless.com |
303df519cc69cc4753e77797e4edf3d2b927b06c | 857e4a79b67cbd7314c6d710e45323930b0c8061 | /src/com/lw/novelreader/DownloadTask.java | 1602144daffa82d9096d5ea8352920cd56601e8e | [] | no_license | liu149339750/NovelReader | 6460d58aea37eaed5be38e3f82979dfe8a9dfc41 | f6dc7d051f218d90ec293320890c46bf2606462d | refs/heads/master | 2021-01-19T19:22:46.582037 | 2018-05-14T13:19:26 | 2018-05-14T13:19:26 | 88,413,841 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,507 | java | package com.lw.novelreader;
import java.io.IOException;
import java.net.SocketTimeoutException;
import java.util.ArrayList;
import java.util.List;
import org.greenrobot.eventbus.EventBus;
import org.htmlparser.util.ParserException;
import com.lw.bean.Chapter;
import com.lw.bean.Novel;
import com.lw.db.DBUtil;
import com.lw.novel.utils.FileUtil;
import com.lw.ttzw.DataQueryManager;
import android.os.AsyncTask;
import android.util.Log;
import android.util.SparseArray;
import okhttp3.OkHttpClient;
public class DownloadTask implements Runnable {
private static final String TAG = "DownloadTask";
public int startChapter;
public int length;
public boolean notify;
public Novel novel;
public boolean isStartDownload = false;
public boolean isCancel = false;
public boolean isFinish = false;
private SparseArray<List<Integer>> mDownloading = new SparseArray<List<Integer>>();
OkHttpClient client = new OkHttpClient();
public DownloadTask(Novel novel, int start, int len) {
this.startChapter = start;
this.length = len;
this.novel = novel;
}
public DownloadTask(Novel novel, int start, int len,boolean notify) {
this.startChapter = start;
this.length = len;
this.novel = novel;
this.notify = notify;
}
@Override
public void run() {
DownloadMessage startMsg = new DownloadMessage(novel.getId(), DownloadMessage.STATUS_START,this);
if(notify)
EventBus.getDefault().postSticky(startMsg);
int bookid = novel.getId();
System.out.println("DownloadTask bookid=" + bookid);
if (bookid <= 0) {
return;
}
isStartDownload = true;
List<Chapter> chapters = DBUtil.queryNovelChapterList(bookid);
if(startChapter < 0) {
startChapter = 0;
}
if(length < 0) {
length = chapters.size();
}
if (startChapter + length > chapters.size()) {
length = chapters.size() - startChapter;
}
int limit = startChapter + length;
for (int i = startChapter; i < limit; i++) {
if (isCancel) {
if(notify)
EventBus.getDefault().post(new DownloadMessage(novel.getId(), DownloadMessage.STATUS_CANCEL,this));
isStartDownload = false;
return;
}
final Chapter chapter = chapters.get(i);
if(notify)
EventBus.getDefault().post(new DownloadProgress(novel.getId(), i + 1, chapters.size()));
if (FileUtil.isChapterExist(novel,chapter))
continue;
List<Integer> ids = mDownloading.get(bookid);
if(ids != null) {
if(ids.contains(i)) {
continue;
} else {
ids.add(i);
}
} else {
ids = new ArrayList<Integer>();
ids.add(i);
mDownloading.put(bookid, ids);
}
boolean s = download(chapter);
if (!s) {
final int a = i;
final List<Integer> cids = ids;
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
for (int i = 0; i < 3; i++) {
Log.v(TAG, "USE async download again! chapter = " + chapter.getTitle() + ",i=" + i);
try {
String content = DataQueryManager.instance().getChapterContent(chapter.getUrl());
FileUtil.saveChapter(novel.getName(), novel.getAuthor(), chapter.getTitle(), content);
cids.remove(new Integer(a));
return null;
} catch (SocketTimeoutException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (ParserException e) {
e.printStackTrace();
}
}
cids.remove(new Integer(a));
return null;
}
}.execute();
} else {
ids.remove(new Integer(i));
}
}
isFinish = true;
isStartDownload = false;
if(notify)
EventBus.getDefault().removeStickyEvent(startMsg);
// if(notify)
EventBus.getDefault().post(new DownloadMessage(novel.getId(), DownloadMessage.STATUS_COMPLETED,this));
}
private boolean download(Chapter chapter) {
System.out.println("Download " + chapter.getTitle() + ",url = " + chapter.getUrl());
// Request request = new Request.Builder().url(chapter.getUrl()).build();
try {
// Response response = client.newCall(request).execute();
String content = DataQueryManager.instance().getChapterContent(chapter.getUrl());
FileUtil.saveChapter(novel.getName(), novel.getAuthor(), chapter.getTitle(), content);
return true;
} catch (SocketTimeoutException e) {
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParserException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return false;
}
}
| [
"hnyjliuwei@163.com"
] | hnyjliuwei@163.com |
b15243bde30ad9d0e1de7e311eed40bb88d8d28a | a0bf821677cd13a0f7c4f46151bc3baa9d45b470 | /app/src/main/java/com/xiaoyu/myweibo/widget/WeiBoTextView.java | 30ebe44669a68e81c919f7ccb7beb1dbc58b98c7 | [] | no_license | xylovezy3344/MyWeiBo | c59da7aafdb95338bfc22d711a35b2d838b8e9d7 | 3a266a4f7776c777ad07cb00a4c7c5ce8161a0e4 | refs/heads/master | 2020-05-21T22:41:53.882548 | 2016-10-17T06:50:15 | 2016-10-17T06:50:15 | 64,825,944 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,380 | java | package com.xiaoyu.myweibo.widget;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.TextPaint;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;
import com.xiaoyu.myweibo.base.BaseApplication;
import com.xiaoyu.myweibo.activity.TopicActivity;
import com.xiaoyu.myweibo.activity.UserHomeActivity;
import com.xiaoyu.myweibo.utils.AppManager;
/**
* @XX 变蓝色, 话题边蓝色以及设置点击事件 的自定义TextVIew
* Created by xiaoyu on 16-9-6.
*/
public class WeiboTextView extends TextView {
public WeiboTextView(Context context) {
super(context);
}
public WeiboTextView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public WeiboTextView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public WeiboTextView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
@Override
public void setText(CharSequence text, BufferType type) {
this.setMovementMethod(LinkMovementMethod.getInstance());
super.setText(changeText((String) text), type);
}
/**
* 微博文字变颜色 (@XX 变蓝色, 话题边蓝色以及设置点击事件)
* @param text
* @return
*/
private SpannableStringBuilder changeText(String text) {
SpannableStringBuilder spannable = new SpannableStringBuilder(text);
//@用户文字变蓝
int startIndex = text.indexOf("@");
int endIndex;
while (startIndex != -1) {
// 找到一个@的情况下,后面一定有冒号或者空格,或者@用户在结尾
int space = text.indexOf(" ", startIndex);
int colonEn = text.indexOf(":", startIndex);
int colonCn = text.indexOf(":", startIndex);
if (space == -1 && colonEn == -1 && colonCn == -1) {
endIndex = text.length();
} else if (space == -1 && colonEn == -1) {
endIndex = colonCn;
} else if (space == -1 && colonCn == -1) {
endIndex = colonEn;
} else if (colonEn == -1 && colonCn == -1) {
endIndex = space;
} else if (space == -1) {
endIndex = Math.min(colonEn, colonCn);
} else if (colonEn == -1) {
endIndex = Math.min(space, colonCn);
} else if (colonCn == -1) {
endIndex = Math.min(colonEn, space);
} else {
endIndex = Math.min(Math.min(space, colonEn), colonCn);
}
String userName = text.substring(startIndex + 1, endIndex);
spannable.setSpan(new TextClick(userName, "user_name"), startIndex, endIndex,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
startIndex = text.indexOf("@", endIndex);
}
// #...# 微博话题变蓝
int topicStartIndex = text.indexOf("#");
int topicEndIndex;
while (topicStartIndex != -1) {
topicEndIndex = text.indexOf("#", topicStartIndex + 1);
if (topicEndIndex != -1) {
String topic = text.substring(topicStartIndex + 1, topicEndIndex);
spannable.setSpan(new TextClick(topic, "topic"), topicStartIndex,
topicEndIndex + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
topicStartIndex = text.indexOf("#", topicEndIndex + 1);
}
}
// //微博短链接变蓝
// int urlStartIndex = text.indexOf("http://t.cn/");
// int urlEndIndex;
//
// while (urlStartIndex != -1) {
//
// urlEndIndex = urlStartIndex + 19;
//
// if (urlEndIndex != -1) {
//
// String shortUrl = text.substring(urlStartIndex , urlEndIndex);
//
// spannable.setSpan(new TextClick(shortUrl, "short_url"), urlStartIndex,
// urlEndIndex , Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
//
// urlStartIndex = text.indexOf("http://t.cn/", urlEndIndex + 1);
// }
// }
return spannable;
}
private class TextClick extends ClickableSpan {
private String text;
private String tag;
public TextClick(String text, String tag) {
super();
this.text = text;
this.tag = tag;
}
@Override
public void onClick(View view) {
Intent intent;
if ("user_name".equals(tag)) {
intent = new Intent(BaseApplication.context(), UserHomeActivity.class);
intent.putExtra("user_name", text);
} else {
intent = new Intent(BaseApplication.context(), TopicActivity.class);
intent.putExtra("topic", text);
}
AppManager.getAppManager().currentActivity().startActivity(intent);
}
@Override
public void updateDrawState(TextPaint ds) {
ds.setColor(Color.BLUE);
}
}
}
| [
"476354234@qq.com"
] | 476354234@qq.com |
f5c64ef9fc487974c286d1cc82eea4a6a8fe9b41 | 6dcb13378c518bf437188b791f74f1342384bef8 | /src/SmallestMultiple.java | df368c36978daeca55d4e1802885dc227d39946f | [] | no_license | RamolaWeb/ProjectEuler | cc0f7be2644c66b300267b9a87a5f59f21dfbea0 | 9eeff315b3e404adc0c682a205466b619e5d0198 | refs/heads/master | 2020-04-13T08:53:27.454309 | 2019-01-31T06:35:33 | 2019-01-31T06:35:33 | 163,095,133 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 602 | java | import java.io.InputStreamReader;
import java.util.Scanner;
public class SmallestMultiple {
public static void main(String[] args) {
Scanner scanner = new Scanner(new InputStreamReader(System.in));
int t = scanner.nextInt();
while (t-- > 0) {
int n = scanner.nextInt();
long ans = 1l;
for(long i=1;i<=n;i++) {
ans = (ans * i)/(gcd(ans, i));
}
System.out.println(ans);
}
}
public static long gcd (long a, long b) {
if(b == 0) return a;
return gcd(b, a%b);
}
}
| [
"sramola5@gmail.com"
] | sramola5@gmail.com |
28c5bfb4c6106a7948fc5da03835cb3d00ef86ff | bb6cf94ffcea85bfb06f639f2c424e4ab5a24445 | /rcm-rest_3.0/src/main/java/com/yk/process/service/impl/ProcessService.java | 652e1142efaaec4b3d47d8aede31334ab9864e5e | [] | no_license | wuguosong/riskcontrol | 4c0ef81763f45e87b1782e61ea45a13006ddde95 | d7a54a352f8aea0e00533d76954247a9143ae56d | refs/heads/master | 2022-12-18T03:12:52.449005 | 2020-03-10T15:38:39 | 2020-03-10T15:38:39 | 246,329,490 | 0 | 0 | null | 2022-12-16T05:02:28 | 2020-03-10T14:53:15 | JavaScript | UTF-8 | Java | false | false | 22,015 | java | package com.yk.process.service.impl;
import com.yk.process.dao.IProcessMapper;
import com.yk.process.entity.FlowConfig;
import com.yk.process.entity.NodeConfig;
import com.yk.process.entity.TaskConfig;
import com.yk.process.service.IProcessService;
import org.activiti.bpmn.converter.BpmnXMLConverter;
import org.activiti.bpmn.model.*;
import org.activiti.bpmn.model.Process;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.ProcessDefinition;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import java.io.InputStream;
import java.util.*;
/**
* 流程信息业务接口实现
* Created by LiPan on 2019/2/13.
*/
@Service
@Transactional
public class ProcessService implements IProcessService {
// 常量来自于表中查询的字段别名
private static final String ID_ = "ID_";
private static final String DEPLOYMENT_ID_ = "DEPLOYMENT_ID_";
private static final String ACT_ID_ = "ACT_ID_";
@Resource
private IProcessMapper processMapper;
@Resource
private RepositoryService repositoryService;
@Override
public List<HashMap<String, Object>> listProcessNode(String processKey, String businessKey) {
return processMapper.selectProcessNodeList(processKey, businessKey);
}
@Override
public List<HashMap<String, Object>> listProcessNodeDetail(String processKey, String businessKey) {
return processMapper.selectProcessNodeListDetail(processKey, businessKey);
}
@Override
public List<HashMap<String, Object>> listProcessDefinition(String processKey, String businessKey) {
return processMapper.selectProcessDefinitionList(processKey, businessKey, false);
}
@Override
public List<HashMap<String, Object>> listLastProcessDefinition(String processKey, String businessKey) {
return processMapper.selectProcessDefinitionList(processKey, businessKey, true);
}
@Override
public List<HashMap<String, Object>> listProcessConfiguration(String processKey, String businessKey) {
return processMapper.selectProcessConfiguration(processKey, businessKey);
}
@Override
public BpmnModel getBpmnModel(String processDefinitionId) {
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefinitionId).singleResult();
InputStream inputStream = repositoryService.getProcessModel(processDefinition.getId());
BpmnXMLConverter converter = new BpmnXMLConverter();
XMLInputFactory factory = XMLInputFactory.newInstance();
XMLStreamReader reader = null;
try {
reader = factory.createXMLStreamReader(inputStream);
} catch (XMLStreamException e) {
e.printStackTrace();
}
BpmnModel bpmnModel = converter.convertToBpmnModel(reader);
return bpmnModel;
}
@Override
public NodeConfig createNodeConfig(String processKey, String businessKey) {
List<HashMap<String, Object>> list = this.listLastProcessDefinition(processKey, businessKey);
if (CollectionUtils.isEmpty(list)) {
throw new RuntimeException("没有找到[" + processKey + "," + businessKey + "]的流程模型!");
}
NodeConfig nodeConfig = new NodeConfig();
HashMap<String, Object> data = list.get(0);
BpmnModel bpmnModel = this.getBpmnModel(String.valueOf(data.get(ID_)));
Process mainProcess = bpmnModel.getMainProcess();
Collection<FlowElement> flowElements = this.recursionFlowElements(mainProcess.getFlowElements());
List<TaskConfig> taskConfigs = new ArrayList<TaskConfig>();// 流程节点List
List<FlowConfig> flowConfigs = new ArrayList<FlowConfig>();// 流程流向List
int index = 1;
for (FlowElement flowElement : flowElements) {// 过滤非流向对象
if (!(flowElement instanceof SequenceFlow)) {
TaskConfig taskConfig = new TaskConfig();
taskConfig.setProcess(String.valueOf(data.get(ID_)));
taskConfig.setDeployment(new Long(String.valueOf(data.get(DEPLOYMENT_ID_))));
taskConfig.setIndex(index);
taskConfig.setName(flowElement.getName());
taskConfig.setId(flowElement.getId());
taskConfig.setType(flowElement.getClass().getSimpleName());
taskConfig.setInit(flowElement);
taskConfigs.add(taskConfig);
index++;
}
}
Map<String, TaskConfig> taskConfigMap = this.toTaskConfigMap(taskConfigs);
for (FlowElement flowElement : flowElements) {// 过滤流向元素对象
if (flowElement instanceof SequenceFlow) {
SequenceFlow sequenceFlow = (SequenceFlow) flowElement;
FlowConfig flowConfig = new FlowConfig();
flowConfig.setId(flowElement.getId());
flowConfig.setName(flowElement.getName());
flowConfig.setFrom(taskConfigMap.get(sequenceFlow.getSourceRef()));
flowConfig.setTo(taskConfigMap.get(sequenceFlow.getTargetRef()));
flowConfig.setInit(flowElement);
flowConfigs.add(flowConfig);
}
}
for (TaskConfig taskConfig : taskConfigs) { // 单独创建内部子流程之间的节点
if (SubProcess.class.getSimpleName().equals(taskConfig.getType())) {
Map<String, Collection<FlowElement>> subFlowsMap = this.getSubProcessFlowElements(mainProcess.getFlowElements(), taskConfig.getId());
if (subFlowsMap != null) {
Set<Map.Entry<String, Collection<FlowElement>>> entrySet = subFlowsMap.entrySet();
for (Iterator<Map.Entry<String, Collection<FlowElement>>> iterator = entrySet.iterator(); iterator.hasNext(); ) {
Map.Entry<String, Collection<FlowElement>> entry = iterator.next();
String key = entry.getKey();
Collection<FlowElement> value = entry.getValue();
for (FlowElement flowElement : value) {
if (flowElement instanceof StartEvent) {
FlowConfig flowConfig = new FlowConfig();
flowConfig.setId(key + ":" + flowElement.getId());
flowConfig.setName(key + "-->" + flowElement.getId());
flowConfig.setFrom(taskConfigMap.get(key));
flowConfig.setTo(taskConfigMap.get(flowElement.getId()));
flowConfig.setInit(null);
flowConfigs.add(flowConfig);
System.out.println(flowConfigs.size());
}
}
// 构造子流程流向集合
Map<String, FlowConfig> flowConfigMap = this.toFlowConfigMap(flowConfigs);
List<FlowConfig> subFlowConfigs = new ArrayList<FlowConfig>();
List<TaskConfig> subTaskConfigs = new ArrayList<TaskConfig>();
for (FlowElement flowElement : value) {
if (flowElement instanceof SequenceFlow) {
subFlowConfigs.add(flowConfigMap.get(flowElement.getId()));
} else {
subTaskConfigs.add(taskConfigMap.get(flowElement.getId()));
}
}
NodeConfig subNodeConfig = new NodeConfig();
subNodeConfig.setProcessKey(processKey);
subNodeConfig.setBusinessKey(businessKey);
subNodeConfig.setEdges(subFlowConfigs);
subNodeConfig.setStates(subTaskConfigs);
nodeConfig.getNodes().put(key, subNodeConfig);
}
}
}
}
nodeConfig.setStates(taskConfigs);
nodeConfig.setEdges(flowConfigs);
nodeConfig.setBusinessKey(businessKey);
nodeConfig.setProcessKey(processKey);
// 设置主流程节点信息
Map<String, NodeConfig> nodes = nodeConfig.getNodes();
List<FlowConfig> mainFlowConfigs = new ArrayList<FlowConfig>();
mainFlowConfigs.addAll(flowConfigs);
List<TaskConfig> mainTaskConfigs = new ArrayList<TaskConfig>();
mainTaskConfigs.addAll(taskConfigs);
Set<Map.Entry<String, NodeConfig>> entrySet = nodes.entrySet();
for (Iterator<Map.Entry<String, NodeConfig>> iterator = entrySet.iterator(); iterator.hasNext(); ) {
Map.Entry<String, NodeConfig> entry = iterator.next();
NodeConfig value = entry.getValue();
List<FlowConfig> otherFlowConfigs = value.getEdges();
List<TaskConfig> otherTaskConfigs = value.getStates();
mainFlowConfigs.removeAll(otherFlowConfigs);
mainTaskConfigs.removeAll(otherTaskConfigs);
}
// 主流流程节点需要移除虚拟的流向元素
for (Iterator<FlowConfig> iterator = mainFlowConfigs.listIterator(); iterator.hasNext(); ) {
FlowConfig mainFlowConfig = iterator.next();
if (mainFlowConfig.getInit() == null) {
iterator.remove();
}
}
NodeConfig mainNodeConfig = new NodeConfig();
mainNodeConfig.setStates(mainTaskConfigs);
mainNodeConfig.setEdges(mainFlowConfigs);
mainNodeConfig.setBusinessKey(businessKey);
mainNodeConfig.setProcessKey(processKey);
nodes.put(processKey, mainNodeConfig);
System.out.println(flowConfigs.size());
return nodeConfig;
}
@Override
public NodeConfig renderNodeConfig(NodeConfig nodeConfig) {
List<HashMap<String, Object>> processConfigurations = this.listProcessConfiguration(nodeConfig.getProcessKey(), nodeConfig.getBusinessKey());
// 设置节点状态
Map<String, TaskConfig> taskConfigMap = this.toTaskConfigMap(nodeConfig.getStates());
for (HashMap<String, Object> processConfiguration : processConfigurations) {
String id = String.valueOf(processConfiguration.get(ACT_ID_));
if (taskConfigMap.get(id) != null) {
taskConfigMap.get(id).setStatus(NodeConfig.ALREADY);
}
}
List<TaskConfig> taskConfigs = this.toTaskConfigList(taskConfigMap);
for (TaskConfig taskConfig : taskConfigs) {
if (StringUtils.isBlank(taskConfig.getStatus())) {
taskConfig.setStatus(NodeConfig.AGENCY);
}
}
// 设置流向状态
List<FlowConfig> flowConfigs = nodeConfig.getEdges();
for (int i = 1; i < processConfigurations.size(); i++) {
String alreadyFrom = String.valueOf(processConfigurations.get(i - 1).get(ACT_ID_));
String alreadyTo = String.valueOf(processConfigurations.get(i).get(ACT_ID_));
for (FlowConfig flowConfig : flowConfigs) {
String to = flowConfig.getTo().getId();
String from = flowConfig.getFrom().getId();
flowConfig.setFrom(taskConfigMap.get(from));// 更新来和去节点状态信息
flowConfig.setTo(taskConfigMap.get(to));
if (alreadyFrom.equals(from) && alreadyTo.equals(to)) {
flowConfig.setStatus(NodeConfig.ALREADY);
}
if (flowConfig.getInit() == null && NodeConfig.ALREADY.equals(flowConfig.getFrom().getStatus()) && NodeConfig.ALREADY.equals(flowConfig.getTo().getStatus())) {
flowConfig.setStatus(NodeConfig.ALREADY);// 子流程与开始的连线状态设置
}
}
}
for (FlowConfig flowConfig : flowConfigs) {
if (StringUtils.isBlank(flowConfig.getStatus())) {
flowConfig.setStatus(NodeConfig.AGENCY);
}
}
return nodeConfig;
}
/**
* 流向List转流向Map
*
* @param flowConfigs
* @return
*/
private Map<String, FlowConfig> toFlowConfigMap(List<FlowConfig> flowConfigs) {
Map<String, FlowConfig> flowConfigMap = new HashMap<String, FlowConfig>();
for (FlowConfig flowConfig : flowConfigs) {
flowConfigMap.put(flowConfig.getId(), flowConfig);
}
return flowConfigMap;
}
/**
* 迭代子流程下面的节点和流向
*
* @param flowElements
* @param subProcessId
* @return
*/
private Map<String, Collection<FlowElement>> getSubProcessFlowElements(Collection<FlowElement> flowElements, String subProcessId) {
Map<String, Collection<FlowElement>> allSubFlowElementsMap = new LinkedHashMap<String, Collection<FlowElement>>();
if (CollectionUtils.isNotEmpty(flowElements)) {
for (FlowElement flowElement : flowElements) {
if (flowElement instanceof SubProcess) {
SubProcess subProcess = (SubProcess) flowElement;
Collection<FlowElement> subFlowElements = subProcess.getFlowElements();
allSubFlowElementsMap.put(subProcessId, subFlowElements);
this.getSubProcessFlowElements(subFlowElements, flowElement.getId());
}
}
}
return allSubFlowElementsMap;
}
/**
* 迭代流程元素(如果一个流程有内部流程时候)
*
* @param flowElements
* @return Collection<FlowElement> 迭代结果
*/
@Override
public Collection<FlowElement> recursionFlowElements(Collection<FlowElement> flowElements) {
Collection<FlowElement> allFlowElements = new ArrayList<FlowElement>();
if (CollectionUtils.isNotEmpty(flowElements)) {
allFlowElements.addAll(flowElements);
for (FlowElement flowElement : flowElements) {
if (flowElement instanceof SubProcess) {
SubProcess subProcess = (SubProcess) flowElement;
Collection<FlowElement> subFlowElements = subProcess.getFlowElements();
allFlowElements.addAll(subFlowElements);
this.recursionFlowElements(subFlowElements);
}
}
}
return allFlowElements;
}
/**
* 将任务List变成任务Map
*
* @param taskConfigs 任务List
* @return Map<String, TaskConfig>
*/
private Map<String, TaskConfig> toTaskConfigMap(List<TaskConfig> taskConfigs) {
Map<String, TaskConfig> taskConfigMap = new LinkedHashMap<String, TaskConfig>();
for (TaskConfig taskConfig : taskConfigs) {
taskConfigMap.put(taskConfig.getId(), taskConfig);
}
return taskConfigMap;
}
/**
* 将任务Map变成任务List
*
* @param taskConfigMap 任务Map
* @return List<TaskConfig>
*/
private List<TaskConfig> toTaskConfigList(Map<String, TaskConfig> taskConfigMap) {
List<TaskConfig> taskConfigs = new ArrayList<TaskConfig>();
Set<Map.Entry<String, TaskConfig>> entrySet = taskConfigMap.entrySet();
for (Iterator<Map.Entry<String, TaskConfig>> iterator = entrySet.iterator(); iterator.hasNext(); ) {
Map.Entry<String, TaskConfig> entry = iterator.next();
taskConfigs.add(entry.getValue());
}
return taskConfigs;
}
@Override
public Map<String, FlowElement> listToMap(Collection<FlowElement> flowElements) {
Map<String, FlowElement> map = new LinkedHashMap<String, FlowElement>();
for (FlowElement flowElement : flowElements) {
map.put(flowElement.getId(), flowElement);
}
return map;
}
@Override
public Map<Class, List<FlowElement>> demergeFlowElements(Collection<FlowElement> flowElements) {
Map<Class, List<FlowElement>> map = new LinkedHashMap<Class, List<FlowElement>>();
List<FlowElement> subProcess = new ArrayList<FlowElement>();
List<FlowElement> exclusiveGateway = new ArrayList<FlowElement>();
List<FlowElement> parallelGateway = new ArrayList<FlowElement>();
List<FlowElement> sequenceFlow = new ArrayList<FlowElement>();
List<FlowElement> userTask = new ArrayList<FlowElement>();
List<FlowElement> startEvent = new ArrayList<FlowElement>();
List<FlowElement> endEvent = new ArrayList<FlowElement>();
for (FlowElement flowElement : flowElements) {
if (flowElement instanceof SubProcess) {
subProcess.add(flowElement);
}
if (flowElement instanceof ExclusiveGateway) {
exclusiveGateway.add(flowElement);
}
if (flowElement instanceof ParallelGateway) {
parallelGateway.add(flowElement);
}
if (flowElement instanceof SequenceFlow) {
sequenceFlow.add(flowElement);
}
if (flowElement instanceof UserTask) {
userTask.add(flowElement);
}
if (flowElement instanceof StartEvent) {
startEvent.add(flowElement);
}
if (flowElement instanceof EndEvent) {
endEvent.add(flowElement);
}
}
map.put(SubProcess.class, subProcess);
map.put(ExclusiveGateway.class, exclusiveGateway);
map.put(ParallelGateway.class, parallelGateway);
map.put(SequenceFlow.class, sequenceFlow);
map.put(UserTask.class, userTask);
map.put(StartEvent.class, startEvent);
map.put(EndEvent.class, endEvent);
return map;
}
@Override
public Map<Class, Map<String, FlowElement>> demergeFlowElementsMap(Collection<FlowElement> flowElements) {
Map<Class, List<FlowElement>> map = this.demergeFlowElements(flowElements);
Map<Class, Map<String, FlowElement>> all = new LinkedHashMap<Class, Map<String, FlowElement>>();
for (Iterator<Map.Entry<Class, List<FlowElement>>> iterator = map.entrySet().iterator(); iterator.hasNext(); ) {
Map.Entry<Class, List<FlowElement>> entry = iterator.next();
Class key = entry.getKey();
List<FlowElement> value = entry.getValue();
Map<String, FlowElement> sub = new LinkedHashMap<String, FlowElement>();
for (FlowElement flowElement : value) {
sub.put(flowElement.getId(), flowElement);
}
all.put(key, sub);
}
return all;
}
@Override
public List<FlowElement> getNextTaskFlowElement(String procDefId, String start, String end) {
Collection<FlowElement> flowElements = this.recursionFlowElements(this.getBpmnModel(procDefId).getMainProcess().getFlowElements());
return this.getNextTaskFlowElement(flowElements, null, start, end);
}
private List<FlowElement> getNextTaskFlowElement(Collection<FlowElement> flowElements, List<FlowElement> filter, String start, String end) {
List<FlowElement> finalFilter = new ArrayList<FlowElement>();
if (CollectionUtils.isNotEmpty(filter)) {
finalFilter.addAll(filter);
}
Map<String, FlowElement> flowElementMap = this.listToMap(flowElements);
Map<Class, List<FlowElement>> demergeFlowElements = this.demergeFlowElements(flowElements);
List<FlowElement> list = demergeFlowElements.get(SequenceFlow.class);
for (FlowElement flowElement : list) {
SequenceFlow sequenceFlow = (SequenceFlow) flowElement;
String key = sequenceFlow.getId();
String sourceRef = sequenceFlow.getSourceRef();
String targetRef = sequenceFlow.getTargetRef();
FlowElement target = flowElementMap.get(targetRef);
if (start.equals(sourceRef)) {
if (!(target instanceof EndEvent)) {
if (end.equals(targetRef)) {
finalFilter.add(flowElement);
if(target instanceof UserTask){
break;
}
} else {
if (!(target instanceof UserTask)) {
finalFilter.add(flowElement);
finalFilter = this.getNextTaskFlowElement(flowElements, finalFilter, targetRef, end);
}
}
}
}
}
return finalFilter;
}
@Override
public Map<String, Object> getNextTaskFlowElementVariable(String procDefId, String start, String end) {
List<FlowElement> flowElements = this.getNextTaskFlowElement(procDefId, start, end);
Map<String, Object> variable = new HashMap<String, Object>();
for(FlowElement flowElement : flowElements){
SequenceFlow sequenceFlow = (SequenceFlow)flowElement;
String conditionExpression = sequenceFlow.getConditionExpression();
if(StringUtils.isNotBlank(conditionExpression)){
conditionExpression = conditionExpression.replaceAll("[$|'{'|'|'}']+", "");
String[] array = conditionExpression.split("==");
if(ArrayUtils.isNotEmpty(array) && array.length > 1){
variable.put(array[0], array[1]);
}
}
}
return variable;
}
}
| [
"wjsxhclj@sina.com"
] | wjsxhclj@sina.com |
639903ecc124a7eae2a77124d6856b3ec99f2208 | 1afbd18ba1a68eef755c3edbeca2552ac4a23f82 | /src/main/java/com/weebindustry/weebjournal/models/User.java | 009566be97af438f2296a98721c4185e090f1bb0 | [
"MIT"
] | permissive | Aragami1408/WeebJournal | cea793465f7d5e3fdd969ce52b1ec8c63a69cd2e | 3c469cebf4dc5a5fbb6b2f6f900da174b745a96f | refs/heads/master | 2020-12-03T21:18:13.822354 | 2019-07-12T12:16:09 | 2019-07-12T12:16:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,210 | java | package com.weebindustry.weebjournal.models;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.*;
/**
* The warehouse to store every user that exist in weebjournal
*
*
*
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "users")
@JsonIgnoreProperties(value = {"password"})
public class User implements Serializable{
private static final long serialVersionUID = -8544233980065788815L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@NotBlank
@Column(name = "username")
private String username;
@NotBlank
@Column(name = "password")
private String password;
@Column(name = "joined_date")
@Temporal(TemporalType.TIMESTAMP)
private Date joinedDate;
@Column(name = "email")
private String email;
@Column(name = "biography")
private String biography;
@Column(name = "displayname")
private String displayname;
@Column(name="date_of_birth")
private Date dateOfBirth;
} | [
"vucaominh1408@gmail.com"
] | vucaominh1408@gmail.com |
a33ca1b2c41ec2871191a0be6736c6d906a40015 | 3ad7e5dceb86e67120f11e8dd1ca1e1166eeea7f | /3/Starting-Strom/src/main/java/pa3/spouts/WordReader.java | 690bf5903a481edd7b290ccec6a1f8776545c40e | [] | no_license | yh36/PA5673 | f99e2ba3e6cfb614b8fe89e7f10b8d9d8f549e82 | d7b81fab9601ed602583bd8ba67866bfaf9701ca | refs/heads/master | 2021-01-09T06:43:10.188835 | 2017-04-15T16:25:16 | 2017-04-15T16:25:16 | 81,036,174 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,547 | java | package pa3.spouts;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.Map;
import org.apache.storm.spout.SpoutOutputCollector;
import org.apache.storm.task.TopologyContext;
import org.apache.storm.topology.IRichSpout;
import org.apache.storm.topology.OutputFieldsDeclarer;
import org.apache.storm.tuple.Fields;
import org.apache.storm.tuple.Values;
public class WordReader implements IRichSpout {
private SpoutOutputCollector collector;
private FileReader fileReader;
private boolean completed = false;
private TopologyContext context;
public boolean isDistributed() {
return false;
}
@Override
public void ack(Object msgId) {
System.out.println("OK:" + msgId);
}
@Override
public void fail(Object msgId) {
System.out.println("FAIL:" + msgId);
}
@Override
public void close() {}
@Override
public void activate() {}
@Override
public void deactivate() {}
/**
* The only thing that the methods will do is emit each file line
*/
@Override
public void nextTuple() {
/**
* The nextuple it is called forever, so if we have been readed the file we
* will wait and then retrun
*/
if (completed) {
try {
Thread.sleep(1);
} catch (InterruptedException e) {
// Do nothing
}
return;
}
String str;
// Open the reader
BufferedReader reader = new BufferedReader(fileReader);
try {
// Read all lines
while ((str = reader.readLine()) != null) {
/**
* By each line emit a new value with the line as a tuple
*/
this.collector.emit(new Values(str), str);
}
} catch (Exception e) {
throw new RuntimeException("Error reading tuple", e);
} finally {
completed = true;
}
}
/**
* We will create the file and get the collector object
*/
@Override
public void open(Map conf, TopologyContext context,
SpoutOutputCollector collector) {
try {
this.context = context;
this.fileReader = new FileReader(conf.get("wordsFile").toString());
} catch (FileNotFoundException e) {
throw new RuntimeException("Error reading file[" + conf.get("wordsFile")
+ "]");
}
this.collector = collector;
}
/**
* Declare the output field "word"
*/
@Override
public void declareOutputFields(OutputFieldsDeclarer declarer) {
declarer.declare(new Fields("line"));
}
@Override
public Map<String, Object> getComponentConfiguration() {
return null;
}
}
| [
"yihou1003437319@hotmail.com"
] | yihou1003437319@hotmail.com |
2129e91e81c5b87f72b99c7d2e156eac0aa342ea | fcf886babeeb33477d3ad03b34d36c07a1aa982f | /ecsite/src/com/internousdev/ecsite/action/UserCreateConfirmAction.java | 13887b4928b0624bc73ba5763e2139b7e05091bb | [] | no_license | maedakenta/ecsite | fd833ba46517b10fce335136907b472cdae1907e | 398cb6a3039cd6822ba7b583d43348afa8a57b2a | refs/heads/master | 2020-07-11T17:10:58.618360 | 2019-08-30T04:08:53 | 2019-08-30T04:08:53 | 204,601,681 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,470 | java | package com.internousdev.ecsite.action;
import java.util.Map;
import org.apache.struts2.interceptor.SessionAware;
import com.opensymphony.xwork2.ActionSupport;
public class UserCreateConfirmAction extends ActionSupport implements SessionAware{
private String loginUserId;
private String loginPassword;
private String userName;
public Map<String,Object> session;
private String errorMessage;
public String execute(){
String result = SUCCESS;
if(!(loginUserId.equals(""))
&&!(loginPassword.equals(""))
&&!(userName.equals(""))){
session.put("loginUserId", loginUserId);
session.put("loginPassword",loginPassword);
session.put("userName", userName);
}else{
setErrorMessage("未入力の項目があります。");
result = ERROR;
}
return result;
}
public String getLoginUserId(){
return loginUserId;
}
public void setLoginUserId(String loginUserId){
this.loginUserId = loginUserId;
}
public String getLoginPassword(){
return loginPassword;
}
public void setLoginPassword(String loginPassword){
this.loginPassword = loginPassword;
}
public String getUserName(){
return userName;
}
public void setUserName(String userName){
this.userName = userName;
}
@Override
public void setSession(Map<String,Object>session){
this.session = session;
}
public String getErrorMessage(){
return errorMessage;
}
public void setErrorMessage(String errorMessage){
this.errorMessage = errorMessage;
}
}
| [
"nippp.107@gmail.com"
] | nippp.107@gmail.com |
e20f668ae7964c68767b84a604a082973b264dc0 | 016b97d8eeb5f3a45e299717fcc949a19235de07 | /src/com/xhermit/patterns/abstractfactory/FemaleFactory.java | 36aa78c4fffcb1f42f5dce90a387a9f5129fb033 | [
"MIT"
] | permissive | xhermit/patterns | 714f9e697198727d265d4e4246501a126e2432ba | 40776aa19860bdf3f0bd3f006e7f86e65fc08bb6 | refs/heads/master | 2021-05-01T01:56:12.554795 | 2017-01-24T02:17:41 | 2017-01-24T02:17:41 | 79,865,387 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 412 | java | package com.xhermit.patterns.abstractfactory;
/**
* 女性工厂
* @author xhermit
* @date Apr 28, 2011 9:47:17 AM
*/
public class FemaleFactory extends HumanFactory {
//生成女性美国人
public Human createAmerican() {
return createHuman(HumanEnum.AmericanFemale);
}
//生成女性中国人
public Human createChinese() {
return createHuman(HumanEnum.ChineseFemale);
}
}
| [
"xhermit@yeah.net"
] | xhermit@yeah.net |
bf750c8c0f9d2d1570c54f143b118da228685921 | 9d9dac9ada6cf3dd141f705400cd606937645a90 | /src/main/java/com/cbmwebdevelopment/project/Project.java | be547f120746e37cf13e4f535c21d47824641de7 | [] | no_license | cmeehan1991/Vulcan-Desktop | 36233cf6d4dc0cdbd29c543c907f49c6d3cbbd8c | daa4aead6369c3fe2ebf7ad255aa57e9a9233749 | refs/heads/master | 2020-04-25T23:03:35.710670 | 2019-04-18T20:14:47 | 2019-04-18T20:14:47 | 173,131,801 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,675 | 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 com.cbmwebdevelopment.project;
import com.cbmwebdevelopment.customers.Customer;
import com.cbmwebdevelopment.project.ProjectIncomeExpensesTableController.ProjectIncomeExpenses;
import com.cbmwebdevelopment.project.ProjectMaterialsTableController.ProjectMaterials;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
/**
*
* @author cmeehan
*/
public class Project {
private final SimpleStringProperty PROJECT_ID, STATUS, TITLE, CUSTOMER, START_DATE, DEADLINE, DESCRIPTION, TYPE, PRIMARY_ADDRESS, SECONDARY_ADDRESS, CITY, STATE, POSTAL_CODE;
private final ObservableList<ProjectIncomeExpenses> INCOME_EXPENSES;
private final ObservableList<ProjectMaterials> MATERIALS;
public Project(){
this.PROJECT_ID = new SimpleStringProperty();
this.STATUS = new SimpleStringProperty();
this.TITLE = new SimpleStringProperty();
this.CUSTOMER = new SimpleStringProperty();
this.START_DATE = new SimpleStringProperty();
this.DEADLINE = new SimpleStringProperty();
this.DESCRIPTION = new SimpleStringProperty();
this.TYPE = new SimpleStringProperty();
this.PRIMARY_ADDRESS = new SimpleStringProperty();
this.SECONDARY_ADDRESS = new SimpleStringProperty();
this.CITY = new SimpleStringProperty();
this.STATE = new SimpleStringProperty();
this.POSTAL_CODE = new SimpleStringProperty();
this.INCOME_EXPENSES = FXCollections.observableArrayList();
this.MATERIALS = FXCollections.observableArrayList();
}
public Project(String projectId, String status, String title, String customerId, String startDate, String deadline, String description, String type, String primaryAddress, String secondaryAddress, String city, String state, String postalCode, ObservableList<ProjectIncomeExpenses> incomeExpenses, ObservableList<ProjectMaterials> materials){
this.PROJECT_ID = new SimpleStringProperty(projectId);
this.STATUS = new SimpleStringProperty(status);
this.TITLE = new SimpleStringProperty(title);
this.CUSTOMER = new SimpleStringProperty(customerId);
this.START_DATE = new SimpleStringProperty(startDate);
this.DEADLINE = new SimpleStringProperty(deadline);
this.DESCRIPTION = new SimpleStringProperty(description);
this.TYPE = new SimpleStringProperty(type);
this.PRIMARY_ADDRESS = new SimpleStringProperty(primaryAddress);
this.SECONDARY_ADDRESS = new SimpleStringProperty(secondaryAddress);
this.CITY = new SimpleStringProperty(city);
this.STATE = new SimpleStringProperty(state);
this.POSTAL_CODE = new SimpleStringProperty(postalCode);
this.INCOME_EXPENSES = incomeExpenses;
this.MATERIALS = materials;
}
public void setProjectId(String val){
this.PROJECT_ID.set(val);
}
public String getProjectId(){
return this.PROJECT_ID.get();
}
public void setStatus(String val){
this.STATUS.set(val);
}
public String gettatus(){
return this.STATUS.get();
}
public void setTitle(String val){
this.TITLE.set(val);
}
public String getTitle(){
return this.TITLE.get();
}
public void setCustomer(String val){
this.CUSTOMER.set(val);
}
public String getCustomer(){
return this.CUSTOMER.get();
}
public void setStartDate(String val){
this.START_DATE.set(val);
}
public String getStartDate(){
return this.START_DATE.get();
}
public void setDeadline(String val){
this.DEADLINE.set(val);
}
public String getDeadline(){
return this.DEADLINE.get();
}
public void setDescription(String val){
this.DESCRIPTION.set(val);
}
public String getDescription(){
return this.DESCRIPTION.get();
}
public void setType(String val){
this.TYPE.set(val);
}
public String getType(){
return this.TYPE.get();
}
public void setPrimaryAddress(String val){
this.PRIMARY_ADDRESS.set(val);
}
public String getPrimaryAddress(){
return this.PRIMARY_ADDRESS.get();
}
public void setSecondaryAddress(String val){
this.SECONDARY_ADDRESS.set(val);
}
public String getSecondaryAddress(){
return this.SECONDARY_ADDRESS.get();
}
public void setCity(String val){
this.CITY.set(val);
}
public String getCity(){
return this.CITY.get();
}
public void setState(String val){
this.STATE.set(val);
}
public String getState(){
return this.STATE.get();
}
public void setPostalCode(String val){
this.POSTAL_CODE.set(val);
}
public String getPostalCode(){
return this.POSTAL_CODE.get();
}
public void setIncomeExpenses(ObservableList<ProjectIncomeExpenses> val){
this.INCOME_EXPENSES.setAll(val);
}
public ObservableList<ProjectIncomeExpenses> getIncomeExpenses(){
return this.INCOME_EXPENSES;
}
public void setMaterials(ObservableList<ProjectMaterials> val){
this.MATERIALS.setAll(val);
}
public ObservableList<ProjectMaterials> getMaterials(){
return this.MATERIALS;
}
}
| [
"cmeehan@elon.edu"
] | cmeehan@elon.edu |
bf7cabdda2737b6f605b188331698a4767cd2bf9 | de6ca5780b657b010a057bc2a20dd7b4c9f0ca9d | /src/main/java/uk/co/songt/ikea/model/Chair.java | 50652015a1eff7d6c3dc6ebd9aca91e5593a56aa | [] | no_license | iamtaosong/springboot-camel-gradle-demo | f64ff1d442cb50361d0f49009821c5023afbf91d | 6ef186ecdfc617cbd681c211833cca6ff97189a1 | refs/heads/master | 2020-09-15T10:47:34.019003 | 2016-08-22T00:59:16 | 2016-08-22T00:59:16 | 66,228,641 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 568 | java | package uk.co.songt.ikea.model;
/**
* Created by tsong on 22/08/2016.
*/
public class Chair {
private String url;
private String name;
private String price;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
}
| [
"tsong@UNKNOWN.(none)"
] | tsong@UNKNOWN.(none) |
5caf5e5d874e51d27c57b1e7ef6638b168a620fb | 604979a5460b72939a0ec4fc18b882985bfd2b0f | /src/main/java/utility/MessageListener.java | 756b0cb3e81f0c84ba02d0252ba790449e9803ab | [] | no_license | shafdanny/Telegram-Bot | 99e29d874b873e4b3fd4a3f8a9f50deda48d3d85 | 25185b604f084d97664e360201f52a42b62dc4d1 | refs/heads/master | 2020-04-15T15:39:59.983821 | 2016-01-31T20:08:32 | 2016-01-31T20:08:32 | 50,609,737 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 199 | java | package utility;
import object.Message;
import java.util.EventListener;
/**
* Created by shafiq on 29/01/16.
*/
public interface MessageListener {
void onNewMessageEvent(Message message);
}
| [
"shafdanny@gmail.com"
] | shafdanny@gmail.com |
9fdd09a48a65e71fdf7b10aaa27e757740550b54 | adfd903d3c76b7112d25c7c91dc117a882a82333 | /src/com/jeremyhaberman/raingauge/rest/method/RestMethod.java | 111576c0c5b1adfdf3c65e481c4d4164ffc30001 | [] | no_license | jeremyhaberman/raingauge | 81085e090b8f3e494db1fe54211308645633c85d | 27670902f693fb5e12bdb694f3890f1bada7a0de | refs/heads/master | 2021-01-25T06:37:17.088517 | 2012-09-13T01:11:10 | 2012-09-13T01:11:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 203 | java | package com.jeremyhaberman.raingauge.rest.method;
import com.jeremyhaberman.raingauge.rest.resource.Resource;
public interface RestMethod<T extends Resource>{
public RestMethodResult<T> execute();
}
| [
"jeremy@livefront.com"
] | jeremy@livefront.com |
0dbf24cab54b9a6bdfb7d7aa3017892d316de1be | ae8f6187b6f79f6768141ebb3d4a6ec0394e9ce9 | /ComparatorVSComparable/src/comparatorvscomparable/Employee.java | 46fcd5e2f6bd9da166f99ddff33af16613daf2cb | [] | no_license | navjit72/Java-2 | bc61a166553ba18bb7f46e43e70f990e40b9c42e | d4643f3cb3ba1c984e60a54687a37b06bf33ce11 | refs/heads/master | 2020-03-17T12:12:15.530842 | 2018-07-13T23:31:31 | 2018-07-13T23:31:31 | 133,578,190 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,112 | java | package comparatorvscomparable;
public class Employee implements Comparable<Employee>{
//declaring instance variables
private String name;
private double salary;
//default constructor
public Employee() {
}
//parameterized constructor
public Employee(String name, double salary) {
this.name = name;
this.salary = salary;
}
//getters and setters
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getSalary() {
return salary;
}
public void setSalary(double salary) {
this.salary = salary;
}
//to string method overriden to display employee information
@Override
public String toString() {
return "Employee{" + "name=" + name + ", salary=" + salary + '}';
}
@Override
public int compareTo(Employee t) {
if(this.getSalary() > t.getSalary())
return 1;
else if(this.getSalary()<t.getSalary())
return -1;
else
return 0;
}
}
| [
"n01267930@humbermail.ca"
] | n01267930@humbermail.ca |
ee1f6a3cde241ed6c3fbda4bd750ebab138c0067 | 8f571d75f89ea7f9d97880ceb4123e2664740627 | /FirebaseCRUD/firebaseCRUD/src/main/java/com/firebasecrud/Constants.java | 8b3083b5eb8ea0196582e6d3d28186e1ae640177 | [] | no_license | rgvmehta99/Firebase-CRUD | cee49bbcdc6a6ac398cb50234c59aebdf5f210e2 | 655599f24c9b39f7ad6a5baa9bbf48aa614df4d3 | refs/heads/master | 2021-05-05T19:28:56.956679 | 2018-01-18T04:44:08 | 2018-01-18T04:44:08 | 117,782,834 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 759 | java | package com.firebasecrud;
/**
* Created by dhaval.mehta on 16-Jan-18.
*/
public class Constants {
public static String USER_DB_TABLE = "user_database";
public static String USER_NAME_TITLE_KEY = "app_title";
public static String USER_NAME_TITLE = "Firebase CRUD";
/*
* Normal field
* */
public static String USER_FIREBASE_ID = "user_firebase_id";
public static String USER_NAME = "user_name";
public static String USER_EMAIL = "user_email";
public static String USER_MOBILE_NO = "user_mobile_no";
public static String USER_ADDRESS = "user_address";
public static String USER_CITY = "user_city";
public static String USER_COUNTRY = "user_country";
public static String USER_DOB = "user_dob";
}
| [
"rgvmehta99@gmail.com"
] | rgvmehta99@gmail.com |
8be38133a424133cc7e19e7bc05144ecaf9171ec | baad57c82fba1707cd901c8dcc01be5e7913f41e | /Grad/app/src/main/java/com/example/grad/ResultVideoRenderer.java | 41c166a31fee3438f431d6eda59e28902554b16c | [] | no_license | UncleBobbyB/HK | 34daefa4aeecc6d08bf2db63bdf53eaa985a5c8c | d9985d1fbceb9e1e164bc0a9764cca784fc3a464 | refs/heads/main | 2023-07-24T13:01:10.395274 | 2021-09-06T16:17:50 | 2021-09-06T16:17:50 | 403,687,307 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,964 | java | package com.example.grad;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import androidx.appcompat.app.AppCompatActivity;
import java.io.IOException;
import java.util.ArrayList;
public class ResultVideoRenderer extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_result_video_view);
Intent received_intent = getIntent();
final Bundle bundle = received_intent.getExtras();
ArrayList<float[]> points = new ArrayList<>();
if (bundle.getBoolean("flag") == true) {
for (int i = 0; i < 33; i++) {
float[] xy = bundle.getFloatArray("pose" + i);
points.add(xy);
// System.out.println(xy[0] + ", " + xy[1]);
}
}
Uri uri = bundle.getParcelable("uri");
Bitmap bitmap = null;
try {
bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), uri);
} catch (IOException e) {
e.printStackTrace();
}
// final Paint mPaint = new Paint();
// mPaint.setStrokeWidth((float) 20);
// mPaint.setColor(Color.RED);
// final Bitmap finalBitmap = bitmap;
// setContentView(new View(this) {
// @Override
// protected void onDraw(Canvas canvas) {
// canvas.drawBitmap(finalBitmap, 0, 0, mPaint);
// if (bundle.getBoolean("flag") == true) {
// for (int i = 0; i < 33; i++) {
// float[] xy = bundle.getFloatArray("pose"+i);
// canvas.drawPoint(xy[0], xy[1], mPaint);
// }
// }
// }
// });
setContentView(new ResultVideoView(this, points, bitmap));
}
} | [
"yingjiejiang@YingjiedeMacBook-Pro.local"
] | yingjiejiang@YingjiedeMacBook-Pro.local |
a12abe7c55cdc25e0efb9b6cdcb1820c54debe4d | 64391379ea21f073a6322f9923eb0244f1380b0d | /app/src/main/java/com/example/switchingmargins/MainActivity.java | 57c6390cfca7ab7ec91bdf3f57382412260b386b | [] | no_license | SurfDRED/Switchingmargins | 62492bba03860396668e2da39445bae33b72ffaa | 6160ef9f01ab03a43a34759963b138e3aa997041 | refs/heads/master | 2022-11-16T12:04:00.448026 | 2020-07-12T12:53:00 | 2020-07-12T12:53:00 | 279,063,159 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,009 | java | package com.example.switchingmargins;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import java.util.Locale;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private Toolbar myToolbar;
private Spinner mLanguageSpinner;
private Spinner mColorSpinner;
private Button mLanguageBtn;
private SharedPreferences mySettings;
private static final String MY_SETTINGS = "my_settings";
private static final String MY_SETTINGS_LANG = "my_lang";
private static final String MY_SETTINGS_SLANG = "my_sLang";
private static final String MY_SETTINGS_COLOR = "my_color";
private String mLang;
private int sLang;
private int mColor;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mySettings = getSharedPreferences(MY_SETTINGS, MODE_PRIVATE);
//язык
mLang = mySettings.getString(MY_SETTINGS_LANG, "");
//index языка для спинера
sLang = mySettings.getInt(MY_SETTINGS_SLANG, 0);
//тема и index для спинера
mColor = mySettings.getInt(MY_SETTINGS_COLOR, 0);
setConfig(mLang);
Selection.setsTheme(mColor);
Selection.onActivityCreateSetTheme(this);
setContentView(R.layout.activity_main);
myToolbar = findViewById(R.id.my_toolbar);
setSupportActionBar(myToolbar);
initViews();
}
private void initViews() {
mLanguageSpinner = findViewById(R.id.languageSpinner);
mColorSpinner = findViewById(R.id.colorSpinner);
mLanguageBtn = findViewById(R.id.btnLang);
spinnerLanguage();
spinnerColor();
mLanguageBtn.setOnClickListener(this);
}
private void setConfig(String mLanguage) {
Locale locale = new Locale(mLanguage);
Configuration config = new Configuration();
config.setLocale(locale);
getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());
}
private void spinnerLanguage() {
ArrayAdapter<CharSequence> adapterLanguage = ArrayAdapter.createFromResource(this, R.array.language, android.R.layout.simple_spinner_item);
adapterLanguage.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);
mLanguageSpinner.setAdapter(adapterLanguage);
mLanguageSpinner.setSelection(sLang);
mLanguageSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
sLang = mLanguageSpinner.getSelectedItemPosition();
languageSelection(sLang);
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
}
private void languageSelection(int languages) {
switch (languages) {
case 0:
mLang = "ru";
break;
case 1:
mLang = "en";
break;
case 2:
mLang = "de";
break;
}
}
private void spinnerColor() {
ArrayAdapter<CharSequence> adapterColor = ArrayAdapter.createFromResource(this, R.array.color, android.R.layout.simple_spinner_item);
adapterColor.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);
mColorSpinner.setAdapter(adapterColor);
mColorSpinner.setSelection(mColor);
mColorSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int a, long s) {
mColor = mColorSpinner.getSelectedItemPosition();
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
}
@Override
public void onClick(View v) {
setConfig(mLang);
SharedPreferences.Editor myEditor = mySettings.edit();
myEditor.putString(MY_SETTINGS_LANG, mLang);
myEditor.putInt(MY_SETTINGS_SLANG, sLang);
myEditor.putInt(MY_SETTINGS_COLOR, mColor);
myEditor.apply();
switch (mColor) {
case 0:
Selection.changeToTheme(this, Selection.THEME_BLACK);
break;
case 1:
Selection.changeToTheme(this, Selection.THEME_GREEN);
break;
case 2:
Selection.changeToTheme(this, Selection.THEME_BLUE);
break;
}
}
} | [
"dima1974tlt@gmail.com"
] | dima1974tlt@gmail.com |
9799c90da206fb59849416bf90872240f12a81ce | 3c4b098d2ec48510e8f6c8ed0bb4ac3b43966a9a | /src/org/asena/common/gCal.java | b1bcf90544aab0394333f5961d3b5925a2a3759c | [] | no_license | GholamaliIrani/glib | a9b460481c3cf65be8862bb44944995b6e01ebe1 | de9c157ed45f3d196d2c2e1678508ab8ec6e009f | refs/heads/master | 2021-01-11T22:00:26.164866 | 2017-01-13T20:28:29 | 2017-01-13T20:28:29 | 78,896,360 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,175 | java | package org.asena.common;
import java.sql.Timestamp;
import com.b4a.manamsoftware.PersianDate.ManamPersianDate;
public class gCal
{
public static Timestamp getCurrentDateTime()
{
return new java.sql.Timestamp(new java.util.Date().getTime());
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ PersianToGregorian
public static String PersianToGregorian (String S) throws InstantiationException, IllegalAccessException
{
String A[]=new String[3];
int B[]=new int[3];
A=S.split("/");
for(int i=0;i<A.length;i++)
B[i]=Integer.parseInt(A[i]);
String w=ManamPersianDate.class.newInstance().PersianToGregorian(B[0], B[1], B[2]);
return w;
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ GregorianToPersian
public static String GregorianToPersian (String S) throws InstantiationException, IllegalAccessException
{
String A[]=new String[3];
int B[]=new int[3];
A=S.split("/");
for(int i=0;i<A.length;i++)
B[i]=Integer.parseInt(A[i]);
String w=ManamPersianDate.class.newInstance().GregorianToPersian(B[0], B[1], B[2]);
return w;
}
}
| [
"irani.gholamali@gmail.com"
] | irani.gholamali@gmail.com |
c5092b5909ba178bfd3c83b188d50323f3d8f627 | cbfa916ce0391e137ea482d6da9248e53ff5493a | /src/test/java/test/eidos/kingchanllenge/TestKingKingSizeLimitedScore.java | 71990f704efe058b3da8f4e17852a10f43d085a2 | [
"Apache-2.0"
] | permissive | eidos71/kingchallenge | 4b85e606d08487947fc84260dc64b6afffbad393 | fbc6e83b2fd9986e343c0ef91398009203a9b505 | refs/heads/master | 2020-05-30T12:06:15.154792 | 2014-09-22T22:15:21 | 2014-09-22T22:15:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,828 | java | package test.eidos.kingchanllenge;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import java.util.HashSet;
import java.util.Set;
import org.easymock.EasyMock;
import org.easymock.EasyMockRunner;
import org.eidos.kingchallenge.domain.KingSizeLimitedScore;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(EasyMockRunner.class)
public class TestKingKingSizeLimitedScore extends AbstractKingTest {
private static final int maxElems = 300;
private KingSizeLimitedScore<String> tKgScore;
@Before
public void setup() {
int lvl=1;
tKgScore = new KingSizeLimitedScore<String>(lvl, maxElems);
for (int i=0; i<300;i++) {
tKgScore.add("e"+i);
}
}
@Test(expected=IllegalStateException.class)
public void testStringsLevel1() {
assertThat("", tKgScore.getCurrentElements().get(), equalTo(maxElems));
assertThat("", tKgScore.getMaxSize(), equalTo(maxElems));
assertThat("", tKgScore.getLevelScope(), equalTo(1));
//we remove one
tKgScore.remove("e1");
//we add one
tKgScore.add("e1");
//we die...
tKgScore.add("BOOOUM");
}
@Test
public void cleanAllElements() {
tKgScore.clear();
assertThat("", tKgScore.getCurrentElements().get(), equalTo(0));
assertThat("", tKgScore.getMaxSize(), equalTo(maxElems));
assertThat("", tKgScore.getLevelScope(), equalTo(1));
}
@Test
public void cleanRemoveCollections() {
Set<String> c= new HashSet<String>();
int numElemRemove=100;
for (int i=0; i<numElemRemove; i++) {
c.add("e"+i);
}
tKgScore.removeAll(c);
assertThat("", tKgScore.getCurrentElements().get(), equalTo(maxElems-numElemRemove));
assertThat("", tKgScore.getMaxSize(), equalTo(maxElems));
assertThat("", tKgScore.getLevelScope(), equalTo(1));
}
}
| [
"eidos33@gmail.com"
] | eidos33@gmail.com |
8784129ca74768fc7522cb1251886f1f268549e7 | 0a6b25b3bc7af8b6be0a8a33c3fd12d602d4a20e | /Covoiturage-Spring-WS/Covoiturage-Rest-OSM/src/test/java/allTests/AllTests.java | 91d91a04168bdb8c897411fb303f52840625a041 | [] | no_license | FlorentMouysset/IAWSProjet | 754cc893e65b5d588368eef2044f9eb66fef8411 | 01fdf50f8cfe51c12ef4948a46f7538d1fa43155 | refs/heads/master | 2016-09-06T11:43:38.780910 | 2013-04-05T20:04:32 | 2013-04-05T20:04:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 458 | java | package allTests;
import nomenclatureTests.CoordLongLatiTests;
import main.OSMTest;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
public class AllTests extends TestCase {
public static Test suite() {
TestSuite suite = new TestSuite(AllTests.class.getName());
//$JUnit-BEGIN$
suite.addTestSuite( OSMTest.class);
suite.addTestSuite( CoordLongLatiTests.class);
//$JUnit-END$
return suite;
}
}
| [
"mouysset.florent@gmail.com"
] | mouysset.florent@gmail.com |
f6dfa3ecec5e332d2ace5440029f6e01f6392e3e | 0ed1a75bcfdaa03e390037b8d11feef7a2be3cc0 | /generated/org.openhealthtools.mdht.uml.cda.vsbr/src/org/openhealthtools/mdht/uml/cda/vsbr/operations/PrenatalTestingandSurveillanceSectionOperations.java | bb6099b03ba6ac240665092859ba19b5a9952cd4 | [] | no_license | andypardue/mdht-models | f018bb47679efb8c790cf9150b52acacdb145373 | f023ce5cd98e2f33c8632a9d370fa4f9697e7a0d | refs/heads/develop | 2021-01-17T22:19:11.790776 | 2016-09-14T19:37:39 | 2016-09-14T19:37:39 | 68,233,776 | 0 | 0 | null | 2016-09-14T18:51:10 | 2016-09-14T18:51:09 | null | UTF-8 | Java | false | false | 26,126 | java | /**
*/
package org.openhealthtools.mdht.uml.cda.vsbr.operations;
import java.util.Map;
import org.eclipse.emf.common.util.BasicDiagnostic;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.common.util.DiagnosticChain;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.ocl.ParserException;
import org.eclipse.ocl.ecore.Constraint;
import org.eclipse.ocl.ecore.OCL;
import org.eclipse.ocl.expressions.OCLExpression;
import org.openhealthtools.mdht.uml.cda.operations.SectionOperations;
import org.openhealthtools.mdht.uml.cda.vsbr.PrenatalCare;
import org.openhealthtools.mdht.uml.cda.vsbr.PrenatalTestingandSurveillanceSection;
import org.openhealthtools.mdht.uml.cda.vsbr.VsbrPackage;
import org.openhealthtools.mdht.uml.cda.vsbr.util.VsbrValidator;
/**
* <!-- begin-user-doc -->
* A static utility class that provides operations related to '<em><b>Prenatal Testingand Surveillance Section</b></em>' model objects.
* <!-- end-user-doc -->
*
* <p>
* The following operations are supported:
* <ul>
* <li>{@link org.openhealthtools.mdht.uml.cda.vsbr.PrenatalTestingandSurveillanceSection#validatePrenatalTestingandSurveillanceSectionTemplateId(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Prenatal Testingand Surveillance Section Template Id</em>}</li>
* <li>{@link org.openhealthtools.mdht.uml.cda.vsbr.PrenatalTestingandSurveillanceSection#validatePrenatalTestingandSurveillanceSectionClassCode(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Prenatal Testingand Surveillance Section Class Code</em>}</li>
* <li>{@link org.openhealthtools.mdht.uml.cda.vsbr.PrenatalTestingandSurveillanceSection#validatePrenatalTestingandSurveillanceSectionMoodCode(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Prenatal Testingand Surveillance Section Mood Code</em>}</li>
* <li>{@link org.openhealthtools.mdht.uml.cda.vsbr.PrenatalTestingandSurveillanceSection#validatePrenatalTestingandSurveillanceSectionCode(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Prenatal Testingand Surveillance Section Code</em>}</li>
* <li>{@link org.openhealthtools.mdht.uml.cda.vsbr.PrenatalTestingandSurveillanceSection#validatePrenatalTestingandSurveillanceSectionText(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Prenatal Testingand Surveillance Section Text</em>}</li>
* <li>{@link org.openhealthtools.mdht.uml.cda.vsbr.PrenatalTestingandSurveillanceSection#validatePrenatalTestingandSurveillanceSectionPrenatalCare(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Prenatal Testingand Surveillance Section Prenatal Care</em>}</li>
* <li>{@link org.openhealthtools.mdht.uml.cda.vsbr.PrenatalTestingandSurveillanceSection#getPrenatalCare() <em>Get Prenatal Care</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class PrenatalTestingandSurveillanceSectionOperations extends SectionOperations {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected PrenatalTestingandSurveillanceSectionOperations() {
super();
}
/**
* The cached OCL expression body for the '{@link #validatePrenatalTestingandSurveillanceSectionTemplateId(PrenatalTestingandSurveillanceSection, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Prenatal Testingand Surveillance Section Template Id</em>}' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #validatePrenatalTestingandSurveillanceSectionTemplateId(PrenatalTestingandSurveillanceSection, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
* @generated
* @ordered
*/
protected static final String VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_TEMPLATE_ID__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP = "self.templateId->exists(id : datatypes::II | id.root = '2.16.840.1.113883.10.20.26.3')";
/**
* The cached OCL invariant for the '{@link #validatePrenatalTestingandSurveillanceSectionTemplateId(PrenatalTestingandSurveillanceSection, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Prenatal Testingand Surveillance Section Template Id</em>}' invariant operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #validatePrenatalTestingandSurveillanceSectionTemplateId(PrenatalTestingandSurveillanceSection, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
* @generated
* @ordered
*/
protected static Constraint VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_TEMPLATE_ID__DIAGNOSTIC_CHAIN_MAP__EOCL_INV;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* @param prenatalTestingandSurveillanceSection The receiving '<em><b>Prenatal Testingand Surveillance Section</b></em>' model object.
* @param diagnostics The chain of diagnostics to which problems are to be appended.
* @param context The cache of context-specific information.
* <!-- end-model-doc -->
* @generated
*/
public static boolean validatePrenatalTestingandSurveillanceSectionTemplateId(
PrenatalTestingandSurveillanceSection prenatalTestingandSurveillanceSection, DiagnosticChain diagnostics,
Map<Object, Object> context) {
if (VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_TEMPLATE_ID__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) {
OCL.Helper helper = EOCL_ENV.createOCLHelper();
helper.setContext(VsbrPackage.Literals.PRENATAL_TESTINGAND_SURVEILLANCE_SECTION);
try {
VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_TEMPLATE_ID__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_TEMPLATE_ID__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP);
} catch (ParserException pe) {
throw new UnsupportedOperationException(pe.getLocalizedMessage());
}
}
if (!EOCL_ENV.createQuery(
VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_TEMPLATE_ID__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(
prenatalTestingandSurveillanceSection)) {
if (diagnostics != null) {
diagnostics.add(new BasicDiagnostic(
Diagnostic.ERROR,
VsbrValidator.DIAGNOSTIC_SOURCE,
VsbrValidator.PRENATAL_TESTINGAND_SURVEILLANCE_SECTION__PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_TEMPLATE_ID,
org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE.getString(
"_UI_GenericInvariant_diagnostic",
new Object[] {
"PrenatalTestingandSurveillanceSectionTemplateId",
org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(
prenatalTestingandSurveillanceSection, context) }),
new Object[] { prenatalTestingandSurveillanceSection }));
}
return false;
}
return true;
}
/**
* The cached OCL expression body for the '{@link #validatePrenatalTestingandSurveillanceSectionClassCode(PrenatalTestingandSurveillanceSection, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Prenatal Testingand Surveillance Section Class Code</em>}' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #validatePrenatalTestingandSurveillanceSectionClassCode(PrenatalTestingandSurveillanceSection, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
* @generated
* @ordered
*/
protected static final String VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_CLASS_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP = "isDefined('classCode') and self.classCode=vocab::ActClass::DOCSECT";
/**
* The cached OCL invariant for the '{@link #validatePrenatalTestingandSurveillanceSectionClassCode(PrenatalTestingandSurveillanceSection, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Prenatal Testingand Surveillance Section Class Code</em>}' invariant operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #validatePrenatalTestingandSurveillanceSectionClassCode(PrenatalTestingandSurveillanceSection, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
* @generated
* @ordered
*/
protected static Constraint VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_CLASS_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* @param prenatalTestingandSurveillanceSection The receiving '<em><b>Prenatal Testingand Surveillance Section</b></em>' model object.
* @param diagnostics The chain of diagnostics to which problems are to be appended.
* @param context The cache of context-specific information.
* <!-- end-model-doc -->
* @generated
*/
public static boolean validatePrenatalTestingandSurveillanceSectionClassCode(
PrenatalTestingandSurveillanceSection prenatalTestingandSurveillanceSection, DiagnosticChain diagnostics,
Map<Object, Object> context) {
if (VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_CLASS_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) {
OCL.Helper helper = EOCL_ENV.createOCLHelper();
helper.setContext(VsbrPackage.Literals.PRENATAL_TESTINGAND_SURVEILLANCE_SECTION);
try {
VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_CLASS_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_CLASS_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP);
} catch (ParserException pe) {
throw new UnsupportedOperationException(pe.getLocalizedMessage());
}
}
if (!EOCL_ENV.createQuery(
VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_CLASS_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(
prenatalTestingandSurveillanceSection)) {
if (diagnostics != null) {
diagnostics.add(new BasicDiagnostic(
Diagnostic.ERROR,
VsbrValidator.DIAGNOSTIC_SOURCE,
VsbrValidator.PRENATAL_TESTINGAND_SURVEILLANCE_SECTION__PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_CLASS_CODE,
org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE.getString(
"_UI_GenericInvariant_diagnostic",
new Object[] {
"PrenatalTestingandSurveillanceSectionClassCode",
org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(
prenatalTestingandSurveillanceSection, context) }),
new Object[] { prenatalTestingandSurveillanceSection }));
}
return false;
}
return true;
}
/**
* The cached OCL expression body for the '{@link #validatePrenatalTestingandSurveillanceSectionMoodCode(PrenatalTestingandSurveillanceSection, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Prenatal Testingand Surveillance Section Mood Code</em>}' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #validatePrenatalTestingandSurveillanceSectionMoodCode(PrenatalTestingandSurveillanceSection, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
* @generated
* @ordered
*/
protected static final String VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_MOOD_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP = "isDefined('moodCode') and self.moodCode=vocab::ActMood::EVN";
/**
* The cached OCL invariant for the '{@link #validatePrenatalTestingandSurveillanceSectionMoodCode(PrenatalTestingandSurveillanceSection, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Prenatal Testingand Surveillance Section Mood Code</em>}' invariant operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #validatePrenatalTestingandSurveillanceSectionMoodCode(PrenatalTestingandSurveillanceSection, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
* @generated
* @ordered
*/
protected static Constraint VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_MOOD_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* @param prenatalTestingandSurveillanceSection The receiving '<em><b>Prenatal Testingand Surveillance Section</b></em>' model object.
* @param diagnostics The chain of diagnostics to which problems are to be appended.
* @param context The cache of context-specific information.
* <!-- end-model-doc -->
* @generated
*/
public static boolean validatePrenatalTestingandSurveillanceSectionMoodCode(
PrenatalTestingandSurveillanceSection prenatalTestingandSurveillanceSection, DiagnosticChain diagnostics,
Map<Object, Object> context) {
if (VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_MOOD_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) {
OCL.Helper helper = EOCL_ENV.createOCLHelper();
helper.setContext(VsbrPackage.Literals.PRENATAL_TESTINGAND_SURVEILLANCE_SECTION);
try {
VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_MOOD_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_MOOD_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP);
} catch (ParserException pe) {
throw new UnsupportedOperationException(pe.getLocalizedMessage());
}
}
if (!EOCL_ENV.createQuery(
VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_MOOD_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(
prenatalTestingandSurveillanceSection)) {
if (diagnostics != null) {
diagnostics.add(new BasicDiagnostic(
Diagnostic.ERROR,
VsbrValidator.DIAGNOSTIC_SOURCE,
VsbrValidator.PRENATAL_TESTINGAND_SURVEILLANCE_SECTION__PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_MOOD_CODE,
org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE.getString(
"_UI_GenericInvariant_diagnostic",
new Object[] {
"PrenatalTestingandSurveillanceSectionMoodCode",
org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(
prenatalTestingandSurveillanceSection, context) }),
new Object[] { prenatalTestingandSurveillanceSection }));
}
return false;
}
return true;
}
/**
* The cached OCL expression body for the '{@link #validatePrenatalTestingandSurveillanceSectionCode(PrenatalTestingandSurveillanceSection, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Prenatal Testingand Surveillance Section Code</em>}' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #validatePrenatalTestingandSurveillanceSectionCode(PrenatalTestingandSurveillanceSection, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
* @generated
* @ordered
*/
protected static final String VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP = "(self.code.oclIsUndefined() or self.code.isNullFlavorUndefined()) implies (not self.code.oclIsUndefined() and self.code.oclIsKindOf(datatypes::CE) and "
+ "let value : datatypes::CE = self.code.oclAsType(datatypes::CE) in "
+ "value.code = '57078-8' and value.codeSystem = '2.16.840.1.113883.6.1')";
/**
* The cached OCL invariant for the '{@link #validatePrenatalTestingandSurveillanceSectionCode(PrenatalTestingandSurveillanceSection, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Prenatal Testingand Surveillance Section Code</em>}' invariant operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #validatePrenatalTestingandSurveillanceSectionCode(PrenatalTestingandSurveillanceSection, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
* @generated
* @ordered
*/
protected static Constraint VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* @param prenatalTestingandSurveillanceSection The receiving '<em><b>Prenatal Testingand Surveillance Section</b></em>' model object.
* @param diagnostics The chain of diagnostics to which problems are to be appended.
* @param context The cache of context-specific information.
* <!-- end-model-doc -->
* @generated
*/
public static boolean validatePrenatalTestingandSurveillanceSectionCode(
PrenatalTestingandSurveillanceSection prenatalTestingandSurveillanceSection, DiagnosticChain diagnostics,
Map<Object, Object> context) {
if (VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) {
OCL.Helper helper = EOCL_ENV.createOCLHelper();
helper.setContext(VsbrPackage.Literals.PRENATAL_TESTINGAND_SURVEILLANCE_SECTION);
try {
VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP);
} catch (ParserException pe) {
throw new UnsupportedOperationException(pe.getLocalizedMessage());
}
}
if (!EOCL_ENV.createQuery(
VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(
prenatalTestingandSurveillanceSection)) {
if (diagnostics != null) {
diagnostics.add(new BasicDiagnostic(
Diagnostic.ERROR,
VsbrValidator.DIAGNOSTIC_SOURCE,
VsbrValidator.PRENATAL_TESTINGAND_SURVEILLANCE_SECTION__PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_CODE,
org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE.getString(
"_UI_GenericInvariant_diagnostic",
new Object[] {
"PrenatalTestingandSurveillanceSectionCode",
org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(
prenatalTestingandSurveillanceSection, context) }),
new Object[] { prenatalTestingandSurveillanceSection }));
}
return false;
}
return true;
}
/**
* The cached OCL expression body for the '{@link #validatePrenatalTestingandSurveillanceSectionText(PrenatalTestingandSurveillanceSection, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Prenatal Testingand Surveillance Section Text</em>}' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #validatePrenatalTestingandSurveillanceSectionText(PrenatalTestingandSurveillanceSection, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
* @generated
* @ordered
*/
protected static final String VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_TEXT__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP = "not self.text.oclIsUndefined()";
/**
* The cached OCL invariant for the '{@link #validatePrenatalTestingandSurveillanceSectionText(PrenatalTestingandSurveillanceSection, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Prenatal Testingand Surveillance Section Text</em>}' invariant operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #validatePrenatalTestingandSurveillanceSectionText(PrenatalTestingandSurveillanceSection, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
* @generated
* @ordered
*/
protected static Constraint VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_TEXT__DIAGNOSTIC_CHAIN_MAP__EOCL_INV;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* @param prenatalTestingandSurveillanceSection The receiving '<em><b>Prenatal Testingand Surveillance Section</b></em>' model object.
* @param diagnostics The chain of diagnostics to which problems are to be appended.
* @param context The cache of context-specific information.
* <!-- end-model-doc -->
* @generated
*/
public static boolean validatePrenatalTestingandSurveillanceSectionText(
PrenatalTestingandSurveillanceSection prenatalTestingandSurveillanceSection, DiagnosticChain diagnostics,
Map<Object, Object> context) {
if (VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_TEXT__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) {
OCL.Helper helper = EOCL_ENV.createOCLHelper();
helper.setContext(VsbrPackage.Literals.PRENATAL_TESTINGAND_SURVEILLANCE_SECTION);
try {
VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_TEXT__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_TEXT__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP);
} catch (ParserException pe) {
throw new UnsupportedOperationException(pe.getLocalizedMessage());
}
}
if (!EOCL_ENV.createQuery(
VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_TEXT__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(
prenatalTestingandSurveillanceSection)) {
if (diagnostics != null) {
diagnostics.add(new BasicDiagnostic(
Diagnostic.ERROR,
VsbrValidator.DIAGNOSTIC_SOURCE,
VsbrValidator.PRENATAL_TESTINGAND_SURVEILLANCE_SECTION__PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_TEXT,
org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE.getString(
"_UI_GenericInvariant_diagnostic",
new Object[] {
"PrenatalTestingandSurveillanceSectionText",
org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(
prenatalTestingandSurveillanceSection, context) }),
new Object[] { prenatalTestingandSurveillanceSection }));
}
return false;
}
return true;
}
/**
* The cached OCL expression body for the '{@link #validatePrenatalTestingandSurveillanceSectionPrenatalCare(PrenatalTestingandSurveillanceSection, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Prenatal Testingand Surveillance Section Prenatal Care</em>}' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #validatePrenatalTestingandSurveillanceSectionPrenatalCare(PrenatalTestingandSurveillanceSection, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
* @generated
* @ordered
*/
protected static final String VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_PRENATAL_CARE__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP = "self.entry->one(entry : cda::Entry | not entry.act.oclIsUndefined() and entry.act.oclIsKindOf(vsbr::Prenatal Care) and entry.typeCode = vocab::x_ActRelationshipEntry::COMP)";
/**
* The cached OCL invariant for the '{@link #validatePrenatalTestingandSurveillanceSectionPrenatalCare(PrenatalTestingandSurveillanceSection, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Prenatal Testingand Surveillance Section Prenatal Care</em>}' invariant operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #validatePrenatalTestingandSurveillanceSectionPrenatalCare(PrenatalTestingandSurveillanceSection, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
* @generated
* @ordered
*/
protected static Constraint VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_PRENATAL_CARE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* @param prenatalTestingandSurveillanceSection The receiving '<em><b>Prenatal Testingand Surveillance Section</b></em>' model object.
* @param diagnostics The chain of diagnostics to which problems are to be appended.
* @param context The cache of context-specific information.
* <!-- end-model-doc -->
* @generated
*/
public static boolean validatePrenatalTestingandSurveillanceSectionPrenatalCare(
PrenatalTestingandSurveillanceSection prenatalTestingandSurveillanceSection, DiagnosticChain diagnostics,
Map<Object, Object> context) {
if (VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_PRENATAL_CARE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) {
OCL.Helper helper = EOCL_ENV.createOCLHelper();
helper.setContext(VsbrPackage.Literals.PRENATAL_TESTINGAND_SURVEILLANCE_SECTION);
try {
VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_PRENATAL_CARE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_PRENATAL_CARE__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP);
} catch (ParserException pe) {
throw new UnsupportedOperationException(pe.getLocalizedMessage());
}
}
if (!EOCL_ENV.createQuery(
VALIDATE_PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_PRENATAL_CARE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(
prenatalTestingandSurveillanceSection)) {
if (diagnostics != null) {
diagnostics.add(new BasicDiagnostic(
Diagnostic.ERROR,
VsbrValidator.DIAGNOSTIC_SOURCE,
VsbrValidator.PRENATAL_TESTINGAND_SURVEILLANCE_SECTION__PRENATAL_TESTINGAND_SURVEILLANCE_SECTION_PRENATAL_CARE,
org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE.getString(
"_UI_GenericInvariant_diagnostic",
new Object[] {
"PrenatalTestingandSurveillanceSectionPrenatalCare",
org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(
prenatalTestingandSurveillanceSection, context) }),
new Object[] { prenatalTestingandSurveillanceSection }));
}
return false;
}
return true;
}
/**
* The cached OCL expression body for the '{@link #getPrenatalCare(PrenatalTestingandSurveillanceSection) <em>Get Prenatal Care</em>}' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPrenatalCare(PrenatalTestingandSurveillanceSection)
* @generated
* @ordered
*/
protected static final String GET_PRENATAL_CARE__EOCL_EXP = "self.getActs()->select(act : cda::Act | not act.oclIsUndefined() and act.oclIsKindOf(vsbr::Prenatal Care))->asSequence()->any(true).oclAsType(vsbr::Prenatal Care)";
/**
* The cached OCL query for the '{@link #getPrenatalCare(PrenatalTestingandSurveillanceSection) <em>Get Prenatal Care</em>}' query operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPrenatalCare(PrenatalTestingandSurveillanceSection)
* @generated
* @ordered
*/
protected static OCLExpression<EClassifier> GET_PRENATAL_CARE__EOCL_QRY;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static PrenatalCare getPrenatalCare(
PrenatalTestingandSurveillanceSection prenatalTestingandSurveillanceSection) {
if (GET_PRENATAL_CARE__EOCL_QRY == null) {
OCL.Helper helper = EOCL_ENV.createOCLHelper();
helper.setOperationContext(
VsbrPackage.Literals.PRENATAL_TESTINGAND_SURVEILLANCE_SECTION,
VsbrPackage.Literals.PRENATAL_TESTINGAND_SURVEILLANCE_SECTION.getEAllOperations().get(61));
try {
GET_PRENATAL_CARE__EOCL_QRY = helper.createQuery(GET_PRENATAL_CARE__EOCL_EXP);
} catch (ParserException pe) {
throw new UnsupportedOperationException(pe.getLocalizedMessage());
}
}
OCL.Query query = EOCL_ENV.createQuery(GET_PRENATAL_CARE__EOCL_QRY);
return (PrenatalCare) query.evaluate(prenatalTestingandSurveillanceSection);
}
} // PrenatalTestingandSurveillanceSectionOperations
| [
"seanmuir@c661c0d1-8b1f-4263-bf69-2f84893fd559"
] | seanmuir@c661c0d1-8b1f-4263-bf69-2f84893fd559 |
e16d74b5737280485d398b4b30143602cd5c6f1b | c46105cf45ae7e10310abca446c3710d4c99009c | /app/src/main/java/com/mancel/yann/go4lunch/utils/GeneratorBitmap.java | 358749b010aa4757694b0f24525d91903640c6de | [] | no_license | YannMancel/Go4Lunch | f003120fd0bd27761c4625d589f72fb7b8e9bf95 | 2310339163c83a92494ce72fb28bd1414766a502 | refs/heads/master | 2020-09-11T10:55:36.371892 | 2020-06-30T13:29:09 | 2020-06-30T13:29:09 | 222,040,947 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,698 | java | package com.mancel.yann.go4lunch.utils;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import com.google.android.gms.maps.model.BitmapDescriptor;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
/**
* Created by Yann MANCEL on 29/12/2019.
* Name of the project: Go4Lunch
* Name of the package: com.mancel.yann.go4lunch.utils
*/
public abstract class GeneratorBitmap {
// METHODS -------------------------------------------------------------------------------------
/**
* Converts a resource (vector) to {@link Bitmap}
* @param context a {@link Context}
* @param vectorResId an integer that corresponds to the resource
* @return a {@link BitmapDescriptor}
*/
@Nullable
public static BitmapDescriptor bitmapDescriptorFromVector(@NonNull final Context context, int vectorResId) {
final Drawable drawable = ContextCompat.getDrawable(context, vectorResId);
if (drawable == null) {
return null;
}
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
final Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(),
drawable.getIntrinsicHeight(),
Bitmap.Config.ARGB_8888);
final Canvas canvas = new Canvas(bitmap);
drawable.draw(canvas);
return BitmapDescriptorFactory.fromBitmap(bitmap);
}
}
| [
"yann.mancel@hotmail.fr"
] | yann.mancel@hotmail.fr |
8f14cb7b4d8e0f32c59179ab5c0dbd15a80d1f69 | 6691f01d0bad1c2ec22cf61e66d0aa5caea936a1 | /src/main/java/core/BasePage.java | 4391bbde8917680d538c5ddff56b61d7c9168c08 | [] | no_license | viniciusflores/provasicredi_ | f280ba15e93e69cd9b9d8eab51b86ee040f17744 | 2ce3a4f49fd9ef86db40844fb7590bc80824e6e6 | refs/heads/master | 2022-02-21T15:25:46.966996 | 2019-09-10T06:42:30 | 2019-09-10T06:42:30 | 207,423,740 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,583 | java | package core;
import java.util.List;
import java.util.NoSuchElementException;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.support.ui.WebDriverWait;
public class BasePage extends DriverFactory {
private JavascriptExecutor js = (JavascriptExecutor) driver;
public void write(By by, String texto) {
try {
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.elementToBeClickable(by));
driver.findElement(by).sendKeys(texto);
} catch (Exception e) {
throw new NoSuchElementException("Element not found: " + e.getMessage());
}
}
public String getText(By by) {
try {
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.presenceOfElementLocated(by));
return driver.findElement(by).getText();
} catch (Exception e) {
throw new NoSuchElementException("Element not found: " + e.getMessage());
}
}
public void clearTextField(By by) {
try {
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.presenceOfElementLocated(by));
driver.findElement(by).clear();
} catch (Exception e) {
throw new NoSuchElementException("Element not found: " + e.getMessage());
}
}
public void click(By by) {
try {
WebDriverWait wait = new WebDriverWait(driver, 15);
wait.until(ExpectedConditions.elementToBeClickable(by));
driver.findElement(by).click();
} catch (Exception e) {
throw new NoSuchElementException("Element not found: " + e.getMessage());
}
}
public void clickByText(String text) {
click(By.xpath("//*[contains(.,'" + text + "')]"));
}
public void clickByTextWithTag(String tagHTML, String text) {
click(By.xpath("//" + tagHTML + "[contains(.,'" + text + "')]"));
}
public boolean existElement(By by) {
try {
WebDriverWait wait = new WebDriverWait(driver, 15);
wait.until(ExpectedConditions.presenceOfElementLocated(by));
List<WebElement> elements = driver.findElements(by);
return elements.size() > 0;
} catch (Exception e) {
return false;
}
}
public boolean existElementByText(String text) {
return existElement(By.xpath("//*[contains(.,'" + text + "')]"));
}
public boolean elementIsClickable(By by) {
try {
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.elementToBeClickable(by));
List<WebElement> elements = driver.findElements(by);
return elements.size() > 0;
} catch (Exception e) {
return false;
}
}
public void waitingForTheElementToLoad(By by) {
while (!driver.findElement(by).isEnabled()) {
for (int i = 0; i < 60; i++) {
waitFixed(500);
}
}
}
public void scrollToElement(By by) {
WebElement element = driver.findElement(by);
Actions actions = new Actions(driver);
actions.moveToElement(element);
actions.perform();
}
public void scrollToElementByText(String text) {
scrollToElement(By.xpath("//*[contains(.,'" + text + "')]"));
}
public void scroolToElementWithJS(By by) {
WebElement element = driver.findElement(by);
((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView();", element);
}
public void commandJS(String command) {
js.executeScript(command, "");
}
public void commandJS(String command, String argument) {
js.executeScript(command, argument);
}
/**
* Busca o atributo de um campo na interface
*
* @param by
* @param atribute
* @return
*/
public String getAtributeFromHtml(By by, String atribute) {
try {
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.presenceOfElementLocated(by));
return driver.findElement(by).getAttribute(atribute);
} catch (Exception e) {
throw new NoSuchElementException("Element not found: " + e.getMessage());
}
}
/**
* Metodo usado para tratar uma string retornando somente os numericos
*
* @param
* @return
*/
public int returnOnlyNumbers(String word) {
return Integer.valueOf(word.replaceAll("[^\\d.]", ""));
}
public void waitFixed(long time) {
try {
Thread.sleep(time);
} catch (InterruptedException e) {
e.printStackTrace();
Thread.currentThread().interrupt();
}
}
/**
* Metodos que enviam comandos de tecla
*
*/
public void clickOnKeyEnter(By by) {
try {
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.presenceOfElementLocated(by));
driver.findElement(by).sendKeys(Keys.ENTER);
} catch (Exception e) {
throw new NoSuchElementException("Element not found: " + e.getMessage());
}
}
public void switchTo(int value) {
driver.switchTo().window((String) driver.getWindowHandles().toArray()[value]);
}
public Boolean elementIsDisabled(By by) {
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.presenceOfElementLocated(by));
if (driver.findElement(by).getAttribute("disabled") != null) {
return true;
}
return false;
}
public void changeSelectByValue(By by, String value) {
try{
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.presenceOfElementLocated(by));
Select select = new Select(driver.findElement(by));
select.selectByValue(value);
} catch (Exception e) {
throw new NoSuchElementException("Element not found: " + e.getMessage());
}
}
}
| [
"viniciusflores379@gmail.com"
] | viniciusflores379@gmail.com |
b51c91e1dfa8798ebf7ce57c1be913e4cf90991b | 0459f6b43871d645f5477a2a4a53f9c369c506ad | /ExOrganizarClasses/src/exorganizarclasses/Soldier.java | f4034040235f1fd7bea875538f6ce129264a0c08 | [] | no_license | GuiLakers/JavaCode | 2978bf72c7e33702d7429b7d2db36791a7b68a3e | a7993f6e5a757608b53760e6ce741f3750470c0a | refs/heads/master | 2021-06-18T16:20:49.417778 | 2021-02-15T06:03:34 | 2021-02-15T06:03:34 | 188,731,156 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 303 | java |
package exorganizarclasses;
public class Soldier implements Weapon {
public void getReady() {
System.out.println("Soldier getting ready for the battle");
}
public void fire() {
System.out.println("Soldier shooting: pow pow pow");
}
}
| [
"guifun08080808@gmail.com"
] | guifun08080808@gmail.com |
70cd57490d9056e17b2162341e8b193543f096fb | ee461488c62d86f729eda976b421ac75a964114c | /tags/HtmlUnit-2.9/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java | e80639e2273c5d72e8dd51b7876e71049c478124 | [
"Apache-2.0"
] | permissive | svn2github/htmlunit | 2c56f7abbd412e6d9e0efd0934fcd1277090af74 | 6fc1a7d70c08fb50fef1800673671fd9cada4899 | refs/heads/master | 2023-09-03T10:35:41.987099 | 2015-07-26T13:12:45 | 2015-07-26T13:12:45 | 37,107,064 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 26,144 | java | /*
* Copyright (c) 2002-2011 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.gargoylesoftware.htmlunit.html;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.xml.sax.Attributes;
import com.gargoylesoftware.htmlunit.BrowserVersionFeatures;
import com.gargoylesoftware.htmlunit.SgmlPage;
/**
* Element factory which creates elements by calling the constructor on a
* given {@link com.gargoylesoftware.htmlunit.html.HtmlElement} subclass.
* The constructor is expected to take 2 arguments of type
* {@link com.gargoylesoftware.htmlunit.html.HtmlPage} and {@link java.util.Map}
* where the first one is the owning page of the element, the second one is a map
* holding the initial attributes for the element.
*
* @version $Revision$
* @author <a href="mailto:cse@dynabean.de">Christian Sell</a>
* @author Ahmed Ashour
* @author David K. Taylor
* @author Ronald Brill
*/
class DefaultElementFactory implements IElementFactory {
static final List<String> SUPPORTED_TAGS_ = Arrays.asList(HtmlAbbreviated.TAG_NAME, HtmlAcronym.TAG_NAME,
HtmlAnchor.TAG_NAME, HtmlAddress.TAG_NAME, HtmlApplet.TAG_NAME, HtmlArea.TAG_NAME, HtmlAudio.TAG_NAME,
HtmlBackgroundSound.TAG_NAME, HtmlBase.TAG_NAME, HtmlBaseFont.TAG_NAME,
HtmlBidirectionalOverride.TAG_NAME, HtmlBig.TAG_NAME, HtmlBlink.TAG_NAME,
HtmlBlockQuote.TAG_NAME, HtmlBody.TAG_NAME, HtmlBold.TAG_NAME,
HtmlBreak.TAG_NAME, HtmlButton.TAG_NAME, HtmlCanvas.TAG_NAME, HtmlCaption.TAG_NAME,
HtmlCenter.TAG_NAME, HtmlCitation.TAG_NAME, HtmlCode.TAG_NAME,
HtmlDefinition.TAG_NAME, HtmlDefinitionDescription.TAG_NAME,
HtmlDeletedText.TAG_NAME, HtmlDirectory.TAG_NAME,
HtmlDivision.TAG_NAME, HtmlDefinitionList.TAG_NAME,
HtmlDefinitionTerm.TAG_NAME, HtmlEmbed.TAG_NAME,
HtmlEmphasis.TAG_NAME, HtmlFieldSet.TAG_NAME,
HtmlFont.TAG_NAME, HtmlForm.TAG_NAME,
HtmlFrame.TAG_NAME, HtmlFrameSet.TAG_NAME, HtmlHeading1.TAG_NAME,
HtmlHeading2.TAG_NAME, HtmlHeading3.TAG_NAME,
HtmlHeading4.TAG_NAME, HtmlHeading5.TAG_NAME,
HtmlHeading6.TAG_NAME, HtmlHead.TAG_NAME,
HtmlHorizontalRule.TAG_NAME, HtmlHtml.TAG_NAME, HtmlInlineFrame.TAG_NAME,
HtmlInlineQuotation.TAG_NAME,
HtmlImage.TAG_NAME, HtmlInsertedText.TAG_NAME, HtmlIsIndex.TAG_NAME,
HtmlItalic.TAG_NAME, HtmlKeyboard.TAG_NAME, HtmlLabel.TAG_NAME,
HtmlLegend.TAG_NAME, HtmlListing.TAG_NAME, HtmlListItem.TAG_NAME,
HtmlLink.TAG_NAME, HtmlMap.TAG_NAME, HtmlMarquee.TAG_NAME,
HtmlMenu.TAG_NAME, HtmlMeta.TAG_NAME, HtmlMultiColumn.TAG_NAME,
HtmlNoBreak.TAG_NAME, HtmlNoEmbed.TAG_NAME, HtmlNoFrames.TAG_NAME,
HtmlNoScript.TAG_NAME, HtmlObject.TAG_NAME, HtmlOrderedList.TAG_NAME,
HtmlOptionGroup.TAG_NAME, HtmlOption.TAG_NAME, HtmlParagraph.TAG_NAME,
HtmlParameter.TAG_NAME, HtmlPlainText.TAG_NAME, HtmlPreformattedText.TAG_NAME,
HtmlS.TAG_NAME, HtmlSample.TAG_NAME,
HtmlScript.TAG_NAME, HtmlSelect.TAG_NAME, HtmlSmall.TAG_NAME,
HtmlSource.TAG_NAME, HtmlSpacer.TAG_NAME, HtmlSpan.TAG_NAME,
HtmlStrike.TAG_NAME, HtmlStrong.TAG_NAME, HtmlStyle.TAG_NAME,
HtmlSubscript.TAG_NAME, HtmlSuperscript.TAG_NAME,
HtmlTable.TAG_NAME, HtmlTableColumn.TAG_NAME, HtmlTableColumnGroup.TAG_NAME,
HtmlTableBody.TAG_NAME, HtmlTableDataCell.TAG_NAME, HtmlTableHeaderCell.TAG_NAME,
HtmlTableRow.TAG_NAME, HtmlTextArea.TAG_NAME, HtmlTableFooter.TAG_NAME,
HtmlTableHeader.TAG_NAME, HtmlTeletype.TAG_NAME, HtmlTitle.TAG_NAME,
HtmlUnderlined.TAG_NAME, HtmlUnorderedList.TAG_NAME,
HtmlVariable.TAG_NAME, HtmlVideo.TAG_NAME,
HtmlWordBreak.TAG_NAME, HtmlExample.TAG_NAME
);
/**
* @param page the owning page
* @param tagName the HTML tag name
* @param attributes initial attributes, possibly <code>null</code>
* @return the newly created element
*/
public HtmlElement createElement(final SgmlPage page, final String tagName, final Attributes attributes) {
return createElementNS(page, null, tagName, attributes);
}
/**
* @param page the owning page
* @param namespaceURI the URI that identifies an XML namespace
* @param qualifiedName the qualified name of the element type to instantiate
* @param attributes initial attributes, possibly <code>null</code>
* @return the newly created element
*/
public HtmlElement createElementNS(final SgmlPage page, final String namespaceURI,
final String qualifiedName, final Attributes attributes) {
final Map<String, DomAttr> attributeMap = setAttributes(page, attributes);
final HtmlElement element;
final String tagName;
final int colonIndex = qualifiedName.indexOf(':');
if (colonIndex == -1) {
tagName = qualifiedName.toLowerCase();
}
else {
tagName = qualifiedName.substring(colonIndex + 1).toLowerCase();
}
// final Class<? extends HtmlElement> klass = JavaScriptConfiguration.getHtmlTagNameMapping().get(tagName);
// if (klass != null) {
// String jsClassName = JavaScriptConfiguration.getHtmlJavaScriptMapping().get(klass).getName();
// jsClassName = jsClassName.substring(jsClassName.lastIndexOf('.') + 1);
// final ClassConfiguration config =
// JavaScriptConfiguration.getInstance(page.getWebClient().getBrowserVersion())
// .getClassConfiguration(jsClassName);
// if (config == null) {
// return UnknownElementFactory.instance.createElementNS(
// page, namespaceURI, qualifiedName, attributes);
// }
// }
if (tagName.equals(HtmlAbbreviated.TAG_NAME)) {
element = new HtmlAbbreviated(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlAcronym.TAG_NAME)) {
element = new HtmlAcronym(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlAddress.TAG_NAME)) {
element = new HtmlAddress(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlAnchor.TAG_NAME)) {
element = new HtmlAnchor(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlApplet.TAG_NAME)) {
element = new HtmlApplet(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlArea.TAG_NAME)) {
element = new HtmlArea(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlAudio.TAG_NAME)) {
if (page.getWebClient().getBrowserVersion().hasFeature(BrowserVersionFeatures.HTML5_TAGS)) {
element = new HtmlAudio(namespaceURI, qualifiedName, page, attributeMap);
}
else {
return UnknownElementFactory.instance.createElementNS(page, namespaceURI, qualifiedName, attributes);
}
}
else if (tagName.equals(HtmlBackgroundSound.TAG_NAME)) {
element = new HtmlBackgroundSound(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlBase.TAG_NAME)) {
element = new HtmlBase(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlBaseFont.TAG_NAME)) {
element = new HtmlBaseFont(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlBidirectionalOverride.TAG_NAME)) {
element = new HtmlBidirectionalOverride(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlBig.TAG_NAME)) {
element = new HtmlBig(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlBlink.TAG_NAME)) {
element = new HtmlBlink(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlBlockQuote.TAG_NAME)) {
element = new HtmlBlockQuote(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlBody.TAG_NAME)) {
element = new HtmlBody(namespaceURI, qualifiedName, page, attributeMap, false);
}
else if (tagName.equals(HtmlBold.TAG_NAME)) {
element = new HtmlBold(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlBreak.TAG_NAME)) {
element = new HtmlBreak(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlButton.TAG_NAME)) {
element = new HtmlButton(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlCanvas.TAG_NAME)) {
if (page.getWebClient().getBrowserVersion().hasFeature(BrowserVersionFeatures.CANVAS)) {
element = new HtmlCanvas(namespaceURI, qualifiedName, page, attributeMap);
}
else {
return UnknownElementFactory.instance.createElementNS(page, namespaceURI, qualifiedName, attributes);
}
}
else if (tagName.equals(HtmlCaption.TAG_NAME)) {
element = new HtmlCaption(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlCenter.TAG_NAME)) {
element = new HtmlCenter(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlCitation.TAG_NAME)) {
element = new HtmlCitation(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlCode.TAG_NAME)) {
element = new HtmlCode(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlDefinition.TAG_NAME)) {
element = new HtmlDefinition(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlDefinitionDescription.TAG_NAME)) {
element = new HtmlDefinitionDescription(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlDefinitionList.TAG_NAME)) {
element = new HtmlDefinitionList(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlDefinitionTerm.TAG_NAME)) {
element = new HtmlDefinitionTerm(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlDeletedText.TAG_NAME)) {
element = new HtmlDeletedText(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlDivision.TAG_NAME)) {
element = new HtmlDivision(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlEmbed.TAG_NAME)) {
element = new HtmlEmbed(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlEmphasis.TAG_NAME)) {
element = new HtmlEmphasis(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlFieldSet.TAG_NAME)) {
element = new HtmlFieldSet(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlFont.TAG_NAME)) {
element = new HtmlFont(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlForm.TAG_NAME)) {
element = new HtmlForm(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlFrame.TAG_NAME)) {
if (attributeMap != null) {
final DomAttr srcAttribute = attributeMap.get("src");
if (srcAttribute != null) {
srcAttribute.setValue(srcAttribute.getValue().trim());
}
}
element = new HtmlFrame(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlFrameSet.TAG_NAME)) {
element = new HtmlFrameSet(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlHead.TAG_NAME)) {
element = new HtmlHead(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlHeading1.TAG_NAME)) {
element = new HtmlHeading1(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlHeading2.TAG_NAME)) {
element = new HtmlHeading2(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlHeading3.TAG_NAME)) {
element = new HtmlHeading3(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlHeading4.TAG_NAME)) {
element = new HtmlHeading4(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlHeading5.TAG_NAME)) {
element = new HtmlHeading5(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlHeading6.TAG_NAME)) {
element = new HtmlHeading6(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlHorizontalRule.TAG_NAME)) {
element = new HtmlHorizontalRule(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlHtml.TAG_NAME)) {
element = new HtmlHtml(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlImage.TAG_NAME)) {
element = new HtmlImage(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlInlineFrame.TAG_NAME)) {
if (attributeMap != null) {
final DomAttr srcAttribute = attributeMap.get("src");
if (srcAttribute != null) {
srcAttribute.setValue(srcAttribute.getValue().trim());
}
}
element = new HtmlInlineFrame(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlInlineQuotation.TAG_NAME)) {
element = new HtmlInlineQuotation(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlInsertedText.TAG_NAME)) {
element = new HtmlInsertedText(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlIsIndex.TAG_NAME)) {
element = new HtmlIsIndex(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlItalic.TAG_NAME)) {
element = new HtmlItalic(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlKeyboard.TAG_NAME)) {
element = new HtmlKeyboard(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlLabel.TAG_NAME)) {
element = new HtmlLabel(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlLegend.TAG_NAME)) {
element = new HtmlLegend(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlLink.TAG_NAME)) {
element = new HtmlLink(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlListing.TAG_NAME)) {
element = new HtmlListing(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlListItem.TAG_NAME)) {
element = new HtmlListItem(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlMap.TAG_NAME)) {
element = new HtmlMap(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlMarquee.TAG_NAME)) {
element = new HtmlMarquee(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlMenu.TAG_NAME)) {
element = new HtmlMenu(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlMeta.TAG_NAME)) {
element = new HtmlMeta(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlMultiColumn.TAG_NAME)) {
element = new HtmlMultiColumn(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlNoBreak.TAG_NAME)) {
element = new HtmlNoBreak(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlNoEmbed.TAG_NAME)) {
element = new HtmlNoEmbed(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlNoFrames.TAG_NAME)) {
element = new HtmlNoFrames(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlNoScript.TAG_NAME)) {
element = new HtmlNoScript(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlObject.TAG_NAME)) {
element = new HtmlObject(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlOption.TAG_NAME)) {
element = new HtmlOption(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlOptionGroup.TAG_NAME)) {
element = new HtmlOptionGroup(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlOrderedList.TAG_NAME)) {
element = new HtmlOrderedList(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlParagraph.TAG_NAME)) {
element = new HtmlParagraph(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlParameter.TAG_NAME)) {
element = new HtmlParameter(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlPlainText.TAG_NAME)) {
element = new HtmlPlainText(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlPreformattedText.TAG_NAME)) {
element = new HtmlPreformattedText(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlS.TAG_NAME)) {
element = new HtmlS(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlSample.TAG_NAME)) {
element = new HtmlSample(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlScript.TAG_NAME)) {
element = new HtmlScript(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlSelect.TAG_NAME)) {
element = new HtmlSelect(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlSmall.TAG_NAME)) {
element = new HtmlSmall(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlSource.TAG_NAME)) {
if (page.getWebClient().getBrowserVersion().hasFeature(BrowserVersionFeatures.HTML5_TAGS)) {
element = new HtmlSource(namespaceURI, qualifiedName, page, attributeMap);
}
else {
return UnknownElementFactory.instance.createElementNS(page, namespaceURI, qualifiedName, attributes);
}
}
else if (tagName.equals(HtmlSpacer.TAG_NAME)) {
element = new HtmlSpacer(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlSpan.TAG_NAME)) {
element = new HtmlSpan(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlStrike.TAG_NAME)) {
element = new HtmlStrike(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlStrong.TAG_NAME)) {
element = new HtmlStrong(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlStyle.TAG_NAME)) {
element = new HtmlStyle(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlSubscript.TAG_NAME)) {
element = new HtmlSubscript(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlSuperscript.TAG_NAME)) {
element = new HtmlSuperscript(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlTable.TAG_NAME)) {
element = new HtmlTable(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlTableBody.TAG_NAME)) {
element = new HtmlTableBody(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlTableColumn.TAG_NAME)) {
element = new HtmlTableColumn(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlTableColumnGroup.TAG_NAME)) {
element = new HtmlTableColumnGroup(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlTableDataCell.TAG_NAME)) {
element = new HtmlTableDataCell(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlTableFooter.TAG_NAME)) {
element = new HtmlTableFooter(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlTableHeader.TAG_NAME)) {
element = new HtmlTableHeader(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlTableHeaderCell.TAG_NAME)) {
element = new HtmlTableHeaderCell(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlTableRow.TAG_NAME)) {
element = new HtmlTableRow(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlTeletype.TAG_NAME)) {
element = new HtmlTeletype(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlTextArea.TAG_NAME)) {
element = new HtmlTextArea(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlDirectory.TAG_NAME)) {
element = new HtmlDirectory(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlTitle.TAG_NAME)) {
element = new HtmlTitle(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlUnderlined.TAG_NAME)) {
element = new HtmlUnderlined(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlUnorderedList.TAG_NAME)) {
element = new HtmlUnorderedList(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlVariable.TAG_NAME)) {
element = new HtmlVariable(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlVideo.TAG_NAME)) {
if (page.getWebClient().getBrowserVersion().hasFeature(BrowserVersionFeatures.HTML5_TAGS)) {
element = new HtmlVideo(namespaceURI, qualifiedName, page, attributeMap);
}
else {
return UnknownElementFactory.instance.createElementNS(page, namespaceURI, qualifiedName, attributes);
}
}
else if (tagName.equals(HtmlWordBreak.TAG_NAME)) {
element = new HtmlWordBreak(namespaceURI, qualifiedName, page, attributeMap);
}
else if (tagName.equals(HtmlExample.TAG_NAME)) {
element = new HtmlExample(namespaceURI, qualifiedName, page, attributeMap);
}
else {
throw new IllegalStateException("Cannot find HtmlElement for " + qualifiedName);
}
return element;
}
/**
* Converts {@link Attributes} into the map needed by {@link HtmlElement}s.
*
* @param page the page which contains the specified attributes
* @param attributes the SAX attributes
* @return the map of attribute values for {@link HtmlElement}s
*/
static Map<String, DomAttr> setAttributes(final SgmlPage page, final Attributes attributes) {
Map<String, DomAttr> attributeMap = null;
if (attributes != null) {
attributeMap = HtmlElement.createAttributeMap(attributes.getLength());
for (int i = 0; i < attributes.getLength(); i++) {
final String qName = attributes.getQName(i);
// browsers consider only first attribute (ex: <div id='foo' id='something'>...</div>)
if (!attributeMap.containsKey(qName)) {
String namespaceURI = attributes.getURI(i);
if (namespaceURI != null && namespaceURI.length() == 0) {
namespaceURI = null;
}
HtmlElement.addAttributeToMap(page, attributeMap, namespaceURI,
qName, attributes.getValue(i));
}
}
}
return attributeMap;
}
}
| [
"mguillem@5f5364db-9458-4db8-a492-e30667be6df6"
] | mguillem@5f5364db-9458-4db8-a492-e30667be6df6 |
fef7609c70a891ab5edb6021d55ccbf3f6fe9dc9 | 6d071edd2c0d28fdf66514117960772d3ab856cc | /nxt/src/java/nxt/http/callers/BuyAliasCall.java | 4c4ccdc9375aadabd1e500b694075b55f169e46c | [
"MIT",
"LGPL-2.1-only",
"EPL-1.0",
"GPL-2.0-only",
"Apache-2.0",
"LicenseRef-scancode-proprietary-license",
"LGPL-2.1-or-later",
"MPL-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-philippe-de-muyter",
"GPL-1.0-or-later",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | BhinbahadurUK/Proof-of-Stake-Cryptocurrency-generator | 784ad8fdcfb0a6f9329198107387337be3f988d6 | 76abce1db9056297d42c183c8a1d66b6526a8558 | refs/heads/master | 2023-06-25T10:37:57.795253 | 2023-06-08T23:23:13 | 2023-06-08T23:23:13 | 178,170,197 | 0 | 0 | MIT | 2023-06-08T23:23:58 | 2019-03-28T09:28:17 | HTML | UTF-8 | Java | false | false | 601 | java | // Auto generated code, do not modify
package nxt.http.callers;
public class BuyAliasCall extends CreateTransactionCallBuilder<BuyAliasCall> {
private BuyAliasCall() {
super(ApiSpec.buyAlias);
}
public static BuyAliasCall create() {
return new BuyAliasCall();
}
public BuyAliasCall aliasName(String aliasName) {
return param("aliasName", aliasName);
}
public BuyAliasCall amountNQT(long amountNQT) {
return param("amountNQT", amountNQT);
}
public BuyAliasCall alias(String alias) {
return param("alias", alias);
}
}
| [
"sandoche@protonmail.com"
] | sandoche@protonmail.com |
b690b1ca23865f795d0e895164ce4cb6d99523e8 | 45de7b97cab6f8c9be0147acf3a330b01b1fb62a | /config/src/main/java/com/alibaba/nacos/config/server/utils/PropertyUtil.java | 2afad72f1c492b4ef12555a07a7aa9648a3c2bc2 | [
"Apache-2.0"
] | permissive | chengchangan/nacos | 22fdfd0e7ace2028ba038902f2dea4b4583e6bae | 8da289fc2ea5c97e2c0af113acf4fa595d6844ea | refs/heads/main | 2023-04-16T08:44:33.486579 | 2021-04-23T09:50:58 | 2021-04-23T09:50:58 | 349,335,197 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,321 | java | /*
* Copyright 1999-2018 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.nacos.config.server.utils;
import com.alibaba.nacos.sys.utils.ApplicationUtils;
import org.slf4j.Logger;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
/**
* Properties util.
*
* @author Nacos
*/
public class PropertyUtil implements ApplicationContextInitializer<ConfigurableApplicationContext> {
private static final Logger LOGGER = LogUtil.DEFAULT_LOG;
private static int notifyConnectTimeout = 100;
private static int notifySocketTimeout = 200;
private static int maxHealthCheckFailCount = 12;
private static boolean isHealthCheck = true;
private static int maxContent = 10 * 1024 * 1024;
/**
* Whether to enable capacity management.
*/
private static boolean isManageCapacity = true;
/**
* Whether to enable the limit check function of capacity management, including the upper limit of configuration
* number, configuration content size limit, etc.
*/
private static boolean isCapacityLimitCheck = false;
/**
* The default cluster capacity limit.
*/
private static int defaultClusterQuota = 100000;
/**
* the default capacity limit per Group.
*/
private static int defaultGroupQuota = 200;
/**
* The default capacity limit per Tenant.
*/
private static int defaultTenantQuota = 200;
/**
* The maximum size of the content in the configuration of a single, unit for bytes.
*/
private static int defaultMaxSize = 100 * 1024;
/**
* The default Maximum number of aggregated data.
*/
private static int defaultMaxAggrCount = 10000;
/**
* The maximum size of content in a single subconfiguration of aggregated data.
*/
private static int defaultMaxAggrSize = 1024;
/**
* Initialize the expansion percentage of capacity has reached the limit.
*/
private static int initialExpansionPercent = 100;
/**
* Fixed capacity information table usage (usage) time interval, the unit is in seconds.
*/
private static int correctUsageDelay = 10 * 60;
/**
* Standalone mode uses DB.
*/
private static boolean useExternalDB = false;
/**
* Inline storage value = ${nacos.standalone}.
*/
private static boolean embeddedStorage = ApplicationUtils.getStandaloneMode();
public static int getNotifyConnectTimeout() {
return notifyConnectTimeout;
}
public static void setNotifyConnectTimeout(int notifyConnectTimeout) {
PropertyUtil.notifyConnectTimeout = notifyConnectTimeout;
}
public static int getNotifySocketTimeout() {
return notifySocketTimeout;
}
public static void setNotifySocketTimeout(int notifySocketTimeout) {
PropertyUtil.notifySocketTimeout = notifySocketTimeout;
}
public static int getMaxHealthCheckFailCount() {
return maxHealthCheckFailCount;
}
public static void setMaxHealthCheckFailCount(int maxHealthCheckFailCount) {
PropertyUtil.maxHealthCheckFailCount = maxHealthCheckFailCount;
}
public static boolean isHealthCheck() {
return isHealthCheck;
}
public static void setHealthCheck(boolean isHealthCheck) {
PropertyUtil.isHealthCheck = isHealthCheck;
}
public static int getMaxContent() {
return maxContent;
}
public static void setMaxContent(int maxContent) {
PropertyUtil.maxContent = maxContent;
}
public static boolean isManageCapacity() {
return isManageCapacity;
}
public static void setManageCapacity(boolean isManageCapacity) {
PropertyUtil.isManageCapacity = isManageCapacity;
}
public static int getDefaultClusterQuota() {
return defaultClusterQuota;
}
public static void setDefaultClusterQuota(int defaultClusterQuota) {
PropertyUtil.defaultClusterQuota = defaultClusterQuota;
}
public static boolean isCapacityLimitCheck() {
return isCapacityLimitCheck;
}
public static void setCapacityLimitCheck(boolean isCapacityLimitCheck) {
PropertyUtil.isCapacityLimitCheck = isCapacityLimitCheck;
}
public static int getDefaultGroupQuota() {
return defaultGroupQuota;
}
public static void setDefaultGroupQuota(int defaultGroupQuota) {
PropertyUtil.defaultGroupQuota = defaultGroupQuota;
}
public static int getDefaultTenantQuota() {
return defaultTenantQuota;
}
public static void setDefaultTenantQuota(int defaultTenantQuota) {
PropertyUtil.defaultTenantQuota = defaultTenantQuota;
}
public static int getInitialExpansionPercent() {
return initialExpansionPercent;
}
public static void setInitialExpansionPercent(int initialExpansionPercent) {
PropertyUtil.initialExpansionPercent = initialExpansionPercent;
}
public static int getDefaultMaxSize() {
return defaultMaxSize;
}
public static void setDefaultMaxSize(int defaultMaxSize) {
PropertyUtil.defaultMaxSize = defaultMaxSize;
}
public static int getDefaultMaxAggrCount() {
return defaultMaxAggrCount;
}
public static void setDefaultMaxAggrCount(int defaultMaxAggrCount) {
PropertyUtil.defaultMaxAggrCount = defaultMaxAggrCount;
}
public static int getDefaultMaxAggrSize() {
return defaultMaxAggrSize;
}
public static void setDefaultMaxAggrSize(int defaultMaxAggrSize) {
PropertyUtil.defaultMaxAggrSize = defaultMaxAggrSize;
}
public static int getCorrectUsageDelay() {
return correctUsageDelay;
}
public static void setCorrectUsageDelay(int correctUsageDelay) {
PropertyUtil.correctUsageDelay = correctUsageDelay;
}
public static boolean isStandaloneMode() {
return ApplicationUtils.getStandaloneMode();
}
public static boolean isUseExternalDB() {
return useExternalDB;
}
public static void setUseExternalDB(boolean useExternalDB) {
PropertyUtil.useExternalDB = useExternalDB;
}
public static boolean isEmbeddedStorage() {
return embeddedStorage;
}
// Determines whether to read the data directly
// if use mysql, Reduce database read pressure
// if use raft+derby, Reduce leader read pressure
public static boolean isDirectRead() {
return ApplicationUtils.getStandaloneMode() && isEmbeddedStorage();
}
public static void setEmbeddedStorage(boolean embeddedStorage) {
PropertyUtil.embeddedStorage = embeddedStorage;
}
private void loadSetting() {
try {
setNotifyConnectTimeout(Integer.parseInt(ApplicationUtils.getProperty("notifyConnectTimeout", "100")));
LOGGER.info("notifyConnectTimeout:{}", notifyConnectTimeout);
setNotifySocketTimeout(Integer.parseInt(ApplicationUtils.getProperty("notifySocketTimeout", "200")));
LOGGER.info("notifySocketTimeout:{}", notifySocketTimeout);
setHealthCheck(Boolean.parseBoolean(ApplicationUtils.getProperty("isHealthCheck", "true")));
LOGGER.info("isHealthCheck:{}", isHealthCheck);
setMaxHealthCheckFailCount(Integer.parseInt(ApplicationUtils.getProperty("maxHealthCheckFailCount", "12")));
LOGGER.info("maxHealthCheckFailCount:{}", maxHealthCheckFailCount);
setMaxContent(Integer.parseInt(ApplicationUtils.getProperty("maxContent", String.valueOf(maxContent))));
LOGGER.info("maxContent:{}", maxContent);
// 容量管理
setManageCapacity(getBoolean("isManageCapacity", isManageCapacity));
setCapacityLimitCheck(getBoolean("isCapacityLimitCheck", isCapacityLimitCheck));
setDefaultClusterQuota(getInt("defaultClusterQuota", defaultClusterQuota));
setDefaultGroupQuota(getInt("defaultGroupQuota", defaultGroupQuota));
setDefaultTenantQuota(getInt("defaultTenantQuota", defaultTenantQuota));
setDefaultMaxSize(getInt("defaultMaxSize", defaultMaxSize));
setDefaultMaxAggrCount(getInt("defaultMaxAggrCount", defaultMaxAggrCount));
setDefaultMaxAggrSize(getInt("defaultMaxAggrSize", defaultMaxAggrSize));
setCorrectUsageDelay(getInt("correctUsageDelay", correctUsageDelay));
setInitialExpansionPercent(getInt("initialExpansionPercent", initialExpansionPercent));
// External data sources are used by default in cluster mode
setUseExternalDB("mysql".equalsIgnoreCase(getString("spring.datasource.platform", "")));
// must initialize after setUseExternalDB
// This value is true in stand-alone mode and false in cluster mode
// If this value is set to true in cluster mode, nacos's distributed storage engine is turned on
// default value is depend on ${nacos.standalone}
if (isUseExternalDB()) {
setEmbeddedStorage(false);
} else {
boolean embeddedStorage = PropertyUtil.embeddedStorage || Boolean.getBoolean("embeddedStorage");
setEmbeddedStorage(embeddedStorage);
// If the embedded data source storage is not turned on, it is automatically
// upgraded to the external data source storage, as before
if (!embeddedStorage) {
setUseExternalDB(true);
}
}
} catch (Exception e) {
LOGGER.error("read application.properties failed", e);
throw e;
}
}
private boolean getBoolean(String key, boolean defaultValue) {
return Boolean.parseBoolean(getString(key, String.valueOf(defaultValue)));
}
private int getInt(String key, int defaultValue) {
return Integer.parseInt(getString(key, String.valueOf(defaultValue)));
}
private String getString(String key, String defaultValue) {
String value = getProperty(key);
if (value == null) {
return defaultValue;
}
LOGGER.info("{}:{}", key, value);
return value;
}
public String getProperty(String key) {
return ApplicationUtils.getProperty(key);
}
public String getProperty(String key, String defaultValue) {
return ApplicationUtils.getProperty(key, defaultValue);
}
@Override
public void initialize(ConfigurableApplicationContext configurableApplicationContext) {
ApplicationUtils.injectEnvironment(configurableApplicationContext.getEnvironment());
loadSetting();
}
}
| [
"cheng.changan@eascs.com"
] | cheng.changan@eascs.com |
7879c91f74509692bf19309f75e7692261c0d313 | 33a447bbd01521f6a2584050382b9c3acb6f1fba | /src/test/java/com/expert/works/service/MailServiceIT.java | bec2a98f9cb7917a0c7b2edc24b6a291c9ea03b3 | [] | no_license | imohitarora/expert-barnacle | 8b17773f0d508b02ea785459bbeebd749abd9f07 | e3b208e5012bc9d3333eabcae4c109422f68a90e | refs/heads/master | 2022-02-22T07:27:32.901471 | 2022-02-10T04:50:01 | 2022-02-10T04:50:01 | 201,439,488 | 0 | 1 | null | 2022-02-10T04:50:02 | 2019-08-09T09:46:40 | Java | UTF-8 | Java | false | false | 11,539 | java | package com.expert.works.service;
import com.expert.works.config.Constants;
import com.expert.works.ExpertApp;
import com.expert.works.domain.User;
import io.github.jhipster.config.JHipsterProperties;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.MessageSource;
import org.springframework.mail.MailSendException;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.thymeleaf.spring5.SpringTemplateEngine;
import javax.mail.Multipart;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.net.URI;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static org.assertj.core.api.Assertions.*;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.*;
/**
* Integration tests for {@link MailService}.
*/
@SpringBootTest(classes = ExpertApp.class)
public class MailServiceIT {
private static String languages[] = {
"en"
// jhipster-needle-i18n-language-constant - JHipster will add/remove languages in this array
};
private static final Pattern PATTERN_LOCALE_3 = Pattern.compile("([a-z]{2})-([a-zA-Z]{4})-([a-z]{2})");
private static final Pattern PATTERN_LOCALE_2 = Pattern.compile("([a-z]{2})-([a-z]{2})");
@Autowired
private JHipsterProperties jHipsterProperties;
@Autowired
private MessageSource messageSource;
@Autowired
private SpringTemplateEngine templateEngine;
@Spy
private JavaMailSenderImpl javaMailSender;
@Captor
private ArgumentCaptor<MimeMessage> messageCaptor;
private MailService mailService;
@BeforeEach
public void setup() {
MockitoAnnotations.initMocks(this);
doNothing().when(javaMailSender).send(any(MimeMessage.class));
mailService = new MailService(jHipsterProperties, javaMailSender, messageSource, templateEngine);
}
@Test
public void testSendEmail() throws Exception {
mailService.sendEmail("john.doe@example.com", "testSubject", "testContent", false, false);
verify(javaMailSender).send(messageCaptor.capture());
MimeMessage message = messageCaptor.getValue();
assertThat(message.getSubject()).isEqualTo("testSubject");
assertThat(message.getAllRecipients()[0].toString()).isEqualTo("john.doe@example.com");
assertThat(message.getFrom()[0].toString()).isEqualTo(jHipsterProperties.getMail().getFrom());
assertThat(message.getContent()).isInstanceOf(String.class);
assertThat(message.getContent().toString()).isEqualTo("testContent");
assertThat(message.getDataHandler().getContentType()).isEqualTo("text/plain; charset=UTF-8");
}
@Test
public void testSendHtmlEmail() throws Exception {
mailService.sendEmail("john.doe@example.com", "testSubject", "testContent", false, true);
verify(javaMailSender).send(messageCaptor.capture());
MimeMessage message = messageCaptor.getValue();
assertThat(message.getSubject()).isEqualTo("testSubject");
assertThat(message.getAllRecipients()[0].toString()).isEqualTo("john.doe@example.com");
assertThat(message.getFrom()[0].toString()).isEqualTo(jHipsterProperties.getMail().getFrom());
assertThat(message.getContent()).isInstanceOf(String.class);
assertThat(message.getContent().toString()).isEqualTo("testContent");
assertThat(message.getDataHandler().getContentType()).isEqualTo("text/html;charset=UTF-8");
}
@Test
public void testSendMultipartEmail() throws Exception {
mailService.sendEmail("john.doe@example.com", "testSubject", "testContent", true, false);
verify(javaMailSender).send(messageCaptor.capture());
MimeMessage message = messageCaptor.getValue();
MimeMultipart mp = (MimeMultipart) message.getContent();
MimeBodyPart part = (MimeBodyPart) ((MimeMultipart) mp.getBodyPart(0).getContent()).getBodyPart(0);
ByteArrayOutputStream aos = new ByteArrayOutputStream();
part.writeTo(aos);
assertThat(message.getSubject()).isEqualTo("testSubject");
assertThat(message.getAllRecipients()[0].toString()).isEqualTo("john.doe@example.com");
assertThat(message.getFrom()[0].toString()).isEqualTo(jHipsterProperties.getMail().getFrom());
assertThat(message.getContent()).isInstanceOf(Multipart.class);
assertThat(aos.toString()).isEqualTo("\r\ntestContent");
assertThat(part.getDataHandler().getContentType()).isEqualTo("text/plain; charset=UTF-8");
}
@Test
public void testSendMultipartHtmlEmail() throws Exception {
mailService.sendEmail("john.doe@example.com", "testSubject", "testContent", true, true);
verify(javaMailSender).send(messageCaptor.capture());
MimeMessage message = messageCaptor.getValue();
MimeMultipart mp = (MimeMultipart) message.getContent();
MimeBodyPart part = (MimeBodyPart) ((MimeMultipart) mp.getBodyPart(0).getContent()).getBodyPart(0);
ByteArrayOutputStream aos = new ByteArrayOutputStream();
part.writeTo(aos);
assertThat(message.getSubject()).isEqualTo("testSubject");
assertThat(message.getAllRecipients()[0].toString()).isEqualTo("john.doe@example.com");
assertThat(message.getFrom()[0].toString()).isEqualTo(jHipsterProperties.getMail().getFrom());
assertThat(message.getContent()).isInstanceOf(Multipart.class);
assertThat(aos.toString()).isEqualTo("\r\ntestContent");
assertThat(part.getDataHandler().getContentType()).isEqualTo("text/html;charset=UTF-8");
}
@Test
public void testSendEmailFromTemplate() throws Exception {
User user = new User();
user.setLogin("john");
user.setEmail("john.doe@example.com");
user.setLangKey("en");
mailService.sendEmailFromTemplate(user, "mail/testEmail", "email.test.title");
verify(javaMailSender).send(messageCaptor.capture());
MimeMessage message = messageCaptor.getValue();
assertThat(message.getSubject()).isEqualTo("test title");
assertThat(message.getAllRecipients()[0].toString()).isEqualTo(user.getEmail());
assertThat(message.getFrom()[0].toString()).isEqualTo(jHipsterProperties.getMail().getFrom());
assertThat(message.getContent().toString()).isEqualToNormalizingNewlines("<html>test title, http://127.0.0.1:8080, john</html>\n");
assertThat(message.getDataHandler().getContentType()).isEqualTo("text/html;charset=UTF-8");
}
@Test
public void testSendActivationEmail() throws Exception {
User user = new User();
user.setLangKey(Constants.DEFAULT_LANGUAGE);
user.setLogin("john");
user.setEmail("john.doe@example.com");
mailService.sendActivationEmail(user);
verify(javaMailSender).send(messageCaptor.capture());
MimeMessage message = messageCaptor.getValue();
assertThat(message.getAllRecipients()[0].toString()).isEqualTo(user.getEmail());
assertThat(message.getFrom()[0].toString()).isEqualTo(jHipsterProperties.getMail().getFrom());
assertThat(message.getContent().toString()).isNotEmpty();
assertThat(message.getDataHandler().getContentType()).isEqualTo("text/html;charset=UTF-8");
}
@Test
public void testCreationEmail() throws Exception {
User user = new User();
user.setLangKey(Constants.DEFAULT_LANGUAGE);
user.setLogin("john");
user.setEmail("john.doe@example.com");
mailService.sendCreationEmail(user);
verify(javaMailSender).send(messageCaptor.capture());
MimeMessage message = messageCaptor.getValue();
assertThat(message.getAllRecipients()[0].toString()).isEqualTo(user.getEmail());
assertThat(message.getFrom()[0].toString()).isEqualTo(jHipsterProperties.getMail().getFrom());
assertThat(message.getContent().toString()).isNotEmpty();
assertThat(message.getDataHandler().getContentType()).isEqualTo("text/html;charset=UTF-8");
}
@Test
public void testSendPasswordResetMail() throws Exception {
User user = new User();
user.setLangKey(Constants.DEFAULT_LANGUAGE);
user.setLogin("john");
user.setEmail("john.doe@example.com");
mailService.sendPasswordResetMail(user);
verify(javaMailSender).send(messageCaptor.capture());
MimeMessage message = messageCaptor.getValue();
assertThat(message.getAllRecipients()[0].toString()).isEqualTo(user.getEmail());
assertThat(message.getFrom()[0].toString()).isEqualTo(jHipsterProperties.getMail().getFrom());
assertThat(message.getContent().toString()).isNotEmpty();
assertThat(message.getDataHandler().getContentType()).isEqualTo("text/html;charset=UTF-8");
}
@Test
public void testSendEmailWithException() throws Exception {
doThrow(MailSendException.class).when(javaMailSender).send(any(MimeMessage.class));
mailService.sendEmail("john.doe@example.com", "testSubject", "testContent", false, false);
}
@Test
public void testSendLocalizedEmailForAllSupportedLanguages() throws Exception {
User user = new User();
user.setLogin("john");
user.setEmail("john.doe@example.com");
for (String langKey : languages) {
user.setLangKey(langKey);
mailService.sendEmailFromTemplate(user, "mail/testEmail", "email.test.title");
verify(javaMailSender, atLeastOnce()).send(messageCaptor.capture());
MimeMessage message = messageCaptor.getValue();
String propertyFilePath = "i18n/messages_" + getJavaLocale(langKey) + ".properties";
URL resource = this.getClass().getClassLoader().getResource(propertyFilePath);
File file = new File(new URI(resource.getFile()).getPath());
Properties properties = new Properties();
properties.load(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")));
String emailTitle = (String) properties.get("email.test.title");
assertThat(message.getSubject()).isEqualTo(emailTitle);
assertThat(message.getContent().toString()).isEqualToNormalizingNewlines("<html>" + emailTitle + ", http://127.0.0.1:8080, john</html>\n");
}
}
/**
* Convert a lang key to the Java locale.
*/
private String getJavaLocale(String langKey) {
String javaLangKey = langKey;
Matcher matcher2 = PATTERN_LOCALE_2.matcher(langKey);
if (matcher2.matches()) {
javaLangKey = matcher2.group(1) + "_"+ matcher2.group(2).toUpperCase();
}
Matcher matcher3 = PATTERN_LOCALE_3.matcher(langKey);
if (matcher3.matches()) {
javaLangKey = matcher3.group(1) + "_" + matcher3.group(2) + "_" + matcher3.group(3).toUpperCase();
}
return javaLangKey;
}
}
| [
"mohitarora.j2ee@gmail.com"
] | mohitarora.j2ee@gmail.com |
dfa964b82fa775b16bd2170ae8a3907dcedeb213 | 59a19bb8c3e2c59a7f7a354f5cafc106e0116e59 | /modules/bluima_units/src/main/java/ch/epfl/bbp/uima/ae/RT1CellTypeProteinConcentrationExtractor.java | 9b6ab7751af5a09cebf1676109270ca73ada69df | [
"Apache-2.0"
] | permissive | KnowledgeGarden/bluima | ffd5d54d69e42078598a780bdf6e67a6325d695a | 793ea3f46761dce72094e057a56cddfa677156ae | refs/heads/master | 2021-01-01T06:21:54.919609 | 2016-01-25T22:37:43 | 2016-01-25T22:37:43 | 97,415,950 | 1 | 0 | null | 2017-07-16T22:53:46 | 2017-07-16T22:53:46 | null | UTF-8 | Java | false | false | 2,721 | java | package ch.epfl.bbp.uima.ae;
import static ch.epfl.bbp.uima.typesystem.TypeSystem.CELL_TYPE_PROTEIN_CONCENTRATION;
import static ch.epfl.bbp.uima.typesystem.TypeSystem.CONCENTRATION;
import static ch.epfl.bbp.uima.typesystem.TypeSystem.CONCEPT_MENTION;
import static ch.epfl.bbp.uima.typesystem.TypeSystem.PROTEIN;
import static ch.epfl.bbp.uima.typesystem.TypeSystem.SENTENCE;
import static org.apache.uima.fit.util.JCasUtil.select;
import static org.apache.uima.fit.util.JCasUtil.subiterate;
import java.util.ArrayList;
import java.util.List;
import org.apache.uima.jcas.JCas;
import org.apache.uima.fit.component.JCasAnnotator_ImplBase;
import org.apache.uima.fit.descriptor.TypeCapability;
import ch.epfl.bbp.uima.types.CellType;
import ch.epfl.bbp.uima.types.CellTypeProteinConcentration;
import ch.epfl.bbp.uima.types.Concentration;
import ch.epfl.bbp.uima.types.Protein;
import de.julielab.jules.types.Sentence;
/**
* Collects existing annotations ({@link Protein}, {@link Concentration} and
* trigger words) and aggregates (copy) them in a
* {@link CellTypeProteinConcentration}.
*
* @author renaud.richardet@epfl.ch
*/
@Deprecated
@TypeCapability(inputs = { SENTENCE, PROTEIN, CONCENTRATION, CONCEPT_MENTION }, outputs = { CELL_TYPE_PROTEIN_CONCENTRATION })
public class RT1CellTypeProteinConcentrationExtractor extends
JCasAnnotator_ImplBase {
@Override
public void process(JCas jCas) {
// AnnotationIndex<Annotation> proteinIndex =
// jCas.getJFSIndexRepository()
// .getAnnotationIndex(Protein.type);
for (Sentence sent : select(jCas, Sentence.class)) {
List<Protein> prots = new ArrayList<Protein>();
for (Protein prot : subiterate(jCas, Protein.class, sent, false,
true)) {
prots.add(prot);
}
List<Concentration> concs = new ArrayList<Concentration>();
for (Concentration conc : subiterate(jCas, Concentration.class,
sent, false, true)) {
concs.add(conc);
}
List<CellType> cts = new ArrayList<CellType>();
for (CellType ct : subiterate(jCas, CellType.class, sent, false,
true)) {
cts.add(ct);
}
// FIXME 1
if (!prots.isEmpty() && !concs.isEmpty() && !cts.isEmpty()) {
CellTypeProteinConcentration ctpc = new CellTypeProteinConcentration(
jCas);
ctpc.setCelltype(cts.get(0));
ctpc.setConcentration(concs.get(0));
ctpc.setProtein(prots.get(0));
ctpc.addToIndexes();
}
}
}
}
| [
"renaud@apache.org"
] | renaud@apache.org |
de2eb859abbf0167debfabe9c6014a67ab5197a9 | 7f827447f3a765e2e133047de349b78cf1f29762 | /app/src/main/java/com/app/gofoodie/model/location/LocationResponse.java | d91a6edafc73c1c31955cc643107d4047cf80b31 | [] | no_license | rahulrainaaa/GoFoodie | bc84356db9c5059b8cce95938b6ee0134a62b356 | b7b1d1e7324f84b93e3091556aa0688277a651ba | refs/heads/master | 2021-09-07T18:41:50.694407 | 2018-02-27T12:03:09 | 2018-02-27T12:03:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,185 | java | package com.app.gofoodie.model.location;
import android.os.Parcel;
import android.os.Parcelable;
import com.app.gofoodie.model.base.BaseModel;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.util.List;
/**
* Model to hold Location (id, name).
*/
@SuppressWarnings("unused")
public class LocationResponse extends BaseModel implements Parcelable {
public final static Creator<LocationResponse> CREATOR = new Creator<LocationResponse>() {
@SuppressWarnings({
"unchecked"
})
public LocationResponse createFromParcel(Parcel in) {
return new LocationResponse(in);
}
public LocationResponse[] newArray(int size) {
return (new LocationResponse[size]);
}
};
@SerializedName("locatons")
@Expose
private List<Locaton> locatons = null;
@SerializedName("statusCode")
@Expose
private Integer statusCode;
@SerializedName("statusMessage")
@Expose
private String statusMessage;
protected LocationResponse(Parcel in) {
in.readList(this.locatons, (com.app.gofoodie.model.location.Locaton.class.getClassLoader()));
this.statusCode = ((Integer) in.readValue((Integer.class.getClassLoader())));
this.statusMessage = ((String) in.readValue((String.class.getClassLoader())));
}
public LocationResponse() {
}
public List<Locaton> getLocatons() {
return locatons;
}
public void setLocatons(List<Locaton> locatons) {
this.locatons = locatons;
}
public Integer getStatusCode() {
return statusCode;
}
public void setStatusCode(Integer statusCode) {
this.statusCode = statusCode;
}
public String getStatusMessage() {
return statusMessage;
}
public void setStatusMessage(String statusMessage) {
this.statusMessage = statusMessage;
}
public void writeToParcel(Parcel dest, int flags) {
dest.writeList(locatons);
dest.writeValue(statusCode);
dest.writeValue(statusMessage);
}
public int describeContents() {
return 0;
}
}
| [
"rahulrainahome@gmail.com"
] | rahulrainahome@gmail.com |
0036f958a0298c8c982e0a00246786d653a2b889 | cca76c9a9bd63f04d05d28fd90531b4d6ee4a189 | /src/main/java/sk/kosickaakademia/spivak/state/OrangeState.java | 3ebafca4f4636b58453af6894497d6f2bde208dc | [] | no_license | illiaspivak/Mathematics | c0a573b06c50e577557f1992e4e1e93368749fa0 | c877890dc25f5316d06c7c5574a96c8a05557c01 | refs/heads/master | 2023-05-21T13:54:04.612689 | 2021-06-07T10:00:21 | 2021-06-07T10:00:21 | 367,601,472 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 282 | java | package sk.kosickaakademia.spivak.state;
public class OrangeState implements State {
public void doAction(Context context) {
System.out.println("Orange color");
context.setState(this);
}
public String toString(){
return "Orange color";
}
}
| [
"illia.spivak@kosickaakademia.sk"
] | illia.spivak@kosickaakademia.sk |
5072e2a23df655ea96b40873b4740e0d5d1fa51e | 67f637c569c8ba680eabf52892524ba1640e109f | /src/main/java/com/example/demo/c04cinema/c04cinema/c04cinema/payment/generated/GeneratedPaymentController.java | 29045848a11014132a7538a2ad4ba187267c889e | [] | no_license | c0420g1/c04cinema_backend | 707b0d74136a33c80568f5878c27574b67715767 | 28980f0e0ef4b99b04ce6028a423111d7ade446a | refs/heads/develop | 2023-01-21T06:12:21.157775 | 2020-12-07T16:19:15 | 2020-12-07T16:19:15 | 306,291,851 | 0 | 0 | null | 2020-11-02T06:41:08 | 2020-10-22T09:46:25 | Java | UTF-8 | Java | false | false | 12,298 | java | package com.example.demo.c04cinema.c04cinema.c04cinema.payment.generated;
import com.example.demo.c04cinema.c04cinema.c04cinema.payment.Payment;
import com.example.demo.c04cinema.c04cinema.c04cinema.payment.PaymentManager;
import com.example.demo.c04cinema.c04cinema.c04cinema.payment.generated.GeneratedPayment.Identifier;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.speedment.common.annotation.GeneratedCode;
import com.speedment.common.json.Json;
import com.speedment.enterprise.plugins.json.JsonCollectors;
import com.speedment.enterprise.plugins.json.JsonComponent;
import com.speedment.enterprise.plugins.json.JsonEncoder;
import com.speedment.enterprise.plugins.spring.runtime.AbstractFilter;
import com.speedment.enterprise.plugins.spring.runtime.AbstractSort;
import com.speedment.enterprise.plugins.spring.runtime.ControllerUtil;
import com.speedment.runtime.field.Field;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus;
import java.util.Comparator;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Stream;
import javax.annotation.PostConstruct;
import static java.util.stream.Collectors.toList;
/**
* The default REST controller logic for Payment entities.
* <p>
* This file has been automatically generated by Speedment. Any changes made to
* it will be overwritten.
*
* @author Speedment
*/
@GeneratedCode("Speedment")
@CrossOrigin(origins = "*", maxAge = 3600)
public abstract class GeneratedPaymentController {
protected @Autowired JsonComponent jsonComponent;
protected @Autowired PaymentManager manager;
protected JsonEncoder<Payment> encoder;
@PostConstruct
void createPaymentEncoder() {
encoder = jsonComponent.<Payment>emptyEncoder()
.put("id", Payment.ID)
.put("name", Payment.NAME)
.build();
}
@GetMapping(path = "/payment", produces = "application/json")
public String get(
@RequestParam(name = "filter", defaultValue = "[]") String filters,
@RequestParam(name = "sort", defaultValue = "[]") String sorters,
@RequestParam(value = "start", defaultValue = "0") long start,
@RequestParam(value = "limit", defaultValue = "25") long limit) {
return getHelper(
ControllerUtil.parseFilters(filters, PaymentFilter::new).collect(toList()),
ControllerUtil.parseSorts(sorters, PaymentSort::new).collect(toList()),
start,
limit
);
}
@ResponseStatus(code = HttpStatus.CREATED)
@PostMapping(path = "/payment", consumes = "application/json")
public void create(
@RequestBody @Validated CreateBody createBody) {
manager.persist(manager.create()
.setName(createBody.getName())
);
}
@ResponseStatus(code = HttpStatus.OK)
@PatchMapping(path = "/payment/{id}", consumes = "application/json")
public void update(
@PathVariable(name = "id") int id,
@RequestBody @Validated UpdateBody updateBody) {
manager.stream()
.filter(Payment.ID.equal(id))
.map(payment -> {
payment.setName(updateBody.getName());
return payment;
}).forEach(manager.updater());
}
@ResponseStatus(code = HttpStatus.NO_CONTENT)
@DeleteMapping(path = "/payment/{id}")
public void delete(
@PathVariable(name = "id") int id) {
manager.stream()
.filter(Payment.ID.equal(id))
.forEach(manager.remover());
}
@ExceptionHandler(JsonMappingException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
public String handleMissingValueError() {
Map<String, Object> error = new HashMap<>();
error.put("error", "Bad Request");
error.put("status", 400);
error.put("message", "Invalid request body: missing required fields");
return Json.toJson(error, true);
}
@ExceptionHandler(JsonParseException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
public String handleInvalidJsonError() {
Map<String, Object> error = new HashMap<>();
error.put("error", "Bad Request");
error.put("status", 400);
error.put("message", "Invalid request body: invalid JSON syntax");
return Json.toJson(error, true);
}
protected final Set<Identifier> parseColumns(String jsonColumnList) {
try {
@SuppressWarnings("unchecked")
final List<String> parsed = (List<String>) Json.fromJson(jsonColumnList);
final Set<GeneratedPayment.Identifier> result = EnumSet.noneOf(GeneratedPayment.Identifier.class);
parsed.stream().map(this::parseColumn).forEach(result::add);
return result;
} catch (final ClassCastException ex) {
throw new IllegalArgumentException("Error in parsed JSON.");
}
}
protected final Identifier parseColumn(String jsonColumn) {
switch (jsonColumn) {
case "id": return GeneratedPayment.Identifier.ID;
case "name": return GeneratedPayment.Identifier.NAME;
default: throw new IllegalArgumentException(
"Unknown column '" + jsonColumn + "'."
);
}
}
protected final Field<Payment> fieldOf(Identifier columnId) {
switch (columnId) {
case ID: return Payment.ID;
case NAME: return Payment.NAME;
default: throw new IllegalArgumentException(
"Unknown column '" + columnId + "'."
);
}
}
protected String getHelper(
List<Predicate<Payment>> predicates,
List<Comparator<Payment>> sorters,
long start,
long limit) {
Stream<Payment> stream = manager.stream();
for (final Predicate<Payment> predicate : predicates) {
stream = stream.filter(predicate);
}
if (!sorters.isEmpty()) {
final Optional<Comparator<Payment>> comparator = sorters.stream()
.reduce(Comparator::thenComparing);
stream = stream.sorted(comparator.get());
}
return stream
.skip(start)
.limit(limit)
.collect(JsonCollectors.toList(encoder));
}
/**
* How to filter the results from the controller. This class is designed to
* be deserialized automatically from JSON.
*/
public static final class PaymentFilter extends AbstractFilter<Payment> {
public PaymentFilter(
String operator,
String property,
String value) {
super(operator, property, value);
}
@Override
public Predicate<Payment> toPredicate() {
switch (property()) {
case "id" : {
final int v = Integer.parseInt(value());
switch (operator()) {
case "eq" : return Payment.ID.equal(v);
case "ne" : return Payment.ID.notEqual(v);
case "lt" : return Payment.ID.lessThan(v);
case "le" : return Payment.ID.lessOrEqual(v);
case "gt" : return Payment.ID.greaterThan(v);
case "ge" : return Payment.ID.greaterOrEqual(v);
case "like" : // Fallthrough
default : throw new IllegalArgumentException(
"'" + operator() + "' is not a valid operator for " +
"Payment.id."
);
}
}
case "name" : {
final String v = value();
switch (operator()) {
case "eq" : return Payment.NAME.equal(v);
case "ne" : return Payment.NAME.notEqual(v);
case "lt" : return Payment.NAME.lessThan(v);
case "le" : return Payment.NAME.lessOrEqual(v);
case "gt" : return Payment.NAME.greaterThan(v);
case "ge" : return Payment.NAME.greaterOrEqual(v);
case "like" : return Payment.NAME.contains(v);
default : throw new IllegalArgumentException(
"'" + operator() + "' is not a valid operator for " +
"Payment.name."
);
}
}
default : throw new IllegalArgumentException(
"'" + property() + "' is not a valid Payment property."
);
}
}
}
/**
* How to sort the results from the controller. This class is designed to be
* deserialized automatically from JSON.
*/
public static final class PaymentSort extends AbstractSort<Payment> {
public PaymentSort(String property, String direction) {
super(property, direction);
}
@Override
public Comparator<Payment> toComparator() {
final Comparator<Payment> comparator;
switch (property()) {
case "id" : comparator = Payment.ID.comparator(); break;
case "name" : comparator = Payment.NAME.comparator(); break;
default : throw new IllegalArgumentException(
"'" + property() + "' is not a valid Payment property."
);
}
switch (direction()) {
case "ASC" : return comparator;
case "DESC" : return comparator.reversed();
default : throw new IllegalArgumentException(
"'" + direction() + "' is not a valid sort direction. " +
"Use either 'ASC' or 'DESC', or leave out."
);
}
}
}
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class CreateBody {
private final String name;
@JsonCreator
public CreateBody(
@JsonProperty("name") String name) {
this.name = Objects.requireNonNull(name, "`name` is required");
}
public String getName() {
return this.name;
}
}
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class UpdateBody {
private final String name;
@JsonCreator
public UpdateBody(
@JsonProperty("name") String name) {
this.name = Objects.requireNonNull(name, "`name` is required");
}
public String getName() {
return this.name;
}
}
} | [
"63178225+quocnna@users.noreply.github.com"
] | 63178225+quocnna@users.noreply.github.com |
7c6c7974feee7fef2d7d8ab1bc3dae6e8a162209 | 8f1f34b000ec35c1eb3c8b98f49c376a5fcdb153 | /Java_Day8_JDBC/Java_Day_8/src/com/marlabs/jdbc/PreparedStatementInterfaceDemo.java | a9a6bbef13ce979c9846e5d19a31fed827e14b9c | [] | no_license | Prabhleen9Kaur/Full-Stack_JProjects | a69ba4ca1061a7f31eb8acc50d0b4854b0477ef1 | 94a6992fa2fb98f52e3985fbd84c5f407ea5d17f | refs/heads/master | 2022-12-22T21:57:51.944294 | 2019-08-04T23:21:14 | 2019-08-04T23:21:14 | 200,550,932 | 0 | 0 | null | 2022-12-16T04:22:26 | 2019-08-04T23:16:08 | Java | UTF-8 | Java | false | false | 353 | java | package com.marlabs.jdbc;
public class PreparedStatementInterfaceDemo {
public static void main(String[] args) {
PreparedStatementAPIExample apiExample = new PreparedStatementAPIExample();
boolean regFlag = apiExample
.registerEmployee(2506, "AAA", 8500.34d, 10);
System.out.println(regFlag);
apiExample.displayEmployeesDetails(10);
}
}
| [
"prabhleen09kaur@gmail.com"
] | prabhleen09kaur@gmail.com |
bf8c29a6ce42c7fcf08980ce0588117160095116 | e559f24f99355b16f68774aeb444231eb741b200 | /core/src/main/java/org/wrml/model/UniquelyNamed.java | cb1238aaf7fa9a71b0316a472279ce1f3dcd851d | [
"Apache-2.0"
] | permissive | ericpu/wrml | 9b842c3c3f51a5920a78a61e86e2ee544187abaf | 121f840f113c02273864b9cf91573e92e833f479 | refs/heads/master | 2021-01-24T21:53:11.984766 | 2013-10-25T16:03:20 | 2013-10-25T16:03:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,603 | java | /**
* WRML - Web Resource Modeling Language
* __ __ ______ __ __ __
* /\ \ _ \ \ /\ == \ /\ "-./ \ /\ \
* \ \ \/ ".\ \\ \ __< \ \ \-./\ \\ \ \____
* \ \__/".~\_\\ \_\ \_\\ \_\ \ \_\\ \_____\
* \/_/ \/_/ \/_/ /_/ \/_/ \/_/ \/_____/
*
* http://www.wrml.org
*
* Copyright (C) 2011 - 2013 Mark Masse <mark@wrml.org> (OSS project WRML.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wrml.model;
import org.wrml.runtime.schema.Title;
import org.wrml.util.UniqueName;
/**
* A <i>composable</i> {@link Abstract} with a <i>universally</i> unique name (a {@link UniqueName}).
*/
public interface UniquelyNamed extends Abstract
{
/**
* The WRML constant name for a UniquelyNamed's <i>uniqueName</i> slot.
*/
public static final String SLOT_NAME_UNIQUE_NAME = "uniqueName";
/**
* The {@link UniqueName} associated with this {@link UniquelyNamed} model.
*/
@Title("Unique Name")
UniqueName getUniqueName();
/**
* @see #getUniqueName()
*/
UniqueName setUniqueName(UniqueName uniqueName);
}
| [
"mark@wrml.org"
] | mark@wrml.org |
494fa5df3fb9770ba7de2cb0497baab446a43a05 | af3ccd340356d2500cba1f98f27d096d7da320f5 | /Mergesort.java | a2d32ab8c5d7ea583b556393b0323d2d0c1218df | [] | no_license | wHavelin/Sorting-Algorithms | 260264f79bfb216e82a670e416bc7208c6c724e0 | fc61736eaa559c926b35812b68e2d97e44c36e5e | refs/heads/master | 2016-09-10T19:09:28.820071 | 2014-09-16T00:35:03 | 2014-09-16T00:35:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,079 | java | import java.util.*;
public class Mergesort
{
public static int comparisons = 0;
public static int[] run_mergesort(int[] input_array){
if(input_array.length==1){
return input_array;
}
int[] array_1 = new int[input_array.length/2];
int[] array_2 = new int[((input_array.length+1)/2)];
int[] return_array = new int[input_array.length];
int a_1_index = 0;
int a_2_index = 0;
int return_a_index = 0;
int i = 0;
while(i < (input_array.length/2)){
array_1[i] = input_array[i];
++i;
}
while(i < (input_array.length)){
array_2[a_2_index] = input_array[i];
++a_2_index;
++i;
}
array_1 = Mergesort.run_mergesort(array_1);
array_2 = Mergesort.run_mergesort(array_2);
a_2_index = 0;
while(return_a_index<return_array.length){
++comparisons;
if(array_1[a_1_index] < array_2[a_2_index]){
return_array[return_a_index] = array_1[a_1_index];
++a_1_index;
if(a_1_index == array_1.length){
finish_filling_up_array(array_2, a_2_index, return_array, return_a_index);
break;
}
}
else{
return_array[return_a_index] = array_2[a_2_index];
++a_2_index;
if(a_2_index == array_2.length){
finish_filling_up_array(array_1, a_1_index, return_array, return_a_index);
break;
}
}
++return_a_index;
}
input_array = return_array;
return return_array;
}
public static void finish_filling_up_array(int[] source_array, int src_a_index, int[] dest_array, int dest_a_index){
++dest_a_index;
while(src_a_index < source_array.length){
dest_array[dest_a_index] = source_array[src_a_index];
++src_a_index;
++dest_a_index;
}
}
}
| [
"williamhavelin@gmail.com"
] | williamhavelin@gmail.com |
3ed83e2d9e42080bd85d49a4f1977c996a3fc15f | 66d4e436dbd3957ba9b9786c2ac2d7490a185a9f | /data/src/main/java/com/haoxuer/adminstore/data/so/MemberSo.java | 69c91a688f8ff7b276c7cc27cc0a42330bd2000e | [
"Apache-2.0"
] | permissive | HuWenhai/adminstore | d548502e667b0a7d87ec271e0848ebd96b482417 | 8df8136e81cb7c012c6f2fa73a6207021eec6844 | refs/heads/master | 2020-09-06T13:52:45.277256 | 2019-03-15T00:56:51 | 2019-03-15T00:56:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 467 | java | package com.haoxuer.adminstore.data.so;
import com.haoxuer.discover.data.page.Filter;
import com.haoxuer.discover.data.page.Search;
import java.io.Serializable;
/**
* Created by imake on 2017年08月29日17:08:12.
*/
public class MemberSo implements Serializable {
@Search(name = "name", operator = Filter.Operator.like)
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"cng1985@gmail.com"
] | cng1985@gmail.com |
85bb0b80955eef06e24ea7b419e134bc867e25cf | ad6011464f2dd68296683df4d47641454a8f4d78 | /mdrtb-lab/src/org/openmrs/module/mdrtb/reporting/definition/ResistanceTypeCohortDefinition.java | b7cc427e1e38f0d8b62b68c3882dbc70dad407a4 | [] | no_license | InteractiveHealthSolutions/openmrs-tjk-mdrtb-dots | 76f4fff3a744e376f54ed8b929b4823d474032a8 | 1fdffd0f1b5fc21844623f0dbdee07985a2eaada | refs/heads/master | 2023-08-28T05:56:23.955028 | 2016-09-08T11:57:39 | 2016-09-08T11:57:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,012 | java | /**
* The contents of this file are subject to the OpenMRS Public License
* Version 1.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://license.openmrs.org
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* Copyright (C) OpenMRS, LLC. All Rights Reserved.
*/
package org.openmrs.module.mdrtb.reporting.definition;
import java.util.Date;
import org.openmrs.module.mdrtb.MdrtbConstants.TbClassification;
import org.openmrs.module.reporting.cohort.definition.BaseCohortDefinition;
import org.openmrs.module.reporting.common.Localized;
import org.openmrs.module.reporting.definition.configuration.ConfigurationProperty;
@Localized("mdrtb.reporting.ResistanceTypeCohortDefinition")
public class ResistanceTypeCohortDefinition extends BaseCohortDefinition {
public static final long serialVersionUID = 1L;
@ConfigurationProperty
private TbClassification resistanceType;
@ConfigurationProperty
private Date startDate;
@ConfigurationProperty
private Date endDate;
//***** CONSTRUCTORS *****
/**
* Default Constructor
*/
public ResistanceTypeCohortDefinition() {
super();
}
//***** INSTANCE METHODS *****
/**
* @see java.lang.Object#toString()
*/
public String toString() {
return super.toString();
}
//***** PROPERTY ACCESS *****
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public TbClassification getResistanceType() {
return resistanceType;
}
public void setResistanceType(TbClassification resistanceType) {
this.resistanceType = resistanceType;
}
}
| [
"ali.habib@irdresearch.org"
] | ali.habib@irdresearch.org |
b3586d43b5668e87031e4430419acd06641a5445 | 9ecdd82225343cd13d04a3a23d81f7cf5c9cdd63 | /src/main/java/com/luv2code/springdemo/service/VirementService.java | db3f9c47c2020148c77089803b3cc7fa6766dcd5 | [] | no_license | saad-chahi1/Spring-MVC | dd3db19c3c2003fdef6230f653c90f08f2b8a63a | 9499b37f7af2dcbbb4e03af1e999f611b3a04353 | refs/heads/master | 2023-05-30T11:41:34.263685 | 2021-06-11T16:26:07 | 2021-06-11T16:26:07 | 373,559,672 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 177 | java | package com.luv2code.springdemo.service;
import com.luv2code.springdemo.entity.Virement;
public interface VirementService {
public void saveVirement(Virement theVirement);
}
| [
"saad.chahi@edu.uca.ma"
] | saad.chahi@edu.uca.ma |
9ac893f1416d7f81d078f9fdf585cbf70af45806 | 0e2252cfca5db6b3d8dda13c726f61d4cc287568 | /src/org/usfirst/frc997/BunnyBot2013/OI.java | df63200da41fccf2177cc9818ea7a4d02fbf4135 | [] | no_license | Team997Coders/BunnyBotPID | 6d844399576d6592b7bac2ddfcaaf93043eac66c | 1b901104d586d6815bd823ee27573664d7d3945f | refs/heads/master | 2021-06-05T04:19:49.590836 | 2018-08-03T01:54:58 | 2018-08-03T01:54:58 | 15,953,973 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,090 | java | // RobotBuilder Version: 1.0
//
// This file was generated by RobotBuilder. It contains sections of
// code that are automatically generated and assigned by robotbuilder.
// These sections will be updated in the future when you export to
// Java from RobotBuilder. Do not put any code or make any change in
// the blocks indicating autogenerated code or it will be lost on an
// update. Deleting the comments indicating the section will prevent
// it from being updated in the future.
package org.usfirst.frc997.BunnyBot2013;
import edu.wpi.first.wpilibj.Joystick;
import org.usfirst.frc997.BunnyBot2013.commands.*;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
/**
* This class is the glue that binds the controls on the physical operator
* interface to the commands and command groups that allow control of the robot.
*/
public class OI {
//// CREATING BUTTONS
// One type of button is a joystick button which is any button on a joystick.
// You create one by telling it which joystick it's on and which button
// number it is.
// Joystick stick = new Joystick(port);
// Button button = new JoystickButton(stick, buttonNumber);
// Another type of button you can create is a DigitalIOButton, which is
// a button or switch hooked up to the cypress module. These are useful if
// you want to build a customized operator interface.
// Button button = new DigitalIOButton(1);
// There are a few additional built in buttons you can use. Additionally,
// by subclassing Button you can create custom triggers and bind those to
// commands the same as any other Button.
//// TRIGGERING COMMANDS WITH BUTTONS
// Once you have a button, it's trivial to bind it to a button in one of
// three ways:
// Start the command when the button is pressed and let it run the command
// until it is finished as determined by it's isFinished method.
// button.whenPressed(new ExampleCommand());
// Run the command while the button is being held down and interrupt it once
// the button is released.
// button.whileHeld(new ExampleCommand());
// Start the command when the button is released and let it run the command
// until it is finished as determined by it's isFinished method.
// button.whenReleased(new ExampleCommand());
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
public Joystick leftStick;
public Joystick rightStick;
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
public OI() {
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
rightStick = new Joystick(2);
leftStick = new Joystick(1);
// SmartDashboard Buttons
SmartDashboard.putData("Autonomous Command", new AutonomousCommand());
//Solenoids
SmartDashboard.putData("ExtendDumper: ", new Extenddumper());
SmartDashboard.putData("RetractDumper: ", new RetractDumper());
SmartDashboard.putData("ExtendKicker: ", new ExtendKicker());
SmartDashboard.putData("RetractKicker: ", new RetractKicker());
//Compresssor
SmartDashboard.putData("CompressorOn: ", new Compressorstart());
SmartDashboard.putData("ComressorOff: ", new Compressoroff());
//Encoders
SmartDashboard.putData("ResetEncoders: ", new ResetEncoders());
//Commands
SmartDashboard.putData("TankDrive", new TankDrive());
SmartDashboard.putData("DriveSetPiont", new DriveSetpiont());
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=FUNCTIONS
public double getLeftStick() {
return -leftStick.getY();
}
public double getRightStick() {
return -rightStick.getY();
}
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=FUNCTIONS
}
| [
""
] | |
f6b1e518a65d33f74fb6bc2a6c26fff63dbe570e | 1a3b567119c3adefce8b6c9817b6a07e2a755f92 | /proxy_manage/src/main/java/cn/deepcoding/service/ProxyTeacherWatchService.java | e65d9e943cb5f6c990dd9a8879c8b11c68ac084a | [] | no_license | xybxjb/repo | e8fcd381294795d3f9458a3c616ffaef2484e27d | da2655e7e0033bdb23ce7b68443a6ecd1512e55e | refs/heads/master | 2021-07-08T21:16:23.517238 | 2019-08-14T09:45:53 | 2019-08-14T09:45:53 | 202,311,278 | 2 | 0 | null | 2019-11-13T11:35:34 | 2019-08-14T08:48:02 | JavaScript | UTF-8 | Java | false | false | 590 | java | package cn.deepcoding.service;
import java.util.Map;
/**
*
* 张旭,主要调用外网接口*/
import javax.servlet.http.HttpServletRequest;
import cn.deepcoding.model.ProxyTeacherWatch;
import cn.deepcoding.model.WatchXmlMessageEntity;
public interface ProxyTeacherWatchService {
// 判断改oppenid是否在数据库存在
boolean watchLogin(String entity,HttpServletRequest request);
// 发送短信
Map<String, String> getmessige(String tel, HttpServletRequest request);
// 验证吗接入验证
Map<String, String> getcode(HttpServletRequest request, String code);
}
| [
"17635911140@163.com"
] | 17635911140@163.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.