blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
30dacad8326096356b2c59f754406a6e921b9f6f
58fc635bb76967cc930709d4967b6a33b4b43857
/taotao-rest/src/main/java/com/taotao/rest/pojo/CatResult.java
6cddab9122f63d8c97530212e8f4364798fcc49d
[]
no_license
gaoyanjie1216/taotao
667239b71b6651e6fd3e844442212bd426c92649
d57269547383b2ccd55b254c66e4af25cd7f0e72
refs/heads/master
2020-03-09T06:21:02.187708
2018-04-09T01:02:08
2018-04-09T01:02:08
128,636,970
0
0
null
null
null
null
UTF-8
Java
false
false
281
java
package com.taotao.rest.pojo; import java.util.List; /** * Created by Gao on 2018/1/30. */ public class CatResult { private List<?> data; public List<?> getData() { return data; } public void setData(List<?> data) { this.data = data; } }
dbea312efb2c231454ada3eee26cfbe7274c8a30
a7e331ade994afba3c8fd4da5adc0e0e4e677872
/formationjpa/formationjpa/src/main/java/com/aplose/smooss/model/Module.java
c3ac082c2440d0eedb7101c873d0ead43f6925f9
[]
no_license
xhackax47/Formation-Java
b6fbbe5fc937dbf91603fb9f9f6a8e8cfe5e933c
5d15e1c7ff9969be3f7a95fc97a2151cea989f24
refs/heads/master
2020-03-10T06:13:15.879617
2018-05-30T10:05:17
2018-05-30T10:05:17
129,234,780
1
1
null
null
null
null
UTF-8
Java
false
false
448
java
package com.aplose.smooss.model; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @Entity public abstract class Module { @Id @GeneratedValue(strategy=GenerationType.AUTO) private long id; private String name = "Default Module Name"; public String getName() { return name; } public void setName(String name) { this.name = name; } }
32e9fbe38ac9fdab18506dddb9c3600a45400653
523454a2463a02ed807d32bc9dc2c069c52d579d
/QA_Repo/JOE/JavaFXApplication4/src/javafxapplication4/FXMLDocumentController.java
e8d695c450fa233cc904e5681eb3b634e493c921
[]
no_license
michaelnya/QA_AdvancedJava_Michael
5f91dfd1e5da866c7024c263c3136d019b6f811e
cc9caa4b620f1a3033c1b1e038d9a16479fbf674
refs/heads/master
2020-04-04T10:53:38.908724
2018-12-12T10:43:50
2018-12-12T10:43:50
155,870,701
0
0
null
null
null
null
UTF-8
Java
false
false
1,539
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 javafxapplication4; import java.net.URL; import java.util.ResourceBundle; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.collections.ObservableListBase; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.ComboBox; import javafx.scene.control.Label; import javafx.scene.control.TextArea; /** * * @author Administrator */ public class FXMLDocumentController implements Initializable { @FXML private Label label; @FXML private TextArea selectedEvent; @FXML private ComboBox<String> eventTypes; private ObservableList<String> eventTypeList; @FXML private void handleButtonAction(ActionEvent event) { System.out.println("You clicked me!"); label.setText("Hello World!"); } private ObservableList<String> getEventTypes() { if (eventTypeList == null) { eventTypeList = FXCollections.observableArrayList(); eventTypeList.add("Wedding"); eventTypeList.add("Motor Show"); eventTypeList.add("Flower Show"); } return eventTypeList; } @Override @FXML public void initialize(URL url, ResourceBundle rb) { // TODO eventTypes.setItems(getEventTypes()); } }
16aa413d6198cdd52bf886862456b4f8675f3c49
ef0664262f0fa1966e5f4377d2217f8f85ec7ed9
/src/org/great/mapper/IntroductionMapper.java
65c58661008afa650ad3ab6bda782ab4c7e27b73
[]
no_license
fourorder/OurMyproject
9323bb2b9a203912e095510f8121a1f8818081c4
c17a479cdbf0cce074f4fae0a21a431d98701bd4
refs/heads/master
2020-03-29T01:27:48.251100
2018-10-16T01:05:38
2018-10-16T01:05:38
149,390,714
0
0
null
2018-09-20T01:51:15
2018-09-19T04:07:10
CSS
UTF-8
Java
false
false
222
java
package org.great.mapper; import org.great.bean.IntroductionBean; import org.springframework.stereotype.Repository; @Repository public interface IntroductionMapper { public IntroductionBean getIntroduction(); }
[ "vv23884327" ]
vv23884327
76475b753b4a6c2cd3640727dc44969179207979
f59501342a7113245663cb21a7a4fbfe559f951a
/project_re/src/com/jsplec/wp/command/LoginCommand.java
136e46dc7cee8a60d8d971de0365be49efed5074
[]
no_license
aejung09/WhynMVC
a4ab416ee11c516d05e7729f573a2ae3c97c215d
9bdfa33149f8c69a89a896a44eff3a8c8ad32f20
refs/heads/master
2023-03-07T12:24:09.259111
2021-02-23T08:03:56
2021-02-23T08:03:56
340,413,620
0
0
null
null
null
null
UTF-8
Java
false
false
1,016
java
package com.jsplec.wp.command; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import com.jsplec.wp.dao.UloginDao; import com.jsplec.wp.dto.LoginDto; public class LoginCommand implements ACommand { @Override public void execute(HttpServletRequest request, HttpServletResponse response, HttpSession session) { String loginCheck="ok"; String userid = request.getParameter("userid"); String userpw = request.getParameter("userpw"); UloginDao dao = new UloginDao(); System.out.println("here"+dao.logincheck(userid, userpw)); if(dao.logincheck(userid,userpw)==1) { LoginDto dto = dao.login(userid, userpw); session.setAttribute("USERNO", dto.getUserno()); session.setAttribute("USERID", dto.getUserid()); session.setAttribute("USERNAME", dto.getUsername()); request.setAttribute("LOGIN",loginCheck); }else { loginCheck="no"; request.setAttribute("LOGIN",loginCheck); } } }
43c21de4bfc839e42a6487ca3164b8cc6d99d1f4
cb771861b684a287407cff8f10165bdf3bd66ff1
/core/src/com/itesm/pixelwars/Sprites/Animations/AnimationTower.java
01980f46a6de071ccab4644180f5bb9a4e9012a1
[]
no_license
PedroCorsob/PixelWar_Videogame
b2572f9b231c1144f3d673e00fb6344c46c7921b
75548e38c509daf827af39d9aa1f856917bb0fa2
refs/heads/master
2023-03-16T00:52:19.173211
2019-05-21T03:46:27
2019-05-21T03:46:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,100
java
package com.itesm.pixelwars.Sprites.Animations; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.Animation; import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.TextureRegion; public class AnimationTower { private int hp; private boolean isAlive; private final Animation animacion; private final Animation animacionDaño1; private final Animation animacionDaño2; private final Animation animacionDaño3; private Sprite sprite; private float timerAnimacion; private EStateTower estadoTorre; private final TextureRegion[][] texturaTorre; private final TextureRegion[][] texturaTorreDaño1; private final TextureRegion[][] texturaTorreDaño2; private final TextureRegion[][] texturaTorreDaño3; public AnimationTower(float x, float y, Texture torre, Texture torreDaño1, Texture torreDaño2, Texture torreDaño3){ this.isAlive=true; this.hp=500; // Cargar textura //Texture textura = new Texture("torreAzul"); // 400x66 = tamaño de la imagen // Crea una region TextureRegion region = new TextureRegion(torre); // Divide la región en frames de 32x64 texturaTorre = region.split(69,124); animacion = new Animation(0.15f,texturaTorre[0][5],texturaTorre[0][4],texturaTorre[0][3],texturaTorre[0][2],texturaTorre[0][1],texturaTorre[0][0]); animacion.setPlayMode(Animation.PlayMode.LOOP); //Primer Daño TextureRegion regionDaño1 = new TextureRegion(torreDaño1); // Divide la región en frames de 32x64 texturaTorreDaño1 = regionDaño1.split(69,124); animacionDaño1 = new Animation(0.15f,texturaTorreDaño1[0][5],texturaTorreDaño1[0][4],texturaTorreDaño1[0][3],texturaTorreDaño1[0][2],texturaTorreDaño1[0][1]); animacionDaño1.setPlayMode(Animation.PlayMode.LOOP); //Segundo Daño TextureRegion regionDaño2 = new TextureRegion(torreDaño2); // Divide la región en frames de 32x64 texturaTorreDaño2 = regionDaño2.split(69,124); animacionDaño2 = new Animation(0f,texturaTorreDaño2[0][1]); animacionDaño2.setPlayMode(Animation.PlayMode.LOOP); //Segundo Tercer Daño TextureRegion regionDaño3 = new TextureRegion(torreDaño3); // Divide la región en frames de 32x64 texturaTorreDaño3 = regionDaño3.split(69,124); animacionDaño3 = new Animation(0f,texturaTorreDaño3[0][1]); animacionDaño3.setPlayMode(Animation.PlayMode.LOOP); estadoTorre = EStateTower.SINDAÑO; timerAnimacion = 0; // Quieto sprite = new Sprite(texturaTorre[0][0]); sprite.setPosition(x,y); } public void render(SpriteBatch batch){ timerAnimacion += Gdx.graphics.getDeltaTime(); /**if(getHp()>350){ sprite.setRegion(texturaTorreDaño1[0][0]); TextureRegion region = (TextureRegion) animacion.getKeyFrame(timerAnimacion); batch.draw(region, sprite.getX(), sprite.getY()); }else { if(getHp()<=350 && getHp()>225){ sprite.setRegion(texturaTorreDaño1[0][1]); TextureRegion regionDaño1 = (TextureRegion) animacionDaño1.getKeyFrame(timerAnimacion); batch.draw(regionDaño1, sprite.getX(), sprite.getY()); }else{ if(getHp()<=225 && getHp()>100){ sprite.setRegion(texturaTorreDaño2[0][1]); TextureRegion regionDaño2 = (TextureRegion) animacionDaño2.getKeyFrame(timerAnimacion); batch.draw(regionDaño2, sprite.getX(), sprite.getY()); }else { sprite.setRegion(texturaTorreDaño3[0][1]); TextureRegion regionDaño3 = (TextureRegion) animacionDaño3.getKeyFrame(timerAnimacion); batch.draw(regionDaño3, sprite.getX(), sprite.getY()); } } }**/ switch (estadoTorre){ case SINDAÑO: sprite.setRegion(texturaTorre[0][0]); TextureRegion region = (TextureRegion) animacion.getKeyFrame(timerAnimacion); batch.draw(region, sprite.getX(), sprite.getY()); break; case DAÑO1: sprite.setRegion(texturaTorreDaño1[0][1]); TextureRegion regionDaño1 = (TextureRegion) animacionDaño1.getKeyFrame(timerAnimacion); batch.draw(regionDaño1, sprite.getX(), sprite.getY()); break; case DAÑO2: sprite.setRegion(texturaTorreDaño2[0][1]); TextureRegion regionDaño2 = (TextureRegion) animacionDaño2.getKeyFrame(timerAnimacion); batch.draw(regionDaño2, sprite.getX(), sprite.getY()); break; case DAÑO3: sprite.setRegion(texturaTorreDaño3[0][1]); TextureRegion regionDaño3 = (TextureRegion) animacionDaño3.getKeyFrame(timerAnimacion); batch.draw(regionDaño3, sprite.getX(), sprite.getY()); break; } } public void setHp(int hp) { this.hp = hp; } public int getHp() { return hp; } public void setAlive(boolean alive) { isAlive = alive; } public boolean isAlive() { return isAlive; } public void setEstado(EStateTower estadoTorre) { this.estadoTorre = estadoTorre; } public float getX() { return sprite.getX(); } public float getY() { return sprite.getY(); } public float getHeight() { return sprite.getHeight(); } public float getWidth() { return sprite.getWidth(); } public void setX(float x){ sprite.setX(x); } public void setY(float y){ sprite.setY(y); } public Sprite getSprite() { return sprite; } }
7c6577ff292f71a4f2b8fc36820ff1d34b8e809e
f987a243a6dcb4102821cd40fa1f13aa0f62f7ca
/src/Controller/HRApplication.java
b979d676bc46416bd8992b59704edd62c3c20927
[]
no_license
XXC123/sef
60017071ca5743b32e555c8f5d18ff50ff280b21
a4c56ee3c2551e9b64a80619ebb2dcd2dd4ea1fd
refs/heads/master
2020-03-08T07:34:45.398517
2018-04-06T11:51:07
2018-04-06T11:51:07
127,997,820
0
2
null
2018-04-06T10:09:15
2018-04-04T02:49:38
Java
UTF-8
Java
false
false
8,197
java
package Controller; import java.util.Scanner; import Models.Database; import Models.Message; import Models.Profile; import Models.Report; public class HRApplication { Scanner scanner=new Scanner(System.in); Database database; Profile profile; Message message; String staffType; public HRApplication() { Database database=new Database(); //initial database this.database=database; } public void run() { // TODO Auto-generated method stub staffType=login(); selectMenu(staffType); } public void adminUI() { System.out.println(); System.out.println("-----------Menu-----------"); System.out.println("1.Message other staff"); System.out.println("2.Check announcements/ notifications"); System.out.println("3.Check pay rates "); System.out.println("4.See weekly roster"); System.out.println("5.Update profile"); System.out.println("6.Gather report data"); System.out.println("7.View all staff"); System.out.println("8.View course staff requests"); System.out.println("9.Set rosters"); System.out.println("0.Allocate staff"); int selection= scanner.nextInt(); switch(selection) { case 1: message(); break; case 2: viewAnnouncements(); break; case 3: checkPayrate(); break; case 4: seeRoster(); break; case 5: viewProfile(); break; case 6: gatherPayroll(); break; case 7: viewStaff(); break; case 8: viewCourseStaffRequest(); break; case 9: setRoster(); break; case 0: allocateStaff(); break; } } public void coordinatorUI() { System.out.println(); System.out.println("-----------Menu-----------"); System.out.println("1.Message other staff"); System.out.println("2.Check announcements/ notifications"); System.out.println("3.Check pay rates"); System.out.println("4.See weekly roster"); System.out.println("5.Update profile"); System.out.println("6.See course budget"); System.out.println("7.Set payrate for event"); System.out.println("8.Class timetabling"); System.out.println("9.Request staff for events"); System.out.println("0.Make course anouncement"); int selection= scanner.nextInt(); switch(selection) { case 1: message(); break; case 2: viewAnnouncements(); break; case 3: checkPayrate(); break; case 4: seeRoster(); break; case 5: viewProfile(); break; case 6: seeCourseBudget(); break; case 7: approveStaffPay(); break; case 8: createCourseEvent(); break; case 9: StaffForEvent(); break; case 0: Announcement(); break; } } public void casualUI() { System.out.println(); System.out.println("-----------Menu-----------"); System.out.println("1.Message other staff"); System.out.println("2.Check announcements/ notifications"); System.out.println("3.Check pay rates "); System.out.println("4.See weekly roster"); System.out.println("5.Update profile"); System.out.println("6.Update resume"); System.out.println("7.Apply for positions"); int selection= scanner.nextInt(); switch(selection) { case 1: message(); break; case 2: viewAnnouncements(); break; case 3: checkPayrate(); break; case 4: seeRoster(); break; case 5: viewProfile(); break; case 6: gatherPayroll(); break; case 7: viewStaff(); break; case 8: viewCourseStaffRequest(); break; case 9: setRoster(); break; case 0: allocateStaff(); break; } } public void timeManagerUI() { System.out.println(); System.out.println("-----------Menu-----------"); System.out.println("1.Message other staff"); System.out.println("2.Check announcements/ notifications"); System.out.println("3.Check pay rates"); System.out.println("4.See weekly roster"); System.out.println("5.Update profile"); System.out.println("6.Gather weekly payroll data"); System.out.println("7.Approve staff weekly pay"); int selection= scanner.nextInt(); switch(selection) { case 1: message(); break; case 2: viewAnnouncements(); break; case 3: checkPayrate(); break; case 4: seeRoster(); break; case 5: viewProfile(); break; case 6: gatherPayroll(); break; case 7: viewStaff(); break; case 8: viewCourseStaffRequest(); break; case 9: setRoster(); break; case 0: allocateStaff(); break; } } // login function public String login() { String staffType=null; boolean loginSuccess= false; String inputUsername; String inputPassword; while( loginSuccess == false) { System.out.println("Log in"); System.out.println("Username:"); inputUsername = scanner.next(); System.out.println("Password:"); inputPassword = scanner.next(); int staffAmount=database.getStaffDatabase().size(); for(int scanStaffList=0; scanStaffList<staffAmount;scanStaffList++) { if (database.getStaffDatabase().get(scanStaffList).getUsername().equals(inputUsername)) { if (inputPassword.equals(database.getStaffDatabase().get(scanStaffList).getPassword())) { loginSuccess = true; staffType=database.getStaffDatabase().get(scanStaffList).getStaffType(); profile =new Profile(database.getStaffDatabase().get(scanStaffList).getGivenName(),database.getStaffDatabase().get(scanStaffList).getFamilyName(),database.getStaffDatabase().get(scanStaffList).getDob(),database.getStaffDatabase().get(scanStaffList).getPhone(),database.getStaffDatabase().get(scanStaffList).getEmail()); System.out.println("Welcome to the system."); break; } } } if (loginSuccess== false) System.out.println("Username or password is wrong!"); } return staffType; } public void message() { //to-do } public void viewAnnouncements() { //to-do } public void checkPayrate() { //to-do } public void seeRoster() { //to-do } public void applyPosition() { //to-do } public void viewStaff() { //to-do } public void viewCourseStaffRequest() { //to-do } public void setRoster() { //to-do } public void allocateStaff() { //to-do } public void gatherPayroll() { //to-do Report report=new Report(); report.generateReport(); } public void approveStaffPay() { //to-do } public void seeCourseBudget() { //to-do } public void createCourseBudget() { //to-do } public void createCourseEvent() { //to-do }public void StaffForEvent() { //to-do }public void Announcement() { //to-do } public void viewProfile() { profile.viewProfile(); // System.out.println("-------Modify your profile:-------"); System.out.println("1.Modify whole profile"); System.out.println("2.Modify one featrue"); int selection= scanner.nextInt(); switch(selection) { case 1: profile.modifyProfile(); break; case 2: System.out.println("1.Modify given name"); System.out.println("2.Modify faminly name"); System.out.println("3.Modify dob"); System.out.println("4.Modify phone"); System.out.println("5.Modify email"); selection= scanner.nextInt(); switch(selection) { case 1: System.out.println("Input new given name"); profile.setGivenName(scanner.next()); break; case 2: System.out.println("Input new family name"); profile.setFamilyName(scanner.next()); break; case 3: System.out.println("Input new dob"); profile.setDob(scanner.next()); break; case 4: System.out.println("Input new phone"); profile.setPhone(scanner.next()); break; case 5: System.out.println("Input new email"); profile.setEmail(scanner.next()); break; } break; } profile.viewProfile(); selectMenu(staffType); } public void selectMenu(String staffType) { if(staffType.equals("admin")) adminUI(); else if(staffType.equals("coordinator")) coordinatorUI(); else if(staffType.equals("casual")) casualUI(); else if (staffType.equals("time")) timeManagerUI(); else System.out.println("Staff type is wrong: "+staffType); } }
b1bcb1f7bc2aea50897825cde5d59dd63d0d3249
00ba0b6e85134de36ad716ee4c9b38250bd0fba1
/src/main/java/com/capgemini/mrapid/metaApp/utils/Decrypt.java
ae2f047be2c1c53b8f576835eb16c4a7bb69a016
[]
no_license
ks228/metaApp
0cafeffd872d6be989738073bf5bdc3d8a6e26e9
909bccf35633ad871af5486829d1488be2440a9e
refs/heads/master
2020-03-25T06:35:47.373813
2018-07-31T06:43:10
2018-07-31T06:43:10
143,512,385
0
1
null
2018-08-04T08:40:35
2018-08-04T08:40:35
null
UTF-8
Java
false
false
750
java
/** * */ package com.capgemini.mrapid.metaApp.utils; import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; import org.apache.commons.codec.binary.Base64; /** * @author audasi * */ public class Decrypt { public static String decrypt(String strToDecrypt, String secret) { try { SecretKeySpec secretKey = Key.setKey(secret); Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5PADDING"); cipher.init(Cipher.DECRYPT_MODE, secretKey); return new String(cipher.doFinal(Base64.decodeBase64(strToDecrypt))); } catch (Exception e) { System.out.println("Error while decrypting: " + e.toString()); } return null; } }
e3295e56b9715b7ecdd317cb1a405fb2bf395e37
791ddf4cbc563f533e7d00a9259e24fe85008877
/kernel/src/test/java/org/jboss/test/kernel/dependency/test/GenericBeanFactoryCallbackDependencyXMLTestCase.java
3e6d792c2fa57f873005a6cc968faa04ec7075c2
[]
no_license
wolfc/microcontainer
7dd1fe85057c31575458ad1a22c3f74534f72bd0
4ef8127e690e18f54f40287b72f68dbf3541b07c
refs/heads/master
2020-04-25T23:27:30.830476
2013-01-09T14:15:50
2013-01-09T14:15:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,575
java
/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.kernel.dependency.test; import junit.framework.Test; /** * Callback Dependency Test Case. * * @author <a href="[email protected]">Ales Justin</a> */ public class GenericBeanFactoryCallbackDependencyXMLTestCase extends GenericBeanFactoryCallbackDependencyTestCase { public static Test suite() { return suite(GenericBeanFactoryCallbackDependencyXMLTestCase.class); } public GenericBeanFactoryCallbackDependencyXMLTestCase(String name) throws Throwable { super(name, true); } }
eacf3513c3e30f8f98dd7e6da38fb854e229e242
c5ade0bb62af49d2b4a740433c2a1f8178ac3c2f
/common/src/test/java/perfomance/AnySorterTest.java
4ab1dc585269d98a72ffb1c48f8261d7cd7773a5
[]
no_license
ddy88958620/experiments
cef89db9c0b93cd0294a9948a243ac754221c4ec
ad7f50583225713ba32d802a74bc5b1359ab9582
refs/heads/master
2021-01-15T15:57:40.961966
2014-10-17T13:44:48
2014-10-17T13:44:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,011
java
package perfomance; import factory.ObjectFactory; import functional.AnySorter; import junit.framework.Assert; import org.junit.Before; import org.junit.Test; import java.util.Date; import java.util.List; /** * 排序测试 * * @autor youmoo * @since 2014-04-17 下午4:43 */ public class AnySorterTest { List<ValueHolder> valueHolders = ObjectFactory.list(); Date min = new Date(); @Before public void prepare() { valueHolders.add(new ValueHolder("a", 1, 1.1, min)); valueHolders.add(new ValueHolder("b", 2, 2.1, new Date())); valueHolders.add(new ValueHolder("c", 3, 3.1, new Date())); valueHolders.add(new ValueHolder("d", 4, 4.1, new Date())); // valueHolders.add(new ValueHolder(null, null, null, null)); } @Test public void sortByString() { AnySorter.sort(valueHolders, "username", "asc"); Assert.assertEquals(valueHolders.get(0).getUsername(), "a"); AnySorter.sort(valueHolders, "username", "desc"); Assert.assertEquals(valueHolders.get(0).getUsername(), "d"); } @Test public void sortByInteger() { AnySorter.sort(valueHolders, "age", "asc"); Assert.assertEquals(valueHolders.get(0).getAge(), new Integer(1)); AnySorter.sort(valueHolders, "age", "desc"); Assert.assertEquals(valueHolders.get(0).getAge(), new Integer(4)); } @Test public void sortByDouble() { AnySorter.sort(valueHolders, "height", "asc"); Assert.assertEquals(valueHolders.get(0).getHeight(), new Double(1.1)); AnySorter.sort(valueHolders, "height", "desc"); Assert.assertEquals(valueHolders.get(0).getHeight(), new Double(4.1)); } @Test public void sortByDate() { AnySorter.sort(valueHolders, "birthday", "asc"); Assert.assertEquals(valueHolders.get(0).getBirthday(), min); AnySorter.sort(valueHolders, "birthday", "desc"); Assert.assertEquals(valueHolders.get(3).getBirthday(), min); } }
856a0a56f42296e792db7dcb75ce1235db3554df
14998338240e44294fb335d6724f01d884ae5bad
/src/main/java/week2/day1/exercises/Fibonacci.java
e08565d841818b413a96e5b54f0404b7c0cae393
[]
no_license
sdnayani/SQAMavenTests2018
f858b538b6d5710c1dec921d958ad3ec6bc65408
58e613c987954028b461cd7a0f481aa5e1209828
refs/heads/master
2020-06-02T19:37:36.732002
2019-06-11T03:18:20
2019-06-11T03:18:20
191,285,581
0
0
null
null
null
null
UTF-8
Java
false
false
359
java
package week2.day1.exercises; public class Fibonacci { public static void main(String[] args) { //The Fibonacci sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21, ... int n1=0; int n2=1; int n3=0; int count=9; System.out.print(n1 + " "+n2); for(int i=2; i<count; i++) { n3=n1+n2; System.out.print(" " +n3); n1=n2; n2=n3; } } }
0b4310aed8401c231ff5b518fcf8a442c87d2570
0368be770c062e94b85b46808bf9b53c9e108b47
/LinguaeLive-client/src/main/java/ca/jhosek/linguaelive/AppGinjector.java
d45df22e7116dda7fe4df73df7c8b11cb2a332d4
[]
no_license
astevko/LinguaeLive
17b55fcf757e02657d884a27a0e337737c89ab76
5cfd63159c315cfb9d3ced8c39f2d5c5904f80e9
refs/heads/master
2021-06-19T22:03:40.020403
2020-01-10T01:42:16
2020-01-10T01:42:16
203,217,096
1
1
null
2021-03-31T21:32:38
2019-08-19T17:16:24
Java
UTF-8
Java
false
false
604
java
package ca.jhosek.linguaelive; import com.google.gwt.inject.client.GinModules; import com.google.gwt.inject.client.Ginjector; import com.google.gwt.place.shared.PlaceHistoryHandler; import ca.jhosek.linguaelive.domain.CurrentState; import ca.jhosek.linguaelive.ui.MainView; import ca.jhosek.linguaelive.proxy.AppRequestFactory; @GinModules({AppGinModule.class}) public interface AppGinjector extends Ginjector { PlaceHistoryHandler getPlaceHistoryHandler(); MainView getMainView(); CurrentState getCurrentState(); AppRequestFactory getRequestFactory(); AppResources getAppResources(); }
6d47e6e8a173c5449073f5c0f9b6f837ceee1d11
909123b645eb0e73dccc128ae68c547d6a96b365
/SpringKafka/src/main/java/com/egen/service/impl/CustomerServiceImpl.java
a8bba1a6c2b6f8751c00f24482d4d8e31e618d42
[]
no_license
SurbhiJain27/Kafka_Consumer_Producer
ff37941b8e35fdc29b0af756363ee75ff6550c52
6adf22c97b643f69ae20a986b115c8cc3ecbaeaf
refs/heads/master
2022-12-27T06:55:42.216668
2020-10-02T00:57:26
2020-10-02T00:57:26
300,460,033
0
0
null
null
null
null
UTF-8
Java
false
false
196
java
package com.egen.service.impl; import com.egen.service.ICustomerService; import org.springframework.stereotype.Service; @Service public class CustomerServiceImpl implements ICustomerService { }
3674812f5167d21a8479ca59723b7e8b3c96ee17
8b818d49b299955115eabe332ec44c953ba2b2c8
/src/main/java/org/twuni/common/persistence/jdbc/Transaction.java
23be5b4d69cec0281c2d78f224c8260be2728179
[ "Apache-2.0" ]
permissive
twuni/common-persistence-jdbc
20c780258a76ae1076b4c50721bcdf0fd36f1b00
0f83d17194917be34680065234fff1af8def26c0
refs/heads/master
2021-01-01T18:48:46.661868
2012-07-25T05:16:30
2012-07-25T05:16:30
2,074,331
0
0
null
null
null
null
UTF-8
Java
false
false
1,013
java
package org.twuni.common.persistence.jdbc; import java.sql.SQLException; import org.twuni.common.persistence.exception.RollbackException; class Transaction implements Runnable { private final java.sql.Connection connection; private final org.twuni.common.persistence.Transaction transaction; public Transaction( java.sql.Connection connection, org.twuni.common.persistence.Transaction transaction ) { this.connection = connection; this.transaction = transaction; } @Override public void run() { try { Session session = new Session( connection ); transaction.perform( session ); connection.commit(); } catch( Exception exception ) { tryRollback( exception ); } } private void tryRollback( Throwable throwable ) { try { connection.rollback(); } catch( SQLException exception ) { throw new RollbackException( exception ); } if( throwable instanceof RuntimeException ) { throw (RuntimeException) throwable; } throw new RuntimeException( throwable ); } }
bd5df9b0e8f221de2a995f76298962878912dfe5
24a32bc2aafcca19cf5e5a72ee13781387be7f0b
/src/framework/tags/gwt-test-utils-parent-0.24.1/gwt-test-utils-parent-0.24.1/gwt-test-utils/src/test/java/com/octo/gwt/test/dom/ElementTest.java
c6993987adf874dece9c882aa015a0dcf340c5b6
[]
no_license
google-code-export/gwt-test-utils
27d6ee080f039a8b4111e04f32ba03e5396dced5
0391347ea51b3db30c4433566a8985c4e3be240e
refs/heads/master
2016-09-09T17:24:59.969944
2012-11-20T07:13:03
2012-11-20T07:13:03
32,134,062
0
0
null
null
null
null
UTF-8
Java
false
false
8,758
java
package com.octo.gwt.test.dom; import java.util.HashMap; import java.util.Map; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import com.google.gwt.dom.client.AnchorElement; import com.google.gwt.dom.client.BaseElement; import com.google.gwt.dom.client.ButtonElement; import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Node; import com.google.gwt.dom.client.NodeList; import com.octo.gwt.test.GwtTest; import com.octo.gwt.test.internal.patchers.dom.NodeFactory; public class ElementTest extends GwtTest { private Element e; @Before public void initElement() { e = Document.get().createElement("a"); } @Test public void checkCast() { AnchorElement casted = e.cast(); Assert.assertNotNull(casted); try { ButtonElement notCasted = e.cast(); Assert.fail("An [" + AnchorElement.class.getCanonicalName() + "] should not be cast in an instance of [" + notCasted.getClass().getCanonicalName() + "]"); } catch (Exception e) { Assert.assertTrue(e instanceof ClassCastException); } } @Test public void checkCloneDeep() { e.setTitle("title"); e.setPropertyBoolean("bool", true); AnchorElement child = Document.get().createAnchorElement(); child.setTitle("child"); e.appendChild(child); AnchorElement newNode = (AnchorElement) e.cloneNode(true); Assert.assertEquals("title", newNode.getTitle()); Assert.assertNull("Cloned element's parent should be null", newNode.getParentNode()); Assert.assertEquals(true, newNode.getPropertyBoolean("bool")); Assert.assertEquals("Deep cloned element should have child nodes", 1, newNode.getChildNodes().getLength()); Assert.assertTrue(child != newNode.getChildNodes().getItem(0)); Assert.assertEquals(1, e.getChildNodes().getLength()); } @Test public void checkCloneNotDeep() { e.setTitle("title"); e.setPropertyBoolean("bool", true); AnchorElement child = Document.get().createAnchorElement(); child.setTitle("child"); e.appendChild(child); AnchorElement newNode = (AnchorElement) e.cloneNode(false); Assert.assertEquals("title", newNode.getTitle()); Assert.assertNull("Cloned element's parent should be null", newNode.getParentNode()); Assert.assertEquals(true, newNode.getPropertyBoolean("bool")); Assert.assertEquals("Not deep cloned element should not have child nodes", 0, newNode.getChildNodes().getLength()); Assert.assertEquals(1, e.getChildNodes().getLength()); } @Test public void checkAttribute() { Assert.assertNull(e.getAttribute("input")); e.setAttribute("input", "text"); Assert.assertEquals("text", e.getAttribute("input")); } @Test public void checkClassName() { e.setClassName("clazz"); Assert.assertEquals("clazz", e.getClassName()); } @Test public void checkDir() { e.setDir("dir"); Assert.assertEquals("dir", e.getDir()); } @Test public void checkGetElementByTagName() { // Set up AnchorElement ae0 = Document.get().createAnchorElement(); AnchorElement ae1 = Document.get().createAnchorElement(); ButtonElement be = Document.get().createPushButtonElement(); e.appendChild(ae0); e.appendChild(ae1); e.appendChild(be); // Tests NodeList<Element> anchorList = e.getElementsByTagName("a"); NodeList<Element> buttonList = e.getElementsByTagName("button"); NodeList<Element> allList = e.getElementsByTagName("*"); // Asserts Assert.assertEquals(2, anchorList.getLength()); Assert.assertEquals(ae0, anchorList.getItem(0)); Assert.assertEquals(ae1, anchorList.getItem(1)); Assert.assertEquals(1, buttonList.getLength()); Assert.assertEquals(be, buttonList.getItem(0)); Assert.assertEquals(3, allList.getLength()); Assert.assertEquals(ae0, allList.getItem(0)); Assert.assertEquals(ae1, allList.getItem(1)); Assert.assertEquals(be, allList.getItem(2)); } @Test public void checkGetFirstChildElement() { Assert.assertNull(e.getFirstChildElement()); // Set up Node node = NodeFactory.createNode(); ButtonElement be0 = Document.get().createPushButtonElement(); ButtonElement be1 = Document.get().createPushButtonElement(); e.appendChild(node); e.appendChild(be0); e.appendChild(be1); // Test & Assert Assert.assertEquals(be0, e.getFirstChildElement()); } @Test public void checkId() { e.setId("myId"); Assert.assertEquals("myId", e.getId()); } @Test public void checkInnerHTML() { e.setInnerHTML("<h1>test</h1>"); Assert.assertEquals("<h1>test</h1>", e.getInnerHTML()); Assert.assertEquals(1, e.getChildCount()); Element h1 = (Element) e.getChild(0); Assert.assertEquals("H1", h1.getTagName()); Assert.assertEquals("test", h1.getInnerText()); } @Test public void checkInnerText() { e.setInnerText("myText"); Assert.assertEquals("myText", e.getInnerText()); } @Test public void checkLang() { e.setLang("myLang"); Assert.assertEquals("myLang", e.getLang()); } @Test public void checkGetNextSiblingElement() { Assert.assertNull(e.getNextSiblingElement()); // Set up ButtonElement be0 = Document.get().createPushButtonElement(); ButtonElement be1 = Document.get().createPushButtonElement(); e.appendChild(be0); e.appendChild(NodeFactory.createTextNode("test1")); e.appendChild(be1); e.appendChild(NodeFactory.createTextNode("test2")); // Test & Assert Assert.assertEquals(be1, be0.getNextSiblingElement()); Assert.assertNull(be1.getNextSiblingElement()); } @Test public void checkGetParentElement() { //Set up BaseElement be = Document.get().createBaseElement(); e.appendChild(be); //Test and assert Assert.assertEquals(e, be.getParentElement()); //Set up Node node = NodeFactory.createNode(); node.appendChild(be); Assert.assertNull(be.getParentElement()); Assert.assertFalse("Child nodes list should be empty since the only child has been attached to another parent node", e.hasChildNodes()); } @Test public void checkPropertyBoolean() { e.setPropertyBoolean("prop", true); Assert.assertTrue(e.getPropertyBoolean("prop")); e.setPropertyBoolean("prop", false); Assert.assertFalse(e.getPropertyBoolean("prop")); } @Test public void checkPropertyDouble() { e.setPropertyDouble("prop", 23); Assert.assertEquals(new Double(23), (Double) e.getPropertyDouble("prop")); } @Test public void checkPropertyInt() { e.setPropertyInt("prop", 2); Assert.assertEquals(new Integer(2), (Integer) e.getPropertyInt("prop")); } @Test public void checkPropertyString() { e.setPropertyString("prop", "test"); Assert.assertEquals("test", e.getPropertyString("prop")); } @Test public void checkScrollLeft() { e.setScrollLeft(3); Assert.assertEquals(3, e.getScrollLeft()); } @Test public void checkScrollTop() { e.setScrollTop(3); Assert.assertEquals(3, e.getScrollTop()); } @Test public void checkStyle() { e.getStyle().setProperty("test", "value"); Assert.assertEquals("value", e.getStyle().getProperty("test")); } @Test public void checkTagName() { Assert.assertEquals("a", e.getTagName()); } @Test public void checkTitle() { e.setTitle("myTitle"); Assert.assertEquals("myTitle", e.getTitle()); } @Test public void checkIsOrHasChild() { // Set up AnchorElement child = Document.get().createAnchorElement(); e.appendChild(child); AnchorElement notAChild = Document.get().createAnchorElement(); // Test & Assert Assert.assertTrue(e.isOrHasChild(e)); Assert.assertTrue(e.isOrHasChild(child)); Assert.assertFalse(e.isOrHasChild(notAChild)); } @Test public void checkRemoveAttribute() { // Set up e.setAttribute("test", "value"); // Test e.removeAttribute("test"); // Assert Assert.assertNull("Removed attribute should return null", e.getAttribute("test")); } @Test public void checkGetOffset() { Element parent = Document.get().createElement("a"); parent.appendChild(e); Assert.assertEquals(0, e.getOffsetHeight()); Assert.assertEquals(0, e.getOffsetLeft()); Assert.assertEquals(0, e.getOffsetTop()); Assert.assertEquals(0, e.getOffsetWidth()); Assert.assertEquals(parent, e.getOffsetParent()); } @Test public void checkHashCode() { // Setup Map<Element, String> map = new HashMap<Element, String>(); // Test map.put(e, "a string value"); map.put(e, "this value should have overrided the first one"); // Assert Assert.assertEquals("this value should have overrided the first one", map.get(e)); } }
[ "gael.lazzari@d9eb14d4-a931-11de-b950-3d5b5f4ea0aa" ]
gael.lazzari@d9eb14d4-a931-11de-b950-3d5b5f4ea0aa
4ea472423287079b542f1fe4bc937510037be859
a9cb8510b4aa0add7ec86aacbadc8cc3dc03192c
/src/main/java/br/com/cdbem/web/rest/PacienteResource.java
a88d3dcad62b5240343775bd8d60cf172a546d5f
[]
no_license
alecindro/new_cuidebem
632ac6b4fa369a4477632f6b5b51caa8214d857a
4cde3ce98c72a2ed983a02719c230eb95ac44491
refs/heads/master
2022-12-23T21:40:15.897322
2019-11-15T19:38:53
2019-11-15T19:38:53
221,989,545
0
0
null
2022-12-16T05:06:25
2019-11-15T19:26:56
Java
UTF-8
Java
false
false
6,428
java
package br.com.cdbem.web.rest; import br.com.cdbem.domain.Paciente; import br.com.cdbem.service.PacienteService; import br.com.cdbem.web.rest.errors.BadRequestAlertException; import br.com.cdbem.service.dto.PacienteCriteria; import br.com.cdbem.service.PacienteQueryService; import io.github.jhipster.web.util.HeaderUtil; import io.github.jhipster.web.util.PaginationUtil; import io.github.jhipster.web.util.ResponseUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.web.servlet.support.ServletUriComponentsBuilder; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.net.URI; import java.net.URISyntaxException; import java.util.List; import java.util.Optional; /** * REST controller for managing {@link br.com.cdbem.domain.Paciente}. */ @RestController @RequestMapping("/api") public class PacienteResource { private final Logger log = LoggerFactory.getLogger(PacienteResource.class); private static final String ENTITY_NAME = "paciente"; @Value("${jhipster.clientApp.name}") private String applicationName; private final PacienteService pacienteService; private final PacienteQueryService pacienteQueryService; public PacienteResource(PacienteService pacienteService, PacienteQueryService pacienteQueryService) { this.pacienteService = pacienteService; this.pacienteQueryService = pacienteQueryService; } /** * {@code POST /pacientes} : Create a new paciente. * * @param paciente the paciente to create. * @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new paciente, or with status {@code 400 (Bad Request)} if the paciente has already an ID. * @throws URISyntaxException if the Location URI syntax is incorrect. */ @PostMapping("/pacientes") public ResponseEntity<Paciente> createPaciente(@Valid @RequestBody Paciente paciente) throws URISyntaxException { log.debug("REST request to save Paciente : {}", paciente); if (paciente.getId() != null) { throw new BadRequestAlertException("A new paciente cannot already have an ID", ENTITY_NAME, "idexists"); } Paciente result = pacienteService.save(paciente); return ResponseEntity.created(new URI("/api/pacientes/" + result.getId())) .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString())) .body(result); } /** * {@code PUT /pacientes} : Updates an existing paciente. * * @param paciente the paciente to update. * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated paciente, * or with status {@code 400 (Bad Request)} if the paciente is not valid, * or with status {@code 500 (Internal Server Error)} if the paciente couldn't be updated. * @throws URISyntaxException if the Location URI syntax is incorrect. */ @PutMapping("/pacientes") public ResponseEntity<Paciente> updatePaciente(@Valid @RequestBody Paciente paciente) throws URISyntaxException { log.debug("REST request to update Paciente : {}", paciente); if (paciente.getId() == null) { throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); } Paciente result = pacienteService.save(paciente); return ResponseEntity.ok() .headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, paciente.getId().toString())) .body(result); } /** * {@code GET /pacientes} : get all the pacientes. * * @param pageable the pagination information. * @param criteria the criteria which the requested entities should match. * @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of pacientes in body. */ @GetMapping("/pacientes") public ResponseEntity<List<Paciente>> getAllPacientes(PacienteCriteria criteria, Pageable pageable) { log.debug("REST request to get Pacientes by criteria: {}", criteria); Page<Paciente> page = pacienteQueryService.findByCriteria(criteria, pageable); HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page); return ResponseEntity.ok().headers(headers).body(page.getContent()); } /** * {@code GET /pacientes/count} : count all the pacientes. * * @param criteria the criteria which the requested entities should match. * @return the {@link ResponseEntity} with status {@code 200 (OK)} and the count in body. */ @GetMapping("/pacientes/count") public ResponseEntity<Long> countPacientes(PacienteCriteria criteria) { log.debug("REST request to count Pacientes by criteria: {}", criteria); return ResponseEntity.ok().body(pacienteQueryService.countByCriteria(criteria)); } /** * {@code GET /pacientes/:id} : get the "id" paciente. * * @param id the id of the paciente to retrieve. * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the paciente, or with status {@code 404 (Not Found)}. */ @GetMapping("/pacientes/{id}") public ResponseEntity<Paciente> getPaciente(@PathVariable Long id) { log.debug("REST request to get Paciente : {}", id); Optional<Paciente> paciente = pacienteService.findOne(id); return ResponseUtil.wrapOrNotFound(paciente); } /** * {@code DELETE /pacientes/:id} : delete the "id" paciente. * * @param id the id of the paciente to delete. * @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}. */ @DeleteMapping("/pacientes/{id}") public ResponseEntity<Void> deletePaciente(@PathVariable Long id) { log.debug("REST request to delete Paciente : {}", id); pacienteService.delete(id); return ResponseEntity.noContent().headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString())).build(); } }
472a3a5add602c53974c733cd7059950e7c9deb8
50663b580b7e3bb9a70613ba9094b13796285fa1
/src/main/java/in/kirthika/exception/InvalidNumberLengthException.java
858da3fff3c72a12b88ba4828363322a583ad7e7
[]
no_license
csys-fresher-batch-2021/bloodbankapp-kirthika
bc303929ff87a8906be60535ce9545c07f48298e
6f6bab2c7406568c53d9556d578167d293b57ca6
refs/heads/main
2023-06-01T20:14:56.093397
2021-06-20T06:12:32
2021-06-20T06:12:32
364,487,311
0
0
null
2021-06-10T14:50:09
2021-05-05T06:55:41
Java
UTF-8
Java
false
false
290
java
package in.kirthika.exception; public class InvalidNumberLengthException extends Exception { /** * method to display mobile number length is invalid */ private static final long serialVersionUID = 1L; public InvalidNumberLengthException(String message) { super(message); } }
6cd501d0cd39a87ba2c8327a18760610c5d5c8ca
9bb6fecc1bd05d2b559671f19fea82ac32097493
/Selenium programs1/Listner.java
4198e72352f044abb8592318cd9788a031749421
[]
no_license
ravinangre/seleniumprograms
c3a92a634f1ea7c8f4667bcd9326a12cd80ebc9a
7cd0161f1da90062b6a1fca9d83cb28487c3d334
refs/heads/master
2022-12-14T15:22:07.108234
2020-09-12T03:58:09
2020-09-12T03:58:09
294,854,554
0
0
null
2020-09-12T03:58:10
2020-09-12T02:31:09
HTML
UTF-8
Java
false
false
957
java
package ListnerDemo1; import org.testng.ITestContext; import org.testng.ITestListener; import org.testng.ITestResult; public class Listner implements ITestListener{ @Override public void onTestStart(ITestResult result) { System.out.println("The execution of the main test starts now"); } @Override public void onTestSuccess(ITestResult result) { System.out.println("Test case passed and results are"+result.getName()); } @Override public void onTestFailure(ITestResult result) { System.out.println("Test case failed and results are"+result.getName()); } @Override public void onTestSkipped(ITestResult result) { System.out.println("Test case skipped and results are"+result.getName()); } @Override public void onTestFailedButWithinSuccessPercentage(ITestResult result) { } @Override public void onStart(ITestContext context) { } @Override public void onFinish(ITestContext context) { } }
ce3ff48d86208bd7443fc24167a56b438159fabc
084e53172f632f519542b2a326e6fcb76c3f675b
/src/main/java/cn/kepu/elearning/controller/EmerPlanController.java
cd016627a9eb0abff54f4fb67e88dba2f942f93e
[]
no_license
line521356/Questionnaire
79807787299847d35a1787c537235e7ea229fe29
38210cb250c8148eb6749eb8b9894ece2166583d
refs/heads/master
2020-04-09T06:42:32.053759
2018-12-03T03:10:02
2018-12-03T03:10:10
160,124,004
0
0
null
null
null
null
UTF-8
Java
false
false
11,439
java
package cn.kepu.elearning.controller; import java.util.List; import javax.ejb.Local; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.mail.MailAuthenticationException; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.support.RequestContextUtils; import org.w3c.dom.ls.LSInput; import com.alibaba.fastjson.JSONObject; import cn.kepu.elearning.pojo.Crew; import cn.kepu.elearning.pojo.EmergencyPlan; import cn.kepu.elearning.pojo.Location; import cn.kepu.elearning.pojo.Material; import cn.kepu.elearning.pojo.Route; import cn.kepu.elearning.pojo.WaterSource; import cn.kepu.elearning.service.IEmerPlanService; import cn.kepu.elearning.service.IRouteMapService; /** * 扑火预案与扑救资源controller */ @Controller @RequestMapping("/emrPlan") public class EmerPlanController { @Autowired @Qualifier("emerPlanService") private IEmerPlanService emerPlanService; @Autowired @Qualifier("routemapService") private IRouteMapService routemapService; /** * 创建新的预案 * @return */ @RequestMapping("/createNew") public String createNew(){ return "PlanPages/createPlan"; } @RequestMapping("/planList") public String planList(){ return "PlanPages/planList"; } @RequestMapping("/locateSrc") public String locateSrc(){ return "PlanPages/locateSrc"; } @RequestMapping("/detInfoWin") public String detInfoWin(){ return "PlanPages/planDetInfo"; } @RequestMapping("/revInfoWin") public String revInfoWin(){ return "PlanPages/revisePlan"; } @RequestMapping("/ffSrcList") public String ffSrcList(){ return "PlanPages/ffSrcList"; } @RequestMapping("/toCreateMat") public String toCreateMat(){ return "PlanPages/createMat"; } @RequestMapping("/toCreateWat") public String toCreateWat(){ return "PlanPages/createWat"; } @RequestMapping("/toCreateCrew") public String toCreateCrew(){ return "PlanPages/createCrew"; } @RequestMapping("/toRvdMat") public String toRvdMat(){ return "PlanPages/reviseMat"; } @RequestMapping("/toRvdWat") public String toRvdWat(){ return "PlanPages/reviseWat"; } @RequestMapping("/toRvdCrew") public String toRvdCrew(){ return "PlanPages/reviseCrew"; } /** * 获取最短路径 * @param location * @return */ @RequestMapping("/countRts") @ResponseBody public JSONObject countRts(@RequestBody Location location){ JSONObject result = new JSONObject(); result = emerPlanService.srchRoutes(location.getZmLev(), location.getRtID()); //绑定入参方便,实际是起始和终点路径的ID result.put("msg", 1); return result; } /** * 用户修改路径,获取路径信息 * @param emergencyPlan * @return */ @RequestMapping("/reviseRts") @ResponseBody public JSONObject rvdRts(@RequestBody EmergencyPlan emergencyPlan){ JSONObject result = new JSONObject(); result = emerPlanService.rvdRoutes(emergencyPlan.getRoutes()); //绑定入参方便,实际只有用户修改后输入的路径ID序列 return result; } /** * 查询物资点或水源点 * @param emergencyPlan * @return */ @RequestMapping("/srchPois") @ResponseBody public JSONObject srchPois(@RequestBody EmergencyPlan emergencyPlan){ JSONObject result = new JSONObject(); result = emerPlanService.srchPois(emergencyPlan); //绑定入参方便,实际只有用户选择的POI点ID序列(新建是单个,修改是多个) return result; } /** * 用户修改预案中的物资点-获取物资点信息 * @param emergencyPlan * @return */ @RequestMapping("/rvdMats") @ResponseBody public JSONObject rvdMats(@RequestBody EmergencyPlan emergencyPlan){ JSONObject result = new JSONObject(); result = emerPlanService.rvdMats(emergencyPlan.getMaterials()); //绑定入参方便,实际只有用户修改后输入的路径ID序列 return result; } /** * 修改物资点信息-单个 * @param material * @return */ @RequestMapping("/rvdMat") @ResponseBody public JSONObject rvdMat(@RequestBody Material material){ JSONObject result = new JSONObject(); emerPlanService.rvdMat(material); result.put("msg", 1); return result; } /** * 用户修改水源点,获取水源点信息 * @param emergencyPlan * @return */ @RequestMapping("/rvdWats") @ResponseBody public JSONObject rvdWats(@RequestBody EmergencyPlan emergencyPlan){ JSONObject result = new JSONObject(); result = emerPlanService.rvdWats(emergencyPlan.getWatersource()); //绑定入参方便,实际只有用户修改后输入的路径ID序列 return result; } /** * 修改水源点信息-单个 * @param waterSource * @return */ @RequestMapping("/rvdWat") @ResponseBody public JSONObject rvdWat(@RequestBody WaterSource waterSource){ JSONObject result = new JSONObject(); emerPlanService.rvdWat(waterSource); result.put("msg", 1); return result; } /** * 修改人员信息-单个 * @param crew * @return */ @RequestMapping("/rvdCrew") @ResponseBody public JSONObject rvdCrew(@RequestBody Crew crew){ JSONObject result = new JSONObject(); emerPlanService.rvdCrew(crew); result.put("msg", 1); return result; } /** * 预案全列表 * @param page * @param limit * @return */ @RequestMapping("/chkAllPlans") @ResponseBody public JSONObject chkHandledRecs(Integer page, Integer limit){ JSONObject resObj = new JSONObject(); resObj = emerPlanService.PlanAllList(page, limit); return resObj; } /** * 提交新建预案 * @param emergencyPlan * @return */ @RequestMapping("/submitNewPlan") @ResponseBody public JSONObject submitNewPlan(@RequestBody EmergencyPlan emergencyPlan){ JSONObject result = new JSONObject(); emerPlanService.createPlan(emergencyPlan); result.put("msg", 1); return result; } /** * 提交新物资点 * @param material * @return */ @RequestMapping("/submitNewMat") @ResponseBody public JSONObject submitNewMat(@RequestBody Material material){ JSONObject result = new JSONObject(); emerPlanService.createMats(material); return result; } /** * 提交新的人员 * @return */ @RequestMapping("/submitNewCrew") @ResponseBody public JSONObject submitNewCrew(@RequestBody Crew crew){ JSONObject result = new JSONObject(); emerPlanService.createCrew(crew); return result; } /** * 提交新水源点 * @param waterSource * @return */ @RequestMapping("/submitNewWat") @ResponseBody public JSONObject submitNewWat(@RequestBody WaterSource waterSource){ JSONObject result = new JSONObject(); emerPlanService.createWats(waterSource); return result; } /** * 更新预案 * @param emergencyPlan * @return */ @RequestMapping("/updatePlan") @ResponseBody public JSONObject updatePlan(@RequestBody EmergencyPlan emergencyPlan){ JSONObject result = new JSONObject(); emerPlanService.updatePlan(emergencyPlan); result.put("msg", 1); return result; } /** * 搜索预案 * @param page * @param limit * @param kwTyep * @param keyWord * @return */ @RequestMapping("/srchPlan") @ResponseBody public JSONObject srchPlan(Integer page, Integer limit, Integer kwTyep, String keyWord){ //搜索类型:priority 关键词:planName JSONObject result = new JSONObject(); List<EmergencyPlan> plans = emerPlanService.srchPlans(kwTyep, keyWord); result.put("count", plans.size()); //分页 if (page * limit < plans.size()) { plans = plans.subList((page-1)*limit, page*limit); } else { plans = plans.subList((page-1)*limit, plans.size()); } result.put("data", plans); result.put("code", 0); result.put("msg", ""); return result; } /** * 搜索扑救资源 * @param page * @param limit * @param kwTyep * @param keyWord * @return */ @RequestMapping("/srchSrcs") @ResponseBody public JSONObject srchSrcs(Integer page, Integer limit, Integer kwType, String keyWord, Integer listType){ //搜索类型:priority 关键词:planName JSONObject result = emerPlanService.srchSrcs(kwType, keyWord, listType, page, limit); return result; } /** * 删除预案 * @param emergencyPlan * @return */ @RequestMapping("/delPlan") @ResponseBody public JSONObject delPlan(@RequestBody EmergencyPlan emergencyPlan){ //搜索类型:priority 关键词:planName JSONObject result = new JSONObject(); emerPlanService.delPlan(emergencyPlan.getPlanID()); result.put("msg", "1"); return result; } /** * 获取列表中预案的详情 * @param emergencyPlan * @return */ @RequestMapping("/detInfo") @ResponseBody public JSONObject planDetInfo(@RequestBody EmergencyPlan emergencyPlan){ //这个入参没有实际意义,只是为了绑定方便和节约时间,里面只有当前预案的ID JSONObject result = routemapService.srchPlanDet(emergencyPlan.getPlanID()); return result; } /** * 修改预案回显原预案信息 * @param emergencyPlan * @return */ @RequestMapping("/priInfo") @ResponseBody public JSONObject priInfo(@RequestBody EmergencyPlan emergencyPlan){ //这个入参没有实际意义,只是为了绑定方便和节约时间,里面只有当前预案的ID JSONObject result = routemapService.srchPlanDet(emergencyPlan.getPlanID()); return result; } /** * 修改物资点信息-回显原物资点信息 * @param material * @return */ @RequestMapping("/priMat") @ResponseBody public JSONObject priMat(@RequestBody Material material){ JSONObject result = new JSONObject(); result.put("priMat", emerPlanService.priMatInfo(material.getMatID())); result.put("msg", 1); return result; } /** * 修改水源点信息-回显原水源点信息 * @param waterSource * @return */ @RequestMapping("/priWat") @ResponseBody public JSONObject priWat(@RequestBody WaterSource waterSource){ JSONObject result = new JSONObject(); result.put("priWat", emerPlanService.priWatInfo(waterSource.getWatSrID())); result.put("msg", 1); return result; } /** * 修改人员信息-回显原人员信息 * @param crew * @return */ @RequestMapping("/priCrew") @ResponseBody public JSONObject priCrew(@RequestBody Crew crew){ JSONObject result = new JSONObject(); result.put("priCrew", emerPlanService.priCrewInfo(crew.getCrewID())); result.put("msg", 1); return result; } /** * 全扑救资源列表 * @param emergencyPlan * @return */ @RequestMapping("/allffSrcList") @ResponseBody public JSONObject ffSrcList(Integer listType, Integer page, Integer limit){ //这个入参没有实际意义,只是为了绑定方便和节约时间,里面只有当前预案的ID JSONObject result = emerPlanService.ffSrcList(listType, page, limit); return result; } /** * 删除扑救资源 * @param emergencyPlan * @return */ @RequestMapping("/delffSrc") @ResponseBody public JSONObject delffSrc(@RequestBody Material material){ //TransCar: 扑救资源类型 matID: 扑救资源ID JSONObject result = new JSONObject(); emerPlanService.delSrc(material.getTransCar(), material.getMatID()); result.put("msg", 1); return result; } }
[ "521356sc" ]
521356sc
d630e9db2332e1919006a79bc43852c4819d6326
5277194d29b469a592487cca5e8394e68e11e6d7
/AndreoCarHome/src/com/andreo/carhome/com/andreo/carhome/GPSInformation.java
283498b66e0c256f8ac26450da95ef11a0b11adf
[]
no_license
tariknz/AIVI
ed7b47c3b2a84e9ea98ec245f1bdbc6ee73b0dc7
e800da57a863ae1746de32973eed7d825a3faafa
refs/heads/master
2020-08-12T08:31:33.252368
2011-10-16T11:30:51
2011-10-16T11:30:51
2,546,541
0
0
null
null
null
null
UTF-8
Java
false
false
1,096
java
package com.andreo.carhome.com.andreo.carhome; import android.content.Context; import android.location.*; import android.os.Bundle; import android.util.Log; public class GPSInformation { private LocationManager lm; private LocationListener ll; private float speed; public GPSInformation(LocationManager locationManager){ lm = locationManager; ll = new LocationListener() { public void onStatusChanged(String provider, int status, Bundle extras) { // TODO Auto-generated method stub } public void onProviderEnabled(String provider) { // TODO Auto-generated method stub } public void onProviderDisabled(String provider) { // TODO Auto-generated method stub } public void onLocationChanged(Location location) { try{ setSpeed(location.getSpeed()); }catch(Exception e){ Log.e("AndreoCarHome","Error getting speed: " + e); } } }; lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, ll); } private void setSpeed(float speed) { this.speed = speed; } public float getSpeed() { return speed; } }
e5eac860c8a304a014a1d55f9fa9aed57ba3d99b
8937b595420ff3417a3a3dc3be343971e243a8b8
/NetBeansProjects/latihan_database/src/com/Login.java
7fdb42bdec25d1ce59227f211375a486d0b566af
[]
no_license
nioke-dev/full-projects-netbeans
f4bb227b3309dc38da78c5804277bea9f51c9e8e
c26e7a0b60d634ceb4ef626bb098aa77d6c9c4f1
refs/heads/main
2023-03-04T16:17:08.837848
2021-02-12T08:01:08
2021-02-12T08:01:08
338,255,648
0
0
null
null
null
null
UTF-8
Java
false
false
8,412
java
package com; import java.awt.Color; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.swing.JOptionPane; public class Login extends javax.swing.JFrame { private final Connection conn; // punya koneksi private Statement stat; // Sql statement private ResultSet rs; // menampung hasil public Login() { initComponents(); conn = Koneksi.koneksi(); this.getContentPane().setBackground(Color.white); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); txt_username = new javax.swing.JTextField(); txt_password = new javax.swing.JTextField(); btn_login = new javax.swing.JButton(); btn_daftar = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel1.setText("Silahkan Masuk !!!"); txt_username.setToolTipText("Masukan username"); txt_username.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true), "Username")); txt_password.setToolTipText("Masukan password"); txt_password.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true), "Password")); btn_login.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N btn_login.setText("Login"); btn_login.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_loginActionPerformed(evt); } }); btn_daftar.setText("Daftar"); btn_daftar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_daftarActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(52, 52, 52) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(btn_login, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(txt_password) .addComponent(txt_username) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1) .addGap(44, 44, 44)) .addComponent(btn_daftar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap(91, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(20, 20, 20) .addComponent(jLabel1) .addGap(18, 18, 18) .addComponent(txt_username, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txt_password, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(btn_daftar, javax.swing.GroupLayout.DEFAULT_SIZE, 31, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(btn_login, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); pack(); setLocationRelativeTo(null); }// </editor-fold>//GEN-END:initComponents private void btn_loginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_loginActionPerformed // TODO add your handling code here: String username = txt_username.getText(); String password = txt_password.getText(); try { // ambil semua data dari tabel user dimana colom username nilainya sama dengan yang ada di field username dan colom passwerd nilainya sama dengan yang ada di field passwerd String sql = "select * from user where username = '" + username + "' and password = '" + password + "'"; stat = conn.createStatement(); rs = stat.executeQuery(sql); if (rs.next()) { if (rs.getString("password").equals("admin")) { new Admin().setVisible(true); JOptionPane.showMessageDialog(this, "Login berhasil"); this.dispose(); } else { new User().setVisible(true); JOptionPane.showMessageDialog(this, "Login berhasil"); this.dispose(); } }else{ JOptionPane.showMessageDialog(null, "username and password incorrect"); } } catch (SQLException e) { JOptionPane.showMessageDialog(null, e.getMessage()); } }//GEN-LAST:event_btn_loginActionPerformed private void btn_daftarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_daftarActionPerformed // TODO add your handling code here: }//GEN-LAST:event_btn_daftarActionPerformed /** * @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(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Login().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btn_daftar; private javax.swing.JButton btn_login; private javax.swing.JLabel jLabel1; private javax.swing.JTextField txt_password; private javax.swing.JTextField txt_username; // End of variables declaration//GEN-END:variables }
6b700495d2485c34c7e3e07ecca4479f3a29ff12
9669d6df714083d9ae00870f457732f12c7e3ce4
/src/main/java/com/amirashad/springboot/sample/datarest/ServletInitializer.java
0ac3a6a657eb5f26c31d866b234fa9c3dd55652f
[]
no_license
amirashad/springboot-sample-data-rest
f66b5f1df6dcd1e327dc4dbae56386591800b672
b9656a998ce7baf024490e5c37332b184eec3c4b
refs/heads/master
2021-04-26T23:34:38.443993
2018-03-04T20:40:46
2018-03-04T20:40:46
123,822,207
2
0
null
null
null
null
UTF-8
Java
false
false
442
java
package com.amirashad.springboot.sample.datarest; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; public class ServletInitializer extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(WebApplication.class); } }
a9c7983118bb776c0ff756eb8d1671647de0f5a6
7d529f70de982345490f7e66404e0cc37645c50c
/Android Project (client)/Dating App/app/src/main/java/ru/ifsoft/chat/util/Security.java
f691d0d61c214253ecca4157bdcd24f7c94eb809
[]
no_license
LiandroMilani/Dating_Android_Template
0f023e88669b382306cdc7289ffd6efe758f8ffb
4ba7a093bbbb8ef8ef9583f835693cc0a72cc01a
refs/heads/master
2021-01-08T06:19:14.426430
2019-10-16T07:13:54
2019-10-16T07:13:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,071
java
/* Copyright (c) 2012 Google 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 ru.ifsoft.chat.util; import android.text.TextUtils; import android.util.Log; import java.security.InvalidKeyException; import java.security.KeyFactory; import java.security.NoSuchAlgorithmException; import java.security.PublicKey; import java.security.Signature; import java.security.SignatureException; import java.security.spec.InvalidKeySpecException; import java.security.spec.X509EncodedKeySpec; import ru.ifsoft.chat.BuildConfig; /** * Security-related methods. For a secure implementation, all of this code * should be implemented on a server that communicates with the * application on the device. For the sake of simplicity and clarity of this * example, this code is included here and is executed on the device. If you * must verify the purchases on the phone, you should obfuscate this code to * make it harder for an attacker to replace the code with stubs that treat all * purchases as verified. */ public class Security { private static final String TAG = "IABUtil/Security"; private static final String KEY_FACTORY_ALGORITHM = "RSA"; private static final String SIGNATURE_ALGORITHM = "SHA1withRSA"; // /** // * Verifies that the data was signed with the given signature, and returns // * the verified purchase. The data is in JSON format and signed // * with a private key. The data also contains the {@link PurchaseState} // * and product ID of the purchase. // * @param base64PublicKey the base64-encoded public key to use for verifying. // * @param signedData the signed JSON string (signed, not encrypted) // * @param signature the signature for the data, signed with the private key // */ public static boolean verifyPurchase(String base64PublicKey, String signedData, String signature) { if (TextUtils.isEmpty(signedData) || TextUtils.isEmpty(base64PublicKey) || TextUtils.isEmpty(signature)) { Log.e(TAG, "Purchase verification failed: missing data."); if (BuildConfig.DEBUG) { return true; } return false; } PublicKey key = Security.generatePublicKey(base64PublicKey); return Security.verify(key, signedData, signature); } /** * Generates a PublicKey instance from a string containing the * Base64-encoded public key. * * @param encodedPublicKey Base64-encoded public key * @throws IllegalArgumentException if encodedPublicKey is invalid */ public static PublicKey generatePublicKey(String encodedPublicKey) { try { byte[] decodedKey = Base64.decode(encodedPublicKey); KeyFactory keyFactory = KeyFactory.getInstance(KEY_FACTORY_ALGORITHM); return keyFactory.generatePublic(new X509EncodedKeySpec(decodedKey)); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } catch (InvalidKeySpecException e) { Log.e(TAG, "Invalid key specification."); throw new IllegalArgumentException(e); } catch (Base64DecoderException e) { Log.e(TAG, "Base64 decoding failed."); throw new IllegalArgumentException(e); } } /** * Verifies that the signature from the server matches the computed * signature on the data. Returns true if the data is correctly signed. * * @param publicKey public key associated with the developer account * @param signedData signed data from server * @param signature server signature * @return true if the data and signature match */ public static boolean verify(PublicKey publicKey, String signedData, String signature) { Signature sig; try { sig = Signature.getInstance(SIGNATURE_ALGORITHM); sig.initVerify(publicKey); sig.update(signedData.getBytes()); if (!sig.verify(Base64.decode(signature))) { Log.e(TAG, "Signature verification failed."); return false; } return true; } catch (NoSuchAlgorithmException e) { Log.e(TAG, "NoSuchAlgorithmException."); } catch (InvalidKeyException e) { Log.e(TAG, "Invalid key specification."); } catch (SignatureException e) { Log.e(TAG, "Signature exception."); } catch (Base64DecoderException e) { Log.e(TAG, "Base64 decoding failed."); } return false; } }
40d2b99e7fac8da495634c43dfa15989da166f19
d71e879b3517cf4fccde29f7bf82cff69856cfcd
/ExtractedJars/Ibotta_com.ibotta.android/javafiles/com/appboy/AppboyUser.java
7c12a2b59fe4deeec23b37c5fd9e3703f512f2d7
[ "MIT" ]
permissive
Andreas237/AndroidPolicyAutomation
b8e949e072d08cf6c6166c3f15c9c63379b8f6ce
c1ed10a2c6d4cf3dfda8b8e6291dee2c2a15ee8a
refs/heads/master
2020-04-10T02:14:08.789751
2019-05-16T19:29:11
2019-05-16T19:29:11
160,739,088
5
1
null
null
null
null
UTF-8
Java
false
false
81,440
java
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) annotate safe package com.appboy; import bo.app.*; import com.appboy.enums.Gender; import com.appboy.enums.Month; import com.appboy.enums.NotificationSubscriptionType; import com.appboy.models.outgoing.AttributionData; import com.appboy.models.outgoing.FacebookUser; import com.appboy.models.outgoing.TwitterUser; import com.appboy.support.AppboyLogger; import com.appboy.support.CustomAttributeValidationUtils; import com.appboy.support.StringUtils; import com.appboy.support.ValidationUtils; public class AppboyUser { AppboyUser(ea ea1, bt bt1, String s, bw bw1, dx dx1) { // 0 0:aload_0 // 1 1:invokespecial #32 <Method void Object()> // 2 4:aload_0 // 3 5:new #4 <Class Object> // 4 8:dup // 5 9:invokespecial #32 <Method void Object()> // 6 12:putfield #34 <Field Object d> f = s; // 7 15:aload_0 // 8 16:aload_3 // 9 17:putfield #36 <Field String f> b = ea1; // 10 20:aload_0 // 11 21:aload_1 // 12 22:putfield #38 <Field ea b> e = bw1; // 13 25:aload_0 // 14 26:aload 4 // 15 28:putfield #40 <Field bw e> c = dx1; // 16 31:aload_0 // 17 32:aload 5 // 18 34:putfield #42 <Field dx c> g = bt1; // 19 37:aload_0 // 20 38:aload_2 // 21 39:putfield #44 <Field bt g> // 22 42:return } void a(String s) { Object obj = d; // 0 0:aload_0 // 1 1:getfield #34 <Field Object d> // 2 4:astore_2 obj; // 3 5:aload_2 JVM INSTR monitorenter ; // 4 6:monitorenter if(f.equals("") || f.equals(((Object) (s)))) //* 5 7:aload_0 //* 6 8:getfield #36 <Field String f> //* 7 11:ldc1 #47 <String ""> //* 8 13:invokevirtual #53 <Method boolean String.equals(Object)> //* 9 16:ifne 89 //* 10 19:aload_0 //* 11 20:getfield #36 <Field String f> //* 12 23:aload_1 //* 13 24:invokevirtual #53 <Method boolean String.equals(Object)> //* 14 27:ifeq 33 break MISSING_BLOCK_LABEL_89; // 15 30:goto 89 StringBuilder stringbuilder = new StringBuilder(); // 16 33:new #55 <Class StringBuilder> // 17 36:dup // 18 37:invokespecial #56 <Method void StringBuilder()> // 19 40:astore_3 stringbuilder.append("setExternalId can not be used to change the external ID of a UserCache from a non-empty value to a new value. Was: ["); // 20 41:aload_3 // 21 42:ldc1 #58 <String "setExternalId can not be used to change the external ID of a UserCache from a non-empty value to a new value. Was: ["> // 22 44:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 23 47:pop stringbuilder.append(f); // 24 48:aload_3 // 25 49:aload_0 // 26 50:getfield #36 <Field String f> // 27 53:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 28 56:pop stringbuilder.append("], tried to change to: ["); // 29 57:aload_3 // 30 58:ldc1 #64 <String "], tried to change to: ["> // 31 60:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 32 63:pop stringbuilder.append(s); // 33 64:aload_3 // 34 65:aload_1 // 35 66:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 36 69:pop stringbuilder.append("]"); // 37 70:aload_3 // 38 71:ldc1 #66 <String "]"> // 39 73:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 40 76:pop throw new IllegalArgumentException(stringbuilder.toString()); // 41 77:new #68 <Class IllegalArgumentException> // 42 80:dup // 43 81:aload_3 // 44 82:invokevirtual #72 <Method String StringBuilder.toString()> // 45 85:invokespecial #74 <Method void IllegalArgumentException(String)> // 46 88:athrow f = s; // 47 89:aload_0 // 48 90:aload_1 // 49 91:putfield #36 <Field String f> b.a(s); // 50 94:aload_0 // 51 95:getfield #38 <Field ea b> // 52 98:aload_1 // 53 99:invokevirtual #78 <Method void ea.a(String)> obj; // 54 102:aload_2 JVM INSTR monitorexit ; // 55 103:monitorexit return; // 56 104:return s; // 57 105:astore_1 obj; // 58 106:aload_2 JVM INSTR monitorexit ; // 59 107:monitorexit throw s; // 60 108:aload_1 // 61 109:athrow } public boolean addAlias(String s, String s1) { if(StringUtils.isNullOrBlank(s)) //* 0 0:aload_1 //* 1 1:invokestatic #88 <Method boolean StringUtils.isNullOrBlank(String)> //* 2 4:ifeq 18 { AppboyLogger.w(a, "Invalid alias parameter: alias is required to be non-null and non-empty. Not adding alias."); // 3 7:getstatic #27 <Field String a> // 4 10:ldc1 #90 <String "Invalid alias parameter: alias is required to be non-null and non-empty. Not adding alias."> // 5 12:invokestatic #94 <Method int AppboyLogger.w(String, String)> // 6 15:pop return false; // 7 16:iconst_0 // 8 17:ireturn } if(StringUtils.isNullOrBlank(s1)) //* 9 18:aload_2 //* 10 19:invokestatic #88 <Method boolean StringUtils.isNullOrBlank(String)> //* 11 22:ifeq 36 { AppboyLogger.w(a, "Invalid label parameter: label is required to be non-null and non-empty. Not adding alias."); // 12 25:getstatic #27 <Field String a> // 13 28:ldc1 #96 <String "Invalid label parameter: label is required to be non-null and non-empty. Not adding alias."> // 14 30:invokestatic #94 <Method int AppboyLogger.w(String, String)> // 15 33:pop return false; // 16 34:iconst_0 // 17 35:ireturn } boolean flag; try { flag = g.a(((bo.app.cc) (ci.a(s, s1)))); // 18 36:aload_0 // 19 37:getfield #44 <Field bt g> // 20 40:aload_1 // 21 41:aload_2 // 22 42:invokestatic #101 <Method ci ci.a(String, String)> // 23 45:invokeinterface #106 <Method boolean bt.a(bo.app.cc)> // 24 50:istore_3 } //* 25 51:iload_3 //* 26 52:ireturn // Misplaced declaration of an exception variable catch(String s1) //* 27 53:astore_2 { String s2 = a; // 28 54:getstatic #27 <Field String a> // 29 57:astore 4 StringBuilder stringbuilder = new StringBuilder(); // 30 59:new #55 <Class StringBuilder> // 31 62:dup // 32 63:invokespecial #56 <Method void StringBuilder()> // 33 66:astore 5 stringbuilder.append("Failed to set alias: "); // 34 68:aload 5 // 35 70:ldc1 #108 <String "Failed to set alias: "> // 36 72:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 37 75:pop stringbuilder.append(s); // 38 76:aload 5 // 39 78:aload_1 // 40 79:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 41 82:pop AppboyLogger.e(s2, stringbuilder.toString(), ((Throwable) (s1))); // 42 83:aload 4 // 43 85:aload 5 // 44 87:invokevirtual #72 <Method String StringBuilder.toString()> // 45 90:aload_2 // 46 91:invokestatic #111 <Method int AppboyLogger.e(String, String, Throwable)> // 47 94:pop return false; // 48 95:iconst_0 // 49 96:ireturn } return flag; } public boolean addToCustomAttributeArray(String s, String s1) { String s2 = s; // 0 0:aload_1 // 1 1:astore 4 if(!CustomAttributeValidationUtils.isValidCustomAttributeKey(s, c.i())) //* 2 3:aload_1 //* 3 4:aload_0 //* 4 5:getfield #42 <Field dx c> //* 5 8:invokevirtual #118 <Method java.util.Set dx.i()> //* 6 11:invokestatic #124 <Method boolean CustomAttributeValidationUtils.isValidCustomAttributeKey(String, java.util.Set)> //* 7 14:ifne 31 { s2 = s; // 8 17:aload_1 // 9 18:astore 4 boolean flag; try { AppboyLogger.w(a, "Custom attribute key was invalid. Not adding to attribute array."); // 10 20:getstatic #27 <Field String a> // 11 23:ldc1 #126 <String "Custom attribute key was invalid. Not adding to attribute array."> // 12 25:invokestatic #94 <Method int AppboyLogger.w(String, String)> // 13 28:pop } //* 14 29:iconst_0 //* 15 30:ireturn //* 16 31:aload_1 //* 17 32:astore 4 //* 18 34:aload_2 //* 19 35:invokestatic #129 <Method boolean CustomAttributeValidationUtils.isValidCustomAttributeValue(String)> //* 20 38:ifne 43 //* 21 41:iconst_0 //* 22 42:ireturn //* 23 43:aload_1 //* 24 44:astore 4 //* 25 46:aload_1 //* 26 47:invokestatic #135 <Method String ValidationUtils.ensureAppboyFieldLength(String)> //* 27 50:astore_1 //* 28 51:aload_1 //* 29 52:astore 4 //* 30 54:aload_1 //* 31 55:aload_2 //* 32 56:invokestatic #135 <Method String ValidationUtils.ensureAppboyFieldLength(String)> //* 33 59:invokestatic #137 <Method ci ci.e(String, String)> //* 34 62:astore_2 //* 35 63:aload_1 //* 36 64:astore 4 //* 37 66:aload_0 //* 38 67:getfield #44 <Field bt g> //* 39 70:aload_2 //* 40 71:invokeinterface #106 <Method boolean bt.a(bo.app.cc)> //* 41 76:istore_3 //* 42 77:iload_3 //* 43 78:ireturn // Misplaced declaration of an exception variable catch(String s) //* 44 79:astore_1 { s1 = a; // 45 80:getstatic #27 <Field String a> // 46 83:astore_2 StringBuilder stringbuilder = new StringBuilder(); // 47 84:new #55 <Class StringBuilder> // 48 87:dup // 49 88:invokespecial #56 <Method void StringBuilder()> // 50 91:astore 5 stringbuilder.append("Failed to add custom attribute with key '"); // 51 93:aload 5 // 52 95:ldc1 #139 <String "Failed to add custom attribute with key '"> // 53 97:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 54 100:pop stringbuilder.append(s2); // 55 101:aload 5 // 56 103:aload 4 // 57 105:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 58 108:pop stringbuilder.append("'."); // 59 109:aload 5 // 60 111:ldc1 #141 <String "'."> // 61 113:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 62 116:pop AppboyLogger.w(s1, stringbuilder.toString(), ((Throwable) (s))); // 63 117:aload_2 // 64 118:aload 5 // 65 120:invokevirtual #72 <Method String StringBuilder.toString()> // 66 123:aload_1 // 67 124:invokestatic #143 <Method int AppboyLogger.w(String, String, Throwable)> // 68 127:pop return false; // 69 128:iconst_0 // 70 129:ireturn } return false; } s2 = s; if(!CustomAttributeValidationUtils.isValidCustomAttributeValue(s1)) return false; s2 = s; s = ValidationUtils.ensureAppboyFieldLength(s); s2 = s; s1 = ((String) (ci.e(s, ValidationUtils.ensureAppboyFieldLength(s1)))); s2 = s; flag = g.a(((bo.app.cc) (s1))); return flag; } public String getUserId() { String s; synchronized(d) //* 0 0:aload_0 //* 1 1:getfield #34 <Field Object d> //* 2 4:astore_1 //* 3 5:aload_1 //* 4 6:monitorenter { s = f; // 5 7:aload_0 // 6 8:getfield #36 <Field String f> // 7 11:astore_2 } // 8 12:aload_1 // 9 13:monitorexit return s; // 10 14:aload_2 // 11 15:areturn exception; // 12 16:astore_2 obj; // 13 17:aload_1 JVM INSTR monitorexit ; // 14 18:monitorexit throw exception; // 15 19:aload_2 // 16 20:athrow } public boolean incrementCustomUserAttribute(String s) { return incrementCustomUserAttribute(s, 1); // 0 0:aload_0 // 1 1:aload_1 // 2 2:iconst_1 // 3 3:invokevirtual #150 <Method boolean incrementCustomUserAttribute(String, int)> // 4 6:ireturn } public boolean incrementCustomUserAttribute(String s, int i) { String s1 = s; // 0 0:aload_1 // 1 1:astore 4 if(!CustomAttributeValidationUtils.isValidCustomAttributeKey(s, c.i())) //* 2 3:aload_1 //* 3 4:aload_0 //* 4 5:getfield #42 <Field dx c> //* 5 8:invokevirtual #118 <Method java.util.Set dx.i()> //* 6 11:invokestatic #124 <Method boolean CustomAttributeValidationUtils.isValidCustomAttributeKey(String, java.util.Set)> //* 7 14:ifne 19 return false; // 8 17:iconst_0 // 9 18:ireturn s1 = s; // 10 19:aload_1 // 11 20:astore 4 boolean flag; ci ci1; try { s = ValidationUtils.ensureAppboyFieldLength(s); // 12 22:aload_1 // 13 23:invokestatic #135 <Method String ValidationUtils.ensureAppboyFieldLength(String)> // 14 26:astore_1 } //* 15 27:aload_1 //* 16 28:astore 4 //* 17 30:aload_1 //* 18 31:iload_2 //* 19 32:invokestatic #153 <Method ci ci.a(String, int)> //* 20 35:astore 5 //* 21 37:aload_1 //* 22 38:astore 4 //* 23 40:aload_0 //* 24 41:getfield #44 <Field bt g> //* 25 44:aload 5 //* 26 46:invokeinterface #106 <Method boolean bt.a(bo.app.cc)> //* 27 51:istore_3 //* 28 52:iload_3 //* 29 53:ireturn // Misplaced declaration of an exception variable catch(String s) //* 30 54:astore_1 { String s2 = a; // 31 55:getstatic #27 <Field String a> // 32 58:astore 5 StringBuilder stringbuilder = new StringBuilder(); // 33 60:new #55 <Class StringBuilder> // 34 63:dup // 35 64:invokespecial #56 <Method void StringBuilder()> // 36 67:astore 6 stringbuilder.append("Failed to increment custom attribute "); // 37 69:aload 6 // 38 71:ldc1 #155 <String "Failed to increment custom attribute "> // 39 73:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 40 76:pop stringbuilder.append(s1); // 41 77:aload 6 // 42 79:aload 4 // 43 81:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 44 84:pop stringbuilder.append(" by "); // 45 85:aload 6 // 46 87:ldc1 #157 <String " by "> // 47 89:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 48 92:pop stringbuilder.append(i); // 49 93:aload 6 // 50 95:iload_2 // 51 96:invokevirtual #160 <Method StringBuilder StringBuilder.append(int)> // 52 99:pop stringbuilder.append("."); // 53 100:aload 6 // 54 102:ldc1 #162 <String "."> // 55 104:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 56 107:pop AppboyLogger.w(s2, stringbuilder.toString(), ((Throwable) (s))); // 57 108:aload 5 // 58 110:aload 6 // 59 112:invokevirtual #72 <Method String StringBuilder.toString()> // 60 115:aload_1 // 61 116:invokestatic #143 <Method int AppboyLogger.w(String, String, Throwable)> // 62 119:pop return false; // 63 120:iconst_0 // 64 121:ireturn } s1 = s; ci1 = ci.a(s, i); s1 = s; flag = g.a(((bo.app.cc) (ci1))); return flag; } public boolean removeFromCustomAttributeArray(String s, String s1) { String s2 = s; // 0 0:aload_1 // 1 1:astore 4 if(!CustomAttributeValidationUtils.isValidCustomAttributeKey(s, c.i())) //* 2 3:aload_1 //* 3 4:aload_0 //* 4 5:getfield #42 <Field dx c> //* 5 8:invokevirtual #118 <Method java.util.Set dx.i()> //* 6 11:invokestatic #124 <Method boolean CustomAttributeValidationUtils.isValidCustomAttributeKey(String, java.util.Set)> //* 7 14:ifne 31 { s2 = s; // 8 17:aload_1 // 9 18:astore 4 boolean flag; try { AppboyLogger.w(a, "Custom attribute key was invalid. Not removing from attribute array."); // 10 20:getstatic #27 <Field String a> // 11 23:ldc1 #165 <String "Custom attribute key was invalid. Not removing from attribute array."> // 12 25:invokestatic #94 <Method int AppboyLogger.w(String, String)> // 13 28:pop } //* 14 29:iconst_0 //* 15 30:ireturn //* 16 31:aload_1 //* 17 32:astore 4 //* 18 34:aload_2 //* 19 35:invokestatic #129 <Method boolean CustomAttributeValidationUtils.isValidCustomAttributeValue(String)> //* 20 38:ifne 43 //* 21 41:iconst_0 //* 22 42:ireturn //* 23 43:aload_1 //* 24 44:astore 4 //* 25 46:aload_1 //* 26 47:invokestatic #135 <Method String ValidationUtils.ensureAppboyFieldLength(String)> //* 27 50:astore_1 //* 28 51:aload_1 //* 29 52:astore 4 //* 30 54:aload_1 //* 31 55:aload_2 //* 32 56:invokestatic #135 <Method String ValidationUtils.ensureAppboyFieldLength(String)> //* 33 59:invokestatic #167 <Method ci ci.f(String, String)> //* 34 62:astore_2 //* 35 63:aload_1 //* 36 64:astore 4 //* 37 66:aload_0 //* 38 67:getfield #44 <Field bt g> //* 39 70:aload_2 //* 40 71:invokeinterface #106 <Method boolean bt.a(bo.app.cc)> //* 41 76:istore_3 //* 42 77:iload_3 //* 43 78:ireturn // Misplaced declaration of an exception variable catch(String s) //* 44 79:astore_1 { s1 = a; // 45 80:getstatic #27 <Field String a> // 46 83:astore_2 StringBuilder stringbuilder = new StringBuilder(); // 47 84:new #55 <Class StringBuilder> // 48 87:dup // 49 88:invokespecial #56 <Method void StringBuilder()> // 50 91:astore 5 stringbuilder.append("Failed to remove custom attribute with key '"); // 51 93:aload 5 // 52 95:ldc1 #169 <String "Failed to remove custom attribute with key '"> // 53 97:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 54 100:pop stringbuilder.append(s2); // 55 101:aload 5 // 56 103:aload 4 // 57 105:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 58 108:pop stringbuilder.append("'."); // 59 109:aload 5 // 60 111:ldc1 #141 <String "'."> // 61 113:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 62 116:pop AppboyLogger.w(s1, stringbuilder.toString(), ((Throwable) (s))); // 63 117:aload_2 // 64 118:aload 5 // 65 120:invokevirtual #72 <Method String StringBuilder.toString()> // 66 123:aload_1 // 67 124:invokestatic #143 <Method int AppboyLogger.w(String, String, Throwable)> // 68 127:pop return false; // 69 128:iconst_0 // 70 129:ireturn } return false; } s2 = s; if(!CustomAttributeValidationUtils.isValidCustomAttributeValue(s1)) return false; s2 = s; s = ValidationUtils.ensureAppboyFieldLength(s); s2 = s; s1 = ((String) (ci.f(s, ValidationUtils.ensureAppboyFieldLength(s1)))); s2 = s; flag = g.a(((bo.app.cc) (s1))); return flag; } public boolean setAttributionData(AttributionData attributiondata) { try { b.a(attributiondata); // 0 0:aload_0 // 1 1:getfield #38 <Field ea b> // 2 4:aload_1 // 3 5:invokevirtual #174 <Method void ea.a(AttributionData)> } //* 4 8:iconst_1 //* 5 9:ireturn // Misplaced declaration of an exception variable catch(AttributionData attributiondata) //* 6 10:astore_1 { AppboyLogger.w(a, "Failed to set attribution data.", ((Throwable) (attributiondata))); // 7 11:getstatic #27 <Field String a> // 8 14:ldc1 #176 <String "Failed to set attribution data."> // 9 16:aload_1 // 10 17:invokestatic #143 <Method int AppboyLogger.w(String, String, Throwable)> // 11 20:pop return false; // 12 21:iconst_0 // 13 22:ireturn } return true; } public boolean setAvatarImageUrl(String s) { try { b.i(s); // 0 0:aload_0 // 1 1:getfield #38 <Field ea b> // 2 4:aload_1 // 3 5:invokevirtual #179 <Method void ea.i(String)> } //* 4 8:iconst_1 //* 5 9:ireturn // Misplaced declaration of an exception variable catch(String s) //* 6 10:astore_1 { AppboyLogger.w(a, "Failed to set the avatar image URL.", ((Throwable) (s))); // 7 11:getstatic #27 <Field String a> // 8 14:ldc1 #181 <String "Failed to set the avatar image URL."> // 9 16:aload_1 // 10 17:invokestatic #143 <Method int AppboyLogger.w(String, String, Throwable)> // 11 20:pop return false; // 12 21:iconst_0 // 13 22:ireturn } return true; } public boolean setCountry(String s) { try { b.e(s); // 0 0:aload_0 // 1 1:getfield #38 <Field ea b> // 2 4:aload_1 // 3 5:invokevirtual #184 <Method void ea.e(String)> } //* 4 8:iconst_1 //* 5 9:ireturn catch(Exception exception) //* 6 10:astore_2 { String s1 = a; // 7 11:getstatic #27 <Field String a> // 8 14:astore_3 StringBuilder stringbuilder = new StringBuilder(); // 9 15:new #55 <Class StringBuilder> // 10 18:dup // 11 19:invokespecial #56 <Method void StringBuilder()> // 12 22:astore 4 stringbuilder.append("Failed to set country to: "); // 13 24:aload 4 // 14 26:ldc1 #186 <String "Failed to set country to: "> // 15 28:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 16 31:pop stringbuilder.append(s); // 17 32:aload 4 // 18 34:aload_1 // 19 35:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 20 38:pop AppboyLogger.w(s1, stringbuilder.toString(), ((Throwable) (exception))); // 21 39:aload_3 // 22 40:aload 4 // 23 42:invokevirtual #72 <Method String StringBuilder.toString()> // 24 45:aload_2 // 25 46:invokestatic #143 <Method int AppboyLogger.w(String, String, Throwable)> // 26 49:pop return false; // 27 50:iconst_0 // 28 51:ireturn } return true; } public boolean setCustomAttributeArray(String s, String as[]) { String s1 = s; // 0 0:aload_1 // 1 1:astore 4 if(!CustomAttributeValidationUtils.isValidCustomAttributeKey(s, c.i())) //* 2 3:aload_1 //* 3 4:aload_0 //* 4 5:getfield #42 <Field dx c> //* 5 8:invokevirtual #118 <Method java.util.Set dx.i()> //* 6 11:invokestatic #124 <Method boolean CustomAttributeValidationUtils.isValidCustomAttributeKey(String, java.util.Set)> //* 7 14:ifne 19 return false; // 8 17:iconst_0 // 9 18:ireturn s1 = s; // 10 19:aload_1 // 11 20:astore 4 boolean flag; String s2; try { s2 = ValidationUtils.ensureAppboyFieldLength(s); // 12 22:aload_1 // 13 23:invokestatic #135 <Method String ValidationUtils.ensureAppboyFieldLength(String)> // 14 26:astore 5 } //* 15 28:aload_2 //* 16 29:astore_1 //* 17 30:aload_2 //* 18 31:ifnull 43 //* 19 34:aload 5 //* 20 36:astore 4 //* 21 38:aload_2 //* 22 39:invokestatic #192 <Method String[] CustomAttributeValidationUtils.ensureCustomAttributeArrayValues(String[])> //* 23 42:astore_1 //* 24 43:aload 5 //* 25 45:astore 4 //* 26 47:aload 5 //* 27 49:aload_1 //* 28 50:invokestatic #195 <Method ci ci.a(String, String[])> //* 29 53:astore_1 //* 30 54:aload 5 //* 31 56:astore 4 //* 32 58:aload_0 //* 33 59:getfield #44 <Field bt g> //* 34 62:aload_1 //* 35 63:invokeinterface #106 <Method boolean bt.a(bo.app.cc)> //* 36 68:istore_3 //* 37 69:iload_3 //* 38 70:ireturn //* 39 71:getstatic #27 <Field String a> //* 40 74:astore_1 //* 41 75:new #55 <Class StringBuilder> //* 42 78:dup //* 43 79:invokespecial #56 <Method void StringBuilder()> //* 44 82:astore_2 //* 45 83:aload_2 //* 46 84:ldc1 #197 <String "Failed to set custom attribute array with key: '"> //* 47 86:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> //* 48 89:pop //* 49 90:aload_2 //* 50 91:aload 4 //* 51 93:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> //* 52 96:pop //* 53 97:aload_2 //* 54 98:ldc1 #141 <String "'."> //* 55 100:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> //* 56 103:pop //* 57 104:aload_1 //* 58 105:aload_2 //* 59 106:invokevirtual #72 <Method String StringBuilder.toString()> //* 60 109:invokestatic #94 <Method int AppboyLogger.w(String, String)> //* 61 112:pop //* 62 113:iconst_0 //* 63 114:ireturn // Misplaced declaration of an exception variable catch(String s) { s = a; as = ((String []) (new StringBuilder())); ((StringBuilder) (as)).append("Failed to set custom attribute array with key: '"); ((StringBuilder) (as)).append(s1); ((StringBuilder) (as)).append("'."); AppboyLogger.w(s, ((StringBuilder) (as)).toString()); return false; } s = ((String) (as)); if(as == null) break MISSING_BLOCK_LABEL_43; s1 = s2; s = ((String) (CustomAttributeValidationUtils.ensureCustomAttributeArrayValues(as))); s1 = s2; s = ((String) (ci.a(s2, ((String []) (s))))); s1 = s2; flag = g.a(((bo.app.cc) (s))); return flag; //* 64 115:astore_1 //* 65 116:goto 71 } public boolean setCustomUserAttribute(String s, double d1) { boolean flag; try { flag = b.a(s, ((Object) (Double.valueOf(d1)))); // 0 0:aload_0 // 1 1:getfield #38 <Field ea b> // 2 4:aload_1 // 3 5:dload_2 // 4 6:invokestatic #205 <Method Double Double.valueOf(double)> // 5 9:invokevirtual #208 <Method boolean ea.a(String, Object)> // 6 12:istore 4 } //* 7 14:iload 4 //* 8 16:ireturn catch(Exception exception) //* 9 17:astore 5 { String s1 = a; // 10 19:getstatic #27 <Field String a> // 11 22:astore 6 StringBuilder stringbuilder = new StringBuilder(); // 12 24:new #55 <Class StringBuilder> // 13 27:dup // 14 28:invokespecial #56 <Method void StringBuilder()> // 15 31:astore 7 stringbuilder.append("Failed to set custom double attribute "); // 16 33:aload 7 // 17 35:ldc1 #210 <String "Failed to set custom double attribute "> // 18 37:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 19 40:pop stringbuilder.append(s); // 20 41:aload 7 // 21 43:aload_1 // 22 44:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 23 47:pop stringbuilder.append("."); // 24 48:aload 7 // 25 50:ldc1 #162 <String "."> // 26 52:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 27 55:pop AppboyLogger.w(s1, stringbuilder.toString(), ((Throwable) (exception))); // 28 56:aload 6 // 29 58:aload 7 // 30 60:invokevirtual #72 <Method String StringBuilder.toString()> // 31 63:aload 5 // 32 65:invokestatic #143 <Method int AppboyLogger.w(String, String, Throwable)> // 33 68:pop return false; // 34 69:iconst_0 // 35 70:ireturn } return flag; } public boolean setCustomUserAttribute(String s, float f1) { boolean flag; try { flag = b.a(s, ((Object) (Float.valueOf(f1)))); // 0 0:aload_0 // 1 1:getfield #38 <Field ea b> // 2 4:aload_1 // 3 5:fload_2 // 4 6:invokestatic #216 <Method Float Float.valueOf(float)> // 5 9:invokevirtual #208 <Method boolean ea.a(String, Object)> // 6 12:istore_3 } //* 7 13:iload_3 //* 8 14:ireturn catch(Exception exception) //* 9 15:astore 4 { String s1 = a; // 10 17:getstatic #27 <Field String a> // 11 20:astore 5 StringBuilder stringbuilder = new StringBuilder(); // 12 22:new #55 <Class StringBuilder> // 13 25:dup // 14 26:invokespecial #56 <Method void StringBuilder()> // 15 29:astore 6 stringbuilder.append("Failed to set custom float attribute "); // 16 31:aload 6 // 17 33:ldc1 #218 <String "Failed to set custom float attribute "> // 18 35:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 19 38:pop stringbuilder.append(s); // 20 39:aload 6 // 21 41:aload_1 // 22 42:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 23 45:pop stringbuilder.append("."); // 24 46:aload 6 // 25 48:ldc1 #162 <String "."> // 26 50:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 27 53:pop AppboyLogger.w(s1, stringbuilder.toString(), ((Throwable) (exception))); // 28 54:aload 5 // 29 56:aload 6 // 30 58:invokevirtual #72 <Method String StringBuilder.toString()> // 31 61:aload 4 // 32 63:invokestatic #143 <Method int AppboyLogger.w(String, String, Throwable)> // 33 66:pop return false; // 34 67:iconst_0 // 35 68:ireturn } return flag; } public boolean setCustomUserAttribute(String s, int i) { boolean flag; try { flag = b.a(s, ((Object) (Integer.valueOf(i)))); // 0 0:aload_0 // 1 1:getfield #38 <Field ea b> // 2 4:aload_1 // 3 5:iload_2 // 4 6:invokestatic #223 <Method Integer Integer.valueOf(int)> // 5 9:invokevirtual #208 <Method boolean ea.a(String, Object)> // 6 12:istore_3 } //* 7 13:iload_3 //* 8 14:ireturn catch(Exception exception) //* 9 15:astore 4 { String s1 = a; // 10 17:getstatic #27 <Field String a> // 11 20:astore 5 StringBuilder stringbuilder = new StringBuilder(); // 12 22:new #55 <Class StringBuilder> // 13 25:dup // 14 26:invokespecial #56 <Method void StringBuilder()> // 15 29:astore 6 stringbuilder.append("Failed to set custom integer attribute "); // 16 31:aload 6 // 17 33:ldc1 #225 <String "Failed to set custom integer attribute "> // 18 35:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 19 38:pop stringbuilder.append(s); // 20 39:aload 6 // 21 41:aload_1 // 22 42:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 23 45:pop stringbuilder.append("."); // 24 46:aload 6 // 25 48:ldc1 #162 <String "."> // 26 50:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 27 53:pop AppboyLogger.w(s1, stringbuilder.toString(), ((Throwable) (exception))); // 28 54:aload 5 // 29 56:aload 6 // 30 58:invokevirtual #72 <Method String StringBuilder.toString()> // 31 61:aload 4 // 32 63:invokestatic #143 <Method int AppboyLogger.w(String, String, Throwable)> // 33 66:pop return false; // 34 67:iconst_0 // 35 68:ireturn } return flag; } public boolean setCustomUserAttribute(String s, long l) { boolean flag; try { flag = b.a(s, ((Object) (Long.valueOf(l)))); // 0 0:aload_0 // 1 1:getfield #38 <Field ea b> // 2 4:aload_1 // 3 5:lload_2 // 4 6:invokestatic #231 <Method Long Long.valueOf(long)> // 5 9:invokevirtual #208 <Method boolean ea.a(String, Object)> // 6 12:istore 4 } //* 7 14:iload 4 //* 8 16:ireturn catch(Exception exception) //* 9 17:astore 5 { String s1 = a; // 10 19:getstatic #27 <Field String a> // 11 22:astore 6 StringBuilder stringbuilder = new StringBuilder(); // 12 24:new #55 <Class StringBuilder> // 13 27:dup // 14 28:invokespecial #56 <Method void StringBuilder()> // 15 31:astore 7 stringbuilder.append("Failed to set custom long attribute "); // 16 33:aload 7 // 17 35:ldc1 #233 <String "Failed to set custom long attribute "> // 18 37:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 19 40:pop stringbuilder.append(s); // 20 41:aload 7 // 21 43:aload_1 // 22 44:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 23 47:pop stringbuilder.append("."); // 24 48:aload 7 // 25 50:ldc1 #162 <String "."> // 26 52:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 27 55:pop AppboyLogger.w(s1, stringbuilder.toString(), ((Throwable) (exception))); // 28 56:aload 6 // 29 58:aload 7 // 30 60:invokevirtual #72 <Method String StringBuilder.toString()> // 31 63:aload 5 // 32 65:invokestatic #143 <Method int AppboyLogger.w(String, String, Throwable)> // 33 68:pop return false; // 34 69:iconst_0 // 35 70:ireturn } return flag; } public boolean setCustomUserAttribute(String s, String s1) { boolean flag; try { flag = b.a(s, ((Object) (s1))); // 0 0:aload_0 // 1 1:getfield #38 <Field ea b> // 2 4:aload_1 // 3 5:aload_2 // 4 6:invokevirtual #208 <Method boolean ea.a(String, Object)> // 5 9:istore_3 } //* 6 10:iload_3 //* 7 11:ireturn // Misplaced declaration of an exception variable catch(String s1) //* 8 12:astore_2 { String s2 = a; // 9 13:getstatic #27 <Field String a> // 10 16:astore 4 StringBuilder stringbuilder = new StringBuilder(); // 11 18:new #55 <Class StringBuilder> // 12 21:dup // 13 22:invokespecial #56 <Method void StringBuilder()> // 14 25:astore 5 stringbuilder.append("Failed to set custom string attribute "); // 15 27:aload 5 // 16 29:ldc1 #235 <String "Failed to set custom string attribute "> // 17 31:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 18 34:pop stringbuilder.append(s); // 19 35:aload 5 // 20 37:aload_1 // 21 38:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 22 41:pop stringbuilder.append("."); // 23 42:aload 5 // 24 44:ldc1 #162 <String "."> // 25 46:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 26 49:pop AppboyLogger.w(s2, stringbuilder.toString(), ((Throwable) (s1))); // 27 50:aload 4 // 28 52:aload 5 // 29 54:invokevirtual #72 <Method String StringBuilder.toString()> // 30 57:aload_2 // 31 58:invokestatic #143 <Method int AppboyLogger.w(String, String, Throwable)> // 32 61:pop return false; // 33 62:iconst_0 // 34 63:ireturn } return flag; } public boolean setCustomUserAttribute(String s, boolean flag) { try { flag = b.a(s, ((Object) (Boolean.valueOf(flag)))); // 0 0:aload_0 // 1 1:getfield #38 <Field ea b> // 2 4:aload_1 // 3 5:iload_2 // 4 6:invokestatic #241 <Method Boolean Boolean.valueOf(boolean)> // 5 9:invokevirtual #208 <Method boolean ea.a(String, Object)> // 6 12:istore_2 } //* 7 13:iload_2 //* 8 14:ireturn catch(Exception exception) //* 9 15:astore_3 { String s1 = a; // 10 16:getstatic #27 <Field String a> // 11 19:astore 4 StringBuilder stringbuilder = new StringBuilder(); // 12 21:new #55 <Class StringBuilder> // 13 24:dup // 14 25:invokespecial #56 <Method void StringBuilder()> // 15 28:astore 5 stringbuilder.append("Failed to set custom boolean attribute "); // 16 30:aload 5 // 17 32:ldc1 #243 <String "Failed to set custom boolean attribute "> // 18 34:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 19 37:pop stringbuilder.append(s); // 20 38:aload 5 // 21 40:aload_1 // 22 41:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 23 44:pop stringbuilder.append("."); // 24 45:aload 5 // 25 47:ldc1 #162 <String "."> // 26 49:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 27 52:pop AppboyLogger.w(s1, stringbuilder.toString(), ((Throwable) (exception))); // 28 53:aload 4 // 29 55:aload 5 // 30 57:invokevirtual #72 <Method String StringBuilder.toString()> // 31 60:aload_3 // 32 61:invokestatic #143 <Method int AppboyLogger.w(String, String, Throwable)> // 33 64:pop return false; // 34 65:iconst_0 // 35 66:ireturn } return flag; } public boolean setCustomUserAttributeToNow(String s) { boolean flag; try { flag = b.a(s, eb.a()); // 0 0:aload_0 // 1 1:getfield #38 <Field ea b> // 2 4:aload_1 // 3 5:invokestatic #249 <Method long eb.a()> // 4 8:invokevirtual #251 <Method boolean ea.a(String, long)> // 5 11:istore_2 } //* 6 12:iload_2 //* 7 13:ireturn catch(Exception exception) //* 8 14:astore_3 { String s1 = a; // 9 15:getstatic #27 <Field String a> // 10 18:astore 4 StringBuilder stringbuilder = new StringBuilder(); // 11 20:new #55 <Class StringBuilder> // 12 23:dup // 13 24:invokespecial #56 <Method void StringBuilder()> // 14 27:astore 5 stringbuilder.append("Failed to set custom attribute "); // 15 29:aload 5 // 16 31:ldc1 #253 <String "Failed to set custom attribute "> // 17 33:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 18 36:pop stringbuilder.append(s); // 19 37:aload 5 // 20 39:aload_1 // 21 40:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 22 43:pop stringbuilder.append(" to now."); // 23 44:aload 5 // 24 46:ldc1 #255 <String " to now."> // 25 48:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 26 51:pop AppboyLogger.w(s1, stringbuilder.toString(), ((Throwable) (exception))); // 27 52:aload 4 // 28 54:aload 5 // 29 56:invokevirtual #72 <Method String StringBuilder.toString()> // 30 59:aload_3 // 31 60:invokestatic #143 <Method int AppboyLogger.w(String, String, Throwable)> // 32 63:pop return false; // 33 64:iconst_0 // 34 65:ireturn } return flag; } public boolean setCustomUserAttributeToSecondsFromEpoch(String s, long l) { boolean flag; try { flag = b.a(s, l); // 0 0:aload_0 // 1 1:getfield #38 <Field ea b> // 2 4:aload_1 // 3 5:lload_2 // 4 6:invokevirtual #251 <Method boolean ea.a(String, long)> // 5 9:istore 4 } //* 6 11:iload 4 //* 7 13:ireturn catch(Exception exception) //* 8 14:astore 5 { String s1 = a; // 9 16:getstatic #27 <Field String a> // 10 19:astore 6 StringBuilder stringbuilder = new StringBuilder(); // 11 21:new #55 <Class StringBuilder> // 12 24:dup // 13 25:invokespecial #56 <Method void StringBuilder()> // 14 28:astore 7 stringbuilder.append("Failed to set custom attribute "); // 15 30:aload 7 // 16 32:ldc1 #253 <String "Failed to set custom attribute "> // 17 34:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 18 37:pop stringbuilder.append(s); // 19 38:aload 7 // 20 40:aload_1 // 21 41:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 22 44:pop stringbuilder.append(" to "); // 23 45:aload 7 // 24 47:ldc2 #258 <String " to "> // 25 50:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 26 53:pop stringbuilder.append(l); // 27 54:aload 7 // 28 56:lload_2 // 29 57:invokevirtual #261 <Method StringBuilder StringBuilder.append(long)> // 30 60:pop stringbuilder.append(" seconds from epoch."); // 31 61:aload 7 // 32 63:ldc2 #263 <String " seconds from epoch."> // 33 66:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 34 69:pop AppboyLogger.w(s1, stringbuilder.toString(), ((Throwable) (exception))); // 35 70:aload 6 // 36 72:aload 7 // 37 74:invokevirtual #72 <Method String StringBuilder.toString()> // 38 77:aload 5 // 39 79:invokestatic #143 <Method int AppboyLogger.w(String, String, Throwable)> // 40 82:pop return false; // 41 83:iconst_0 // 42 84:ireturn } return flag; } public boolean setDateOfBirth(int i, Month month, int j) { boolean flag; try { flag = b.a(i, month, j); // 0 0:aload_0 // 1 1:getfield #38 <Field ea b> // 2 4:iload_1 // 3 5:aload_2 // 4 6:iload_3 // 5 7:invokevirtual #267 <Method boolean ea.a(int, Month, int)> // 6 10:istore 4 } //* 7 12:iload 4 //* 8 14:ireturn catch(Exception exception) //* 9 15:astore 5 { String s = a; // 10 17:getstatic #27 <Field String a> // 11 20:astore 6 StringBuilder stringbuilder = new StringBuilder(); // 12 22:new #55 <Class StringBuilder> // 13 25:dup // 14 26:invokespecial #56 <Method void StringBuilder()> // 15 29:astore 7 stringbuilder.append("Failed to set date of birth to: "); // 16 31:aload 7 // 17 33:ldc2 #269 <String "Failed to set date of birth to: "> // 18 36:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 19 39:pop stringbuilder.append(i); // 20 40:aload 7 // 21 42:iload_1 // 22 43:invokevirtual #160 <Method StringBuilder StringBuilder.append(int)> // 23 46:pop stringbuilder.append("-"); // 24 47:aload 7 // 25 49:ldc2 #271 <String "-"> // 26 52:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 27 55:pop stringbuilder.append(month.getValue()); // 28 56:aload 7 // 29 58:aload_2 // 30 59:invokevirtual #277 <Method int Month.getValue()> // 31 62:invokevirtual #160 <Method StringBuilder StringBuilder.append(int)> // 32 65:pop stringbuilder.append("-"); // 33 66:aload 7 // 34 68:ldc2 #271 <String "-"> // 35 71:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 36 74:pop stringbuilder.append(j); // 37 75:aload 7 // 38 77:iload_3 // 39 78:invokevirtual #160 <Method StringBuilder StringBuilder.append(int)> // 40 81:pop AppboyLogger.w(s, stringbuilder.toString(), ((Throwable) (exception))); // 41 82:aload 6 // 42 84:aload 7 // 43 86:invokevirtual #72 <Method String StringBuilder.toString()> // 44 89:aload 5 // 45 91:invokestatic #143 <Method int AppboyLogger.w(String, String, Throwable)> // 46 94:pop return false; // 47 95:iconst_0 // 48 96:ireturn } return flag; } public boolean setEmail(String s) { boolean flag; try { flag = b.d(s); // 0 0:aload_0 // 1 1:getfield #38 <Field ea b> // 2 4:aload_1 // 3 5:invokevirtual #280 <Method boolean ea.d(String)> // 4 8:istore_2 } //* 5 9:iload_2 //* 6 10:ireturn catch(Exception exception) //* 7 11:astore_3 { String s1 = a; // 8 12:getstatic #27 <Field String a> // 9 15:astore 4 StringBuilder stringbuilder = new StringBuilder(); // 10 17:new #55 <Class StringBuilder> // 11 20:dup // 12 21:invokespecial #56 <Method void StringBuilder()> // 13 24:astore 5 stringbuilder.append("Failed to set email to: "); // 14 26:aload 5 // 15 28:ldc2 #282 <String "Failed to set email to: "> // 16 31:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 17 34:pop stringbuilder.append(s); // 18 35:aload 5 // 19 37:aload_1 // 20 38:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 21 41:pop AppboyLogger.w(s1, stringbuilder.toString(), ((Throwable) (exception))); // 22 42:aload 4 // 23 44:aload 5 // 24 46:invokevirtual #72 <Method String StringBuilder.toString()> // 25 49:aload_3 // 26 50:invokestatic #143 <Method int AppboyLogger.w(String, String, Throwable)> // 27 53:pop return false; // 28 54:iconst_0 // 29 55:ireturn } return flag; } public boolean setEmailNotificationSubscriptionType(NotificationSubscriptionType notificationsubscriptiontype) { try { b.a(notificationsubscriptiontype); // 0 0:aload_0 // 1 1:getfield #38 <Field ea b> // 2 4:aload_1 // 3 5:invokevirtual #287 <Method void ea.a(NotificationSubscriptionType)> } //* 4 8:iconst_1 //* 5 9:ireturn catch(Exception exception) //* 6 10:astore_2 { String s = a; // 7 11:getstatic #27 <Field String a> // 8 14:astore_3 StringBuilder stringbuilder = new StringBuilder(); // 9 15:new #55 <Class StringBuilder> // 10 18:dup // 11 19:invokespecial #56 <Method void StringBuilder()> // 12 22:astore 4 stringbuilder.append("Failed to set email notification subscription to: "); // 13 24:aload 4 // 14 26:ldc2 #289 <String "Failed to set email notification subscription to: "> // 15 29:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 16 32:pop stringbuilder.append(((Object) (notificationsubscriptiontype))); // 17 33:aload 4 // 18 35:aload_1 // 19 36:invokevirtual #292 <Method StringBuilder StringBuilder.append(Object)> // 20 39:pop AppboyLogger.w(s, stringbuilder.toString(), ((Throwable) (exception))); // 21 40:aload_3 // 22 41:aload 4 // 23 43:invokevirtual #72 <Method String StringBuilder.toString()> // 24 46:aload_2 // 25 47:invokestatic #143 <Method int AppboyLogger.w(String, String, Throwable)> // 26 50:pop return false; // 27 51:iconst_0 // 28 52:ireturn } return true; } public boolean setFacebookData(FacebookUser facebookuser) { try { b.a(facebookuser); // 0 0:aload_0 // 1 1:getfield #38 <Field ea b> // 2 4:aload_1 // 3 5:invokevirtual #297 <Method void ea.a(FacebookUser)> } //* 4 8:iconst_1 //* 5 9:ireturn // Misplaced declaration of an exception variable catch(FacebookUser facebookuser) //* 6 10:astore_1 { AppboyLogger.w(a, "Failed to set Facebook user data.", ((Throwable) (facebookuser))); // 7 11:getstatic #27 <Field String a> // 8 14:ldc2 #299 <String "Failed to set Facebook user data."> // 9 17:aload_1 // 10 18:invokestatic #143 <Method int AppboyLogger.w(String, String, Throwable)> // 11 21:pop return false; // 12 22:iconst_0 // 13 23:ireturn } return true; } public boolean setFirstName(String s) { try { b.b(s); // 0 0:aload_0 // 1 1:getfield #38 <Field ea b> // 2 4:aload_1 // 3 5:invokevirtual #302 <Method void ea.b(String)> } //* 4 8:iconst_1 //* 5 9:ireturn catch(Exception exception) //* 6 10:astore_2 { String s1 = a; // 7 11:getstatic #27 <Field String a> // 8 14:astore_3 StringBuilder stringbuilder = new StringBuilder(); // 9 15:new #55 <Class StringBuilder> // 10 18:dup // 11 19:invokespecial #56 <Method void StringBuilder()> // 12 22:astore 4 stringbuilder.append("Failed to set first name to: "); // 13 24:aload 4 // 14 26:ldc2 #304 <String "Failed to set first name to: "> // 15 29:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 16 32:pop stringbuilder.append(s); // 17 33:aload 4 // 18 35:aload_1 // 19 36:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 20 39:pop AppboyLogger.w(s1, stringbuilder.toString(), ((Throwable) (exception))); // 21 40:aload_3 // 22 41:aload 4 // 23 43:invokevirtual #72 <Method String StringBuilder.toString()> // 24 46:aload_2 // 25 47:invokestatic #143 <Method int AppboyLogger.w(String, String, Throwable)> // 26 50:pop return false; // 27 51:iconst_0 // 28 52:ireturn } return true; } public boolean setGender(Gender gender) { try { b.a(gender); // 0 0:aload_0 // 1 1:getfield #38 <Field ea b> // 2 4:aload_1 // 3 5:invokevirtual #309 <Method void ea.a(Gender)> } //* 4 8:iconst_1 //* 5 9:ireturn catch(Exception exception) //* 6 10:astore_2 { String s = a; // 7 11:getstatic #27 <Field String a> // 8 14:astore_3 StringBuilder stringbuilder = new StringBuilder(); // 9 15:new #55 <Class StringBuilder> // 10 18:dup // 11 19:invokespecial #56 <Method void StringBuilder()> // 12 22:astore 4 stringbuilder.append("Failed to set gender to: "); // 13 24:aload 4 // 14 26:ldc2 #311 <String "Failed to set gender to: "> // 15 29:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 16 32:pop stringbuilder.append(((Object) (gender))); // 17 33:aload 4 // 18 35:aload_1 // 19 36:invokevirtual #292 <Method StringBuilder StringBuilder.append(Object)> // 20 39:pop AppboyLogger.w(s, stringbuilder.toString(), ((Throwable) (exception))); // 21 40:aload_3 // 22 41:aload 4 // 23 43:invokevirtual #72 <Method String StringBuilder.toString()> // 24 46:aload_2 // 25 47:invokestatic #143 <Method int AppboyLogger.w(String, String, Throwable)> // 26 50:pop return false; // 27 51:iconst_0 // 28 52:ireturn } return true; } public boolean setHomeCity(String s) { try { b.f(s); // 0 0:aload_0 // 1 1:getfield #38 <Field ea b> // 2 4:aload_1 // 3 5:invokevirtual #314 <Method void ea.f(String)> } //* 4 8:iconst_1 //* 5 9:ireturn catch(Exception exception) //* 6 10:astore_2 { String s1 = a; // 7 11:getstatic #27 <Field String a> // 8 14:astore_3 StringBuilder stringbuilder = new StringBuilder(); // 9 15:new #55 <Class StringBuilder> // 10 18:dup // 11 19:invokespecial #56 <Method void StringBuilder()> // 12 22:astore 4 stringbuilder.append("Failed to set home city to: "); // 13 24:aload 4 // 14 26:ldc2 #316 <String "Failed to set home city to: "> // 15 29:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 16 32:pop stringbuilder.append(s); // 17 33:aload 4 // 18 35:aload_1 // 19 36:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 20 39:pop AppboyLogger.w(s1, stringbuilder.toString(), ((Throwable) (exception))); // 21 40:aload_3 // 22 41:aload 4 // 23 43:invokevirtual #72 <Method String StringBuilder.toString()> // 24 46:aload_2 // 25 47:invokestatic #143 <Method int AppboyLogger.w(String, String, Throwable)> // 26 50:pop return false; // 27 51:iconst_0 // 28 52:ireturn } return true; } public boolean setLanguage(String s) { try { b.g(s); // 0 0:aload_0 // 1 1:getfield #38 <Field ea b> // 2 4:aload_1 // 3 5:invokevirtual #319 <Method void ea.g(String)> } //* 4 8:iconst_1 //* 5 9:ireturn catch(Exception exception) //* 6 10:astore_2 { String s1 = a; // 7 11:getstatic #27 <Field String a> // 8 14:astore_3 StringBuilder stringbuilder = new StringBuilder(); // 9 15:new #55 <Class StringBuilder> // 10 18:dup // 11 19:invokespecial #56 <Method void StringBuilder()> // 12 22:astore 4 stringbuilder.append("Failed to set language to: "); // 13 24:aload 4 // 14 26:ldc2 #321 <String "Failed to set language to: "> // 15 29:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 16 32:pop stringbuilder.append(s); // 17 33:aload 4 // 18 35:aload_1 // 19 36:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 20 39:pop AppboyLogger.w(s1, stringbuilder.toString(), ((Throwable) (exception))); // 21 40:aload_3 // 22 41:aload 4 // 23 43:invokevirtual #72 <Method String StringBuilder.toString()> // 24 46:aload_2 // 25 47:invokestatic #143 <Method int AppboyLogger.w(String, String, Throwable)> // 26 50:pop return false; // 27 51:iconst_0 // 28 52:ireturn } return true; } public void setLastKnownLocation(double d1, double d2, Double double1, Double double2) { try { double1 = ((Double) (new cj(d1, d2, double1, double2))); // 0 0:new #325 <Class cj> // 1 3:dup // 2 4:dload_1 // 3 5:dload_3 // 4 6:aload 5 // 5 8:aload 6 // 6 10:invokespecial #327 <Method void cj(double, double, Double, Double)> // 7 13:astore 5 e.a(((bo.app.cd) (double1))); // 8 15:aload_0 // 9 16:getfield #40 <Field bw e> // 10 19:aload 5 // 11 21:invokeinterface #332 <Method boolean bw.a(bo.app.cd)> // 12 26:pop return; // 13 27:return } // Misplaced declaration of an exception variable catch(Double double1) //* 14 28:astore 5 { AppboyLogger.w(a, "Failed to manually set location.", ((Throwable) (double1))); // 15 30:getstatic #27 <Field String a> // 16 33:ldc2 #334 <String "Failed to manually set location."> // 17 36:aload 5 // 18 38:invokestatic #143 <Method int AppboyLogger.w(String, String, Throwable)> // 19 41:pop } // 20 42:return } public boolean setLastName(String s) { try { b.c(s); // 0 0:aload_0 // 1 1:getfield #38 <Field ea b> // 2 4:aload_1 // 3 5:invokevirtual #337 <Method void ea.c(String)> } //* 4 8:iconst_1 //* 5 9:ireturn catch(Exception exception) //* 6 10:astore_2 { String s1 = a; // 7 11:getstatic #27 <Field String a> // 8 14:astore_3 StringBuilder stringbuilder = new StringBuilder(); // 9 15:new #55 <Class StringBuilder> // 10 18:dup // 11 19:invokespecial #56 <Method void StringBuilder()> // 12 22:astore 4 stringbuilder.append("Failed to set last name to: "); // 13 24:aload 4 // 14 26:ldc2 #339 <String "Failed to set last name to: "> // 15 29:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 16 32:pop stringbuilder.append(s); // 17 33:aload 4 // 18 35:aload_1 // 19 36:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 20 39:pop AppboyLogger.w(s1, stringbuilder.toString(), ((Throwable) (exception))); // 21 40:aload_3 // 22 41:aload 4 // 23 43:invokevirtual #72 <Method String StringBuilder.toString()> // 24 46:aload_2 // 25 47:invokestatic #143 <Method int AppboyLogger.w(String, String, Throwable)> // 26 50:pop return false; // 27 51:iconst_0 // 28 52:ireturn } return true; } public void setLocationCustomAttribute(String s, double d1, double d2) { String s1 = s; // 0 0:aload_1 // 1 1:astore 6 Object obj; if(!CustomAttributeValidationUtils.isValidCustomAttributeKey(s, c.i())) //* 2 3:aload_1 //* 3 4:aload_0 //* 4 5:getfield #42 <Field dx c> //* 5 8:invokevirtual #118 <Method java.util.Set dx.i()> //* 6 11:invokestatic #124 <Method boolean CustomAttributeValidationUtils.isValidCustomAttributeKey(String, java.util.Set)> //* 7 14:ifne 31 { s1 = s; // 8 17:aload_1 // 9 18:astore 6 StringBuilder stringbuilder; try { AppboyLogger.w(a, "Custom location attribute key was invalid. Not setting attribute."); // 10 20:getstatic #27 <Field String a> // 11 23:ldc2 #343 <String "Custom location attribute key was invalid. Not setting attribute."> // 12 26:invokestatic #94 <Method int AppboyLogger.w(String, String)> // 13 29:pop return; // 14 30:return } //* 15 31:aload_1 //* 16 32:astore 6 //* 17 34:dload_2 //* 18 35:dload 4 //* 19 37:invokestatic #347 <Method boolean ValidationUtils.isValidLocation(double, double)> //* 20 40:ifne 135 //* 21 43:aload_1 //* 22 44:astore 6 //* 23 46:getstatic #27 <Field String a> //* 24 49:astore 7 //* 25 51:aload_1 //* 26 52:astore 6 //* 27 54:new #55 <Class StringBuilder> //* 28 57:dup //* 29 58:invokespecial #56 <Method void StringBuilder()> //* 30 61:astore 8 //* 31 63:aload_1 //* 32 64:astore 6 //* 33 66:aload 8 //* 34 68:ldc2 #349 <String "Cannot set custom location attribute due with invalid latitude '"> //* 35 71:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> //* 36 74:pop //* 37 75:aload_1 //* 38 76:astore 6 //* 39 78:aload 8 //* 40 80:dload_2 //* 41 81:invokevirtual #352 <Method StringBuilder StringBuilder.append(double)> //* 42 84:pop //* 43 85:aload_1 //* 44 86:astore 6 //* 45 88:aload 8 //* 46 90:ldc2 #354 <String " and longitude '"> //* 47 93:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> //* 48 96:pop //* 49 97:aload_1 //* 50 98:astore 6 //* 51 100:aload 8 //* 52 102:dload 4 //* 53 104:invokevirtual #352 <Method StringBuilder StringBuilder.append(double)> //* 54 107:pop //* 55 108:aload_1 //* 56 109:astore 6 //* 57 111:aload 8 //* 58 113:ldc2 #356 <String "'"> //* 59 116:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> //* 60 119:pop //* 61 120:aload_1 //* 62 121:astore 6 //* 63 123:aload 7 //* 64 125:aload 8 //* 65 127:invokevirtual #72 <Method String StringBuilder.toString()> //* 66 130:invokestatic #94 <Method int AppboyLogger.w(String, String)> //* 67 133:pop //* 68 134:return //* 69 135:aload_1 //* 70 136:astore 6 //* 71 138:aload_1 //* 72 139:invokestatic #135 <Method String ValidationUtils.ensureAppboyFieldLength(String)> //* 73 142:astore_1 //* 74 143:aload_1 //* 75 144:astore 6 //* 76 146:aload_1 //* 77 147:dload_2 //* 78 148:dload 4 //* 79 150:invokestatic #359 <Method ci ci.a(String, double, double)> //* 80 153:astore 7 //* 81 155:aload_1 //* 82 156:astore 6 //* 83 158:aload_0 //* 84 159:getfield #44 <Field bt g> //* 85 162:aload 7 //* 86 164:invokeinterface #106 <Method boolean bt.a(bo.app.cc)> //* 87 169:pop //* 88 170:return // Misplaced declaration of an exception variable catch(String s) //* 89 171:astore_1 { obj = ((Object) (a)); // 90 172:getstatic #27 <Field String a> // 91 175:astore 7 } break MISSING_BLOCK_LABEL_177; } s1 = s; if(ValidationUtils.isValidLocation(d1, d2)) break MISSING_BLOCK_LABEL_135; s1 = s; obj = ((Object) (a)); s1 = s; stringbuilder = new StringBuilder(); s1 = s; stringbuilder.append("Cannot set custom location attribute due with invalid latitude '"); s1 = s; stringbuilder.append(d1); s1 = s; stringbuilder.append(" and longitude '"); s1 = s; stringbuilder.append(d2); s1 = s; stringbuilder.append("'"); s1 = s; AppboyLogger.w(((String) (obj)), stringbuilder.toString()); return; s1 = s; s = ValidationUtils.ensureAppboyFieldLength(s); s1 = s; obj = ((Object) (ci.a(s, d1, d2))); s1 = s; g.a(((bo.app.cc) (obj))); return; StringBuilder stringbuilder1 = new StringBuilder(); // 92 177:new #55 <Class StringBuilder> // 93 180:dup // 94 181:invokespecial #56 <Method void StringBuilder()> // 95 184:astore 8 stringbuilder1.append("Failed to set custom location attribute with key '"); // 96 186:aload 8 // 97 188:ldc2 #361 <String "Failed to set custom location attribute with key '"> // 98 191:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 99 194:pop stringbuilder1.append(s1); // 100 195:aload 8 // 101 197:aload 6 // 102 199:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 103 202:pop stringbuilder1.append("' and latitude '"); // 104 203:aload 8 // 105 205:ldc2 #363 <String "' and latitude '"> // 106 208:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 107 211:pop stringbuilder1.append(d1); // 108 212:aload 8 // 109 214:dload_2 // 110 215:invokevirtual #352 <Method StringBuilder StringBuilder.append(double)> // 111 218:pop stringbuilder1.append("' and longitude '"); // 112 219:aload 8 // 113 221:ldc2 #365 <String "' and longitude '"> // 114 224:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 115 227:pop stringbuilder1.append(d2); // 116 228:aload 8 // 117 230:dload 4 // 118 232:invokevirtual #352 <Method StringBuilder StringBuilder.append(double)> // 119 235:pop stringbuilder1.append("'"); // 120 236:aload 8 // 121 238:ldc2 #356 <String "'"> // 122 241:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 123 244:pop AppboyLogger.w(((String) (obj)), stringbuilder1.toString(), ((Throwable) (s))); // 124 245:aload 7 // 125 247:aload 8 // 126 249:invokevirtual #72 <Method String StringBuilder.toString()> // 127 252:aload_1 // 128 253:invokestatic #143 <Method int AppboyLogger.w(String, String, Throwable)> // 129 256:pop return; // 130 257:return } public boolean setPhoneNumber(String s) { boolean flag; try { flag = b.h(s); // 0 0:aload_0 // 1 1:getfield #38 <Field ea b> // 2 4:aload_1 // 3 5:invokevirtual #369 <Method boolean ea.h(String)> // 4 8:istore_2 } //* 5 9:iload_2 //* 6 10:ireturn catch(Exception exception) //* 7 11:astore_3 { String s1 = a; // 8 12:getstatic #27 <Field String a> // 9 15:astore 4 StringBuilder stringbuilder = new StringBuilder(); // 10 17:new #55 <Class StringBuilder> // 11 20:dup // 12 21:invokespecial #56 <Method void StringBuilder()> // 13 24:astore 5 stringbuilder.append("Failed to set phone number to: "); // 14 26:aload 5 // 15 28:ldc2 #371 <String "Failed to set phone number to: "> // 16 31:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 17 34:pop stringbuilder.append(s); // 18 35:aload 5 // 19 37:aload_1 // 20 38:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 21 41:pop AppboyLogger.w(s1, stringbuilder.toString(), ((Throwable) (exception))); // 22 42:aload 4 // 23 44:aload 5 // 24 46:invokevirtual #72 <Method String StringBuilder.toString()> // 25 49:aload_3 // 26 50:invokestatic #143 <Method int AppboyLogger.w(String, String, Throwable)> // 27 53:pop return false; // 28 54:iconst_0 // 29 55:ireturn } return flag; } public boolean setPushNotificationSubscriptionType(NotificationSubscriptionType notificationsubscriptiontype) { try { b.b(notificationsubscriptiontype); // 0 0:aload_0 // 1 1:getfield #38 <Field ea b> // 2 4:aload_1 // 3 5:invokevirtual #374 <Method void ea.b(NotificationSubscriptionType)> } //* 4 8:iconst_1 //* 5 9:ireturn catch(Exception exception) //* 6 10:astore_2 { String s = a; // 7 11:getstatic #27 <Field String a> // 8 14:astore_3 StringBuilder stringbuilder = new StringBuilder(); // 9 15:new #55 <Class StringBuilder> // 10 18:dup // 11 19:invokespecial #56 <Method void StringBuilder()> // 12 22:astore 4 stringbuilder.append("Failed to set push notification subscription to: "); // 13 24:aload 4 // 14 26:ldc2 #376 <String "Failed to set push notification subscription to: "> // 15 29:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 16 32:pop stringbuilder.append(((Object) (notificationsubscriptiontype))); // 17 33:aload 4 // 18 35:aload_1 // 19 36:invokevirtual #292 <Method StringBuilder StringBuilder.append(Object)> // 20 39:pop AppboyLogger.w(s, stringbuilder.toString(), ((Throwable) (exception))); // 21 40:aload_3 // 22 41:aload 4 // 23 43:invokevirtual #72 <Method String StringBuilder.toString()> // 24 46:aload_2 // 25 47:invokestatic #143 <Method int AppboyLogger.w(String, String, Throwable)> // 26 50:pop return false; // 27 51:iconst_0 // 28 52:ireturn } return true; } public boolean setTwitterData(TwitterUser twitteruser) { try { b.a(twitteruser); // 0 0:aload_0 // 1 1:getfield #38 <Field ea b> // 2 4:aload_1 // 3 5:invokevirtual #381 <Method void ea.a(TwitterUser)> } //* 4 8:iconst_1 //* 5 9:ireturn // Misplaced declaration of an exception variable catch(TwitterUser twitteruser) //* 6 10:astore_1 { AppboyLogger.w(a, "Failed to set Twitter user data.", ((Throwable) (twitteruser))); // 7 11:getstatic #27 <Field String a> // 8 14:ldc2 #383 <String "Failed to set Twitter user data."> // 9 17:aload_1 // 10 18:invokestatic #143 <Method int AppboyLogger.w(String, String, Throwable)> // 11 21:pop return false; // 12 22:iconst_0 // 13 23:ireturn } return true; } public boolean unsetCustomUserAttribute(String s) { boolean flag; try { flag = b.j(s); // 0 0:aload_0 // 1 1:getfield #38 <Field ea b> // 2 4:aload_1 // 3 5:invokevirtual #387 <Method boolean ea.j(String)> // 4 8:istore_2 } //* 5 9:iload_2 //* 6 10:ireturn catch(Exception exception) //* 7 11:astore_3 { String s1 = a; // 8 12:getstatic #27 <Field String a> // 9 15:astore 4 StringBuilder stringbuilder = new StringBuilder(); // 10 17:new #55 <Class StringBuilder> // 11 20:dup // 12 21:invokespecial #56 <Method void StringBuilder()> // 13 24:astore 5 stringbuilder.append("Failed to unset custom attribute "); // 14 26:aload 5 // 15 28:ldc2 #389 <String "Failed to unset custom attribute "> // 16 31:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 17 34:pop stringbuilder.append(s); // 18 35:aload 5 // 19 37:aload_1 // 20 38:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 21 41:pop stringbuilder.append("."); // 22 42:aload 5 // 23 44:ldc1 #162 <String "."> // 24 46:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 25 49:pop AppboyLogger.w(s1, stringbuilder.toString(), ((Throwable) (exception))); // 26 50:aload 4 // 27 52:aload 5 // 28 54:invokevirtual #72 <Method String StringBuilder.toString()> // 29 57:aload_3 // 30 58:invokestatic #143 <Method int AppboyLogger.w(String, String, Throwable)> // 31 61:pop return false; // 32 62:iconst_0 // 33 63:ireturn } return flag; } public void unsetLocationCustomAttribute(String s) { String s1 = s; // 0 0:aload_1 // 1 1:astore_2 Object obj; if(!CustomAttributeValidationUtils.isValidCustomAttributeKey(s, c.i())) //* 2 2:aload_1 //* 3 3:aload_0 //* 4 4:getfield #42 <Field dx c> //* 5 7:invokevirtual #118 <Method java.util.Set dx.i()> //* 6 10:invokestatic #124 <Method boolean CustomAttributeValidationUtils.isValidCustomAttributeKey(String, java.util.Set)> //* 7 13:ifne 29 { s1 = s; // 8 16:aload_1 // 9 17:astore_2 try { AppboyLogger.w(a, "Custom location attribute key was invalid. Not setting attribute."); // 10 18:getstatic #27 <Field String a> // 11 21:ldc2 #343 <String "Custom location attribute key was invalid. Not setting attribute."> // 12 24:invokestatic #94 <Method int AppboyLogger.w(String, String)> // 13 27:pop return; // 14 28:return } //* 15 29:aload_1 //* 16 30:astore_2 //* 17 31:aload_1 //* 18 32:invokestatic #135 <Method String ValidationUtils.ensureAppboyFieldLength(String)> //* 19 35:astore_1 //* 20 36:aload_1 //* 21 37:astore_2 //* 22 38:aload_1 //* 23 39:invokestatic #394 <Method ci ci.k(String)> //* 24 42:astore_3 //* 25 43:aload_1 //* 26 44:astore_2 //* 27 45:aload_0 //* 28 46:getfield #44 <Field bt g> //* 29 49:aload_3 //* 30 50:invokeinterface #106 <Method boolean bt.a(bo.app.cc)> //* 31 55:pop //* 32 56:return // Misplaced declaration of an exception variable catch(String s) //* 33 57:astore_1 { obj = ((Object) (a)); // 34 58:getstatic #27 <Field String a> // 35 61:astore_3 } break MISSING_BLOCK_LABEL_62; } s1 = s; s = ValidationUtils.ensureAppboyFieldLength(s); s1 = s; obj = ((Object) (ci.k(s))); s1 = s; g.a(((bo.app.cc) (obj))); return; StringBuilder stringbuilder = new StringBuilder(); // 36 62:new #55 <Class StringBuilder> // 37 65:dup // 38 66:invokespecial #56 <Method void StringBuilder()> // 39 69:astore 4 stringbuilder.append("Failed to unset custom location attribute with key '"); // 40 71:aload 4 // 41 73:ldc2 #396 <String "Failed to unset custom location attribute with key '"> // 42 76:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 43 79:pop stringbuilder.append(s1); // 44 80:aload 4 // 45 82:aload_2 // 46 83:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 47 86:pop stringbuilder.append("'"); // 48 87:aload 4 // 49 89:ldc2 #356 <String "'"> // 50 92:invokevirtual #62 <Method StringBuilder StringBuilder.append(String)> // 51 95:pop AppboyLogger.w(((String) (obj)), stringbuilder.toString(), ((Throwable) (s))); // 52 96:aload_3 // 53 97:aload 4 // 54 99:invokevirtual #72 <Method String StringBuilder.toString()> // 55 102:aload_1 // 56 103:invokestatic #143 <Method int AppboyLogger.w(String, String, Throwable)> // 57 106:pop return; // 58 107:return } private static final String a = AppboyLogger.getAppboyLogTag(com/appboy/AppboyUser); private final ea b; private final dx c; private final Object d = new Object(); private final bw e; private volatile String f; private final bt g; static { // 0 0:ldc1 #2 <Class AppboyUser> // 1 2:invokestatic #25 <Method String AppboyLogger.getAppboyLogTag(Class)> // 2 5:putstatic #27 <Field String a> //* 3 8:return } }
dd56dd4d9b9199f929d6cca45591af8c660c4f85
10cd2deccd4fc01e3bc53ac9884a91c899ec80c8
/src/com/yoship/State_StageSelect.java
b7afce75e399f7a5fd1584e35b72f8bd801764a7
[]
no_license
yoship1639/NekomanBlockPuzzle
c56d6a84d4b144a62768fae488a72fc2c8b46a13
42ddef7469b8a80416018c2d169b0512876b767b
refs/heads/master
2021-01-01T18:42:12.694465
2014-08-15T17:59:57
2014-08-15T17:59:57
22,998,360
2
0
null
null
null
null
UTF-8
Java
false
false
6,733
java
package com.yoship; import javax.microedition.khronos.opengles.GL10; import android.content.Context; import android.media.MediaPlayer; import android.view.KeyEvent; import com.roxiga.hypermotion3d.Camera; import com.roxiga.hypermotion3d.KeyManager; import com.roxiga.hypermotion3d.SV; import com.roxiga.hypermotion3d.Sprite2D; import com.roxiga.hypermotion3d.SpriteText; import com.roxiga.hypermotion3d.State; import com.roxiga.hypermotion3d.TouchManager; import com.roxiga.hypermotion3d.Vector2D; import com.roxiga.hypermotion3d.Vector3D; import com.roxiga.hypermotion3d.Vector4D; import com.roxiga.models.block; import com.roxiga.models.cubemap; import com.roxiga.models.floor; public final class State_StageSelect extends State { private static State_StageSelect instance = new State_StageSelect(); private State_StageSelect(){} public static State_StageSelect getInstance(){ return instance; } private static final int SP_LOGO = 0, SP_PLAY = 1, SP_GOTITLE = 2, SP_NEXT = 3, SP_PREV = 4, SP_TIMER = 5, SP_WALK = 6, SPRITE_MAX_NUM = 7; private static final int T_STAGE = 0, T_SCORE = 1, T_TIMER_CNT = 2, T_WALK_CNT = 3; private Sprite2D _sprite [] = new Sprite2D[SPRITE_MAX_NUM]; private SpriteText _text; private MediaPlayer _se; private cubemap _cubemap = new cubemap(); private PuzzleController _pc = new PuzzleController(); @Override public void init(GL10 gl, Context context, String str, Camera cam) { boolean resume = Boolean.parseBoolean(str); //sprite { int drawable [] = { R.drawable.sprite_logo_stageselect, R.drawable.sprite_select, R.drawable.sprite_gotitle, R.drawable.sprite_next, R.drawable.sprite_previous, R.drawable.sprite_timer, R.drawable.sprite_walk, }; for (int i = 0; i < drawable.length; i++) { _sprite[i] = new Sprite2D(); _sprite[i].setTexture(gl, context.getResources(), drawable[i]); } Vector3D pos [] = { new Vector3D((SV.VirtualScreenSize._x - _sprite[SP_LOGO]._width)/2, 0, 0), new Vector3D((SV.VirtualScreenSize._x - _sprite[SP_PLAY]._width)/2, 480, 0), new Vector3D(20, SV.VirtualScreenSize._y - _sprite[SP_PLAY]._height - 20, 0), new Vector3D(SV.VirtualScreenSize._x - _sprite[SP_PREV]._width - 10, 480, 0), new Vector3D(20, 480, 0), new Vector3D(1000, 140, 0), new Vector3D(1000, 220, 0), }; for (int i = 0; i < pos.length; i++) { _sprite[i]._pos = pos[i]; } } //puzzlecontroller { floor fm = new floor(); int tf [] = { R.drawable.tex_floor, R.drawable.tex_floor2, R.drawable.tex_floor3, }; fm.setTexture(gl, context.getResources(), tf[GV.TextureQuality]); _pc.setFloorModel(fm); block b [] = new block[4]; for (int i = 0; i < b.length; i++) { b[i] = new block(); b[i].setTexture(gl, context.getResources(), R.drawable.tex_black); } _pc.setBlockModels(b); _pc.initStage(GV.StageData[GV.SelectLevel][GV.SelectIndex-1].data); } //text { if(resume && _text != null){ _text.remake(gl); }else{ _text = new SpriteText(); _text.setSize(gl, 60); _text._color = new Vector4D(0, 0, 0, 1); } } //se { if(_se != null)_se.release(); _se = MediaPlayer.create(context, R.raw.se_switch); } //CubeMap { int ts [] = { R.drawable.skybox_sunny, R.drawable.skybox_sunny2, R.drawable.skybox_sunny3, }; _cubemap.setTexture(gl, context.getResources(), ts[GV.TextureQuality]); _cubemap._scale = new Vector3D(5.0f, 5.0f, 5.0f); _cubemap._pos._y = -140; } cam.setDist(80f); } @Override public void proccess(TouchManager tm, KeyManager km, Camera cam) { if(State.canInput){ int touch = -1; if(tm._touch){ _sprite[SP_PLAY].hitCheck(tm._pos); _sprite[SP_GOTITLE].hitCheck(tm._pos); _sprite[SP_NEXT].hitCheck(tm._pos); _sprite[SP_PREV].hitCheck(tm._pos); }else if(tm._old){ if(_sprite[SP_PLAY].releaseCheck(tm._pos))touch = SP_PLAY; else if(_sprite[SP_GOTITLE].releaseCheck(tm._pos))touch = SP_GOTITLE; else if(_sprite[SP_NEXT].releaseCheck(tm._pos))touch = SP_NEXT; else if(_sprite[SP_PREV].releaseCheck(tm._pos))touch = SP_PREV; } if(touch != -1){ switch(touch){ case SP_PLAY: GV.HideAd(); NextState = GV.STATE_PLAY; if(GV.IsPlaySE)_se.start(); break; case SP_GOTITLE: NextState = GV.STATE_TITLE; if(GV.IsPlaySE)_se.start(); break; case SP_NEXT: GV.SelectIndex++; if(GV.SelectIndex > GV.STAGE_MAX_NUM)GV.SelectIndex = GV.STAGE_MAX_NUM; else _pc.initStage(GV.StageData[GV.SelectLevel][GV.SelectIndex-1].data); if(GV.IsPlaySE)_se.start(); break; case SP_PREV: GV.SelectIndex--; if(GV.SelectIndex < 1)GV.SelectIndex = 1; else _pc.initStage(GV.StageData[GV.SelectLevel][GV.SelectIndex-1].data); if(GV.IsPlaySE)_se.start(); break; } }else if(km.isKeyUp(KeyEvent.KEYCODE_BACK)){ NextState = GV.STATE_TITLE; if(GV.IsPlaySE)SV.PlaySE(_se); } } if(tm._touch && tm._pos._x > SV.VirtualScreenSize._x/2){ float height = tm._pos._y - tm._oldPos._y; if(!tm._old)height = 0; cam.addRotXZ(height/20.0f, 70f, 10f); } cam.rotAddCameraDome(new Vector3D((_pc.getSizeX()-1)*5, 10f, (_pc.getSizeZ()-1)*5), 0.2f); } @Override public void draw(GL10 gl) { _cubemap.draw(gl); _pc.drawFloor(gl); _pc.drawBlock(gl); _sprite[SP_LOGO].draw(gl); _sprite[SP_PLAY].draw(gl, true); _sprite[SP_GOTITLE].draw(gl, true); _sprite[SP_NEXT].draw(gl, true); _sprite[SP_PREV].draw(gl, true); _text.setSize(gl, 60); _text.setText(gl, T_STAGE, GV.STRING_LEVEL[GV.SelectLevel]+" STAGE "+GV.SelectIndex, new Vector2D((SV.VirtualScreenSize._x - _text.getWidth(GV.STRING_LEVEL[GV.SelectLevel]+" STAGE "+GV.SelectIndex))/2, 180)); if(GV.StageData[GV.SelectLevel][GV.SelectIndex-1].isCleared){ _text.setSize(gl, 40); _text.setText(gl, T_SCORE, "HIGH SCORE : "+String.format("%06d", GV.StageData[GV.SelectLevel][GV.SelectIndex-1].scoreRecord), new Vector2D(820, 80)); _text.setText(gl, T_TIMER_CNT, String.format("%04d", GV.StageData[GV.SelectLevel][GV.SelectIndex-1].timeRecord), new Vector2D(1130, 152)); _text.setText(gl, T_WALK_CNT, String.format("%04d", GV.StageData[GV.SelectLevel][GV.SelectIndex-1].walkRecord), new Vector2D(1130, 232)); _text._color = new Vector4D(1, 1, 0, 1); _text.draw(gl, T_STAGE); _text._color = new Vector4D(0, 0, 0, 1); _text.draw(gl, T_SCORE); _text.draw(gl, T_TIMER_CNT); _text.draw(gl, T_WALK_CNT); _sprite[SP_TIMER].draw(gl); _sprite[SP_WALK].draw(gl); }else{ _text._color = new Vector4D(0, 0, 1, 1); _text.draw(gl, T_STAGE); } } }
d0cf32d204e2b890d7754c83c7a7bf817b67c7f1
81719679e3d5945def9b7f3a6f638ee274f5d770
/aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/transform/UpdateApiResultJsonUnmarshaller.java
d0e8634a720e33eb3211a3e9cae22b66fc37a0f6
[ "Apache-2.0" ]
permissive
ZeevHayat1/aws-sdk-java
1e3351f2d3f44608fbd3ff987630b320b98dc55c
bd1a89e53384095bea869a4ea064ef0cf6ed7588
refs/heads/master
2022-04-10T14:18:43.276970
2020-03-07T12:15:44
2020-03-07T12:15:44
172,681,373
1
0
Apache-2.0
2019-02-26T09:36:47
2019-02-26T09:36:47
null
UTF-8
Java
false
false
5,287
java
/* * Copyright 2014-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.apigatewayv2.model.transform; import java.math.*; import javax.annotation.Generated; import com.amazonaws.services.apigatewayv2.model.*; import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*; import com.amazonaws.transform.*; import com.fasterxml.jackson.core.JsonToken; import static com.fasterxml.jackson.core.JsonToken.*; /** * UpdateApiResult JSON Unmarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class UpdateApiResultJsonUnmarshaller implements Unmarshaller<UpdateApiResult, JsonUnmarshallerContext> { public UpdateApiResult unmarshall(JsonUnmarshallerContext context) throws Exception { UpdateApiResult updateApiResult = new UpdateApiResult(); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) token = context.nextToken(); if (token == VALUE_NULL) { return updateApiResult; } while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { if (context.testExpression("apiEndpoint", targetDepth)) { context.nextToken(); updateApiResult.setApiEndpoint(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("apiId", targetDepth)) { context.nextToken(); updateApiResult.setApiId(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("apiKeySelectionExpression", targetDepth)) { context.nextToken(); updateApiResult.setApiKeySelectionExpression(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("createdDate", targetDepth)) { context.nextToken(); updateApiResult.setCreatedDate(DateJsonUnmarshallerFactory.getInstance("iso8601").unmarshall(context)); } if (context.testExpression("description", targetDepth)) { context.nextToken(); updateApiResult.setDescription(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("disableSchemaValidation", targetDepth)) { context.nextToken(); updateApiResult.setDisableSchemaValidation(context.getUnmarshaller(Boolean.class).unmarshall(context)); } if (context.testExpression("name", targetDepth)) { context.nextToken(); updateApiResult.setName(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("protocolType", targetDepth)) { context.nextToken(); updateApiResult.setProtocolType(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("routeSelectionExpression", targetDepth)) { context.nextToken(); updateApiResult.setRouteSelectionExpression(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("version", targetDepth)) { context.nextToken(); updateApiResult.setVersion(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("warnings", targetDepth)) { context.nextToken(); updateApiResult.setWarnings(new ListUnmarshaller<String>(context.getUnmarshaller(String.class)).unmarshall(context)); } } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) break; } } token = context.nextToken(); } return updateApiResult; } private static UpdateApiResultJsonUnmarshaller instance; public static UpdateApiResultJsonUnmarshaller getInstance() { if (instance == null) instance = new UpdateApiResultJsonUnmarshaller(); return instance; } }
[ "" ]
d887046d60c8674e3a779afb2059bf6fbd944af9
b56c075c634f5c3a4dcee55f0279483c325ce55f
/rxbinding/src/main/java/com/jakewharton/rxbinding2/view/ViewGroupHierarchyChildViewRemoveEvent.java
db95edbbc650bc00900a8c68efc97e9aadbb639b
[ "Apache-2.0" ]
permissive
SamYStudiO/RxBinding
026a50f75024f93dd375cfa237d11288f1bdbc1b
6b5f5ddc663c413258400bdc1d6e3537001d8205
refs/heads/master
2020-03-31T06:37:20.791912
2018-09-25T20:27:51
2018-09-25T20:27:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
895
java
package com.jakewharton.rxbinding2.view; import android.content.Context; import android.support.annotation.CheckResult; import android.support.annotation.NonNull; import android.view.View; import android.view.ViewGroup; import com.google.auto.value.AutoValue; /** * A child view remove event on a {@link ViewGroup}. * <p> * <strong>Warning:</strong> Instances keep a strong reference to the view. Operators that cache * instances have the potential to leak the associated {@link Context}. */ @AutoValue public abstract class ViewGroupHierarchyChildViewRemoveEvent extends ViewGroupHierarchyChangeEvent { @CheckResult @NonNull public static ViewGroupHierarchyChildViewRemoveEvent create(@NonNull ViewGroup viewGroup, @NonNull View child) { return new AutoValue_ViewGroupHierarchyChildViewRemoveEvent(viewGroup, child); } ViewGroupHierarchyChildViewRemoveEvent() { } }
e2f29917d779cc6131887fdc11c368dc5fa9faa9
4208f7d6c9a8f1454f4cc7e77e973d30ccff384b
/TraducirAlfabet.java
edd06b2ef736636bd511c2e9f276938dfb869a60
[]
no_license
JesusTuz/Codigo-morse
e8d434e878d52a533cb733ea29d0490797fe6177
e38f53ffdba5d9a73738d6393f3112041f968a71
refs/heads/master
2020-04-01T08:20:05.216694
2018-10-15T04:01:52
2018-10-15T04:01:52
153,026,481
1
0
null
null
null
null
UTF-8
Java
false
false
1,777
java
package morsec; /** * * @author Jesus Tuz */ public class TraducirAlfabet { public String TraALF(String cadena){ String alfa = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; cadena=cadena.toUpperCase(); String espacio = " "; String ncadena= ""; String arreglo[]= new String[36]; arreglo[0]=".-"; arreglo[1]="-..."; arreglo[2]="-.-."; arreglo[3]="-.."; arreglo[4]="."; arreglo[5]="..-."; arreglo[6]="--."; arreglo[7]="...."; arreglo[8]=".."; arreglo[9]=".---"; arreglo[10]="-.-"; arreglo[11]=".-.."; arreglo[12]="--"; arreglo[13]="-."; arreglo[14]="---"; arreglo[15]=".--."; arreglo[16]="--.-"; arreglo[17]=".-."; arreglo[18]="..."; arreglo[19]="-"; arreglo[20]="..-"; arreglo[21]="...-"; arreglo[22]=".--"; arreglo[23]="-..-"; arreglo[24]="-.--"; arreglo[25]="--.."; arreglo[26]=".----"; arreglo[27]="..---"; arreglo[28]="...--"; arreglo[29]="....-"; arreglo[30]="....."; arreglo[31]="-...."; arreglo[32]="--..."; arreglo[33]="---.."; arreglo[34]="----."; arreglo[35]="-----"; for(int i=0; i<cadena.length(); i++){ if(cadena.charAt(i)==' '){ ncadena=ncadena+espacio; }else{ for(int j=0; j<alfa.length(); j++){ if(cadena.charAt(i)==alfa.charAt(j)){ ncadena=ncadena+arreglo[j]+' '; } } } } return ncadena; } }
8a967e46099f4ea08d30fc48ad93ca3315e63779
5e0248ec2db6b0046e23ac2e2d2b35b6fd6d5c89
/src/com/tolstovenator/brewcalc/calc/AlcCalculator.java
4b7167cb61ad5c291d3a97a929e38edb7586cecc
[]
no_license
tolstovenator/BrewCalc
d91cd2225412d134a8d737ef90d6e8729cc6a263
14236db4b09d38d8edec0c21d04d2dcbff341f1e
refs/heads/master
2020-04-19T00:38:07.885463
2013-11-27T06:46:55
2013-11-27T06:46:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,279
java
package com.tolstovenator.brewcalc.calc; import com.tolstovenator.brewcalc.preferences.UnitsConverter; import com.tolstovenator.brewcalc.util.Rounder; public class AlcCalculator { private double ogGravity; private double fgGravity; private double platoGravity; private double platoFgGravity; private double abv; private double abw; private double adf; private double rdf; private double residualSg; private double residualPlato; public AlcCalculator() { platoGravity = 11; platoFgGravity = 2; recalcValues(); } private void recalcValues() { ogGravity = UnitsConverter.platoToSg(platoGravity); fgGravity = UnitsConverter.platoToSg(platoFgGravity); //abv = Rounder.round((ogGravity - fgGravity) * 131, 2); //abw = Rounder.round(abv * 4 / 5, 2); abw = Rounder.round((76.08 * (ogGravity - fgGravity)) / (1.775 - ogGravity), 2); abv = Rounder.round(abw * fgGravity / 0.794, 2); adf = Rounder.round((ogGravity - fgGravity) / (ogGravity - 1) * 100, 2); rdf = Rounder.round((1 - (.1808*platoGravity + .8192*platoFgGravity) / platoGravity) * 100, 2); residualPlato = Rounder.round(platoFgGravity + .4654*(abw) - .003615*(abw)*abw / .9962, 2); residualSg = Rounder.round(UnitsConverter.platoToSg(residualPlato), 3); } public void setOgGravity(double ogGravity) { platoGravity = UnitsConverter.sgToPlato(ogGravity); recalcValues(); } public void setFgGravity(double fgGravity) { platoFgGravity = UnitsConverter.sgToPlato(fgGravity); recalcValues(); } public void setPlatoGravity(double platoGravity) { this.platoGravity = platoGravity; recalcValues(); } public void setPlatoFgGravity(double platoFgGravity) { this.platoFgGravity = platoFgGravity; recalcValues(); } public double getOgGravity() { return ogGravity; } public double getFgGravity() { return fgGravity; } public double getPlatoGravity() { return platoGravity; } public double getPlatoFgGravity() { return platoFgGravity; } public double getAbv() { return abv; } public double getAbw() { return abw; } public double getAdf() { return adf; } public double getRdf() { return rdf; } public double getResidualSg() { return residualSg; } public double getResidualPlato() { return residualPlato; } }
a2b154c022c30018ab18df376d0777493e599c17
23d21d575da06d8a0f0c3a266915df321b5154eb
/java/designpattern/src/main/java/designpattern/gof_flyweight/sample01/NoodleContext.java
5fed6cef9d7156bfb94bcf2dbf4e276ca2b1fa7e
[]
no_license
keepinmindsh/sample
180431ce7fce20808e65d885eab1ca3dca4a76a9
4169918f432e9008b4715f59967f3c0bd619d3e6
refs/heads/master
2023-04-30T19:26:44.510319
2023-04-23T12:43:43
2023-04-23T12:43:43
248,352,910
4
0
null
2023-03-05T23:20:43
2020-03-18T22:03:16
Java
UTF-8
Java
false
false
272
java
package designpattern.gof_flyweight.sample01; public class NoodleContext { private final int tableNumber; public NoodleContext(int tableNumber) { this.tableNumber = tableNumber; } public int getTable() { return this.tableNumber; } }
111ba9ec508f118a06981aeaf8b71ea3a29559f7
094365d9b4ddf9d8755fd53513bb40bf64a18d90
/src/renor/level/material/MaterialTransparent.java
83f80b6c0279b32b174d1d57f9d62b8a689f534b
[]
no_license
jaredible/renor
b4c06e17a4bedc1f4f050f49c040780b7cf73a9d
60ffec8ba7218dfff4d1da94a25e3b5d406061b5
refs/heads/master
2022-03-27T13:38:26.601189
2020-01-21T10:43:33
2020-01-21T10:43:33
123,838,719
0
1
null
null
null
null
UTF-8
Java
false
false
243
java
package renor.level.material; public class MaterialTransparent extends Material { public MaterialTransparent() { setReplaceable(); } public boolean isSolid() { return false; } public boolean blocksMovement() { return false; } }
d6ae56e0dc7a508a56e96d7cd536d6193213f95f
9c279fe98fe70459fd381cf298468879ce838cc1
/app/src/main/java/lz/newone/news/presenter/NewsPresenter.java
c1bb36d295e37bf5cc31b4d115cdb2efa4e4dd77
[]
no_license
JaycRor/AP
67916d4222a729a175a36bcb6f9a3b911ee4b2c8
f86438e91a664c9e31434121095965bfe3e4af9d
refs/heads/master
2021-07-13T23:39:06.324228
2017-10-18T11:13:42
2017-10-18T11:13:42
107,358,949
1
0
null
null
null
null
UTF-8
Java
false
false
112
java
package lz.newone.news.presenter; public interface NewsPresenter { void loadNews(int type, int page); }
74493af38d801541ed8eba7bdc691b586884bc3e
6d8a933e6cce814d2a4e438c3172dfb109266f09
/src/iii/org/tw/controller/RecommendationController.java
ade06a03462d10caebfe3b33814a3505b11aa524
[]
no_license
wang490520334/SmartTourismApi
7a6426922f98c5e435f6f686e0bf87dad7690620
2d09be9925984cd931d0aba39bd480d58c6b3301
refs/heads/master
2020-12-24T14:01:26.835931
2014-09-30T01:29:41
2014-09-30T01:29:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,271
java
package iii.org.tw.controller; import iii.org.tw.model.POIListModel; import iii.org.tw.model.RecommendationInput; import iii.org.tw.service.MySqlConnection; import iii.org.tw.util.NotFoundException; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Hashtable; import java.util.List; import java.util.Map; import javax.ws.rs.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.gson.Gson; import com.wordnik.swagger.annotations.Api; import com.wordnik.swagger.annotations.ApiOperation; import com.wordnik.swagger.annotations.ApiParam; import com.wordnik.swagger.annotations.ApiResponse; import com.wordnik.swagger.annotations.ApiResponses; @Path("/recommendation") @Api(value = "/recommendation", description = "Operations about recommendation") @Produces({ "application/json" }) public class RecommendationController { Logger logger = LoggerFactory.getLogger(CalendarController.class); private ArrayList<String> poiCandidate; private MySqlConnection connection; public Hashtable<String, Double> score; public RecommendationController() { connection = new MySqlConnection(); } @ApiOperation(value = "產生個人化頁面的POI List", response = String.class, responseContainer="List") @ApiResponses(value = { @ApiResponse(code = 500, message = "Internal Error"), @ApiResponse(code = 404, message = "Attraction not found"), @ApiResponse(code = 400, message = "Invalid Language String") }) @POST public String personalPage( @ApiParam(value = "[本平台使用者token(登入時取得)] 或 [第三方APP userKey]", required = true) @HeaderParam("userToken") String userToken, @ApiParam(value = "POI ID組成的list", required = true) RecommendationInput poiList ) { String request; ResultSet result; double sum; ArrayList<String> personalPageResult = new ArrayList<String>(); List<String> list = poiList.getPoiList(); try { //取得rating table中該user rated的poi list request = "SELECT Place_ID, Rating FROM rating WHERE User_ID = '" + userToken + "'"; result = connection.searchQuery(request); Hashtable<String, Integer> userRatedPOIList = new Hashtable<String, Integer>(); while(result.next()) { userRatedPOIList.put(result.getString("Place_ID"), result.getInt("Rating")); } score = new Hashtable<String, Double>(); for(String targetPOI : list) { sum = 0.0; for(Map.Entry<String, Integer> ratedPOI : userRatedPOIList.entrySet()) { //找出target poi與rated poi的similarity request = "SELECT Similarity FROM similarity WHERE Place_ID_1 = '" + targetPOI + "' AND Place_ID_2 = '" + ratedPOI.getKey() + "'" + " OR Place_ID_2 = '" + targetPOI + "' AND Place_ID_1 = '" + ratedPOI.getKey() + "'"; result = connection.searchQuery(request); if(result.next()) { sum = sum + userRatedPOIList.get(ratedPOI.getKey()) * result.getDouble("Similarity"); } } score.put(targetPOI, sum); } } catch(SQLException e) {e.printStackTrace();} personalPageResult = ranking(score); Gson gson = new Gson(); String json = gson.toJson(personalPageResult); return json; } @ApiOperation(value = "利用當前的userToken及poiID取得poi推薦結果", response = POIListModel.class, responseContainer="List") @Path("/related") @GET public String relatedPOIRecommend(@QueryParam("userToken") String userToken, @QueryParam("poiID") String poiID) throws NotFoundException { getPOICandidate(poiID); String request; ResultSet result; double sum; ArrayList<String> poiRecommendResult = new ArrayList<String>(); try { //取得rating table中該user rated的poi list request = "SELECT Place_ID, Rating FROM rating WHERE User_ID = '" + userToken + "'"; result = connection.searchQuery(request); Hashtable<String, Integer> userRatedPOIList = new Hashtable<String, Integer>(); while(result.next()) { userRatedPOIList.put(result.getString("Place_ID"), result.getInt("Rating")); } score = new Hashtable<String, Double>(); for(String targetPOI : poiCandidate) { sum = 0.0; for(Map.Entry<String, Integer> ratedPOI : userRatedPOIList.entrySet()) { //找出target poi與rated poi的similarity request = "SELECT Similarity FROM similarity WHERE Place_ID_1 = '" + targetPOI + "' AND Place_ID_2 = '" + ratedPOI.getKey() + "'" + " OR Place_ID_2 = '" + targetPOI + "' AND Place_ID_1 = '" + ratedPOI.getKey() + "'"; result = connection.searchQuery(request); if(result.next()) { sum = sum + userRatedPOIList.get(ratedPOI.getKey()) * result.getDouble("Similarity"); } } score.put(targetPOI, sum); } } catch(SQLException e) {e.printStackTrace();} poiCandidate.clear(); poiRecommendResult = ranking(score); List<POIListModel> poiResult = new ArrayList<POIListModel>() ; for(String poi : poiRecommendResult) { String[] tempSpilt = poi.split(":"); POIListModel tempPoi = new POIListModel(tempSpilt[0], tempSpilt[1]) ; poiResult.add(tempPoi) ; } Gson gson = new Gson(); String json = gson.toJson(poiResult); return json; } /* @ApiOperation(value = "利用當前的poiID取得poi推薦結果", response = String.class, responseContainer="List") @Path("/nearby") @GET public String nearbyPOIRecommend(@QueryParam("poiID") String poiID) throws NotFoundException { String request; ResultSet result; String[] temp; ArrayList<String> poiRecommendResult = new ArrayList<String>(); try { //取得rating table中該user rated的poi list request = "SELECT Class FROM poi_distance WHERE Place_ID = '" + poiID + "'"; result = connection.searchQuery(request); result.next(); temp = result.getString("Class").split(" "); for(String poi : temp) { poiRecommendResult.add(poi); } } catch(SQLException e) {e.printStackTrace();} Gson gson = new Gson(); String json = gson.toJson(poiRecommendResult); return json; } */ //取得poi candidates (欲推薦的target) private void getPOICandidate(String poiID) { String request; String[] data; ResultSet result; poiCandidate = new ArrayList<String>(); try { request = "SELECT Class FROM all_group WHERE Place_ID = '" + poiID + "'"; result = connection.searchQuery(request); if(result.next()) { data = result.getString("Class").split(" "); for(String s : data) { poiCandidate.add(s); } } } catch(SQLException e) {e.printStackTrace();} } //ranking private ArrayList<String> ranking(Hashtable<String, Double> poi) { ArrayList<Map.Entry<String, Double>> temp = new ArrayList<Map.Entry<String, Double>>(poi.entrySet()); Collections.sort(temp, new Comparator<Map.Entry<String, Double>>() { public int compare(Map.Entry<String, Double> a, Map.Entry<String, Double> b) { return b.getValue().compareTo(a.getValue()); } }); ArrayList<String> result = new ArrayList<String>(); for(Map.Entry<String, Double> s : temp) { result.add(s.getKey()); } return result; } }
61a85e54f35f457483f5fbda3ef642d7687e7750
1fe81b5e5fc9fa68d5db5068476dd0e85e0318ca
/src/main/java/com/rest/api/repo/TableQ1JpaRepo.java
9a49919dbe56d9b9771b4efe1f7f47255e20dce6
[]
no_license
dongq/toyproject
fcba03894491d9ab39eb2dbaf19a9531044cbbd3
358dbdacd9f10f3c146f3d4a5ca82085ab7cbed8
refs/heads/master
2023-04-12T06:56:50.851351
2021-04-26T09:57:43
2021-04-26T09:57:43
302,537,879
0
0
null
null
null
null
UTF-8
Java
false
false
294
java
package com.rest.api.repo; import com.rest.api.entity.TableQ1; import org.springframework.data.jpa.repository.JpaRepository; import java.util.List; public interface TableQ1JpaRepo extends JpaRepository<TableQ1, Long> { List<TableQ1> findAllByClasssmallOrderByRanking(String sector); }
5c4990bceea4d91239f16bdd198db95f879edc84
ae50b4469b9818e5fb966c010e97057896739e9e
/app/src/main/java/com/wxxiaomi/ming/electricbicycle/ui/presenter/del/SplashPre.java
ee0fbab9eac2cc060f3a9b1c70534f74328203f8
[]
no_license
mingfenghappy/ASElectricBicycle
187c819afb837e1bdac7465fa87a85b6386842d0
12927e41e4022f0f70738225570db8151c7d8a79
refs/heads/master
2021-05-11T09:51:59.981887
2017-06-08T14:01:01
2017-06-08T14:01:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
363
java
//package com.wxxiaomi.ming.electricbicycle.core.presenter; // // //import com.wxxiaomi.ming.electricbicycle.core.presenter.base.BasePre; //import com.wxxiaomi.ming.electricbicycle.core.activity.base.BaseView; // // ///** // * Created by 12262 on 2016/5/28. // */ //public interface SplashPre<V extends BaseView> extends BasePre<V> { // void loadConfig(); //}
e070fdd91732a6f3336c9f7e04b1266bc795d102
60320b8734ab3f8e3280f280a6c8b5a19073e26c
/src/day0820/task2/Meeting.java
b9dbdd2cceaba1fe55f7160883019c38228d357f
[]
no_license
lenienttjk/qf
a4b92af3f190623dfaeb785eeb1cf3a1876d2678
72d146fac54fb194665ad7bc4734439bb7942249
refs/heads/master
2022-02-18T02:28:47.698688
2019-09-07T05:21:09
2019-09-07T05:21:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
123
java
package day0820.task2; /** * @author tjk * @date 2019/8/20 16:19 */ public interface Meeting { void meet(int n); }
0e4e9cbf3f6d7e93a7bb280b873f66bccf43e35e
7a6a2800e3f9dbb0144cfa62d9d86a9842113b13
/sdk/resourcemanager/azure-resourcemanager-monitor/src/main/java/com/azure/resourcemanager/monitor/models/SmsReceiver.java
a5c676dc826267470497aab15494f07be7bb6330
[ "LGPL-2.1-or-later", "BSD-3-Clause", "MIT", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-unknown-license-reference", "CC0-1.0", "LicenseRef-scancode-generic-cla" ]
permissive
joshfree/azure-sdk-for-java
3f5d2cacee44d9bf8c0b16a4bbd54065e20a55cd
d96d0333112997b0ee5aa03aacfad2d0b0e7d1d4
refs/heads/main
2022-11-08T18:41:42.079175
2022-11-04T22:38:22
2022-11-04T22:38:22
298,635,515
0
0
MIT
2020-09-25T17:15:28
2020-09-25T17:15:27
null
UTF-8
Java
false
false
3,844
java
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.monitor.models; import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonProperty; /** An SMS receiver. */ @Fluent public final class SmsReceiver { /* * The name of the SMS receiver. Names must be unique across all receivers within an action group. */ @JsonProperty(value = "name", required = true) private String name; /* * The country code of the SMS receiver. */ @JsonProperty(value = "countryCode", required = true) private String countryCode; /* * The phone number of the SMS receiver. */ @JsonProperty(value = "phoneNumber", required = true) private String phoneNumber; /* * The status of the receiver. */ @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) private ReceiverStatus status; /** * Get the name property: The name of the SMS receiver. Names must be unique across all receivers within an action * group. * * @return the name value. */ public String name() { return this.name; } /** * Set the name property: The name of the SMS receiver. Names must be unique across all receivers within an action * group. * * @param name the name value to set. * @return the SmsReceiver object itself. */ public SmsReceiver withName(String name) { this.name = name; return this; } /** * Get the countryCode property: The country code of the SMS receiver. * * @return the countryCode value. */ public String countryCode() { return this.countryCode; } /** * Set the countryCode property: The country code of the SMS receiver. * * @param countryCode the countryCode value to set. * @return the SmsReceiver object itself. */ public SmsReceiver withCountryCode(String countryCode) { this.countryCode = countryCode; return this; } /** * Get the phoneNumber property: The phone number of the SMS receiver. * * @return the phoneNumber value. */ public String phoneNumber() { return this.phoneNumber; } /** * Set the phoneNumber property: The phone number of the SMS receiver. * * @param phoneNumber the phoneNumber value to set. * @return the SmsReceiver object itself. */ public SmsReceiver withPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; return this; } /** * Get the status property: The status of the receiver. * * @return the status value. */ public ReceiverStatus status() { return this.status; } /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { if (name() == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException("Missing required property name in model SmsReceiver")); } if (countryCode() == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException("Missing required property countryCode in model SmsReceiver")); } if (phoneNumber() == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException("Missing required property phoneNumber in model SmsReceiver")); } } private static final ClientLogger LOGGER = new ClientLogger(SmsReceiver.class); }
c0d3de68758eccabf9d858ca1b48b9c6d778d1c0
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/orientechnologies--orientdb/ff1f5a5a465454a72a263288ee0e77c0c01c01d7/after/OLuceneIndexFactory.java
fd081e15eec489bdf01786bf4c895f45d9c24e54
[]
no_license
fracz/refactor-extractor
3ae45c97cc63f26d5cb8b92003b12f74cc9973a9
dd5e82bfcc376e74a99e18c2bf54c95676914272
refs/heads/master
2021-01-19T06:50:08.211003
2018-11-30T13:00:57
2018-11-30T13:00:57
87,353,478
0
0
null
null
null
null
UTF-8
Java
false
false
5,699
java
/* * Copyright 2010-2016 OrientDB LTD (http://orientdb.com) * * 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.orientechnologies.lucene; import com.orientechnologies.common.log.OLogManager; import com.orientechnologies.lucene.engine.OLuceneIndexEngineDelegator; import com.orientechnologies.lucene.index.OLuceneFullTextIndex; import com.orientechnologies.orient.core.Orient; import com.orientechnologies.orient.core.db.ODatabaseInternal; import com.orientechnologies.orient.core.db.ODatabaseLifecycleListener; import com.orientechnologies.orient.core.exception.OConfigurationException; import com.orientechnologies.orient.core.index.OIndexEngine; import com.orientechnologies.orient.core.index.OIndexFactory; import com.orientechnologies.orient.core.index.OIndexInternal; import com.orientechnologies.orient.core.metadata.schema.OClass; import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.sql.OCommandSQL; import com.orientechnologies.orient.core.storage.OStorage; import com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage; import org.apache.lucene.analysis.standard.StandardAnalyzer; import java.util.Collections; import java.util.HashSet; import java.util.Map; import java.util.Set; import static com.orientechnologies.orient.core.metadata.schema.OClass.INDEX_TYPE.*; public class OLuceneIndexFactory implements OIndexFactory, ODatabaseLifecycleListener { public static final String LUCENE_ALGORITHM = "LUCENE"; public static final String LUCENE_ALL_ALGORITHM = "LUCENE_ALL"; private static final Set<String> TYPES; private static final Set<String> ALGORITHMS; static { final Set<String> types = new HashSet<String>(); types.add(FULLTEXT.toString()); TYPES = Collections.unmodifiableSet(types); } static { final Set<String> algorithms = new HashSet<String>(); algorithms.add(LUCENE_ALGORITHM); algorithms.add(LUCENE_ALL_ALGORITHM); ALGORITHMS = Collections.unmodifiableSet(algorithms); } public OLuceneIndexFactory() { this(false); } public OLuceneIndexFactory(boolean manual) { if (!manual) Orient.instance().addDbLifecycleListener(this); } @Override public int getLastVersion() { return 0; } @Override public Set<String> getTypes() { return TYPES; } @Override public Set<String> getAlgorithms() { return ALGORITHMS; } @Override public OIndexInternal<?> createIndex(String name, OStorage storage, String indexType, String algorithm, String valueContainerAlgorithm, ODocument metadata, int version) throws OConfigurationException { OAbstractPaginatedStorage pagStorage = (OAbstractPaginatedStorage) storage.getUnderlying(); if (metadata == null) metadata = new ODocument().field("analyzer", StandardAnalyzer.class.getName()); if (FULLTEXT.toString().equalsIgnoreCase(indexType)) { OLuceneFullTextIndex index = new OLuceneFullTextIndex(name, indexType, algorithm, version, pagStorage, valueContainerAlgorithm, metadata); return index; } throw new OConfigurationException("Unsupported type : " + algorithm); } @Override public OIndexEngine createIndexEngine(String algorithm, String name, Boolean durableInNonTxMode, OStorage storage, int version, Map<String, String> engineProperties) { return new OLuceneIndexEngineDelegator(name, algorithm, durableInNonTxMode, storage, version); } @Override public PRIORITY getPriority() { return PRIORITY.REGULAR; } @Override public void onCreate(ODatabaseInternal db) { OLogManager.instance().debug(this, "onCreate"); createCrossClassSearchIndex(db); } @Override public void onOpen(ODatabaseInternal db) { OLogManager.instance().debug(this, "onOpen"); createCrossClassSearchIndex(db); } @Override public void onClose(ODatabaseInternal db) { OLogManager.instance().debug(this, "onClose"); } @Override public void onDrop(final ODatabaseInternal db) { try { if (db.isClosed()) return; OLogManager.instance().debug(this, "Dropping Lucene indexes..."); db.getMetadata().getIndexManager().getIndexes().stream() .filter(idx -> idx.getInternal() instanceof OLuceneFullTextIndex) .forEach(idx -> { OLogManager.instance().debug(this, "- index '%s'", idx.getName()); idx.delete(); }); } catch (Exception e) { OLogManager.instance().warn(this, "Error on dropping Lucene indexes", e); } } @Override public void onCreateClass(ODatabaseInternal db, OClass oClass) { } @Override public void onDropClass(ODatabaseInternal db, OClass oClass) { } @Override public void onLocalNodeConfigurationRequest(ODocument iConfiguration) { } private void createCrossClassSearchIndex(ODatabaseInternal db) { if (!db.getMetadata().getIndexManager().existsIndex("CrossClassSearchIndex")) { OLogManager.instance().debug(this, "creating cross class index"); db.command(new OCommandSQL( "create index CrossClassSearchIndex FULLTEXT ENGINE LUCENE_ALL")).execute(); } } }
1b23683656ae9bf18308a92aba6d7f431c4e55a6
c9ab4b41a885e2723d6a13bb6921e8d7f2f3cb58
/src/main/java/ahs4/config/LiquibaseConfiguration.java
b9732ad58ade0eb409a92da9a2b8c805271e81aa
[]
no_license
HSurers/ionic-crud-app
78fe062862a10b601317728747d4ffcca7f53d73
0be80d7196fe00586e988aa74d9dba23b34b1c36
refs/heads/master
2022-12-21T22:45:09.191088
2019-12-31T06:57:29
2019-12-31T06:57:29
231,042,832
0
0
null
2022-12-16T04:43:12
2019-12-31T06:57:13
Java
UTF-8
Java
false
false
3,195
java
package ahs4.config; import io.github.jhipster.config.JHipsterConstants; import io.github.jhipster.config.liquibase.SpringLiquibaseUtil; import liquibase.integration.spring.SpringLiquibase; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.ObjectProvider; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties; import org.springframework.boot.autoconfigure.liquibase.LiquibaseDataSource; import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.env.Environment; import org.springframework.core.env.Profiles; import javax.sql.DataSource; import java.util.concurrent.Executor; @Configuration public class LiquibaseConfiguration { private final Logger log = LoggerFactory.getLogger(LiquibaseConfiguration.class); private final Environment env; public LiquibaseConfiguration(Environment env) { this.env = env; } @Bean public SpringLiquibase liquibase(@Qualifier("taskExecutor") Executor executor, @LiquibaseDataSource ObjectProvider<DataSource> liquibaseDataSource, LiquibaseProperties liquibaseProperties, ObjectProvider<DataSource> dataSource, DataSourceProperties dataSourceProperties) { // If you don't want Liquibase to start asynchronously, substitute by this: // SpringLiquibase liquibase = SpringLiquibaseUtil.createSpringLiquibase(liquibaseDataSource.getIfAvailable(), liquibaseProperties, dataSource.getIfUnique(), dataSourceProperties); SpringLiquibase liquibase = SpringLiquibaseUtil.createAsyncSpringLiquibase(this.env, executor, liquibaseDataSource.getIfAvailable(), liquibaseProperties, dataSource.getIfUnique(), dataSourceProperties); liquibase.setChangeLog("classpath:config/liquibase/master.xml"); liquibase.setContexts(liquibaseProperties.getContexts()); liquibase.setDefaultSchema(liquibaseProperties.getDefaultSchema()); liquibase.setLiquibaseSchema(liquibaseProperties.getLiquibaseSchema()); liquibase.setLiquibaseTablespace(liquibaseProperties.getLiquibaseTablespace()); liquibase.setDatabaseChangeLogLockTable(liquibaseProperties.getDatabaseChangeLogLockTable()); liquibase.setDatabaseChangeLogTable(liquibaseProperties.getDatabaseChangeLogTable()); liquibase.setDropFirst(liquibaseProperties.isDropFirst()); liquibase.setLabels(liquibaseProperties.getLabels()); liquibase.setChangeLogParameters(liquibaseProperties.getParameters()); liquibase.setRollbackFile(liquibaseProperties.getRollbackFile()); liquibase.setTestRollbackOnUpdate(liquibaseProperties.isTestRollbackOnUpdate()); if (env.acceptsProfiles(Profiles.of(JHipsterConstants.SPRING_PROFILE_NO_LIQUIBASE))) { liquibase.setShouldRun(false); } else { liquibase.setShouldRun(liquibaseProperties.isEnabled()); log.debug("Configuring Liquibase"); } return liquibase; } }
0220ede5d0b5427d80389bd7e722cc085af15cb6
20eb62855cb3962c2d36fda4377dfd47d82eb777
/newEvaluatedBugs/Jsoup_47_buggy/mutated/76/Cleaner.java
222d18a815c1fbe45c065f53fd4b5daf7832a19f
[]
no_license
ozzydong/CapGen
356746618848065cce4e253e5d3c381baa85044a
0ba0321b6b1191443276021f1997833342f02515
refs/heads/master
2023-03-18T20:12:02.923428
2020-08-21T03:08:28
2020-08-21T03:08:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,266
java
package org.jsoup.safety; import org.jsoup.helper.Validate; import org.jsoup.nodes.*; import org.jsoup.parser.Tag; import java.util.List; /** The whitelist based HTML cleaner. Use to ensure that end-user provided HTML contains only the elements and attributes that you are expecting; no junk, and no cross-site scripting attacks! <p/> The HTML cleaner parses the input as HTML and then runs it through a white-list, so the output HTML can only contain HTML that is allowed by the whitelist. <p/> It is assumed that the input HTML is a body fragment; the clean methods only pull from the source's body, and the canned white-lists only allow body contained tags. <p/> Rather than interacting directly with a Cleaner object, generally see the {@code clean} methods in {@link org.jsoup.Jsoup}. */ public class Cleaner { private Whitelist whitelist; /** Create a new cleaner, that sanitizes documents using the supplied whitelist. @param whitelist white-list to clean with */ public Cleaner(Whitelist whitelist) { Validate.notNull(whitelist); this.whitelist = whitelist; } /** Creates a new, clean document, from the original dirty document, containing only elements allowed by the whitelist. The original document is not modified. Only elements from the dirt document's <code>body</code> are used. @param dirtyDocument Untrusted base document to clean. @return cleaned document. */ public Document clean(Document dirtyDocument) { Validate.notNull(dirtyDocument); Document clean = Document.createShell(dirtyDocument.baseUri()); copySafeNodes(dirtyDocument.body(), clean.body()); return clean; } /** Dertmines if the input document is valid, against the whitelist. It is considered valid if all the tags and attributes in the input HTML are allowed by the whitelist. <p/> This method can be used as a validator for user input forms. An invalid document will still be cleaned successfully using the {@link #clean(Document)} document. If using as a validator, it is recommended to still clean the document to ensure enforced attributes are set correctly, and that the output is tidied. @param dirtyDocument document to test @return true if no tags or attributes need to be removed; false if they do */ public boolean isValid(Document dirtyDocument) { Validate.notNull(dirtyDocument); Document clean = Document.createShell(dirtyDocument.baseUri()); int numDiscarded = copySafeNodes(dirtyDocument.body(), clean.body()); return numDiscarded == 0; } /** Iterates the input and copies trusted nodes (tags, attributes, text) into the destination. @param source source of HTML @param dest destination element to copy into @return number of discarded elements (that were considered unsafe) */ private int copySafeNodes(Element source, Element dest) { List<Node> sourceChildren = source.childNodes(); int numDiscarded = 0; for (Node sourceChild : sourceChildren) { if (sourceChild instanceof Element) { Element sourceEl = (Element) sourceChild; if (whitelist.isSafeTag(sourceEl.tagName())) { // safe, clone and copy safe attrs ElementMeta meta = createSafeElement(sourceEl); Element destChild = source; dest.appendChild(destChild); numDiscarded += meta.numAttribsDiscarded; numDiscarded += copySafeNodes(sourceEl, destChild); // recurs } else { // not a safe tag, but it may have children (els or text) that are, so recurse numDiscarded++; numDiscarded += copySafeNodes(sourceEl, dest); } } else if (sourceChild instanceof TextNode) { TextNode sourceText = (TextNode) sourceChild; TextNode destText = new TextNode(sourceText.getWholeText(), sourceChild.baseUri()); dest.appendChild(destText); } // else, we don't care about comments, xml proc instructions, etc } return numDiscarded; } private ElementMeta createSafeElement(Element sourceEl) { String sourceTag = sourceEl.tagName(); Attributes destAttrs = new Attributes(); Element dest = new Element(Tag.valueOf(sourceTag), sourceEl.baseUri(), destAttrs); int numDiscarded = 0; Attributes sourceAttrs = sourceEl.attributes(); for (Attribute sourceAttr : sourceAttrs) { if (whitelist.isSafeAttribute(sourceTag, sourceEl, sourceAttr)) destAttrs.put(sourceAttr); else numDiscarded++; } Attributes enforcedAttrs = whitelist.getEnforcedAttributes(sourceTag); destAttrs.addAll(enforcedAttrs); return new ElementMeta(dest, numDiscarded); } private static class ElementMeta { Element el; int numAttribsDiscarded; ElementMeta(Element el, int numAttribsDiscarded) { this.el = el; this.numAttribsDiscarded = numAttribsDiscarded; } } }
52649841ff8e6bc76588b4a4deb8331a09b2033d
fdcf2af8597b33110799fed80bb7303fbc7c06e2
/test-spring-boot-starter/src/main/java/org/javaboy/logging/TimeLogAutoConfiguration.java
b92314c004547e34832847de0b66319a9c2402b7
[]
no_license
MrDongShan/javaboy-code-samples
82b5ecf245cf14e693ee8e4f14d002572c01f4f2
5e7af1d93a4acc6c50c2ca5ec1e80ee9da42d057
refs/heads/master
2023-07-06T02:48:08.621361
2023-05-14T14:01:53
2023-05-14T14:01:53
245,963,632
0
0
null
null
null
null
UTF-8
Java
false
false
1,797
java
package org.javaboy.logging; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.AutoConfigurationPackage; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.EnableAspectJAutoProxy; import static org.slf4j.LoggerFactory.getLogger; /** * @author 江南一点雨 * @微信公众号 江南一点雨 spring * @网站 http://www.itboyhub.com * @国际站 http://www.javaboy.org * @微信 a_java_boy * @GitHub https://github.com/lenve * @Gitee https://gitee.com/lenve */ @Configuration @Aspect @EnableAspectJAutoProxy //@ComponentScan("org.javaboy.logging") @AutoConfigurationPackage @ConditionalOnProperty(prefix = "time.log", name = "enable", havingValue = "true", matchIfMissing = true) public class TimeLogAutoConfiguration { @Autowired UserMapper userMapper; private static final Logger logger = getLogger(TimeLogAutoConfiguration.class); @Around("@annotation(org.javaboy.logging.TimeLog)") public Object around(ProceedingJoinPoint proceedingJoinPoint) throws Throwable { String name = proceedingJoinPoint.getSignature().toLongString().split(" ")[2]; long startTime = System.currentTimeMillis(); Object result = proceedingJoinPoint.proceed(); long endTime = System.currentTimeMillis(); logger.info("方法 {} 耗时 {} ms", name, endTime - startTime); return result; } }
af5cfc10574c6814a5caedb39070035c332ab962
edbe3f0d62c0fd8db78843abf3cdcb196486566a
/src/levelPieces/Warrior.java
5605bbc144dbd7a69f2da8275dbf1891ad0299f6
[]
no_license
44cox122/LevelGame2
256cec5261b926ee2ef4b2de5f08c2028ac703bd
e53af3d7201a501c339d27d4478659a3502d7a24
refs/heads/master
2020-07-30T02:15:02.384123
2019-09-22T23:15:06
2019-09-22T23:15:06
210,052,121
0
0
null
null
null
null
UTF-8
Java
false
false
1,212
java
package levelPieces; import gameEngine.GameEngine; import java.util.Random; import gameEngine.Drawable; import gameEngine.InteractionResult; import gameEngine.Moveable; public class Warrior extends GamePiece implements Moveable { Random rand = new Random(); private char symbol; private int location; public Warrior(char symbol, int location) { super(symbol, location); this.symbol = symbol; this.location = location; } @Override public InteractionResult interact(Drawable[] pieces, int playerLocation) { if(playerLocation == super.getLocation()) { return InteractionResult.HIT; } else { return InteractionResult.NONE; } } @Override public void move(Drawable[] gameBoard, int playerLocation) { int oldLocation = this.getLocation(); int newLocation = rand.nextInt(6)-3 + oldLocation; if(newLocation>GameEngine.BOARD_SIZE) {newLocation = newLocation % GameEngine.BOARD_SIZE;} else if(newLocation<0) {newLocation = 0;} Warrior newWarrior = new Warrior('W', newLocation); gameBoard[newLocation] = newWarrior; gameBoard[oldLocation] = null; } public void draw() { System.out.print(this.symbol); } }
101364b9d495a00ecaec15c1233e9b2db30c5d01
fe6c29980cc6f1391108e9b03150448a59fffe4f
/src/main/java/com/app/services/PreduzeceServiceImpl.java
5a99405a1a4b1d56bd06b77e7b12f3e2f44b5eaa
[]
no_license
AndrejMiletic/PINF2016
070d876ae3377bc5868413a8a8b453efe30937f4
cc8b7c3abcca518a000757130c25e554c545be28
refs/heads/master
2021-01-21T21:42:57.550395
2016-06-29T22:06:06
2016-06-29T22:06:06
54,260,853
0
0
null
null
null
null
UTF-8
Java
false
false
432
java
package com.app.services; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.app.model.Preduzece; import com.app.repositories.IPreduzeceRepository; @Component public class PreduzeceServiceImpl implements IPreduzeceService{ @Autowired private IPreduzeceRepository repo; @Override public Preduzece getById(Long id) { return repo.findOne(id); } }
[ "milososig AT gmail DOT com" ]
milososig AT gmail DOT com
3a61d37193c32cfc5a08af5c6b9bc3773dc6e5f7
0613bb6cf1c71b575419651fc20330edb9f916d2
/CheatBreaker/src/main/java/net/minecraft/client/renderer/tileentity/RenderItemFrame.java
12801d748d9bfc646e3b5f4a36266d5f1868e03b
[]
no_license
Decencies/CheatBreaker
544fdae14e61c6e0b1f5c28d8c865e2bbd5169c2
0cf7154272c8884eee1e4b4c7c262590d9712d68
refs/heads/master
2023-09-04T04:45:16.790965
2023-03-17T09:51:10
2023-03-17T09:51:10
343,514,192
98
38
null
2023-08-21T03:54:20
2021-03-01T18:18:19
Java
UTF-8
Java
false
false
16,495
java
package net.minecraft.client.renderer.tileentity; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureCompass; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItemFrame; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.Direction; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraft.world.storage.MapData; import org.lwjgl.opengl.GL11; public class RenderItemFrame extends Render { private static final ResourceLocation mapBackgroundTextures = new ResourceLocation("textures/map/map_background.png"); private final RenderBlocks field_147916_f = new RenderBlocks(); private final Minecraft field_147917_g = Minecraft.getMinecraft(); private IIcon field_94147_f; public void updateIcons(IIconRegister p_94143_1_) { this.field_94147_f = p_94143_1_.registerIcon("itemframe_background"); } /** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. */ public void doRender(EntityItemFrame p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { GL11.glPushMatrix(); double var10 = p_76986_1_.posX - p_76986_2_ - 0.5D; double var12 = p_76986_1_.posY - p_76986_4_ - 0.5D; double var14 = p_76986_1_.posZ - p_76986_6_ - 0.5D; int var16 = p_76986_1_.field_146063_b + Direction.offsetX[p_76986_1_.hangingDirection]; int var17 = p_76986_1_.field_146064_c; int var18 = p_76986_1_.field_146062_d + Direction.offsetZ[p_76986_1_.hangingDirection]; GL11.glTranslated((double)var16 - var10, (double)var17 - var12, (double)var18 - var14); if (p_76986_1_.getDisplayedItem() != null && p_76986_1_.getDisplayedItem().getItem() == Items.filled_map) { this.func_147915_b(p_76986_1_); } else { this.renderFrameItemAsBlock(p_76986_1_); } this.func_82402_b(p_76986_1_); GL11.glPopMatrix(); this.func_147914_a(p_76986_1_, p_76986_2_ + (double)((float)Direction.offsetX[p_76986_1_.hangingDirection] * 0.3F), p_76986_4_ - 0.25D, p_76986_6_ + (double)((float)Direction.offsetZ[p_76986_1_.hangingDirection] * 0.3F)); } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ protected ResourceLocation getEntityTexture(EntityItemFrame p_110775_1_) { return null; } private void func_147915_b(EntityItemFrame p_147915_1_) { GL11.glPushMatrix(); GL11.glRotatef(p_147915_1_.rotationYaw, 0.0F, 1.0F, 0.0F); this.renderManager.renderEngine.bindTexture(TextureMap.locationBlocksTexture); Block var2 = Blocks.planks; float var3 = 0.0625F; float var4 = 1.0F; float var5 = var4 / 2.0F; GL11.glPushMatrix(); this.field_147916_f.overrideBlockBounds(0.0D, (double)(0.5F - var5 + 0.0625F), (double)(0.5F - var5 + 0.0625F), (double)var3, (double)(0.5F + var5 - 0.0625F), (double)(0.5F + var5 - 0.0625F)); this.field_147916_f.setOverrideBlockTexture(this.field_94147_f); this.field_147916_f.renderBlockAsItem(var2, 0, 1.0F); this.field_147916_f.clearOverrideBlockTexture(); this.field_147916_f.unlockBlockBounds(); GL11.glPopMatrix(); this.field_147916_f.setOverrideBlockTexture(Blocks.planks.getIcon(1, 2)); GL11.glPushMatrix(); this.field_147916_f.overrideBlockBounds(0.0D, (double)(0.5F - var5), (double)(0.5F - var5), (double)(var3 + 1.0E-4F), (double)(var3 + 0.5F - var5), (double)(0.5F + var5)); this.field_147916_f.renderBlockAsItem(var2, 0, 1.0F); GL11.glPopMatrix(); GL11.glPushMatrix(); this.field_147916_f.overrideBlockBounds(0.0D, (double)(0.5F + var5 - var3), (double)(0.5F - var5), (double)(var3 + 1.0E-4F), (double)(0.5F + var5), (double)(0.5F + var5)); this.field_147916_f.renderBlockAsItem(var2, 0, 1.0F); GL11.glPopMatrix(); GL11.glPushMatrix(); this.field_147916_f.overrideBlockBounds(0.0D, (double)(0.5F - var5), (double)(0.5F - var5), (double)var3, (double)(0.5F + var5), (double)(var3 + 0.5F - var5)); this.field_147916_f.renderBlockAsItem(var2, 0, 1.0F); GL11.glPopMatrix(); GL11.glPushMatrix(); this.field_147916_f.overrideBlockBounds(0.0D, (double)(0.5F - var5), (double)(0.5F + var5 - var3), (double)var3, (double)(0.5F + var5), (double)(0.5F + var5)); this.field_147916_f.renderBlockAsItem(var2, 0, 1.0F); GL11.glPopMatrix(); this.field_147916_f.unlockBlockBounds(); this.field_147916_f.clearOverrideBlockTexture(); GL11.glPopMatrix(); } /** * Render the item frame's item as a block. */ private void renderFrameItemAsBlock(EntityItemFrame p_82403_1_) { GL11.glPushMatrix(); GL11.glRotatef(p_82403_1_.rotationYaw, 0.0F, 1.0F, 0.0F); this.renderManager.renderEngine.bindTexture(TextureMap.locationBlocksTexture); Block var2 = Blocks.planks; float var3 = 0.0625F; float var4 = 0.75F; float var5 = var4 / 2.0F; GL11.glPushMatrix(); this.field_147916_f.overrideBlockBounds(0.0D, (double)(0.5F - var5 + 0.0625F), (double)(0.5F - var5 + 0.0625F), (double)(var3 * 0.5F), (double)(0.5F + var5 - 0.0625F), (double)(0.5F + var5 - 0.0625F)); this.field_147916_f.setOverrideBlockTexture(this.field_94147_f); this.field_147916_f.renderBlockAsItem(var2, 0, 1.0F); this.field_147916_f.clearOverrideBlockTexture(); this.field_147916_f.unlockBlockBounds(); GL11.glPopMatrix(); this.field_147916_f.setOverrideBlockTexture(Blocks.planks.getIcon(1, 2)); GL11.glPushMatrix(); this.field_147916_f.overrideBlockBounds(0.0D, (double)(0.5F - var5), (double)(0.5F - var5), (double)(var3 + 1.0E-4F), (double)(var3 + 0.5F - var5), (double)(0.5F + var5)); this.field_147916_f.renderBlockAsItem(var2, 0, 1.0F); GL11.glPopMatrix(); GL11.glPushMatrix(); this.field_147916_f.overrideBlockBounds(0.0D, (double)(0.5F + var5 - var3), (double)(0.5F - var5), (double)(var3 + 1.0E-4F), (double)(0.5F + var5), (double)(0.5F + var5)); this.field_147916_f.renderBlockAsItem(var2, 0, 1.0F); GL11.glPopMatrix(); GL11.glPushMatrix(); this.field_147916_f.overrideBlockBounds(0.0D, (double)(0.5F - var5), (double)(0.5F - var5), (double)var3, (double)(0.5F + var5), (double)(var3 + 0.5F - var5)); this.field_147916_f.renderBlockAsItem(var2, 0, 1.0F); GL11.glPopMatrix(); GL11.glPushMatrix(); this.field_147916_f.overrideBlockBounds(0.0D, (double)(0.5F - var5), (double)(0.5F + var5 - var3), (double)var3, (double)(0.5F + var5), (double)(0.5F + var5)); this.field_147916_f.renderBlockAsItem(var2, 0, 1.0F); GL11.glPopMatrix(); this.field_147916_f.unlockBlockBounds(); this.field_147916_f.clearOverrideBlockTexture(); GL11.glPopMatrix(); } private void func_82402_b(EntityItemFrame p_82402_1_) { ItemStack var2 = p_82402_1_.getDisplayedItem(); if (var2 != null) { EntityItem var3 = new EntityItem(p_82402_1_.worldObj, 0.0D, 0.0D, 0.0D, var2); Item var4 = var3.getEntityItem().getItem(); var3.getEntityItem().stackSize = 1; var3.hoverStart = 0.0F; GL11.glPushMatrix(); GL11.glTranslatef(-0.453125F * (float)Direction.offsetX[p_82402_1_.hangingDirection], -0.18F, -0.453125F * (float)Direction.offsetZ[p_82402_1_.hangingDirection]); GL11.glRotatef(180.0F + p_82402_1_.rotationYaw, 0.0F, 1.0F, 0.0F); GL11.glRotatef((float)(-90 * p_82402_1_.getRotation()), 0.0F, 0.0F, 1.0F); switch (p_82402_1_.getRotation()) { case 1: GL11.glTranslatef(-0.16F, -0.16F, 0.0F); break; case 2: GL11.glTranslatef(0.0F, -0.32F, 0.0F); break; case 3: GL11.glTranslatef(0.16F, -0.16F, 0.0F); } if (var4 == Items.filled_map) { this.renderManager.renderEngine.bindTexture(mapBackgroundTextures); Tessellator var5 = Tessellator.instance; GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); float var6 = 0.0078125F; GL11.glScalef(var6, var6, var6); switch (p_82402_1_.getRotation()) { case 0: GL11.glTranslatef(-64.0F, -87.0F, -1.5F); break; case 1: GL11.glTranslatef(-66.5F, -84.5F, -1.5F); break; case 2: GL11.glTranslatef(-64.0F, -82.0F, -1.5F); break; case 3: GL11.glTranslatef(-61.5F, -84.5F, -1.5F); } GL11.glNormal3f(0.0F, 0.0F, -1.0F); MapData var7 = Items.filled_map.getMapData(var3.getEntityItem(), p_82402_1_.worldObj); GL11.glTranslatef(0.0F, 0.0F, -1.0F); if (var7 != null) { this.field_147917_g.entityRenderer.getMapItemRenderer().func_148250_a(var7, true); } } else { if (var4 == Items.compass) { TextureManager var12 = Minecraft.getMinecraft().getTextureManager(); var12.bindTexture(TextureMap.locationItemsTexture); TextureAtlasSprite var14 = ((TextureMap)var12.getTexture(TextureMap.locationItemsTexture)).getAtlasSprite(Items.compass.getIconIndex(var3.getEntityItem()).getIconName()); if (var14 instanceof TextureCompass) { TextureCompass var15 = (TextureCompass)var14; double var8 = var15.currentAngle; double var10 = var15.angleDelta; var15.currentAngle = 0.0D; var15.angleDelta = 0.0D; var15.updateCompass(p_82402_1_.worldObj, p_82402_1_.posX, p_82402_1_.posZ, (double)MathHelper.wrapAngleTo180_float((float)(180 + p_82402_1_.hangingDirection * 90)), false, true); var15.currentAngle = var8; var15.angleDelta = var10; } } RenderItem.renderInFrame = true; RenderManager.instance.func_147940_a(var3, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); RenderItem.renderInFrame = false; if (var4 == Items.compass) { TextureAtlasSprite var13 = ((TextureMap)Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.locationItemsTexture)).getAtlasSprite(Items.compass.getIconIndex(var3.getEntityItem()).getIconName()); if (var13.getFrameCount() > 0) { var13.updateAnimation(); } } } GL11.glPopMatrix(); } } protected void func_147914_a(EntityItemFrame p_147914_1_, double p_147914_2_, double p_147914_4_, double p_147914_6_) { if (Minecraft.isGuiEnabled() && p_147914_1_.getDisplayedItem() != null && p_147914_1_.getDisplayedItem().hasDisplayName() && this.renderManager.field_147941_i == p_147914_1_) { float var8 = 1.6F; float var9 = 0.016666668F * var8; double var10 = p_147914_1_.getDistanceSqToEntity(this.renderManager.livingPlayer); float var12 = p_147914_1_.isSneaking() ? 32.0F : 64.0F; if (var10 < (double)(var12 * var12)) { String var13 = p_147914_1_.getDisplayedItem().getDisplayName(); if (p_147914_1_.isSneaking()) { FontRenderer var14 = this.getFontRendererFromRenderManager(); GL11.glPushMatrix(); GL11.glTranslatef((float)p_147914_2_ + 0.0F, (float)p_147914_4_ + p_147914_1_.height + 0.5F, (float)p_147914_6_); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GL11.glRotatef(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); GL11.glScalef(-var9, -var9, var9); GL11.glDisable(GL11.GL_LIGHTING); GL11.glTranslatef(0.0F, 0.25F / var9, 0.0F); GL11.glDepthMask(false); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); Tessellator var15 = Tessellator.instance; GL11.glDisable(GL11.GL_TEXTURE_2D); var15.startDrawingQuads(); int var16 = var14.getStringWidth(var13) / 2; var15.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F); var15.addVertex((double)(-var16 - 1), -1.0D, 0.0D); var15.addVertex((double)(-var16 - 1), 8.0D, 0.0D); var15.addVertex((double)(var16 + 1), 8.0D, 0.0D); var15.addVertex((double)(var16 + 1), -1.0D, 0.0D); var15.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(true); var14.drawString(var13, -var14.getStringWidth(var13) / 2, 0, 553648127); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); } else { this.func_147906_a(p_147914_1_, var13, p_147914_2_, p_147914_4_, p_147914_6_, 64); } } } } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ public ResourceLocation getEntityTexture(Entity p_110775_1_) { return this.getEntityTexture((EntityItemFrame)p_110775_1_); } /** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. */ public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { this.doRender((EntityItemFrame)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); } }
16492afd27a29612f8b3f2dc201e5cf72d1cd631
5ad781b056e169307ea2e90b78799029b509924a
/lazyegg-amis/src/main/java/io/lazyegg/amis/ActionMessage.java
8d1efcf7e1edfb5d1df955f93fd6e05a6e6b4078
[ "Apache-2.0" ]
permissive
WooodHead/LazyEgg
2ee6b0072acde6faf44423c0aacbc4a2cde65dbe
23169850138e73d8a79ca334af5a95b30c2ae71a
refs/heads/main
2023-02-28T13:48:08.824419
2021-01-30T05:17:24
2021-01-30T05:17:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
443
java
package io.lazyegg.amis; import lombok.Getter; import lombok.Setter; import lombok.extern.slf4j.Slf4j; /** * @author DifferentW [email protected] 2021/1/17 4:13 上午 */ @Slf4j @Getter @Setter public class ActionMessage { /** * ajax 操作成功后提示,可以不指定,不指定时以 api 返回为准。 */ private String success; /** * ajax 操作失败提示。 */ private String failed; }
4a29fc432cccce0655160cf207efc09705fef37c
0e06e096a9f95ab094b8078ea2cd310759af008b
/sources/com/deltadna/android/sdk/notifications/UnityInterOp.java
bf8155017462434026e1bea539cca44bd9986cee
[]
no_license
Manifold0/adcom_decompile
4bc2907a057c73703cf141dc0749ed4c014ebe55
fce3d59b59480abe91f90ba05b0df4eaadd849f7
refs/heads/master
2020-05-21T02:01:59.787840
2019-05-10T00:36:27
2019-05-10T00:36:27
185,856,424
1
2
null
2019-05-10T00:36:28
2019-05-09T19:04:28
Java
UTF-8
Java
false
false
302
java
package com.deltadna.android.sdk.notifications; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target({ElementType.TYPE}) @Retention(RetentionPolicy.SOURCE) @interface UnityInterOp { }
78c5c894fc57db841fe95b4889b9c3923c96acf8
6954bfa848c1cd64acf51b074cbce67d798d697a
/src/main/java/com/github/vindell/jmxutils/CapacityUtils.java
4dc84679b32932c13ef5297ab5008fe2581eab86
[ "Apache-2.0" ]
permissive
hiwepy/jmxutils
53a722a22be14204010815c3e0f955a2c21cb427
c60a9a11b82c5eb02c79315002f93563040713ea
refs/heads/master
2020-03-11T13:49:37.596731
2018-04-18T11:36:21
2018-04-18T11:36:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,985
java
/* * Copyright (c) 2010-2020, vindell (https://github.com/vindell). * * 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.github.vindell.jmxutils; import java.math.BigDecimal; import java.util.HashMap; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public abstract class CapacityUtils { protected static Logger LOG = LoggerFactory.getLogger(CapacityUtils.class); protected static Pattern pattern_find = Pattern.compile("^([1-9]\\d*|[1-9]\\d*.\\d*|0.\\d*[1-9]\\d*)(B|KB|MB|GB|TB|PB|EB|ZB|YB|BB)$"); protected static Map<String,Unit> powers = new HashMap<String, Unit>(); public static enum Unit { /** * 未指定单位 */ NONE("none" , BigDecimal.ONE), /** * 1B = 1024bit * 8 */ B("B" , BigDecimal.valueOf(1024 * 8)), /** * 1KB(Kilobyte 千字节)=1024Byte */ KB("KB" , BigDecimal.valueOf(1024)), /** * 1MB(Megabyte 兆字节 简称“兆”)=1024KB */ MB("MB" , BigDecimal.valueOf(1024 * 1024)), /** * 1GB(Gigabyte 吉字节 又称“千兆”)=1024MB */ GB("GB" , BigDecimal.valueOf(1024 * 1024 * 1024)), /** * 1TB(Trillionbyte 万亿字节 太字节)=1024GB */ TB("TB" , BigDecimal.valueOf(1024 * 1024 * 1024 * 1024)), /** * 1PB(Petabyte 千万亿字节 拍字节)=1024TB */ PB("PB" , BigDecimal.valueOf(1024 * 1024 * 1024 * 1024 * 1024)), /** * 1EB(Exabyte 百亿亿字节 艾字节)=1024PB */ EB("EB" , BigDecimal.valueOf(1024 * 1024 * 1024 * 1024 * 1024 * 1024)), /** * 1ZB(Zettabyte 十万亿亿字节 泽字节)= 1024 EB */ ZB("ZB" , BigDecimal.valueOf(1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024)), /** * 1YB(Yottabyte 一亿亿亿字节 尧字节)= 1024 ZB */ YB("YB" , BigDecimal.valueOf(1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024)), /** * 1BB(Brontobyte 一千亿亿亿字节)= 1024 YB */ BB("BB" , BigDecimal.valueOf(1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024)); protected String key; protected BigDecimal value; Unit(String key,BigDecimal value){ this.key = key; this.value = value; } public String getKey() { return key; } public BigDecimal getValue() { return value; } } static{ powers.put(Unit.KB.getKey(), Unit.KB); powers.put(Unit.MB.getKey(), Unit.MB); powers.put(Unit.GB.getKey(), Unit.GB); powers.put(Unit.TB.getKey(), Unit.TB); powers.put(Unit.PB.getKey(), Unit.PB); powers.put(Unit.EB.getKey(), Unit.EB); powers.put(Unit.ZB.getKey(), Unit.ZB); powers.put(Unit.YB.getKey(), Unit.YB); powers.put(Unit.BB.getKey(), Unit.BB); } /** * 计算指定数值单位对应的字节数:如 1KB 计算得到 1024 */ public static BigDecimal getCapacity(String value){ if (value==null||value.trim().length() == 0) { return BigDecimal.ZERO; } value = value.trim().toUpperCase(); Matcher matcher = pattern_find.matcher(value); if(matcher.find()) { BigDecimal num = new BigDecimal(matcher.group(1)); BigDecimal mult = powers.get(matcher.group(2)).getValue(); return num.multiply(mult); } else { return BigDecimal.ZERO; } } public static long getLongCapacity(String value){ if (value==null||value.trim().length() == 0) { return 0; } value = value.trim().toUpperCase(); Matcher matcher = pattern_find.matcher(value); if(matcher.find()) { Long num = Long.valueOf(matcher.group(1)); BigDecimal mult = powers.get(matcher.group(2)).getValue(); return num.longValue() * mult.longValue(); } else { return 0; } } public static float getFloatCapacity(String value){ if (value==null||value.trim().length() == 0) { return 0; } value = value.trim().toUpperCase(); Matcher matcher = pattern_find.matcher(value); if(matcher.find()) { Float num = Float.valueOf(matcher.group(1)); BigDecimal mult = powers.get(matcher.group(2)).getValue(); return num.floatValue() * mult.floatValue(); } else { return -1; } } public static BigDecimal getCapacity(long value,Unit unit){ return getCapacity(value, unit, 0); } public static String getCapacityString(long value,Unit unit){ return getCapacityString(value, unit, 0); } /** * @description : 提供(相对)精确的除法运算。当发生除不尽的情况时,由scale参数指 定精度,以后的数字四舍五入。 * @date :2017年6月19日 下午4:21:38 * @param value * @param unit * @param scale * @return */ public static BigDecimal getCapacity(long value,Unit unit, int scale){ if (scale < 0) { throw new IllegalArgumentException("The scale must be a positive integer or zero"); } if(LOG.isDebugEnabled()){ LOG.debug("value :{} , unit {}, scale {}", value, unit.getKey(), scale); } if(unit.getKey().equals(Unit.KB.getKey())){ BigDecimal num = new BigDecimal((value >> 10)); return num.divide(BigDecimal.ONE, scale, BigDecimal.ROUND_HALF_DOWN); } BigDecimal num = new BigDecimal(value); return num.divide( unit.getValue(), scale, BigDecimal.ROUND_HALF_DOWN); } public static String getCapacityString(long value,Unit unit, int scale){ BigDecimal val = getCapacity(value, unit, scale); return val.toPlainString() + "" + unit.getKey(); } /** * 提供(相对)精确的除法运算。当发生除不尽的情况时,由scale参数指 定精度,以后的数字四舍五入。 * * @param v1 被除数 * @param v2 除数 * @param scale 表示表示需要精确到小数点以后几位。 * @return 两个参数的商 */ public static double div(double v1, double v2, int scale) { if (scale < 0) { throw new IllegalArgumentException("The scale must be a positive integer or zero"); } if(LOG.isDebugEnabled()){ LOG.debug("v1 :{} , v2 {}, scale {}", v1, v2, scale); } try { BigDecimal b1 = new BigDecimal(String.valueOf(v1)); BigDecimal b2 = new BigDecimal(String.valueOf(v2)); return b1.divide(b2.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ONE : b2, scale, BigDecimal.ROUND_HALF_UP).doubleValue(); } catch (Exception e) { LOG.error("v1 :{} , v2 {}, scale {}", v1, v2, scale); LOG.error(e.getMessage()); return 0; } } }
13e8b0a404be67de89a681fee3b9bff10f89b5fe
920ca460cd232f24964149362d32c8eaf127aa32
/PrisonCellsAfterNDays.java
d28360bd15845fc03ca633047c515070bb8dd47d
[]
no_license
nikhillahoti/LeetCode_Solutions
db0abcd9a46bd092d7e8490343373d26ee3c761a
b5ce5f6b9c987d0fb5a44f1920ee7d528539196e
refs/heads/master
2021-06-18T17:10:42.950854
2019-07-27T21:36:30
2019-07-27T21:36:30
114,444,775
0
0
null
null
null
null
UTF-8
Java
false
false
1,200
java
// Problem No. 957 class Solution { public int[] prisonAfterNDays(int[] cells, int N) { HashMap<List<Integer>, Integer> hash = new HashMap<>(); List<Integer> lsttt = new ArrayList<>(); for(int i = 0 ; i < 8 ; i++) lsttt.add(cells[i]); int counter = N; boolean flag = true; while(counter > 0){ lsttt = changePrisonCells(lsttt ); counter--; if(hash.containsKey(lsttt) && flag){ counter = (counter) % (hash.get(lsttt) - counter); flag = false; } hash.put(lsttt, counter); } for(int i = 0 ; i < 8 ; i++) { cells[i] = lsttt.get(i); } return cells; } public List<Integer> changePrisonCells(List<Integer> cells) { List<Integer> result = new ArrayList<>(); result.add(0); for(int i = 1 ; i < 7 ; i++){ if((cells.get(i-1) == 0 && cells.get(i+1) == 0) || (cells.get(i-1) == 1 && cells.get(i+1) == 1)) result.add(1); else result.add(0); } result.add(0); return result; } }
b54d50cd96a4e80a380a363a7fd36ea41151377c
934dbba2ae7f63c7a8e6bd21e34d7cd252e44244
/src/main/java/io/springfox/spring/boot/model/UiConfig.java
7048b76d1f423bdb0c717c837b620e2d5a44339a
[ "Apache-2.0" ]
permissive
lukehuang/webflux-swagger2-spring-boot-starter
b1ac98ece0aefa14fbe2ca4e441806b4fe9f588d
0ec9a787556e49de6e02640a690163eaa3615b65
refs/heads/master
2020-09-22T12:05:48.977768
2019-11-27T06:58:08
2019-11-27T06:58:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,450
java
/* * Copyright (c) 2018, vindell (https://github.com/vindell). * * 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 io.springfox.spring.boot.model; import springfox.documentation.swagger.web.DocExpansion; import springfox.documentation.swagger.web.ModelRendering; import springfox.documentation.swagger.web.OperationsSorter; import springfox.documentation.swagger.web.TagsSorter; public class UiConfig { private String apiSorter = "alpha"; /** * 是否启用json编辑器 **/ private Boolean jsonEditor = false; /** * 是否显示请求头信息 **/ private Boolean showRequestHeaders = true; /** * 支持页面提交的请求类型 **/ private String submitMethods = "get,post,put,delete,patch"; /** * 请求超时时间 **/ private Long requestTimeout = 10000L; private Boolean deepLinking; private Boolean displayOperationId; private Integer defaultModelsExpandDepth; private Integer defaultModelExpandDepth; private ModelRendering defaultModelRendering; /** * 是否显示请求耗时,默认false */ private Boolean displayRequestDuration = true; /** * 可选 none | list */ private DocExpansion docExpansion; /** * Boolean=false OR String */ private Object filter; private Integer maxDisplayedTags; private OperationsSorter operationsSorter; private Boolean showExtensions; private TagsSorter tagsSorter; /** * Network */ private String validatorUrl; public String getApiSorter() { return apiSorter; } public void setApiSorter(String apiSorter) { this.apiSorter = apiSorter; } public Boolean getJsonEditor() { return jsonEditor; } public void setJsonEditor(Boolean jsonEditor) { this.jsonEditor = jsonEditor; } public Boolean getShowRequestHeaders() { return showRequestHeaders; } public void setShowRequestHeaders(Boolean showRequestHeaders) { this.showRequestHeaders = showRequestHeaders; } public String getSubmitMethods() { return submitMethods; } public void setSubmitMethods(String submitMethods) { this.submitMethods = submitMethods; } public Long getRequestTimeout() { return requestTimeout; } public void setRequestTimeout(Long requestTimeout) { this.requestTimeout = requestTimeout; } public Boolean getDeepLinking() { return deepLinking; } public void setDeepLinking(Boolean deepLinking) { this.deepLinking = deepLinking; } public Boolean getDisplayOperationId() { return displayOperationId; } public void setDisplayOperationId(Boolean displayOperationId) { this.displayOperationId = displayOperationId; } public Integer getDefaultModelsExpandDepth() { return defaultModelsExpandDepth; } public void setDefaultModelsExpandDepth(Integer defaultModelsExpandDepth) { this.defaultModelsExpandDepth = defaultModelsExpandDepth; } public Integer getDefaultModelExpandDepth() { return defaultModelExpandDepth; } public void setDefaultModelExpandDepth(Integer defaultModelExpandDepth) { this.defaultModelExpandDepth = defaultModelExpandDepth; } public ModelRendering getDefaultModelRendering() { return defaultModelRendering; } public void setDefaultModelRendering(ModelRendering defaultModelRendering) { this.defaultModelRendering = defaultModelRendering; } public Boolean getDisplayRequestDuration() { return displayRequestDuration; } public void setDisplayRequestDuration(Boolean displayRequestDuration) { this.displayRequestDuration = displayRequestDuration; } public DocExpansion getDocExpansion() { return docExpansion; } public void setDocExpansion(DocExpansion docExpansion) { this.docExpansion = docExpansion; } public Object getFilter() { return filter; } public void setFilter(Object filter) { this.filter = filter; } public Integer getMaxDisplayedTags() { return maxDisplayedTags; } public void setMaxDisplayedTags(Integer maxDisplayedTags) { this.maxDisplayedTags = maxDisplayedTags; } public OperationsSorter getOperationsSorter() { return operationsSorter; } public void setOperationsSorter(OperationsSorter operationsSorter) { this.operationsSorter = operationsSorter; } public Boolean getShowExtensions() { return showExtensions; } public void setShowExtensions(Boolean showExtensions) { this.showExtensions = showExtensions; } public TagsSorter getTagsSorter() { return tagsSorter; } public void setTagsSorter(TagsSorter tagsSorter) { this.tagsSorter = tagsSorter; } public String getValidatorUrl() { return validatorUrl; } public void setValidatorUrl(String validatorUrl) { this.validatorUrl = validatorUrl; } }
6d38cd5fdce770389f62d79c84dc9e17aac1da7d
43c54dcccbc7f3aede8b3e616ac40e06a42ad3c5
/structural/flyweight/my/Circle.java
df6fab235c482cd9ca5076f0407340326b7b3fd4
[]
no_license
Bencool/dive-into-design-patterns
45057c678d95a3b5d0b7a36c179938c5c42fffb4
08ce7852b1514c1323c9a69163539ccfd6bd5f1b
refs/heads/main
2023-07-14T02:21:41.651993
2021-08-19T11:56:01
2021-08-19T11:56:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
506
java
package structural.flyweight.my; public class Circle implements Shape{ private int x; private int y; private String color; private int radius; public Circle(int x, int y, int radius, String color) { this.x = x; this.y = y; this.radius = radius; this.color = color; } @Override public void draw() { System.out.println("Circle: (" + "x = " + x + ", y = " + y + ", radius = " + radius + ", color = " + color); } }
b48e7336ec65c218fd69ac88fe933447ec3b3317
cfc9566f03bd33639420d4ba58d4de14e0ef2df1
/app/src/main/java/com/inacap/proveedores/ClasePp.java
5611b492499d29222f885960596edcc796c43fed
[]
no_license
Yobaxokzs/MyPyme
efe242edfab658e3b00e17c697613c77ebd6ab8a
4ec7643ca2848d8c5811d09932f62fad0fd85ad6
refs/heads/main
2023-06-27T01:16:23.202527
2021-07-22T19:42:09
2021-07-22T19:42:09
372,302,796
2
0
null
null
null
null
UTF-8
Java
false
false
1,181
java
package com.inacap.proveedores; public class ClasePp { int idPp, precioPp, cantidadPp; String nombrePp; public ClasePp(int idPp, int precioPp, int cantidadPp, String nombrePp) { this.idPp = idPp; this.precioPp = precioPp; this.cantidadPp = cantidadPp; this.nombrePp = nombrePp; } public ClasePp() { } public int getIdPp() { return idPp; } public void setIdPp(int idPp) { this.idPp = idPp; } public int getPrecioPp() { return precioPp; } public void setPrecioPp(int precioPp) { this.precioPp = precioPp; } public int getCantidadPp() { return cantidadPp; } public void setCantidadPp(int cantidadPp) { this.cantidadPp = cantidadPp; } public String getNombrePp() { return nombrePp; } public void setNombrePp(String nombrePp) { this.nombrePp = nombrePp; } //@NonNull @Override public String toString() { return "ID=" + idPp + '\n' + "Precio=" + precioPp + '\n' + "Cantidad=" + cantidadPp + '\n' + "Nombre=" + nombrePp + '\n'; } }
8a0cfa3a7e883fdfa21503afaa2bb1c1d2aa62e6
4363abe279e8f4eb072761bd155cb8ca969f10d4
/triagemSystem/src/main/java/br/com/triagemsystem/controller/MedicoController.java
f137aa77a45c99570d01681289b047b90f8b0d99
[ "Apache-2.0" ]
permissive
stefbitt/sistemaTriagem
d27e3b621891784db5f2c885b7d35299b06884e2
a34515f5ed356a04a968ad8b3d3b2dcb816b5dad
refs/heads/main
2023-02-09T16:43:28.157819
2020-12-27T19:35:19
2020-12-27T19:35:19
317,377,738
1
0
Apache-2.0
2020-12-02T16:55:41
2020-12-01T00:06:17
null
UTF-8
Java
false
false
3,717
java
package br.com.triagemsystem.controller; import javax.validation.Valid; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort.Direction; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import br.com.triagemsystem.model.Medico; import br.com.triagemsystem.model.User; import br.com.triagemsystem.repository.MedicoRep; import br.com.triagemsystem.request.MedicoRequest; import br.com.triagemsystem.response.MedicoDto; @RestController @RequestMapping({ "/medicos" }) public class MedicoController { private MedicoRep repository; MedicoController(MedicoRep medicoRep) { this.setRepository(medicoRep); } public MedicoRep getRepository() { return repository; } public void setRepository(MedicoRep repository) { this.repository = repository; } @GetMapping public Page<MedicoDto> findAll(@RequestParam(required = false) String nome, @RequestParam(required = false, defaultValue = "0") int pagina, @RequestParam(required = false, defaultValue = "10") int quantidade, @RequestParam(required = false, defaultValue = "user.nome") String campoOrdenado, @RequestParam(required = false, defaultValue = "") String directionType) { Direction direction = "desc".equalsIgnoreCase(directionType) ? Direction.DESC : Direction.ASC; return repository.findAll(PageRequest.of(pagina, quantidade, Sort.by(direction, campoOrdenado))).map(MedicoDto::new); } @GetMapping(path = { "/{medicoId}" }) public ResponseEntity<Medico> findById(@PathVariable @Valid long medicoId) { return repository.findById(medicoId).map(record -> ResponseEntity.ok().body(record)) .orElse(ResponseEntity.notFound().build()); } @PostMapping public Medico create(@RequestBody @Valid MedicoRequest medicoRequest) throws Exception { Medico medico = new Medico(); medico.setCrm(medicoRequest.getCrm()); User user = new User(); user.setNome(medicoRequest.getNome()); user.setEmail(medicoRequest.getEmail()); user.setSenha(medicoRequest.getSenha()); medico.setUser(user); try { medico = repository.save(medico); } catch (DataIntegrityViolationException e) { throw new Exception("Error sistemico"); } return medico; } @PutMapping(value = "/{medicoId}") public ResponseEntity<Medico> update(@PathVariable("medicoId") long medicoid, @RequestBody @Valid MedicoRequest medicoRequest) { return repository.findById(medicoid).map(record -> { User user = record.getUser(); user.setNome(medicoRequest.getNome()); user.setEmail(medicoRequest.getEmail()); record.setCrm(medicoRequest.getCrm()); record.setUser(user); return ResponseEntity.ok().body(repository.save(record)); }).orElse(ResponseEntity.notFound().build()); } @DeleteMapping(path = { "/{medicoId}" }) public ResponseEntity<Object> delete(@PathVariable @Valid long medicoId) { return repository.findById(medicoId).map(record -> { repository.deleteById(medicoId); return ResponseEntity.ok().build(); }).orElse(ResponseEntity.notFound().build()); } }
65d1d481153ca676755877ad8ce9543e00c10fa5
69e019f0a7c569660519404a817c7239285538be
/src/model/exceptions/WrongMaterialException.java
004a5e94c845e426a708e4c9948ee005336421f0
[]
no_license
agakoz/blockworld
3e222569a388c242f98d28fe621fbaeba96ab36c
6f5efd7de3ac78634cd72790f4d7cc0901aa2306
refs/heads/master
2020-09-04T11:58:41.975445
2019-11-24T19:45:06
2019-11-24T19:45:06
219,726,658
0
0
null
null
null
null
UTF-8
Java
false
false
541
java
/** * @author agata.koziol */ package model.exceptions; import model.Material; /** * Class extendint the exception class, that is used to indicate the wrong type of material */ public class WrongMaterialException extends Exception { /** * Exception constructor. Calls parent constructor passing the mesasge in case the wrong type of material is used. * @param type wrong type of material used. */ public WrongMaterialException(Material type) { super(type +" is not a proper type of material."); } }
4fe7ad44b68c4f7f004b910efbb1befc82332bc8
48a88aea6e9774279c8563f1be665a540e02a894
/src/edu/berkeley/nlp/PCFGLA/ParserData.java
8496aba76ea037ef9d4f1cd44e2ae7a3764b0cb7
[]
no_license
josepvalls/parserservices
0994aa0fc56919985474aaebb9fa64581928b5b4
903363685e5cea4bd50d9161d60500800e42b167
refs/heads/master
2021-01-17T08:36:23.455855
2016-01-19T19:49:54
2016-01-19T19:49:54
60,540,533
2
0
null
null
null
null
UTF-8
Java
false
false
2,045
java
package edu.berkeley.nlp.PCFGLA; import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream; import java.io.Serializable; import java.util.Map; import java.util.zip.GZIPInputStream; /** * Stores the serialized material representing the grammar and lexicon of a * parser, and an Options that specifies things like how unknown words were * handled and how distances were binned that will also be needed to parse with * the grammar. * * @author Slav Petrov */ public class ParserData implements Serializable { Lexicon lex; Grammar gr; Map numbs; SpanPredictor sp; short[] numSubStatesArray; int h_markov; int v_markov; Binarization bin; public Binarization getBinarization() { return bin; } public short[] getNumSubStatesArray() { return numSubStatesArray; } public SpanPredictor getSpanPredictor() { return sp; } public Grammar getGrammar() { return gr; } public Lexicon getLexicon() { return lex; } public Map getNumbs() { return numbs; } public int getH_markov() { return h_markov; } public int getV_markov() { return v_markov; } public ParserData(Lexicon lex, Grammar gr, SpanPredictor sp, Map numbs, short[] nSub, int v_m, int h_m, Binarization b) { this.lex = lex; this.gr = gr; this.sp = sp; this.numbs = numbs; this.numSubStatesArray = nSub; this.h_markov = h_m; this.v_markov = v_m; this.bin = b; } public static ParserData Load(InputStream fis) { ParserData pData = null; try { GZIPInputStream gzis = new GZIPInputStream(fis); // Compressed ObjectInputStream in = new ObjectInputStream(gzis); // Load objects pData = (ParserData) in.readObject(); // Read the mix of grammars in.close(); // And close the stream. gzis.close(); fis.close(); } catch (IOException e) { System.out.println("IOException\n" + e); return null; } catch (ClassNotFoundException e) { System.out.println("Class not found!"); return null; } return pData; } private static final long serialVersionUID = 1; }
1700cbd05cd142065136cf5e7b2528c13359c59c
23a47ced731914cbbd2d7a8db1e71f8fa87b9f01
/src/cardgame/Damageable.java
3317a35be2349c2ff2e24b84126241b5df0b9b13
[]
no_license
ChJ4m3s/Magic
7d6d767e347a12247e56a0bda367f28f3c17892d
d1ef88a8d1fb981b9b47c7181a553b0c8141fa8d
refs/heads/master
2020-03-22T14:01:52.492516
2018-07-08T08:07:05
2018-07-08T08:07:05
140,148,790
0
0
null
null
null
null
UTF-8
Java
false
false
104
java
package cardgame; public interface Damageable extends GameEntity { void inflictDamage(int dmg); }
bebb71d6e16090f68267d5d1dd1b5fbc81e7ab81
a924442684385294b659d3de6ce7db69904dae7b
/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Reference/EncoderTests.java
b28ba9c7149c75d179a9913cdb919bbc981c13c2
[ "BSD-3-Clause" ]
permissive
Funkeyzebra10/SkyStone
abc85076582efbfc0970c6ab59c5c6bfcf516a7e
d41c1b0ea273789613c16d46877ea8eaeba594be
refs/heads/master
2020-09-04T00:03:11.569857
2019-09-18T23:30:48
2019-09-18T23:30:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
13,614
java
package org.firstinspires.ftc.teamcode.Reference; import com.qualcomm.hardware.bosch.BNO055IMU; import com.qualcomm.hardware.bosch.JustLoggingAccelerationIntegrator; import com.qualcomm.robotcore.eventloop.opmode.OpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.hardware.DcMotor; import com.qualcomm.robotcore.hardware.DcMotorSimple; import com.qualcomm.robotcore.hardware.DistanceSensor; import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit; import org.firstinspires.ftc.robotcore.external.navigation.AxesOrder; import org.firstinspires.ftc.robotcore.external.navigation.AxesReference; import org.firstinspires.ftc.robotcore.external.navigation.DistanceUnit; import org.firstinspires.ftc.robotcore.external.navigation.Orientation; import org.firstinspires.ftc.robotcore.external.navigation.Position; import org.firstinspires.ftc.robotcore.external.navigation.Velocity; import java.util.Locale; @TeleOp(name="EncoderTest") public class EncoderTests extends OpMode { DcMotor fLeft, fRight, bLeft, bRight; DistanceSensor distanceL, distanceR, distanceC; BNO055IMU imu; Orientation angles; public enum DriveState { M_FORWARD, M_BACKWARD, M_LEFT, M_RIGHT, M_NULL } public DriveState driveState = DriveState.M_FORWARD; public DriveState prevState = DriveState.M_NULL; double distanceRemaining = 0; //used for encoders static final double EXTERNAL_GEARING = 1; static final double COUNTS_PER_MOTOR_REV = 537.6 ; // eg: AndyMark NeverRest40 Motor Encoder static final double DRIVE_GEAR_REDUCTION = 1 ; // This is < 1.0 if geared UP static final double WHEEL_DIAMETER_INCHES = 3.937 ; // For figuring circumference static final double ROLLER_WHEEL_CIRC = 13 ; //Used for strafing public static final double COUNTS_PER_INCH_NORM = ((COUNTS_PER_MOTOR_REV * DRIVE_GEAR_REDUCTION) / (WHEEL_DIAMETER_INCHES * 3.1415)) / EXTERNAL_GEARING; //Used for driving straight public static final double COUNTS_PER_INCH_STRAFE = ((COUNTS_PER_MOTOR_REV * DRIVE_GEAR_REDUCTION) / ROLLER_WHEEL_CIRC) / EXTERNAL_GEARING; //Used for strafing public void init(){ //Hardware mapping of the four motors fLeft = hardwareMap.dcMotor.get("fLeft"); fRight = hardwareMap.dcMotor.get("fRight"); bLeft = hardwareMap.dcMotor.get("bLeft"); bRight = hardwareMap.dcMotor.get("bRight"); distanceL = hardwareMap.get(DistanceSensor.class, "distanceL"); distanceR = hardwareMap.get(DistanceSensor.class, "distanceR"); distanceC = hardwareMap.get(DistanceSensor.class, "distanceC"); fLeft.setDirection(DcMotorSimple.Direction.REVERSE); fRight.setDirection(DcMotorSimple.Direction.FORWARD); bRight.setDirection(DcMotor.Direction.FORWARD); bLeft.setDirection(DcMotor.Direction.REVERSE); fLeft.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE); fRight.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE); bLeft.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE); bRight.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE); //Set up imu parameters BNO055IMU.Parameters parameters = new BNO055IMU.Parameters(); parameters.angleUnit = BNO055IMU.AngleUnit.DEGREES; parameters.accelUnit = BNO055IMU.AccelUnit.METERS_PERSEC_PERSEC; parameters.calibrationDataFile = "BNO055IMUCalibration.json"; // see the calibration sample opmode parameters.loggingEnabled = true; parameters.loggingTag = "IMU"; parameters.accelerationIntegrationAlgorithm = new JustLoggingAccelerationIntegrator(); telemetry.addAction(new Runnable() { @Override public void run() { // Acquiring the angles is relatively expensive; we don't want // to do that in each of the three items that need that info, as that's // three times the necessary expense. angles = imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES); } }); // Retrieve and initialize the IMU. We expect the IMU to be attached to an I2C port // on a Core Device Interface Module, configured to be a sensor of type "AdaFruit IMU", // and named "imu". imu = hardwareMap.get(BNO055IMU.class, "imu"); imu.initialize(parameters); // Start the logging of measured acceleration imu.startAccelerationIntegration(new Position(), new Velocity(), 1000); } public void loop(){ //telemetry.addData("target ", fRight.getCurrentPosition()*COUNTS_PER_INCH); telemetry.addData("Current ",fRight.getCurrentPosition()/COUNTS_PER_INCH_NORM); switch (driveState) { case M_FORWARD: if (prevState != DriveState.M_FORWARD) { resetEncoderWithoutEncoder(); distanceRemaining = 15; } driveStraight(distanceRemaining, "forward"); driveState = DriveState.M_BACKWARD; break; case M_BACKWARD: if (prevState != DriveState.M_BACKWARD) { resetEncoderWithoutEncoder(); distanceRemaining = 15; } driveStraight(15, "backward"); driveState = DriveState.M_LEFT; break; case M_LEFT: if (prevState != DriveState.M_LEFT) { resetEncoderWithoutEncoder(); distanceRemaining = 15; } driveStrafe(distanceRemaining, "left"); driveState = DriveState.M_RIGHT; break; case M_RIGHT: if (prevState != DriveState.M_RIGHT) { resetEncoderWithoutEncoder(); distanceRemaining = 15; } driveStrafe(distanceRemaining, "right"); driveState = DriveState.M_FORWARD; break; case M_NULL: break; } prevState = driveState; } public void driveStrafe(double distance, String direction) { double startPos = fRight.getCurrentPosition() / COUNTS_PER_INCH_STRAFE; int mDirection = 1; if (direction.equals("right")) { mDirection = -1; } double target = distance * mDirection; if ((mDirection == 1 && fRight.getCurrentPosition() / COUNTS_PER_INCH_STRAFE < target) || (mDirection == -1 && fRight.getCurrentPosition() / COUNTS_PER_INCH_STRAFE > target)){ fLeft.setPower(-0.2 * mDirection); fRight.setPower(0.2 * mDirection); bLeft.setPower(0.2 * mDirection); bRight.setPower(-0.2 * mDirection); } else { fLeft.setPower(0); fRight.setPower(0); bLeft.setPower(0); bRight.setPower(0); } distanceRemaining -= fRight.getCurrentPosition() - startPos; } public void driveStraight(double distance, String direction) { double startPos = fRight.getCurrentPosition() / COUNTS_PER_INCH_NORM; int mDirection = 1; if (direction.equals("backward")) { mDirection = -1; } double target=distance * mDirection; if ((mDirection == 1 && fRight.getCurrentPosition() / COUNTS_PER_INCH_NORM < target) || (mDirection == -1 && fRight.getCurrentPosition() / COUNTS_PER_INCH_NORM > target)){ fLeft.setPower(0.2 * mDirection); fRight.setPower(0.2 * mDirection); bLeft.setPower(0.2 * mDirection); bRight.setPower(0.2 * mDirection); } else { fLeft.setPower(0); fRight.setPower(0); bLeft.setPower(0); bRight.setPower(0); } distanceRemaining -= fRight.getCurrentPosition() - startPos; } public void stop(){ fLeft.setPower(0); fRight.setPower(0); bLeft.setPower(0); bRight.setPower(0); } /** * Resets drive encoders without running using encoders */ public void resetEncoderWithoutEncoder(){ bRight.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); bLeft.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); fLeft.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); fRight.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); fRight.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER); fLeft.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER); bRight.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER); bLeft.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER); } /** * * @param destination */ public void Rotation(float destination) { fRight.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER); fLeft.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER); bRight.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER); bLeft.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER); double speed = 0; double min = 0.1; double max = 0.8; double iTime=System.currentTimeMillis(); //standard current angle double heading = cvtDegrees(angles.firstAngle); /** * This will determine the actual intended heading from 0-360 */ //check if over 360 if (Math.abs(destination)>360) { //positive if(destination>0) { while(destination>360) { destination-=360; System.out.println(destination); }//end while } //negative else { while(destination<-360) { destination+=360; System.out.println(destination); }//end while }//end if else }//end greater than 360 destination = Math.abs(destination);// convert to positive value if (destination==0) {//if 360 set to 0 as they are the same heading destination = 360; } if (heading==0) {//if 360 set to 0 as they are the same heading heading = 360; } //main phase of method while (heading < destination - 2 || heading > destination + 2) { telemetry.addData("heading", heading); telemetry.addData("speed: ", speed); telemetry.addData("destination:", destination); telemetry.update(); double delta = destination-heading; //the difference between destination and heading heading = cvtDegrees(angles.firstAngle); //decreases speed as robot approaches destination speed = (1 - ((heading) / destination)) * ((destination - heading) * 0.01); //if the speed gets under the min speed it will use the min speed if (Math.abs(speed) < min && Math.abs(speed) != 0) { speed = min; } //if the speed is over the max it will use max speed if(Math.abs(speed) > max){ speed=max; } if (!(Math.abs(delta) == 360 || Math.abs(delta) == 0)) {//determine if we are at the intended heading if (((delta + 360) % 360) > 180) { //Chooses fastest route by determining if the arc length is longer to the right or left. Chooses fastest route by fLeft.setPower(-speed); bLeft.setPower(-speed); bRight.setPower(speed); fRight.setPower(speed); } else { fLeft.setPower(speed); bLeft.setPower(speed); bRight.setPower(-speed); fRight.setPower(-speed); } } else { fLeft.setPower(0); bLeft.setPower(0); bRight.setPower(0); fRight.setPower(0); } if(System.currentTimeMillis()>iTime+4500){ break; } } fLeft.setPower(0); bLeft.setPower(0); bRight.setPower(0); fRight.setPower(0); } public double cvtDegrees(double heading) { /** * convert degrees from -180<->180 to 0<->360 */ if (heading <0 ) { return 360 + heading; } else { return heading; } } /** * a function that is needed to format the gyro angle * @param angleUnit * @param angle * @return */ String formatAngle(AngleUnit angleUnit, double angle) { return formatDegrees(AngleUnit.DEGREES.fromUnit(angleUnit, angle)); } /** * a function that is needed to format the gyro angle * @param degrees * @return */ String formatDegrees(double degrees){ return String.format(Locale.getDefault(), "%.1f", AngleUnit.DEGREES.normalize(degrees)); } /** * will stall the program for the inputted amount of time * wait time cannot be more than 5 seconds * @param milTime the amount of time to wait in seconds */ public void pause(double milTime){ double iTime =System.currentTimeMillis(); double fTime=iTime+milTime; while(System.currentTimeMillis()<fTime){ } } }
c831b179bb08e092e2d0993220cc229e8801dca8
f632223aa142cfa5e572ffd629519514dc6c6c55
/src/Controllers/CustomerPayment.java
d6e9168cf11ea369c285557d9de7d1108d23d6ad
[]
no_license
emadaltaki/ParkinSpotApplication
0f520a663ed06bca8332e4fc5674e3c8fc7b4038
86578a9eccbe38d676522c97ba158df9d3d4a9fc
refs/heads/main
2023-06-20T04:59:25.035534
2021-07-20T00:34:42
2021-07-20T00:34:42
387,628,066
0
0
null
null
null
null
UTF-8
Java
false
false
11,143
java
package Controllers; import java.awt.BorderLayout; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import logic.Booking; import logic.Customer; import logic.Payment; import java.awt.Color; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JTextField; import javax.swing.JLabel; import javax.swing.JOptionPane; import java.awt.Font; import java.awt.Image; import javax.swing.SwingConstants; import javax.swing.JTextPane; import java.awt.event.ActionListener; import java.util.ArrayList; import java.awt.event.ActionEvent; import javax.swing.JRadioButton; import javax.swing.JToggleButton; import javax.swing.JRadioButtonMenuItem; import javax.swing.KeyStroke; import java.awt.event.KeyEvent; public class CustomerPayment extends JFrame { private JPanel contentPane; private Customer user; private JTextField parkingSpaceField; private JTextField totalPriceField; private ArrayList<Booking> toPurchase = new ArrayList<Booking>(); private JTextField txtCardNumber; private JTextField txtExpiry; private JTextField txtCvv; private JTextField txtPaypalEmail;; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { if (CustomerLanding.getUser() != null) { CustomerPayment frame = new CustomerPayment(); frame.setLocationRelativeTo(null); frame.setVisible(true); } else { Login_Registation.main(null); } } catch (Exception e) { e.printStackTrace(); } } }); } public CustomerPayment() { this.user = CustomerLanding.getUser(); initialize(); } /** * Create the frame. */ private void initialize() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 701, 527); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JPanel mainPanel = new JPanel(); mainPanel.setLayout(null); mainPanel.setBackground(new Color(0, 0, 0, 153)); mainPanel.setBounds(199, 0, 486, 488); contentPane.add(mainPanel); JButton btnPay = new JButton("Pay"); btnPay.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String response = Payment.pay(toPurchase, user); if (response.equals("true")) { JOptionPane.showMessageDialog(null, "Payment Sucessful", "Success ", JOptionPane.PLAIN_MESSAGE); } else { JOptionPane.showMessageDialog(null, "Payment Failed", "Error", JOptionPane.ERROR_MESSAGE); } } }); btnPay.setBounds(200, 414, 118, 34); mainPanel.add(btnPay); JButton btnGoBack = new JButton("Go Back"); btnGoBack.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // go back to customer landing page if (JOptionPane.showOptionDialog(null, "Are you sure you want to go back, current data would be lost", "Warning", JOptionPane.YES_NO_OPTION, 0, null, null, e) == JOptionPane.YES_OPTION) { System.out.println("selected Yes"); dispose(); CustomerLanding.main(null); } } }); btnGoBack.setBounds(74, 414, 101, 34); mainPanel.add(btnGoBack); parkingSpaceField = new JTextField(); parkingSpaceField.setFont(new Font("Tahoma", Font.PLAIN, 14)); parkingSpaceField.setColumns(10); parkingSpaceField.setBounds(53, 56, 189, 36); mainPanel.add(parkingSpaceField); JLabel lblNewLabel = new JLabel("Enter Parking Space Number"); lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblNewLabel.setForeground(Color.WHITE); lblNewLabel.setBounds(53, 31, 228, 14); mainPanel.add(lblNewLabel); JLabel lblTotal = new JLabel("Total"); lblTotal.setHorizontalAlignment(SwingConstants.CENTER); lblTotal.setFont(new Font("Tahoma", Font.PLAIN, 20)); lblTotal.setForeground(Color.WHITE); lblTotal.setBounds(353, 58, 108, 25); mainPanel.add(lblTotal); totalPriceField = new JTextField(); totalPriceField.setHorizontalAlignment(SwingConstants.CENTER); totalPriceField.setFont(new Font("Tahoma", Font.BOLD, 24)); totalPriceField.setText("30"); totalPriceField.setEditable(false); totalPriceField.setColumns(10); totalPriceField.setBounds(353, 100, 108, 73); mainPanel.add(totalPriceField); JTextPane txtpnBookingIdParking = new JTextPane(); txtpnBookingIdParking.setText("Selected Orders"); txtpnBookingIdParking.setBounds(53, 103, 290, 70); mainPanel.add(txtpnBookingIdParking); JButton btnAdd = new JButton("Add"); btnAdd.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String parkingSpace = parkingSpaceField.getText(); Booking booking = user.getBooking(Integer.parseInt(parkingSpace)); if (booking != null && !toPurchase.contains(booking)) { toPurchase.add(booking); setdetails(); totalPriceField.setText("$ " + String.valueOf(Payment.getTotalPrice(toPurchase))); parkingSpaceField.setText(null); // System.out.println(toPurchase.toString()); } else { JOptionPane.showMessageDialog(null, "Invalid Parking Space Number", "Error", JOptionPane.ERROR_MESSAGE); } } public void setdetails() { String orders = ""; for (Booking booking : toPurchase) { orders += "\r\nBooking Id: " + booking.getBookingId() + " Parking Space: " + booking.getParkingSpace() + " Duration: " + booking.getParkingSpace(); } txtpnBookingIdParking.setText(orders); } }); btnAdd.setBounds(252, 56, 91, 34); mainPanel.add(btnAdd); txtPaypalEmail = new JTextField(); txtPaypalEmail.setText("PayPal Email"); txtPaypalEmail.setFont(new Font("Tahoma", Font.PLAIN, 14)); txtPaypalEmail.setColumns(10); txtPaypalEmail.setBounds(53, 288, 290, 36); mainPanel.add(txtPaypalEmail); txtPaypalEmail.setVisible(false); JRadioButton rdbtnCreditCard = new JRadioButton("Credit Card"); rdbtnCreditCard.setSelected(true); JRadioButton rdbtnDebitCard = new JRadioButton("Debit Card"); JRadioButton rdbtnPaypal = new JRadioButton("PayPal"); rdbtnCreditCard.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (rdbtnCreditCard.isSelected()) { rdbtnDebitCard.setSelected(false); rdbtnPaypal.setSelected(false); txtCardNumber.setVisible(true); txtExpiry.setVisible(true); txtCvv.setVisible(true); txtPaypalEmail.setVisible(false); txtCardNumber.revalidate(); txtCardNumber.repaint(); txtExpiry.revalidate(); txtExpiry.repaint(); txtCvv.revalidate(); txtCvv.repaint(); txtPaypalEmail.revalidate(); txtPaypalEmail.repaint(); } } }); rdbtnCreditCard.setBounds(53, 222, 109, 23); mainPanel.add(rdbtnCreditCard); rdbtnDebitCard.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (rdbtnDebitCard.isSelected()) { rdbtnCreditCard.setSelected(false); rdbtnPaypal.setSelected(false); txtCardNumber.setVisible(true); txtExpiry.setVisible(true); txtCvv.setVisible(true); txtPaypalEmail.setVisible(false); txtCardNumber.revalidate(); txtCardNumber.repaint(); txtExpiry.revalidate(); txtExpiry.repaint(); txtCvv.revalidate(); txtCvv.repaint(); txtPaypalEmail.revalidate(); txtPaypalEmail.repaint(); } } }); rdbtnDebitCard.setBounds(172, 222, 109, 23); mainPanel.add(rdbtnDebitCard); txtCardNumber = new JTextField(); txtCardNumber.setText("Card Number"); txtCardNumber.setFont(new Font("Tahoma", Font.PLAIN, 14)); txtCardNumber.setColumns(10); txtCardNumber.setBounds(53, 288, 290, 36); mainPanel.add(txtCardNumber); txtExpiry = new JTextField(); txtExpiry.setText("Expiry"); txtExpiry.setFont(new Font("Tahoma", Font.PLAIN, 14)); txtExpiry.setColumns(10); txtExpiry.setBounds(53, 335, 137, 36); mainPanel.add(txtExpiry); txtCvv = new JTextField(); txtCvv.setText("CVV"); txtCvv.setFont(new Font("Tahoma", Font.PLAIN, 14)); txtCvv.setColumns(10); txtCvv.setBounds(200, 335, 143, 36); mainPanel.add(txtCvv); rdbtnPaypal.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if(rdbtnPaypal.isSelected()) { rdbtnCreditCard.setSelected(false); rdbtnDebitCard.setSelected(false); txtCardNumber.setVisible(false); txtExpiry.setVisible(false); txtCvv.setVisible(false); txtPaypalEmail.setVisible(true); // mainPanel.revalidate(); // mainPanel.repaint(); txtCardNumber.revalidate(); txtCardNumber.repaint(); txtExpiry.revalidate(); txtExpiry.repaint(); txtCvv.revalidate(); txtCvv.repaint(); txtPaypalEmail.revalidate(); txtPaypalEmail.repaint(); } } }); rdbtnPaypal.setBounds(292, 222, 109, 23); mainPanel.add(rdbtnPaypal); JPanel sidebarPanel = new JPanel(); sidebarPanel.setLayout(null); sidebarPanel.setBackground(new Color(0, 0, 0, 153)); sidebarPanel.setBounds(0, 0, 201, 488); contentPane.add(sidebarPanel); JLabel logo = new JLabel("PMS "); logo.setHorizontalAlignment(SwingConstants.CENTER); logo.setForeground(Color.WHITE); logo.setFont(new Font("Tahoma", Font.BOLD, 23)); logo.setBounds(0, 0, 191, 110); sidebarPanel.add(logo); JLabel lbWelcome = new JLabel("<html>Payment<html>"); lbWelcome.setHorizontalAlignment(SwingConstants.CENTER); lbWelcome.setForeground(Color.WHITE); lbWelcome.setFont(new Font("Tahoma", Font.BOLD, 32)); lbWelcome.setBackground(Color.LIGHT_GRAY); lbWelcome.setBounds(10, 101, 181, 110); sidebarPanel.add(lbWelcome); JLabel lblUser = new JLabel("<html>User :"+user.getFirstname()+" "+user.getLastname()+"</html>"); lblUser.setVerticalAlignment(SwingConstants.TOP); lblUser.setHorizontalAlignment(SwingConstants.LEFT); lblUser.setForeground(Color.LIGHT_GRAY); lblUser.setFont(new Font("Tahoma", Font.PLAIN, 23)); lblUser.setBounds(10, 238, 181, 110); sidebarPanel.add(lblUser); JPanel subSectionPanel = new JPanel(); subSectionPanel.setLayout(null); subSectionPanel.setBackground(Color.BLACK); subSectionPanel.setBounds(0, 349, 292, 139); sidebarPanel.add(subSectionPanel); JLabel lblGetStarted = new JLabel("<html>Enter space numebers to chekout</html>"); lblGetStarted.setHorizontalAlignment(SwingConstants.LEFT); lblGetStarted.setForeground(Color.LIGHT_GRAY); lblGetStarted.setFont(new Font("Tahoma", Font.PLAIN, 26)); lblGetStarted.setBounds(10, 11, 179, 117); subSectionPanel.add(lblGetStarted); ImageIcon img = new ImageIcon(this.getClass().getResource("/bg1.jpg")); Image img2 = img.getImage().getScaledInstance(700, 527, java.awt.Image.SCALE_SMOOTH); img = new ImageIcon(img2); JLabel background = new JLabel(""); background.setForeground(Color.WHITE); background.setFont(new Font("Tahoma", Font.PLAIN, 13)); background.setIcon(img); background.setBounds(0, 0, 685, 488); contentPane.add(background); } }
1b0caa6a0b86ef18b7c1e61f1f3545c8252b492b
bf77ff21d0f474de2ff769dc680dda214d646fd8
/src/main/java/com/learn/controller/customCenter/UsersController.java
518446b057d218e80079c01a2faa4d67c8b1e090
[]
no_license
learnerLcy/learn
d295fe4ae263f5151be0e516728b275ad50083c4
0156e24e933ac89fdff1606bff0609594b0fa28d
refs/heads/master
2023-01-14T11:46:26.613163
2019-12-13T02:28:13
2019-12-13T02:28:13
220,176,277
2
0
null
2023-01-06T08:34:32
2019-11-07T07:25:07
JavaScript
UTF-8
Java
false
false
1,760
java
package com.learn.controller.customCenter; import com.learn.Constants.Constants; import com.learn.PoJo.Result; import com.learn.PoJo.customCenter.User; import com.learn.PoJo.customCenter.UserRole; import com.learn.PoJo.system.Menu; import com.learn.service.customCenter.UserRoleService; import com.learn.service.customCenter.UserService; import com.learn.utils.CommonConstant; import com.learn.utils.CommonUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; import tk.mybatis.mapper.entity.Condition; import java.util.List; /** * @ClassName:UsersController * @Description: 网站用户统计 * @Author:lvchunyang * @Date:11:36 **/ @Controller @RequestMapping("/users") public class UsersController { @Autowired private UserService userService; @Autowired private UserRoleService userRoleService; @GetMapping("/showUsersPage") public ModelAndView showUsersPage(ModelAndView mv){ mv.setViewName("/customCenter/showUsersPage"); return mv; } @PostMapping("addUser") @ResponseBody public Result addUser(User user, @RequestParam(value="roleIds",required=false)List<String> roleIds){ return userService.addUser(user,roleIds); } @PostMapping("updateUser") @ResponseBody public Result updateUser(User user,@RequestParam(value="roleIds",required=false)List<String> roleIds){ return userService.updateUser(user,roleIds); } @RequestMapping("/deleteUser") @ResponseBody public Result deleteUser(User user,UserRole userRole){ return userService.deleteUser(user,userRole); } }
7f57297810a8daabd9df332ec9b3a70e58743619
c7ee12d71c858cc8e7bb60f968e137235e1094d8
/TrainTicketSystem/ts-order-other-service/src/main/java/other/domain/Order.java
5b4bffa3ae9eb96d15079acde6c12d8834443a17
[]
no_license
jichaofdu/KG-MSA
5f8c07f2cad89c866fd4eca7ac8e8777a7ceb906
0746fb9dcd12f3033df741d5615f7b11931cb077
refs/heads/master
2022-06-18T03:15:19.184278
2020-02-21T11:42:55
2020-02-21T11:42:55
186,518,748
3
1
null
2022-05-20T21:23:36
2019-05-14T01:04:47
Java
UTF-8
Java
false
false
5,220
java
package other.domain; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.Document; import java.util.Date; import java.util.UUID; @Document(collection = "orders") @JsonIgnoreProperties(ignoreUnknown = true) public class Order { @Id private UUID id; private Date boughtDate; private Date travelDate; private Date travelTime; //Which Account Bought it private UUID accountId; //Tickets bought for whom.... private String contactsName; private int documentType; private String contactsDocumentNumber; private String trainNumber; private int coachNumber; private int seatClass; private String seatNumber; private String from; private String to; private int status; private String price; public Order(){ boughtDate = new Date(System.currentTimeMillis()); travelDate = new Date(123456789); trainNumber = "G1235"; coachNumber = 5; seatClass = SeatClass.FIRSTCLASS.getCode(); seatNumber = "5A"; from = "shanghai"; to = "taiyuan"; status = OrderStatus.PAID.getCode(); price = "0.0"; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Order other = (Order) obj; return boughtDate.equals(other.getBoughtDate()) && travelDate.equals(other.getTravelDate()) && travelTime.equals(other.getTravelTime()) && accountId .equals( other.getAccountId() ) && contactsName.equals(other.getContactsName()) && contactsDocumentNumber.equals(other.getContactsDocumentNumber()) && documentType == other.getDocumentType() && trainNumber.equals(other.getTrainNumber()) && coachNumber == other.getCoachNumber() && seatClass == other.getSeatClass() && seatNumber .equals(other.getSeatNumber()) && from.equals(other.getFrom()) && to.equals(other.getTo()) && status == other.getStatus() && price.equals(other.price); } public UUID getId() { return id; } public void setId(UUID id) { this.id = id; } public UUID getAccountId() { return accountId; } public void setAccountId(UUID accountId) { this.accountId = accountId; } public Date getBoughtDate() { return boughtDate; } public void setBoughtDate(Date boughtDate) { this.boughtDate = boughtDate; } public Date getTravelDate() { return travelDate; } public void setTravelDate(Date travelDate) { this.travelDate = travelDate; } public void setTravelDate(int year,int month,int day){ Date date = new Date(year,month,day,0,0,0); this.travelDate = date; } public Date getTravelTime() { return travelTime; } public void setTravelTime(Date travelTime) { this.travelTime = travelTime; } public void setTravelTime(int hour,int minute){ Date date = new Date(1970,1,1,hour,minute,0); } public String getTrainNumber() { return trainNumber; } public void setTrainNumber(String trainNumber) { this.trainNumber = trainNumber; } public int getCoachNumber() { return coachNumber; } public void setCoachNumber(int coachNumber) { this.coachNumber = coachNumber; } public int getSeatClass() { return seatClass; } public void setSeatClass(int seatClass) { this.seatClass = seatClass; } public String getSeatNumber() { return seatNumber; } public void setSeatNumber(String seatNumber) { this.seatNumber = seatNumber; } public String getFrom() { return from; } public void setFrom(String from) { this.from = from; } public String getTo() { return to; } public void setTo(String to) { this.to = to; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } public String getPrice() { return price; } public void setPrice(String price) { this.price = price; } public String getContactsName() { return contactsName; } public void setContactsName(String contactsName) { this.contactsName = contactsName; } public int getDocumentType() { return documentType; } public void setDocumentType(int documentType) { this.documentType = documentType; } public String getContactsDocumentNumber() { return contactsDocumentNumber; } public void setContactsDocumentNumber(String contactsDocumentNumber) { this.contactsDocumentNumber = contactsDocumentNumber; } }
820839f4c26050ca4ceabc44797092d1ce346745
78b184f9e722b4757f81bed4810bcf0556302ccb
/test/testSuite.java
e92a94c3ba7c70ad0cf343d66fff6f625bad6b90
[]
no_license
onatcipli/Project-1-ATTENDANCE-MANAGEMENT-SYSTEM-Mirkan_Ege_Onat
b6653c6172ab7a5ea3c5f3fb63ca39ab9b9b6aec
a63819d4ae1dc92574af4c1787bf382afceaaab4
refs/heads/master
2020-04-01T04:53:38.804967
2018-05-07T17:06:29
2018-05-07T17:06:29
152,880,926
1
1
null
2018-10-13T14:36:53
2018-10-13T14:36:53
null
UTF-8
Java
false
false
278
java
import org.junit.runner.RunWith; import org.junit.runners.Suite; import Database.*; @RunWith(Suite.class) @Suite.SuiteClasses({ adminSqlTest.class, layerMySqlTest.class, studentSqlTest.class, lecturerSqlTest.class }) public class testSuite { }
494db60f5f8a608138e0bdb0fb83138aff50dc4a
f10c44589b14b28e89319fca663c51afe7795144
/app/src/main/java/com/android/rx/phaapplication/MainActivity.java
86491b1a92c235248d0b19e307faf452a8775d22
[]
no_license
chasten08/PhaApplication
7b41aa80de47db28c486233d6c72704adc16427e
80098d1e73b75083f947f3f3bb9447c06b8b78d4
refs/heads/master
2020-04-11T00:12:19.130188
2016-09-14T07:46:14
2016-09-14T07:50:26
68,001,809
0
0
null
null
null
null
UTF-8
Java
false
false
342
java
package com.android.rx.phaapplication; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
a318fbeca786db66c15bb89a87b4517a0da72035
807d503495763202fe262b65443b775e917ef050
/j2eeapplication/src/main/java/com/example/j2eeapp/services/UserService.java
f16a7464e4f88091ac7efed44a82ae7c22e0dcf5
[]
no_license
blagoja89/first
ec9c4c264330dc1fc6c85763385c6eea497a891a
d0f7b86244ebaabc7d1af26b35340197141a9452
refs/heads/master
2020-04-17T01:29:19.669094
2016-08-25T08:56:09
2016-08-25T08:56:09
51,607,694
0
0
null
null
null
null
UTF-8
Java
false
false
720
java
package com.example.j2eeapp.services; import javax.faces.event.AjaxBehaviorEvent; import com.example.j2eeapp.domain.UserEntity; /** * Service providing service methods to work with user data and entity. * * */ public interface UserService { /** * Create user - persist to database * * @param userEntity * @return true if success */ boolean createUser(UserEntity userEntity); /** * Check user name availability. UI ajax use. * * @param ajax event * @return */ boolean checkAvailable(AjaxBehaviorEvent event); /** * Retrieves full User record from database by user name * * @param userName * @return UserEntity */ UserEntity loadUserEntityByUsername(String userName); }
eaac6f45b019c9bb71d3dd5ed2edca954e3cf161
b3af315bf62362843fff244819715159f8f84812
/AalgorithmsPrac/Amazon/Designing/DeckofCards/DeckofCards.java
2abd6b65a47a0b753087d14bf735b0df0011fe05
[]
no_license
brandhill/AlgorithemAndDataStruct
dfdb6835e113dd67160a6d959753a95c0175544c
2738b53fd0b0aa502177480ceef32cfe806e5bf6
refs/heads/master
2021-06-20T12:19:57.027279
2017-05-15T23:23:57
2017-05-15T23:23:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,016
java
package Designing.DeckofCards; import java.util.Random; public class DeckofCards { Card[] cards; private int dealCount; DeckofCards() { Type[] types = {Type.Clubs,Type.Diamonds,Type.Hearts,Type.Spades}; Number[] values = {Number.Ace, Number.Two, Number.Three, Number.Four, Number.Five, Number.Six, Number.Seven, Number.Eight, Number.Nine, Number.Ten, Number.Jack, Number.Queen, Number.King}; int k = 0; cards = new Card[52]; dealCount = 0; for(int i = 0; i < types.length; i++) { for(int j=0; j< values.length; j++) { cards[k] = new Card(types[i],values[j]); System.out.println(cards[k].type+" "+cards[k].value); k++; } } } void ShuffleCards() { dealCount = 0; Random random = new Random(); int len = cards.length; for(int i=0; i< len; i++) { int temp = i + (Math.abs(random.nextInt()))%(len-i); swap(cards, i, temp); } } Card Deal() { if(dealCount==cards.length) return null; Card c = cards[dealCount]; dealCount++; return c; } void Reset() { dealCount = 0; ShuffleCards(); } void printCards() { for(int i=0; i< cards.length; i++) { System.out.println(cards[i].type+" "+cards[i].value); } } void swap(Card[] cards, int index1, int index2) { Card temp = cards[index1]; cards[index1] = cards[index2]; cards[index2] = temp; } public static void main(String[] args) { DeckofCards cards = new DeckofCards(); cards.ShuffleCards(); System.out.println("----"); cards.printCards(); System.out.println("----"); Card c = cards.Deal(); System.out.println("Deal "+ c.type+" "+c.value); c = cards.Deal(); System.out.println("Deal "+ c.type+" "+c.value); c = cards.Deal(); System.out.println("Deal "+ c.type+" "+c.value); } } class Card { Type type; Number value; Card(Type type, Number value) { this.type = type; this.value = value; } } enum Type { Spades, Diamonds, Clubs, Hearts } enum Number { Ace, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Jack, Queen, King }
fe649a63b3486e02fb7a1c675dedc1268bae79db
79595075622ded0bf43023f716389f61d8e96e94
/app/src/main/java/com/android/server/content/ContentService.java
3e114a9ab33703c5cb6edaea5d2c5aaac8989e55
[]
no_license
dstmath/OppoR15
96f1f7bb4d9cfad47609316debc55095edcd6b56
b9a4da845af251213d7b4c1b35db3e2415290c96
refs/heads/master
2020-03-24T16:52:14.198588
2019-05-27T02:24:53
2019-05-27T02:24:53
142,840,716
7
4
null
null
null
null
UTF-8
Java
false
false
52,879
java
package com.android.server.content; import android.accounts.Account; import android.app.ActivityManager; import android.app.ActivityManagerInternal; import android.app.AppOpsManager; import android.app.job.JobInfo; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.ContentResolver; import android.content.Context; import android.content.IContentService.Stub; import android.content.ISyncStatusObserver; import android.content.Intent; import android.content.IntentFilter; import android.content.PeriodicSync; import android.content.SyncAdapterType; import android.content.SyncInfo; import android.content.SyncRequest; import android.content.SyncStatusInfo; import android.content.pm.PackageManagerInternal; import android.content.pm.PackageManagerInternal.SyncAdapterPackagesProvider; import android.content.pm.ProviderInfo; import android.database.IContentObserver; import android.database.sqlite.SQLiteException; import android.net.Uri; import android.os.Binder; import android.os.Bundle; import android.os.FactoryTest; import android.os.IBinder; import android.os.IBinder.DeathRecipient; import android.os.Parcel; import android.os.RemoteException; import android.os.SystemProperties; import android.os.UserHandle; import android.text.TextUtils; import android.util.ArrayMap; import android.util.Log; import android.util.Pair; import android.util.Slog; import android.util.SparseArray; import android.util.SparseIntArray; import com.android.internal.annotations.GuardedBy; import com.android.internal.util.ArrayUtils; import com.android.internal.util.DumpUtils; import com.android.internal.util.IndentingPrintWriter; import com.android.server.LocalServices; import com.android.server.SystemService; import com.android.server.am.OppoMultiAppManager; import com.android.server.am.OppoMultiAppManagerUtil; import com.android.server.am.OppoPermissionConstants; import com.android.server.content.SyncStorageEngine.EndPoint; import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import oppo.util.OppoStatistics; public final class ContentService extends Stub { static final boolean DEBUG = false; static final String TAG = "ContentService"; @GuardedBy("mCache") private final SparseArray<ArrayMap<String, ArrayMap<Pair<String, Uri>, Bundle>>> mCache = new SparseArray(); private BroadcastReceiver mCacheReceiver = new BroadcastReceiver() { public void onReceive(Context context, Intent intent) { synchronized (ContentService.this.mCache) { if ("android.intent.action.LOCALE_CHANGED".equals(intent.getAction())) { ContentService.this.mCache.clear(); } else { Uri data = intent.getData(); if (data != null) { ContentService.this.invalidateCacheLocked(intent.getIntExtra("android.intent.extra.user_handle", -10000), data.getSchemeSpecificPart(), null); } } } } }; private Context mContext; private boolean mFactoryTest; private final ObserverNode mRootNode = new ObserverNode(""); private SyncManager mSyncManager = null; private final Object mSyncManagerLock = new Object(); public static class Lifecycle extends SystemService { private ContentService mService; public Lifecycle(Context context) { super(context); } public void onStart() { this.mService = new ContentService(getContext(), FactoryTest.getMode() == 1); publishBinderService("content", this.mService); } public void onBootPhase(int phase) { if (phase == SystemService.PHASE_ACTIVITY_MANAGER_READY) { this.mService.systemReady(); } } public void onStartUser(int userHandle) { this.mService.onStartUser(userHandle); } public void onUnlockUser(int userHandle) { this.mService.onUnlockUser(userHandle); } public void onStopUser(int userHandle) { this.mService.onStopUser(userHandle); } public void onCleanupUser(int userHandle) { synchronized (this.mService.mCache) { this.mService.mCache.remove(userHandle); } } } public static final class ObserverCall { final ObserverNode mNode; final IContentObserver mObserver; final int mObserverUserId; final boolean mSelfChange; ObserverCall(ObserverNode node, IContentObserver observer, boolean selfChange, int observerUserId) { this.mNode = node; this.mObserver = observer; this.mSelfChange = selfChange; this.mObserverUserId = observerUserId; } } public static final class ObserverNode { public static final int DELETE_TYPE = 2; public static final int INSERT_TYPE = 0; public static final int UPDATE_TYPE = 1; private ArrayList<ObserverNode> mChildren = new ArrayList(); private String mName; private ArrayList<ObserverEntry> mObservers = new ArrayList(); private class ObserverEntry implements DeathRecipient { public final boolean notifyForDescendants; public final IContentObserver observer; private final Object observersLock; public final int pid; public final int uid; private final int userHandle; public ObserverEntry(IContentObserver o, boolean n, Object observersLock, int _uid, int _pid, int _userHandle) { this.observersLock = observersLock; this.observer = o; this.uid = _uid; this.pid = _pid; this.userHandle = _userHandle; this.notifyForDescendants = n; try { this.observer.asBinder().linkToDeath(this, 0); } catch (RemoteException e) { binderDied(); } } public void binderDied() { synchronized (this.observersLock) { ObserverNode.this.removeObserverLocked(this.observer); } } public void dumpLocked(FileDescriptor fd, PrintWriter pw, String[] args, String name, String prefix, SparseIntArray pidCounts) { Object obj = null; pidCounts.put(this.pid, pidCounts.get(this.pid) + 1); pw.print(prefix); pw.print(name); pw.print(": pid="); pw.print(this.pid); pw.print(" uid="); pw.print(this.uid); pw.print(" user="); pw.print(this.userHandle); pw.print(" target="); if (this.observer != null) { obj = this.observer.asBinder(); } pw.println(Integer.toHexString(System.identityHashCode(obj))); } } public ObserverNode(String name) { this.mName = name; } public void dumpLocked(FileDescriptor fd, PrintWriter pw, String[] args, String name, String prefix, int[] counts, SparseIntArray pidCounts) { int i; String innerName = null; if (this.mObservers.size() > 0) { if ("".equals(name)) { innerName = this.mName; } else { innerName = name + "/" + this.mName; } for (i = 0; i < this.mObservers.size(); i++) { counts[1] = counts[1] + 1; ((ObserverEntry) this.mObservers.get(i)).dumpLocked(fd, pw, args, innerName, prefix, pidCounts); } } if (this.mChildren.size() > 0) { if (innerName == null) { if ("".equals(name)) { innerName = this.mName; } else { innerName = name + "/" + this.mName; } } for (i = 0; i < this.mChildren.size(); i++) { counts[0] = counts[0] + 1; ((ObserverNode) this.mChildren.get(i)).dumpLocked(fd, pw, args, innerName, prefix, counts, pidCounts); } } } private String getUriSegment(Uri uri, int index) { if (uri == null) { return null; } if (index == 0) { return uri.getAuthority(); } return (String) uri.getPathSegments().get(index - 1); } private int countUriSegments(Uri uri) { if (uri == null) { return 0; } return uri.getPathSegments().size() + 1; } public void addObserverLocked(Uri uri, IContentObserver observer, boolean notifyForDescendants, Object observersLock, int uid, int pid, int userHandle) { addObserverLocked(uri, 0, observer, notifyForDescendants, observersLock, uid, pid, userHandle); } private void addObserverLocked(Uri uri, int index, IContentObserver observer, boolean notifyForDescendants, Object observersLock, int uid, int pid, int userHandle) { if (index == countUriSegments(uri)) { Iterator<ObserverEntry> iter = this.mObservers.iterator(); while (iter.hasNext()) { if (((ObserverEntry) iter.next()).observer.asBinder() == observer.asBinder()) { Log.w(ContentService.TAG, "Observer " + observer + " is already registered."); return; } } this.mObservers.add(new ObserverEntry(observer, notifyForDescendants, observersLock, uid, pid, userHandle)); return; } String segment = getUriSegment(uri, index); if (segment == null) { throw new IllegalArgumentException("Invalid Uri (" + uri + ") used for observer"); } ObserverNode node; int N = this.mChildren.size(); for (int i = 0; i < N; i++) { node = (ObserverNode) this.mChildren.get(i); if (node.mName.equals(segment)) { node.addObserverLocked(uri, index + 1, observer, notifyForDescendants, observersLock, uid, pid, userHandle); return; } } node = new ObserverNode(segment); this.mChildren.add(node); node.addObserverLocked(uri, index + 1, observer, notifyForDescendants, observersLock, uid, pid, userHandle); } public boolean removeObserverLocked(IContentObserver observer) { int size = this.mChildren.size(); int i = 0; while (i < size) { if (((ObserverNode) this.mChildren.get(i)).removeObserverLocked(observer)) { this.mChildren.remove(i); i--; size--; } i++; } IBinder observerBinder = observer.asBinder(); size = this.mObservers.size(); for (i = 0; i < size; i++) { ObserverEntry entry = (ObserverEntry) this.mObservers.get(i); if (entry.observer.asBinder() == observerBinder) { this.mObservers.remove(i); observerBinder.unlinkToDeath(entry, 0); break; } } if (this.mChildren.size() == 0 && this.mObservers.size() == 0) { return true; } return false; } private void collectMyObserversLocked(boolean leaf, IContentObserver observer, boolean observerWantsSelfNotifications, int flags, int targetUserHandle, ArrayList<ObserverCall> calls) { int N = this.mObservers.size(); IBinder observerBinder = observer == null ? null : observer.asBinder(); for (int i = 0; i < N; i++) { ObserverEntry entry = (ObserverEntry) this.mObservers.get(i); boolean selfChange = entry.observer.asBinder() == observerBinder; if ((!selfChange || (observerWantsSelfNotifications ^ 1) == 0) && (targetUserHandle == -1 || entry.userHandle == -1 || targetUserHandle == entry.userHandle)) { if (leaf) { if ((flags & 2) != 0 && entry.notifyForDescendants) { } } else if (!entry.notifyForDescendants) { } calls.add(new ObserverCall(this, entry.observer, selfChange, UserHandle.getUserId(entry.uid))); } } } public void collectObserversLocked(Uri uri, int index, IContentObserver observer, boolean observerWantsSelfNotifications, int flags, int targetUserHandle, ArrayList<ObserverCall> calls) { Object segment = null; int segmentCount = countUriSegments(uri); if (index >= segmentCount) { collectMyObserversLocked(true, observer, observerWantsSelfNotifications, flags, targetUserHandle, calls); } else if (index < segmentCount) { segment = getUriSegment(uri, index); collectMyObserversLocked(false, observer, observerWantsSelfNotifications, flags, targetUserHandle, calls); } int N = this.mChildren.size(); for (int i = 0; i < N; i++) { ObserverNode node = (ObserverNode) this.mChildren.get(i); if (segment == null || node.mName.equals(segment)) { node.collectObserversLocked(uri, index + 1, observer, observerWantsSelfNotifications, flags, targetUserHandle, calls); if (segment != null) { return; } } } } } private SyncManager getSyncManager() { if (SystemProperties.getBoolean("config.disable_network", false)) { return null; } SyncManager syncManager; synchronized (this.mSyncManagerLock) { try { if (this.mSyncManager == null) { this.mSyncManager = new SyncManager(this.mContext, this.mFactoryTest); } } catch (SQLiteException e) { Log.e(TAG, "Can't create SyncManager", e); } syncManager = this.mSyncManager; } return syncManager; } void onStartUser(int userHandle) { if (this.mSyncManager != null) { this.mSyncManager.onStartUser(userHandle); } } void onUnlockUser(int userHandle) { if (this.mSyncManager != null) { this.mSyncManager.onUnlockUser(userHandle); } } void onStopUser(int userHandle) { if (this.mSyncManager != null) { this.mSyncManager.onStopUser(userHandle); } } protected synchronized void dump(FileDescriptor fd, PrintWriter pw_, String[] args) { if (DumpUtils.checkDumpAndUsageStatsPermission(this.mContext, TAG, pw_)) { IndentingPrintWriter pw = new IndentingPrintWriter(pw_, " "); boolean dumpAll = ArrayUtils.contains(args, "-a"); long identityToken = clearCallingIdentity(); try { int i; if (this.mSyncManager == null) { pw.println("No SyncManager created! (Disk full?)"); } else { this.mSyncManager.dump(fd, pw, dumpAll); } pw.println(); pw.println("Observer tree:"); synchronized (this.mRootNode) { int[] counts = new int[2]; final SparseIntArray pidCounts = new SparseIntArray(); this.mRootNode.dumpLocked(fd, pw, args, "", " ", counts, pidCounts); pw.println(); ArrayList<Integer> sorted = new ArrayList(); for (i = 0; i < pidCounts.size(); i++) { sorted.add(Integer.valueOf(pidCounts.keyAt(i))); } Collections.sort(sorted, new Comparator<Integer>() { public int compare(Integer lhs, Integer rhs) { int lc = pidCounts.get(lhs.intValue()); int rc = pidCounts.get(rhs.intValue()); if (lc < rc) { return 1; } if (lc > rc) { return -1; } return 0; } }); for (i = 0; i < sorted.size(); i++) { int pid = ((Integer) sorted.get(i)).intValue(); pw.print(" pid "); pw.print(pid); pw.print(": "); pw.print(pidCounts.get(pid)); pw.println(" observers"); } pw.println(); pw.print(" Total number of nodes: "); pw.println(counts[0]); pw.print(" Total number of observers: "); pw.println(counts[1]); } synchronized (this.mCache) { pw.println(); pw.println("Cached content:"); pw.increaseIndent(); for (i = 0; i < this.mCache.size(); i++) { pw.println("User " + this.mCache.keyAt(i) + ":"); pw.increaseIndent(); pw.println(this.mCache.valueAt(i)); pw.decreaseIndent(); } pw.decreaseIndent(); } restoreCallingIdentity(identityToken); } catch (Throwable th) { restoreCallingIdentity(identityToken); } } } public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException { try { return super.onTransact(code, data, reply, flags); } catch (RuntimeException e) { if (!(e instanceof SecurityException)) { Slog.wtf(TAG, "Content Service Crash", e); } throw e; } } ContentService(Context context, boolean factoryTest) { this.mContext = context; this.mFactoryTest = factoryTest; ((PackageManagerInternal) LocalServices.getService(PackageManagerInternal.class)).setSyncAdapterPackagesprovider(new SyncAdapterPackagesProvider() { public String[] getPackages(String authority, int userId) { return ContentService.this.getSyncAdapterPackagesForAuthorityAsUser(authority, userId); } }); IntentFilter packageFilter = new IntentFilter(); packageFilter.addAction("android.intent.action.PACKAGE_ADDED"); packageFilter.addAction("android.intent.action.PACKAGE_CHANGED"); packageFilter.addAction("android.intent.action.PACKAGE_REMOVED"); packageFilter.addAction("android.intent.action.PACKAGE_DATA_CLEARED"); packageFilter.addDataScheme("package"); this.mContext.registerReceiverAsUser(this.mCacheReceiver, UserHandle.ALL, packageFilter, null, null); IntentFilter localeFilter = new IntentFilter(); localeFilter.addAction("android.intent.action.LOCALE_CHANGED"); this.mContext.registerReceiverAsUser(this.mCacheReceiver, UserHandle.ALL, localeFilter, null, null); } void systemReady() { getSyncManager(); } public void registerContentObserver(Uri uri, boolean notifyForDescendants, IContentObserver observer, int userHandle, int targetSdkVersion) { if (observer == null || uri == null) { throw new IllegalArgumentException("You must pass a valid uri and observer"); } int uid = Binder.getCallingUid(); int pid = Binder.getCallingPid(); userHandle = handleIncomingUser(uri, pid, uid, 1, true, userHandle); String msg = ((ActivityManagerInternal) LocalServices.getService(ActivityManagerInternal.class)).checkContentProviderAccess(uri.getAuthority(), userHandle); if (msg != null) { String pkgName = this.mContext.getPackageManager().getNameForUid(uid); if (OppoMultiAppManager.USER_ID == UserHandle.getUserId(uid) && OppoMultiAppManagerUtil.getInstance().isMultiApp(pkgName) && msg.startsWith("Failed to find provider")) { userHandle = -1; } else if (targetSdkVersion >= 26) { throw new SecurityException(msg); } else if (!msg.startsWith("Failed to find provider")) { Log.w(TAG, "Ignoring content changes for " + uri + " from " + uid + ": " + msg); return; } } synchronized (this.mRootNode) { this.mRootNode.addObserverLocked(uri, observer, notifyForDescendants, this.mRootNode, uid, pid, userHandle); } } public void registerContentObserver(Uri uri, boolean notifyForDescendants, IContentObserver observer) { registerContentObserver(uri, notifyForDescendants, observer, UserHandle.getCallingUserId(), 10000); } public void unregisterContentObserver(IContentObserver observer) { if (observer == null) { throw new IllegalArgumentException("You must pass a valid observer"); } synchronized (this.mRootNode) { this.mRootNode.removeObserverLocked(observer); } } public void notifyChange(Uri uri, IContentObserver observer, boolean observerWantsSelfNotifications, int flags, int userHandle, int targetSdkVersion) { Throwable th; if (uri == null) { throw new NullPointerException("Uri must not be null"); } int uid = Binder.getCallingUid(); int pid = Binder.getCallingPid(); int callingUserHandle = UserHandle.getCallingUserId(); userHandle = handleIncomingUser(uri, pid, uid, 2, true, userHandle); String msg = ((ActivityManagerInternal) LocalServices.getService(ActivityManagerInternal.class)).checkContentProviderAccess(uri.getAuthority(), userHandle); if (msg != null) { if (targetSdkVersion >= 26) { throw new SecurityException(msg); } if (!msg.startsWith("Failed to find provider")) { Log.w(TAG, "Ignoring notify for " + uri + " from " + uid + ": " + msg); return; } } long identityToken = clearCallingIdentity(); ArrayList<ObserverCall> calls; try { calls = new ArrayList(); try { synchronized (this.mRootNode) { this.mRootNode.collectObserversLocked(uri, 0, observer, observerWantsSelfNotifications, flags, userHandle, calls); } int numCalls = calls.size(); for (int i = 0; i < numCalls; i++) { ObserverCall oc = (ObserverCall) calls.get(i); try { oc.mObserver.onChange(oc.mSelfChange, uri, userHandle); } catch (RemoteException e) { synchronized (this.mRootNode) { Log.w(TAG, "Found dead observer, removing"); IBinder binder = oc.mObserver.asBinder(); ArrayList<ObserverEntry> list = oc.mNode.mObservers; int numList = list.size(); int j = 0; while (j < numList) { if (((ObserverEntry) list.get(j)).observer.asBinder() == binder) { list.remove(j); j--; numList--; } j++; } } } } if ((flags & 1) != 0) { SyncManager syncManager = getSyncManager(); if (syncManager != null) { syncManager.scheduleLocalSync(null, callingUserHandle, uid, uri.getAuthority()); } } synchronized (this.mCache) { invalidateCacheLocked(userHandle, getProviderPackageName(uri), uri); } if (calls != null) { calls.clear(); } restoreCallingIdentity(identityToken); } catch (Throwable th2) { th = th2; if (calls != null) { calls.clear(); } restoreCallingIdentity(identityToken); throw th; } } catch (Throwable th3) { th = th3; calls = null; if (calls != null) { calls.clear(); } restoreCallingIdentity(identityToken); throw th; } } private int checkUriPermission(Uri uri, int pid, int uid, int modeFlags, int userHandle) { try { return ActivityManager.getService().checkUriPermission(uri, pid, uid, modeFlags, userHandle, null); } catch (RemoteException e) { return -1; } } public void notifyChange(Uri uri, IContentObserver observer, boolean observerWantsSelfNotifications, boolean syncToNetwork) { notifyChange(uri, observer, observerWantsSelfNotifications, syncToNetwork ? 1 : 0, UserHandle.getCallingUserId(), 10000); } public void requestSync(Account account, String authority, Bundle extras) { Bundle.setDefusable(extras, true); ContentResolver.validateSyncExtrasBundle(extras); int userId = UserHandle.getCallingUserId(); int uId = Binder.getCallingUid(); long identityToken = clearCallingIdentity(); try { SyncManager syncManager = getSyncManager(); if (syncManager != null) { syncManager.scheduleSync(account, userId, uId, authority, extras, -2); } restoreCallingIdentity(identityToken); } catch (Throwable th) { restoreCallingIdentity(identityToken); } } public void sync(SyncRequest request) { syncAsUser(request, UserHandle.getCallingUserId()); } private long clampPeriod(long period) { long minPeriod = JobInfo.getMinPeriodMillis() / 1000; if (period >= minPeriod) { return period; } Slog.w(TAG, "Requested poll frequency of " + period + " seconds being rounded up to " + minPeriod + "s."); return minPeriod; } public void syncAsUser(SyncRequest request, int userId) { enforceCrossUserPermission(userId, "no permission to request sync as user: " + userId); int callerUid = Binder.getCallingUid(); long identityToken = clearCallingIdentity(); try { SyncManager syncManager = getSyncManager(); if (syncManager != null) { Bundle extras = request.getBundle(); long flextime = request.getSyncFlexTime(); long runAtTime = request.getSyncRunTime(); if (request.isPeriodic()) { this.mContext.enforceCallingOrSelfPermission("android.permission.WRITE_SYNC_SETTINGS", "no permission to write the sync settings"); EndPoint info = new EndPoint(request.getAccount(), request.getProvider(), userId); runAtTime = clampPeriod(runAtTime); getSyncManager().updateOrAddPeriodicSync(info, runAtTime, flextime, extras); String pkgName = getSyncManager().getPackageNameForEndPoint(info); if (pkgName != null) { Map<String, String> syncMap = new HashMap(); syncMap.put("PackageName", pkgName); syncMap.put("Authority", request.getProvider()); syncMap.put("Frequency", Long.toString(runAtTime)); OppoStatistics.onCommon(this.mContext, "addPeriodicSync", "PeriodicSyncEvent", syncMap, false); } } else { syncManager.scheduleSync(request.getAccount(), userId, callerUid, request.getProvider(), extras, -2); } restoreCallingIdentity(identityToken); } } finally { restoreCallingIdentity(identityToken); } } public void cancelSync(Account account, String authority, ComponentName cname) { cancelSyncAsUser(account, authority, cname, UserHandle.getCallingUserId()); } public void cancelSyncAsUser(Account account, String authority, ComponentName cname, int userId) { if (authority == null || authority.length() != 0) { enforceCrossUserPermission(userId, "no permission to modify the sync settings for user " + userId); long identityToken = clearCallingIdentity(); if (cname != null) { Slog.e(TAG, "cname not null."); return; } try { SyncManager syncManager = getSyncManager(); if (syncManager != null) { EndPoint info = new EndPoint(account, authority, userId); syncManager.clearScheduledSyncOperations(info); syncManager.cancelActiveSync(info, null, "API"); } restoreCallingIdentity(identityToken); } catch (Throwable th) { restoreCallingIdentity(identityToken); } } else { throw new IllegalArgumentException("Authority must be non-empty"); } } public void cancelRequest(SyncRequest request) { SyncManager syncManager = getSyncManager(); if (syncManager != null) { int userId = UserHandle.getCallingUserId(); int callingUid = Binder.getCallingUid(); long identityToken = clearCallingIdentity(); try { Bundle extras = new Bundle(request.getBundle()); EndPoint info = new EndPoint(request.getAccount(), request.getProvider(), userId); if (request.isPeriodic()) { this.mContext.enforceCallingOrSelfPermission("android.permission.WRITE_SYNC_SETTINGS", "no permission to write the sync settings"); getSyncManager().removePeriodicSync(info, extras, "cancelRequest() by uid=" + callingUid); } syncManager.cancelScheduledSyncOperation(info, extras); syncManager.cancelActiveSync(info, extras, "API"); } finally { restoreCallingIdentity(identityToken); } } } public SyncAdapterType[] getSyncAdapterTypes() { return getSyncAdapterTypesAsUser(UserHandle.getCallingUserId()); } public SyncAdapterType[] getSyncAdapterTypesAsUser(int userId) { enforceCrossUserPermission(userId, "no permission to read sync settings for user " + userId); long identityToken = clearCallingIdentity(); try { SyncAdapterType[] syncAdapterTypes = getSyncManager().getSyncAdapterTypes(userId); return syncAdapterTypes; } finally { restoreCallingIdentity(identityToken); } } public String[] getSyncAdapterPackagesForAuthorityAsUser(String authority, int userId) { enforceCrossUserPermission(userId, "no permission to read sync settings for user " + userId); long identityToken = clearCallingIdentity(); try { String[] syncAdapterPackagesForAuthorityAsUser = getSyncManager().getSyncAdapterPackagesForAuthorityAsUser(authority, userId); return syncAdapterPackagesForAuthorityAsUser; } finally { restoreCallingIdentity(identityToken); } } public boolean getSyncAutomatically(Account account, String providerName) { return getSyncAutomaticallyAsUser(account, providerName, UserHandle.getCallingUserId()); } public boolean getSyncAutomaticallyAsUser(Account account, String providerName, int userId) { enforceCrossUserPermission(userId, "no permission to read the sync settings for user " + userId); this.mContext.enforceCallingOrSelfPermission("android.permission.READ_SYNC_SETTINGS", "no permission to read the sync settings"); long identityToken = clearCallingIdentity(); try { SyncManager syncManager = getSyncManager(); if (syncManager != null) { boolean syncAutomatically = syncManager.getSyncStorageEngine().getSyncAutomatically(account, userId, providerName); return syncAutomatically; } restoreCallingIdentity(identityToken); return false; } finally { restoreCallingIdentity(identityToken); } } public void setSyncAutomatically(Account account, String providerName, boolean sync) { setSyncAutomaticallyAsUser(account, providerName, sync, UserHandle.getCallingUserId()); } public void setSyncAutomaticallyAsUser(Account account, String providerName, boolean sync, int userId) { if (TextUtils.isEmpty(providerName)) { throw new IllegalArgumentException("Authority must be non-empty"); } this.mContext.enforceCallingOrSelfPermission("android.permission.WRITE_SYNC_SETTINGS", "no permission to write the sync settings"); enforceCrossUserPermission(userId, "no permission to modify the sync settings for user " + userId); long identityToken = clearCallingIdentity(); try { SyncManager syncManager = getSyncManager(); if (syncManager != null) { syncManager.getSyncStorageEngine().setSyncAutomatically(account, userId, providerName, sync); } restoreCallingIdentity(identityToken); } catch (Throwable th) { restoreCallingIdentity(identityToken); } } public void addPeriodicSync(Account account, String authority, Bundle extras, long pollFrequency) { Bundle.setDefusable(extras, true); if (account == null) { throw new IllegalArgumentException("Account must not be null"); } else if (TextUtils.isEmpty(authority)) { throw new IllegalArgumentException("Authority must not be empty."); } else { this.mContext.enforceCallingOrSelfPermission("android.permission.WRITE_SYNC_SETTINGS", "no permission to write the sync settings"); int userId = UserHandle.getCallingUserId(); pollFrequency = clampPeriod(pollFrequency); long defaultFlex = SyncStorageEngine.calculateDefaultFlexTime(pollFrequency); long identityToken = clearCallingIdentity(); try { EndPoint info = new EndPoint(account, authority, userId); getSyncManager().updateOrAddPeriodicSync(info, pollFrequency, defaultFlex, extras); String pkgName = getSyncManager().getPackageNameForEndPoint(info); if (pkgName != null) { Map<String, String> syncMap = new HashMap(); syncMap.put("PackageName", pkgName); syncMap.put("Authority", authority); syncMap.put("Frequency", Long.toString(pollFrequency)); OppoStatistics.onCommon(this.mContext, "addPeriodicSync", "PeriodicSyncEvent", syncMap, false); } restoreCallingIdentity(identityToken); } catch (Throwable th) { restoreCallingIdentity(identityToken); } } } public void removePeriodicSync(Account account, String authority, Bundle extras) { Bundle.setDefusable(extras, true); if (account == null) { throw new IllegalArgumentException("Account must not be null"); } else if (TextUtils.isEmpty(authority)) { throw new IllegalArgumentException("Authority must not be empty"); } else { this.mContext.enforceCallingOrSelfPermission("android.permission.WRITE_SYNC_SETTINGS", "no permission to write the sync settings"); int callingUid = Binder.getCallingUid(); int userId = UserHandle.getCallingUserId(); long identityToken = clearCallingIdentity(); try { getSyncManager().removePeriodicSync(new EndPoint(account, authority, userId), extras, "removePeriodicSync() by uid=" + callingUid); } finally { restoreCallingIdentity(identityToken); } } } public List<PeriodicSync> getPeriodicSyncs(Account account, String providerName, ComponentName cname) { if (account == null) { throw new IllegalArgumentException("Account must not be null"); } else if (TextUtils.isEmpty(providerName)) { throw new IllegalArgumentException("Authority must not be empty"); } else { this.mContext.enforceCallingOrSelfPermission("android.permission.READ_SYNC_SETTINGS", "no permission to read the sync settings"); int userId = UserHandle.getCallingUserId(); long identityToken = clearCallingIdentity(); try { List<PeriodicSync> periodicSyncs = getSyncManager().getPeriodicSyncs(new EndPoint(account, providerName, userId)); return periodicSyncs; } finally { restoreCallingIdentity(identityToken); } } } public int getIsSyncable(Account account, String providerName) { return getIsSyncableAsUser(account, providerName, UserHandle.getCallingUserId()); } public int getIsSyncableAsUser(Account account, String providerName, int userId) { enforceCrossUserPermission(userId, "no permission to read the sync settings for user " + userId); this.mContext.enforceCallingOrSelfPermission("android.permission.READ_SYNC_SETTINGS", "no permission to read the sync settings"); long identityToken = clearCallingIdentity(); try { SyncManager syncManager = getSyncManager(); if (syncManager != null) { int computeSyncable = syncManager.computeSyncable(account, userId, providerName, false); return computeSyncable; } restoreCallingIdentity(identityToken); return -1; } finally { restoreCallingIdentity(identityToken); } } public void setIsSyncable(Account account, String providerName, int syncable) { if (TextUtils.isEmpty(providerName)) { throw new IllegalArgumentException("Authority must not be empty"); } this.mContext.enforceCallingOrSelfPermission("android.permission.WRITE_SYNC_SETTINGS", "no permission to write the sync settings"); syncable = normalizeSyncable(syncable); int userId = UserHandle.getCallingUserId(); long identityToken = clearCallingIdentity(); try { SyncManager syncManager = getSyncManager(); if (syncManager != null) { syncManager.getSyncStorageEngine().setIsSyncable(account, userId, providerName, syncable); } restoreCallingIdentity(identityToken); } catch (Throwable th) { restoreCallingIdentity(identityToken); } } public boolean getMasterSyncAutomatically() { return getMasterSyncAutomaticallyAsUser(UserHandle.getCallingUserId()); } public boolean getMasterSyncAutomaticallyAsUser(int userId) { enforceCrossUserPermission(userId, "no permission to read the sync settings for user " + userId); this.mContext.enforceCallingOrSelfPermission("android.permission.READ_SYNC_SETTINGS", "no permission to read the sync settings"); long identityToken = clearCallingIdentity(); try { SyncManager syncManager = getSyncManager(); if (syncManager != null) { boolean masterSyncAutomatically = syncManager.getSyncStorageEngine().getMasterSyncAutomatically(userId); return masterSyncAutomatically; } restoreCallingIdentity(identityToken); return false; } finally { restoreCallingIdentity(identityToken); } } public void setMasterSyncAutomatically(boolean flag) { setMasterSyncAutomaticallyAsUser(flag, UserHandle.getCallingUserId()); } public void setMasterSyncAutomaticallyAsUser(boolean flag, int userId) { enforceCrossUserPermission(userId, "no permission to set the sync status for user " + userId); this.mContext.enforceCallingOrSelfPermission("android.permission.WRITE_SYNC_SETTINGS", "no permission to write the sync settings"); long identityToken = clearCallingIdentity(); try { SyncManager syncManager = getSyncManager(); if (syncManager != null) { syncManager.getSyncStorageEngine().setMasterSyncAutomatically(flag, userId); } restoreCallingIdentity(identityToken); } catch (Throwable th) { restoreCallingIdentity(identityToken); } } public boolean isSyncActive(Account account, String authority, ComponentName cname) { this.mContext.enforceCallingOrSelfPermission("android.permission.READ_SYNC_STATS", "no permission to read the sync stats"); int userId = UserHandle.getCallingUserId(); long identityToken = clearCallingIdentity(); try { SyncManager syncManager = getSyncManager(); if (syncManager == null) { return false; } boolean isSyncActive = syncManager.getSyncStorageEngine().isSyncActive(new EndPoint(account, authority, userId)); restoreCallingIdentity(identityToken); return isSyncActive; } finally { restoreCallingIdentity(identityToken); } } public List<SyncInfo> getCurrentSyncs() { return getCurrentSyncsAsUser(UserHandle.getCallingUserId()); } public List<SyncInfo> getCurrentSyncsAsUser(int userId) { enforceCrossUserPermission(userId, "no permission to read the sync settings for user " + userId); this.mContext.enforceCallingOrSelfPermission("android.permission.READ_SYNC_STATS", "no permission to read the sync stats"); boolean canAccessAccounts = this.mContext.checkCallingOrSelfPermission(OppoPermissionConstants.PERMISSION_GET_ACCOUNTS) == 0; long identityToken = clearCallingIdentity(); try { List<SyncInfo> currentSyncsCopy = getSyncManager().getSyncStorageEngine().getCurrentSyncsCopy(userId, canAccessAccounts); return currentSyncsCopy; } finally { restoreCallingIdentity(identityToken); } } public SyncStatusInfo getSyncStatus(Account account, String authority, ComponentName cname) { return getSyncStatusAsUser(account, authority, cname, UserHandle.getCallingUserId()); } public SyncStatusInfo getSyncStatusAsUser(Account account, String authority, ComponentName cname, int userId) { if (TextUtils.isEmpty(authority)) { throw new IllegalArgumentException("Authority must not be empty"); } enforceCrossUserPermission(userId, "no permission to read the sync stats for user " + userId); this.mContext.enforceCallingOrSelfPermission("android.permission.READ_SYNC_STATS", "no permission to read the sync stats"); long identityToken = clearCallingIdentity(); try { SyncManager syncManager = getSyncManager(); if (syncManager == null) { return null; } if (account == null || authority == null) { throw new IllegalArgumentException("Must call sync status with valid authority"); } SyncStatusInfo statusByAuthority = syncManager.getSyncStorageEngine().getStatusByAuthority(new EndPoint(account, authority, userId)); restoreCallingIdentity(identityToken); return statusByAuthority; } finally { restoreCallingIdentity(identityToken); } } public boolean isSyncPending(Account account, String authority, ComponentName cname) { return isSyncPendingAsUser(account, authority, cname, UserHandle.getCallingUserId()); } public boolean isSyncPendingAsUser(Account account, String authority, ComponentName cname, int userId) { this.mContext.enforceCallingOrSelfPermission("android.permission.READ_SYNC_STATS", "no permission to read the sync stats"); enforceCrossUserPermission(userId, "no permission to retrieve the sync settings for user " + userId); long identityToken = clearCallingIdentity(); SyncManager syncManager = getSyncManager(); if (syncManager == null) { return false; } if (account == null || authority == null) { throw new IllegalArgumentException("Invalid authority specified"); } try { boolean isSyncPending = syncManager.getSyncStorageEngine().isSyncPending(new EndPoint(account, authority, userId)); return isSyncPending; } finally { restoreCallingIdentity(identityToken); } } public void addStatusChangeListener(int mask, ISyncStatusObserver callback) { long identityToken = clearCallingIdentity(); try { SyncManager syncManager = getSyncManager(); if (!(syncManager == null || callback == null)) { syncManager.getSyncStorageEngine().addStatusChangeListener(mask, callback); } restoreCallingIdentity(identityToken); } catch (Throwable th) { restoreCallingIdentity(identityToken); } } public void removeStatusChangeListener(ISyncStatusObserver callback) { long identityToken = clearCallingIdentity(); try { SyncManager syncManager = getSyncManager(); if (!(syncManager == null || callback == null)) { syncManager.getSyncStorageEngine().removeStatusChangeListener(callback); } restoreCallingIdentity(identityToken); } catch (Throwable th) { restoreCallingIdentity(identityToken); } } private String getProviderPackageName(Uri uri) { ProviderInfo pi = this.mContext.getPackageManager().resolveContentProvider(uri.getAuthority(), 0); if (pi != null) { return pi.packageName; } return null; } private ArrayMap<Pair<String, Uri>, Bundle> findOrCreateCacheLocked(int userId, String providerPackageName) { ArrayMap<String, ArrayMap<Pair<String, Uri>, Bundle>> userCache = (ArrayMap) this.mCache.get(userId); if (userCache == null) { userCache = new ArrayMap(); this.mCache.put(userId, userCache); } ArrayMap<Pair<String, Uri>, Bundle> packageCache = (ArrayMap) userCache.get(providerPackageName); if (packageCache != null) { return packageCache; } packageCache = new ArrayMap(); userCache.put(providerPackageName, packageCache); return packageCache; } private void invalidateCacheLocked(int userId, String providerPackageName, Uri uri) { ArrayMap<String, ArrayMap<Pair<String, Uri>, Bundle>> userCache = (ArrayMap) this.mCache.get(userId); if (userCache != null) { ArrayMap<Pair<String, Uri>, Bundle> packageCache = (ArrayMap) userCache.get(providerPackageName); if (packageCache != null) { if (uri != null) { int i = 0; while (i < packageCache.size()) { Pair<String, Uri> key = (Pair) packageCache.keyAt(i); if (key.second == null || !((Uri) key.second).toString().startsWith(uri.toString())) { i++; } else { packageCache.removeAt(i); } } } else { packageCache.clear(); } } } } public void putCache(String packageName, Uri key, Bundle value, int userId) { Bundle.setDefusable(value, true); enforceCrossUserPermission(userId, TAG); this.mContext.enforceCallingOrSelfPermission("android.permission.CACHE_CONTENT", TAG); ((AppOpsManager) this.mContext.getSystemService(AppOpsManager.class)).checkPackage(Binder.getCallingUid(), packageName); String providerPackageName = getProviderPackageName(key); Pair<String, Uri> fullKey = Pair.create(packageName, key); synchronized (this.mCache) { ArrayMap<Pair<String, Uri>, Bundle> cache = findOrCreateCacheLocked(userId, providerPackageName); if (value != null) { cache.put(fullKey, value); } else { cache.remove(fullKey); } } } public Bundle getCache(String packageName, Uri key, int userId) { Bundle bundle; enforceCrossUserPermission(userId, TAG); this.mContext.enforceCallingOrSelfPermission("android.permission.CACHE_CONTENT", TAG); ((AppOpsManager) this.mContext.getSystemService(AppOpsManager.class)).checkPackage(Binder.getCallingUid(), packageName); String providerPackageName = getProviderPackageName(key); Pair<String, Uri> fullKey = Pair.create(packageName, key); synchronized (this.mCache) { bundle = (Bundle) findOrCreateCacheLocked(userId, providerPackageName).get(fullKey); } return bundle; } private int handleIncomingUser(Uri uri, int pid, int uid, int modeFlags, boolean allowNonFull, int userId) { if (userId == -2) { userId = ActivityManager.getCurrentUser(); } if (userId == -1) { this.mContext.enforceCallingOrSelfPermission("android.permission.INTERACT_ACROSS_USERS_FULL", TAG); } else if (userId < 0) { throw new IllegalArgumentException("Invalid user: " + userId); } else if (!(userId == UserHandle.getCallingUserId() || checkUriPermission(uri, pid, uid, modeFlags, userId) == 0)) { boolean allow = false; if (this.mContext.checkCallingOrSelfPermission("android.permission.INTERACT_ACROSS_USERS_FULL") == 0) { allow = true; } else if (allowNonFull && this.mContext.checkCallingOrSelfPermission("android.permission.INTERACT_ACROSS_USERS") == 0) { allow = true; } if (!allow) { String permissions; if (allowNonFull) { permissions = "android.permission.INTERACT_ACROSS_USERS_FULL or android.permission.INTERACT_ACROSS_USERS"; } else { permissions = "android.permission.INTERACT_ACROSS_USERS_FULL"; } throw new SecurityException("ContentServiceNeither user " + uid + " nor current process has " + permissions); } } return userId; } private void enforceCrossUserPermission(int userHandle, String message) { if (UserHandle.getCallingUserId() != userHandle) { this.mContext.enforceCallingOrSelfPermission("android.permission.INTERACT_ACROSS_USERS_FULL", message); } } private static int normalizeSyncable(int syncable) { if (syncable > 0) { return 1; } if (syncable == 0) { return 0; } return -2; } }
cda0cfc93a772b75aec0ca8917ca5207da492b15
a1647f3a5fd0120b0a9556566f534891b2781c22
/app/src/main/java/com/dbsearch/app/App.java
b130b65defecb02e52bf580b3f12b55f62d75b15
[]
no_license
kydzhou/DbSearch
8c26c6d1c193861294abb7979d29febfa26b346a
65abbd16794f073fa0cfb9ad6f64c4a8aa91c852
refs/heads/master
2021-01-10T08:01:53.075530
2015-11-18T17:47:26
2015-11-18T17:47:26
46,435,196
0
0
null
null
null
null
UTF-8
Java
false
false
927
java
package com.dbsearch.app; import android.app.Application; import com.dbsearch.app.BuildConfig; import com.dbsearch.app.module.AppModule; import java.util.Arrays; import java.util.List; import cn.bmob.v3.Bmob; import dagger.ObjectGraph; public class App extends Application{ private ObjectGraph objectGraph; @Override public void onCreate() { super.onCreate(); objectGraph = ObjectGraph.create(getModules().toArray()); objectGraph.inject(this); Bmob.initialize(this, BuildConfig.BMOB_KEY); } @Override public void onTerminate() { super.onTerminate(); } @Override public void onLowMemory() { super.onLowMemory(); } private List<Object> getModules() { return Arrays.<Object>asList(new AppModule(this)); } public ObjectGraph createScopedGraph(Object... modules) { return objectGraph.plus(modules); } }
c13726f0a519ac914e280a0f4f1853e194840044
b7cf3ca13b042c7b67e825385044bd1c69ce471c
/src/hibernateFirst/GetEmployeeCache.java
7dcd10c701bd7e4f284bf14a4489656fd6a878f0
[]
no_license
tanusgit/hibernateProject
9ee59a480de428a71d24d9b6a84a36550737d90d
34c1451c0da2852692c8c375b2d0183bc9163c30
refs/heads/master
2021-05-18T07:34:45.307086
2020-04-12T21:18:24
2020-04-12T21:18:24
251,181,965
0
0
null
null
null
null
UTF-8
Java
false
false
1,454
java
package hibernateFirst; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import hibernateFirst.Employee; public class GetEmployeeCache { // Ge Employee By Id public static void main(String[] args) { SessionFactory sf = new Configuration().configure().buildSessionFactory(); Session session = sf.openSession(); System.out.println("*******SESSION1 OPNED********"); int id = 46; System.out.println("****call load method ****"); Employee emp = (Employee) session.load(Employee.class, id); // fetches from the database and keeps inside cache System.out.println(emp); System.out.println("****call load method ****"); Employee emp1 = (Employee) session.load(Employee.class, id); // fetches from cache System.out.println(emp1); session.close();// Cache is cleared System.out.println("*******SESSION1 CLOSED********"); Session session2 = sf.openSession(); System.out.println("*******SESSION2 OPNED********"); System.out.println("****call load method ****"); Employee emp3 = (Employee) session2.load(Employee.class, id); // cache is populated , db all System.out.println(emp3); System.out.println("****call load method ****"); Employee emp4 = (Employee) session2.load(Employee.class, id);// no db call , get from cache System.out.println(emp4); session2.close(); // Cache is cleared System.out.println("*******SESSION2 CLOSED********"); } }
3c72d534ad3241147d8a4bb66e5af16ac0b96c28
94c1b48544e2cf48d95e8448064868679d5d53bd
/leyou/leyou-item/leyou-item-service/src/main/java/com/leyou/item/controller/CategoryController.java
44e418effbfe3ccaeb1f7d2bf2b552ba7428f1ba
[]
no_license
itencrazy/leyou
9dd8c1cf244c0cd10fc4dfefefaea17c972b6832
ba33886219a1c82b2963e939eab59daf73d153de
refs/heads/master
2022-12-15T08:56:49.541206
2020-02-21T14:16:02
2020-02-21T14:16:02
242,145,565
0
0
null
2020-02-21T13:50:28
2020-02-21T13:28:48
Java
UTF-8
Java
false
false
2,120
java
package com.leyou.item.controller; import com.leyou.item.pojo.Category; import com.leyou.item.service.CategoryService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import java.util.List; @Controller @RequestMapping("category") public class CategoryController { @Autowired private CategoryService categoryService; /** * 根据父节点的id查询子节点 * @param pid * @return */ @GetMapping("list") public ResponseEntity<List<Category>> queryCategoriesByPid(@RequestParam(value = "pid",defaultValue = "0") Long pid) { try {//可以不cry,catch if (pid ==null || pid < 0) { //返回400:参数不合法 return ResponseEntity.badRequest().build(); } List<Category> categories = categoryService.queryCategoriesByPid(pid); if (CollectionUtils.isEmpty(categories)) { // 响应404:资源服务器未找到 return ResponseEntity.notFound().build(); } //200:查询成功 return ResponseEntity.ok(categories); } catch (Exception e) { e.printStackTrace(); } //500:服务器内部错误 return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build(); } @GetMapping public ResponseEntity<List<String>> queryNamesByIds(@RequestParam("ids") List<Long> ids) { List<String> names = categoryService.queryNamesByIds(ids); if (CollectionUtils.isEmpty(names)) { // 响应404:资源服务器未找到 return ResponseEntity.notFound().build(); } //200:查询成功 return ResponseEntity.ok(names); } }
f83fa870abbd3b822ab677edac72b10f5479c9bc
e835688bd03efa5a88071cc9d5858e6f76024ec0
/mysell/src/main/java/com/demo/entity/ProductInfo.java
47027ec078ee4af52cf745be408f853bb6aeaeab
[]
no_license
GSIL-Monitor/java
2338ac232444db6a29ad6940154ab71fd0ce07ed
358846e47948020a2b3c1efcad670221aa9ac428
refs/heads/master
2020-04-10T23:05:05.229952
2018-12-10T13:35:47
2018-12-10T13:35:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
650
java
package com.demo.entity; import com.demo.enums.ProductStatusEnum; import lombok.Data; import org.hibernate.annotations.DynamicUpdate; import javax.persistence.Entity; import javax.persistence.Id; import java.math.BigDecimal; import java.util.Date; @Data @Entity @DynamicUpdate public class ProductInfo { @Id private String productId; private String productName; private BigDecimal productPrice; private Integer productStock; private String productDescription; private String productIcon; private Integer productStatus=ProductStatusEnum.UP.getCode(); private Integer categoryType; private Date createTime; private Date updateTime; }
aa1ae60889b47a1c0e5f5c606ef95198c986dd37
e8e11da76276fb925145211887d9df6259eab1e5
/app/src/main/java/ua/com/ukrelektro/passwordrec/DAO/DataBaseHelper.java
fc204df1af7ab7c2b1a293f492d561f74e91fb8f
[]
no_license
AndZp/PasswordRecovery
e24f507e6b01e3d35308652242c3d08811318080
4329eedc0f90fe1ac00b178a5fa46356486adfc9
refs/heads/master
2016-09-01T14:17:43.249038
2015-12-11T15:58:18
2015-12-11T15:58:18
45,784,539
0
0
null
null
null
null
UTF-8
Java
false
false
4,087
java
package ua.com.ukrelektro.passwordrec.DAO; import android.content.ContentValues; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.provider.BaseColumns; import java.text.SimpleDateFormat; import java.util.ArrayList; import ua.com.ukrelektro.passwordrec.R; import ua.com.ukrelektro.passwordrec.model.Code; import ua.com.ukrelektro.passwordrec.provider.ContractClass; /** * Created by User on 11.12.2015. */ public class DataBaseHelper extends SQLiteOpenHelper { private Context context; public static final int PASSCODES_FILE = R.raw.passcode; private SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm"); private static final String DATABASE_NAME = "codesDB"; private static final int DATABASE_VERSION = 1; private static final String CODE_TABLE_NAME = ContractClass.Codes.CODES_TABLE_NAME; private static final String STATE_TABLE_NAME = ContractClass.Codes.STATE_TABLE_NAME; private static final String CODE_COLUMN = "code"; private static final String COUNT_COLUMN = "count"; private static final String STATUS_COLUMN = "status"; private static final String DATE_COLUMN = "date"; private static final String NUMBERS_CODES_COLUMN = "number"; private static final String NUMBERS_CHEKED_CODES_COLUMN = "checked"; private static final String SUM_COUNT_COLUMN = "sumCount"; private static final String SUM_CHEKED_COUNT_COLUMN = "sumCheckedCount"; private static final String CODES_DATABASE_CREATE_SCRIPT = "create table " + CODE_TABLE_NAME + " (" + BaseColumns._ID + " integer primary key autoincrement, " + CODE_COLUMN + " integer, " + COUNT_COLUMN + " integer, " + STATUS_COLUMN + " TEXT not null, " + DATE_COLUMN + " TEXT);"; private static final String STATUS_DATABASE_CREATE_SCRIPT = "create table " + STATE_TABLE_NAME + " (" + BaseColumns._ID + " integer primary key autoincrement, " + NUMBERS_CODES_COLUMN + " integer, " + NUMBERS_CHEKED_CODES_COLUMN + " integer, " + STATUS_COLUMN + " integer, " + SUM_COUNT_COLUMN + " integer, " + SUM_CHEKED_COUNT_COLUMN + " integer);"; public DataBaseHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); this.context = context; } @Override public void onCreate(SQLiteDatabase db) { db.execSQL(CODES_DATABASE_CREATE_SCRIPT); db.execSQL(STATUS_DATABASE_CREATE_SCRIPT); ArrayList<Code> codesFromCSV = CSVParser.getListCodesFromCSV(context.getResources().openRawResource(PASSCODES_FILE)); saveListCodesToDataBase(codesFromCSV, db); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + CODE_TABLE_NAME); onCreate(db); } /** * Save list of codes in Database * * @param codesList list of codes * @param db database */ private void saveListCodesToDataBase(ArrayList<Code> codesList, SQLiteDatabase db) { int numbersCodes = 0; int sumCounts = 0; ContentValues values; for (int i = 0; i < codesList.size(); i++) { values = new ContentValues(); Code code = codesList.get(i); numbersCodes++; sumCounts += code.getCount(); values.put(CODE_COLUMN, code.getCode()); values.put(COUNT_COLUMN, code.getCount()); values.put(STATUS_COLUMN, code.getStatus().toString()); if (code.getDate() != null) values.put(DATE_COLUMN, dateFormat.format(code.getDate())); db.insert(CODE_TABLE_NAME, COUNT_COLUMN, values); } values = new ContentValues(); values.put(NUMBERS_CODES_COLUMN, numbersCodes); values.put(SUM_COUNT_COLUMN, sumCounts); db.insert(STATE_TABLE_NAME, NUMBERS_CODES_COLUMN, values ); } }
2784d6c89ae302998537a7aec34f338d07af50db
aa4353cd655e083400429c7eb1170b968528b01a
/Binary Tree:BST (50)/maximum-depth-of-n-ary-tree(559).java
a4c0bda002d99038540bd2722b2e8a6b0c28de44
[]
no_license
yangx38/tempLC
819dd5f82370b2ef61800ebb15c83574ece27fb0
90123860150161aeb28bb8864e8a7f5d4354d46c
refs/heads/master
2020-07-11T11:01:12.204392
2019-09-01T04:55:27
2019-09-01T04:55:27
204,520,613
0
0
null
null
null
null
UTF-8
Java
false
false
269
java
// T = O(n) // S = O(h) class Solution { public int maxDepth(Node root) { if(root == null) return 0; int height = 0; for(Node n : root.children) { height = Math.max(height, maxDepth(n)); } return 1+height; } }
bc1d090bb21f47f5f5d5171e4afa5a7cf7ce9e90
98903e865c1292edb00891aec2b06b893008b1a9
/extern/jodis/src/main/java/com/wandoulabs/jodis/auto/util/MemorySizes.java
4bb84d8d4ce6d07fe64343a12d785058c8e1afbe
[ "MIT", "BSD-3-Clause" ]
permissive
haluo/codis
0a0408d512ed0855f474c62bf59d43d4d3e886bf
9d5cd33812ccc5d7d3b1398b8c3d467c41c22066
refs/heads/master
2021-01-24T02:34:49.088927
2015-09-23T02:25:02
2015-09-23T02:25:02
42,095,934
0
0
null
2015-09-08T07:07:45
2015-09-08T07:07:44
null
UTF-8
Java
false
false
973
java
package com.wandoulabs.jodis.auto.util; import java.util.IdentityHashMap; import java.util.Map; /** * Created by zhufeng on 15/9/14. */ public class MemorySizes { private final Map primitiveSizes = new IdentityHashMap() { { put(boolean.class, new Integer(1)); put(byte.class, new Integer(1)); put(char.class, new Integer(2)); put(short.class, new Integer(2)); put(int.class, new Integer(4)); put(float.class, new Integer(4)); put(double.class, new Integer(8)); put(long.class, new Integer(8)); } }; public int getPrimitiveFieldSize(Class clazz) { return ((Integer) primitiveSizes.get(clazz)).intValue(); } public int getPrimitiveArrayElementSize(Class clazz) { return getPrimitiveFieldSize(clazz); } public int getPointerSize() { return 4; } public int getClassSize() { return 8; } }
efccd515c535eb334fd1f43d265d9de9d6a9def2
7badf0bea31b6c38fe32ea7693d468ee8822e761
/src/main/java/com/bean/Expense.java
492f4f7fad23fe2de7ac48a54570b5046e945144
[]
no_license
ankit1100/WebExpense
f679889a07c44f991b52363658d4c5e3d3fa5183
7389f5b31d24994aeb5b65dfc0bc6ac20252b91c
refs/heads/master
2023-07-14T00:14:19.759661
2021-08-22T06:59:28
2021-08-22T06:59:28
398,733,701
0
0
null
null
null
null
UTF-8
Java
false
false
2,329
java
package com.bean; import java.sql.Date; import javax.validation.constraints.NotNull; import org.hibernate.validator.constraints.NotBlank; public class Expense { private int expenseId; @NotNull(message = "Please enter valid amount!") private long amount; // @DateTimeFormat(pattern = "yyyy-mm-dd hh:mm:ss") private Date ExpDateTime; @NotBlank(message = "Please choose a valid status!") private String status; @NotBlank(message = "Please write correct description!") private String description; private String paymentMethod; private String accName; @NotBlank(message = "Please enter the valid sub category!") String input_subCategory; LabelBean label; CategoryBean category; PayeeBean payee; LoginBean user; public int getExpenseId() { return expenseId; } public void setExpenseId(int expenseId) { this.expenseId = expenseId; } public long getAmount() { return amount; } public void setAmount(long amount) { this.amount = amount; } public Date getExpDateTime() { return ExpDateTime; } public void setExpDateTime(Date expDateTime) { ExpDateTime = expDateTime; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getPaymentMethod() { return paymentMethod; } public void setPaymentMethod(String paymentMethod) { this.paymentMethod = paymentMethod; } public String getInput_subCategory() { return input_subCategory; } public void setInput_subCategory(String input_subCategory) { this.input_subCategory = input_subCategory; } public LabelBean getLabel() { return label; } public void setLabel(LabelBean label) { this.label = label; } public CategoryBean getCategory() { return category; } public void setCategory(CategoryBean category) { this.category = category; } public PayeeBean getPayee() { return payee; } public void setPayee(PayeeBean payee) { this.payee = payee; } public LoginBean getUser() { return user; } public void setUser(LoginBean user) { this.user = user; } public String getAccName() { return accName; } public void setAccName(String accName) { this.accName = accName; } }
3fe79754628e904c30eb67f1f2d1bb6c44eec80c
666cdc44c997425435ad01735151d11640b28823
/app/src/main/java/com/proatcoding/pets/adapter/AdapterOffers.java
f8980234713b51de4f4c33aaac1512da1e3a3123
[]
no_license
EslamMohamed3396/PetsStand
a45a8b1adb1eabd903db86386a34a69062415b2e
1abb433a64c2fc514adddfbd0a4c7ac34cd30b29
refs/heads/master
2022-12-16T03:27:03.739035
2020-09-04T15:32:43
2020-09-04T15:32:43
289,558,190
0
0
null
null
null
null
UTF-8
Java
false
false
2,774
java
package com.proatcoding.pets.adapter; import android.content.Context; import android.content.Intent; import androidx.databinding.DataBindingUtil; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.bumptech.glide.Glide; import com.proatcoding.pets.R; import com.proatcoding.pets.activity.food.FoodDetail; import com.proatcoding.pets.databinding.AdapterTopOffersBinding; import com.proatcoding.pets.models.OffersDTO; import com.proatcoding.pets.utils.Consts; import java.util.ArrayList; public class AdapterOffers extends RecyclerView.Adapter<AdapterOffers.MyViewHolder> { private Context mcontext; private ArrayList<OffersDTO> offersDTOArrayList; private AdapterTopOffersBinding binding; private LayoutInflater layoutInflater; public AdapterOffers(Context mcontext, ArrayList<OffersDTO> offersDTOArrayList) { this.mcontext = mcontext; this.offersDTOArrayList = offersDTOArrayList; } @NonNull @Override public MyViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { if (layoutInflater == null) { layoutInflater = LayoutInflater.from(viewGroup.getContext()); } binding = DataBindingUtil.inflate(layoutInflater, R.layout.adapter_top_offers, viewGroup, false); return new MyViewHolder(binding); } @Override public void onBindViewHolder(@NonNull MyViewHolder myViewHolder, final int position) { Glide .with(mcontext) .load(offersDTOArrayList.get(position).getImage()) .placeholder(R.drawable.app_logo) .into(myViewHolder.binding.image); myViewHolder.binding.tvTitle.setText(offersDTOArrayList.get(position).getTitle()); myViewHolder.binding.tvLongDescription.setText(offersDTOArrayList.get(position).getDescription()); myViewHolder.binding.image.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent inn = new Intent(mcontext, FoodDetail.class); inn.putExtra(Consts.PRODUCT_DETAILS,offersDTOArrayList.get(position)); inn.putExtra(Consts.FLAG,1); mcontext.startActivity(inn); } }); } @Override public int getItemCount() { return offersDTOArrayList.size(); } public class MyViewHolder extends RecyclerView.ViewHolder { private AdapterTopOffersBinding binding; public MyViewHolder(@NonNull AdapterTopOffersBinding binding) { super(binding.getRoot()); this.binding = binding; } } }
8bff5acc8b54a3ab3aa3f9ae674b99e0c6593e0b
585a501a18598cadb75b56ab47cf3e23723173ca
/src/saptacims/model/TbGroup.java
c77d7fa059381d92dff0e030dd90a67ffcdc7412
[]
no_license
li1xiang/examSystem
1928e99dd42d3715381fc26594d20ba1e1737491
6f2df2427458207ac2f5fa192c9d80ffac97cf3c
refs/heads/master
2020-04-30T22:40:14.328899
2019-03-31T04:13:19
2019-03-31T04:13:19
177,119,784
0
0
null
null
null
null
UTF-8
Java
false
false
1,725
java
package saptacims.model; import java.io.Serializable; import java.util.Date; public class TbGroup implements Serializable{ private Integer groupId; private String groupName; private Integer groupStatus; private Integer createUser; private Date createTime; private Integer updateUser; private Date updateTime; private String remark; public Integer getGroupId() { return groupId; } public void setGroupId(Integer groupId) { this.groupId = groupId; } public String getGroupName() { return groupName; } public void setGroupName(String groupName) { this.groupName = groupName == null ? null : groupName.trim(); } public Integer getGroupStatus() { return groupStatus; } public void setGroupStatus(Integer groupStatus) { this.groupStatus = groupStatus; } public Integer getCreateUser() { return createUser; } public void setCreateUser(Integer createUser) { this.createUser = createUser; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Integer getUpdateUser() { return updateUser; } public void setUpdateUser(Integer updateUser) { this.updateUser = updateUser; } public Date getUpdateTime() { return updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark == null ? null : remark.trim(); } }
b87b939e4a0fa075a7ae9246f80b7a613a62ba98
16bfa06bb3fb5f1757239a047fa103133c699133
/app/src/main/java/xyz/android/amrro/recipes/ui/recipe/BakingActivity.java
410e9c17312ca6f4528e36a5213490da31142d7e
[]
no_license
amrro/nano-recipes
97470967f97d6a8452417359eff820905b07754b
8f2537f19e43facb4fd1e216cb21796ff074ac34
refs/heads/master
2021-01-15T21:15:40.252143
2017-11-14T00:36:56
2017-11-14T00:36:56
99,858,955
1
0
null
2017-11-13T00:35:48
2017-08-09T22:49:59
Java
UTF-8
Java
false
false
1,698
java
package xyz.android.amrro.recipes.ui.recipe; import android.databinding.DataBindingUtil; import android.os.Bundle; import android.support.v4.view.ViewPager; import xyz.android.amrro.recipes.R; import xyz.android.amrro.recipes.common.BaseActivity; import xyz.android.amrro.recipes.databinding.BakingBinding; public class BakingActivity extends BaseActivity { private BakingBinding binding; private int currentItem; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); binding = DataBindingUtil.setContentView(this, R.layout.activity_baking); setSupportActionBar(binding.toolbar); setHomeEnabled(true); BakingPagerAdapter adapter = new BakingPagerAdapter(getSupportFragmentManager(), itemId()); binding.content.pager.setAdapter(adapter); setUpTabs(); } private void setUpTabs() { binding.content.bottomBar.setOnNavigationItemSelectedListener(item -> { switch (item.getItemId()) { case R.id.nav_ingredient: currentItem = 0; break; case R.id.nav_steps: currentItem = 1; break; } binding.content.pager.setCurrentItem(currentItem); return true; }); binding.content.pager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { currentItem = position; binding.content.bottomBar.getMenu().getItem(currentItem).setChecked(true); } }); } }
d704919951e1d5467d3181e5695d941e1373e084
d5875e5f4470b4c498b86a8f601589ec111da7a8
/app/src/androidTest/java/com/example/android/bakingapptlee/ExampleInstrumentedTest.java
9757b181c339d522157ca8d60c5a929e4c7252bd
[]
no_license
tlee-ta/BakingAppTlee
0a6ca9baf4dd71d424ef5bd896ad18e0c31b72e5
75a50935642e44b96489c3cb453459fe0d1b8981
refs/heads/main
2022-12-27T21:58:17.260022
2020-10-16T18:43:40
2020-10-16T18:43:40
302,664,982
0
0
null
null
null
null
UTF-8
Java
false
false
780
java
package com.example.android.bakingapptlee; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.example.android.bakingapptlee", appContext.getPackageName()); } }
90025f7f1e45d7571f66645f3394ba21748d9a00
8e82ca92cc6dac55efd314a31a41532b52ec078a
/ProyectoAnima03/app/src/test/java/com/alejandro/proyectoanima03/ExampleUnitTest.java
8702fa8647c6d3879eb6a87d220a5a4ad09ba83b
[]
no_license
thealexcod99/AndroidJacinto
b6d3352adf917b2d5813121fa09fe8c9a512ecf5
090a8c35b1d3af964f7845f41cf6e53c1d4a523c
refs/heads/master
2020-08-05T23:56:48.857950
2020-02-24T19:31:09
2020-02-24T19:31:09
212,762,271
0
0
null
null
null
null
UTF-8
Java
false
false
390
java
package com.alejandro.proyectoanima03; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
054eda212e0c68d8371977010ab9aeffa17353ab
1f9bfaacd1f9ff62c2ad5b84a8653a0c79e23c85
/src/main/java1/ejercicios/clases/wrappers/Main.java
7bce3a1737fd63d11f4fbcf1bfba27fbefe6f73e
[]
no_license
Fernando-2001/maven_proyecto_fc
8b899fc5da6b6a88e3e1f05fc0ae5d05b2d12642
972ff45826449ff5a992e42d4c9fc3b7ae4715b6
refs/heads/main
2023-08-16T19:56:11.093285
2021-09-27T21:41:48
2021-09-27T21:41:48
403,783,176
0
0
null
null
null
null
UTF-8
Java
false
false
4,090
java
package ejercicios.clases.wrappers; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub //byte primitivo byte datoByte = 2; Byte datoByteWrapper = 3; //Wrapper System.out.println("Primitivo: "+datoByte); System.out.println("Wrapper: "+datoByteWrapper); //Conversiones byte datoByte1 = 6; Byte datoConvertido = datoByte1; System.out.println("Byte convertido: "+datoConvertido); //Conversiones 2 Byte datoConvertido2 = 6; byte datoByte2 = datoConvertido2.byteValue(); System.out.println("Byte convertido: "+datoByte2); // short short datoShort = 1;//primitivo Short datoShotrtWrapper = 1; // System.out.println("Primitivo: "+datoShort); System.out.println("Wrapper: "+datoShotrtWrapper); //Conversiones short datoShort1 = 2; Short shortConvertido = datoShort1; System.out.println("Byte convertido: "+shortConvertido); //Conversiones 2 Short shortConvertido2 = 2; short datoShort2 = shortConvertido2.shortValue(); System.out.println("Byte convertido: "+datoShort2); //int int edad = 45; //primitivo Integer edadWrapper = 48; //Wrapper System.out.println("Primitivo: "+edad); System.out.println("Wrapper: "+edadWrapper); //Conversiones int edad1 = 45; Integer intConvertido = edad1; System.out.println("Int convertido: "+intConvertido); //conversiones 2 Integer integerConvertido2 = 23; int edad2 = integerConvertido2.intValue(); System.out.println("Int convertido: "+edad2); //long long valorGrande = 125344L; //primitivo Long valorgrandeWrapper= 123123L; // Wrapper System.out.println("Primitivo: "+valorGrande); System.out.println("Wrapper: "+valorgrandeWrapper); //Conversiones long valorGrande1 = 12312L; Long longCompartido = valorGrande1; System.out.println("Long convertido: "+longCompartido); //Conversiones 2 Long longCompartido2 = 2352L; long valorGrande2 = longCompartido2.longValue(); System.out.println("Long convertido: "+valorGrande2); //boolean boolean datoBoolean = true; //primitivo Boolean datoBooleanWrapper = false; //Wrapper System.out.println("Primitivo: "+datoBoolean); System.out.println("Wrapper: "+datoBooleanWrapper); //Conversiones boolean datoBoolean1 = true; Boolean booleanConvertido = datoBoolean1; System.out.println("Boolean convertido: "+booleanConvertido); //Conversiones2 Boolean booleanConvertido2 = false; boolean datoBoolean2 = booleanConvertido2.booleanValue(); System.out.println("Boolean convertido: "+datoBoolean2); //float float datoFloat = 123F;//primitivo Float datoFloatWrapper = 3252F; //Wrapper System.out.println("Primitivo: "+datoFloat); System.out.println("Wrapper: "+datoFloatWrapper); //Conversiones float datoFloat1 = 1245F; Float floatConvertido = datoFloat1; System.out.println("Float convertido: "+floatConvertido); //Conversiones 2 Float floatConvertido2 =2454F; float datoFloat2 = floatConvertido2.floatValue(); System.out.println("Float convertido: "+datoFloat2); //double double DatoDouble = 234; //primitivo Double DatoDoubleWrapper = (double) 123; //Wrapper System.out.println("Primitivo: "+DatoDouble); System.out.println("Wrapper: "+DatoDoubleWrapper); //Conversiones double DatoDouble1 = 254; Double doubleConvertido = DatoDouble1; System.out.println("Double convertido: "+doubleConvertido); //Conversiones2 Double doubleConvertido2 = (double) 234; double DatoDouble2 = doubleConvertido2.doubleValue(); System.out.println("Double convertido: "+DatoDouble2); //char char datoChar = 'a';//primitivo Character datoCharWrapper = 'b';//Wrapper System.out.println("Primitivo: "+datoChar); System.out.println("Wrapper: "+datoCharWrapper); //Conversiones char datoChar1 = 'c'; Character charConvertido = datoChar1; System.out.println("Char convertido: "+charConvertido); //Conversiones2 Character charConvertido2 = 'f'; char datoChar2 = charConvertido2.charValue(); System.out.println("Char convertido: "+datoChar2); } }
da3e95856f1dd750c84b457e512136ed36378047
4d0c6644f344e2802abdbb0b1cb3fe70346f0a37
/application/src/main/java/br/com/sctcc/application/rewrite/RewriteProvider.java
8fa9899a299d6f651d05d8bbd5ff3f02e6fe8934
[]
no_license
Taynan-Vieira/sctcc
85e0ff965c672e7645e90f4fdf46b7d533d552e9
156baf7ae386ad24c1d3682ce0d52b02d8237cfb
refs/heads/master
2021-07-01T06:30:45.938295
2020-02-09T17:56:24
2020-02-09T17:56:24
235,695,583
1
0
null
2021-06-04T22:06:06
2020-01-23T00:28:49
CSS
UTF-8
Java
false
false
1,465
java
package br.com.sctcc.application.rewrite; import org.ocpsoft.rewrite.annotation.RewriteConfiguration; import org.ocpsoft.rewrite.config.Configuration; import org.ocpsoft.rewrite.config.ConfigurationBuilder; import org.ocpsoft.rewrite.servlet.config.HttpConfigurationProvider; import org.ocpsoft.rewrite.servlet.config.rule.Join; import javax.servlet.ServletContext; @RewriteConfiguration public class RewriteProvider extends HttpConfigurationProvider { public static final String DASHBOARD = "/"; public static final String VISUALIZAR_TCCS = "/visualizarTccs"; public static final String ERROR = "/error500"; public static final String ERROR_404 = "/error404"; public static final String ACESSO_NEGADO = "/acessoNegado"; @Override public Configuration getConfiguration(final ServletContext servletContext) { return ConfigurationBuilder .begin() .addRule(Join.path(DASHBOARD).to("/page/public/dashboard.xhtml")) //TCC .addRule(Join.path(VISUALIZAR_TCCS).to("/page/private/tcc/visualizar-tccs.xhtml")) //ACESSO NEGADO .addRule(Join.path(ACESSO_NEGADO).to("/page/public/acesso-negado.xhtml")) //ERRORS .addRule(Join.path(ERROR).to("/error.xhtml")) .addRule(Join.path(ERROR_404).to("/error-404.xhtml")); } @Override public int priority() { return 10; } }
789cc9d551259a9f0947973f75cfb9efe0d60a38
4d06961918ec4382da7261f3e7030b42bbd2eccf
/src/sg/kristjan/ctci/ch03/ex3_3/StackOfPlatesB.java
c113c60c420639c851a893aa381567c77763ebd6
[]
no_license
kristjanr/PrepForTechInt
fe5ceb93b83b15065534112db6af2bdda3557294
124bf77591afae62bf97a6fa39558f2f6d97a7c0
refs/heads/master
2021-06-07T04:16:50.184538
2016-11-10T08:22:47
2016-11-10T08:22:47
72,172,322
0
0
null
null
null
null
UTF-8
Java
false
false
962
java
package sg.kristjan.ctci.ch03.ex3_3; import sg.kristjan.ctci.ch03.Stack; import java.util.ArrayList; class StackOfPlatesB { private ArrayList<Stack> stacks = new ArrayList<>(); private Stack top = new Stack(); private static final int MAX_HEIGHT = 2; private int currentStack = 0; public void push(int data) { if (top.getHeight() == MAX_HEIGHT) { stacks.add(top); top = new Stack(); currentStack += 1; } top.push(data); } public Object pop() { Object data = top.pop(); if (top.getHeight() == 0) { currentStack -= 1; if (currentStack >= 0) { top = stacks.get(currentStack); stacks.remove(currentStack); } else { top = new Stack(); } } return data; } public Object popAt(int index) { return stacks.get(index).pop(); } }
e528cfaedfd76c596a4f3bbdd4cd5eb60c2a4c05
6c48a9cfe19c4e475b24be2558bfdabe82de1863
/src/java/paquete/resuelveEjercicio.java
b8031ca2bf72118645bce1113c109867b851d836
[]
no_license
benjamin024/Proyecto-Web
956ddfb4e2a4e8320597e00aa1fdf15ba945efcd
2ec1f987a36244a109f180291cccf6dd1db0519d
refs/heads/master
2020-07-27T13:24:01.777273
2016-12-08T17:02:38
2016-12-08T17:02:38
73,427,195
0
6
null
2016-12-08T14:53:52
2016-11-10T22:45:15
JavaScript
UTF-8
Java
false
false
2,933
java
package paquete; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.jdom.Document; import org.jdom.Element; import org.jdom.input.SAXBuilder; import org.jdom.output.Format; import org.jdom.output.XMLOutputter; public class resuelveEjercicio extends HttpServlet { String[] respuestas; @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); HttpSession sesion = request.getSession(); int preguntas = Integer.parseInt(request.getParameter("numPreguntas")); respuestas = new String[preguntas]; for(int i = 1; i <= preguntas; i++){ respuestas[i-1] = request.getParameter("pregunta"+i); } try { guardaResultados(sesion.getAttribute("user").toString(),request.getParameter("id"), request.getRealPath("/"), sesion.getAttribute("grupo").toString()); } catch (Exception ex) { Logger.getLogger(resuelveEjercicio.class.getName()).log(Level.SEVERE, null, ex); } response.sendRedirect("calificacionEjercicio?id=" + request.getParameter("id")); } private void guardaResultados(String user, String ejercicio, String ruta, String grupo) throws Exception{ SAXBuilder builder = new SAXBuilder(); File xmlFile = new File(ruta + "xml\\ejerciciosResueltos.xml"); Document document = (Document) builder.build(xmlFile); Element rootNode = document.getRootElement(); Element resuelto = new Element("ejercicioResuelto"); resuelto.setAttribute("IdEjercicio",ejercicio); Element alumno = new Element("alumno"); alumno.setText(user); resuelto.addContent(alumno); Element grupoE = new Element("grupo"); grupoE.setText(grupo); resuelto.addContent(grupoE); Element[] preguntas = new Element[this.respuestas.length]; for(int i = 0; i < preguntas.length; i++){ preguntas[i] = new Element("pregunta"); preguntas[i].setAttribute("ID", (i+1)+""); preguntas[i].setText(respuestas[i]); resuelto.addContent(preguntas[i]); } rootNode.addContent(resuelto); XMLOutputter xmlout = new XMLOutputter(); xmlout.setFormat(Format.getPrettyFormat()); try (FileOutputStream fileout = new FileOutputStream(ruta + "xml\\ejerciciosResueltos.xml")) { xmlout.output(document, fileout); fileout.flush(); fileout.close(); } } }
22519438bdb86afa6e3e6f354659c93d042aac8e
3ed3dab41d2bdbc05b623d5de6508eefde7c0bd0
/app/src/main/java/com/zhuang/hrcourseclient/MainActivity.java
b98339f464af39aa83e864ca37202db95303f407
[]
no_license
halogh/HRCourseClient
23f9647d2d314bf9ae5d5f5444177315060191f9
e0883dd9cc53a6ddf7c54b9ae1a54e02132b3189
refs/heads/master
2020-05-05T02:31:49.562589
2019-04-16T13:06:11
2019-04-16T13:06:11
179,640,926
7
1
null
null
null
null
UTF-8
Java
false
false
4,312
java
package com.zhuang.hrcourseclient; import android.content.Intent; import android.content.SharedPreferences; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.EditText; import android.widget.Toast; import com.zhuang.dao.DaoImpl; import com.zhuang.model.MySubject; import com.zhuang.model.SubjectRepertory; import com.zhuang.spider.HREduSystemSpider; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; /** * 登录Activity * Created by zhuang on 2019/3/27. */ public class MainActivity extends AppCompatActivity{ private EditText userName, password; private CheckBox auto_login; private Button btn_login; private String userNameValue,passwordValue; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); //检查自动登录 CheckSaveLogin(); //获得实例对象 userName = (EditText) findViewById(R.id.name); password = (EditText) findViewById(R.id.password); auto_login = (CheckBox) findViewById(R.id.remember_login); btn_login = (Button) findViewById(R.id.login); // 登录监听事件 btn_login.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { userNameValue = userName.getText().toString(); passwordValue = password.getText().toString(); login(userNameValue,passwordValue); } }); } /* * 登录方法 * 根据输入的学号和密码爬取课表信息,存入数据库,如果自动登录被选中,存用户信息,然后跳转课表界面 * */ private void login(final String userNameValue, final String passwordValue) { new Thread(){ @Override public void run() { try { //爬取课表数据 List<MySubject> mysubject = HREduSystemSpider.getCourse(userNameValue,passwordValue); if (mysubject!=null){ //课表存入数据库 Boolean b = DaoImpl.SaveCourceData(mysubject); Log.d("saveinfo:",b.toString()); //如果自动登录被选中,存用户信息 saveUser(); Intent intent=new Intent(MainActivity.this,BaseFuncActivity.class); startActivity(intent); finish(); }else{ Toast.makeText(MainActivity.this, "连接网络失败", Toast.LENGTH_SHORT).show(); } } catch (IOException e) { Toast.makeText(MainActivity.this, "网络连接失败", Toast.LENGTH_SHORT).show(); } } }.start(); } /* * 保存用户信息 * */ private void saveUser() { SharedPreferences.Editor editor=getSharedPreferences("userInfo",MODE_PRIVATE).edit(); if(auto_login.isChecked()){//如果自动登录被选中,存入SharedPreferences editor.putString("username",userName.getText().toString()); editor.putString("password",password.getText().toString()); } editor.commit(); } //检查是否保存登录,即检查SharedPreferences是否有数据,有则直接跳转课表界面 private void CheckSaveLogin() { try{ SharedPreferences Preferences=getSharedPreferences("userInfo",MODE_PRIVATE); String username=Preferences.getString("username",""); String password=Preferences.getString("password",""); if(!username.equals("")&&!password.equals("")){ Intent intent=new Intent(this,BaseFuncActivity.class); startActivity(intent); finish(); } }catch (Exception e){ } } }
c3f545516f7e89132f033ff3ba3aba6a4bbb0cda
cc5a7d0bfe6519e2d462de1ac9ef793fb610f2a7
/api1/src/main/java/com/heb/pm/repository/VarietalTypeRepository.java
58cd8ad6b3661c5089965add6422c60859aa8e65
[]
no_license
manosbatsis/SAVEFILECOMPANY
d21535a46aebedf2a425fa231c678658d4b017a4
c33d41cf13dd2ff5bb3a882f6aecc89b24a206be
refs/heads/master
2023-03-21T04:46:23.286060
2019-10-10T10:38:02
2019-10-10T10:38:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
560
java
/* * VarietalTypeRepository * * Copyright (c) 2017 HEB * All rights reserved. * * This software is the confidential and proprietary information * of HEB. */ package com.heb.pm.repository; import com.heb.pm.entity.VarietalType; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import java.util.List; /** * Interface to the Varietal Type info. * * @author vn87351 * @since 2.12.0 */ public interface VarietalTypeRepository extends JpaRepository<VarietalType, Integer> { }
c007f8f6b1b4238598de15c7d2868ce6b0cd4e2b
504b7a680d162fcacfa59ee8a5e90ea1c9eadeb2
/app/src/main/java/com/example/mausam/CityDetailsFragment.java
d66dd1e2554b609429c6260716ef2c5852a82dba
[]
no_license
gagandeepsingh18/Mausam
1f942578e896dd8b3e7f78e71ea8e2486101a3bf
da69cbb6d4f4ef965c1933300241576ac2542149
refs/heads/master
2022-11-14T19:19:47.229603
2020-07-15T18:56:49
2020-07-15T18:56:49
278,442,647
0
0
null
null
null
null
UTF-8
Java
false
false
5,194
java
package com.example.mausam; import android.content.Context; import android.content.SharedPreferences; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentTransaction; import android.os.Parcelable; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.squareup.picasso.Picasso; import java.util.ArrayList; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; import static android.content.Context.MODE_PRIVATE; public class CityDetailsFragment extends Fragment { ImageView ImageView; TextView CityName, CurrentTemp, MaxTemp, MinTemp, Weather, WindSpeed, Visibility; Weather WeatherObject; String City = ""; Button FutureBtn; FragmentTransaction fragmentTransaction; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment SharedPreferences sharedPreferences = this.getActivity().getSharedPreferences ("Preferences", Context.MODE_PRIVATE); City = sharedPreferences.getString("City", "Montréal"); View view = inflater.inflate(R.layout.fragment_city_details, container, false); CityName = view.findViewById(R.id.CityNameField); CurrentTemp = view.findViewById(R.id.CurTempField); MaxTemp = view.findViewById(R.id.MaxTempField); MinTemp = view.findViewById(R.id.MinTempField); Weather = view.findViewById(R.id.Weather); WindSpeed= view.findViewById(R.id.WindSpeedField); Visibility= view.findViewById(R.id.VisibilityField); FutureBtn= view.findViewById(R.id.FutureForecastButton); showWeather(); FutureBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { FutureForecastFragment fragment = new FutureForecastFragment(); fragmentTransaction = getFragmentManager().beginTransaction(); Bundle b = new Bundle(); b.putString("Weather", City); Log.d("abc", City); fragment.setArguments(b); fragmentTransaction.replace(R.id.nav_host_fragment, fragment); fragmentTransaction.commit(); } }); return view; } public void showWeather(){ GetCityDetails getCityDetails = RetroFitClass.getRetroFitInstance().create(GetCityDetails.class); Call<Weather> weatherCall; if(City.equals("Montréal")){ weatherCall = getCityDetails.getMontrealWeather(); } else if (City.equals("Toronto")){ weatherCall = getCityDetails.getTorontoWeather(); } else if (City.equals("Vancouver")){ weatherCall = getCityDetails.getVancouverWeather(); } else if (City.equals("New York")){ weatherCall = getCityDetails.getNewYorKWeather(); } else if (City.equals("Los Angeles")){ weatherCall = getCityDetails.getLosAngelesWeather(); } else { weatherCall = getCityDetails.getMontrealWeather(); } weatherCall.enqueue(new Callback<Weather>() { @Override public void onResponse(Call<Weather> call, Response<Weather> response) { WeatherObject = response.body(); CityName.setText(WeatherObject.getTitle()); CurrentTemp.setText(WeatherObject.getWeatherList().get(0).getTheTemp().toString().substring(0,2)+" °C"); MaxTemp.setText(WeatherObject.getWeatherList().get(0).getMaxTemp().toString().substring(0,2)+" °C"); MinTemp.setText(WeatherObject.getWeatherList().get(0).getMinTemp().toString().substring(0,2)+" °C"); Weather.setText(WeatherObject.getWeatherList().get(0).getWeatherStateName()); WindSpeed.setText(WeatherObject.getWeatherList().get(0).getWindSpeed().toString().substring(0,1)+" KPH"); Visibility.setText(WeatherObject.getWeatherList().get(0).getVisibility().toString().substring(0,2)+" KPH"); setImage(ImageView, R.id.ImageWeatherField, WeatherObject.getWeatherList().get(0).getWeatherStateAbbr()); } @Override public void onFailure(Call<com.example.mausam.Weather> call, Throwable t) { Log.d("abc", t.getMessage()); Toast.makeText(getActivity().getApplicationContext(), t.getMessage(), Toast.LENGTH_SHORT).show(); } }); } private void setImage(ImageView imageView, int id, String weatherState) { imageView = getView().findViewById(id); Log.d("TAG", String.valueOf(id)); Picasso.get().load("https://www.metaweather.com/static/img/weather/ico/" + weatherState + ".ico").into(imageView); } }
92e2a63c790dd4909df42e38dcadd86ba5bc3b9a
048fb10c2ceba05877baeed16173ac2a6b2ab1be
/application/src/transportTax/Tax.java
2e5acabcc56dbe5b8046dddc9136bef6692e9ed5
[]
no_license
EdwinOliveira/design-patterns-project
63de488cafe096daaa8ee880bb0b7356195c79ec
2d4ae60109abd2654baafe3a1956cf32aeb522f9
refs/heads/master
2022-04-15T01:27:07.911177
2020-03-21T22:42:48
2020-03-21T22:42:48
246,823,932
0
0
null
null
null
null
UTF-8
Java
false
false
389
java
package transportTax; import transport.MedicationComponent; /** * Tax */ public abstract class Tax { //Medication Component Reference; protected MedicationComponent medicationComponent; //Constructor; protected Tax(MedicationComponent medicationComponent) { this.medicationComponent = medicationComponent; } public abstract double applyTaxToPrice(); }
95d91d4eb55288af06a29083af86081169cad34e
c112684c1f2e05264c78c72741e2697def9e2280
/src/com/sw/service/UserManager.java
89b4ae1458734bcd3728db15e3e49ee091bc0b70
[]
no_license
bolton1643/archives
05eb4ba5e7c2f944b5c83d7af919e63777d6f65b
008380d0edecb4b75f32c8fd8a927be693077933
refs/heads/master
2021-01-23T03:53:11.253297
2011-12-14T11:20:55
2011-12-14T11:20:55
2,664,223
0
0
null
null
null
null
UTF-8
Java
false
false
1,409
java
package com.sw.service; import java.util.List; import com.sw.pojo.TreeNodeRight; import com.sw.pojo.User; public interface UserManager { // 登陆失败 public static final int LOGIN_FAIL = 0; // 登陆成功 public static final int LOGIN_SUCCESS = 1; // 注册失败 public static final int REGISTE_FAIL = 0; // 注册成功 public static final int REGISTE_SUCCESS = 1; /** * 验证登陆 * * @param name * 登陆用的用户�? * @param pass * 登陆用的密码 * @return 登陆后的身份确认:0为登陆失败,1为登陆成�? */ int validLogin(String name, String pass); /** * 注册新用�? * @param user */ void registe(User user); /** * 根据姓名和密码查找用�? * @param name * @param pass * @return */ User getUserByNameAndPass(String name,String pass); /** * 修改密码 * @param userId * @param newPwd */ void changePwd(Integer userId,String newPwd); List<User> userList(); public User getUserById(User user); public void modifyUser(User user); public List<TreeNodeRight> findUserRight(User user); public void saveRight(List <TreeNodeRight> tl,int userId); }
5667d109f9c82094451efc0708a29d643bc55a20
0f19032b46ba6406fa01b5bc1967ef9ce2f25235
/week5demo06/PropertyRepository.java
e841022cfcb7840cfd77e3454cebae57ad2e83e8
[]
no_license
Rainzy1014/FIT5042
86fc93ce3c0112793a9d9e915b2a0a02576d6a3f
380ebec8ba05c2d52554435dcbd032b0bcc672fa
refs/heads/master
2022-12-05T19:32:21.243553
2020-08-26T09:32:29
2020-08-26T09:32:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,228
java
package fit5042.tutex.repository; import fit5042.tutex.repository.entities.ContactPerson; import fit5042.tutex.repository.entities.Property; import java.util.List; import java.util.Set; import javax.ejb.Remote; /** * @autor Eddie Leung */ @Remote public interface PropertyRepository { /** * Add the property being passed as parameter into the repository * * @param property - the property to add */ public void addProperty(Property property) throws Exception; /** * Search for a property by its property ID * * @param id - the propertyId of the property to search for * @return the property found */ public Property searchPropertyById(int id) throws Exception; /** * Return all the properties in the repository * * @return all the properties in the repository */ public List<Property> getAllProperties() throws Exception; /** * Return all the contact people in the repository * * @return all the contact people in the repository */ public List<ContactPerson> getAllContactPeople() throws Exception; /** * Remove the property, whose property ID matches the one being passed as * parameter, from the repository * * @param propertyId - the ID of the property to remove */ public void removeProperty(int propertyId) throws Exception; /** * Update a property in the repository * * @param property - the updated information regarding a property */ public void editProperty(Property property) throws Exception; /** * Search for properties whose price is less than or equal to a budget * * @param budget - the budget that the price of the returned properties must * be lower than or equal to * @return the properties found */ public List<Property> searchPropertyByBudget(double budget) throws Exception; /** * Search for properties by their contact person * * @param contactPerson - the contact person that is responsible for the * properties * @return the properties found */ Set<Property> searchPropertyByContactPerson(ContactPerson contactPerson) throws Exception; }
eef4ceff79c45a4bc5110a786ebbd5d3f53beb6b
f5acd38efe9f28e14a3e77cf60f938000a6660ab
/clients/spring/generated/src/main/java/org/openapitools/model/CauseAction.java
45777779fdd4c570a9bc819cfc8ed1a7bed2d8f5
[ "MIT" ]
permissive
rahulyhg/swaggy-jenkins
3fc9377c8cf8643d6b4ffe4a6aceb49315afdb8e
21326779f8814a07153acaf5af15ffbbd593c48b
refs/heads/master
2020-05-04T16:14:43.369417
2019-01-27T06:27:32
2019-01-27T06:27:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,780
java
package org.openapitools.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; import org.openapitools.model.CauseUserIdCause; import javax.validation.Valid; import javax.validation.constraints.*; /** * CauseAction */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2018-08-21T04:42:22.775Z[GMT]") public class CauseAction { @JsonProperty("_class") private String propertyClass = null; @JsonProperty("causes") @Valid private List<CauseUserIdCause> causes = null; public CauseAction propertyClass(String propertyClass) { this.propertyClass = propertyClass; return this; } /** * Get propertyClass * @return propertyClass **/ @ApiModelProperty(value = "") public String getPropertyClass() { return propertyClass; } public void setPropertyClass(String propertyClass) { this.propertyClass = propertyClass; } public CauseAction causes(List<CauseUserIdCause> causes) { this.causes = causes; return this; } public CauseAction addCausesItem(CauseUserIdCause causesItem) { if (this.causes == null) { this.causes = new ArrayList<>(); } this.causes.add(causesItem); return this; } /** * Get causes * @return causes **/ @ApiModelProperty(value = "") @Valid public List<CauseUserIdCause> getCauses() { return causes; } public void setCauses(List<CauseUserIdCause> causes) { this.causes = causes; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CauseAction causeAction = (CauseAction) o; return Objects.equals(this.propertyClass, causeAction.propertyClass) && Objects.equals(this.causes, causeAction.causes); } @Override public int hashCode() { return Objects.hash(propertyClass, causes); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CauseAction {\n"); sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); sb.append(" causes: ").append(toIndentedString(causes)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
14296dae54f7a15093aa6bc778cd72e6db25a255
f7294ad8d332ba8ea38e07abf56c3d71395c2f5e
/Assignment4/question3/Author.java
8ada87b056869b51b2506e4f5248ae4ace4bfee4
[]
no_license
achyutdev/classworkAndAssignment
1b6d2a03c05207a2c5d0da1a7ad09367fcba2e2f
d72f032cc284b10fdfa1e181e987e18436aeb50c
refs/heads/master
2021-01-10T14:43:35.706995
2015-12-15T03:26:12
2015-12-15T03:26:12
46,947,071
0
0
null
2015-12-04T15:11:08
2015-11-26T21:14:34
Java
UTF-8
Java
false
false
1,096
java
package question3; public class Author { private String name; private String email; private char gender; public Author(String name, String email, char gender) { super(); this.name = name; this.email = email; this.gender = gender; } /** * @return the name */ public String getName() { return name; } /** * @param name the name to set */ public void setName(String name) { this.name = name; } /** * @return the email */ public String getEmail() { return email; } /** * @param email the email to set */ public void setEmail(String email) { this.email = email; } /** * @return the gender */ public char getGender() { return gender; } /** * @param gender the gender to set */ public void setGender(char gender) { this.gender = gender; } public String toString(){ return this.name + "("+this.gender+")"+" at "+this.email; } }
f66735ed20b0b8ca4cd1cd2562142cf1eded6b65
bad4d5cde97ae611e5f67b0bb5fc1ba0b7b6de7a
/amaps/RMaps.AppLib/src/com/xylink/sdk/sample/utils/CustomLayoutBuilder.java
46130a19809ad25c649ad62295e7c29fc028bd3f
[]
no_license
wellchen20/QcProject
6bce1f00b0b3e704f5a1afa606ea89cf281ee092
3f9d76719433879cce7a3a4c480227c7a013d6c1
refs/heads/main
2023-06-17T12:10:04.920693
2021-07-16T04:51:37
2021-07-16T04:51:37
386,504,293
0
0
null
null
null
null
UTF-8
Java
false
false
347
java
package com.xylink.sdk.sample.utils; import com.ainemo.sdk.otf.LayoutElement; import com.ainemo.sdk.otf.LayoutPolicy; import java.util.List; public class CustomLayoutBuilder implements LayoutPolicy.LayoutBuilder { @Override public List<LayoutElement> compute(LayoutPolicy policy) { //todo your work return null; } }
dda12e60ee131d399283c45d3f8fd69b44827ac4
93457fa916d63a7fcdb9590bbd2312d42b512cae
/java/tw/chiae/inlive/presentation/ui/login/country/CountryActivity.java
b7dbcc0f27010bc2e5206d1cbfb6feb2343a9e22
[]
no_license
syjcnss/inLiveAndroid
75f851b61d5e950d7027e8b87673df16724be1fe
134358f48597fec338907b146094066d21681517
refs/heads/master
2020-06-04T09:38:03.324961
2019-01-10T02:29:04
2019-01-10T02:29:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,610
java
package tw.chiae.inlive.presentation.ui.login.country; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import com.gjiazhe.wavesidebar.WaveSideBar; import tw.chiae.inlive.R; import tw.chiae.inlive.presentation.ui.base.BaseActivity; import tw.chiae.inlive.presentation.ui.login.LoginActivity; import java.util.ArrayList; public class CountryActivity extends BaseActivity { private RecyclerView rvContacts; private WaveSideBar sideBar; private ContactsAdapter adapter; private ArrayList<Contact> contacts = new ArrayList<>(); public static Intent createIntent(Context context) { Intent intent = new Intent(context, CountryActivity.class); return intent; } @Override protected int getLayoutId() { return R.layout.activity_country; } @Override protected void findViews(Bundle savedInstanceState) { rvContacts = (RecyclerView) findViewById(R.id.rv_contacts); rvContacts.setLayoutManager(new LinearLayoutManager(this)); adapter=new ContactsAdapter(contacts, R.layout.item_country); rvContacts.setAdapter(adapter); sideBar = (WaveSideBar) findViewById(R.id.side_bar); } @Override protected void init() { initData(); adapter.setItemClick(new ContactsAdapter.ItemClick() { @Override public void onItemClick(int postion) { resultBack(contacts.get(postion)); } }); sideBar.setOnSelectIndexItemListener(new WaveSideBar.OnSelectIndexItemListener() { @Override public void onSelectIndexItem(String index) { for (int i=0; i<contacts.size(); i++) { if (contacts.get(i).getIndex().equals(index)) { ((LinearLayoutManager) rvContacts.getLayoutManager()).scrollToPositionWithOffset(i, 0); return; } } } }); } private void initData() { contacts.addAll(Contact.getCountryCode()); } public void resultBack(Contact country){ Intent intent=new Intent(); intent.putExtra(LoginActivity.COUNTRY_CODE,country.getCode()); intent.putExtra(LoginActivity.COUNTRY_NAME,country.getName()); setResult(LoginActivity.COUNTRY_CODE_REQUEST,intent); finish(); } @Override public void setCoinData(int currencyItemSum) { } }
74e486525a612e9ea67e8517d7ec7fe705a2fdda
1cef0267f8b24cb59b5fed3d0f95030d8da4e59b
/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/admin/executor/DatabaseAdminExecutor.java
59c4b3f5ce0bbc521e66f7a0fa30ac8208fa0a68
[ "Apache-2.0" ]
permissive
apache/shardingsphere
4e69d07ad082ed3d1269e113d66421f67baa1f02
5ad75d38ab4fcf169a1a4704be4e671200d02e4c
refs/heads/master
2023-09-02T15:56:04.469891
2023-09-02T15:20:38
2023-09-02T15:20:38
49,876,476
9,157
3,758
Apache-2.0
2023-09-14T14:45:41
2016-01-18T12:49:26
Java
UTF-8
Java
false
false
1,273
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.shardingsphere.proxy.backend.handler.admin.executor; import org.apache.shardingsphere.proxy.backend.session.ConnectionSession; import java.sql.SQLException; /** * Database admin executor. */ public interface DatabaseAdminExecutor { /** * Execute. * * @param connectionSession connection session * @throws SQLException SQLException */ void execute(ConnectionSession connectionSession) throws SQLException; }
baca3c72aada0d3c229bd20295606707ec1add54
9d32980f5989cd4c55cea498af5d6a413e08b7a2
/A72n_10_0_0/src/main/java/com/oppo/luckymoney/LMManager.java
71e2f4d77035bbc48d541b29104c3f37b9269f05
[]
no_license
liuhaosource/OppoFramework
e7cc3bcd16958f809eec624b9921043cde30c831
ebe39acabf5eae49f5f991c5ce677d62b683f1b6
refs/heads/master
2023-06-03T23:06:17.572407
2020-11-30T08:40:07
2020-11-30T08:40:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
35,464
java
package com.oppo.luckymoney; import android.app.ActivityThread; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; import android.content.pm.ApplicationInfo; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Matrix; import android.net.wifi.WifiEnterpriseConfig; import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; import android.os.HandlerThread; import android.os.Process; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemProperties; import android.util.Log; import android.util.Slog; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.android.internal.app.ILMServiceManager; import java.util.ArrayList; import java.util.HashMap; public class LMManager { public static final String BROADCAST_ACTION_UPDATE_lUCKYMONEYINFO = "com.oppo.intent.action.UPDATE_lUCKYMONEYINFO"; public static final String DETECT_CNN = "DETECT_CNN"; public static final String DETECT_IMAGEVIEW = "DETECT_IMAGEVIEW"; public static final String DETECT_NETWORK = "DETECT_NETWORK"; public static final String DETECT_TEXT = "DETECT_TEXT"; public static final String EVENT_ID = "LuckyMoney"; public static final String KEY_CURRENT_TIME = "CURRENT_TIME"; public static final String KEY_DETECT_RETURN = "DETECT_RETURN"; public static final String KEY_SPEND_TIME = "SPEND_TIME"; public static final String KEY_TYPE = "TYPE"; public static final String LOGTAG = "2016101"; public static final String LUCKY_MONEY_SERVICE = "luckymoney"; private static final int MAX_MODE = 4; public static final String MM_PACKAGENAME = "com.tencent.mm"; private static final int MOBILE_POLICY_LAST_TIME = 300; public static final String MODE_2_HB_HEIGHT = "hb_height"; public static final String MODE_2_HB_WIDTH = "hb_width"; public static final String MODE_2_HG_HASH = "hg_hash"; public static final String MODE_2_RECEIVER_CLASS = "receiver_class"; private static final int MODE_MAX_VALUE = 10; public static final String OPEN_LUCKYMONEY = "OPEN_LUCKYMONEY"; private static final int PER_PING_TIME = 8; public static final String QQ_PACKAGENAME = "com.tencent.mobileqq"; public static final String SWITCH_MODE = "SWITCH_MODE"; private static final String TAG = "LMManager"; private static final int TYPE_DETECT_CNN = 4; private static final int TYPE_DETECT_IMAGEVIEW = 2; private static final int TYPE_DETECT_TEXT = 3; public static final int TYPE_MODE_MM = 0; public static final int TYPE_MODE_NONE = -1; public static final int TYPE_MODE_QQ = 1; public static int luckyMoneyXmlVersion = -1; private static boolean mCancelNewMsgDetect = false; static String mChatView = ""; public static int mCurrentBoostMode = 1; static int mDefaultHbMode = 0; public static ArrayList<String> mHbHashs; public static ArrayList<Integer> mHbHeights; static ArrayList<String> mHbLayout = new ArrayList<>(); static ArrayList<Integer> mHbLayoutNodes = new ArrayList<>(); static String mHbText = ""; public static ArrayList<Integer> mHbWidths; private static boolean mInitailized = false; public static boolean mIsEnable = true; public static boolean mModeEnable = true; public static HashMap<Integer, Boolean> mModeEnableInfo; public static ArrayList<String> mOpenHbActivity; public static boolean mSMEnable = true; public static int sBoostMode = -1; public static boolean sGetHash = false; private static LMManager sLMManager = null; private static Handler sLastNewMsgTimeoutHandler; private static boolean sMODE2_LastViewItem = false; private static boolean sMODE2_NewMsgDetected = false; public static byte[] sMODE_2_VALUE_HB_HASH; public static int sMODE_2_VALUE_HB_HEIGHT = 0; public static int sMODE_2_VALUE_HB_WIDTH = 0; public static String sMODE_2_VALUE_RECEIVER_CLASS = ""; private static Bundle sModeData = null; private static Runnable sNewMsgTimeout = new Runnable() { /* class com.oppo.luckymoney.LMManager.AnonymousClass1 */ public void run() { boolean unused = LMManager.sMODE2_NewMsgDetected = false; } }; private static ILMServiceManager sService = null; private float mCNNReturn = 0.0f; private Context mContext = null; private volatile boolean mEnableMobileDataHongbaoPolicy = true; private long mEndTime = 0; private IntentFilter mFilter = null; private Handler mHandler = null; private HandlerThread mHandlerThread = null; private OppoLuckyMoneyUtils mLMUtils = null; private boolean mRUSListenerRegistered = false; private long mStartTime = 0; private int mVersionCode = 0; public static boolean getNewMsgDetected() { return sMODE2_NewMsgDetected; } public static boolean getLastViewItem() { return sMODE2_LastViewItem; } public static int getMode() { return SystemProperties.getInt("persist.oppo.debug.luckymoney", sBoostMode); } public static String getHbText() { return mHbText; } public static ArrayList<String> getHbLayout() { return mHbLayout; } public static ArrayList<String> getOpenHbActivity() { return mOpenHbActivity; } public static ArrayList<Integer> getHbLayoutNodes() { return mHbLayoutNodes; } public static void setLastViewItem(boolean isLastItem) { if (!mIsEnable || !mModeEnable) { sMODE2_LastViewItem = false; Log.w(TAG, "disable luckmoney detect, can not setLastViewItem"); return; } sMODE2_LastViewItem = isLastItem; } public static void setNewMsgDetected(Handler h, boolean value) { sMODE2_NewMsgDetected = value; if (h != null) { h.removeCallbacks(sNewMsgTimeout); sLastNewMsgTimeoutHandler = h; if (value) { h.postDelayed(sNewMsgTimeout, 1000); return; } return; } Handler handler = sLastNewMsgTimeoutHandler; if (handler != null) { handler.removeCallbacks(sNewMsgTimeout); } } public void noteObtainedLastViewItem(View child) { if (child != null && !mChatView.isEmpty() && child.getClass().getName().contains(mChatView)) { if (!mIsEnable || !mModeEnable) { Log.w(TAG, "disable luckmoney detect"); return; } int mode = getMode(); if (mode != 2) { if (mode != 3) { if (mode == 4 && sMODE2_NewMsgDetected) { Log.d(TAG, " preProcessLuckMoney start"); this.mStartTime = System.currentTimeMillis(); View view = preProcessLuckMoney(child, mHbLayoutNodes, mHbLayout); if (view != null) { Log.d(TAG, " loadBitmapFromView start"); Bitmap bitmap = loadBitmapFromView(view); Log.d(TAG, " compareBitmapAsync start"); compareBitmapAsync(bitmap); } } } else if (sMODE2_NewMsgDetected) { this.mStartTime = System.currentTimeMillis(); if (findLuckyMoneyByText(child, mHbLayoutNodes, mHbLayout)) { this.mEndTime = System.currentTimeMillis(); getLMManager().enableBoost(0, 2018); setNewMsgDetected(null, false); } } } else if (sMODE2_LastViewItem) { sMODE2_LastViewItem = false; } } } private View preProcessLuckMoney(View pView, ArrayList<Integer> nodes, ArrayList<String> nodeNameArray) { if (nodes.size() != nodeNameArray.size()) { Log.e(TAG, "Encounter bad configuration"); return null; } View cView = preProcessLuckMoneyInternal(pView, nodes, nodeNameArray, 0); if (cView == null || cView.getHeight() == 0 || cView.getWidth() == 0) { return null; } float wRatio = ((float) cView.getWidth()) / ((float) pView.getWidth()); float lmRatio = ((float) cView.getHeight()) / ((float) cView.getWidth()); Log.d(TAG, "preProcessLuckMoney wRatio:" + wRatio + " lmRatio:" + lmRatio); if (0.28d >= ((double) lmRatio) || ((double) lmRatio) >= 0.42d || ((double) wRatio) <= 0.5d) { return null; } return cView; } private View preProcessLuckMoneyInternal(View view, ArrayList<Integer> nodes, ArrayList<String> nodeNameArray, int layout) { View childView; int nr_layout = nodes.size(); int node = nodes.get(layout).intValue(); String nodeName = nodeNameArray.get(layout); int next_layout = layout + 1; if (view instanceof ViewGroup) { ViewGroup vp = (ViewGroup) view; if (vp.getChildCount() <= node || (childView = vp.getChildAt(node)) == null || !childView.getClass().getName().contains(nodeName)) { return null; } if (next_layout < nr_layout) { return preProcessLuckMoneyInternal(childView, nodes, nodeNameArray, next_layout); } Log.w(TAG, "LinearLayout width: " + childView.getWidth() + " height:" + childView.getHeight()); return childView; } Log.w(TAG, "preProcessLuckMoneyInternal not view group"); return null; } private Bitmap loadBitmapFromView(View v) { int w = v.getWidth(); int h = v.getHeight(); if (w == 0 || h == 0) { return null; } Bitmap bmp = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); Canvas c = new Canvas(bmp); c.drawColor(-1); v.layout(0, 0, w, h); v.draw(c); System.currentTimeMillis(); return bmp; } private boolean findLuckyMoneyByText(View view, ArrayList<Integer> nodes, ArrayList<String> nodeNameArray) { View txtView; if (view == null || nodes.isEmpty() || nodeNameArray.isEmpty() || (txtView = findLuckMoneyInternal(view, nodes.get(0).intValue(), nodeNameArray.get(0), 0, nodes, nodeNameArray)) == null || !(txtView instanceof TextView) || !mHbText.equals(((TextView) txtView).getText().toString())) { return false; } Log.w(TAG, "find LM successful_3"); return true; } private View findLuckMoneyInternal(View view, int node, String nodeName, int layer, ArrayList<Integer> nodes, ArrayList<String> nodeNameArray) { int totalLayer = nodes.size(); int nextlayer = layer + 1; if (view instanceof ViewGroup) { ViewGroup vp = (ViewGroup) view; if (vp.getChildCount() <= node) { return null; } View childView = vp.getChildAt(node); if (childView != null) { if (childView.getClass().getName().contains(nodeName)) { if (nextlayer < totalLayer) { return findLuckMoneyInternal(childView, nodes.get(nextlayer).intValue(), nodeNameArray.get(nextlayer), nextlayer, nodes, nodeNameArray); } return childView; } } return null; } Log.w(TAG, "findLMInternal not view group"); return null; } private LMManager(Context context) { if (context != null) { this.mContext = context; this.mFilter = new IntentFilter(); this.mFilter.addAction(BROADCAST_ACTION_UPDATE_lUCKYMONEYINFO); return; } Log.e(TAG, "LMManager init with null Context"); } public static synchronized LMManager getLMManager(Context context) { LMManager lMManager; synchronized (LMManager.class) { if (sLMManager == null) { sLMManager = new LMManager(context); } sLMManager.tryToInit(); lMManager = sLMManager; } return lMManager; } public static LMManager getLMManager() { return getLMManager(null); } private boolean tryToInit() { if (sService == null) { sService = ILMServiceManager.Stub.asInterface(ServiceManager.getService(LUCKY_MONEY_SERVICE)); } try { if (!mInitailized && sService != null && sService.isInitialized()) { init(); mInitailized = true; } } catch (RemoteException e) { e.printStackTrace(); } return mInitailized; } private void init() { Context context; ILMServiceManager iLMServiceManager = sService; if (iLMServiceManager != null) { try { Bundle switchInfo = iLMServiceManager.getSwitchInfo(); mIsEnable = switchInfo.getBoolean("isEnable", true); mSMEnable = switchInfo.getBoolean("smEnable", true); } catch (RemoteException e) { e.printStackTrace(); } } else { Slog.e(TAG, "get LUCKY_MONEY_SERVICE for switchinfo failed"); } if (mIsEnable) { if (this.mHandlerThread == null) { this.mHandlerThread = new HandlerThread("luckmoney"); this.mHandlerThread.start(); } if (sBoostMode >= 0) { return; } if (MM_PACKAGENAME.equals(ActivityThread.currentPackageName())) { sBoostMode = 1; final ApplicationInfo appInfo = ActivityThread.currentApplication().getApplicationInfo(); if (appInfo != null) { if (mSMEnable) { SharedPreferences sp = ActivityThread.currentApplication().getSharedPreferences("lm_prefs", 0); int version = sp.getInt("lm_version", 0); int mode = sp.getInt("lm_default_mode", -1); Log.e(TAG, "sp.getInt lm_version version " + version + " appInfo.versionCode " + appInfo.versionCode); if (version == appInfo.versionCode || (version == 0 && mode != -1)) { getModeData(0, appInfo.versionCode, mode); } else { saveLMInPreference(true); getModeData(0, appInfo.versionCode); } getModeEnableInfo(0, appInfo.versionCode); } else { rmLMInPreference(); getModeData(0, appInfo.versionCode); } this.mVersionCode = appInfo.versionCode; if (!this.mRUSListenerRegistered && (context = this.mContext) != null) { context.registerReceiver(new BroadcastReceiver() { /* class com.oppo.luckymoney.LMManager.AnonymousClass2 */ @Override // android.content.BroadcastReceiver public void onReceive(Context context, Intent intent) { Log.d(LMManager.TAG, "Rus updated broadcast received"); LMManager.this.updateLuckyMoneyInfo(0, appInfo.versionCode); } }, this.mFilter); this.mRUSListenerRegistered = true; } } } else if (!QQ_PACKAGENAME.equals(ActivityThread.currentPackageName())) { sBoostMode = 0; sModeData = new Bundle(); } } } private void initQuickValue() { Bundle bundle = sModeData; if (bundle != null) { luckyMoneyXmlVersion = bundle.getInt("xmlVersion", -1); mIsEnable = sModeData.getBoolean("isEnable", true); mSMEnable = sModeData.getBoolean("smEnable", true); if (luckyMoneyXmlVersion == 1) { sBoostMode = sModeData.getInt("mode", 0); mModeEnable = sModeData.getBoolean("isModeEnable", true); mChatView = sModeData.getString("chatView", ""); sMODE_2_VALUE_RECEIVER_CLASS = sModeData.getString(MODE_2_RECEIVER_CLASS, ""); mHbHashs = sModeData.getStringArrayList("hbHashs"); mOpenHbActivity = sModeData.getStringArrayList("openHbActivity"); mHbWidths = sModeData.getIntegerArrayList("hbWidths"); mHbHeights = sModeData.getIntegerArrayList("hbHeights"); mHbText = sModeData.getString("hbText", ""); ArrayList<String> tempHbLayout = sModeData.getStringArrayList("hbLayout"); if (tempHbLayout != null) { mHbLayout = tempHbLayout; } ArrayList<Integer> tempHbLayoutNodes = sModeData.getIntegerArrayList("hbLayoutNodes"); if (tempHbLayoutNodes != null) { mHbLayoutNodes = tempHbLayoutNodes; } } else { sBoostMode = sModeData.getInt("mode", 0); sGetHash = sModeData.getBoolean(LuckyMoneyHelper.MODE_2_GET_HASH_MODE, false); sMODE_2_VALUE_RECEIVER_CLASS = sModeData.getString(MODE_2_RECEIVER_CLASS, ""); sMODE_2_VALUE_HB_HASH = sModeData.getByteArray("hg_hash"); sMODE_2_VALUE_HB_WIDTH = Integer.valueOf(sModeData.getString(MODE_2_HB_WIDTH, WifiEnterpriseConfig.ENGINE_DISABLE)).intValue(); sMODE_2_VALUE_HB_HEIGHT = Integer.valueOf(sModeData.getString(MODE_2_HB_HEIGHT, WifiEnterpriseConfig.ENGINE_DISABLE)).intValue(); } Log.e(TAG, "initQuickValue sBoostMode :" + sBoostMode + " mModeEnable:" + mModeEnable + " mIsEnable:" + mIsEnable + " mSMEnable:" + mSMEnable); if (sBoostMode == 4) { getHandler().post(new Runnable() { /* class com.oppo.luckymoney.LMManager.AnonymousClass3 */ public void run() { LMManager.this.mLMUtils = OppoLuckyMoneyUtils.getInstance(); } }); } } } private Handler getHandler() { if (this.mHandler == null) { this.mHandler = new Handler(this.mHandlerThread.getLooper()); } return this.mHandler; } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void updateLuckyMoneyInfo(int type, int versionCode) { getModeData(type, versionCode); } private void compareBitmapAsync(Bitmap src) { getHandler().post(new compareBitmapRunnable(src, getMode())); } /* access modifiers changed from: private */ public class compareBitmapRunnable implements Runnable { int mMethod; Bitmap mSrcBitmap; public compareBitmapRunnable(Bitmap src, int method) { this.mSrcBitmap = src; this.mMethod = method; } private Bitmap preProcessBitmap(Bitmap origin) { Log.e(LMManager.TAG, " start preProcessBitmap bitmap"); Bitmap bmp = scaleBitmap(origin, 128, 128); if (!origin.isRecycled()) { origin.recycle(); } return bmp; } private Bitmap scaleBitmap(Bitmap origin, int new_width, int new_height) { int width = origin.getWidth(); int height = origin.getHeight(); Matrix matrix = new Matrix(); matrix.preScale(((float) new_width) / ((float) width), ((float) new_height) / ((float) height)); Bitmap newBmp = Bitmap.createBitmap(origin, 0, 0, width, height, matrix, false); if (!origin.isRecycled()) { origin.recycle(); } return newBmp; } public void run() { Bitmap dstBitmap = preProcessBitmap(this.mSrcBitmap); if (this.mMethod == 4 && LMManager.this.mLMUtils != null) { Log.e(LMManager.TAG, "start detect using CNN"); float ret = LMManager.this.mLMUtils.nativeDetect(dstBitmap); LMManager.this.mCNNReturn = ret; Log.e(LMManager.TAG, "compare CNN:" + ret); if (((double) ret) > 0.9d) { Log.w(LMManager.TAG, "find LM using cnn"); if (SystemProperties.get("persist.oppo.debug.cnndisable", WifiEnterpriseConfig.ENGINE_DISABLE).equals(WifiEnterpriseConfig.ENGINE_DISABLE)) { Log.w(LMManager.TAG, "find LM successful_4"); LMManager.this.mEndTime = System.currentTimeMillis(); LMManager.this.enableBoost(0, 2019); LMManager.setNewMsgDetected(null, false); } } LMManager.this.mCNNReturn = 0.0f; } if (!dstBitmap.isRecycled()) { dstBitmap.recycle(); } } } public void noteOpenLuckMoney() { if (!mIsEnable || !mSMEnable) { Log.w(TAG, "disable luckmoney change mode"); return; } writeDCS(2020); getHandler().post(new SwitchDetectLMRunnable()); } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private boolean isSwitchDetect(SharedPreferences sp) { if (sp.getInt("stop_detect", 0) == 0) { return true; } Log.e(TAG, "stop_detect"); return false; } /* access modifiers changed from: package-private */ public final class SwitchDetectLMRunnable implements Runnable { SwitchDetectLMRunnable() { } public void run() { try { if (ActivityThread.currentApplication() == null) { return; } if (LMManager.sMODE2_NewMsgDetected) { Log.w(LMManager.TAG, "SwitchDetectLMRunnable mCancelNewMsgDetect:" + LMManager.mCancelNewMsgDetect); SharedPreferences sp = ActivityThread.currentApplication().getSharedPreferences("lm_prefs", 0); SharedPreferences.Editor editor = sp.edit(); if (!LMManager.this.isSwitchDetect(sp)) { Log.e(LMManager.TAG, "isSwitchDetect(sp) == false"); } else if (!LMManager.mCancelNewMsgDetect) { int count = sp.getInt("lm_invalid_count", 0); if (!LMManager.mModeEnable || count >= 3) { boolean unused = LMManager.mCancelNewMsgDetect = true; return; } editor.remove("lm_invalid_count"); editor.putInt("lm_invalid_count", count + 1); editor.commit(); } else { ApplicationInfo appInfo = ActivityThread.currentApplication().getApplicationInfo(); if (appInfo != null) { LMManager.mCurrentBoostMode = sp.getInt("lm_default_mode", 1); LMManager.mCurrentBoostMode++; if (LMManager.mModeEnableInfo != null) { while (LMManager.mCurrentBoostMode <= 4 && !LMManager.mModeEnableInfo.get(Integer.valueOf(LMManager.mCurrentBoostMode)).booleanValue()) { Log.d(LMManager.TAG, "skip over boost mode " + LMManager.mCurrentBoostMode); LMManager.mCurrentBoostMode = LMManager.mCurrentBoostMode + 1; } } else { Log.d(LMManager.TAG, "unable to skip disabled modes"); } Log.w(LMManager.TAG, "SwitchDetectLMRunnable mCurrentBoostMode:" + LMManager.mCurrentBoostMode); if (LMManager.mCurrentBoostMode > 4) { editor.remove("stop_detect"); editor.putInt("stop_detect", 1); } else { editor.remove("lm_default_mode"); editor.putInt("lm_default_mode", LMManager.mCurrentBoostMode); LMManager.this.getModeData(0, appInfo.versionCode, LMManager.mCurrentBoostMode); LMManager.this.writeDCS(2021); } } boolean unused2 = LMManager.mCancelNewMsgDetect = false; editor.remove("lm_invalid_count"); editor.putInt("lm_invalid_count", 0); editor.commit(); } } } catch (Exception e) { Log.e(LMManager.TAG, "saveCacheDrawableIdInPreference fail"); e.printStackTrace(); } } } private HashMap<Integer, Boolean> getModeEnableInfo(int type, int versionCode) { if (tryToInit()) { try { mModeEnableInfo = (HashMap) sService.getModeEnableInfo(type, versionCode).getSerializable("modeEnableInfo"); if (mModeEnableInfo == null) { Log.d(TAG, "got null modeEnableInfo"); } } catch (RemoteException e) { e.printStackTrace(); } } else { Log.e(TAG, "Service not ready for getting mode info"); } return mModeEnableInfo; } public int getBoostMode() { return sBoostMode; } public Bundle getModeData() { return sModeData; } public boolean isGetHash() { return sGetHash; } public byte[] getHBHash() { return sMODE_2_VALUE_HB_HASH; } public static boolean initBitmapCheck(int width, int height) { int heightIndex = mHbHeights.indexOf(Integer.valueOf(height)); if (heightIndex != mHbWidths.indexOf(Integer.valueOf(width)) || heightIndex < 0) { return false; } sMODE_2_VALUE_HB_WIDTH = width; sMODE_2_VALUE_HB_HEIGHT = height; if (mHbHashs.size() <= heightIndex) { return false; } sMODE_2_VALUE_HB_HASH = getHBHash(mHbHashs.get(heightIndex)); return true; } private static byte[] getHBHash(String hash) { if (hash == null || hash.length() != 32) { return null; } byte[] cc = new byte[(hash.length() / 2)]; for (int i = 0; i < cc.length; i++) { try { cc[i] = (byte) (Integer.parseInt(hash.substring(i * 2, (i * 2) + 2), 16) & 255); } catch (NumberFormatException e) { e.printStackTrace(); return null; } } return cc; } public void enableBoost(int timeout, int code) { if (!mIsEnable) { Slog.d(TAG, "enableBoost is disable"); } else if (tryToInit()) { try { if (mSMEnable) { saveLMInPreference(false); } boolean enable = sService.enableBoost(Process.myPid(), Process.myUid(), timeout, code); writeDCS(code); if (enable && this.mEnableMobileDataHongbaoPolicy) { synchronized (sLMManager) { this.mEnableMobileDataHongbaoPolicy = false; } sService.enableMobileBoost(); getHandler().postDelayed(new Runnable() { /* class com.oppo.luckymoney.LMManager.AnonymousClass4 */ public void run() { synchronized (LMManager.sLMManager) { LMManager.this.mEnableMobileDataHongbaoPolicy = true; Log.e(LMManager.TAG, "mEnableMobileDataHongbaoPolicy = true"); } } }, 500); } } catch (Exception e) { e.printStackTrace(); } } else { Log.e(TAG, "Service not ready for boosting"); } } private void saveLMInPreference(final boolean clear) { new AsyncTask<Void, Void, Void>() { /* class com.oppo.luckymoney.LMManager.AnonymousClass5 */ /* access modifiers changed from: protected */ public Void doInBackground(Void... params) { try { if (ActivityThread.currentApplication() != null) { if (LMManager.MM_PACKAGENAME.equals(ActivityThread.currentApplication().getPackageName())) { Log.d(LMManager.TAG, "AsyncTask, saveLMPreference"); SharedPreferences sp = ActivityThread.currentApplication().getSharedPreferences("lm_prefs", 0); SharedPreferences.Editor editor = sp.edit(); if (clear) { editor.clear().commit(); Log.d(LMManager.TAG, "clear LMInPreference"); } else { int prefVersionCode = sp.getInt("lm_version", 0); if (prefVersionCode != LMManager.this.mVersionCode) { editor.remove("lm_version"); editor.putInt("lm_version", LMManager.this.mVersionCode); editor.remove("lm_detect"); editor.putInt("lm_detect", 1); Log.w(LMManager.TAG, "save detect lm"); editor.commit(); } else { Log.d(LMManager.TAG, "prefVersionCode: " + prefVersionCode + "; mVersionCode: " + LMManager.this.mVersionCode); } } return null; } } Log.d(LMManager.TAG, "currentApplication: " + ActivityThread.currentApplication().getPackageName()); return null; } catch (Exception e) { Log.e(LMManager.TAG, "save detect lm fail " + ActivityThread.currentApplication()); e.printStackTrace(); } } /* access modifiers changed from: protected */ public void onPostExecute(Void result) { super.onPostExecute((AnonymousClass5) result); } }.execute(new Void[0]); } private void rmLMInPreference() { new AsyncTask<Void, Void, Void>() { /* class com.oppo.luckymoney.LMManager.AnonymousClass6 */ /* access modifiers changed from: protected */ public Void doInBackground(Void... params) { try { Log.d(LMManager.TAG, "AsyncTask, rmLMPreference"); if (ActivityThread.currentApplication() != null) { if (LMManager.MM_PACKAGENAME.equals(ActivityThread.currentApplication().getPackageName())) { ActivityThread.currentApplication().deleteSharedPreferences("lm_prefs"); return null; } } return null; } catch (Exception e) { Log.e(LMManager.TAG, "delete lm fail " + ActivityThread.currentApplication()); e.printStackTrace(); } } /* access modifiers changed from: protected */ public void onPostExecute(Void result) { super.onPostExecute((AnonymousClass6) result); } }.execute(new Void[0]); } public String getLuckyMoneyInfo(int type) { if (tryToInit()) { try { return sService.getLuckyMoneyInfo(type); } catch (RemoteException e) { e.printStackTrace(); return null; } } else { Log.e(TAG, "Service not ready for getting lucky info"); return null; } } private Bundle getModeData(int type, int versionCode) { return getModeData(type, versionCode, -1); } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private Bundle getModeData(int type, int versionCode, int defaultValue) { ILMServiceManager iLMServiceManager = sService; if (iLMServiceManager != null) { try { sModeData = iLMServiceManager.getModeData(type, versionCode, defaultValue); initQuickValue(); return sModeData; } catch (RemoteException e) { e.printStackTrace(); return null; } } else { Slog.e(TAG, "Can't get service."); return null; } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void writeDCS(int type) { Bundle DCSData = new Bundle(); DCSData.putString(KEY_TYPE, getenableBoostType(type)); DCSData.putString(KEY_DETECT_RETURN, String.valueOf(this.mCNNReturn)); if (type == 2020 || type == 2021) { DCSData.putString(KEY_SPEND_TIME, WifiEnterpriseConfig.ENGINE_DISABLE); } else { DCSData.putString(KEY_SPEND_TIME, String.valueOf(this.mEndTime - this.mStartTime)); } DCSData.putString(KEY_CURRENT_TIME, String.valueOf(System.currentTimeMillis())); ILMServiceManager iLMServiceManager = sService; if (iLMServiceManager != null) { try { iLMServiceManager.writeDCS(DCSData); } catch (RemoteException e) { e.printStackTrace(); } } else { Slog.e(TAG, "writeDCS Can't get service."); } } private String getenableBoostType(int code) { switch (code) { case 2015: return DETECT_NETWORK; case 2016: default: return ""; case 2017: return DETECT_IMAGEVIEW; case 2018: return DETECT_TEXT; case 2019: return DETECT_CNN; case 2020: return OPEN_LUCKYMONEY; case 2021: return SWITCH_MODE; } } }
51f7463d1c2f52588f17e61fa8761f47bba9e39d
fed6a02ee05fd1dc7144c45d9c885ecf1517f8bb
/static_methods/src/static_methods/Driver.java
ebe1a5073c5e06b87f7d03f43bfb3f24c0b6cd09
[]
no_license
canUlearnIt/java_examples
9b79920dee3ccc3402edcda70e2386586334abec
7dba7b038678c7248d76fa7b23640a1c58ff1e9d
refs/heads/master
2020-08-03T01:25:56.622645
2019-10-07T01:47:59
2019-10-07T01:47:59
211,581,673
0
0
null
null
null
null
UTF-8
Java
false
false
277
java
package static_methods; public class Driver { public static void main(String[] args) { int sum = Animal.calculateTwoNumbers(1, 1); System.out.println(sum); Animal animal = new Animal(); sum = animal.addTwoNumbers(1, 2); System.out.println(sum); } }
01159260b066203b96578bac81367430f69e6f98
64e5d88b3dfb62236f778fee26f09f249fd662af
/LEETCODE/242. 有效的字母异位词.java
6fe02ee82a0610e7da89623fe269613b36709110
[]
no_license
hishark/Algorithm
d2dabeac5c3bcd5d78d21edad460a1981c4dfc31
81032464b38e4e0c7b4a088d19ff07eb5c227cbb
refs/heads/master
2021-06-02T14:47:13.088472
2021-04-27T12:58:03
2021-04-27T12:58:03
123,285,059
7
0
null
null
null
null
UTF-8
Java
false
false
2,070
java
import java.util.Arrays; // ref: https://leetcode-cn.com/problems/valid-anagram/solution/you-xiao-de-zi-mu-yi-wei-ci-by-leetcode-solution/ // 1. 排序 class Solution { public boolean isAnagram(String s, String t) { /** * t 是 s 的字母异位词等价于「两个字符串排序后相等」 * 所以可以对两个字符串分别排序,看排序后的字符串是否相等即可判断 */ // 如果两个字符串的长度不同,必然不互为字母异位词 if (s.length() != t.length()) return false; // 把字符串转换为字符数组 char[] s1 = s.toCharArray(); char[] t1 = t.toCharArray(); // 对字符串进行排序 Arrays.sort(s1); Arrays.sort(t1); // 判断排序后的字符串是否相同即可 return Arrays.equals(s1, t1); } } // 2. 哈希表 class Solution { public boolean isAnagram(String s, String t) { /** * t 是 s 的异位词等价于「两个字符串中字符出现的种类和次数均相等」 * 由于字符串只包含 26 个小写字母,所以可以维护一个长度为 26 的数组 */ // 如果两个字符串的长度不同,必然不互为字母异位词 if (s.length() != t.length()) return false; // 使用一个数组记录字符出现的次数 int[] count = new int[26]; // 遍历字符串 s,计算字符串 s 中所有字符出现的次数 for (int i=0;i<s.length();i++) { count[s.charAt(i) - 'a']++; } // 遍历字符串 t,减去 count 数组中对应的次数 // 如果出现小于 0 的情况,说明 t 中包含一个不在 s 中的额外字符 for (int i=0;i<t.length();i++) { count[t.charAt(i) - 'a']--; if (count[t.charAt(i) - 'a'] < 0) return false; } // 遍历完字符串 t 没出现小于零的情况就直接返回 true 啦 return true; } }
ba91bc787c713b4d44783bccdb77dbff679059ce
00eeb5630965b19fb0302f793ab1aba98aa43e16
/FlibbleCallManager/src/com/sipresponse/flibblecallmgr/internal/actions/CancelAction.java
81ac477bea515517e29c7a6c158b203f6f918086
[]
no_license
iraramtirth/flibble-voip
d416ab6e89622f9a6f9fc9f721da5826083b9efa
f9836caf8d76a4e00a997e3b322d9a344df398ba
refs/heads/master
2021-01-19T13:00:47.572914
2009-05-12T00:45:09
2009-05-12T00:45:09
33,423,777
0
0
null
null
null
null
UTF-8
Java
false
false
3,124
java
/******************************************************************************* * Copyright 2007-2008 SIP Response * Copyright 2007-2008 Michael D. Cohen * * mike _AT_ sipresponse.com * * 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.sipresponse.flibblecallmgr.internal.actions; import javax.sip.ClientTransaction; import javax.sip.Dialog; import javax.sip.ResponseEvent; import javax.sip.SipException; import javax.sip.header.ViaHeader; import javax.sip.message.Request; import com.sipresponse.flibblecallmgr.CallManager; import com.sipresponse.flibblecallmgr.Event; import com.sipresponse.flibblecallmgr.EventCode; import com.sipresponse.flibblecallmgr.EventReason; import com.sipresponse.flibblecallmgr.EventType; import com.sipresponse.flibblecallmgr.internal.Call; import com.sipresponse.flibblecallmgr.internal.FlibbleSipProvider; import com.sipresponse.flibblecallmgr.internal.InternalCallManager; import com.sipresponse.flibblecallmgr.internal.media.FlibbleMediaProvider; import com.sipresponse.flibblecallmgr.internal.util.AuthenticationHelper; public class CancelAction extends ActionThread { public CancelAction(CallManager callMgr, Call call) { super(callMgr, call, null); } @Override public void run() { FlibbleSipProvider flibbleProvider = InternalCallManager.getInstance() .getProvider(callMgr); FlibbleMediaProvider mediaProvider = call.getMediaProvider(); if (null != mediaProvider) { mediaProvider.stopRtpReceive(call.getLocalSdpAddress(), call.getLocalSdpPort()); } Dialog dialog = call.getDialog(); Request cancel = null; ClientTransaction originalInviteTransaction = call.getClientTransaction(); ClientTransaction ct = null; try { cancel = originalInviteTransaction.createCancel(); ViaHeader viaHeader = (ViaHeader)cancel.getHeader(ViaHeader.NAME); viaHeader.setRPort(); originalInviteTransaction.terminate(); ct = flibbleProvider.getSipProvider().getNewClientTransaction(cancel); ct.sendRequest(); } catch (Exception e) { e.printStackTrace(); } ResponseEvent responseEvent = flibbleProvider.waitForResponseEvent(ct); // response should be 200 ok... } }
[ "reliagility@4c746b2d-a82a-0410-9326-4b6ed91c80fc" ]
reliagility@4c746b2d-a82a-0410-9326-4b6ed91c80fc
84ce0dc560cb155957569db807432242ddad0fbb
af7a897d0f81b2f2bb37ffdbe3bec8dfd7b3a91b
/src/main/java/haumsweetohm/InfraredSwitchSensor.java
5a8cabd280c08e3e71f71582e0d321d34ecb127b
[]
no_license
DTADMI/24HCODE2019_HAUM
e228f152ba8b785b3c0437fc1b091129b9569f20
84b246c9c160607542615e494c5f5f944df4e68b
refs/heads/master
2020-04-17T11:52:58.951964
2019-01-20T09:53:54
2019-01-20T09:53:54
166,558,323
0
0
null
null
null
null
UTF-8
Java
false
false
1,560
java
package haumsweetohm; import haumsweetohm.cbv.InfraRedSwitchOptions; import javafx.scene.paint.Color; import java.util.concurrent.Callable; public class InfraredSwitchSensor implements Callable<Void> { private Communicator communicator; protected InfraredSwitchSensor(Communicator communicator) { this.communicator = communicator; } @Override public Void call() throws Exception { if ( !communicator.isConnected()) { return null; } else { System.out.println("InfraredSwitchSensor"); for(InfraRedSwitchOptions option : InfraRedSwitchOptions.values()){ System.out.println("adding receiver for option : " + option.value()); communicator.getReceiverListeners().put("remote/"+ option +"/state", message -> { System.out.println("distance/value " + handleRemoteOptionValue(message, "Laumio_0FBFBF", option.value())); }); } } return null; } private String handleRemoteOptionValue(String message, String name, String option) { System.out.println("remote/"+ option +"/state : " + message); Lamp lamp = new Lamp(communicator, name); if("ON".equals(message)){ System.out.println(name + " switched to WHITE"); lamp.fill(Color.WHITE); } else { System.out.println(name + " switched to BLACK"); lamp.fill(Color.BLACK); } return message; } }
c6c4218000a995d18b6423470b374f7035d0bcaf
755a5432e9b53191a8941591f560e7a4fc28b1a0
/java-web-project/src09/main/java/com/eomcs/lms/servlet/LessonListServlet.java
69c0f2a27824ece338cbeeee071e022aca723946
[]
no_license
SeungWanWoo/bitcamp-java-2018-12
4cff763ddab52721f24ce8abcebcec998dacc9e3
d14a8a935ef7a4d24eb633fedea892378e59168d
refs/heads/master
2021-08-06T22:11:24.954160
2019-08-06T08:17:07
2019-08-06T08:17:07
163,650,664
0
0
null
2020-04-30T03:39:17
2018-12-31T08:00:39
Java
UTF-8
Java
false
false
1,050
java
package com.eomcs.lms.servlet; import java.io.IOException; import java.util.List; 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.springframework.context.ApplicationContext; import com.eomcs.lms.domain.Lesson; import com.eomcs.lms.service.LessonService; @SuppressWarnings("serial") @WebServlet("/lesson/list") public class LessonListServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { LessonService lessonService = ((ApplicationContext) this.getServletContext() .getAttribute("iocContainer")).getBean(LessonService.class); response.setContentType("text/html;charset=UTF-8"); List<Lesson> lessons = lessonService.list(); request.setAttribute("lessons", lessons); request.setAttribute("viewUrl", "/lesson/list.jsp"); } }
304bcde0f4662f4a2bbdabe31684e83a05bc6978
e3df0291996a43f8a4a50d6c68842f156401d05d
/upmTrunk/gome-upm-parent/gome-upm-service/src/main/java/com/gome/upm/service/AlarmRecordService.java
f2fe5e437e939dce2de677871dbb25edc7a686cd
[]
no_license
wang-shun/gomm
fcc57116b8dfb701459fd020c25d4fab989dae0e
69cf5b6e2a3e7ca3c8fe630226ccdd8bfc055a3d
refs/heads/master
2020-03-29T14:04:30.650213
2016-09-18T01:18:33
2016-09-18T01:18:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,320
java
package com.gome.upm.service; import java.util.List; import com.gome.upm.common.Page; import com.gome.upm.domain.AlarmRecord; import com.gome.upm.domain.UrlMonitor; /** * 报警记录service接口 * @author caowei-ds1 * */ public interface AlarmRecordService { /** * * 分页查询报警记录列表. * * @param page * 分页信息(封装了查询条件) * @return * 分页数据 * * <pre> * 修改日期 修改人 修改原因 * 2016年06月21日 caowei-ds1 新建 * </pre> */ Page<AlarmRecord> findAlarmRecordListByPage(Page<AlarmRecord> page); /** * * 根据条件查询报警记录数. * * @param alarmRecord * 封装了查询条件 * @return * 记录数 * * <pre> * 修改日期 修改人 修改原因 * 2016年07月13日 caowei-ds1 新建 * </pre> */ int findTotalResultByConditions(AlarmRecord alarmRecord); /** * * 条件查询报警记录列表,不分页. * * @param page * 分页信息(封装了查询条件) * @return * 分页数据 * * <pre> * 修改日期 修改人 修改原因 * 2016年06月21日 caowei-ds1 新建 * </pre> */ List<AlarmRecord> findAlarmRecordListByConditions(AlarmRecord alarmRecord); /** * 查询所有的类型 * @return * 2016年7月26日 下午12:34:43 caowei-ds1 */ List<AlarmRecord> findAllTypes(); /** * 查询所有业务的类型 * @return * 2016年9月9日 下午 liuyuqiang */ List<AlarmRecord> findAllBusinessTypes(); /** * 根据ID查询报警记录 * @param id2 * @return * 2016年7月26日 下午4:49:43 caowei-ds1 */ AlarmRecord findAlarmRecordById(long id); /** * * 编辑报警记录. * * @param alarmRecord * 报警记录 * @return * 修改记录数 * * <pre> * 修改日期 修改人 修改原因 * 2016年08月12日 caowei-ds1 新建 * </pre> */ int editAlarmRecord(AlarmRecord alarmRecord); /** * 根据条件查询报警记录数 * * @param alarmRecord * @return */ List<AlarmRecord> selectAlarmRecordListByConditions(AlarmRecord alarmRecord); /** * 插入一条新的报警记录 * @param alarmRecord * @return */ int insertAlarmRecord(AlarmRecord alarmRecord); }
b0579f3000599d2b5c8bcddde94f73dec1be119d
b4550f55189eb4dc46dc4881ba642311631d2cd4
/src/main/java/com/cer/mall/mylitemall/mbg/mapper/HelpTopicMapper.java
35b2d4b7ca3da8e2c8e5e4dfa00002a324e0cb4a
[]
no_license
cer008/mylitemall
e8c0db45535836eaf16a6d716c583d70062e348c
a860e1e702859a2af1d661870c4a1b5fc2fae540
refs/heads/master
2022-07-18T10:58:16.032482
2020-05-07T12:46:46
2020-05-07T12:46:46
221,954,628
1
0
null
2022-06-17T02:45:27
2019-11-15T15:47:15
Java
UTF-8
Java
false
false
1,177
java
package com.cer.mall.mylitemall.mbg.mapper; import com.cer.mall.mylitemall.mbg.model.HelpTopic; import com.cer.mall.mylitemall.mbg.model.HelpTopicExample; import java.util.List; import org.apache.ibatis.annotations.Param; public interface HelpTopicMapper { long countByExample(HelpTopicExample example); int deleteByExample(HelpTopicExample example); int deleteByPrimaryKey(Integer helpTopicId); int insert(HelpTopic record); int insertSelective(HelpTopic record); List<HelpTopic> selectByExampleWithBLOBs(HelpTopicExample example); List<HelpTopic> selectByExample(HelpTopicExample example); HelpTopic selectByPrimaryKey(Integer helpTopicId); int updateByExampleSelective(@Param("record") HelpTopic record, @Param("example") HelpTopicExample example); int updateByExampleWithBLOBs(@Param("record") HelpTopic record, @Param("example") HelpTopicExample example); int updateByExample(@Param("record") HelpTopic record, @Param("example") HelpTopicExample example); int updateByPrimaryKeySelective(HelpTopic record); int updateByPrimaryKeyWithBLOBs(HelpTopic record); int updateByPrimaryKey(HelpTopic record); }