blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
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
listlengths
1
1
author_id
stringlengths
0
313
3e56ea9e0ed1a37ee8d7f45bc16b157dee1e380d
9572bd5e936efc49f5e25d3573965b8779de0d96
/src/main/mapElements/MapDirection.java
1b9bb3f5eea9e3818168e021a6e95e1595644bc0
[]
no_license
pawel00100/Pobiektowe1
c92ce06724e2a63e7e7c0c1a8696f3a5cbd9ffa7
cc76f3f19e1b60cebf5af7d44e3fb2d92301967c
refs/heads/master
2022-11-24T17:23:10.912074
2022-11-15T18:18:21
2022-11-15T18:20:36
225,888,412
0
0
null
null
null
null
UTF-8
Java
false
false
1,640
java
package main.mapElements; public enum MapDirection { NORTH, NORTHEAST, EAST, SOUTHEAST, SOUTH, SOUTHWEST, WEST, NORTHWEST; private static final MapDirection[] values = MapDirection.values(); public String toString() { switch (this) { case NORTH: return "Północ"; case SOUTH: return "Południe"; case WEST: return "Zachód"; case EAST: return "Wschód"; default: return null; } } public String toShortString(){ switch (this) { case NORTH: return "N"; case SOUTH: return "S"; case WEST: return "W"; case EAST: return "E"; default: return "X"; } } private Vector2d vector; static { NORTH.vector = new Vector2d(0, 1); NORTHEAST.vector = new Vector2d(1, 1); EAST.vector = new Vector2d(1, 0); SOUTHEAST.vector = new Vector2d(1, -1); SOUTH.vector = new Vector2d(0, -1); SOUTHWEST.vector = new Vector2d(-1, -1); WEST.vector = new Vector2d(-1, 0); NORTHWEST.vector = new Vector2d(-1, 1); } public Vector2d toUnitVector() { return this.vector; } public static MapDirection generateRandomDirection(){ return values[(int)(8 * Math.random())]; } public MapDirection rotateBy(int rotations){ int newValue = (this.ordinal() + rotations) % 8; return values[newValue]; } }
2fae4618fcd41c486ba88ef6d20cb4bfde19e049
e053777b608854cf9070031da3f3ff7157c203f2
/src/main/java/com/maguzman/onbron/service/implementation/TipoPagoServiceImpl.java
16e94fec2fc965fcc615dcdfc516337525ce7e48
[]
no_license
marioalex77/onbronCRM
d66e884c780cdf6bfb6204fcfe23f72073a47852
187107f246c2eeae15765744ddd289f8c68e96d9
refs/heads/master
2020-12-02T06:18:40.661859
2017-07-17T21:10:05
2017-07-17T21:10:05
96,815,612
0
0
null
null
null
null
UTF-8
Java
false
false
1,166
java
package com.maguzman.onbron.service.implementation; import com.maguzman.onbron.beans.TipoPago; import com.maguzman.onbron.dao.TipoPagoDAO; import com.maguzman.onbron.service.TipoPagoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; /** * Created by maguzman on 24/05/2017. */ @Service("tipoPagoService") @Transactional public class TipoPagoServiceImpl implements TipoPagoService { @Autowired private TipoPagoDAO tipoPagoDAO; @Override public TipoPago buscarPorClave(Integer idTipoPago) { return tipoPagoDAO.buscarPorClave(idTipoPago); } @Override public List<TipoPago> buscarTodos() { return tipoPagoDAO.buscarTodos(); } @Override public void salvar(TipoPago tipoPago) { tipoPagoDAO.salvar(tipoPago); } @Override public void borrar(Integer idTipoPago) { tipoPagoDAO.borrar(idTipoPago); } @Override public TipoPago actualizar(TipoPago tipoPago) { return tipoPagoDAO.actualizar(tipoPago); } }
ef765b02ab587c7a3dccff4169e1f272d8b23322
87ca872569b19e1ebf629ed80c74b0769ca5fd7a
/src/main/java/com/speedment/internal/util/tuple/impl/Tuple5Impl.java
46528c0dc950abef636317d1bff9e1e63a7c0aa6
[ "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
lawesson/speedment
04772f9a30dc28ade7e358761d615f43b32f3dd6
fad54076832496a8dd81919a0db9fb162f3ab165
refs/heads/master
2021-01-17T20:28:03.873640
2016-08-21T00:07:42
2016-08-21T00:07:42
66,567,694
0
0
null
2016-08-25T14:58:39
2016-08-25T14:58:39
null
UTF-8
Java
false
false
1,717
java
/** * * Copyright (c) 2006-2016, Speedment, Inc. 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. 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.speedment.internal.util.tuple.impl; import com.speedment.util.tuple.Tuple5; /** * * @author pemi * @param <T0> Type of 0:th argument * @param <T1> Type of 1:st argument * @param <T2> Type of 2:nd argument * @param <T3> Type of 3:rd argument * @param <T4> Type of 4:th argument */ public final class Tuple5Impl<T0, T1, T2, T3, T4> extends AbstractTuple implements Tuple5<T0, T1, T2, T3, T4> { public Tuple5Impl(T0 v0, T1 v1, T2 v2, T3 v3, T4 v4) { super(Tuple5Impl.class, v0, v1, v2, v3, v4); } @SuppressWarnings("unchecked") @Override public T0 get0() { return (T0) values[0]; } @SuppressWarnings("unchecked") @Override public T1 get1() { return (T1) values[1]; } @SuppressWarnings("unchecked") @Override public T2 get2() { return (T2) values[2]; } @SuppressWarnings("unchecked") @Override public T3 get3() { return (T3) values[3]; } @SuppressWarnings("unchecked") @Override public T4 get4() { return (T4) values[4]; } }
3274de0ac3299b3391198673e15f8083eabb9acb
f10dc8fb4181c4865cd4797de9d5a79f2c98af7a
/crmsrc/com/psit/struts/entity/SupPaidPast.java
74c23b2bdd49963599bb0f67d4ce528f5d4c0576
[]
no_license
DennisAZ/NewtouchOA
b9c41cc1f4caac53b453c56952af0f5156b6c4fa
881d72d80c83e1f2ad578c92e37a3241498499fc
refs/heads/master
2020-03-30T05:37:21.900004
2018-09-29T02:11:34
2018-09-29T02:11:34
150,809,685
0
3
null
null
null
null
UTF-8
Java
false
false
3,576
java
package com.psit.struts.entity; // default package import java.util.Date; /** * SupPaidPast entity. @author MyEclipse Persistence Tools */ public class SupPaidPast implements java.io.Serializable { // Fields private Long sppId; private PurOrd purOrd; private Supplier supplier; private String sppContent; private Date sppFctDate; private String sppPayType; private Double sppPayMon; private SalEmp salEmp; private String sppIsinv; private String sppCreUser; private Date sppCreDate; private String sppUpdUser; private Date sppUpdDate; // Constructors /** default constructor */ public SupPaidPast() { } public SupPaidPast(Long sppId){ this.sppId = sppId; } /** full constructor */ public SupPaidPast(PurOrd purOrd, Supplier supplier, String sppContent, Date sppFctDate, String sppPayType, Double sppPayMon, SalEmp salEmp, String sppIsinv, String sppCreUser, Date sppCreDate, String sppUpdUser, Date sppUpdDate) { this.purOrd = purOrd; this.supplier = supplier; this.sppContent = sppContent; this.sppFctDate = sppFctDate; this.sppPayType = sppPayType; this.sppPayMon = sppPayMon; this.salEmp = salEmp; this.sppIsinv = sppIsinv; this.sppCreUser = sppCreUser; this.sppCreDate = sppCreDate; this.sppUpdUser = sppUpdUser; this.sppUpdDate = sppUpdDate; } // Property accessors public Long getSppId() { return this.sppId; } public void setSppId(Long sppId) { this.sppId = sppId; } public PurOrd getPurOrd() { return purOrd; } public void setPurOrd(PurOrd purOrd) { this.purOrd = purOrd; } public Supplier getSupplier() { return supplier; } public void setSupplier(Supplier supplier) { this.supplier = supplier; } public String getSppContent() { return this.sppContent; } public void setSppContent(String sppContent) { this.sppContent = sppContent; } public Date getSppFctDate() { return this.sppFctDate; } public void setSppFctDate(Date sppFctDate) { this.sppFctDate = sppFctDate; } public String getSppPayType() { return this.sppPayType; } public void setSppPayType(String sppPayType) { this.sppPayType = sppPayType; } public Double getSppPayMon() { return this.sppPayMon; } public void setSppPayMon(Double sppPayMon) { this.sppPayMon = sppPayMon; } public SalEmp getSalEmp() { return salEmp; } public void setSalEmp(SalEmp salEmp) { this.salEmp = salEmp; } public String getSppIsinv() { return this.sppIsinv; } public void setSppIsinv(String sppIsinv) { this.sppIsinv = sppIsinv; } public String getSppCreUser() { return this.sppCreUser; } public void setSppCreUser(String sppCreUser) { this.sppCreUser = sppCreUser; } public Date getSppCreDate() { return this.sppCreDate; } public void setSppCreDate(Date sppCreDate) { this.sppCreDate = sppCreDate; } public String getSppUpdUser() { return this.sppUpdUser; } public void setSppUpdUser(String sppUpdUser) { this.sppUpdUser = sppUpdUser; } public Date getSppUpdDate() { return this.sppUpdDate; } public void setSppUpdDate(Date sppUpdDate) { this.sppUpdDate = sppUpdDate; } }
592c83b8abd8be768578769d9d35a8234cc81f0d
ea8a2197de3b2f16aab70acd5f143e42996aaf05
/MinDist.java
e26cd0e543a5d33d7568c328fcdf3ee6331560d2
[]
no_license
janetanne26/ZohoArrays
ace06ad3fd1408c6eb9ba6d523202b9077a8f0fe
7ac0e1fb606584ad6aa0b37e5e7b63f5b0bf7199
refs/heads/main
2023-08-03T12:42:22.798741
2021-09-15T06:10:50
2021-09-15T06:10:50
406,616,443
0
0
null
null
null
null
UTF-8
Java
false
false
1,267
java
package ZohoArrays; import java.util.Scanner; public class MinDist { public static int minDist(int a[], int n, int x, int y) { int recent_x = -1; int recent_y = -1; int ans = Integer.MAX_VALUE; for (int i = 0; i < n; i++) { if (a[i] == x) { recent_x = i; if (recent_y != -1) ans = Math.min(Math.abs(recent_x - recent_y), ans); } else if (a[i] == y) { recent_y = i; if (recent_x != -1) ans = Math.min(Math.abs(recent_x - recent_y), ans); } } if (ans == Integer.MAX_VALUE) return -1; return ans; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("enter the number of array elements"); int n = sc.nextInt(); int[] a = new int[n]; System.out.println("enter the array elements"); for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); } System.out.println("enter the x value"); int x=sc.nextInt(); System.out.println("enter y value"); int y=sc.nextInt(); System.out.println(minDist(a,n,x,y)); } }
7bed891cc1d1e25b29959d4595f1c93855734ef0
009302e299b67501b86df2378091dadbab44e81b
/src/calander/Second_Count1.java
414f8130c2a30ac54dd75dd895f9e0e5ac09625d
[]
no_license
shahinvx/Calender_Time_Count
4425d7044d8c7b0a5f5c34eb7d5ab1e55d09cfd9
70a5280c2c0a510ff4ee6e91ea7d9d3ca1618b30
refs/heads/master
2021-09-07T23:26:03.210617
2018-03-03T02:02:43
2018-03-03T02:02:43
123,650,273
0
0
null
null
null
null
UTF-8
Java
false
false
749
java
package calander; import java.util.*; import java.text.*; public class Second_Count1 { static int interval; static Timer timer; int m,d,t; public static void main(String[] args){ Scanner sc = new Scanner(System.in); System.out.print("Input seconds => : "); String secs = sc.nextLine(); int delay = 1000; int period = 1000; timer = new Timer(); interval = Integer.parseInt(secs); System.out.println(secs); timer.scheduleAtFixedRate(new TimerTask() { public void run() { System.out.println(setInterval()); } }, delay, period); } private static final int setInterval() { if (interval == 1) timer.cancel(); return --interval; } }
[ "SHAHINVX@DESKTOP-CBV7RB9" ]
SHAHINVX@DESKTOP-CBV7RB9
82711079b7dcd3cbfd097e01aae2cc58cff79d96
b7c7d19ab54f60c0d729be8d3aa4b3c1b6ed5a39
/src/test/cards/Forest.java
f3f4e901feb0f58b8ee28f171aa624ee1f2ded2a
[]
no_license
Aki-zuki/MTGtest
36fb2a3516ff8d954604fade31fcf86ed16e1025
b3106c7ad4cf783e97c926f67c0e0935519be2c9
refs/heads/master
2020-06-29T20:07:45.214563
2019-08-08T06:38:34
2019-08-08T06:38:34
200,612,799
0
0
null
null
null
null
UTF-8
Java
false
false
286
java
package test.cards; import test.Cards; public class Forest extends Cards { public Forest() { name = "Forest"; type = "Basic_Land~Forest"; manacost = ""; m2c(); produceManaByManaAbility = true; manaAbilityGenerate = "G"; } }
341d7a8baae3e74c64939596e45ace45383df427
1d5ad100235043d4053cb7ea175517b95d85c7cc
/pluginlibrary/src/androidTest/java/com/test/pluginlibrary/ExampleInstrumentedTest.java
3e2ec4905bd10819c1cb67d0ff5e512a7ddb608c
[]
no_license
doudou000000/TestDemo
b03adad56c70fa39c08cedf8d6faebfca5609b8a
d12d4f28954c053cc661f1463fd4086f74f48dac
refs/heads/master
2020-06-27T19:26:35.820730
2019-08-01T10:28:31
2019-08-01T10:28:31
200,029,488
1
0
null
null
null
null
UTF-8
Java
false
false
733
java
package com.test.pluginlibrary; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.test.pluginlibrary.test", appContext.getPackageName()); } }
a1a3fe39c1d79e072251c9b836de19dfbc292273
cdceb0cd5840af01e21dd21b2648f571c840e53d
/src/main/java/win/hupubao/mapper/hupubao/TagMapper.java
11909121e1f0e59605f46f77c7d45454ebe5bc65
[]
no_license
ysdxz207/hupubao
3175935a22e4c1c0e06e11f3399caba24767f556
697edf2e278acd906999576d1e2708f5cbe3d6df
refs/heads/master
2020-03-23T22:29:54.512721
2019-01-18T06:23:18
2019-01-18T06:23:18
52,258,543
0
0
null
null
null
null
UTF-8
Java
false
false
593
java
package win.hupubao.mapper.hupubao; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import org.springframework.stereotype.Repository; import win.hupubao.beans.biz.TagBean; import win.hupubao.utils.mybatis.MyMapper; import java.util.List; @Repository public interface TagMapper extends MyMapper<TagBean> { @Select("select * from tag where id in (select tag_id from article_tag where article_id = #{articleId})") List<TagBean> selectTagListByArticleId(@Param("articleId") String articleId); List<TagBean> selectList(TagBean tagBean); }
5e1a8ea5813ad1756e2e6937f7a694d2aa6fd429
292a9143e6c47c3f8e30d8b2742e3bec5c6e43e2
/src/main/java/tool/sql/DelNotifDB.java
c8122844c5e497586978000b1093eddda4d8c7f2
[]
no_license
Kreik2809/PGL_01_extension
0a97f72b324d42dc4444c31937e987a4a3abe724
d86c9fed7a7a753c4131e5d9fb6cb292c6eac9c0
refs/heads/main
2023-05-03T07:34:00.694163
2021-05-25T17:07:22
2021-05-25T17:07:22
353,305,368
0
0
null
null
null
null
UTF-8
Java
false
false
1,297
java
package tool.sql; import java.util.ArrayList; public class DelNotifDB extends DB{ private static String[] COLUMNS = {"USERNAME", "EAN"}; protected DelNotifDB() { super("DELNOTIF", COLUMNS); } public static ArrayList<String> getDelNotifDB(String username) { DelNotifDB db = new DelNotifDB(); ArrayList<DataTable> liste = new ArrayList<>(); liste.add(new DataTable(COLUMNS[0], username)); return db.getDataDB(liste); } public static boolean addDelNotifDB(String username, String ean) { DelNotifDB db = new DelNotifDB(); ArrayList<DataTable> liste = new ArrayList<>(); liste.add(new DataTable(COLUMNS[0], username)); liste.add(new DataTable(COLUMNS[1], ean)); ArrayList<DataTable> liste2 = new ArrayList<>(); liste2.add(new DataTable(COLUMNS[0], username)); liste2.add(new DataTable(COLUMNS[1], ean)); return db.addDataDB(liste, liste2); } public static boolean deleteDelNotifDB(String id, String ean){ DelNotifDB db = new DelNotifDB(); ArrayList<DataTable> liste = new ArrayList<>(); liste.add(new DataTable(COLUMNS[0], id)); liste.add(new DataTable(COLUMNS[1], ean)); return db.deleteDataDB(liste); } }
d3676b6f85c1c3e5adcf5a99fe1cfd2826216225
e9a5b794658f8db0d034c53d50edb3744f4060f2
/business/src/main/java/com/course/business/controller/admin/TeacherController.java
28daa0ecf2cc8bac6bf716adc5d0bdaa02ab797b
[]
no_license
EstAshbell/Course
059f983e27da03ed5df9015d4b524d512be4771f
d129d82d3e56baa8fa8bd7ddd0b0a287579e9e58
refs/heads/master
2023-01-21T11:08:06.115440
2020-12-02T16:37:59
2020-12-02T16:37:59
307,351,221
0
0
null
null
null
null
UTF-8
Java
false
false
2,460
java
package com.course.business.controller.admin; import com.course.server.dto.PageDto; import com.course.server.dto.ResponseDto; import com.course.server.dto.TeacherDto; import com.course.server.service.TeacherService; import com.course.server.util.ValidatorUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; /** * @author: xyl * @time: 2020/9/21 11:14 * @description: */ @RestController @RequestMapping("/admin/teacher") public class TeacherController { private static final Logger LOG = LoggerFactory.getLogger(TeacherController.class); public static final String BUSINESS_NAME = "讲师"; @Resource private TeacherService teacherService; /* * @title : 查询不分页 */ @RequestMapping("/all") public ResponseDto all() { ResponseDto<Object> responseDto = new ResponseDto<>(); List<TeacherDto> list = teacherService.all(); responseDto.setContent(list); return responseDto; } /* * @title : 查询 */ @RequestMapping("/list") public ResponseDto list(@RequestBody PageDto pageDto) { ResponseDto<Object> responseDto = new ResponseDto<>(); teacherService.list(pageDto); responseDto.setContent(pageDto); return responseDto; } /* * @title : 保存 */ @RequestMapping("/save") public ResponseDto save(@RequestBody TeacherDto teacherDto) { //校验 ValidatorUtil.require(teacherDto.getName(), "姓名"); ValidatorUtil.length(teacherDto.getName(),"姓名",1,50); ValidatorUtil.length(teacherDto.getNickname(),"昵称",1,50); ValidatorUtil.length(teacherDto.getImage(),"头像",1,100); ValidatorUtil.length(teacherDto.getPosition(),"职位",1,50); ValidatorUtil.length(teacherDto.getMotto(),"座右铭",1,50); ValidatorUtil.length(teacherDto.getIntro(),"简介",1,500); ResponseDto<Object> responseDto = new ResponseDto<>(); teacherService.save(teacherDto); responseDto.setContent(teacherDto); return responseDto; } /* * @title : 删除 */ @DeleteMapping("/delete/{id}") public ResponseDto delete(@PathVariable("id") String id) { ResponseDto<Object> responseDto = new ResponseDto<>(); teacherService.delete(id); return responseDto; } }
5bd774118a868e5cd016b4f1a818804d919ff7dc
c529779fef3e8175f762268948b998a6be89de4c
/app/src/main/java/com/tilseier/studying/screens/dagger/di2/model/Registered.java
8f8d93c78f6eeacabf3ab47a01f32b415595f3b5
[]
no_license
TilSeier/Studying
3c4286271d5de4ec4d4302afe55840a005485919
16b78184e4bf1db3094dc6836976da35fcf30881
refs/heads/master
2020-08-01T21:39:42.993277
2020-04-05T14:40:50
2020-04-05T14:40:50
211,124,728
1
0
null
null
null
null
UTF-8
Java
false
false
465
java
package com.tilseier.studying.screens.dagger.di2.model; import com.google.gson.annotations.SerializedName; public class Registered { @SerializedName("date") private String date; @SerializedName("age") private Integer age; private void setDate(String date) { this.date = date; } private String getDate() { return this.date; } private void setAge(Integer age) { this.age = age; } private Integer getAge() { return this.age; } }
76b19bfb69a5f52062999855809546c745a8ad70
2534632801fd1f4c59b184088c515a28078e3a70
/src/main/java/com/nswt/entity/system/Department.java
d5037ea7b5001ca1eb2131536e132687e4744965
[]
no_license
SimonHK/ProcessIntegrationPlatform
0b339a7051a858eedf87953471c9f8820cdd0f8b
d7bd97e3a8b125cc1137de7ede8c0498dd0f02d6
refs/heads/master
2021-10-27T16:07:27.150839
2019-04-18T10:28:45
2019-04-18T10:28:45
100,347,976
0
0
null
null
null
null
UTF-8
Java
false
false
2,784
java
package com.nswt.entity.system; import java.util.List; /** * * 类名称:组织机构 * 类描述: * @author HongKai * 作者单位: * 联系方式: * 修改时间:2015年12月16日 * @version 2.0 */ public class Department { private String NAME; //名称 private String NAME_EN; //英文名称 private String BIANMA; //编码 private String PARENT_ID; //上级ID private String HEADMAN; //负责人 private String TEL; //电话 private String FUNCTIONS; //部门职能 private String BZ; //备注 private String ADDRESS; //地址 private String DEPARTMENT_ID; //主键 private String target; private Department department; private List<Department> subDepartment; private boolean hasDepartment = false; private String treeurl; private String icon; public String getIcon() { return icon; } public void setIcon(String icon) { this.icon = icon; } public String getNAME() { return NAME; } public void setNAME(String nAME) { NAME = nAME; } public String getNAME_EN() { return NAME_EN; } public void setNAME_EN(String nAME_EN) { NAME_EN = nAME_EN; } public String getBIANMA() { return BIANMA; } public void setBIANMA(String bIANMA) { BIANMA = bIANMA; } public String getPARENT_ID() { return PARENT_ID; } public void setPARENT_ID(String pARENT_ID) { PARENT_ID = pARENT_ID; } public String getHEADMAN() { return HEADMAN; } public void setHEADMAN(String hEADMAN) { HEADMAN = hEADMAN; } public String getTEL() { return TEL; } public void setTEL(String tEL) { TEL = tEL; } public String getFUNCTIONS() { return FUNCTIONS; } public void setFUNCTIONS(String fUNCTIONS) { FUNCTIONS = fUNCTIONS; } public String getBZ() { return BZ; } public void setBZ(String bZ) { BZ = bZ; } public String getADDRESS() { return ADDRESS; } public void setADDRESS(String aDDRESS) { ADDRESS = aDDRESS; } public String getDEPARTMENT_ID() { return DEPARTMENT_ID; } public void setDEPARTMENT_ID(String dEPARTMENT_ID) { DEPARTMENT_ID = dEPARTMENT_ID; } public String getTarget() { return target; } public void setTarget(String target) { this.target = target; } public Department getDepartment() { return department; } public void setDepartment(Department department) { this.department = department; } public List<Department> getSubDepartment() { return subDepartment; } public void setSubDepartment(List<Department> subDepartment) { this.subDepartment = subDepartment; } public boolean isHasDepartment() { return hasDepartment; } public void setHasDepartment(boolean hasDepartment) { this.hasDepartment = hasDepartment; } public String getTreeurl() { return treeurl; } public void setTreeurl(String treeurl) { this.treeurl = treeurl; } }
7d4e61f24a3c9e7fa960118a032fe301c8149110
b26211316aee52c896b90e825cfe768541cf2285
/src/lesson1/Orange.java
7d06e376fa005153e998f4ec48642999d08522d9
[]
no_license
LupanovDmitriy/prof_level
cb88985eb1a9f5f349447324db31c13c9205a26f
e9a12e8c163539cdebd84c02ebfeeaa7dbdb1aca
refs/heads/master
2022-11-14T22:51:10.742487
2020-07-01T21:01:01
2020-07-01T21:01:01
274,894,523
0
0
null
null
null
null
UTF-8
Java
false
false
118
java
package lesson1; public class Orange extends Fruit { public Orange(float weight) { super(1.5f); } }
[ "geandr20" ]
geandr20
ccbf8b69e69cc489bdb362b5f3d69d53532b7d19
3cc0134da44d939561af7b66be6d03a99256d78d
/src/main/java/org/ttic/dounya/service/dto/package-info.java
fe3925c1f8b9c1e07a6e65f4dfdc65cbe1c1a81f
[]
no_license
zinaLacina/jhipster-with-mongodb
44d605501f118635015799bb08c6b901008234a8
cc372641c9bdffa53c3752f6c7754e169a049f16
refs/heads/master
2020-07-23T10:11:14.500685
2016-08-29T08:00:51
2016-08-29T08:00:51
66,824,590
1
0
null
null
null
null
UTF-8
Java
false
false
71
java
/** * Data Transfer Objects. */ package org.ttic.dounya.service.dto;
157fac9bf87153aabd0ca812efe56505136c3982
501527e55aaa1e574460a54e2c842afa1b033848
/app/src/main/java/com/zucc/xwk_31401151/sharebookclient/utils/common/OkHttpUtil.java
9ed7c264fc1520b999d28a476766a94cd5a74497
[]
no_license
xuwenkai357/ShareBookClient
237e2d583fb038a9c62288239ada453dbf1d05ed
0005f4dfb46e0cfc2d1a011b51d67446ab0b27b9
refs/heads/master
2020-03-09T19:27:25.558873
2018-05-27T20:00:20
2018-05-27T20:00:20
128,958,481
0
0
null
null
null
null
UTF-8
Java
false
false
866
java
package com.zucc.xwk_31401151.sharebookclient.utils.common; import java.util.Map; import okhttp3.FormBody; import okhttp3.OkHttpClient; import okhttp3.Request; /** * Created by Administrator on 2018/4/8. */ public class OkHttpUtil { public static void post(String address, okhttp3.Callback callback, Map<String,String> map){ OkHttpClient client = new OkHttpClient(); FormBody.Builder builder = new FormBody.Builder(); if (map!=null){ for (Map.Entry<String,String> entry:map.entrySet()) { builder.add(entry.getKey(),entry.getValue()); } } FormBody body = builder.build(); Request request = new Request.Builder() .url(address) .post(body) .build(); client.newCall(request).enqueue(callback); } }
7c9be11891f199662cbf0503b67dc6ef10dd26ce
69e5be420c86592041ca2480c7076abeb8ac7a05
/org.vkim/src/org/vkim/Application.java
cd18c74d99611b9802d9ed242b42eadd10235ba0
[]
no_license
strogo/vkim
d753a3e90b716bebe8fe1fa42f87fe4aa032bb0e
ec7d0064b988ba427dab3389aeccf218ab9b4dff
refs/heads/master
2021-01-19T08:26:29.597214
2010-08-16T11:46:57
2010-08-16T11:46:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,281
java
package org.vkim; import org.eclipse.equinox.app.IApplication; import org.eclipse.equinox.app.IApplicationContext; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.PlatformUI; import org.vkim.ui.ApplicationWorkbenchAdvisor; /** * This class controls all aspects of the application's execution */ public class Application implements IApplication { /* (non-Javadoc) * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext) */ public Object start(IApplicationContext context) { Display display = PlatformUI.createDisplay(); try { int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor()); if (returnCode == PlatformUI.RETURN_RESTART) { return IApplication.EXIT_RESTART; } return IApplication.EXIT_OK; } finally { display.dispose(); } } /* (non-Javadoc) * @see org.eclipse.equinox.app.IApplication#stop() */ public void stop() { if (!PlatformUI.isWorkbenchRunning()) return; final IWorkbench workbench = PlatformUI.getWorkbench(); final Display display = workbench.getDisplay(); display.syncExec(new Runnable() { public void run() { if (!display.isDisposed()) workbench.close(); } }); } }
6bd23d9e59fb20d8cadb137d4c592de62d689348
6a303d25fac6c5ce6334d61db3b061afee66798a
/src/main/java/com/cookie/repo/UserRepository.java
365c933b7e703b4dd14f0b1580505b01294a9707
[]
no_license
FochMaiden/blogDuo
5f2d584c437307fdced2c71656ac6ed0b3631800
59cccc02f205fe309af5f6524b919a9b020a2743
refs/heads/master
2021-01-21T15:03:58.800716
2017-06-27T06:07:51
2017-06-27T06:07:51
95,374,112
0
0
null
null
null
null
UTF-8
Java
false
false
332
java
package com.cookie.repo; import com.cookie.model.User; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; /** * Created by FochMaiden */ @Repository("userRepo") public interface UserRepository extends JpaRepository<User, Long> { User findByEmail(String email); }
43f79776abc9430a646921e51b012d90415b15fe
522c4abef6c0410d52dd5b8433bf4487d46c1c25
/efamily-device/src/main/java/com/winterframework/efamily/dao/IEjlUserDeviceDao.java
ad905ac827fb792dc7b83ead09cad76fb5906774
[]
no_license
xjiafei/efamily
05b1c71e1f7f485132e5d6243e7af7208b567517
0401d6ec572c7959721c294408f6d525e3d12866
refs/heads/master
2020-03-10T11:42:00.359799
2018-04-13T08:13:58
2018-04-13T08:13:58
129,361,914
0
3
null
null
null
null
UTF-8
Java
false
false
655
java
package com.winterframework.efamily.dao; import com.winterframework.efamily.core.base.IBaseDao; import com.winterframework.efamily.entity.EjlUserDevice; public interface IEjlUserDeviceDao extends IBaseDao<EjlUserDevice> { /** * 功能:获取用户设备 * @param ejlUserDevice * @return */ public EjlUserDevice getEjlUserDevice(EjlUserDevice ejlUserDevice); /** * 功能:删除用户设备 * @param ejlUserDevice * @return */ public int deleteByDeviceSwitch(EjlUserDevice ejlUserDevice); public int updateByAttribute(EjlUserDevice ejlUserDevice); public EjlUserDevice getByAttribute(EjlUserDevice ejlUserDevice); }
4b191b7d8a388efb2f088c0940da9d11fc661d5c
a62eccf4ce74db234827a7d02b83b4a0aa39b53a
/src/main/java/service/impl/ClientService.java
16a28bc79ecf4d2654c5bd9e897f59149fadc218
[]
no_license
rocketm4n001/wt-project-online-market
7b4211ef34c7c4f20656254622ef6e7d5f208418
c999a1b5555d427e3fb846308e8e7cff193475cf
refs/heads/main
2023-02-04T20:11:29.038278
2020-12-13T15:24:52
2020-12-13T15:24:52
321,095,182
0
0
null
null
null
null
UTF-8
Java
false
false
1,083
java
package service.impl; import beans.UserAccount; import dao.SQLUserDao; import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Base64; public class ClientService { public boolean signIn(String login,String password) { return true; } public boolean isRegistered(String login, String password) { SQLUserDao userDao = new SQLUserDao(); boolean result = userDao.isUserExist(login,password); return result; } public boolean isPasswordsEqual(String pass1, String pass2) { return pass1.equals(pass2); } public static String Hash(String password) { MessageDigest digest = null; try { digest = MessageDigest.getInstance("SHA-256"); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } byte[] encodedhash = digest.digest(password.getBytes(StandardCharsets.UTF_8)); return Base64.getEncoder().encodeToString(encodedhash); } }
5b6c842fdcb08076db7ae5986775817ad0b58b7b
64c2b41770217f47f68e27be7bac691d21ec9817
/module/src/main/java/library/yugisoft/module/Utils/pSmartGridView/SmartGridViewRowHolder.java
3c279f4d0515f32cdc994707c317b158b839e1da
[]
no_license
yugisoft/Library
33668e6add3658e2ffa132756579554af7bbb879
827b99d3018c48de5349869dcc001bc99b8120b4
refs/heads/master
2021-06-04T18:21:20.383288
2020-06-05T06:25:31
2020-06-05T06:25:31
123,543,039
0
0
null
null
null
null
UTF-8
Java
false
false
1,147
java
package library.yugisoft.module.Utils.pSmartGridView; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; import library.yugisoft.module.R; import library.yugisoft.module.yugi; /* Created By Android Resurce Manager Of Yusuf AYDIN 18.10.2019 - 10:32*/ public class SmartGridViewRowHolder extends RecyclerView.ViewHolder { public SmartGridViewRowHolder() { this(null); } public SmartGridViewRowHolder(View itemView) { super(itemView== null ? yugi.activity.getLayoutInflater().inflate(R.layout.view_smart_grid_row,null) :itemView); init(); } public SmartGridViewRowHolder(int itemView) { super(yugi.activity.getLayoutInflater().inflate(itemView,null)); init(); } //region DECLARE public TextView txt_title; public LinearLayout row_detail; public LinearLayout row_divider; //endregion public void init() { txt_title = (TextView)itemView.findViewById(R.id.txt_title); row_detail = (LinearLayout)itemView.findViewById(R.id.row_detail); row_divider = (LinearLayout)itemView.findViewById(R.id.row_divider); } }
030ab731b03a979dd900e333cc9b87f6c0f22046
1d928c3f90d4a0a9a3919a804597aa0a4aab19a3
/java/flink/2016/12/PendingCheckpoint.java
e7df5bc7982efebfb026b599153fec5e3beaefc8
[]
no_license
rosoareslv/SED99
d8b2ff5811e7f0ffc59be066a5a0349a92cbb845
a062c118f12b93172e31e8ca115ce3f871b64461
refs/heads/main
2023-02-22T21:59:02.703005
2021-01-28T19:40:51
2021-01-28T19:40:51
306,497,459
1
1
null
2020-11-24T20:56:18
2020-10-23T01:18:07
null
UTF-8
Java
false
false
12,232
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.flink.runtime.checkpoint; import org.apache.flink.api.common.JobID; import org.apache.flink.runtime.checkpoint.savepoint.Savepoint; import org.apache.flink.runtime.checkpoint.savepoint.SavepointStore; import org.apache.flink.runtime.checkpoint.savepoint.SavepointV1; import org.apache.flink.runtime.concurrent.Future; import org.apache.flink.runtime.concurrent.impl.FlinkCompletableFuture; import org.apache.flink.runtime.executiongraph.ExecutionAttemptID; import org.apache.flink.runtime.executiongraph.ExecutionVertex; import org.apache.flink.runtime.jobgraph.JobVertexID; import org.apache.flink.runtime.state.ChainedStateHandle; import org.apache.flink.runtime.state.OperatorStateHandle; import org.apache.flink.runtime.state.StateUtil; import org.apache.flink.runtime.state.StreamStateHandle; import org.apache.flink.util.Preconditions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.concurrent.Executor; import static org.apache.flink.util.Preconditions.checkArgument; import static org.apache.flink.util.Preconditions.checkNotNull; /** * A pending checkpoint is a checkpoint that has been started, but has not been * acknowledged by all tasks that need to acknowledge it. Once all tasks have * acknowledged it, it becomes a {@link CompletedCheckpoint}. * * <p>Note that the pending checkpoint, as well as the successful checkpoint keep the * state handles always as serialized values, never as actual values. */ public class PendingCheckpoint { private static final Logger LOG = LoggerFactory.getLogger(CheckpointCoordinator.class); private final Object lock = new Object(); private final JobID jobId; private final long checkpointId; private final long checkpointTimestamp; private final Map<JobVertexID, TaskState> taskStates; private final Map<ExecutionAttemptID, ExecutionVertex> notYetAcknowledgedTasks; /** Set of acknowledged tasks */ private final Set<ExecutionAttemptID> acknowledgedTasks; /** Flag indicating whether the checkpoint is triggered as part of periodic scheduling. */ private final boolean isPeriodic; /** * The checkpoint properties. If the checkpoint should be persisted * externally, it happens in {@link #finalizeCheckpoint()}. */ private final CheckpointProperties props; /** Target directory to potentially persist checkpoint to; <code>null</code> if none configured. */ private final String targetDirectory; /** The promise to fulfill once the checkpoint has been completed. */ private final FlinkCompletableFuture<CompletedCheckpoint> onCompletionPromise = new FlinkCompletableFuture<>(); private final Executor executor; private int numAcknowledgedTasks; private boolean discarded; // -------------------------------------------------------------------------------------------- public PendingCheckpoint( JobID jobId, long checkpointId, long checkpointTimestamp, Map<ExecutionAttemptID, ExecutionVertex> verticesToConfirm, boolean isPeriodic, CheckpointProperties props, String targetDirectory, Executor executor) { this.jobId = checkNotNull(jobId); this.checkpointId = checkpointId; this.checkpointTimestamp = checkpointTimestamp; this.notYetAcknowledgedTasks = checkNotNull(verticesToConfirm); this.isPeriodic = isPeriodic; this.taskStates = new HashMap<>(); this.props = checkNotNull(props); this.targetDirectory = targetDirectory; this.executor = Preconditions.checkNotNull(executor); // Sanity check if (props.externalizeCheckpoint() && targetDirectory == null) { throw new NullPointerException("No target directory specified to persist checkpoint to."); } checkArgument(verticesToConfirm.size() > 0, "Checkpoint needs at least one vertex that commits the checkpoint"); acknowledgedTasks = new HashSet<>(verticesToConfirm.size()); } // -------------------------------------------------------------------------------------------- // ------------------------------------------------------------------------ // Properties // ------------------------------------------------------------------------ public JobID getJobId() { return jobId; } public long getCheckpointId() { return checkpointId; } public long getCheckpointTimestamp() { return checkpointTimestamp; } public int getNumberOfNonAcknowledgedTasks() { return notYetAcknowledgedTasks.size(); } public int getNumberOfAcknowledgedTasks() { return numAcknowledgedTasks; } public Map<JobVertexID, TaskState> getTaskStates() { return taskStates; } public boolean isFullyAcknowledged() { return this.notYetAcknowledgedTasks.isEmpty() && !discarded; } public boolean isDiscarded() { return discarded; } boolean isPeriodic() { return isPeriodic; } /** * Checks whether this checkpoint can be subsumed or whether it should always continue, regardless * of newer checkpoints in progress. * * @return True if the checkpoint can be subsumed, false otherwise. */ public boolean canBeSubsumed() { // If the checkpoint is forced, it cannot be subsumed. return !props.forceCheckpoint(); } CheckpointProperties getProps() { return props; } String getTargetDirectory() { return targetDirectory; } // ------------------------------------------------------------------------ // Progress and Completion // ------------------------------------------------------------------------ /** * Returns the completion future. * * @return A future to the completed checkpoint */ public Future<CompletedCheckpoint> getCompletionFuture() { return onCompletionPromise; } public CompletedCheckpoint finalizeCheckpoint() { synchronized (lock) { Preconditions.checkState(isFullyAcknowledged(), "Pending checkpoint has not been fully acknowledged yet."); // Persist if required String externalPath = null; if (props.externalizeCheckpoint()) { try { Savepoint savepoint = new SavepointV1(checkpointId, taskStates.values()); externalPath = SavepointStore.storeSavepoint( targetDirectory, savepoint); } catch (IOException e) { LOG.error("Failed to persist checkpoint {}.",checkpointId, e); } } CompletedCheckpoint completed = new CompletedCheckpoint( jobId, checkpointId, checkpointTimestamp, System.currentTimeMillis(), new HashMap<>(taskStates), props, externalPath); onCompletionPromise.complete(completed); dispose(false); return completed; } } /** * Acknowledges the task with the given execution attempt id and the given subtask state. * * @param executionAttemptId of the acknowledged task * @param subtaskState of the acknowledged task * @return TaskAcknowledgeResult of the operation */ public TaskAcknowledgeResult acknowledgeTask( ExecutionAttemptID executionAttemptId, SubtaskState subtaskState) { synchronized (lock) { if (discarded) { return TaskAcknowledgeResult.DISCARDED; } final ExecutionVertex vertex = notYetAcknowledgedTasks.remove(executionAttemptId); if (vertex == null) { if (acknowledgedTasks.contains(executionAttemptId)) { return TaskAcknowledgeResult.DUPLICATE; } else { return TaskAcknowledgeResult.UNKNOWN; } } else { acknowledgedTasks.add(executionAttemptId); } if (null != subtaskState) { JobVertexID jobVertexID = vertex.getJobvertexId(); int subtaskIndex = vertex.getParallelSubtaskIndex(); TaskState taskState = taskStates.get(jobVertexID); if (null == taskState) { ChainedStateHandle<StreamStateHandle> nonPartitionedState = subtaskState.getLegacyOperatorState(); ChainedStateHandle<OperatorStateHandle> partitioneableState = subtaskState.getManagedOperatorState(); //TODO this should go away when we remove chained state, assigning state to operators directly instead int chainLength; if (nonPartitionedState != null) { chainLength = nonPartitionedState.getLength(); } else if (partitioneableState != null) { chainLength = partitioneableState.getLength(); } else { chainLength = 1; } taskState = new TaskState( jobVertexID, vertex.getTotalNumberOfParallelSubtasks(), vertex.getMaxParallelism(), chainLength); taskStates.put(jobVertexID, taskState); } long duration = System.currentTimeMillis() - checkpointTimestamp; subtaskState.setDuration(duration); taskState.putState(subtaskIndex, subtaskState); } ++numAcknowledgedTasks; return TaskAcknowledgeResult.SUCCESS; } } /** * Result of the {@link PendingCheckpoint#acknowledgedTasks} method. */ public enum TaskAcknowledgeResult { SUCCESS, // successful acknowledge of the task DUPLICATE, // acknowledge message is a duplicate UNKNOWN, // unknown task acknowledged DISCARDED // pending checkpoint has been discarded } // ------------------------------------------------------------------------ // Cancellation // ------------------------------------------------------------------------ /** * Aborts a checkpoint because it expired (took too long). */ public void abortExpired() { try { onCompletionPromise.completeExceptionally(new Exception("Checkpoint expired before completing")); } finally { dispose(true); } } /** * Aborts the pending checkpoint because a newer completed checkpoint subsumed it. */ public void abortSubsumed() { try { if (props.forceCheckpoint()) { onCompletionPromise.completeExceptionally(new Exception("Bug: forced checkpoints must never be subsumed")); throw new IllegalStateException("Bug: forced checkpoints must never be subsumed"); } else { onCompletionPromise.completeExceptionally(new Exception("Checkpoints has been subsumed")); } } finally { dispose(true); } } public void abortDeclined() { try { onCompletionPromise.completeExceptionally(new Exception("Checkpoint was declined (tasks not ready)")); } finally { dispose(true); } } /** * Aborts the pending checkpoint due to an error. * @param cause The error's exception. */ public void abortError(Throwable cause) { try { onCompletionPromise.completeExceptionally(new Exception("Checkpoint failed: " + cause.getMessage(), cause)); } finally { dispose(true); } } private void dispose(boolean releaseState) { synchronized (lock) { try { numAcknowledgedTasks = -1; if (!discarded && releaseState) { executor.execute(new Runnable() { @Override public void run() { try { StateUtil.bestEffortDiscardAllStateObjects(taskStates.values()); } catch (Exception e) { LOG.warn("Could not properly dispose the pending checkpoint " + "{} of job {}.", checkpointId, jobId, e); } } }); } } finally { discarded = true; taskStates.clear(); notYetAcknowledgedTasks.clear(); acknowledgedTasks.clear(); } } } // -------------------------------------------------------------------------------------------- @Override public String toString() { return String.format("Pending Checkpoint %d @ %d - confirmed=%d, pending=%d", checkpointId, checkpointTimestamp, getNumberOfAcknowledgedTasks(), getNumberOfNonAcknowledgedTasks()); } }
efae099a8e7e1a8bf284350fcab2dab66d565349
c1922d87a4ae677d6ba4ccf8f1f076d2e1c6b70b
/src/java/Data/DBUtil.java
4f460d5d684b0bf7f24c1b36391f02994a3142e7
[]
no_license
ShruthaKashyap/NBAD
155182c2202c57a19ff5ca7a0540a747fe5ac93b
a7dae62163f279b7abae5faea776fe5ec2800ba0
refs/heads/master
2021-01-21T14:56:46.465277
2017-06-19T22:18:37
2017-06-19T22:18:37
88,954,765
0
0
null
null
null
null
UTF-8
Java
false
false
958
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 Data; /** * * @author shrut */ import java.sql.*; public class DBUtil { public static void closeStatement(Statement s) { try { if (s != null) { s.close(); } } catch (SQLException e) { System.out.println(e); } } public static void closePreparedStatement(Statement ps) { try { if (ps != null) { ps.close(); } } catch (SQLException e) { System.out.println(e); } } public static void closeResultSet(ResultSet rs) { try { if (rs != null) { rs.close(); } } catch (SQLException e) { System.out.println(e); } } }
8a37f6a7f571b0dfe000aab9682ecdfb7a4626de
c4d38b45cf30388fa7b30442a96b145f4fa77d00
/Calculate.java
996460b6fa026b6d140aae0686bfc7778876e672
[]
no_license
Engelos/java-courses
b5b2d75d3e198d1ee1c17d713707d6e75f81ec13
15aab1b06b29eec76cfd9ed827e9f7eb4652e303
refs/heads/master
2021-01-10T17:16:14.387550
2015-11-23T19:59:29
2015-11-23T19:59:29
46,743,185
0
0
null
null
null
null
UTF-8
Java
false
false
132
java
public class Calculate { public static void main(String[] arg) { System.out.println("Calculate..."); } }
f0ed5315b73e0a34e2867f28f9ca231df23b1dc8
fb09b3e048ead55f435f7dea0c646563e48a82a9
/ui/src/main/java/com/jidouauto/ui/oushang/Common.java
0366b29b294828f0974c600198da9a0952a23031
[]
no_license
MissTeven/NavigationDemo
bea94a2757843834e0bfa24a2f52e16ab69cf324
77229fc1b23e70b18782d414dd50447d225c16e3
refs/heads/master
2020-04-26T22:13:11.406523
2019-04-10T02:52:10
2019-04-10T02:52:10
173,865,406
13
0
null
null
null
null
UTF-8
Java
false
false
59
java
package com.jidouauto.ui.oushang; public class Common { }
76ab543780b4f1dc0d73643df5b095c0063a3f02
27b8d2acfdbbc6c0b57a98976e964165326b2242
/app/src/test/java/com/example/pablocovarrubias/androidexamples/ExampleUnitTest.java
ba9bfb537e7bdfd869b8cf5318c0165d5f0bd54b
[]
no_license
pablochrun/AndroidExample
909c823c29098931d73b13c7744bd7076f8e422e
47e192913157cef14e18228488f844a6245f6e87
refs/heads/master
2021-01-14T08:04:17.023777
2017-02-14T15:52:54
2017-02-14T15:52:54
81,914,447
0
0
null
null
null
null
UTF-8
Java
false
false
422
java
package com.example.pablocovarrubias.androidexamples; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
93aaaf014411512f29d444cab8ee7eda0740a0fe
f36f446c83db055699de715f9667b4c9b7c57e1a
/app/src/main/java/com/marquelo/getstars/Cardview/item/fotos/personalizada/ItemPhotoCustomActivity.java
dcdcd2bc13061b22b7b7d6b2e19f9599fb1336d0
[]
no_license
EmilioMartel/GetStars
3745cc52494ff4c3eeb5c6ee94ce91ced5a8dd88
d96664e6e97ef8ee41d95cbdf37aa72b8ca750e1
refs/heads/master
2023-06-25T02:42:27.737900
2020-12-13T22:41:34
2020-12-13T22:41:34
321,175,148
0
0
null
null
null
null
UTF-8
Java
false
false
4,439
java
package com.marquelo.getstars.Cardview.item.fotos.personalizada; import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.WindowManager; import android.widget.EditText; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.RadioButton; import android.widget.Toast; import com.bumptech.glide.Glide; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.firestore.FirebaseFirestore; import com.marquelo.getstars.R; import com.marquelo.getstars.ui.ItemCarritoAdded; import com.marquelo.getstars.working.Famoso; import com.marquelo.getstars.working.ItemCarrito; import java.util.HashMap; import java.util.Map; import java.util.Objects; public class ItemPhotoCustomActivity extends AppCompatActivity { private Famoso famoso; private ImageView img; private RadioButton rbtnCumple, rbtnGeneral, rbtnEnfermedad, rbtnOtro;; private EditText multiLineObservaciones; private ImageButton carrito; private Uri uri; private FirebaseFirestore db = FirebaseFirestore.getInstance(); private FirebaseUser usuario = FirebaseAuth.getInstance().getCurrentUser(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE); setContentView(R.layout.activity_item_foto_personalizada); setTitle("Foto personalizada"); ActionBar actionBar = getSupportActionBar(); assert actionBar != null; actionBar.setDisplayHomeAsUpEnabled(true); iniciarVistas(); iniciarValores(); goCarrito(); } @Override public boolean onSupportNavigateUp() { onBackPressed(); return super.onSupportNavigateUp(); } private void iniciarVistas(){ famoso = Objects.requireNonNull(getIntent().getExtras()).getParcelable("famoso"); img = findViewById(R.id.imageView); rbtnCumple = findViewById(R.id.rbtnCumpleanios); rbtnEnfermedad = findViewById(R.id.rbtnEnfermedad); rbtnGeneral = findViewById(R.id.rbtnGeneral); carrito = findViewById(R.id.btnCarritoFotoPersonalizada); } private void iniciarValores(){ if(famoso != null){ Glide.with(this).load(famoso.getImg()).into(img); uri = famoso.getImg(); } carrito.setOnClickListener(v -> goCarrito()); } public void goCarrito(){ carrito.setOnClickListener(v -> { String res=""; if(rbtnCumple.isChecked()){ res = "Cumpleaños"; addCarrito(res); }else if(rbtnEnfermedad.isChecked()){ res = "Enfermedad"; addCarrito(res); }else if(rbtnGeneral.isChecked()){ res = "General"; addCarrito(res); }else{ Toast.makeText(this,"Seleccione una categoría",Toast.LENGTH_SHORT).show(); } }); } private void addCarrito(String observaciones){ // Create a new user with a first and last name Map<String,Object> mapa = new HashMap<>(); ItemCarrito articulos = new ItemCarrito(); articulos.setNombre("Foto Personalizada"); articulos.setMotivo(observaciones); articulos.setObservaciones(observaciones); articulos.setPrecio(6.99); articulos.setImagen(uri.toString()); articulos.setCreador(famoso.getName()); articulos.setKey(famoso.getKey()); mapa.put("nombre",articulos.getNombre()); mapa.put("creador",articulos.getCreador()); mapa.put("observaciones",articulos.getObservaciones()); mapa.put("precio",articulos.getPrecio()); mapa.put("img",articulos.getImagen()); mapa.put("key",articulos.getKey()); // Add a new document with a generated ID db.collection("usuarios") .document(Objects.requireNonNull(usuario.getEmail())) .collection("Carrito").add(mapa) .addOnSuccessListener(documentReference -> startActivity(new Intent(getApplicationContext(), ItemCarritoAdded.class))); } }
4221ead15d6849cb7a4079be23b88113760e535a
8c38376f4d3ff89fa323da091d888072b3fece03
/src/main/java/com/sample/service/TeachingStaffService.java
f0d142d1f918d25dacb163298628f3517edfeba6
[]
no_license
ChethanaNagarjun/schoolproject
5bf01dd0e110c65041cebd41d19b12456da0564c
c827504e9a7a55f0ad8891afb21aa806ab0cf0b8
refs/heads/master
2020-05-20T21:26:09.340797
2019-05-09T08:56:29
2019-05-09T08:56:29
185,762,187
0
0
null
null
null
null
UTF-8
Java
false
false
470
java
package com.sample.service; import java.util.List; import java.util.UUID; import com.sample.modelmapper.TeachingStaffDetail; public interface TeachingStaffService { public UUID save(TeachingStaffDetail teachingstaffdetail) throws Throwable; public void delete(UUID teachingstaffdetail) throws Throwable; public void update(UUID teachingstaffdetail,Integer salary) throws Throwable; public List<TeachingStaffDetail> getAllTeachingStaffs() throws Throwable; }
cc5d06e527ee6173eff47f2d8ac9420eb6ed4035
2570232ec643020a4d3abef649a12a1f71b9690b
/src/main/org/deidentifier/arx/risk/RiskModelSampleSummary.java
6546f10a42a04fbdd9644955ffcb9927f6d1e794
[ "Apache-2.0" ]
permissive
mariogasparsilva/arx
319dae6fbee6c67c873833964e8e2dfcdc9c9122
204214fb1a4c56da0fcc85866b69d8bf60452ccd
refs/heads/master
2023-06-28T21:48:29.161578
2021-07-09T09:25:06
2021-07-09T09:25:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
18,233
java
/* * ARX: Powerful Data Anonymization * Copyright 2012 - 2021 Fabian Prasser and contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.deidentifier.arx.risk; import java.util.Arrays; import java.util.Set; import org.deidentifier.arx.DataHandleInternal; import org.deidentifier.arx.common.Groupify; import org.deidentifier.arx.common.Groupify.Group; import org.deidentifier.arx.common.TupleWrapper; import org.deidentifier.arx.common.WrappedBoolean; import org.deidentifier.arx.common.WrappedInteger; import org.deidentifier.arx.exceptions.ComputationInterruptedException; import org.deidentifier.arx.reliability.ParameterTranslation; /** * This class implements risk measures as proposed by El Emam in * "Guide to the De-Identification of Personal Health Information", * "Measuring the Probability of Re-Identification" * * @author Fabian Prasser */ public class RiskModelSampleSummary { /** * Journalist risk * @author Fabian Prasser */ public static class JournalistRisk extends RiskSummary { /** * Creates a new instance * @param t * @param rA * @param rB * @param rC */ protected JournalistRisk(double t, double rA, double rB, double rC) { super(t, rA, rB, rC); } } /** * Marketer risk * * @author Fabian Prasser */ public static class MarketerRisk { /** Proportion of records that can be re-identified on average*/ private final double rC; /** * Creates a new instance * @param rC */ protected MarketerRisk(double rC) { this.rC = rC; } /** * Proportion of records that can be re-identified on average * @return */ public double getSuccessRate() { return Double.isNaN(rC) ? 0d : rC; } } /** * Prosecutor risk * @author Fabian Prasser */ public static class ProsecutorRisk extends RiskSummary { /** * Creates a new instance * @param t * @param rA * @param rB * @param rC */ protected ProsecutorRisk(double t,double rA, double rB, double rC) { super(t, rA, rB, rC); } } /** * A set of derived risk estimates * * @author Fabian Prasser */ public static class RiskSummary { /** User-specified threshold*/ private final double t; /** Proportion of records with risk above threshold*/ private final double rA; /** Maximum probability of re-identification*/ private final double rB; /** Proportion of records that can be re-identified on average*/ private final double rC; /** * Creates a new instance * @param t * @param rA * @param rB * @param rC */ protected RiskSummary(double t, double rA, double rB, double rC) { this.t = t; this.rA = rA; this.rB = rB; this.rC = rC; } /** * Returns the average risk * @return the average risk */ public double getAverageRisk() { return getSuccessRate(); } /** * Returns the effective threshold, which may differ from user-specified parameters due to rounding issues. * @return */ public double getEffectiveRiskThreshold() { return ParameterTranslation.getEffectiveRiskThreshold(t); } /** * Maximum probability of re-identification * @return */ public double getHighestRisk() { return Double.isNaN(rB) ? 0d : rB; } /** * Proportion of records with risk above threshold * @return */ public double getRecordsAtRisk() { return Double.isNaN(rA) ? 0d : rA; } /** * Returns the threshold specified by the user. Note: the actual threshold used may differ slightly. * See: <code>getEffectiveRiskThreshold()</code>. * @return */ public double getRiskThreshold() { return t; } /** * Proportion of records that can be re-identified on average * @return */ public double getSuccessRate() { return Double.isNaN(rC) ? 0d : rC; } } /** Prosecutor risk */ private final ProsecutorRisk prosecutorRisk; /** Journalist risk */ private final JournalistRisk journalistRisk; /** Marketer risk */ private final MarketerRisk marketerRisk; /** Acceptable highest probability of re-identification for a single record */ private final double threshold; /** * Creates a new instance * @param handle Handle * @param identifiers Identifiers * @param threshold Acceptable highest probability of re-identification for a single record. Please note that this * threshold may be exceeded by up to 1% due to rounding issues. * @param suppressed * @param stop Stop flag * @param progress Progress */ public RiskModelSampleSummary(DataHandleInternal handle, Set<String> identifiers, double threshold, String suppressed, WrappedBoolean stop, WrappedInteger progress) { // Init this.threshold = threshold; // Prepare Groupify<TupleWrapper> sample; Groupify<TupleWrapper> population; if (handle.getSuperset() != null) { sample = getGroups(handle, identifiers, 0d, 0.45d, stop, progress, false, suppressed); population = getGroups(handle.getSuperset(), identifiers, 0.45d, 0.45d, stop, progress, true, suppressed); } else { sample = getGroups(handle, identifiers, 0d, 0.9d, stop, progress, false, suppressed); population = sample; } if (sample.size() == 0) { this.prosecutorRisk = new ProsecutorRisk(threshold, 0d, 0d, 0d); this.journalistRisk = new JournalistRisk(threshold, 0d, 0d, 0d); this.marketerRisk = new MarketerRisk(0d); } else { this.prosecutorRisk = getProsecutorRisk(population, sample, 0.9d, stop, progress); this.journalistRisk = getJournalistRisk(population, sample, 0.933d, stop, progress); this.marketerRisk = getMarketerRisk(population, sample, 0.966d, stop, progress); } } /** * Creates a new instance * @param handle Handle * @param identifiers Identifiers * @param threshold Acceptable highest probability of re-identification for a single record. Please note that this * threshold may be exceeded by up to 1% due to rounding issues. * @param suppressed * @param stop Stop flag * @param progress Progress */ public RiskModelSampleSummary(DataHandleInternal handle, Set<String> identifiers, double threshold, WrappedBoolean stop, WrappedInteger progress) { this(handle, identifiers, threshold, null, stop, progress); } /** * Returns the journalist risk * @return */ public JournalistRisk getJournalistRisk() { return journalistRisk; } /** * Returns the marketer risk * @return */ public MarketerRisk getMarketerRisk() { return marketerRisk; } /** * Returns the prosecutor risk * @return */ public ProsecutorRisk getProsecutorRisk() { return prosecutorRisk; } /** * Returns the user-defined risk threshold for individual records * @return */ public double getThreshold() { return threshold; } /** * Computes the equivalence classes * @param handle * @param qis * @param offset * @param factor * @param stop * @param progress * @param ignoreOutliers * @param suppressed * @return */ private Groupify<TupleWrapper> getGroups(DataHandleInternal handle, Set<String> qis, double offset, double factor, WrappedBoolean stop, WrappedInteger progress, boolean ignoreOutliers, String suppressed) { /* ******************************** * Check * ********************************/ if (handle == null) { throw new NullPointerException("Handle is null"); } if (qis == null) { throw new NullPointerException("Quasi identifiers must not be null"); } for (String q : qis) { if (handle.getColumnIndexOf(q) == -1) { throw new IllegalArgumentException(q + " is not an attribute"); } } /* ******************************** * Build equivalence classes * ********************************/ final int[] indices = new int[qis.size()]; int index = 0; for (final String attribute : qis) { indices[index++] = handle.getColumnIndexOf(attribute); } Arrays.sort(indices); // Calculate equivalence classes int capacity = handle.getNumRows() / 10; capacity = capacity > 10 ? capacity : 10; Groupify<TupleWrapper> map = new Groupify<TupleWrapper>(capacity); int numRows = handle.getNumRows(); for (int row = 0; row < numRows; row++) { int prog = (int) Math.round(offset + (double) row / (double) numRows * factor); if (prog != progress.value) { progress.value = prog; } if (ignoreOutliers || !handle.isOutlier(row, indices)) { TupleWrapper tuple = new TupleWrapper(handle, indices, row, ignoreOutliers); map.add(tuple); } if (stop.value) { throw new ComputationInterruptedException(); } } // Return return map; } /** * Computes risks * @param population * @param sample * @param offset * @param progress * @param stop * @return */ private JournalistRisk getJournalistRisk(Groupify<TupleWrapper> population, Groupify<TupleWrapper> sample, double offset, WrappedBoolean stop, WrappedInteger progress) { // Init double rA = 0d; double rB = 0d; double rC = 0d; double rC1 = 0d; double rC2 = 0d; double numRecordsInSample = 0d; double numClassesInSample = 0d; double smallestClassSizeInPopulation = Integer.MAX_VALUE; int maxindex = sample.size(); int index = 0; // For each group Group<TupleWrapper> element = sample.first(); while (element != null) { // Track progress int prog = (int) Math.round(offset + (double) index++ / (double) maxindex * 3.3d); if (prog != progress.value) { progress.value = prog; } // Process int groupSizeInSample = element.getCount(); int groupSizeInPopulation = groupSizeInSample; if (population != sample) { groupSizeInPopulation = population.get(element.getElement()).getCount(); } // Compute rA if (1d / groupSizeInPopulation > threshold) { rA += groupSizeInSample; } // Compute rB if (groupSizeInPopulation < smallestClassSizeInPopulation) { smallestClassSizeInPopulation = groupSizeInPopulation; } // Compute rC numClassesInSample++; numRecordsInSample += groupSizeInSample; rC1 += groupSizeInPopulation; rC2 += (double) groupSizeInSample / (double) groupSizeInPopulation; // Next element element = element.next(); // Stop, if required if (stop.value) { throw new ComputationInterruptedException(); } } // Finalize rA rA /= numRecordsInSample; // Compute rB: smallest class is first class in the histogram rB = 1d / smallestClassSizeInPopulation; // Compute rC rC1 = numClassesInSample / rC1; rC2 = rC2 / numRecordsInSample; rC = Math.max(rC1, rC2); // Return return new JournalistRisk(threshold, rA, rB, rC); } /** * Computes risks * @param population * @param sample * @param offset * @param progress * @param stop * @return */ private MarketerRisk getMarketerRisk(Groupify<TupleWrapper> population, Groupify<TupleWrapper> sample, double offset, WrappedBoolean stop, WrappedInteger progress) { // Init double rC = 0d; double numRecordsInSample = 0d; int maxindex = sample.size(); int index = 0; // For each group Group<TupleWrapper> element = sample.first(); while (element != null) { // Track progress int prog = (int) Math.round(offset + (double) index++ / (double) maxindex * 3.3d); if (prog != progress.value) { progress.value = prog; } // Process int groupSizeInSample = element.getCount(); int groupSizeInPopulation = groupSizeInSample; if (population != sample) { groupSizeInPopulation = population.get(element.getElement()).getCount(); } // Compute rC numRecordsInSample += groupSizeInSample; rC += (double) groupSizeInSample / (double) groupSizeInPopulation; // Next element element = element.next(); // Stop, if required if (stop.value) { throw new ComputationInterruptedException(); } } // Compute rC rC = rC / numRecordsInSample; // Return return new MarketerRisk(rC); } /** * Computes risks * @param population * @param sample * @param offset * @param progress * @param stop * @return */ private ProsecutorRisk getProsecutorRisk(Groupify<TupleWrapper> population, Groupify<TupleWrapper> sample, double offset, WrappedBoolean stop, WrappedInteger progress) { // Init double rA = 0d; double rB = 0d; double rC = 0d; double numRecords = 0d; double numClasses = 0d; double smallestClassSize = Integer.MAX_VALUE; int maxindex = sample.size(); int index = 0; // For each group Group<TupleWrapper> element = sample.first(); while (element != null) { // Track progress int prog = (int) Math.round(offset + (double) index++ / (double) maxindex * 3.3d); if (prog != progress.value) { progress.value = prog; } // Compute rA int groupSize = element.getCount(); if (1d / groupSize > threshold) { rA += groupSize; } // Compute rB if (groupSize < smallestClassSize) { smallestClassSize = groupSize; } // Compute rC numClasses++; numRecords += groupSize; // Next element element = element.next(); // Stop, if required if (stop.value) { throw new ComputationInterruptedException(); } } // Finalize rA rA /= numRecords; // Compute rB: smallest class is first class in the histogram rB = 1d / smallestClassSize; // Compute rC rC = numClasses / numRecords; // Return return new ProsecutorRisk(threshold, rA, rB, rC); } }
fcabd685ecac288bf0767c2d674990cf87f0a1b1
cee07e9b756aad102d8689b7f0db92d611ed5ab5
/src_6/org/benf/cfr/tests/CondJumpTest10.java
08ea98e4250116a832c89266ecca103afa4f8b15
[ "MIT" ]
permissive
leibnitz27/cfr_tests
b85ab71940ae13fbea6948a8cc168b71f811abfd
b3aa4312e3dc0716708673b90cc0a8399e5f83e2
refs/heads/master
2022-09-04T02:45:26.282511
2022-08-11T06:14:39
2022-08-11T06:14:39
184,790,061
11
5
MIT
2022-02-24T07:07:46
2019-05-03T16:49:01
Java
UTF-8
Java
false
false
314
java
package org.benf.cfr.tests; /** * Created by IntelliJ IDEA. * User: lee * Date: 07/06/2011 * Time: 06:24 * To change this template use File | Settings | File Templates. */ public class CondJumpTest10 { public boolean test(int a, int b) { if (a==b) { } return a>b; } }
fd294a2d4f9ed30ec20e66dbd200df3995c3fc15
2054038ddd44181a70dcf7a1b4260e7afcd8400e
/src/it/unipr/ce/dsg/p2pgame/GUI/BattlefieldMouseListener.java
80c9f16ebef4b358541301101558ee87ddfb6c9d
[]
no_license
dsg-unipr/patrol
621e031fc96c289a3144bc94ee81942c7378e785
099b725866ccb6256478dd5683c48460f99f9793
refs/heads/master
2021-01-20T04:28:47.924916
2015-08-03T09:57:28
2015-08-03T09:57:28
40,116,704
0
0
null
null
null
null
UTF-8
Java
false
false
23,575
java
package it.unipr.ce.dsg.p2pgame.GUI; import it.unipr.ce.dsg.p2pgame.GUI.KnowledgeSpace.SpaceType; import it.unipr.ce.dsg.p2pgame.platform.GamePeer; import it.unipr.ce.dsg.p2pgame.platform.GamePlayer; import it.unipr.ce.dsg.p2pgame.platform.GamePlayerResponsible; import it.unipr.ce.dsg.p2pgame.platform.GameResourceMobile; import it.unipr.ce.dsg.p2pgame.platform.GameResourceMobileResponsible; import it.unipr.ce.dsg.p2pgame.util.MultiLog; import java.awt.Choice; import java.awt.event.ItemEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionListener; import java.util.ArrayList; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; public class BattlefieldMouseListener extends MouseAdapter implements MouseMotionListener { public BattlefieldMouseListener(JLabel x, JLabel y, int g, JPanel panel, GamePeer gp, BattlefieldPanel bf){ this.xLab = x; this.yLab = y; this.gran = g; this.panel = panel; this.gp = gp; this.bf = bf; this.request=new MessageSender(); } private JPanel panel; private GamePeer gp; private static BattlefieldPanel bf; private JButton moveButton; private JLabel resType; private JLabel info; private JLabel qt; private Choice choice; private GameResourceMobile starship; private int selection = 0; private ArrayList<String> attack = new ArrayList<String>(); private JLabel xLab; private JLabel yLab; private int gran; private int X = 0; private int Y = 0; // points used to determinate the route private int x_a = -1; private int y_a = -1; private int x_b = -1; private int y_b = -1; private String mobRes = null; // this object is used for send the message requests from the GUI to the engine MessageSender request; //TODO: aggiungere una variabile per indicare la parte di click che si sta considerando private void initComponent(){ MultiLog.println(BattlefieldMouseListener.class.toString(), "#### Get Component Name"); for (int i=0; i < this.panel.getComponentCount(); i++){ MultiLog.println(BattlefieldMouseListener.class.toString(), i + ": " + this.panel.getComponent(i).getName()); if (this.panel.getComponent(i).getName() != null ){ if (this.panel.getComponent(i).getName().compareTo("resType") == 0){ MultiLog.println(BattlefieldMouseListener.class.toString(), "Found RESTYPE"); this.resType = (JLabel) this.panel.getComponent(i); } else if (this.panel.getComponent(i).getName().compareTo("Info") == 0){ this.info = (JLabel) this.panel.getComponent(i); } else if (this.panel.getComponent(i).getName().compareTo("qtInfo") == 0) { this.qt = (JLabel) this.panel.getComponent(i); } else if (this.panel.getComponent(i).getName().compareTo("Choice") == 0){ this.choice = (Choice) this.panel.getComponent(i); } else if (this.panel.getComponent(i).getName().compareTo("move") == 0){ this.moveButton = (JButton) this.panel.getComponent(i); } } } this.moveButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { moveButtonActionPerformed(evt); } }); } private void setAllInvisible(){ this.moveButton.setVisible(false); this.resType.setVisible(false); this.info.setVisible(false); this.qt.setVisible(false); this.choice.setVisible(false); } //il primo punto selezionato dev'essere il nostro pianeta o una nostra navicella ////il secondo punto qualsiasi cosa ma se è un altro pianeta o una navicella nemica attaccarla alla fine public void mousePressed(MouseEvent ev) { this.initComponent(); this.setAllInvisible(); //TODO: fare la funzione di spostamento o attacco MultiLog.println(BattlefieldMouseListener.class.toString(), "Mouse Pressed Called !"); int x_pos = (int) ( (double) X / this.gran ); int y_pos = (int) ( (double) Y / this.gran ); MultiLog.println(BattlefieldMouseListener.class.toString(), "Mouse pressed:: offset position " + x_pos + ", " + y_pos); MultiLog.println(BattlefieldMouseListener.class.toString(), "Calculating path..."); //System.out.println("Calculating path..."); if (this.x_a == -1 && this.y_a == -1){ //se � il primo punto selezionato si occupa soltanto di caricare le informazioni //TODO: vedere il tipo di risorsa selezionata this.x_a = x_pos; this.y_a = y_pos; KnowledgeSpace kl = this.bf.getKnowledgeFor(this.x_a, this.y_a); if (kl.getType() == SpaceType.UNKNOW || kl.getType() == SpaceType.SPACE ){ this.x_a = -1; this.y_a = -1; MultiLog.println(BattlefieldMouseListener.class.toString(), "Selected Nothing!"); } else if(kl.getType() == SpaceType.STARSHIP){ MultiLog.println(BattlefieldMouseListener.class.toString(), "Setting icon..."); this.resType.setIcon(new javax.swing.ImageIcon("res/starship_trasp.png")); this.resType.setVisible(true); GameResourceMobileResponsible ship = (GameResourceMobileResponsible) kl.getElement(); //TODO: fornire l'opzione per poter attaccare String id =""; id = this.request.getGamePeerId(); //System.out.println("201 if " + id); if (ship.getOwnerId().compareTo(id) == 0){ this.info.setText("MY STARSHIP"); this.info.setVisible(true); this.qt.setText(Double.toString(ship.getQuantity())); this.qt.setVisible(true); this.starship = ship; MultiLog.println(BattlefieldMouseListener.class.toString(), "Nome " + this.starship.getId() + " qt " + this.starship.getQuantity()); } else { // if isn't my starship this.info.setText(ship.getOwner()); this.info.setVisible(true); this.x_a = -1; this.y_a = -1; } } else if (kl.getType() == SpaceType.PLANET){ MultiLog.println(BattlefieldMouseListener.class.toString(), "Setting icon..."); this.resType.setIcon(new javax.swing.ImageIcon("res/planet.jpg")); this.resType.setVisible(true); GamePlayerResponsible player = (GamePlayerResponsible) kl.getElement(); if (kl.getElement() == null){ MultiLog.println(BattlefieldMouseListener.class.toString(), "ELEMENTO PLANET NULL "); } String gpdes=""; gpdes = this.request.getGamePeerDescription(); //System.out.println("252 gamepeerdesc"); //System.out.println(gpdes); String id =""; id = this.request.getGamePeerId(); //System.out.println("271 multilog "+id); MultiLog.println(BattlefieldMouseListener.class.toString(),id); MultiLog.println(BattlefieldMouseListener.class.toString(),player.getName()); MultiLog.println(BattlefieldMouseListener.class.toString(),player.getId()); id = this.request.getGamePeerId(); //System.out.println("305 if "+id); if (player.getId().compareTo(id) == 0){ MultiLog.println(BattlefieldMouseListener.class.toString(), "Create my planet info"); System.out.println(this.panel); this.info.setText("MY PLANET"); this.info.setVisible(true); ArrayList<Object> res=null; res = this.request.getResources(); // System.out.println("321 Risorse"); int k=0; for (int i = 0; i < res.size(); i++){ if (res.get(i) instanceof GameResourceMobile){ GameResourceMobile mob = (GameResourceMobile) res.get(i); //Visualizza soltanto gli elementi che sono alla base if (mob.getX() == player.getPosX() && mob.getY() == player.getPosY()){ attack.add(mob.getId()); this.choice.add(Double.toString(mob.getQuantity()) + "-" + mob.getId().substring(0, 31)); //TODO:aggiungere un listener che cambia la quantità della label this.choice.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(ItemEvent e) { MultiLog.println(BattlefieldMouseListener.class.toString(), "selected " + choice.getSelectedIndex()); selection = choice.getSelectedIndex(); qt.setText(Double.toString(request.getMyResourceFromId(attack.get(selection)).getQuantity())); // System.out.println("344 resource from id"); } }); this.choice.setVisible(true); if (!this.qt.isVisible()) this.qt.setText(Double.toString(mob.getQuantity())); this.qt.setVisible(true); k++; this.moveButton.setVisible(true); } } } if (k == 0){ this.x_a = -1; this.y_a = -1; } } else { MultiLog.println(BattlefieldMouseListener.class.toString(), "Selected another planet"); this.info.setText(player.getName()); this.info.setVisible(true); this.x_a = -1; this.y_a = -1; } } } ///############### PUNTO B //selected B point else if (this.x_b == -1 && this.y_b == -1){ this.x_b = x_pos; this.y_b = y_pos; MultiLog.println(BattlefieldMouseListener.class.toString(),"Point B " + this.x_b + "," + this.y_b); //TODO: calcolo della traiettoria e resetta i punti a-b //muovere la risorsa prima tutta in una direzione e poi nell'altra //dev'essere gi� stata selezionata altrimanti non fa nienete MultiLog.println(BattlefieldMouseListener.class.toString(), "Movimento della navicella !!!!!!!!!!!!!!!!!!!!!!!!!!!!! --- PUNTO B"); if (this.starship != null){ mobRes = this.starship.getId(); final int gran = this.gran; MultiLog.println(BattlefieldMouseListener.class.toString(), "LUNCHING THREAD for move resource"); //System.out.println("LUNCHING THREAD for move resource"); Thread resMov = new Thread( new Runnable() { //return (posX - posX % this.granularity); double x_target = X - X % gran; //double x_target = X; double y_target = Y - Y % gran; //double y_target = Y; String threadId = new Long(Thread.currentThread().getId()).toString(); String resId = mobRes; public void run() { try { /***** GameResourceMobile res=null; // try { res = request.getMobileResource(resId); System.out.println("\n\n\n\n\n\n430 resource mobile\n\n\n\n\n\n\n\n"); // } catch (UnknownHostException ex) { // Logger.getLogger(BattlefieldMouseListener.class.getName()).log(Level.SEVERE, null, ex); //} catch (IOException ex) { // Logger.getLogger(BattlefieldMouseListener.class.getName()).log(Level.SEVERE, null, ex); //} /**********************/ /**********************/ threadId=request.getGamePeerId(); request.MovementRequest(x_target, y_target, resId, threadId); GameResourceMobile res=null; // System.out.println("MOVIMENTO"); boolean band=false; while(!band) { Thread.sleep(700); res = request.getMobileResource(resId); if((res.getX()!=x_target) ||(res.getY()!=y_target)) { // System.out.println("MOV_RESOURCE2 "+ res.getX() + " "+res.getY()); bf.repaint(); } else { band=true; } } /********************** GameResourceMobile res = request.getMobileResource(resId); //GameResourceMobile res = gp.getMyMobileResourceFromId(resId); while(res.getX() != x_target || res.getY() != y_target) { Thread.sleep(500); System.out.println("RES_POS:" +res.getX()+ " "+ res.getY()); //TODO: muove il giocatore di una posizione double movX = x_target - res.getX(); double movY = y_target - res.getY(); //TODO: andrebbe messo anche un controllo per ottimizzare il movimento if (movX != 0.0){ if (movX > 0.0 && movX > res.getVelocity() / 2.0){ movX = res.getVelocity() / 2.0; } else if (movX < 0.0 && Math.abs(movX) > res.getVelocity() / 2.0){ movX = - (res.getVelocity() / 2.0); } } if (movY != 0.0){ if (movY > 0.0 && movY > res.getVelocity() / 2.0){ movY = res.getVelocity() / 2.0; } else if (movY < 0.0 && Math.abs(movY) > res.getVelocity() / 2.0){ movY = - (res.getVelocity() / 2.0); } } MultiLog.println(BattlefieldMouseListener.class.toString(), "RISORSA MOSSA di " + movX + " , " + movY); //System.out.println("RISORSA MOSSA di " + movX + " , " + movY); if( (movX + movY) > res.getVelocity() ){ MultiLog.println(BattlefieldMouseListener.class.toString(), "FINE PER MOVIMENTO ECCESSIVO ------------------------------------------------" + res.getVelocity()); //System.out.println("FINE PER MOVIMENTO ECCESSIVO ------------------------------------------------" + res.getVelocity()); System.exit(1); } /****/ // try { // System.out.println("478 move resource mobile"); // request.moveResourceMobile(resId, movX, movY, 0, threadId); // } catch (UnknownHostException ex) { // Logger.getLogger(BattlefieldMouseListener.class.getName()).log(Level.SEVERE, null, ex); // } catch (IOException ex) { // Logger.getLogger(BattlefieldMouseListener.class.getName()).log(Level.SEVERE, null, ex); // } /*****************************************/ //gp.moveResourceMobile(resId, movX, movY, 0, threadId); //res.moveResourceMobile(movX, movY, 0.0); //TODO: caricare tutta la vision dell'intorno con space e poi // aggiungere anche gli elementi che sono nella resource vision // for (int i_x = (int) (res.getX() - res.getVision()); i_x < res.getX() + res.getVision(); i_x++){ // for (int i_y = (int) (res.getY() - res.getVision()); i_y < res.getY() + res.getVision(); i_y++){ // // bf.addNewInfo(i_x, i_y, null); // } // } // // GameResourceMobileResponsible ship = new GameResourceMobileResponsible(res.getId(), res.getDescription(), res.getOwner(), res.getOwnerId(), // res.getQuantity(), res.getX(), res.getY(), 0, res.getVelocity(), res.getVision(), 0, "", ""); // bf.addNewInfo((int) res.getX(), (int) res.getY(), ship); //System.out.println("AAAAAA " + res.getResourceVision().size()); //bf.repaint(); //res = request.getMobileResource(resId); //} /**********************/ MultiLog.println(BattlefieldMouseListener.class.toString(), "ARRIVATOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"); //System.out.println("ARRIVATOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"); //bf.repaint(); } catch (InterruptedException e) { e.printStackTrace(); } } } );//.start(); resMov.setPriority(Thread.MAX_PRIORITY); resMov.start(); } this.x_a = -1; this.y_a = -1; this.x_b = -1; this.y_b = -1; //System.out.println("pos " + this.starship.getX() + " - " + this.starship.getY()); } } private static void setStarShipVision(GameResourceMobile mob, double gran, GamePlayer player){ for (int i_x = (int) (mob.getX() - mob.getVision()); i_x < mob.getX() + mob.getVision(); i_x += gran){ for (int i_y = (int) (mob.getY() - mob.getVision()); i_y < mob.getY() + mob.getVision(); i_y += gran ){ if ( !(i_x == player.getPosX() && i_y == player.getPosY()) ){ bf.addNewInfo(i_x, i_y, null); //System.out.println("pos " + i_x + " , " + i_y); } } } GameResourceMobileResponsible ship = new GameResourceMobileResponsible(mob.getId(), mob.getDescription(), mob.getOwner(), mob.getOwnerId(), mob.getQuantity(), mob.getX(), mob.getY(), 0, mob.getVelocity(), mob.getVision(), 0, "", ""); if ( !(mob.getX() == player.getPosX() && mob.getY() == player.getPosY()) ){ bf.addNewInfo((int) mob.getX(), (int) mob.getY(), ship); } ArrayList<Object> mobVis = mob.getResourceVision(); for (int k = 0; k < mobVis.size(); k++){ if (mobVis.get(k) instanceof GamePlayerResponsible){ GamePlayerResponsible playerResp = (GamePlayerResponsible) mobVis.get(k); MultiLog.println(BattlefieldMouseListener.class.toString(), "**********************************************"); //System.out.println("**********************************************"); MultiLog.println(BattlefieldMouseListener.class.toString(), k + " VISION un PLAYER " + playerResp.getPosX() + ", " + playerResp.getPosY()); //System.out.println(k + " VISION un PLAYER " + playerResp.getPosX() + ", " + playerResp.getPosY()); bf.addNewInfo( (int) playerResp.getPosX() , (int) playerResp.getPosY(), playerResp); } else if (mobVis.get(k) instanceof GameResourceMobileResponsible){ GameResourceMobileResponsible resource = (GameResourceMobileResponsible) mobVis.get(k); MultiLog.println(BattlefieldMouseListener.class.toString(),"**********************************************"); //System.out.println("**********************************************"); MultiLog.println(BattlefieldMouseListener.class.toString(), k + " VISION un MOBILE " + resource.getX() + ", " + resource.getY()); //System.out.println(k + " VISION un MOBILE " + resource.getX() + ", " + resource.getY()); bf.addNewInfo((int) resource.getX(), (int) resource.getY(), resource); } } } private void moveButtonActionPerformed(java.awt.event.ActionEvent evt) { MultiLog.println(BattlefieldMouseListener.class.toString(), "move button pressed..."); //System.out.println("move button pressed..."); MultiLog.println(BattlefieldMouseListener.class.toString(), "ATTACCO CON " + this.selection + " -> " + this.attack.get(this.selection)); /************************************************************/ // try { this.starship = (GameResourceMobile) request.getMobileResource(this.attack.get(this.selection)); //System.out.println("\n\n\n605 mobile resource from id\n\n"); // } catch (UnknownHostException ex) { // Logger.getLogger(BattlefieldMouseListener.class.getName()).log(Level.SEVERE, null, ex); //} catch (IOException ex) { // Logger.getLogger(BattlefieldMouseListener.class.getName()).log(Level.SEVERE, null, ex); // } /************************************************************/ //this.starship = this.gp.getMyMobileResourceFromId(this.attack.get(this.selection)); MultiLog.println(BattlefieldMouseListener.class.toString(), "Nome " + this.starship.getId() + " qt " + this.starship.getQuantity()); //System.out.println("Nome " + this.starship.getId() + " qt " + this.starship.getQuantity()); } public void setPeer(GamePeer gp){ this.gp = gp; this.initComponent(); } public int getX() { return X; } public void setX(int x) { X = x; } public int getY() { return Y; } public void setY(int y) { Y = y; } public void mouseDragged(MouseEvent arg0) { // TODO Auto-generated method stub } public void mouseMoved(MouseEvent ev) { //System.out.println("Mouse Moved Called !"); X = (ev.getX()); Y = (ev.getY()); int x_pos = (int) Math.round( X / this.gran - 0.5); int y_pos = (int) Math.round( Y / this.gran - 0.5 ); // System.out.println("Mouse moved:: offset position " + x_pos + ", " + y_pos); this.xLab.setText(Integer.toString(x_pos)); this.yLab.setText(Integer.toString(y_pos)); //repaint(); } }
96b7e7479114574a30d29bb2613dc75b4ed0c281
5a0bfac7ad00c079fe8e0bdf1482f4271c46eeab
/app/src/main/wechat6.5.3/android/support/v4/widget/r.java
af2a6b9b635eedce2bf9970954ae6bc02be77f2b
[]
no_license
newtonker/wechat6.5.3
8af53a870a752bb9e3c92ec92a63c1252cb81c10
637a69732afa3a936afc9f4679994b79a9222680
refs/heads/master
2020-04-16T03:32:32.230996
2017-06-15T09:54:10
2017-06-15T09:54:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,641
java
package android.support.v4.widget; import android.graphics.drawable.Drawable; import android.os.Build.VERSION; import android.widget.TextView; public final class r { static final f DP; interface f { void a(TextView textView, Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4); int c(TextView textView); } static class b implements f { b() { } public void a(TextView textView, Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) { textView.setCompoundDrawables(drawable, null, null, null); } public int c(TextView textView) { if (!s.DT) { s.DS = s.n("mMaxMode"); s.DT = true; } if (s.DS != null && s.a(s.DS, textView) == 1) { if (!s.DR) { s.DQ = s.n("mMaximum"); s.DR = true; } if (s.DQ != null) { return s.a(s.DQ, textView); } } return -1; } } static class e extends b { e() { } public final int c(TextView textView) { return textView.getMaxLines(); } } static class c extends e { c() { } public void a(TextView textView, Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) { Object obj = textView.getLayoutDirection() == 1 ? 1 : null; Drawable drawable5 = obj != null ? null : drawable; if (obj == null) { drawable = null; } textView.setCompoundDrawables(drawable5, null, drawable, null); } } static class d extends c { d() { } public final void a(TextView textView, Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) { textView.setCompoundDrawablesRelative(drawable, null, null, null); } } static class a extends d { a() { } } static { int i = VERSION.SDK_INT; if (i >= 23) { DP = new a(); } else if (i >= 18) { DP = new d(); } else if (i >= 17) { DP = new c(); } else if (i >= 16) { DP = new e(); } else { DP = new b(); } } public static void a(TextView textView, Drawable drawable) { DP.a(textView, drawable, null, null, null); } public static int c(TextView textView) { return DP.c(textView); } }
22bc47be655a2a96eaf426debb418fdbd3280592
71c06fae520f81c9312c3dff2137a8bfa17d0a2b
/src/main/java/org/ingenia/rhinobuy/domain/Product.java
d3fe70b8e7cc531ce3fa497f77a3f5c398a490ec
[]
no_license
BulkSecurityGeneratorProject/rhinobuy
fcf23ddc4a23b5e6815c96ea479ab5f061e4bcf2
669cbdfaf2181c5743de98e907c1b12f50afffaf
refs/heads/master
2022-12-14T04:50:10.035229
2016-11-16T16:15:54
2016-11-16T16:15:54
296,593,890
0
0
null
2020-09-18T10:51:29
2020-09-18T10:51:28
null
UTF-8
Java
false
false
9,594
java
package org.ingenia.rhinobuy.domain; import com.fasterxml.jackson.annotation.JsonIgnore; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.springframework.data.elasticsearch.annotations.Document; import javax.persistence.*; import javax.validation.constraints.*; import java.io.Serializable; import java.math.BigDecimal; import java.util.HashSet; import java.util.Set; import java.util.Objects; /** * A Product. */ @Entity @Table(name = "product") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) @Document(indexName = "product") public class Product implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @Column(name = "return_authorization") private Boolean returnAuthorization; @NotNull @Column(name = "name", nullable = false) private String name; @NotNull @Column(name = "price", precision=10, scale=2, nullable = false) private BigDecimal price; @Column(name = "size") private String size; @NotNull @Column(name = "color", nullable = false) private String color; @NotNull @Column(name = "description", nullable = false) private String description; @Column(name = "other_details") private String otherDetails; @ManyToOne private Product product; @OneToMany(mappedBy = "product") @JsonIgnore @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) private Set<Product> products = new HashSet<>(); @OneToMany(mappedBy = "product") @JsonIgnore @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) private Set<ProductDescription> descriptions = new HashSet<>(); @OneToMany(mappedBy = "product") @JsonIgnore @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) private Set<Picture> images = new HashSet<>(); @ManyToOne private Category category; @ManyToMany(mappedBy = "products") @JsonIgnore @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) private Set<Supplier> suppliers = new HashSet<>(); @ManyToMany(mappedBy = "products") @JsonIgnore @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) private Set<WishList> wlists = new HashSet<>(); @ManyToOne private ShopingCart shopingCart; @ManyToOne private Promotion promotion; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Boolean isReturnAuthorization() { return returnAuthorization; } public Product returnAuthorization(Boolean returnAuthorization) { this.returnAuthorization = returnAuthorization; return this; } public void setReturnAuthorization(Boolean returnAuthorization) { this.returnAuthorization = returnAuthorization; } public String getName() { return name; } public Product name(String name) { this.name = name; return this; } public void setName(String name) { this.name = name; } public BigDecimal getPrice() { return price; } public Product price(BigDecimal price) { this.price = price; return this; } public void setPrice(BigDecimal price) { this.price = price; } public String getSize() { return size; } public Product size(String size) { this.size = size; return this; } public void setSize(String size) { this.size = size; } public String getColor() { return color; } public Product color(String color) { this.color = color; return this; } public void setColor(String color) { this.color = color; } public String getDescription() { return description; } public Product description(String description) { this.description = description; return this; } public void setDescription(String description) { this.description = description; } public String getOtherDetails() { return otherDetails; } public Product otherDetails(String otherDetails) { this.otherDetails = otherDetails; return this; } public void setOtherDetails(String otherDetails) { this.otherDetails = otherDetails; } public Product getProduct() { return product; } public Product product(Product product) { this.product = product; return this; } public void setProduct(Product product) { this.product = product; } public Set<Product> getProducts() { return products; } public Product products(Set<Product> products) { this.products = products; return this; } public Product addProduct(Product product) { products.add(product); product.setProduct(this); return this; } public Product removeProduct(Product product) { products.remove(product); product.setProduct(null); return this; } public void setProducts(Set<Product> products) { this.products = products; } public Set<ProductDescription> getDescriptions() { return descriptions; } public Product descriptions(Set<ProductDescription> productDescriptions) { this.descriptions = productDescriptions; return this; } public Product addDescription(ProductDescription productDescription) { descriptions.add(productDescription); productDescription.setProduct(this); return this; } public Product removeDescription(ProductDescription productDescription) { descriptions.remove(productDescription); productDescription.setProduct(null); return this; } public void setDescriptions(Set<ProductDescription> productDescriptions) { this.descriptions = productDescriptions; } public Set<Picture> getImages() { return images; } public Product images(Set<Picture> pictures) { this.images = pictures; return this; } public Product addImage(Picture picture) { images.add(picture); picture.setProduct(this); return this; } public Product removeImage(Picture picture) { images.remove(picture); picture.setProduct(null); return this; } public void setImages(Set<Picture> pictures) { this.images = pictures; } public Category getCategory() { return category; } public Product category(Category category) { this.category = category; return this; } public void setCategory(Category category) { this.category = category; } public Set<Supplier> getSuppliers() { return suppliers; } public Product suppliers(Set<Supplier> suppliers) { this.suppliers = suppliers; return this; } public Product addSupplier(Supplier supplier) { suppliers.add(supplier); supplier.getProducts().add(this); return this; } public Product removeSupplier(Supplier supplier) { suppliers.remove(supplier); supplier.getProducts().remove(this); return this; } public void setSuppliers(Set<Supplier> suppliers) { this.suppliers = suppliers; } public Set<WishList> getWlists() { return wlists; } public Product wlists(Set<WishList> wishLists) { this.wlists = wishLists; return this; } public Product addWlist(WishList wishList) { wlists.add(wishList); wishList.getProducts().add(this); return this; } public Product removeWlist(WishList wishList) { wlists.remove(wishList); wishList.getProducts().remove(this); return this; } public void setWlists(Set<WishList> wishLists) { this.wlists = wishLists; } public ShopingCart getShopingCart() { return shopingCart; } public Product shopingCart(ShopingCart shopingCart) { this.shopingCart = shopingCart; return this; } public void setShopingCart(ShopingCart shopingCart) { this.shopingCart = shopingCart; } public Promotion getPromotion() { return promotion; } public Product promotion(Promotion promotion) { this.promotion = promotion; return this; } public void setPromotion(Promotion promotion) { this.promotion = promotion; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Product product = (Product) o; if(product.id == null || id == null) { return false; } return Objects.equals(id, product.id); } @Override public int hashCode() { return Objects.hashCode(id); } @Override public String toString() { return "Product{" + "id=" + id + ", returnAuthorization='" + returnAuthorization + "'" + ", name='" + name + "'" + ", price='" + price + "'" + ", size='" + size + "'" + ", color='" + color + "'" + ", description='" + description + "'" + ", otherDetails='" + otherDetails + "'" + '}'; } }
9e3e49006d32f8983627831c4d1ea810a63e7c26
f85312dc53de91f00b29a6ce20c24707b4bf3387
/cloud-modules/cloud-core/src/main/java/com/donkeycode/core/exception/UserTokenException.java
c3a2c83646fe514baeb55776bb1d3ec30f7d73c6
[ "Apache-2.0" ]
permissive
walker-xue/learn-cloud
3e6005db228ed4e7ea1066ae3baac4b155fc49bf
e87c036aab897e4689bc43b78fddcda87c6d4e65
refs/heads/master
2022-12-24T02:23:06.093299
2020-09-22T00:40:27
2020-09-22T00:40:27
297,494,507
1
0
null
null
null
null
UTF-8
Java
false
false
450
java
package com.donkeycode.core.exception; import com.donkeycode.core.consts.Constants; import com.donkeycode.core.consts.HttpCode; import com.donkeycode.core.exception.BaseException; /** * * @author yanjun.xue * @since 2019年6月28日 */ public class UserTokenException extends BaseException { private static final long serialVersionUID = 1L; public UserTokenException(String message) { super(HttpCode.EX_USER_INVALID_CODE, message); } }
b3e0f40c82acb6a692913f8c45e4e4ec7f1339fa
c2954b979f535f80a32c6d382d79ae3b1563ac7a
/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Movie.java
d6918233c7320f340dca51f73468f27834ef05f5
[ "BSD-3-Clause" ]
permissive
ftcquimby/ftc_2019_quimby
e579df3dc75c99a2c51989c14373a436e6d977c9
50e3517fb1bfef45d3ed17ac32b4a0ddbf3c755e
refs/heads/master
2020-09-25T07:01:34.870738
2020-02-21T17:09:38
2020-02-21T17:09:38
225,944,651
0
0
null
null
null
null
UTF-8
Java
false
false
411
java
package org.firstinspires.ftc.teamcode; public class Movie { public int time; public int cost; public Movie(){ time = 2; cost = 10; } public Movie(int time1){ time = time1; }; public Movie(int time1, int cost1){ time1= time; cost1 =cost; } public int getTime(){ int realTime = time + 15; return realTime; } }
9b3f3f4ccf891c8fee659be644c864a60ab315d7
6c0cc351d083add81c3756835e49edeea860d564
/src/main/java/com/excilys/prezlombok/cdb/cheatsheet/dto/CompanyDTO.java
adc13e91448b6a1d9e600925db1ac4b26650a40c
[]
no_license
Moinketroa/prez-lombok
dc647998dfe84149d8834aec764cdde5f9ace1aa
4f516a308e39d5f3a52c4f61dcd02c89b5e26f53
refs/heads/master
2020-04-25T16:20:13.405718
2019-02-28T00:16:38
2019-02-28T00:16:38
172,907,763
0
0
null
null
null
null
UTF-8
Java
false
false
1,681
java
package com.excilys.prezlombok.cdb.cheatsheet.dto; import java.util.Objects; public class CompanyDTO { private Integer id; private final String name; public CompanyDTO(String name) { this.name = name; } public CompanyDTO(Integer id, String name) { this.id = id; this.name = name; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public static CompanyDTOBuilder builder() { return new CompanyDTOBuilder(); } @Override public String toString() { return "CompanyDTO{" + "id=" + id + ", name='" + name + '\'' + '}'; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; CompanyDTO company = (CompanyDTO) o; return id.equals(company.id) && Objects.equals(name, company.name); } @Override public int hashCode() { return Objects.hash(id, name); } public static class CompanyDTOBuilder { private Integer id; private String name; public CompanyDTOBuilder id(Integer id) { this.id = id; return this; } public CompanyDTOBuilder name(String name) { this.name = name; return this; } public CompanyDTO build() { CompanyDTO result = new CompanyDTO(this.name); result.setId(this.id); return result; } } }
f23209da0b31c35f50363f3366139b16b03cb967
54d11da88eafbc4ccd8047323f4b7751510d2964
/Yukari/src/main/java/shibafu/yukari/common/Suppressor.java
3deeab9f1e62430813f1fb1ae6a6d8e6e34336da
[ "Apache-2.0" ]
permissive
Na0ki/Yukari
fab3d0d462fb10911e11224ed946aebf41b1ddaf
914584472a6a6b117e17c50ed3f6b6f01d1ab2bc
refs/heads/master
2021-12-14T21:34:45.718592
2021-09-24T15:50:27
2021-09-24T15:50:27
188,963,942
0
0
null
2019-05-28T06:02:30
2019-05-28T06:02:30
null
UTF-8
Java
false
false
7,480
java
package shibafu.yukari.common; import android.support.v4.util.LongSparseArray; import android.util.Log; import org.eclipse.collections.api.list.primitive.MutableLongList; import org.eclipse.collections.impl.list.mutable.primitive.LongArrayList; import shibafu.yukari.database.MuteConfig; import shibafu.yukari.database.MuteMatch; import shibafu.yukari.twitter.entity.TwitterStatus; import shibafu.yukari.twitter.entity.TwitterUser; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; /** * Created by shibafu on 14/04/28. */ public class Suppressor { private List<MuteConfig> configs; private MutableLongList blockedIDs = new LongArrayList(); private MutableLongList mutedIDs = new LongArrayList(); private MutableLongList noRetweetIDs = new LongArrayList(); private LongSparseArray<Pattern> patternCache = new LongSparseArray<>(); public void setConfigs(List<MuteConfig> configs) { this.configs = configs; patternCache.clear(); for (MuteConfig config : configs) { if (!config.expired() && config.getMatch() == MuteMatch.MATCH_REGEX) { try { patternCache.put(config.getId(), Pattern.compile(config.getQuery())); } catch (PatternSyntaxException ignore) { patternCache.put(config.getId(), null); } } } Log.d("Suppressor", "Loaded " + configs.size() + " MuteConfigs"); } public List<MuteConfig> getConfigs() { return configs; } public void addBlockedIDs(long[] ids) { blockedIDs.addAll(ids); blockedIDs.sortThis(); } public void removeBlockedID(long id) { blockedIDs.remove(id); blockedIDs.sortThis(); } public void addMutedIDs(long[] ids) { mutedIDs.addAll(ids); mutedIDs.sortThis(); } public void addNoRetweetIDs(long[] ids) { noRetweetIDs.addAll(ids); noRetweetIDs.sortThis(); } public boolean[] decision(shibafu.yukari.entity.Status status) { boolean[] result = new boolean[7]; if (status instanceof TwitterStatus) { if (blockedIDs.binarySearch(status.getOriginStatus().getUser().getId()) > -1 || mutedIDs.binarySearch(status.getOriginStatus().getUser().getId()) > -1) { result[MuteConfig.MUTE_TWEET_RTED] = true; return result; } else if (noRetweetIDs.binarySearch(status.getUser().getId()) > -1) { result[MuteConfig.MUTE_RETWEET] = true; } } for (MuteConfig config : configs) { if (config.expired()) continue; shibafu.yukari.entity.Status s; int mute = config.getMute(); if (status.isRepost() && mute != MuteConfig.MUTE_RETWEET && mute != MuteConfig.MUTE_NOTIF_RT) { s = status.getOriginStatus(); } else { s = status; } String source; switch (config.getScope()) { case MuteConfig.SCOPE_TEXT: source = s.getText(); break; case MuteConfig.SCOPE_USER_ID: source = String.valueOf(s.getUser().getId()); break; case MuteConfig.SCOPE_USER_SN: source = s.getUser().getScreenName(); break; case MuteConfig.SCOPE_USER_NAME: source = s.getUser().getName(); break; case MuteConfig.SCOPE_VIA: source = s.getSource(); break; default: continue; } boolean match = false; switch (config.getMatch()) { case MuteMatch.MATCH_EXACT: match = source.equals(config.getQuery()); break; case MuteMatch.MATCH_PARTIAL: match = source.contains(config.getQuery()); break; case MuteMatch.MATCH_REGEX: { Pattern pattern = patternCache.get(config.getId()); if (pattern == null && patternCache.indexOfKey(config.getId()) < 0) { try { pattern = Pattern.compile(config.getQuery()); patternCache.put(config.getId(), pattern); } catch (PatternSyntaxException ignore) { patternCache.put(config.getId(), null); } } if (pattern != null) { Matcher matcher = pattern.matcher(source); match = matcher.find(); } break; } } if (match) { result[mute] = true; } } return result; } public boolean[] decisionUser(shibafu.yukari.entity.User user) { boolean[] result = new boolean[7]; if (user instanceof TwitterUser) { if (blockedIDs.binarySearch(user.getId()) > -1 || mutedIDs.binarySearch(user.getId()) > -1) { result[MuteConfig.MUTE_TWEET_RTED] = true; return result; } else if (noRetweetIDs.binarySearch(user.getId()) > -1) { result[MuteConfig.MUTE_RETWEET] = true; return result; } } for (MuteConfig config : configs) { String source; switch (config.getScope()) { case MuteConfig.SCOPE_USER_ID: source = String.valueOf(user.getId()); break; case MuteConfig.SCOPE_USER_SN: source = user.getScreenName(); break; case MuteConfig.SCOPE_USER_NAME: source = user.getName(); break; default: continue; } boolean match = false; switch (config.getMatch()) { case MuteMatch.MATCH_EXACT: match = source.equals(config.getQuery()); break; case MuteMatch.MATCH_PARTIAL: match = source.contains(config.getQuery()); break; case MuteMatch.MATCH_REGEX: { Pattern pattern = patternCache.get(config.getId()); if (pattern == null && patternCache.indexOfKey(config.getId()) < 0) { try { pattern = Pattern.compile(config.getQuery()); patternCache.put(config.getId(), pattern); } catch (PatternSyntaxException ignore) { patternCache.put(config.getId(), null); } } if (pattern != null) { Matcher matcher = pattern.matcher(source); match = matcher.find(); } break; } } if (match) { result[config.getMute()] = true; } } return result; } }
7402de659f1c239829b335fce3b19be97b2c74ed
add0672f3904d8289814c44c8f3ae6cbd404f518
/src/main/java/org/jhipster/web/rest/AccountResource.java
613e9f65bcaa1100a3e6c792c451fce7a05b2f4c
[]
no_license
8020code/blog
9609468571fe64204ca1c03610f00ba02b0850c0
151799ce51ed80f7ada7d0477b9ad51c9e00dddc
refs/heads/master
2022-12-19T01:46:58.072468
2017-10-15T18:08:16
2017-10-15T18:08:16
107,035,988
0
1
null
2020-09-18T19:19:29
2017-10-15T18:01:59
Java
UTF-8
Java
false
false
9,006
java
package org.jhipster.web.rest; import com.codahale.metrics.annotation.Timed; import org.jhipster.domain.User; import org.jhipster.repository.UserRepository; import org.jhipster.security.SecurityUtils; import org.jhipster.service.MailService; import org.jhipster.service.UserService; import org.jhipster.service.dto.UserDTO; import org.jhipster.web.rest.vm.KeyAndPasswordVM; import org.jhipster.web.rest.vm.ManagedUserVM; import org.jhipster.web.rest.util.HeaderUtil; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; import java.util.*; /** * REST controller for managing the current user's account. */ @RestController @RequestMapping("/api") public class AccountResource { private final Logger log = LoggerFactory.getLogger(AccountResource.class); private final UserRepository userRepository; private final UserService userService; private final MailService mailService; private static final String CHECK_ERROR_MESSAGE = "Incorrect password"; public AccountResource(UserRepository userRepository, UserService userService, MailService mailService) { this.userRepository = userRepository; this.userService = userService; this.mailService = mailService; } /** * POST /register : register the user. * * @param managedUserVM the managed user View Model * @return the ResponseEntity with status 201 (Created) if the user is registered or 400 (Bad Request) if the login or email is already in use */ @PostMapping(path = "/register", produces={MediaType.APPLICATION_JSON_VALUE, MediaType.TEXT_PLAIN_VALUE}) @Timed public ResponseEntity registerAccount(@Valid @RequestBody ManagedUserVM managedUserVM) { HttpHeaders textPlainHeaders = new HttpHeaders(); textPlainHeaders.setContentType(MediaType.TEXT_PLAIN); if (!checkPasswordLength(managedUserVM.getPassword())) { return new ResponseEntity<>(CHECK_ERROR_MESSAGE, HttpStatus.BAD_REQUEST); } return userRepository.findOneByLogin(managedUserVM.getLogin().toLowerCase()) .map(user -> new ResponseEntity<>("login already in use", textPlainHeaders, HttpStatus.BAD_REQUEST)) .orElseGet(() -> userRepository.findOneByEmailIgnoreCase(managedUserVM.getEmail()) .map(user -> new ResponseEntity<>("email address already in use", textPlainHeaders, HttpStatus.BAD_REQUEST)) .orElseGet(() -> { User user = userService .createUser(managedUserVM.getLogin(), managedUserVM.getPassword(), managedUserVM.getFirstName(), managedUserVM.getLastName(), managedUserVM.getEmail().toLowerCase(), managedUserVM.getImageUrl(), managedUserVM.getLangKey()); mailService.sendActivationEmail(user); return new ResponseEntity<>(HttpStatus.CREATED); }) ); } /** * GET /activate : activate the registered user. * * @param key the activation key * @return the ResponseEntity with status 200 (OK) and the activated user in body, or status 500 (Internal Server Error) if the user couldn't be activated */ @GetMapping("/activate") @Timed public ResponseEntity<String> activateAccount(@RequestParam(value = "key") String key) { return userService.activateRegistration(key) .map(user -> new ResponseEntity<String>(HttpStatus.OK)) .orElse(new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR)); } /** * GET /authenticate : check if the user is authenticated, and return its login. * * @param request the HTTP request * @return the login if the user is authenticated */ @GetMapping("/authenticate") @Timed public String isAuthenticated(HttpServletRequest request) { log.debug("REST request to check if the current user is authenticated"); return request.getRemoteUser(); } /** * GET /account : get the current user. * * @return the ResponseEntity with status 200 (OK) and the current user in body, or status 500 (Internal Server Error) if the user couldn't be returned */ @GetMapping("/account") @Timed public ResponseEntity<UserDTO> getAccount() { return Optional.ofNullable(userService.getUserWithAuthorities()) .map(user -> new ResponseEntity<>(new UserDTO(user), HttpStatus.OK)) .orElse(new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR)); } /** * POST /account : update the current user information. * * @param userDTO the current user information * @return the ResponseEntity with status 200 (OK), or status 400 (Bad Request) or 500 (Internal Server Error) if the user couldn't be updated */ @PostMapping("/account") @Timed public ResponseEntity saveAccount(@Valid @RequestBody UserDTO userDTO) { final String userLogin = SecurityUtils.getCurrentUserLogin(); Optional<User> existingUser = userRepository.findOneByEmailIgnoreCase(userDTO.getEmail()); if (existingUser.isPresent() && (!existingUser.get().getLogin().equalsIgnoreCase(userLogin))) { return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert("user-management", "emailexists", "Email already in use")).body(null); } return userRepository .findOneByLogin(userLogin) .map(u -> { userService.updateUser(userDTO.getFirstName(), userDTO.getLastName(), userDTO.getEmail(), userDTO.getLangKey(), userDTO.getImageUrl()); return new ResponseEntity(HttpStatus.OK); }) .orElseGet(() -> new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR)); } /** * POST /account/change-password : changes the current user's password * * @param password the new password * @return the ResponseEntity with status 200 (OK), or status 400 (Bad Request) if the new password is not strong enough */ @PostMapping(path = "/account/change-password", produces = MediaType.TEXT_PLAIN_VALUE) @Timed public ResponseEntity changePassword(@RequestBody String password) { if (!checkPasswordLength(password)) { return new ResponseEntity<>(CHECK_ERROR_MESSAGE, HttpStatus.BAD_REQUEST); } userService.changePassword(password); return new ResponseEntity<>(HttpStatus.OK); } /** * POST /account/reset-password/init : Send an email to reset the password of the user * * @param mail the mail of the user * @return the ResponseEntity with status 200 (OK) if the email was sent, or status 400 (Bad Request) if the email address is not registered */ @PostMapping(path = "/account/reset-password/init", produces = MediaType.TEXT_PLAIN_VALUE) @Timed public ResponseEntity requestPasswordReset(@RequestBody String mail) { return userService.requestPasswordReset(mail) .map(user -> { mailService.sendPasswordResetMail(user); return new ResponseEntity<>("email was sent", HttpStatus.OK); }).orElse(new ResponseEntity<>("email address not registered", HttpStatus.BAD_REQUEST)); } /** * POST /account/reset-password/finish : Finish to reset the password of the user * * @param keyAndPassword the generated key and the new password * @return the ResponseEntity with status 200 (OK) if the password has been reset, * or status 400 (Bad Request) or 500 (Internal Server Error) if the password could not be reset */ @PostMapping(path = "/account/reset-password/finish", produces = MediaType.TEXT_PLAIN_VALUE) @Timed public ResponseEntity<String> finishPasswordReset(@RequestBody KeyAndPasswordVM keyAndPassword) { if (!checkPasswordLength(keyAndPassword.getNewPassword())) { return new ResponseEntity<>(CHECK_ERROR_MESSAGE, HttpStatus.BAD_REQUEST); } return userService.completePasswordReset(keyAndPassword.getNewPassword(), keyAndPassword.getKey()) .map(user -> new ResponseEntity<String>(HttpStatus.OK)) .orElse(new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR)); } private boolean checkPasswordLength(String password) { return !StringUtils.isEmpty(password) && password.length() >= ManagedUserVM.PASSWORD_MIN_LENGTH && password.length() <= ManagedUserVM.PASSWORD_MAX_LENGTH; } }
0023e5a2f3c9870248bf4503e3f0b6c7522da14a
c00b0135e26f8e3b9e97e0916529318fe1816dbe
/bitcamp-java-application2-server/v32_10/src/main/java/com/eomcs/lms/ServerTest2.java
0ada6567629dda71eb0eb2f1ec41d880ddacd117
[]
no_license
jisoo0516/bitcamp-java-20190527
40c0ae9fe7b07201cd977de7c12a182e398487ec
0e1efcd7405f088f6ad0fbcc21778d9142968f4c
refs/heads/master
2020-06-13T20:15:13.951155
2019-10-11T10:55:15
2019-10-11T10:55:15
194,775,331
0
0
null
2020-04-30T11:45:58
2019-07-02T02:41:01
Java
UTF-8
Java
false
false
4,905
java
package com.eomcs.lms; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.net.Socket; import java.sql.Date; import java.util.List; import com.eomcs.lms.domain.Lesson; public class ServerTest2 { static ObjectOutputStream out; static ObjectInputStream in; public static void main(String[] args) throws Exception { System.out.println("[수업관리시스템 서버 애플리케이션 테스트]"); try (Socket socket = new Socket("localhost", 8888); ObjectOutputStream out = new ObjectOutputStream(socket.getOutputStream()); ObjectInputStream in = new ObjectInputStream(socket.getInputStream())) { System.out.println("서버와 연결되었음."); // 다른 메서드가 입출력 객체를 사용할 수 있도록 스태틱 변수에 저장한다. ServerTest2.in = in; ServerTest2.out = out; Lesson lesson = new Lesson(); lesson.setNo(1); lesson.setTitle("자바프로그래밍"); lesson.setContents("okok"); lesson.setStartDate(Date.valueOf("2019-1-1")); lesson.setEndDate(Date.valueOf("2019-1-1")); lesson.setTotalHours(400); lesson.setDayHours(4); if (!add(lesson)) { error(); } System.out.println("------------------"); lesson = new Lesson(); lesson.setNo(2); lesson.setTitle("자바프로그래밍2"); lesson.setContents("okok"); lesson.setStartDate(Date.valueOf("2019-2-2")); lesson.setEndDate(Date.valueOf("2019-3-3")); lesson.setTotalHours(400); lesson.setDayHours(4); if (!add(lesson)) { error(); } System.out.println("------------------"); if (!list()) { error(); } System.out.println("------------------"); if (!delete()) { error(); } System.out.println("------------------"); if (!list()) { error(); } System.out.println("------------------"); if (!detail()) { error(); } System.out.println("------------------"); lesson = new Lesson(); lesson.setNo(1); lesson.setTitle("자바 웹 프로그래밍"); lesson.setContents("웹개발자 양성과정"); lesson.setStartDate(Date.valueOf("2019-5-27")); lesson.setEndDate(Date.valueOf("2019-11-27")); lesson.setTotalHours(400); lesson.setDayHours(3); if (!update(lesson)) { error(); } System.out.println("------------------"); if (!list()) { error(); } System.out.println("------------------"); if (!quit()) { error(); } } catch (IOException e) { e.printStackTrace(); } System.out.println("서버와 연결 끊음."); } private static void error() throws Exception { System.out.printf("오류: %s\n", in.readUTF()); } private static boolean quit() throws Exception { out.writeUTF("quit"); out.flush(); System.out.print("quit 요청함 => "); if (!in.readUTF().equals("ok")) return false; System.out.println("처리 완료!"); return true; } private static boolean delete() throws Exception { out.writeUTF("/lesson/delete"); out.writeInt(2); out.flush(); System.out.print("delete 요청함 => "); if (!in.readUTF().equals("ok")) return false; System.out.println("처리 완료!"); return true; } private static boolean detail() throws Exception { out.writeUTF("/lesson/detail"); out.writeInt(1); out.flush(); System.out.print("detail 요청함 => "); if (!in.readUTF().equals("ok")) return false; System.out.println("처리 완료!"); System.out.println(in.readObject()); return true; } private static boolean update(Lesson obj) throws Exception { out.writeUTF("/lesson/update"); out.writeObject(obj); out.flush(); System.out.print("update 요청함 => "); if (!in.readUTF().equals("ok")) return false; System.out.println("처리 완료!"); return true; } private static boolean list() throws Exception { out.writeUTF("/lesson/list"); out.flush(); System.out.print("list 요청함 => "); if (!in.readUTF().equals("ok")) return false; System.out.println("처리 완료!"); @SuppressWarnings("unchecked") List<Lesson> list = (List<Lesson>) in.readObject(); System.out.println("------------------"); for (Lesson obj : list) { System.out.println(obj); } return true; } private static boolean add(Lesson obj) throws IOException { out.writeUTF("/lesson/add"); out.writeObject(obj); out.flush(); System.out.print("add 요청함 => "); if (!in.readUTF().equals("ok")) return false; System.out.println("처리 완료!"); return true; } }
dc6d6db689594166d19133ad9adc85276cbd9303
575eeee79c4737814328c955b9aaf154b9efe161
/04-SB-AutowiredSI/src/main/java/in/synerzip/Application.java
3800c0d4ccd0aab7177c687f0d602596acea00b4
[]
no_license
Saudagarsarfaraz/SpringBoot
865706c49b37d12d7ea9a89105fcd3287742dd18
dfed393fc68c967df1d6c21101b63709926561bd
refs/heads/main
2023-08-13T03:22:18.944849
2021-09-20T05:42:43
2021-09-20T05:42:43
406,110,777
0
0
null
null
null
null
UTF-8
Java
false
false
559
java
package in.synerzip; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.ConfigurableApplicationContext; import in.synerzip.service.UserService; @SpringBootApplication public class Application { public static void main(String[] args) { ConfigurableApplicationContext applicationContext = SpringApplication.run(Application.class, args); UserService bean = applicationContext.getBean(UserService.class); bean.registerUser(); } }
d92723dfca436eef903eaf9bb430f440c043b1c0
33f18b35cfc8575ee66506819d404f19f33d6bcd
/app/src/main/java/com/example/f1/a08_database/App.java
af5d910c11967cedfa68450543ece03aa95d6413
[]
no_license
amapmcis/08_Database
f7a5d5f71c3efb0ae7caa8a1e5ea298b724ede3d
433889e3e4d3107c393ee6772d2f71426a44132f
refs/heads/master
2021-07-26T01:01:48.570294
2017-11-03T09:38:24
2017-11-03T09:38:24
109,432,841
0
0
null
null
null
null
UTF-8
Java
false
false
695
java
package com.example.f1.a08_database; import android.app.Application; import io.realm.Realm; import io.realm.RealmConfiguration; public class App extends Application { @Override public void onCreate() { super.onCreate(); Realm.init(this); // Initiate Realm in the app // Define Realm configuration: RealmConfiguration config = new RealmConfiguration .Builder() .name("myrealm.realm") // name of the database file .schemaVersion(1) // version of the database .build(); // Set configuration (defined above) as default: Realm.setDefaultConfiguration(config); } }
7863c99d23f6c92bde527108099dcea505d17204
c4306c70117f4b8c1dc44775aced9e7f465ff698
/Android/ICPAndroidApp/app/src/main/java/com/example/preranasingh/icpandroidapp/TeamScanActivity.java
048fc568cfa124e833ebc1b013988f8ae548b2ef
[]
no_license
preranas20/ICPApplicationPortal
c33dadfba0e90fced8baf9df1d9599de0105a03f
5f12c08ae81d2f79b8811fdb837b1817b18a36b8
refs/heads/master
2020-04-12T05:24:25.718627
2018-12-18T18:03:48
2018-12-18T18:03:48
162,325,893
0
0
null
2018-12-18T17:50:30
2018-12-18T17:50:29
null
UTF-8
Java
false
false
6,949
java
package com.example.preranasingh.icpandroidapp; import android.Manifest; import android.content.Context; import android.content.DialogInterface; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.os.Build; import android.os.Bundle; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.widget.Toast; import com.google.zxing.Result; import java.util.ArrayList; import me.dm7.barcodescanner.zxing.ZXingScannerView; import static android.Manifest.permission_group.CAMERA; public class TeamScanActivity extends AppCompatActivity implements ZXingScannerView.ResultHandler { private static final int REQUEST_CAMERA = 1; private ZXingScannerView mScannerView; private String remoteIP="http://52.202.147.130:5000"; static final String TEAM_KEY ="TEAM"; private String token; private ArrayList<Team> teamList; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_team_scan); teamList = new ArrayList<Team>(); if(getIntent().getExtras()!= null) { teamList = (ArrayList<Team>) getIntent().getExtras().getSerializable("TEAMLIST"); } mScannerView = new ZXingScannerView(this); setContentView(mScannerView); int currentapiVersion = Build.VERSION.SDK_INT; if (currentapiVersion >= Build.VERSION_CODES.M) { if (checkPermission()) { //check if permission is granted Toast.makeText(getApplicationContext(), "Permission already granted", Toast.LENGTH_LONG).show(); Log.d("test", "have permission"); } else { Log.d("test", "onrequest permission"); requestPermission(); } } } private boolean checkPermission() { //permission is granted or not return ( ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED); } private void requestPermission() { Log.d("test", "asking for permission"); ActivityCompat.requestPermissions(TeamScanActivity.this, new String[]{Manifest.permission.CAMERA}, REQUEST_CAMERA); } @Override public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { switch (requestCode) { case REQUEST_CAMERA: Log.d("scan", String.valueOf(grantResults[0])); if (grantResults.length > 0) { Log.d("scan", String.valueOf(grantResults[0])); boolean cameraAccepted = grantResults[0] == PackageManager.PERMISSION_GRANTED; if (cameraAccepted){ Toast.makeText(getApplicationContext(), "Permission Granted, Now you can access camera", Toast.LENGTH_LONG).show(); }else { Log.d("scan", String.valueOf(cameraAccepted)); Toast.makeText(getApplicationContext(), "Permission Denied, You cannot access and camera", Toast.LENGTH_LONG).show(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (shouldShowRequestPermissionRationale(CAMERA)) { showMessageOKCancel("You need to allow access to both the permissions", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { requestPermissions(new String[]{CAMERA}, REQUEST_CAMERA); } } }); return; } } } } break; } } private void showMessageOKCancel(String message, DialogInterface.OnClickListener okListener) { new android.support.v7.app.AlertDialog.Builder(TeamScanActivity.this) .setMessage(message) .setPositiveButton("OK", okListener) .setNegativeButton("Cancel", null) .create() .show(); } @Override public void onResume() { super.onResume(); int currentapiVersion = Build.VERSION.SDK_INT; if (currentapiVersion >= Build.VERSION_CODES.M) { if (checkPermission()) { if (mScannerView == null) { mScannerView = new ZXingScannerView(this); setContentView(mScannerView); } mScannerView.setResultHandler(this); // Register ourselves as a handler for scan results. mScannerView.startCamera(); // Start camera on resume }else { requestPermission(); } } } @Override public void onDestroy() { super.onDestroy(); mScannerView.stopCamera(); } @Override public void onPause() { super.onPause(); mScannerView.stopCamera(); // Stop camera on pause } @Override public void handleResult(Result result) { // Do something with the result here final String txtresult = result.getText(); Log.d("QR", result.getText()); Log.d("QR", result.getBarcodeFormat().toString()); String id = result.getText(); Team team = checkValidity(id); if(team == null) Toast.makeText(this,"Not a valid team",Toast.LENGTH_LONG).show(); else { SurveyResponseApi response = new SurveyResponseApi(getToken(),this); response.getResultsForTeam(team); /* Intent intent = new Intent(TeamScanActivity.this, SurveyActivity.class); intent.putExtra(TEAM_KEY, team); intent.putExtra("Class", "TeamScanActivity"); startActivity(intent);*/ } } private Team checkValidity(String id) { for(Team team : teamList) { if(team != null && team.getId().equals(id)) { return team; } } return null; } public String getToken(){ String ret; SharedPreferences sharedPref =this.getSharedPreferences( "mypref", Context.MODE_PRIVATE); ret = sharedPref.getString("token",""); return ret; } }
2cde540b835b4a1d46d2044c39789e52d10c0382
113d5a8590a578817e1cfdbebb24584931630e9a
/presentations/Programmieren-Tutorium/Tutorium-04/singleLines.java
a06bb20bd7bb9327402cefe275262eb3064c0628
[ "MIT" ]
permissive
MartinThoma/LaTeX-examples
17f0d147269035b8e0e454964c76521cf26cf899
6d517700348d86e21c874c131582f0e74da342dc
refs/heads/master
2023-08-23T01:27:57.441809
2022-03-25T14:05:36
2022-03-25T14:05:36
5,351,405
1,492
452
MIT
2023-03-02T18:51:55
2012-08-09T05:02:14
TeX
UTF-8
Java
false
false
495
java
boolean hasLicense(); boolean canEvaluate(); boolean shouldAbort = false; boolean bell; boolean light; boolean hasBell; boolean hasLight; public class TestBoolean { private boolean isActive; public boolean isActive() { return isActive; } } int i = 42; int k = (i * i) / (42 % 3); for (int j = 12; j < i; i++) { } int[] liste = new int[7]; liste[5] = 5; int[][] tabelle = new int[20][30]; tabelle[1][2] = 1; int[][][] quader = new int[5][7][2]; quader[0][0][0] = 0;
d64fd836367e2e59fd8a711eeada27623f165c44
eadc503564c1d8c72bc35d3dd3965f8b11ea2a07
/app/src/main/java/com/perculacreative/peter/airhockey/util/ShaderHelper.java
91e4e0c65231d5efa31f75419e749ac164358233
[]
no_license
percula/Air_Hockey_Game
dee1a561e72ce27abda36fa070a1cda9f85cd781
1b8e61ac90d3b4c4b0b366a11cddb36c1e63adc2
refs/heads/master
2021-01-13T10:56:40.570861
2016-11-06T16:43:19
2016-11-06T16:43:19
72,297,579
0
0
null
null
null
null
UTF-8
Java
false
false
4,572
java
package com.perculacreative.peter.airhockey.util; import android.util.Log; import static android.opengl.GLES20.GL_COMPILE_STATUS; import static android.opengl.GLES20.GL_FRAGMENT_SHADER; import static android.opengl.GLES20.GL_LINK_STATUS; import static android.opengl.GLES20.GL_VALIDATE_STATUS; import static android.opengl.GLES20.GL_VERTEX_SHADER; import static android.opengl.GLES20.glAttachShader; import static android.opengl.GLES20.glCompileShader; import static android.opengl.GLES20.glCreateProgram; import static android.opengl.GLES20.glCreateShader; import static android.opengl.GLES20.glDeleteProgram; import static android.opengl.GLES20.glDeleteShader; import static android.opengl.GLES20.glGetProgramInfoLog; import static android.opengl.GLES20.glGetProgramiv; import static android.opengl.GLES20.glGetShaderInfoLog; import static android.opengl.GLES20.glGetShaderiv; import static android.opengl.GLES20.glLinkProgram; import static android.opengl.GLES20.glShaderSource; import static android.opengl.GLES20.glValidateProgram; /** * Created by peter on 10/29/16. */ public class ShaderHelper { private static final String TAG = "ShaderHelper"; public static int compileVertexShader(String shaderCode) { return compileShader(GL_VERTEX_SHADER, shaderCode); } public static int compileFragmentShader(String shaderCode) { return compileShader(GL_FRAGMENT_SHADER, shaderCode); } private static int compileShader(int type, String shaderCode) { final int shaderObjectId = glCreateShader(type); if (shaderObjectId == 0) { if (LoggerConfig.ON) { Log.w(TAG, "Could not create new shader."); } return 0; } // Pass in the shader source. glShaderSource(shaderObjectId, shaderCode); // Compile the shader. glCompileShader(shaderObjectId); // Get the compilation status. final int[] compileStatus = new int[1]; glGetShaderiv(shaderObjectId, GL_COMPILE_STATUS, compileStatus, 0); if (LoggerConfig.ON) { // Print the shader info log to the Android log output. Log.v(TAG, "Results of compiling source:" + "\n" + shaderCode + "\n:" + glGetShaderInfoLog(shaderObjectId)); } // Verify the compile status. if (compileStatus[0] == 0) { // If it failed, delete the shader object. glDeleteShader(shaderObjectId); if (LoggerConfig.ON) { Log.w(TAG, "Compilation of shader failed."); } return 0; } return shaderObjectId; } public static int linkProgram(int vertexShaderId, int fragmentShaderId) { // Create a new program object. final int programObjectId = glCreateProgram(); if (programObjectId == 0) { if (LoggerConfig.ON) { Log.w(TAG, "Could not create new program"); } return 0; } // Attach the vertex shader to the program. glAttachShader(programObjectId, vertexShaderId); // Attach the fragment shader to the program. glAttachShader(programObjectId, fragmentShaderId); // Link the two shaders together into a program. glLinkProgram(programObjectId); // Get the link status. final int[] linkStatus = new int[1]; glGetProgramiv(programObjectId, GL_LINK_STATUS, linkStatus, 0); if (LoggerConfig.ON) { // Print the program info log to the Android log output. Log.v(TAG, "Results of linking program:\n" + glGetProgramInfoLog(programObjectId)); } if (linkStatus[0] == 0) { // If it failed, delete the program object. glDeleteProgram(programObjectId); if (LoggerConfig.ON) { Log.w(TAG, "Linking of program failed."); } return 0; } return programObjectId; } /** * Validates an OpenGL program. Should only be called when developing the * application. */ public static boolean validateProgram(int programObjectId) { glValidateProgram(programObjectId); final int[] validateStatus = new int[1]; glGetProgramiv(programObjectId, GL_VALIDATE_STATUS, validateStatus, 0); Log.v(TAG, "Results of validating program: " + validateStatus[0] + "\nLog:" + glGetProgramInfoLog(programObjectId)); return validateStatus[0] != 0; } }
6c62b4c6873ba4a4ed2af52064a9cccfa884d3ca
153d0daab959d1865eae5ea975b99e9f1919b4f9
/prezentacja/src/test/java/pl/comarch/prezentacja/PrezentacjaApplicationTests.java
2a3bd9cdf974521d94b552b0e2c8016834dc5565
[]
no_license
wemstar/prezentacja-docker
2e3f12068c782bd98a92f920acc21ebd76c49a03
39f967c6fca6f9ebc33f32c70de75cf50069622b
refs/heads/master
2021-08-08T07:41:26.619890
2017-11-09T22:16:43
2017-11-09T22:16:43
110,171,900
0
0
null
null
null
null
UTF-8
Java
false
false
344
java
package pl.comarch.prezentacja; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class PrezentacjaApplicationTests { @Test public void contextLoads() { } }
2c1c87d974ae3e1b2224a3a9418e7832b1713ec7
c110a83212ebd90fecf67b4097fb6bf90b713358
/src/VSMSemanticBinaryFeatureVectors/VSMFeatureVectorsWordVBN.java
ee115eeda72e0174a1ecc66b77672d78f6b92d64
[]
no_license
alwaysroad/vsm
22238fa70d84be7d0f4f9be214ccccad9a2303fb
67a461905cb60c433a975890ac60076dccd089d2
refs/heads/master
2020-07-01T14:20:14.968124
2016-01-23T14:20:37
2016-01-23T14:20:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
23,136
java
package VSMSemanticBinaryFeatureVectors; import java.io.File; import java.io.FileFilter; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutput; import java.io.ObjectOutputStream; import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; import java.util.Random; import java.util.Stack; import no.uib.cipr.matrix.MatrixEntry; import no.uib.cipr.matrix.sparse.FlexCompRowMatrix; import no.uib.cipr.matrix.sparse.SparseVector; import cern.colt.matrix.tdouble.impl.DenseDoubleMatrix2D; import jeigen.SparseMatrixLil; import Jama.Matrix; import VSMFeatureVectors.VSMInsideFeatureVector; import VSMFeatureVectors.VSMInsideFeatureVectorWords; import VSMFeatureVectors.VSMOutsideFeatureVector; import VSMFeatureVectors.VSMOutsideFeatureVectorWords; import VSMSerialization.VSMCountMap; import VSMSerialization.VSMDictionaryBean; import VSMSerialization.VSMFeatureVectorBean; import VSMSerialization.VSMReadSerialCountMap; import VSMSerialization.VSMReadSerialMatrix; import VSMSerialization.VSMReadSerialWordDict; import VSMSerialization.VSMSerializeCountMap; import VSMSerialization.VSMSerializeFeatureVectorBean; import VSMSerialization.VSMSerializeFeatureVectorBeanWord; import VSMSerialization.VSMWordDictionaryBean; import VSMSerialization.VSMWordFeatureVectorBean; import VSMUtilityClasses.Alphabet; import VSMUtilityClasses.PTBTreeNormaliser; import VSMUtilityClasses.VSMUtil; import edu.berkeley.nlp.syntax.Constituent; import edu.berkeley.nlp.syntax.Tree; import edu.berkeley.nlp.syntax.Trees.PennTreeReader; import edu.upenn.cis.swell.MathUtils.MatrixFormatConversion; import edu.upenn.cis.swell.MathUtils.SVDTemplates1; import edu.upenn.cis.swell.SpectralRepresentations.ContextPCARepresentation; /** * The class generates the feature vectors given an input inside and outside * feature dictionary for each non-terminal in a corpus of parse trees. The * inside and outside feature vectors are stored serialized so that we do not * have to create the vectors again and can use them whenever we want by * deserialising the object. We store sparse feature vectors. These feature * vectors will be used to learn the linear transforms corresponding to each * non-terminal in Matlab. The feature vectors are binary and not scaled for * now. Read about the scaling in NAACL2013 and then implement scaling if * required * * @author sameerkhurana10 * */ public class VSMFeatureVectorsWordVBN { static Matrix phiL; static Matrix phiR; Matrix phiLT; Matrix phiRT; static Matrix phiLCSU; static Matrix phiRCSU; Matrix phiL_1stage; Matrix phiR_1stage; static double[] s; private static DenseDoubleMatrix2D dictMatrixCOLT = null; private static int d; private static int dprime; public static void main(String... args) throws Exception { /* * The inside and outisde projection matrices I suppose */ Object[] matrices = new Object[2]; /* * Data structure to hold all the sparse vectors */ // ArrayList<SparseVector> phiList = new ArrayList<SparseVector>(); // ArrayList<SparseVector> psiList = new ArrayList<SparseVector>(); /* * Used to normalize the trees */ PTBTreeNormaliser treeNormalizer = new PTBTreeNormaliser(true); /* * Getting the feature dictionary path, i.e. the serialized file path. * This dictionary will be used to form the feature vectors. */ String featureDictionary = null; /* * This variable tells the code about the directory path where parse * trees are stored from which feature vectors need to be extracted * corresponding to all the nodes */ String parsedTreeCorpus = null; /* * The feature dictionary that needs to be used while extracting * features */ featureDictionary = "/disk/scratch/s1444025/worddictionary/worddictionary.ser"; /* * The directory that holds the parse trees that are iterated over to * extract the feature vector corresponding to the nodes */ parsedTreeCorpus = "/afs/inf.ed.ac.uk/group/project/vsm.restored/trees"; /* * Necessary to get the appropriate directory structure */ // countMapLoc = // "/afs/inf.ed.ac.uk/group/project/vsm/countmapnodesamples/countMap.ser"; /* * Getting the serialised dictionary bean object that contains the * inside and outside feature dictionaries which are used to form the * feature vectors */ VSMWordDictionaryBean dictionaryBean = VSMReadSerialWordDict .readSerializedDictionary(featureDictionary); /* * Getting the inside and outside feature dictionaries, that are used * for forming the feature vectors */ System.out.println("***Getting word dictionary*****"); Alphabet wordDictionary = dictionaryBean.getWordDictionary(); System.out.println(wordDictionary); // System.out.println(wordDictionary.size()); dprime = wordDictionary.size(); d = wordDictionary.size(); SparseMatrixLil PsiTPsi = new SparseMatrixLil(dprime, dprime); SparseMatrixLil PsiTPhi = new SparseMatrixLil(dprime, d); SparseMatrixLil PhiTPhi = new SparseMatrixLil(d, d); SparseMatrixLil PhiTPsi = new SparseMatrixLil(d, dprime); /* * The parsed tree corpus from where the feature vectors need to be * extracted corresponding to all the nodes */ File[] files = new File(parsedTreeCorpus).listFiles(new FileFilter() { @Override public boolean accept(File file) { return !file.isHidden(); } }); ArrayList<String> filePaths = VSMUtil.getFilePaths(files); /* * The obect that is used to serialize the feature vector bean. The * feature vector bean storing the inside and outside feature vectors * corresponding to a particular node in a tree. Each feature vector * bean holds the feature vectors for one particular node */ VSMSerializeFeatureVectorBeanWord serializeBean = null; /* * If we already have a serialized count map object then we would want * to start from where we left */ // File fileCountMap = new File(countMapLoc); serializeBean = new VSMSerializeFeatureVectorBeanWord(); // } else { // VSMCountMap countMapObj = VSMReadSerialCountMap // .readCountMapObj(countMapLoc); // System.out.println("inside the count map***"); // serializeBean = new VSMSerializeFeatureVectorBeanWord( // countMapObj.getCountMap()); // } /* * Getting the data structure to store all the feature vectors in it, We * are taking 200000 samples for a particular non-terminal */ SparseMatrixLil Phi = new SparseMatrixLil(300000, d); SparseMatrixLil Psi = new SparseMatrixLil(300000, dprime); int count = 0; mainloop: for (String filePath : filePaths) { /* * Getting an iterator over the trees in the file */ PennTreeReader treeReader = VSMUtil.getTreeReader(filePath); /* * Iterating over all the trees */ while (treeReader.hasNext()) { /* * The syntax tree */ Tree<String> syntaxTree = null; /* * Unmatched parentheses exception. Does this mean that the * BLLIP corpus sometimes does not have correct parse trees? * Strange */ try { syntaxTree = treeReader.next(); } catch (RuntimeException e) { System.out.println("exception" + e + " ::tree " + syntaxTree); } /* * Do stuff only if the syntax tree is a valid one */ if (syntaxTree != null) { /* * Process the syntax tree to remove the top bracket */ syntaxTree = treeNormalizer.process(syntaxTree); /* * Iterator over the nodes of the tree */ Iterator<Tree<String>> nodeTrees = syntaxTree.iterator(); /* * Sparse Inside and outside feature vectors declared */ no.uib.cipr.matrix.sparse.SparseVector psi = null; no.uib.cipr.matrix.sparse.SparseVector phi = null; Tree<String> insideTree = null; /* * Iterating over all the nodes in a particular syntax tree */ while (nodeTrees.hasNext()) { /* * This is the inside tree for which we want to form a * feature vector and store it in the map */ insideTree = nodeTrees.next(); /* * Only do stuff if inside tree is not a leaf */ if (!insideTree.isLeaf() && insideTree.getLabel().equalsIgnoreCase("VBN")) { /* * Setting the object's properties that are stored * in the .ser file */ VSMWordFeatureVectorBean vectorBean = new VSMWordFeatureVectorBean(); System.out .println("****Extracting inside and outside feature vectors for node**** " + insideTree.getLabel()); /* * Getting the inside and outside feature vectors * corresponding to the partcular node */ psi = new VSMOutsideFeatureVectorWords() .getOutsideFeatureVectorPsi(syntaxTree, insideTree, wordDictionary, vectorBean); // psiList.add(psi); phi = new VSMInsideFeatureVectorWords() .getInsideFeatureVectorPhi(insideTree, wordDictionary, vectorBean); // phiList.add(phi); System.out.println("got the sparse vectors*** "); /* * Inside sparse matrix formation for the particular * node. */ /* * Do the below operation only if both psi and phi * are not null for the given node sample and also * if either psi pr phi are different than before * for this spample, if both are same then no need * to unecessarily fill up Psi and Phi */ if (phi != null && psi != null) { System.out.println(count); System.out .println("****Filling in the matrices***"); int[] indicesPhi = phi.getIndex(); double[] valuesPhi = phi.getData(); /* * Don't need the phi anymore in this iteration */ phi = null; /* * Putting the inside feature vector into the * inside feature matrix */ for (int i = 0; i < indicesPhi.length; i++) { Phi.append(count, indicesPhi[i], valuesPhi[i]); } indicesPhi = null; valuesPhi = null; /* * Outside sparse matrix formation for the * particular node */ int[] indicesPsi = psi.getIndex(); double[] valuesPsi = psi.getData(); psi = null; /* * Putting the outside feature vector into the * outside feature matrix */ for (int j = 0; j < indicesPsi.length; j++) { Psi.append(count, indicesPsi[j], valuesPsi[j]); } indicesPsi = null; valuesPsi = null; System.gc(); /* * Storing the feature vectors in a bean which * will be serialized for future use */ vectorBean.setPhi(phi); vectorBean.setPsi(psi); vectorBean.setInsideTree(insideTree); vectorBean.setLabel(insideTree.getLabel()); vectorBean.setSyntaxTree(syntaxTree); /* * Serialize the feature vector bean * corresponding to the particular node. The * feature vector bean contains the sparse * inside and outside feature vectors */ serializeBean .serializeWordVectorBean(vectorBean); System.out .println("***Serialized the feature vector***"); count++; /* * Break when we have 200000 samples */ if (count == (Psi.rows - 1)) { break mainloop; } } } } } } } /* * Call the CCA function here */ System.out.println("*****Done with matrices formation****"); /* * Just calculating the co-vavriance, assuming that the data is centered * and normalized */ System.out.println("***Calculating Covariances****"); PsiTPsi = Psi.t().mmul(Psi); // d' \times d' PsiTPhi = Psi.t().mmul(Phi);// d' \times d PhiTPhi = Phi.t().mmul(Phi);// d \times d PhiTPsi = Phi.t().mmul(Psi);// d \times d' System.out.println("****Done with it***"); /* * Log and square root transform */ PsiTPsi = VSMUtil.createJeigenMatrix(transform(VSMUtil .createSparseMatrixMTJFromJeigen(PsiTPsi))); PsiTPhi = VSMUtil.createJeigenMatrix(transform(VSMUtil .createSparseMatrixMTJFromJeigen(PsiTPhi))); PhiTPhi = VSMUtil.createJeigenMatrix(transform(VSMUtil .createSparseMatrixMTJFromJeigen(PhiTPhi))); PhiTPsi = VSMUtil.createJeigenMatrix(transform(VSMUtil .createSparseMatrixMTJFromJeigen(PhiTPsi))); /* * Writing the co-variance matrices in a text file to see what's going * on */ System.out .println("****Writing the Covarinace Matrices to the file***"); VSMUtil.writeCovarMatrixSem(PsiTPsi, "VBN"); VSMUtil.writeCovarMatrixSem(PsiTPhi, "VBN"); VSMUtil.writeCovarMatrixSem(PhiTPhi, "VBN"); VSMUtil.writeCovarMatrixSem(PhiTPsi, "VBN"); System.out.println("***Done***"); /* * Done with the Psi and Phi and freeing up some space */ Psi = null; Phi = null; System.gc(); /* * Getting the the similarity scoressvd template object that has utility * methods to do preprocessing before performing CCA */ SVDTemplates1 svdTC = new SVDTemplates1(null); /* * Function to compute the CCA, passing the covariance matrices to the * function */ computeCCA2( MatrixFormatConversion.createSparseMatrixMTJFromJeigen(PsiTPhi), MatrixFormatConversion.createSparseMatrixMTJFromJeigen(PhiTPsi), MatrixFormatConversion.createSparseMatrixMTJFromJeigen(PhiTPhi), MatrixFormatConversion.createSparseMatrixMTJFromJeigen(PsiTPsi), svdTC, null, 0, 50, "VBN"); /* * Writing the projection matrices out in a file to see what is in there */ matrices = VSMUtil.deserializeCCAVariantsRunSem("VBN"); VSMUtil.writeEigenDictInsideSemantic(matrices, "VBN", d); VSMUtil.writeEigenDictOutsideSem(matrices, "VBN", dprime); matrices = null; PsiTPhi = null; PhiTPhi = null; PsiTPsi = null; PhiTPsi = null; System.gc(); /* * We would also like to serialize the count map. The count map is the * data structure that helps us store the .ser files in proper * directories with proper names. So, if in future we want to extract * feature vectors corresponding to more parse trees, we will start from * where we left in the directory structure and file name */ /* * Getting the updated count map */ // countMap = VSMSerializeFeatureVectorBean.getCountMap(); // /* // * The object that will be serialized // */ // VSMCountMap countMapObject = new VSMCountMap(); // countMapObject.setCountMap(countMap); // // /* // * Serialize count map // */ // VSMSerializeCountMap.serializeCountMap(countMapObject); // System.out.println("*****count map serialized****"); } /** * Computing CCA * * @param xty * - x = \Psi and y= \Phi * @param ytx * @param yty * @param xtx * @param svdTC * @param _cpcaR2 * @param twoStageFlag * @return */ private static void computeCCA2(FlexCompRowMatrix xty, FlexCompRowMatrix ytx, FlexCompRowMatrix yty, FlexCompRowMatrix xtx, SVDTemplates1 svdTC, ContextPCARepresentation _cpcaR2, int twoStageFlag, int hiddenStates, String directoryName) { System.out.println("+++Entering CCA Compute Function+++"); DenseDoubleMatrix2D phiLCOLT, phiRCOLT; // remember x is Psi, i.e. the outside feature matrix and hence the // dimensionality here is dprime \times k System.out .println("***Creating the dense matrix, Memory Consuming Step****"); /* Total memory currently in use by the JVM */ System.out.println("Total memory (bytes) currently used: " + Runtime.getRuntime().totalMemory()); phiLCOLT = new DenseDoubleMatrix2D(xtx.numRows(), hiddenStates); /* * The below matrix dimensionality is d \times k */ phiRCOLT = new DenseDoubleMatrix2D(yty.numRows(), hiddenStates); System.out .println("****Memory Consuming Step Done, Loaded two huge matrices in Memory****"); /* Total memory currently in use by the JVM */ System.out.println("Total memory (bytes) used currently by JVM: " + Runtime.getRuntime().totalMemory()); /* * dprime \times d */ FlexCompRowMatrix auxMat1 = new FlexCompRowMatrix(xtx.numRows(), xty.numColumns()); /* * d \times dprime */ FlexCompRowMatrix auxMat2 = new FlexCompRowMatrix(yty.numRows(), ytx.numColumns()); /* * dprime \times d */ FlexCompRowMatrix auxMat3 = new FlexCompRowMatrix(auxMat1.numRows(), auxMat1.numColumns()); /* * d \times dprime */ FlexCompRowMatrix auxMat4 = new FlexCompRowMatrix(auxMat2.numRows(), auxMat2.numColumns()); // d in our case, the dimensionality of the inside feature matrix int dim1 = ytx.numRows(); // dprime in our case, the dimensionality of the outside feature matrix int dim2 = xty.numRows(); System.out.println("+++Initialized auxiliary matrices+++"); /* * Calculating C_{xx}^{-1|2} C_{xy} */ auxMat1 = MatrixFormatConversion.multLargeSparseMatricesJEIGEN( computeSparseInverseSqRoot(xtx), xty); /* * Multiplying auxMat1 with C_{yy}^{-1|2} */ auxMat3 = MatrixFormatConversion.multLargeSparseMatricesJEIGEN(auxMat1, computeSparseInverseSqRoot(yty)); System.out.println("+++Computed 1 inverse+++"); // (svdTC.computeSparseInverse(yty)).zMult(ytx, auxMat2); /* * C_{yy}^{-1|2}.C_{yx} */ auxMat2 = MatrixFormatConversion.multLargeSparseMatricesJEIGEN( (svdTC.computeSparseInverseSqRoot(yty)), ytx); /* * Multiplying auxMat2 with C_{xx}^{-1|2} */ auxMat4 = MatrixFormatConversion.multLargeSparseMatricesJEIGEN(auxMat2, svdTC.computeSparseInverseSqRoot(xtx)); System.out.println("+++Computed Inverses+++"); // auxMat1.zMult(auxMat2,auxMat3); System.out.println("+++Entering SVD computation+++"); /* * Unnormalized Z projection matrix i.e. the Outside Projection Matrix, * but Unnormalized */ phiLCSU = svdTC.computeSVD_Tropp( MatrixFormatConversion.createSparseMatrixCOLT(auxMat3), getOmegaMatrix(auxMat3.numColumns(), hiddenStates), dim1); s = svdTC.getSingularVals(); /* * Write singular values to a file, just to see what's going on in here */ VSMUtil.writeSingularValuesSem(s, "VBN"); // phiL=phiLCSU; MatrixFormatConversion.createSparseMatrixCOLT( (svdTC.computeSparseInverseSqRoot(xtx))) .zMult(MatrixFormatConversion.createDenseMatrixCOLT(phiLCSU), phiLCOLT); /* * This is the actual Outside projection TODO, check whether this is * actually the Outside projection. We get this by performing SVD on * C_{xx}^{-1|2}.C_{XY}.C{YY}^{-1|2}, where x is the outside feature * matrix (\Psi) and y is the inside feature matrix (\Phi) dprime \times * k */ /* Total memory currently in use by the JVM */ System.out.println("Total memory (bytes) currently used: " + Runtime.getRuntime().totalMemory()); phiL = MatrixFormatConversion.createDenseMatrixJAMA(phiLCOLT); /* * Unormalized Y projection matrix */ phiRCSU = svdTC.computeSVD_Tropp( MatrixFormatConversion.createSparseMatrixCOLT(auxMat4), getOmegaMatrix(auxMat4.numColumns(), hiddenStates), dim2); MatrixFormatConversion.createSparseMatrixCOLT( (svdTC.computeSparseInverseSqRoot(yty))) .zMult(MatrixFormatConversion.createDenseMatrixCOLT(phiRCSU), phiRCOLT); /* * THe inside projection matrix for the node */ // 700000 \times 200 /* Total memory currently in use by the JVM */ System.out.println("Total memory (bytes) currently used: " + Runtime.getRuntime().totalMemory()); phiR = MatrixFormatConversion.createDenseMatrixJAMA(phiRCOLT); /* * Serialize PhiR and PhiL */ System.out.println("***Serializing***"); serializeCCAVariantsRun(directoryName); System.out.println("Freeing up the memory"); phiLCOLT = null; phiRCOLT = null; phiL = null; phiLCSU = null; phiRCSU = null; phiR = null; /* Total memory currently in use by the JVM */ System.out.println("Total memory (bytes) currently used: " + Runtime.getRuntime().totalMemory()); } /** * For randomized SVD * * @param rows * @return */ public static DenseDoubleMatrix2D getOmegaMatrix(int rows, int hiddenState) {// Refer // Tropp's // notation Random r = new Random(); DenseDoubleMatrix2D Omega; Omega = new DenseDoubleMatrix2D(rows, hiddenState + 20);// Oversampled // the rank k for (int i = 0; i < (rows); i++) { for (int j = 0; j < hiddenState + 20; j++) Omega.set(i, j, r.nextGaussian()); } System.out.println("==Created Omega Matrix=="); return Omega; } /** * Important method used in compute CCA * * @param X * @return */ public static FlexCompRowMatrix computeSparseInverseSqRoot( FlexCompRowMatrix X) { FlexCompRowMatrix diagInvEntries = new FlexCompRowMatrix(X.numRows(), X.numColumns()); System.out.println("++Beginning Sparse Inverse Sq. Root++"); for (MatrixEntry e : X) { if (e.row() == e.column() && e.get() != 0) { diagInvEntries.set(e.row(), e.column(), 1 / Math.sqrt(e.get())); } if (e.row() == e.column() && e.get() == 0) { diagInvEntries.set(e.row(), e.column(), 10000); // Some large // value } } System.out.println("++Finished Sparse Inverse Sq. Root++"); return diagInvEntries; } public static void serializeCCAVariantsRun(String directoryName) { // String fileDirPath = // "/Users/sameerkhurana10/Documents/serializedprojections/" // + directoryName; String fileDirPath = "/afs/inf.ed.ac.uk/group/project/vsm.restored/semanticprojectionserobjects/" + directoryName; File fileDir = new File(fileDirPath); if (!fileDir.exists()) { fileDir.mkdirs(); } String fileName = fileDir.getAbsolutePath() + "/projectionInside.ser"; String fileName1 = fileDir.getAbsolutePath() + "/projectionOutside.ser"; try { ObjectOutput inside = new ObjectOutputStream(new FileOutputStream( fileName)); ObjectOutput outside = new ObjectOutputStream(new FileOutputStream( fileName1)); /* * Inside serialization */ outside.writeObject(phiL); outside.flush(); outside.close(); /* * Outside serialization */ inside.writeObject(phiR); inside.flush(); inside.close(); System.out.println("=======Serialized the CCA Variant Run======="); } catch (IOException ioe) { System.out.println(ioe.getMessage()); } } public static FlexCompRowMatrix transform(FlexCompRowMatrix a) { Iterator<MatrixEntry> aIt = a.iterator(); // iterating over the elements // in the matrix double ent = 0; while (aIt.hasNext()) { MatrixEntry ment = aIt.next(); ent = ment.get(); if (true) ent = Math.log(ent); // log transform, a good thing to do I // guess if (true) ent = Math.sqrt(ent); // this is also a valid thing to do a.set(ment.row(), ment.column(), ent); // Performing tranforms on // the matrix } return a; } }
2fec017d3d6ac5d6260f16d0e608dc6297d9cb27
2121c5d0d42ac6e9fc3b9862f98a60cfce7fe230
/app/src/main/java/com/example/latihan1/api/HttpHandler.java
3883a82ac82f4ba8c8cb486d0dd31c2f02f3ced9
[]
no_license
NekciR/Latihan1
dee475372ebd4a679d17b7dd3987383b61169c36
e8d39c46b174b05833367319deea3887585c2a5c
refs/heads/main
2023-08-16T09:00:55.776960
2021-09-23T05:30:54
2021-09-23T05:30:54
409,460,465
0
0
null
null
null
null
UTF-8
Java
false
false
1,948
java
package com.example.latihan1.api; import android.util.Log; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.ProtocolException; import java.net.URL; public class HttpHandler { private static final String TAG = HttpHandler.class.getSimpleName(); public HttpHandler() { } public String makeServiceCall(String reqUrl) { String response = null; try { URL url = new URL(reqUrl); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); // read the response InputStream in = new BufferedInputStream(conn.getInputStream()); response = convertStreamToString(in); } catch (MalformedURLException e) { Log.e(TAG, "MalformedURLException: " + e.getMessage()); } catch (ProtocolException e) { Log.e(TAG, "ProtocolException: " + e.getMessage()); } catch (IOException e) { Log.e(TAG, "IOException: " + e.getMessage()); } catch (Exception e) { Log.e(TAG, "Exception: " + e.getMessage()); } return response; } private String convertStreamToString(InputStream is) { BufferedReader reader = new BufferedReader(new InputStreamReader(is)); StringBuilder sb = new StringBuilder(); String line; try { while ((line = reader.readLine()) != null) { sb.append(line).append('\n'); } } catch (IOException e) { e.printStackTrace(); } finally { try { is.close(); } catch (IOException e) { e.printStackTrace(); } } return sb.toString(); } }
8f9993fc7b38bfc79555625642a1eacad3411fd3
f50b0555df03bfb22185c071cdb5581e4f67182b
/cnc_dao/src/main/java/com/cnc/dao/ccr/mapper/UserDAO.java
fdfe9110457f79fedd29cff773d1fe72d1606c2e
[]
no_license
Tanwei1770/cn
17cbdfe57f84d6a0f3bdfbd0be5c78e6f9fdbd63
af75260558e37184288fb0dbbd89da800a5346f6
refs/heads/master
2023-02-19T00:19:35.207115
2021-01-13T16:23:55
2021-01-13T16:23:55
329,306,811
0
0
null
null
null
null
UTF-8
Java
false
false
536
java
package com.cnc.dao.ccr.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.cnc.entity.user.Perms; import com.cnc.entity.user.User; import org.apache.ibatis.annotations.Mapper; import java.util.List; @Mapper public interface UserDAO extends BaseMapper<User> { void save(User user); User findByUserName(String username); //根据用户名查询所有角色 User findRolesByUserName(String username); //根据角色id查询权限集合 List<Perms> findPermsByRoleId(String id); }
c4599ee5c84939cb35f679f8fcb1b6d8d2972a9d
6af8173edb8f6696cda8d04acd7d8da5446ef1d1
/src/main/java/com/codegym/controller/CategoryController.java
f5a5eac7c0bd53223867f366cad4fe3565beac90
[]
no_license
phinamdesign/Fashion-back-end
15b97746b1ad4e2a6a4cf06846913331306de61d
3fb251749d46cee6336cbaf51bbd30c536123e6f
refs/heads/master
2020-12-06T18:25:33.330482
2020-02-11T04:04:03
2020-02-11T04:04:03
232,524,808
1
0
null
null
null
null
UTF-8
Java
false
false
3,605
java
package com.codegym.controller; import com.codegym.model.Category; import com.codegym.service.CategoryService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import org.springframework.web.util.UriComponentsBuilder; import java.util.List; import java.util.Optional; @RestController @CrossOrigin(maxAge = 3600) //@PreAuthorize("hasRole('USER') or hasRole('ADMIN')") @RequestMapping("/api/auth") public class CategoryController { @Autowired private CategoryService categoryService; @GetMapping("/category") // @PreAuthorize("hasRole('ADMIN')") ResponseEntity<List<Category>> getAllCategory() { List<Category> categoryList = (List<Category>) categoryService.findAllCategory(); if (categoryList.isEmpty()) { return new ResponseEntity<List<Category>>(HttpStatus.NO_CONTENT); } return new ResponseEntity<List<Category>>(categoryList, HttpStatus.OK); } @PostMapping("/category") @PreAuthorize("hasRole('ADMIN')") ResponseEntity<Category> createCategory(@RequestBody Category category, UriComponentsBuilder ucBuilder) { categoryService.saveCategory(category); HttpHeaders headers = new HttpHeaders(); headers.setLocation(ucBuilder.path("/api/admin/category/{id}").buildAndExpand(category.getCategoryId()).toUri()); return new ResponseEntity<Category>(headers, HttpStatus.CREATED); } @GetMapping("/category/{id}") @PreAuthorize("hasRole('ADMIN')") ResponseEntity<?> getCategory(@PathVariable("id") Long id) { Optional<Category> category = categoryService.findByCategoryId(id); if (!category.isPresent()) { return new ResponseEntity<>(HttpStatus.NOT_FOUND); } return new ResponseEntity<>(category, HttpStatus.OK); } @PutMapping("/category/{id}") @PreAuthorize("hasRole('ADMIN')") ResponseEntity<?> editCategory(@PathVariable("id") Long id, @RequestBody Category category) { Optional<Category> currentCategory = categoryService.findByCategoryId(id); if (!currentCategory.isPresent()) { return new ResponseEntity<>(HttpStatus.NOT_FOUND); } currentCategory.get().setCategoryName(category.getCategoryName()); categoryService.saveCategory(currentCategory.get()); return new ResponseEntity<>(currentCategory, HttpStatus.OK); } @DeleteMapping("/category/{id}") @PreAuthorize("hasRole('ADMIN')") ResponseEntity<?> deleteCategory(@PathVariable("id") Long id) { Optional<Category> thisCategory = categoryService.findByCategoryId(id); if (!thisCategory.isPresent()) { return new ResponseEntity<>(HttpStatus.NOT_FOUND); } categoryService.removeCategory(id); return new ResponseEntity<Category>(HttpStatus.NO_CONTENT); } @GetMapping("/search/category") // @PreAuthorize("hasRole('USER') or hasRole('ADMIN')") ResponseEntity<?> findCategory(@RequestParam("name") Optional<String> categoryName) { Iterable<Category> categories; if (categoryName.isPresent()) { categories = categoryService.findAllByCategoryName(categoryName.get()); } else { return new ResponseEntity<>(HttpStatus.NOT_FOUND); } return new ResponseEntity<>(categories, HttpStatus.OK); } }
f80189e4bc6372da13ff659664434d71eee36a63
5d62f8680dc54bd2673293734e01c0f76e4200ca
/Meeting Organizer/src/com/service/MOrganizerService.java
0026274eb0d54d128b4624ede165635e052bcd31
[]
no_license
ManuArugollu1/meetingoraganizer1
dc65abe0b51f7a39f02b60f1e072c7fef90201d6
53278894f6b901c95106072c0424b2ca54a6101d
refs/heads/master
2023-04-30T11:07:23.588723
2023-04-14T12:39:21
2023-04-14T12:39:21
212,091,833
0
0
null
null
null
null
UTF-8
Java
false
false
458
java
package com.service; import java.util.List; import com.model.MOrganizer; public interface MOrganizerService { MOrganizer findByUserName(String userName); MOrganizer addUser(String name,String userName,String password,long mobileNumber); MOrganizer updateUser(MOrganizer org); MOrganizer deleteUser(MOrganizer org); List<MOrganizer> findAll(); boolean checkLogin(String userName,String password); MOrganizer getHomePage(String userName); }
93d6cdeae20d8c57edb6b48e0b0e97f6838472fb
b152c9dd276b33f7b2ad14d6a8071a042e299352
/library/SlidingDrawer/src/it/sephiroth/demo/slider/widget/MultiDirectionSlidingDrawer.java
b21b836b9a4435842a52f9a280d6269423e06fe0
[ "MIT" ]
permissive
ECGKit/android-scp
fa442658554a02a633f37c99dc6b2505f5dec2c1
7d51d4180d56930687d7005b4a1e285356ca2d54
refs/heads/master
2021-12-04T11:37:16.122615
2015-03-23T02:50:55
2015-03-23T02:50:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
32,239
java
/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Modifications by: Alessandro Crugnola */ package it.sephiroth.demo.slider.widget; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Rect; import android.os.Handler; import android.os.Message; import android.os.SystemClock; import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; import android.view.SoundEffectConstants; import android.view.VelocityTracker; import android.view.View; import android.view.ViewGroup; import android.view.accessibility.AccessibilityEvent; public class MultiDirectionSlidingDrawer extends ViewGroup { public static final int ORIENTATION_RTL = 0; public static final int ORIENTATION_BTT = 1; public static final int ORIENTATION_LTR = 2; public static final int ORIENTATION_TTB = 3; private static final int TAP_THRESHOLD = 6; private static final float MAXIMUM_TAP_VELOCITY = 100.0f; private static final float MAXIMUM_MINOR_VELOCITY = 150.0f; private static final float MAXIMUM_MAJOR_VELOCITY = 200.0f; private static final float MAXIMUM_ACCELERATION = 2000.0f; private static final int VELOCITY_UNITS = 1000; private static final int MSG_ANIMATE = 1000; private static final int ANIMATION_FRAME_DURATION = 1000 / 60; private static final int EXPANDED_FULL_OPEN = -10001; private static final int COLLAPSED_FULL_CLOSED = -10002; private final int mHandleId; private final int mContentId; private View mHandle; private View mContent; private final Rect mFrame = new Rect(); private final Rect mInvalidate = new Rect(); private boolean mTracking; private boolean mLocked; private VelocityTracker mVelocityTracker; private boolean mInvert; private boolean mVertical; private boolean mExpanded; private int mBottomOffset; private int mTopOffset; private int mHandleHeight; private int mHandleWidth; private OnDrawerOpenListener mOnDrawerOpenListener; private OnDrawerCloseListener mOnDrawerCloseListener; private OnDrawerScrollListener mOnDrawerScrollListener; private final Handler mHandler = new SlidingHandler(); private float mAnimatedAcceleration; private float mAnimatedVelocity; private float mAnimationPosition; private long mAnimationLastTime; private long mCurrentAnimationTime; private int mTouchDelta; private boolean mAnimating; private boolean mAllowSingleTap; private boolean mAnimateOnClick; private final int mTapThreshold; private final int mMaximumTapVelocity; private int mMaximumMinorVelocity; private int mMaximumMajorVelocity; private int mMaximumAcceleration; private final int mVelocityUnits; /** * Callback invoked when the drawer is opened. */ public static interface OnDrawerOpenListener { /** * Invoked when the drawer becomes fully open. */ public void onDrawerOpened(); } /** * Callback invoked when the drawer is closed. */ public static interface OnDrawerCloseListener { /** * Invoked when the drawer becomes fully closed. */ public void onDrawerClosed(); } /** * Callback invoked when the drawer is scrolled. */ public static interface OnDrawerScrollListener { /** * Invoked when the user starts dragging/flinging the drawer's handle. */ public void onScrollStarted(); /** * Invoked when the user stops dragging/flinging the drawer's handle. */ public void onScrollEnded(); } /** * Creates a new SlidingDrawer from a specified set of attributes defined in * XML. * * @param context * The application's environment. * @param attrs * The attributes defined in XML. */ public MultiDirectionSlidingDrawer( Context context, AttributeSet attrs ) { this( context, attrs, 0 ); } /** * Creates a new SlidingDrawer from a specified set of attributes defined in * XML. * * @param context * The application's environment. * @param attrs * The attributes defined in XML. * @param defStyle * The style to apply to this widget. */ public MultiDirectionSlidingDrawer( Context context, AttributeSet attrs, int defStyle ) { super( context, attrs, defStyle ); TypedArray a = context.obtainStyledAttributes( attrs, R.styleable.MultiDirectionSlidingDrawer, defStyle, 0 ); int orientation = a.getInt( R.styleable.MultiDirectionSlidingDrawer_direction, ORIENTATION_BTT ); mVertical = ( orientation == ORIENTATION_BTT || orientation == ORIENTATION_TTB ); mBottomOffset = (int)a.getDimension( R.styleable.MultiDirectionSlidingDrawer_bottomOffset, 0.0f ); mTopOffset = (int)a.getDimension( R.styleable.MultiDirectionSlidingDrawer_topOffset, 0.0f ); mAllowSingleTap = a.getBoolean( R.styleable.MultiDirectionSlidingDrawer_allowSingleTap, true ); mAnimateOnClick = a.getBoolean( R.styleable.MultiDirectionSlidingDrawer_animateOnClick, true ); mInvert = ( orientation == ORIENTATION_TTB || orientation == ORIENTATION_LTR ); int handleId = a.getResourceId( R.styleable.MultiDirectionSlidingDrawer_handle, 0 ); if ( handleId == 0 ) { throw new IllegalArgumentException( "The handle attribute is required and must refer " + "to a valid child." ); } int contentId = a.getResourceId( R.styleable.MultiDirectionSlidingDrawer_content, 0 ); if ( contentId == 0 ) { throw new IllegalArgumentException( "The content attribute is required and must refer " + "to a valid child." ); } if ( handleId == contentId ) { throw new IllegalArgumentException( "The content and handle attributes must refer " + "to different children." ); } mHandleId = handleId; mContentId = contentId; final float density = getResources().getDisplayMetrics().density; mTapThreshold = (int)( TAP_THRESHOLD * density + 0.5f ); mMaximumTapVelocity = (int)( MAXIMUM_TAP_VELOCITY * density + 0.5f ); mMaximumMinorVelocity = (int)( MAXIMUM_MINOR_VELOCITY * density + 0.5f ); mMaximumMajorVelocity = (int)( MAXIMUM_MAJOR_VELOCITY * density + 0.5f ); mMaximumAcceleration = (int)( MAXIMUM_ACCELERATION * density + 0.5f ); mVelocityUnits = (int)( VELOCITY_UNITS * density + 0.5f ); if( mInvert ) { mMaximumAcceleration = -mMaximumAcceleration; mMaximumMajorVelocity = -mMaximumMajorVelocity; mMaximumMinorVelocity = -mMaximumMinorVelocity; } a.recycle(); setAlwaysDrawnWithCacheEnabled( false ); } @Override protected void onFinishInflate() { mHandle = findViewById( mHandleId ); if ( mHandle == null ) { throw new IllegalArgumentException( "The handle attribute is must refer to an" + " existing child." ); } mHandle.setOnClickListener( new DrawerToggler() ); mContent = findViewById( mContentId ); if ( mContent == null ) { throw new IllegalArgumentException( "The content attribute is must refer to an" + " existing child." ); } mContent.setVisibility( View.GONE ); } @Override protected void onMeasure( int widthMeasureSpec, int heightMeasureSpec ) { int widthSpecMode = MeasureSpec.getMode( widthMeasureSpec ); int widthSpecSize = MeasureSpec.getSize( widthMeasureSpec ); int heightSpecMode = MeasureSpec.getMode( heightMeasureSpec ); int heightSpecSize = MeasureSpec.getSize( heightMeasureSpec ); if ( widthSpecMode == MeasureSpec.UNSPECIFIED || heightSpecMode == MeasureSpec.UNSPECIFIED ) { throw new RuntimeException( "SlidingDrawer cannot have UNSPECIFIED dimensions" ); } final View handle = mHandle; measureChild( handle, widthMeasureSpec, heightMeasureSpec ); if ( mVertical ) { int height = heightSpecSize - handle.getMeasuredHeight() - mTopOffset; mContent.measure( MeasureSpec.makeMeasureSpec( widthSpecSize, MeasureSpec.EXACTLY ), MeasureSpec.makeMeasureSpec( height, MeasureSpec.EXACTLY ) ); } else { int width = widthSpecSize - handle.getMeasuredWidth() - mTopOffset; mContent.measure( MeasureSpec.makeMeasureSpec( width, MeasureSpec.EXACTLY ), MeasureSpec.makeMeasureSpec( heightSpecSize, MeasureSpec.EXACTLY ) ); } setMeasuredDimension( widthSpecSize, heightSpecSize ); } @Override protected void dispatchDraw( Canvas canvas ) { final long drawingTime = getDrawingTime(); final View handle = mHandle; final boolean isVertical = mVertical; drawChild( canvas, handle, drawingTime ); if ( mTracking || mAnimating ) { final Bitmap cache = mContent.getDrawingCache(); if ( cache != null ) { if ( isVertical ) { if( mInvert ) { canvas.drawBitmap( cache, 0, handle.getTop() - (getBottom() - getTop()) + mHandleHeight, null ); } else { canvas.drawBitmap( cache, 0, handle.getBottom(), null ); } } else { canvas.drawBitmap( cache, mInvert ? handle.getLeft() - cache.getWidth() : handle.getRight(), 0, null ); } } else { canvas.save(); if( mInvert ) { canvas.translate( isVertical ? 0 : handle.getLeft() - mTopOffset - mContent.getMeasuredWidth(), isVertical ? handle.getTop() - mTopOffset - mContent.getMeasuredHeight() : 0 ); } else { canvas.translate( isVertical ? 0 : handle.getLeft() - mTopOffset, isVertical ? handle.getTop() - mTopOffset : 0 ); } drawChild( canvas, mContent, drawingTime ); canvas.restore(); } invalidate(); } else if ( mExpanded ) { drawChild( canvas, mContent, drawingTime ); } } public static final String LOG_TAG = "Sliding"; @Override protected void onLayout( boolean changed, int l, int t, int r, int b ) { if ( mTracking ) { return; } final int width = r - l; final int height = b - t; final View handle = mHandle; int handleWidth = handle.getMeasuredWidth(); int handleHeight = handle.getMeasuredHeight(); Log.d( LOG_TAG, "handleHeight: " + handleHeight ); int handleLeft; int handleTop; final View content = mContent; if ( mVertical ) { handleLeft = ( width - handleWidth ) / 2; if ( mInvert ) { Log.d( LOG_TAG, "content.layout(1)" ); handleTop = mExpanded ? height - mBottomOffset - handleHeight : mTopOffset; content.layout( 0, mTopOffset, content.getMeasuredWidth(), mTopOffset + content.getMeasuredHeight() ); } else { handleTop = mExpanded ? mTopOffset : height - handleHeight + mBottomOffset; content.layout( 0, mTopOffset + handleHeight, content.getMeasuredWidth(), mTopOffset + handleHeight + content.getMeasuredHeight() ); } } else { handleTop = ( height - handleHeight ) / 2; if( mInvert ) { handleLeft = mExpanded ? width - mBottomOffset - handleWidth : mTopOffset; content.layout( mTopOffset, 0, mTopOffset + content.getMeasuredWidth(), content.getMeasuredHeight() ); } else { handleLeft = mExpanded ? mTopOffset : width - handleWidth + mBottomOffset; content.layout( mTopOffset + handleWidth, 0, mTopOffset + handleWidth + content.getMeasuredWidth(), content.getMeasuredHeight() ); } } handle.layout( handleLeft, handleTop, handleLeft + handleWidth, handleTop + handleHeight ); mHandleHeight = handle.getHeight(); mHandleWidth = handle.getWidth(); } @Override public boolean onInterceptTouchEvent( MotionEvent event ) { if ( mLocked ) { return false; } final int action = event.getAction(); float x = event.getX(); float y = event.getY(); final Rect frame = mFrame; final View handle = mHandle; handle.getHitRect( frame ); if ( !mTracking && !frame.contains( (int)x, (int)y ) ) { return false; } if ( action == MotionEvent.ACTION_DOWN ) { mTracking = true; handle.setPressed( true ); // Must be called before prepareTracking() prepareContent(); // Must be called after prepareContent() if ( mOnDrawerScrollListener != null ) { mOnDrawerScrollListener.onScrollStarted(); } if ( mVertical ) { final int top = mHandle.getTop(); mTouchDelta = (int)y - top; prepareTracking( top ); } else { final int left = mHandle.getLeft(); mTouchDelta = (int)x - left; prepareTracking( left ); } mVelocityTracker.addMovement( event ); } return true; } @Override public boolean onTouchEvent( MotionEvent event ) { if ( mLocked ) { return true; } if ( mTracking ) { mVelocityTracker.addMovement( event ); final int action = event.getAction(); switch ( action ) { case MotionEvent.ACTION_MOVE: moveHandle( (int)( mVertical ? event.getY() : event.getX() ) - mTouchDelta ); break; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: { final VelocityTracker velocityTracker = mVelocityTracker; velocityTracker.computeCurrentVelocity( mVelocityUnits ); float yVelocity = velocityTracker.getYVelocity(); float xVelocity = velocityTracker.getXVelocity(); boolean negative; final boolean vertical = mVertical; if ( vertical ) { negative = yVelocity < 0; if ( xVelocity < 0 ) { xVelocity = -xVelocity; } // fix by Maciej Ciemięga. if ( (!mInvert && xVelocity > mMaximumMinorVelocity) || (mInvert && xVelocity < mMaximumMinorVelocity) ) { xVelocity = mMaximumMinorVelocity; } } else { negative = xVelocity < 0; if ( yVelocity < 0 ) { yVelocity = -yVelocity; } // fix by Maciej Ciemięga. if ( (!mInvert && yVelocity > mMaximumMinorVelocity) || (mInvert && yVelocity < mMaximumMinorVelocity) ) { yVelocity = mMaximumMinorVelocity; } } float velocity = (float)Math.hypot( xVelocity, yVelocity ); if ( negative ) { velocity = -velocity; } final int handleTop = mHandle.getTop(); final int handleLeft = mHandle.getLeft(); final int handleBottom = mHandle.getBottom(); final int handleRight = mHandle.getRight(); if ( Math.abs( velocity ) < mMaximumTapVelocity ) { boolean c1; boolean c2; boolean c3; boolean c4; if( mInvert ) { c1 = ( mExpanded && (getBottom() - handleBottom ) < mTapThreshold + mBottomOffset ); c2 = ( !mExpanded && handleTop < mTopOffset + mHandleHeight - mTapThreshold ); c3 = ( mExpanded && (getRight() - handleRight ) < mTapThreshold + mBottomOffset ); c4 = ( !mExpanded && handleRight < mTopOffset + mHandleWidth - mTapThreshold ); } else { c1 = ( mExpanded && handleTop < mTapThreshold + mTopOffset ); c2 = ( !mExpanded && handleTop > mBottomOffset + getBottom() - getTop() - mHandleHeight - mTapThreshold ); c3 = ( mExpanded && handleLeft < mTapThreshold + mTopOffset ); c4 = ( !mExpanded && handleLeft > mBottomOffset + getRight() - getLeft() - mHandleWidth - mTapThreshold ); } Log.d( LOG_TAG, "ACTION_UP: " + "c1: " + c1 + ", c2: " + c2 + ", c3: " + c3 + ", c4: " + c4 ); if ( vertical ? c1 || c2 : c3 || c4 ) { if ( mAllowSingleTap ) { playSoundEffect( SoundEffectConstants.CLICK ); if ( mExpanded ) { animateClose( vertical ? handleTop : handleLeft ); } else { animateOpen( vertical ? handleTop : handleLeft ); } } else { performFling( vertical ? handleTop : handleLeft, velocity, false ); } } else { performFling( vertical ? handleTop : handleLeft, velocity, false ); } } else { performFling( vertical ? handleTop : handleLeft, velocity, false ); } } break; } } return mTracking || mAnimating || super.onTouchEvent( event ); } public void setTopOffset (int offset) { this.mTopOffset = offset; } private void animateClose( int position ) { prepareTracking( position ); performFling( position, mMaximumAcceleration, true ); } private void animateOpen( int position ) { prepareTracking( position ); performFling( position, -mMaximumAcceleration, true ); } private void performFling( int position, float velocity, boolean always ) { mAnimationPosition = position; mAnimatedVelocity = velocity; boolean c1; boolean c2; boolean c3; if ( mExpanded ) { int bottom = mVertical ? getBottom() : getRight(); int handleHeight = mVertical ? mHandleHeight : mHandleWidth; Log.d( LOG_TAG, "position: " + position + ", velocity: " + velocity + ", mMaximumMajorVelocity: " + mMaximumMajorVelocity ); c1 = mInvert ? velocity < mMaximumMajorVelocity : velocity > mMaximumMajorVelocity; c2 = mInvert ? ( bottom - (position + handleHeight) ) + mBottomOffset > handleHeight : position > mTopOffset + ( mVertical ? mHandleHeight : mHandleWidth ); c3 = mInvert ? velocity < -mMaximumMajorVelocity : velocity > -mMaximumMajorVelocity; Log.d( LOG_TAG, "EXPANDED. c1: " + c1 + ", c2: " + c2 + ", c3: " + c3 ); if ( always || ( c1 || ( c2 && c3 ) ) ) { // We are expanded, So animate to CLOSE! mAnimatedAcceleration = mMaximumAcceleration; if( mInvert ) { if ( velocity > 0 ) { mAnimatedVelocity = 0; } } else { if ( velocity < 0 ) { mAnimatedVelocity = 0; } } } else { // We are expanded, but they didn't move sufficiently to cause // us to retract. Animate back to the expanded position. so animate BACK to expanded! mAnimatedAcceleration = -mMaximumAcceleration; if( mInvert ) { if ( velocity < 0 ) { mAnimatedVelocity = 0; } } else { if ( velocity > 0 ) { mAnimatedVelocity = 0; } } } } else { // WE'RE COLLAPSED c1 = mInvert ? velocity < mMaximumMajorVelocity : velocity > mMaximumMajorVelocity; c2 = mInvert ? ( position < ( mVertical ? getHeight() : getWidth() ) / 2 ) : ( position > ( mVertical ? getHeight() : getWidth() ) / 2 ); c3 = mInvert ? velocity < -mMaximumMajorVelocity : velocity > -mMaximumMajorVelocity; Log.d( LOG_TAG, "COLLAPSED. position: " + position + ", velocity: " + velocity + ", mMaximumMajorVelocity: " + mMaximumMajorVelocity ); Log.d( LOG_TAG, "COLLAPSED. always: " + always + ", c1: " + c1 + ", c2: " + c2 + ", c3: " + c3 ); if ( !always && ( c1 || ( c2 && c3 ) ) ) { mAnimatedAcceleration = mMaximumAcceleration; if( mInvert ) { if ( velocity > 0 ) { mAnimatedVelocity = 0; } } else { if ( velocity < 0 ) { mAnimatedVelocity = 0; } } } else { mAnimatedAcceleration = -mMaximumAcceleration; if( mInvert ) { if ( velocity < 0 ) { mAnimatedVelocity = 0; } } else { if ( velocity > 0 ) { mAnimatedVelocity = 0; } } } } long now = SystemClock.uptimeMillis(); mAnimationLastTime = now; mCurrentAnimationTime = now + ANIMATION_FRAME_DURATION; mAnimating = true; mHandler.removeMessages( MSG_ANIMATE ); mHandler.sendMessageAtTime( mHandler.obtainMessage( MSG_ANIMATE ), mCurrentAnimationTime ); stopTracking(); } private void prepareTracking( int position ) { mTracking = true; mVelocityTracker = VelocityTracker.obtain(); boolean opening = !mExpanded; if ( opening ) { mAnimatedAcceleration = mMaximumAcceleration; mAnimatedVelocity = mMaximumMajorVelocity; if( mInvert ) mAnimationPosition = mTopOffset; else mAnimationPosition = mBottomOffset + ( mVertical ? getHeight() - mHandleHeight : getWidth() - mHandleWidth ); moveHandle( (int)mAnimationPosition ); mAnimating = true; mHandler.removeMessages( MSG_ANIMATE ); long now = SystemClock.uptimeMillis(); mAnimationLastTime = now; mCurrentAnimationTime = now + ANIMATION_FRAME_DURATION; mAnimating = true; } else { if ( mAnimating ) { mAnimating = false; mHandler.removeMessages( MSG_ANIMATE ); } moveHandle( position ); } } private void moveHandle( int position ) { final View handle = mHandle; if ( mVertical ) { if ( position == EXPANDED_FULL_OPEN ) { if( mInvert ) handle.offsetTopAndBottom( mBottomOffset + getBottom() - getTop() - mHandleHeight ); else handle.offsetTopAndBottom( mTopOffset - handle.getTop() ); invalidate(); } else if ( position == COLLAPSED_FULL_CLOSED ) { if( mInvert ) { handle.offsetTopAndBottom( mTopOffset - handle.getTop() ); } else { handle.offsetTopAndBottom( mBottomOffset + getBottom() - getTop() - mHandleHeight - handle.getTop() ); } invalidate(); } else { final int top = handle.getTop(); int deltaY = position - top; if ( position < mTopOffset ) { deltaY = mTopOffset - top; } else if ( deltaY > mBottomOffset + getBottom() - getTop() - mHandleHeight - top ) { deltaY = mBottomOffset + getBottom() - getTop() - mHandleHeight - top; } handle.offsetTopAndBottom( deltaY ); final Rect frame = mFrame; final Rect region = mInvalidate; handle.getHitRect( frame ); region.set( frame ); region.union( frame.left, frame.top - deltaY, frame.right, frame.bottom - deltaY ); region.union( 0, frame.bottom - deltaY, getWidth(), frame.bottom - deltaY + mContent.getHeight() ); invalidate( region ); } } else { if ( position == EXPANDED_FULL_OPEN ) { if( mInvert ) handle.offsetLeftAndRight( mBottomOffset + getRight() - getLeft() - mHandleWidth ); else handle.offsetLeftAndRight( mTopOffset - handle.getLeft() ); invalidate(); } else if ( position == COLLAPSED_FULL_CLOSED ) { if( mInvert ) handle.offsetLeftAndRight( mTopOffset - handle.getLeft() ); else handle.offsetLeftAndRight( mBottomOffset + getRight() - getLeft() - mHandleWidth - handle.getLeft() ); invalidate(); } else { final int left = handle.getLeft(); int deltaX = position - left; if ( position < mTopOffset ) { deltaX = mTopOffset - left; } else if ( deltaX > mBottomOffset + getRight() - getLeft() - mHandleWidth - left ) { deltaX = mBottomOffset + getRight() - getLeft() - mHandleWidth - left; } handle.offsetLeftAndRight( deltaX ); final Rect frame = mFrame; final Rect region = mInvalidate; handle.getHitRect( frame ); region.set( frame ); region.union( frame.left - deltaX, frame.top, frame.right - deltaX, frame.bottom ); region.union( frame.right - deltaX, 0, frame.right - deltaX + mContent.getWidth(), getHeight() ); invalidate( region ); } } } private void prepareContent() { if ( mAnimating ) { return; } // Something changed in the content, we need to honor the layout request // before creating the cached bitmap final View content = mContent; if ( content.isLayoutRequested() ) { if ( mVertical ) { final int handleHeight = mHandleHeight; int height = getBottom() - getTop() - handleHeight - mTopOffset; content.measure( MeasureSpec.makeMeasureSpec( getRight() - getLeft(), MeasureSpec.EXACTLY ), MeasureSpec.makeMeasureSpec( height, MeasureSpec.EXACTLY ) ); Log.d( LOG_TAG, "content.layout(2)" ); if ( mInvert ) content.layout( 0, mTopOffset, content.getMeasuredWidth(), mTopOffset + content.getMeasuredHeight() ); else content.layout( 0, mTopOffset + handleHeight, content.getMeasuredWidth(), mTopOffset + handleHeight + content.getMeasuredHeight() ); } else { final int handleWidth = mHandle.getWidth(); int width = getRight() - getLeft() - handleWidth - mTopOffset; content.measure( MeasureSpec.makeMeasureSpec( width, MeasureSpec.EXACTLY ), MeasureSpec.makeMeasureSpec( getBottom() - getTop(), MeasureSpec.EXACTLY ) ); if( mInvert ) content.layout( mTopOffset, 0, mTopOffset + content.getMeasuredWidth(), content.getMeasuredHeight() ); else content.layout( handleWidth + mTopOffset, 0, mTopOffset + handleWidth + content.getMeasuredWidth(), content.getMeasuredHeight() ); } } // Try only once... we should really loop but it's not a big deal // if the draw was cancelled, it will only be temporary anyway content.getViewTreeObserver().dispatchOnPreDraw(); content.buildDrawingCache(); content.setVisibility( View.GONE ); } private void stopTracking() { mHandle.setPressed( false ); mTracking = false; if ( mOnDrawerScrollListener != null ) { mOnDrawerScrollListener.onScrollEnded(); } if ( mVelocityTracker != null ) { mVelocityTracker.recycle(); mVelocityTracker = null; } } private void doAnimation() { if ( mAnimating ) { incrementAnimation(); if( mInvert ) { if ( mAnimationPosition < mTopOffset ) { mAnimating = false; closeDrawer(); } else if ( mAnimationPosition >= mTopOffset + ( mVertical ? getHeight() : getWidth() ) - 1 ) { mAnimating = false; openDrawer(); } else { moveHandle( (int)mAnimationPosition ); mCurrentAnimationTime += ANIMATION_FRAME_DURATION; mHandler.sendMessageAtTime( mHandler.obtainMessage( MSG_ANIMATE ), mCurrentAnimationTime ); } } else { if ( mAnimationPosition >= mBottomOffset + ( mVertical ? getHeight() : getWidth() ) - 1 ) { mAnimating = false; closeDrawer(); } else if ( mAnimationPosition < mTopOffset ) { mAnimating = false; openDrawer(); } else { moveHandle( (int)mAnimationPosition ); mCurrentAnimationTime += ANIMATION_FRAME_DURATION; mHandler.sendMessageAtTime( mHandler.obtainMessage( MSG_ANIMATE ), mCurrentAnimationTime ); } } } } private void incrementAnimation() { long now = SystemClock.uptimeMillis(); float t = ( now - mAnimationLastTime ) / 1000.0f; // ms -> s final float position = mAnimationPosition; final float v = mAnimatedVelocity; // px/s final float a = mInvert ? mAnimatedAcceleration : mAnimatedAcceleration; // px/s/s mAnimationPosition = position + ( v * t ) + ( 0.5f * a * t * t ); // px mAnimatedVelocity = v + ( a * t ); // px/s mAnimationLastTime = now; // ms } /** * Toggles the drawer open and close. Takes effect immediately. * * @see #open() * @see #close() * @see #animateClose() * @see #animateOpen() * @see #animateToggle() */ public void toggle() { if ( !mExpanded ) { openDrawer(); } else { closeDrawer(); } invalidate(); requestLayout(); } /** * Toggles the drawer open and close with an animation. * * @see #open() * @see #close() * @see #animateClose() * @see #animateOpen() * @see #toggle() */ public void animateToggle() { if ( !mExpanded ) { animateOpen(); } else { animateClose(); } } /** * Opens the drawer immediately. * * @see #toggle() * @see #close() * @see #animateOpen() */ public void open() { openDrawer(); invalidate(); requestLayout(); sendAccessibilityEvent( AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED ); } /** * Closes the drawer immediately. * * @see #toggle() * @see #open() * @see #animateClose() */ public void close() { closeDrawer(); invalidate(); requestLayout(); } /** * Closes the drawer with an animation. * * @see #close() * @see #open() * @see #animateOpen() * @see #animateToggle() * @see #toggle() */ public void animateClose() { prepareContent(); final OnDrawerScrollListener scrollListener = mOnDrawerScrollListener; if ( scrollListener != null ) { scrollListener.onScrollStarted(); } animateClose( mVertical ? mHandle.getTop() : mHandle.getLeft() ); if ( scrollListener != null ) { scrollListener.onScrollEnded(); } } /** * Opens the drawer with an animation. * * @see #close() * @see #open() * @see #animateClose() * @see #animateToggle() * @see #toggle() */ public void animateOpen() { prepareContent(); final OnDrawerScrollListener scrollListener = mOnDrawerScrollListener; if ( scrollListener != null ) { scrollListener.onScrollStarted(); } animateOpen( mVertical ? mHandle.getTop() : mHandle.getLeft() ); sendAccessibilityEvent( AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED ); if ( scrollListener != null ) { scrollListener.onScrollEnded(); } } private void closeDrawer() { moveHandle( COLLAPSED_FULL_CLOSED ); mContent.setVisibility( View.GONE ); mContent.destroyDrawingCache(); if ( !mExpanded ) { return; } mExpanded = false; if ( mOnDrawerCloseListener != null ) { mOnDrawerCloseListener.onDrawerClosed(); } } private void openDrawer() { moveHandle( EXPANDED_FULL_OPEN ); mContent.setVisibility( View.VISIBLE ); if ( mExpanded ) { return; } mExpanded = true; if ( mOnDrawerOpenListener != null ) { mOnDrawerOpenListener.onDrawerOpened(); } } /** * Sets the listener that receives a notification when the drawer becomes * open. * * @param onDrawerOpenListener * The listener to be notified when the drawer is opened. */ public void setOnDrawerOpenListener( OnDrawerOpenListener onDrawerOpenListener ) { mOnDrawerOpenListener = onDrawerOpenListener; } /** * Sets the listener that receives a notification when the drawer becomes * close. * * @param onDrawerCloseListener * The listener to be notified when the drawer is closed. */ public void setOnDrawerCloseListener( OnDrawerCloseListener onDrawerCloseListener ) { mOnDrawerCloseListener = onDrawerCloseListener; } /** * Sets the listener that receives a notification when the drawer starts or * ends a scroll. A fling is considered as a scroll. A fling will also * trigger a drawer opened or drawer closed event. * * @param onDrawerScrollListener * The listener to be notified when scrolling starts or stops. */ public void setOnDrawerScrollListener( OnDrawerScrollListener onDrawerScrollListener ) { mOnDrawerScrollListener = onDrawerScrollListener; } /** * Returns the handle of the drawer. * * @return The View reprenseting the handle of the drawer, identified by the * "handle" id in XML. */ public View getHandle() { return mHandle; } /** * Returns the content of the drawer. * * @return The View reprenseting the content of the drawer, identified by the * "content" id in XML. */ public View getContent() { return mContent; } /** * Unlocks the SlidingDrawer so that touch events are processed. * * @see #lock() */ public void unlock() { mLocked = false; } /** * Locks the SlidingDrawer so that touch events are ignores. * * @see #unlock() */ public void lock() { mLocked = true; } /** * Indicates whether the drawer is currently fully opened. * * @return True if the drawer is opened, false otherwise. */ public boolean isOpened() { return mExpanded; } /** * Indicates whether the drawer is scrolling or flinging. * * @return True if the drawer is scroller or flinging, false otherwise. */ public boolean isMoving() { return mTracking || mAnimating; } private class DrawerToggler implements OnClickListener { public void onClick( View v ) { if ( mLocked ) { return; } // mAllowSingleTap isn't relevant here; you're *always* // allowed to open/close the drawer by clicking with the // trackball. if ( mAnimateOnClick ) { animateToggle(); } else { toggle(); } } } private class SlidingHandler extends Handler { public void handleMessage( Message m ) { switch ( m.what ) { case MSG_ANIMATE: doAnimation(); break; } } } }
817fa5e1c9b1c44a28da35ff9ced09f794a0d816
3963442753532e3fc2b7b45274ebd9c8605cb9cb
/src/main/java/com/xy1m/JsonFactoryFeatures.java
36451c533673d28e589fb86426106c9946d8791e
[ "MIT" ]
permissive
xy1m/jackson-practice
a0a2e59416b514cedd61bf89acf57cc4afaf6113
80e8ae83d003a65d67102334c10ba8a82934917a
refs/heads/master
2022-12-02T16:06:36.757730
2020-04-29T21:21:03
2020-04-29T21:21:03
136,666,815
1
0
MIT
2022-11-16T10:25:50
2018-06-08T21:16:26
Java
UTF-8
Java
false
false
151
java
package com.xy1m; /** * Created by gzhenpeng on 6/4/18 */ public class JsonFactoryFeatures { public static void main(String... args) { } }
c40339c6b50f0181e9db7a25f77be6dde810c19e
7614d3f22eb45e2b7439db91f03b001a256b2c95
/MultiMediaRoom/src/com/multimedia/room/media/VideoPlayerManager.java
eda4057481cf4c89261e6155268d6ef5ea936cd5
[]
no_license
tigerjiang/mmclass
fe25112a07744e54c8ca27604b24032953e0323a
8fb94b0fb67596c5521e4741af359f9caef43d3a
refs/heads/master
2016-08-05T08:59:01.351086
2015-08-26T03:35:59
2015-08-26T03:35:59
41,402,465
0
0
null
null
null
null
UTF-8
Java
false
false
19,277
java
/* * Copyright 2013 - Jamdeo */ package com.multimedia.room.media; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.AsyncTask; import android.os.Handler; import android.os.Message; import android.util.Log; import android.view.SurfaceHolder; import android.widget.Toast; import com.multimedia.room.FilesEntity; import com.multimedia.room.SystemWriter; import java.io.IOException; import java.lang.ref.WeakReference; import java.util.HashMap; import java.util.List; /** * The class VideoPlayerManager provide a interface to play the live TV program. */ public class VideoPlayerManager implements MediaPlayer.OnCompletionListener, MediaPlayer.OnErrorListener, MediaPlayer.OnInfoListener, MediaPlayer.OnPreparedListener, MediaPlayer.OnVideoSizeChangedListener { private static String TAG = VideoPlayerManager.class.getSimpleName(); private static boolean DEBUG = true; private WeakReference<Context> mContextRef; private String mPath; // current channel number private SurfaceHolder mSurfaceHolder; private MediaPlayer mMediaPlayer = null; private static int PLAYER_START_TIMEOUT = 10000; // all possible internal states private static final int STATE_ERROR = -1; private static final int STATE_IDLE = 0; private static final int STATE_PREPARING = 1; private static final int STATE_PREPARED = 2; private static final int STATE_PLAYING = 3; private static final int STATE_PAUSED = 4; private static final int STATE_PLAYBACK_COMPLETED = 5; private int mCurrentState = STATE_IDLE; private boolean mIsInternetConnected = false; private ConnectivityManager mConnectivityManager; private final NetworkReceiver mNetworkReceiver = new NetworkReceiver(); private boolean mNetworkReceiverRegistered = false; private boolean mIsPlayerPrepared = false; private Handler mHandler; // Buffer time private static final int BUFFER_WAITING_TIME = 800; private static final int MEDIA_PLAYER_READY_DELAY = 5000; private boolean mIsFirstError = false; private int mFirstErrorIndex = 0; private int mCurrentIndex; private List<FilesEntity> mFileList; public static SystemWriter mSystemWriter; /** * Interface definition of a callback to be invoked to communicate some * states of playback and Network. */ public interface onStateListener { /** * Called to indicate an error. * * @param what the type of error that has occurred: * @param extra an extra code, specific to the error. Typically * implementation dependent. * @return True if the method handled the error, false if it didn't. * Returning false, or not having an OnErrorListener at all, * will cause the OnCompletionListener to be called. */ boolean onError(int what, int extra); /** * Called to indicate an info or a warning. * * @param what the type of info or warning. * @param extra an extra code, specific to the info. Typically * implementation dependent. * @return True if the method handled the info, false if it didn't. * Returning false, or not having an OnErrorListener at all, * will cause the info to be discarded. */ boolean onInfo(int what, int extra); /** * Called to indicate an state of network. * * @param connected the network connected or not */ void onNetworkConnected(boolean connected); } /** * Register a callback to be invoked when an state of MediaPlayer or Network * has happened during an asynchronous operation. * * @param listener the callback that will be run */ public void setOnStateListener(onStateListener listener) { mOnStateListener = listener; } private onStateListener mOnStateListener; // singleton instance holder private static class SingletonHolder { public static VideoPlayerManager instance = new VideoPlayerManager(); } public static VideoPlayerManager getInstance(Context context) { if (context != null && SingletonHolder.instance.mContextRef == null) { SingletonHolder.instance.mContextRef = new WeakReference<Context>( context.getApplicationContext()); SingletonHolder.instance.init(); mSystemWriter = new SystemWriter(context); } return SingletonHolder.instance; } private Context getContext() { if (mContextRef != null) { return mContextRef.get(); } return null; } private void init() { mConnectivityManager = (ConnectivityManager) getContext() .getSystemService(Context.CONNECTIVITY_SERVICE); mHandler = new NotifyBufferHandler(); registerNetworkReceiver(); } /** * Sets the SurfaceHolder to use for displaying the video portion of the * media. * * @param sh the SurfaceHolder to use for video display */ public void setDisplay(SurfaceHolder sh) { this.mSurfaceHolder = sh; } /** * Change the SurfaceHolder to display the video in a different surface * view. * * @param sh the SurfaceHolder to use for video display */ public void changeDisplay(SurfaceHolder sh) { if (DEBUG) Log.d(TAG, "change surface holder " + sh); if (sh != null) { mSurfaceHolder = sh; } if (mMediaPlayer != null) { mMediaPlayer.setDisplay(mSurfaceHolder); } } public void setCurrentIndex(int index) { mCurrentIndex = index; } /** * Get current source index * * @return source index */ public int getCurrentSourceIndex() { return mCurrentIndex; } /** * Sets the data source (file-path or http/rtsp URL) to use. * * @param channelNumber the current channel numuber. * @param path the path of the file, or the http/rtsp URL of the stream you * want to play * @param force the boolean flag to set path by force */ public void setDataSource(String path, boolean force) { mIsPlayerPrepared = false; mPath = path; if (path == null || path.isEmpty()) { Log.w(TAG, "set data source path is illegal"); return; } if (!force && mPath != null && mPath.equals(path)) { Log.i(TAG, "set data source same path"); return; } Log.d(TAG, "path " + mPath); // release media player at first if (mMediaPlayer != null) { releasePlayer(); } // create new player new CreatePlayerTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } /** * Pause the playing. */ public void pause() { if (mMediaPlayer != null) { mMediaPlayer.pause(); mCurrentState = STATE_PAUSED; } } /** * Pause the playing. */ public void play() { Log.d(TAG, "--------------play"); if (mMediaPlayer != null) { mMediaPlayer.start(); mCurrentState = STATE_PAUSED; } } /** * Start to play. */ public void start() { Log.d(TAG, "-----------------start"); if (mMediaPlayer != null) { mMediaPlayer.start(); mCurrentState = STATE_PLAYING; } } /** * Seek to play. */ public void seekTo(int progress) { if (mMediaPlayer != null) { mMediaPlayer.seekTo(progress); } } /** * Stop to play. */ public void stop() { if (mMediaPlayer != null) { mMediaPlayer.stop(); } } public int getCurrentPos() { int currentPos = 0; if (mMediaPlayer != null) { currentPos = mMediaPlayer.getCurrentPosition(); } return currentPos; } public int getDuration() { int duration = 0; if (mMediaPlayer != null) { duration = mMediaPlayer.getDuration(); } return duration; } public void setFileList(List<FilesEntity> files) { mFileList = files; } public void next() { Log.d(TAG, "current " + mCurrentIndex + " " + mPath); if (mCurrentIndex == mFileList.size()) { return ; // mCurrentIndex = 0; } else { mCurrentIndex++; } try { mPath = mFileList.get(mCurrentIndex).getUrl(); setDataSource(mPath, true); mIUpdateUIListenner.update(mFileList.get(mCurrentIndex),mCurrentIndex); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } Log.d(TAG, "next " + mCurrentIndex + " " + mPath); } public void previous() { Log.d(TAG, "current " + mCurrentIndex + " " + mPath); if (mCurrentIndex == 0) { return ; // mCurrentIndex = mFileList.size(); } else { mCurrentIndex--; } Log.d(TAG, "index"+mCurrentIndex); try { mPath = mFileList.get(mCurrentIndex).getUrl(); setDataSource(mPath, true); mIUpdateUIListenner.update(mFileList.get(mCurrentIndex),mCurrentIndex); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } Log.d(TAG, "previous " + mCurrentIndex + " " + mPath); } /** * Checks whether the MediaPlayer is playing. * * @return true if currently playing, false otherwise */ public boolean isPlaying() { if (mMediaPlayer != null) { return mMediaPlayer.isPlaying(); } Log.w(TAG, "isPlaying - MediaPlayer is not initialized"); return false; } /** * Release the resource of TV player. */ public void release() { releasePlayer(); unregisterNetworkReceiver(); mContextRef = null; } /** * Release player */ public void releasePlayer() { Log.d(TAG, "---------releasePlayer"); mHandler.removeCallbacksAndMessages(null); if (DEBUG) Log.d(TAG, "release player"); if (mMediaPlayer != null) { mMediaPlayer.reset(); mMediaPlayer.release(); mMediaPlayer = null; } mSystemWriter.disableScaler(); } private class NetworkReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (DEBUG) Log.d(TAG, "NetworkReceiver.onReceive: " + intent); if (checkNetworkAvailable()) { // when the network reconnect , Then restart the play if (mMediaPlayer != null) { releasePlayer(); } if (mPath == null || mPath.isEmpty()) { Log.w(TAG, "set data source path is illegal"); return; } new CreatePlayerTask() .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else { Log.i(TAG, "NetworkReceiver network is disconnect"); releasePlayer(); } } } private void registerNetworkReceiver() { if (!mNetworkReceiverRegistered) { // we only care about the network connect state change IntentFilter filter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION); getContext().registerReceiver(mNetworkReceiver, filter); mNetworkReceiverRegistered = true; } } private void unregisterNetworkReceiver() { if (mNetworkReceiverRegistered) { getContext().unregisterReceiver(mNetworkReceiver); mNetworkReceiverRegistered = false; } } private void registerListener(MediaPlayer player) { player.setOnCompletionListener(this); player.setOnErrorListener(this); player.setOnInfoListener(this); player.setOnPreparedListener(this); } private void prepareMediaPlayer(MediaPlayer emp) { mSystemWriter.enableScaler(); try { emp.setLooping(false); registerListener(emp); // mCurrentSourceIndex = mCurrentSourceIndex % mAllPlayerUrl.length; // // Avoid array index out of bounds // emp.setDataSource(mAllPlayerUrl[mCurrentSourceIndex]); emp.setDataSource(mPath); emp.setAudioStreamType(AudioManager.STREAM_MUSIC); emp.setDisplay(mSurfaceHolder); emp.prepareAsync(); /* * Everything seems OK. Now notify the user that we are ready. */ handleStartPlayerPop(); mCurrentState = STATE_PREPARING; } catch (IOException exception) { Log.e(TAG, "prepare player ioexception" + exception); } catch (IllegalArgumentException exception) { Log.e(TAG, "prepare player argument is illegal" + exception); } catch (SecurityException exception) { Log.e(TAG, "prepare player security exception" + exception); } catch (IllegalStateException exception) { Log.e(TAG, "prepare player state is illegal" + exception); } } private class PrepareMediaPlayerThread extends Thread { private final MediaPlayer mMediaPlayer; private PrepareMediaPlayerThread(MediaPlayer player) { this.mMediaPlayer = player; } @Override public void run() { prepareMediaPlayer(mMediaPlayer); } } private class CreatePlayerTask extends AsyncTask<Void, Void, Boolean> { @Override protected Boolean doInBackground(Void... arg0) { return true; } @Override protected void onPostExecute(Boolean result) { if (!result) { Log.w(TAG, "Unable to acquire video decoder"); // Try to start playback anyway } if (mMediaPlayer == null) { mMediaPlayer = new MediaPlayer(); mCurrentState = STATE_IDLE; } new PrepareMediaPlayerThread(mMediaPlayer).start(); } } @Override public void onPrepared(MediaPlayer mp) { Log.d(TAG, "MediaPlayer onPrepared"); mCurrentState = STATE_PREPARED; mMediaPlayer.start(); mCurrentState = STATE_PLAYING; mIsPlayerPrepared = true; } /** * Notify the loading state when the time more than 1s that the time between * start buffer and filling buffer */ @Override public boolean onInfo(MediaPlayer mp, int what, int extra) { mHandler.removeMessages(MEDIA_PLAYER_READY); if (mIsInternetConnected && mOnStateListener != null) { mOnStateListener.onInfo(what, extra); } if (DEBUG) Log.d(TAG, "MediaPlayer onInffo " + what); return true; } @Override public boolean onError(MediaPlayer mp, int what, int extra) { if ( mOnStateListener != null) { mOnStateListener.onError(what, extra); } if (DEBUG) Log.d(TAG, "MediaPlayer onError " + what); mCurrentState = STATE_ERROR; return true; } @Override public void onCompletion(MediaPlayer mp) { if (DEBUG) Log.d(TAG, "MediaPlayer onCompletion"); mCurrentState = STATE_PLAYBACK_COMPLETED; // next(); } @Override public void onVideoSizeChanged(MediaPlayer mp, int width, int height) { if (DEBUG) Log.d(TAG, "Video size changed to " + width + "x" + height); int videoWidth = mp.getVideoWidth(); int videoHeight = mp.getVideoHeight(); if (videoWidth != 0 && videoHeight != 0) { mSurfaceHolder.setFixedSize(videoWidth, videoHeight); } } /** * Check the internet state and notify the state. * * @return true if network available. */ public boolean checkNetworkAvailable() { NetworkInfo networkInfo = mConnectivityManager.getActiveNetworkInfo(); if (networkInfo != null) { if (DEBUG) { Log.d(TAG, "network status connected: " + networkInfo.isConnected()); } mIsInternetConnected = networkInfo.isConnected(); } else { // the active network info null, then it's disconnected if (DEBUG) { Log.d(TAG, "network status: disconnected"); } mIsInternetConnected = false; } if (mOnStateListener != null) mOnStateListener.onNetworkConnected(mIsInternetConnected); return mIsInternetConnected; } // Sometimes the media player doesn't invoke onPrepared() long time. If so // alert a loading message. private void handleStartPlayerPop() { Message msg = mHandler.obtainMessage(MEDIA_PLAYER_READY); mHandler.sendMessageDelayed(msg, MEDIA_PLAYER_READY_DELAY); } private static boolean sIsLoading = false; private static final int MEDIA_PLAYER_READY = 0; private class NotifyBufferHandler extends Handler { public void handleMessage(Message msg) { switch (msg.what) { case MEDIA_PLAYER_READY: break; case MediaPlayer.MEDIA_INFO_BUFFERING_START: sIsLoading = true; break; case MediaPlayer.MEDIA_INFO_BUFFERING_END: break; } if (mIsInternetConnected && mOnStateListener != null) { mOnStateListener.onInfo(msg.what, mCurrentIndex + 1); } } } public IUpdateUIListenner mIUpdateUIListenner; public void setUpdateUIListenner(IUpdateUIListenner l) { mIUpdateUIListenner = l; } public static interface IUpdateUIListenner { public void update(FilesEntity filesEntity,int index); } }
7179886a5300983f73bb949d4c967ee3e6b39663
bc5ca4b04b9d938fc6b1b929765612d13141d3eb
/AndroidStudioProjects/Mot22/app/src/androidTest/java/com/example/omnicns/mot22/ApplicationTest.java
2b45d03855eb01c484727ae49be776d82a9da6cb
[]
no_license
lees28/motion
a2dfe740259ade8ae5e2e3c40d3330928a9f97c7
3775d153a685059795f73fa7561ace9251b8d61a
refs/heads/master
2020-04-06T03:37:00.791284
2016-07-29T07:26:20
2016-07-29T07:26:20
64,456,896
0
0
null
null
null
null
UTF-8
Java
false
false
356
java
package com.example.omnicns.mot22; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
df85557d8192e317df62929afc3f54d523c8ed80
a0b57351680d941a90c75cb6b0c2f03f59c642bf
/science-parent/science-service/src/main/java/com/sxj/science/service/ICountReportService.java
7df45c1dfaa3fd3b049b4e47efbb3a73f942ad0a
[]
no_license
redtroy/sxj-src
e9ef178232f7c8dd7fd2626a759a716219e44c1e
78dda0d908eade85a537afc520d98aee50a389cc
refs/heads/master
2021-01-22T04:40:37.510022
2015-12-16T05:50:44
2015-12-16T05:50:44
23,170,714
2
5
null
null
null
null
UTF-8
Java
false
false
453
java
package com.sxj.science.service; import java.util.List; import com.sxj.science.DocReportModel; import com.sxj.science.model.PartsModel; import com.sxj.science.model.ProductModel; public interface ICountReportService { public List<ProductModel> getProductReport(List<String> itemIds); public List<PartsModel> getPartsReport(List<String> temList); public List<DocReportModel> getDocReport(List<String> temList); }
fb38fa6e69eb650145d963b8c8df946cadec371c
e6d12b1e2f13d1031a519a82be7aabf4bc18eef2
/GameThis/src/br/com/recidev/gamethis/util/SincronizacaoReceiver.java
242479287cf4476d4bc9debd0708a8ae101b8c21
[]
no_license
Recidev/gamethis
1f96900d5bf43c152ae92ed8aa82ec794f2f6859
9f9712b94e631156b3cd61ab7aa09b394d0fa149
refs/heads/master
2021-01-01T17:31:42.313404
2015-07-17T02:44:46
2015-07-17T02:44:46
35,511,036
0
0
null
null
null
null
ISO-8859-1
Java
false
false
1,472
java
package br.com.recidev.gamethis.util; import java.util.ArrayList; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import br.com.recidev.gamethis.dominio.Jogo; import br.com.recidev.gamethis.repositorio.RepositorioJogoSQLite; import com.google.gson.Gson; public class SincronizacaoReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { RepositorioJogoSQLite repJogo = new RepositorioJogoSQLite(); //Atualiza dados do SQLite para o banco remoto String path = ConstantesGameThis.PATH_SYNC_JOGO; ArrayList<Jogo> jogosNaoAtualizados = new ArrayList<Jogo>(); jogosNaoAtualizados = repJogo.consultarJogosNaoAtualizados(context); Gson gson = new Gson(); String convertedJsonJogos = gson.toJson(jogosNaoAtualizados); String jsonFinal = "{\"jogos\":" + convertedJsonJogos +"}"; Intent sincService = new Intent(context, SincronizacaoService.class); sincService.putExtra("path", path); sincService.putExtra("json", jsonFinal); context.startService(sincService); //Atualiza dados do banco remoto para o SQLite boolean existeDadosParaAtualizar = false; if(existeDadosParaAtualizar){ sincService = new Intent(context, SincronizacaoService.class); sincService.putExtra("titulo", "Sincronização de Jogos"); sincService.putExtra("conteudo", "Jogo X foi atualizado"); context.startService(sincService); } } }
fd17dd753d6b0ce72677107a535b6549fae1369b
b37900e078678eefc77d74f4feab58235d46b884
/BorgataJavaFx/src/main/java/poker/app/view/PokerTableController.java
f0bd8553c21b95cec3ec1bc49d277e5f027d4e71
[]
no_license
Jsamaha1/Lab5_Correct
1173cf3fd507cf32aa2fc0554a5f8631bf7dfd24
c2d55041009fc9e0f4290ccbdb9951d80f6084e5
refs/heads/master
2016-08-12T19:48:11.817267
2015-11-21T02:53:12
2015-11-21T02:53:12
46,598,342
0
0
null
null
null
null
UTF-8
Java
false
false
16,376
java
package poker.app.view; import java.util.ArrayList; import java.util.HashMap; import java.util.Random; import java.util.UUID; import org.apache.commons.math3.util.Combinations; import com.sun.xml.internal.ws.policy.privateutil.PolicyUtils.Collections; import enums.eGame; import javafx.animation.FadeTransition; import javafx.animation.ParallelTransition; import javafx.animation.RotateTransition; import javafx.animation.SequentialTransition; import javafx.animation.SequentialTransitionBuilder; import javafx.animation.TranslateTransition; import javafx.beans.property.DoubleProperty; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.fxml.FXML; import javafx.geometry.Bounds; import javafx.geometry.Point2D; import javafx.scene.control.Alert; import javafx.scene.control.Alert.AlertType; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.TextField; import javafx.scene.control.ToggleButton; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.HBox; import javafx.scene.shape.Circle; import javafx.util.Duration; import poker.app.MainApp; import pokerBase.Card; import pokerBase.Deck; import pokerBase.GamePlay; import pokerBase.GamePlayPlayerHand; import pokerBase.Hand; import pokerBase.Player; import pokerBase.Rule; import pokerBase.Action; import pokerEnums.eDrawAction; public class PokerTableController { //Determines gameToPlay, gets value from the radio buttons // See RootLayoutController.Java for implementation public static int gameToPlay; boolean bPlay = false; boolean bP1Sit = false; boolean bP2Sit = false; boolean bP3Sit = false; boolean bP4Sit = false; // Reference to the main application. private MainApp mainApp; private GamePlay gme = null; private int iCardDrawn = 0; private int iCardDrawnPlayer = 0; private int iCardDrawnCommon = 0; private Player PlayerCommon = new Player("Common", 0); @FXML public AnchorPane APMainScreen; private ImageView imgTransCardP1 = new ImageView(); private ImageView imgTransCardP2 = new ImageView(); private ImageView imgTransCardP3 = new ImageView(); private ImageView imgTransCardP4 = new ImageView(); private ImageView imgTransCardCommon = new ImageView(); @FXML public HBox HboxCommonArea; @FXML public HBox HboxCommunityCards; @FXML public HBox hBoxP1Cards; @FXML public HBox hBoxP2Cards; @FXML public HBox hBoxP3Cards; @FXML public HBox hBoxP4Cards; @FXML public TextField txtP1Name; @FXML public TextField txtP2Name; @FXML public TextField txtP3Name; @FXML public TextField txtP4Name; @FXML public Label lblP1Name; @FXML public Label lblP2Name; @FXML public Label lblP3Name; @FXML public Label lblP4Name; @FXML public ToggleButton btnP1SitLeave; @FXML public ToggleButton btnP2SitLeave; @FXML public ToggleButton btnP3SitLeave; @FXML public ToggleButton btnP4SitLeave; @FXML public Button btnDraw; @FXML public Button btnPlay; public PokerTableController() { } /** * Initializes the controller class. This method is automatically called * after the fxml file has been loaded. */ @FXML private void initialize() { } /** * Is called by the main application to give a reference back to itself. * * @param mainApp */ public void setMainApp(MainApp mainApp) { this.mainApp = mainApp; } @FXML private void handleP1SitLeave() { int iPlayerPosition = 1; btnP1SitLeave.setDisable(true); bP1Sit = handleSitLeave(bP1Sit, iPlayerPosition, lblP1Name, txtP1Name, btnP1SitLeave); btnP1SitLeave.setDisable(false); } @FXML private void handleP2SitLeave() { int iPlayerPosition = 2; btnP2SitLeave.setDisable(true); bP2Sit = handleSitLeave(bP2Sit, iPlayerPosition, lblP2Name, txtP2Name, btnP2SitLeave); btnP2SitLeave.setDisable(false); } @FXML private void handleP3SitLeave() { int iPlayerPosition = 3; btnP3SitLeave.setDisable(true); bP3Sit =handleSitLeave(bP3Sit, iPlayerPosition, lblP3Name, txtP3Name, btnP3SitLeave); btnP3SitLeave.setDisable(false); } @FXML private void handleP4SitLeave() { int iPlayerPosition = 4; btnP4SitLeave.setDisable(true); bP4Sit = handleSitLeave(bP4Sit, iPlayerPosition, lblP4Name, txtP4Name, btnP4SitLeave); btnP4SitLeave.setDisable(false); } private boolean handleSitLeave(boolean bSit, int iPlayerPosition, Label lblPlayer, TextField txtPlayer, ToggleButton btnSitLeave) { if (bSit == false) { Player p = new Player(txtPlayer.getText(), iPlayerPosition); mainApp.AddPlayerToTable(p); lblPlayer.setText(txtPlayer.getText()); lblPlayer.setVisible(true); btnSitLeave.setText("Leave"); txtPlayer.setVisible(false); bSit = true; } else { mainApp.RemovePlayerFromTable(iPlayerPosition); btnSitLeave.setText("Sit"); txtPlayer.setVisible(true); lblPlayer.setVisible(false); bSit = false; } return bSit; } @FXML private void handlePlay() { // Determine what game is selected //gameToPlay = RootLayoutController.gameSelected(); // Clear all players hands hBoxP1Cards.getChildren().clear(); hBoxP2Cards.getChildren().clear(); hBoxP3Cards.getChildren().clear(); hBoxP4Cards.getChildren().clear(); ImageView imgBottomCard = new ImageView( new Image(getClass().getResourceAsStream("/res/img/b1fh.png"), 75, 75, true, true)); HboxCommonArea.getChildren().clear(); HboxCommonArea.getChildren().add(imgBottomCard); HboxCommunityCards.getChildren().clear(); // Initialize the rule variable Rule rle = null; // Switch statement determining game type, defaults to FiveStud // Gets the value from radio button FXML methods at the bottom of RootLayoutController.Java switch(gameToPlay) { case 1: rle = new Rule(eGame.TexasHoldEm); gme = new GamePlay(rle); break; case 2: rle = new Rule(eGame.Omaha); gme = new GamePlay(rle); break; case 3: rle = new Rule(eGame.FiveStud); gme = new GamePlay(rle); break; case 4: rle = new Rule(eGame.FiveStudOneJoker); gme = new GamePlay(rle); break; case 5: rle = new Rule(eGame.FiveStudTwoJoker); gme = new GamePlay(rle); break; case 6: rle = new Rule(eGame.SevenDraw); gme = new GamePlay(rle); break; default: rle = new Rule(eGame.FiveStud); gme = new GamePlay(rle); break; } // Add the seated players to the game for (Player p : mainApp.GetSeatedPlayers()) { gme.addPlayerToGame(p); GamePlayPlayerHand GPPH = new GamePlayPlayerHand(); GPPH.setGame(gme); GPPH.setPlayer(p); GPPH.setHand(new Hand()); gme.addGamePlayPlayerHand(GPPH); DealFaceDownCards(gme.getNbrOfCards(), p.getiPlayerPosition()); } GamePlayPlayerHand GPCH = new GamePlayPlayerHand(); GPCH.setGame(gme); GPCH.setPlayer(PlayerCommon); GPCH.setHand(new Hand()); gme.addGamePlayCommonHand(GPCH); DealFaceDownCards(gme.getRule().GetCommunityCardsCount(), 0); // Add a deck to the game gme.setGameDeck(new Deck(rle.GetNumberOfJokers(), rle.GetRuleCards())); btnDraw.setVisible(true); btnDraw.setDisable(false); btnPlay.setVisible(false); iCardDrawn = 0; iCardDrawnPlayer = 0; iCardDrawnCommon = 0; } public void DealFaceDownCards(int nbrOfCards, int iPlayerPosition) { HBox PlayerCardBox = null; switch (iPlayerPosition) { case 0: PlayerCardBox = HboxCommunityCards; break; case 1: PlayerCardBox = hBoxP1Cards; break; case 2: PlayerCardBox = hBoxP2Cards; break; case 3: PlayerCardBox = hBoxP3Cards; break; case 4: PlayerCardBox = hBoxP4Cards; break; } String strCard = "/res/img/b1fv.png"; for (int i = 0; i < nbrOfCards; i++) { ImageView img = new ImageView(new Image(getClass().getResourceAsStream(strCard), 75, 75, true, true)); PlayerCardBox.getChildren().add(img); } } @FXML private void handleDraw() { iCardDrawn++; ImageView imView = null; // Disable the button in case of double-click btnDraw.setDisable(true); // Create the parent transition SequentialTransition tranDealCards = new SequentialTransition(); // Figure the action based on the game, state of game Action act = new Action(gme, iCardDrawn); if (act.geteDrawAction() == eDrawAction.DrawPlayer) { iCardDrawnPlayer++; // Draw a card for each player seated for (Player p : mainApp.GetSeatedPlayers()) { Card c = gme.getGameDeck().drawFromDeck(); HBox PlayerCardBox = null; switch (p.getiPlayerPosition()) { case 1: PlayerCardBox = hBoxP1Cards; imView = imgTransCardP1; break; case 2: PlayerCardBox = hBoxP2Cards; imView = imgTransCardP2; break; case 3: PlayerCardBox = hBoxP3Cards; imView = imgTransCardP3; break; case 4: PlayerCardBox = hBoxP4Cards; imView = imgTransCardP4; break; } GamePlayPlayerHand GPPH = gme.FindPlayerGame(gme, p); GPPH.addCardToHand(c); tranDealCards.getChildren().add(CalculateTransition(c, PlayerCardBox, imView, iCardDrawnPlayer)); //tranDealCards.getChildren().add(FadeOutTransition(imView)); } } else if (act.geteDrawAction() == eDrawAction.DrawCommon) { iCardDrawnCommon++; imView = imgTransCardCommon; Card c = gme.getGameDeck().drawFromDeck(); GamePlayPlayerHand GPCH = gme.FindCommonHand(gme); GPCH.addCardToHand(c); tranDealCards.getChildren().add(CalculateTransition(c, HboxCommunityCards, imView, iCardDrawnCommon)); //tranDealCards.getChildren().add(FadeOutTransition(imView)); } tranDealCards.play(); // If bEvalHand is true, it's time to evaluate the Hand... if (act.isbEvaluateHand()) { ArrayList<GamePlayPlayerHand> AllPlayersHands = new ArrayList<GamePlayPlayerHand>(); ArrayList<Hand> BestPlayerHands = new ArrayList<Hand>(); HashMap hsPlayerHand = new HashMap(); for (Player p : mainApp.GetSeatedPlayers()) { GamePlayPlayerHand GPPH = gme.FindPlayerGame(gme, p); Hand PlayerHand = GPPH.getHand(); GamePlayPlayerHand GPCH = gme.FindCommonHand(gme); ArrayList<Hand> AllHands = Hand.ListHands(GPPH.getHand(), GPCH.getHand(), GPPH.getGame() ); Hand hBestHand = Hand.PickBestHand(AllHands); GPPH.setBestHand(hBestHand); hsPlayerHand.put(hBestHand, GPPH.getPlayer()); BestPlayerHands.add(hBestHand); } Hand WinningHand = Hand.PickBestHand(BestPlayerHands); Player WinningPlayer = (Player)hsPlayerHand.get(WinningHand); String winnerName = ""; switch(WinningPlayer.getiPlayerPosition()) { case 1: winnerName = this.txtP1Name.getText(); break; case 2: winnerName = this.txtP2Name.getText(); break; case 3: winnerName = this.txtP3Name.getText(); break; case 4: winnerName = this.txtP4Name.getText(); } Alert winner = new Alert(AlertType.INFORMATION); winner.setTitle("Result of Game"); winner.setHeaderText("Winning Player was: " + winnerName); winner.setContentText("Congratulations! You won the game! Your score was: " + WinningHand.getHandStrength()); winner.showAndWait(); System.out.println("Winning Player Position: " + WinningPlayer.getiPlayerPosition()); btnDraw.setVisible(false); btnPlay.setVisible(true); } else { // Re-enable the draw button btnDraw.setDisable(false); } } private SequentialTransition CalculateTransition(Card c, HBox PlayerCardBox, ImageView imView, int iCardDrawn) { // This is the card that is going to be dealt to the player. String strCard = "/res/img/" + c.getCardImg(); ImageView imgvCardDealt = new ImageView(new Image(getClass().getResourceAsStream(strCard), 96, 71, true, true)); // imgvCardFaceDown - There's already a place holder card // sitting in // the player's hbox. It's face down. Find it // and then determine it's bounds and top left hand handle. ImageView imgvCardFaceDown = (ImageView) PlayerCardBox.getChildren().get(iCardDrawn - 1); Bounds bndCardDealt = imgvCardFaceDown.localToScene(imgvCardFaceDown.getBoundsInLocal()); Point2D pntCardDealt = new Point2D(bndCardDealt.getMinX(), bndCardDealt.getMinY()); // imgvDealerDeck = the card in the common area, where dealer's // card // is located. Find the boundary top left point. ImageView imgvDealerDeck = (ImageView) HboxCommonArea.getChildren().get(0); Bounds bndCardDeck = imgvDealerDeck.localToScene(imgvDealerDeck.getBoundsInLocal()); Point2D pntCardDeck = new Point2D(bndCardDeck.getMinX(), bndCardDeck.getMinY()); // Add a sequential transition to the card (move, rotate) SequentialTransition transMoveRotCard = createTransition(pntCardDeck, pntCardDealt, imView); // Add a parallel transition to the card (fade in/fade out). final ParallelTransition transFadeCardInOut = createFadeTransition(imgvCardFaceDown, new Image(getClass().getResourceAsStream(strCard), 75, 75, true, true)); SequentialTransition transAllActions = new SequentialTransition(); transAllActions.getChildren().addAll(transMoveRotCard, transFadeCardInOut); return transAllActions; } private SequentialTransition createTransition(final Point2D pntStartPoint, final Point2D pntEndPoint, ImageView imView) { imView = new ImageView( new Image(getClass().getResourceAsStream("/res/img/b1fh.png"), 75, 75, true, true)); imView.setX(pntStartPoint.getX()); imView.setY(pntStartPoint.getY() - 30); APMainScreen.getChildren().add(imView); TranslateTransition translateTransition = new TranslateTransition(Duration.millis(300), imView); translateTransition.setFromX(0); translateTransition.setToX(pntEndPoint.getX() - pntStartPoint.getX()); translateTransition.setFromY(0); translateTransition.setToY(pntEndPoint.getY() - pntStartPoint.getY()); translateTransition.setCycleCount(1); translateTransition.setAutoReverse(false); int rnd = randInt(1, 3); RotateTransition rotateTransition = new RotateTransition(Duration.millis(150), imView); rotateTransition.setByAngle(90F); rotateTransition.setCycleCount(rnd); rotateTransition.setAutoReverse(false); ParallelTransition parallelTransition = new ParallelTransition(); parallelTransition.getChildren().addAll(translateTransition, rotateTransition); SequentialTransition seqTrans = new SequentialTransition(); seqTrans.getChildren().addAll(parallelTransition); final ImageView ivRemove = imView; seqTrans.setOnFinished(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent arg0) { APMainScreen.getChildren().remove(ivRemove); } }); return seqTrans; } private ParallelTransition createFadeTransition(final ImageView iv, final Image img) { FadeTransition fadeOutTransition = new FadeTransition(Duration.seconds(.25), iv); fadeOutTransition.setFromValue(1.0); fadeOutTransition.setToValue(0.0); fadeOutTransition.setOnFinished(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent arg0) { iv.setImage(img); } }); FadeTransition fadeInTransition = new FadeTransition(Duration.seconds(.25), iv); fadeInTransition.setFromValue(0.0); fadeInTransition.setToValue(1.0); /* FadeTransition fadeFlyCare = FadeOutTransition(ivFlyCard); */ ParallelTransition parallelTransition = new ParallelTransition(); parallelTransition.getChildren().addAll(fadeOutTransition, fadeInTransition); return parallelTransition; } /** * randInt - Create a random number * * @param min * @param max * @return */ private static int randInt(int min, int max) { return (int) (Math.random() * (min - max)) * -1; } public static void setGame(int i) { gameToPlay = i; } }
fea1965a1b70c227bb8b4b0cd03bc09ffd0984a7
24748d9c3311c5683f1d6e815fa7e24740c3709a
/Spring/dependency_injectio2/src/Si_Map2/Answer3.java
cf944d3c1dcf743be8d35ca09c2dfbb7bbe4adc6
[]
no_license
pradeepp82/mypractice
6262a862770f4a8bcfaf5e6be725d51c5d24b915
3b845d2b7635271d5a75631ae47515c429d4a7cb
refs/heads/master
2021-07-17T07:48:18.324173
2017-10-25T07:20:23
2017-10-25T07:20:23
108,234,160
0
0
null
null
null
null
UTF-8
Java
false
false
567
java
package Si_Map2; import java.util.Date; public class Answer3 { private int id; private String answer; private Date postedDate; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getAnswer() { return answer; } public void setAnswer(String answer) { this.answer = answer; } public Date getPostedDate() { return postedDate; } public void setPostedDate(Date postedDate) { this.postedDate = postedDate; } public String toString(){ return "Id:"+id+" Answer:"+answer+" Posted Date:"+postedDate; } }
a89716bddc22a127eb78bb301399b012d86048e1
c2efacd889f56763712dda60dfd80cac9e5bcce2
/bee_web/src/main/java/com/bee/app/controller/shop/ShopErrorController.java
713298af65a1c2d23c1c0d925d9c326b58f647cf
[]
no_license
caocf/bee_parent
70c1d54e657a7b2ccd0e8696f293719b133ad8cc
ab8899e800cc318f22fc23045b1164a0047bcefa
refs/heads/master
2020-05-29T11:55:16.736793
2016-01-27T15:53:52
2016-01-27T15:53:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,653
java
package com.bee.app.controller.shop; import com.bee.commons.Codes; import com.bee.pojo.shop.Shop; import com.bee.pojo.shop.ShopError; import com.bee.services.shop.IShopErrorService; import com.qsd.framework.commons.utils.StringUtil; import com.qsd.framework.hibernate.exception.DataRunException; import com.qsd.framework.spring.BaseResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; /** * Created by suntongwei on 15/6/26. */ @RestController @RequestMapping("/shop/{sid}/error") public class ShopErrorController { @Autowired private IShopErrorService shopErrorService; /** * * * @param sid * @param shopError * @return */ @RequestMapping(method = RequestMethod.POST) public BaseResponse addShopError(@PathVariable Long sid, ShopError shopError) { BaseResponse res = new BaseResponse(); if (StringUtil.checkIllegalChar(shopError.getErrorMsg(), shopError.getPhone())) { res.setCode(Codes.Error); res.setMsg("输入内容不合法,请重新输入"); return res; } try { shopError.setShop(new Shop(sid)); shopErrorService.addShopError(shopError); res.setCode(Codes.Success); } catch (DataRunException e) { res.setCode(Codes.Error); e.printStackTrace(); } return res; } }
82006243c45e5e779ab0101f7bc56a0a895f511b
972c01c4fb21dd3fc0cfbca08d2b6df64f71d06c
/app/src/test/java/mentorme/csumb/edu/mentorme/data/model/topics/TopicTest.java
33be664a8898297b187717899ff593a9096898fb
[]
no_license
sorenlassen-csumb/MentorMe
f1340b52b0cc8fc9d788f901806e129059750844
92ebd91ecf5d229e0f865d79bf8d7d2504d45e1f
refs/heads/master
2020-06-13T18:40:17.779793
2016-12-06T02:15:21
2016-12-06T02:57:19
75,567,703
0
0
null
2016-12-04T22:08:06
2016-12-04T22:08:06
null
UTF-8
Java
false
false
1,468
java
package mentorme.csumb.edu.mentorme.data.model.topics; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertFalse; /** * * Unit test coverage for {@link Topic}. */ @RunWith(JUnit4.class) public class TopicTest { private final String MATCH_TOPIC = "CST"; private final String MATCH_TITLE = "Algorithms"; private final String NO_MATCH_TOPIC = "ENG"; private final String NO_MATCH_TITLE = "English 1"; private Topic mTopic; @Before public void onSetup() { mTopic = new Topic(); } @Test public void getTopic_whenTopicMatch_shouldPass() { // Given mTopic.setTopic(MATCH_TOPIC); // When assertEquals(mTopic.getTopic(), MATCH_TOPIC); } @Test public void getTopic_whenTopicDoNotMatch_shouldFail() { mTopic.setTopic(MATCH_TOPIC); assertFalse(mTopic.getTopic().equals(NO_MATCH_TOPIC)); } @Test public void getTitle_whenTitleMatch_shouldPass() { // Given mTopic.setTitle(MATCH_TITLE); // Then assertEquals(mTopic.getTitle(), MATCH_TITLE); } @Test public void getTitle_whenTitleDoNotMatch_shouldFail() { // Given mTopic.setTitle(MATCH_TITLE); // Then assertFalse(mTopic.getTitle().equals(NO_MATCH_TITLE)); } }
b9b8ce876bc53feb34d8fbc538cf2b4e23f87041
46e72e072e183d9475578b76728f1184048c9a77
/app/src/main/java/com/viewpagerindicator/IconPageIndicator.java
eb7ddd679d006bd8fbb41889333195d8b69f3aa1
[]
no_license
blastering66/RCS-V-X
08758614c399be50d73815d66de399703757b664
172156a075ce1ab8b69ea897745805034967e88f
refs/heads/master
2021-01-10T14:13:57.255940
2016-03-03T07:01:46
2016-03-03T07:01:46
51,807,044
1
0
null
null
null
null
UTF-8
Java
false
false
4,925
java
package com.viewpagerindicator; /** * Created by Anoa 34 on 06/10/2015. */ import id.tech.verificareolx.R; import android.content.Context; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager.OnPageChangeListener; import android.util.AttributeSet; import android.view.Gravity; import android.view.View; import android.widget.HorizontalScrollView; import android.widget.ImageView; import static android.view.ViewGroup.LayoutParams.FILL_PARENT; import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; public class IconPageIndicator extends HorizontalScrollView implements PageIndicator { private final IcsLinearLayout mIconsLayout; private ViewPager mViewPager; private OnPageChangeListener mListener; private Runnable mIconSelector; private int mSelectedIndex; public IconPageIndicator(Context context) { this(context, null); } public IconPageIndicator(Context context, AttributeSet attrs) { super(context, attrs); setHorizontalScrollBarEnabled(false); mIconsLayout = new IcsLinearLayout(context, R.attr.vpiIconPageIndicatorStyle); addView(mIconsLayout, new LayoutParams(WRAP_CONTENT, FILL_PARENT, Gravity.CENTER)); } private void animateToIcon(final int position) { final View iconView = mIconsLayout.getChildAt(position); if (mIconSelector != null) { removeCallbacks(mIconSelector); } mIconSelector = new Runnable() { public void run() { final int scrollPos = iconView.getLeft() - (getWidth() - iconView.getWidth()) / 2; smoothScrollTo(scrollPos, 0); mIconSelector = null; } }; post(mIconSelector); } @Override public void onAttachedToWindow() { super.onAttachedToWindow(); if (mIconSelector != null) { // Re-post the selector we saved post(mIconSelector); } } @Override public void onDetachedFromWindow() { super.onDetachedFromWindow(); if (mIconSelector != null) { removeCallbacks(mIconSelector); } } @Override public void onPageScrollStateChanged(int arg0) { if (mListener != null) { mListener.onPageScrollStateChanged(arg0); } } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { if (mListener != null) { mListener.onPageScrolled(arg0, arg1, arg2); } } @Override public void onPageSelected(int arg0) { setCurrentItem(arg0); if (mListener != null) { mListener.onPageSelected(arg0); } } @Override public void setViewPager(ViewPager view) { if (mViewPager == view) { return; } if (mViewPager != null) { mViewPager.setOnPageChangeListener(null); } PagerAdapter adapter = view.getAdapter(); if (adapter == null) { throw new IllegalStateException("ViewPager does not have adapter instance."); } mViewPager = view; view.setOnPageChangeListener(this); notifyDataSetChanged(); } public void notifyDataSetChanged() { mIconsLayout.removeAllViews(); IconPagerAdapter iconAdapter = (IconPagerAdapter) mViewPager.getAdapter(); int count = iconAdapter.getCount(); for (int i = 0; i < count; i++) { ImageView view = new ImageView(getContext(), null, R.attr.vpiIconPageIndicatorStyle); view.setImageResource(iconAdapter.getIconResId(i)); mIconsLayout.addView(view); } if (mSelectedIndex > count) { mSelectedIndex = count - 1; } setCurrentItem(mSelectedIndex); requestLayout(); } @Override public void setViewPager(ViewPager view, int initialPosition) { setViewPager(view); setCurrentItem(initialPosition); } @Override public void setCurrentItem(int item) { if (mViewPager == null) { throw new IllegalStateException("ViewPager has not been bound."); } mSelectedIndex = item; mViewPager.setCurrentItem(item); int tabCount = mIconsLayout.getChildCount(); for (int i = 0; i < tabCount; i++) { View child = mIconsLayout.getChildAt(i); boolean isSelected = (i == item); child.setSelected(isSelected); if (isSelected) { animateToIcon(item); } } } @Override public void setOnPageChangeListener(OnPageChangeListener listener) { mListener = listener; } }
053bc8297fa9ea2e82b5aa5398cd305101ed6f78
97989671c4228498ff0968cf2a359894d3015768
/CoreFindView/src/au/gov/asd/tac/constellation/views/find/utilities/FindResult.java
32c760522c2c757352a621ca603fe2f0d6a27b60
[ "Apache-2.0" ]
permissive
constellation-app/constellation
d8ef3156f6f8b39da8636a41b16191678b9edac0
a0489877b4c77fb6c7a47c66a947895af35ecf19
refs/heads/master
2023-09-02T13:52:54.448671
2023-08-30T00:51:47
2023-08-30T00:51:47
196,507,883
393
105
Apache-2.0
2023-09-12T04:40:36
2019-07-12T04:19:50
Java
UTF-8
Java
false
false
5,836
java
/* * Copyright 2010-2022 Australian Signals Directorate * * 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 au.gov.asd.tac.constellation.views.find.utilities; import au.gov.asd.tac.constellation.graph.GraphElementType; import java.util.ArrayList; import java.util.Objects; /** * This class is the holder class for an individual vertex, transaction, edge or * link that has been found to be a match to one or more find criteria. * <p> * Any results delivered from advanced or quick queries are returned in an * <code>ArrayList&lt;FindResult&gt;</code>. * * @see ArrayList * * @author betelgeuse */ public class FindResult { public static final String SEPARATOR = " : "; private int id; private long uid; private GraphElementType type; private String attributeName; private Object value; private static final String SELECTED = "selected"; private static final String DEFAULT_VALUE = "found"; private final String graphId; /** * Constructs a new <code>FindResult</code> with minimum applicable content. * * @param id The ID of the Graph Element this <code>FindResult</code> * represents. * @param type The type of result. May be VERTEX, LINK, EDGE or TRANSACTION. */ public FindResult(final int id, final long uid, final GraphElementType type, final String graphId) { this.id = id; this.uid = uid; this.type = type; this.attributeName = SELECTED; this.value = DEFAULT_VALUE; this.graphId = graphId; } /** * Constructs a new <code>FindResult</code>. * * @param id Graph ID of the search result. * @param type Type of result. May be VERTEX, LINK, EDGE or TRANSACTION. * @param attributeName The name of the result's attribute type. * @param value The content of the given VERTEX, LINK, EDGE or TRANSACTION. */ public FindResult(final int id, final long uid, final GraphElementType type, final String attributeName, final Object value, final String graphId) { this.id = id; this.uid = uid; this.type = type; this.attributeName = attributeName; this.value = value; this.graphId = graphId; } /** * Returns the ID of the given GraphElement. * * @return The ID of the given GraphElement. */ public int getID() { return id; } /** * Sets the ID of the given GraphElement. * * @param id ID to set this FindResult to. */ public void setID(final int id) { this.id = id; } /** * Returns the UID of the given GraphElement. * * @return The UID of the given GraphElement. */ public long getUID() { return uid; } /** * Sets the UID of the given GraphElement. * * @param uid UID to set this FindResult to. */ public void setUID(final long uid) { this.uid = uid; } /** * Gets the type of the given GraphElement. * * @return type. */ public GraphElementType getType() { return type; } /** * Sets the type of the given GraphElement. * * @param type Type of the GraphElement. */ public void setType(final GraphElementType type) { this.type = type; } /** * Gets the name of the attribute for the given GraphElement. * * @return AttributeName. */ public String getAttributeName() { return attributeName; } /** * Sets the attribute name. * * @param attributeName The name of the attribute. */ public void setAttributeName(final String attributeName) { this.attributeName = attributeName; } /** * Returns the stored attribute value. * * @return attribute value. */ public Object getAttributeValue() { return value; } /** * Sets the value of this result to the given value. * * @param value Value of the GraphElement. */ public void setAttributeValue(final Object value) { this.value = value; } /** * Gets the id of the graph this result is found in * * @return graphId */ public String getGraphId() { return graphId; } /** * Returns the string representation of this FindResult. * * @return The current item's value and GraphElementType. */ @Override public String toString() { return value.toString() + SEPARATOR + attributeName; } @Override public boolean equals(final Object obj) { if (obj == this) { return true; } if (!(obj instanceof FindResult)) { return false; } final FindResult other = (FindResult) obj; return this.id == other.id && this.graphId.equals(other.graphId); } @Override public int hashCode() { int hash = 3; hash = 97 * hash + this.id; hash = 97 * hash + (int) (this.uid ^ (this.uid >>> 32)); hash = 97 * hash + Objects.hashCode(this.type); hash = 97 * hash + Objects.hashCode(this.attributeName); hash = 97 * hash + Objects.hashCode(this.value); hash = 97 * hash + Objects.hashCode(this.graphId); return hash; } }
f6c596895e52d1080ecd0bc46092130d64e6ce2f
512e6c14fb4ab5397cf1a94c21a6062e59d6eb99
/src/controller/ClienteController.java
4fef43d467b573fc41bcd432bb7e6b571225cbef
[]
no_license
flpos/AvaliacaoPOO2021.1
9b98d22401c75ae46c10361fd58cc952c06cb0b5
01ac815535e482768325cc84753b9e97f650a5b3
refs/heads/master
2023-05-06T13:44:41.192889
2021-06-05T01:43:04
2021-06-05T01:43:04
358,134,503
1
0
null
null
null
null
UTF-8
Java
false
false
2,712
java
package controller; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import model.Cliente; public class ClienteController { private List<Cliente> clientes = new ArrayList<Cliente>(); public ClienteController() { this.loadData(); } public List<Cliente> getClientes() { return this.clientes; } public Cliente findById(Integer id) { Iterator<Cliente> lista = this.clientes.iterator(); while (lista.hasNext()) { Cliente cliente = lista.next(); if (cliente.getId() == id) { return cliente; } } return null; } public Cliente findByLogin(String login) { Iterator<Cliente> lista = this.clientes.iterator(); while (lista.hasNext()) { Cliente cliente = lista.next(); if (cliente.getLogin().equals(login)) { return cliente; } } return null; } public void addCliente(Cliente cliente) { this.clientes.add(cliente); this.saveData(); } public void saveData() { try { FileOutputStream f = new FileOutputStream(new File("Clientes.txt")); ObjectOutputStream o = new ObjectOutputStream(f); // Write objects to file Iterator<Cliente> clientes = this.clientes.iterator(); while (clientes.hasNext()) { o.writeObject(clientes.next()); } o.close(); f.close(); } catch (FileNotFoundException e) { System.out.println("File not found"); } catch (IOException e) { System.out.println("Error initializing stream"); } } public void loadData() { try { FileInputStream fi = new FileInputStream(new File("Clientes.txt")); ObjectInputStream oi = new ObjectInputStream(fi); // Read objects Boolean eof = false; this.clientes = new ArrayList<Cliente>(); while (!eof) { this.clientes.add((Cliente) oi.readObject()); } oi.close(); fi.close(); } catch (FileNotFoundException e) { System.out.println("File not found"); } catch (IOException e) { System.out.println("Error initializing stream"); } catch (ClassNotFoundException e) { e.printStackTrace(); } } }
047f370b9681be5f389a1f2c82724a16e2b8e3cf
60393704a3bc883ce460898b2e47d248860893a4
/src/Game/Liquid.java
140c6156ed56cbe3bd7842aeda78bf0f79a767fa
[]
no_license
mjfinzel/The-Loot-Game
f3c6d14e8f6f0d8555e9d8f8e219804834114c40
5d92a0a39b26a1b5a9f39c9a0dce0933cd954c1a
refs/heads/master
2021-04-28T01:36:16.605365
2018-02-21T02:08:53
2018-02-21T02:08:53
122,282,065
0
0
null
null
null
null
UTF-8
Java
false
false
99
java
package Game; public class Liquid { int[][] positions = new int[1][1]; public Liquid(){ } }
3517c6343225ec81f8a18e453ab3203a945d34ab
16cf69f5658d0a3d3c67eca33f851bc79ac485ec
/RetrofitRxJavaMvp/app/src/main/java/com/dawn/rrm/Plugin.java
da79d66a2fa22a3fdc1f25a8eaa0fd16d839fd8b
[]
no_license
wangxiongtao/Retrofit-RxJava-Mvp
be03668e4307a6fb6a97622febb22925075b6602
fd53823fd4a0e26c792f7eb50089d9bd29fe0799
refs/heads/master
2018-11-27T05:53:08.513466
2018-09-05T07:43:48
2018-09-05T07:43:48
120,549,737
0
0
null
null
null
null
UTF-8
Java
false
false
177
java
package com.dawn.rrm; /** * Created by Administrator on 2018/3/12 0012. */ public class Plugin { public String getString(){ return "WO im getString "; } }
9d5c63056672b45c1b9388e7e6ff8ecb47bb467a
1b4763fd72c3f8bd2eb64bd912387c06388526dd
/javier-lete/Java/LoginApp/src/com/garaipenadev/loginapp/controllers/CookieController.java
290ae508f4bb24da9bfdca8e8bf554948d05fa3f
[]
no_license
ipartek/web-zalla
b9e899d7d6f24c275b2d7f0fea54acbc3c01d436
da8e4c165445baf5b5fe2935ffccfeb1edb6ff7b
refs/heads/master
2021-01-18T17:25:58.506425
2017-09-27T11:57:03
2017-09-27T11:57:03
86,797,063
0
1
null
null
null
null
UTF-8
Java
false
false
1,554
java
package com.garaipenadev.loginapp.controllers; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.xml.bind.DatatypeConverter; import com.garaipenadev.loginapp.vo.User; /** * Servlet implementation class CookieController */ @WebServlet("/hghghghghghghgh") public class CookieController extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public CookieController() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response) */ protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String cookieValue; if(request.getSession()==null){ Cookie[] cookies = request.getCookies(); for(Cookie c : cookies){ if(c.getName().equals("usuario")){ cookieValue = c.getValue(); String[] cookieTokens = cookieValue.split("|"); String decodedName = new String(DatatypeConverter.parseBase64Binary(cookieTokens[0])); String decodedPass = new String(DatatypeConverter.parseBase64Binary(cookieTokens[1])); User u = new User(decodedName, decodedPass); request.getSession().setAttribute("user", u); } } } } }
f95bd5d904219fc1ef86a50a2e4bd9193ef361c7
bbb78ba1afa3eeb21633ae8973b5ace2a8ece017
/app/build/generated/source/r/debug/android/support/constraint/R.java
1a6efda96a1bfc62987b9bd71caf931a55d84c20
[]
no_license
mirkomikan/mrucv2
16d776698e6281b8c54c11468ac420cb6eff99ff
0c156b7bbadd7f76d70fb122d55f76a6b1f5dc1d
refs/heads/master
2020-03-17T09:48:05.437553
2018-05-15T09:13:01
2018-05-15T09:13:01
133,489,259
0
0
null
null
null
null
UTF-8
Java
false
false
18,797
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package android.support.constraint; public final class R { public static final class attr { public static final int barrierAllowsGoneWidgets = 0x7f030037; public static final int barrierDirection = 0x7f030038; public static final int chainUseRtl = 0x7f03004e; public static final int constraintSet = 0x7f030063; public static final int constraint_referenced_ids = 0x7f030064; public static final int content = 0x7f030065; public static final int emptyVisibility = 0x7f030085; public static final int layout_constrainedHeight = 0x7f0300c3; public static final int layout_constrainedWidth = 0x7f0300c4; public static final int layout_constraintBaseline_creator = 0x7f0300c5; public static final int layout_constraintBaseline_toBaselineOf = 0x7f0300c6; public static final int layout_constraintBottom_creator = 0x7f0300c7; public static final int layout_constraintBottom_toBottomOf = 0x7f0300c8; public static final int layout_constraintBottom_toTopOf = 0x7f0300c9; public static final int layout_constraintCircle = 0x7f0300ca; public static final int layout_constraintCircleAngle = 0x7f0300cb; public static final int layout_constraintCircleRadius = 0x7f0300cc; public static final int layout_constraintDimensionRatio = 0x7f0300cd; public static final int layout_constraintEnd_toEndOf = 0x7f0300ce; public static final int layout_constraintEnd_toStartOf = 0x7f0300cf; public static final int layout_constraintGuide_begin = 0x7f0300d0; public static final int layout_constraintGuide_end = 0x7f0300d1; public static final int layout_constraintGuide_percent = 0x7f0300d2; public static final int layout_constraintHeight_default = 0x7f0300d3; public static final int layout_constraintHeight_max = 0x7f0300d4; public static final int layout_constraintHeight_min = 0x7f0300d5; public static final int layout_constraintHeight_percent = 0x7f0300d6; public static final int layout_constraintHorizontal_bias = 0x7f0300d7; public static final int layout_constraintHorizontal_chainStyle = 0x7f0300d8; public static final int layout_constraintHorizontal_weight = 0x7f0300d9; public static final int layout_constraintLeft_creator = 0x7f0300da; public static final int layout_constraintLeft_toLeftOf = 0x7f0300db; public static final int layout_constraintLeft_toRightOf = 0x7f0300dc; public static final int layout_constraintRight_creator = 0x7f0300dd; public static final int layout_constraintRight_toLeftOf = 0x7f0300de; public static final int layout_constraintRight_toRightOf = 0x7f0300df; public static final int layout_constraintStart_toEndOf = 0x7f0300e0; public static final int layout_constraintStart_toStartOf = 0x7f0300e1; public static final int layout_constraintTop_creator = 0x7f0300e2; public static final int layout_constraintTop_toBottomOf = 0x7f0300e3; public static final int layout_constraintTop_toTopOf = 0x7f0300e4; public static final int layout_constraintVertical_bias = 0x7f0300e5; public static final int layout_constraintVertical_chainStyle = 0x7f0300e6; public static final int layout_constraintVertical_weight = 0x7f0300e7; public static final int layout_constraintWidth_default = 0x7f0300e8; public static final int layout_constraintWidth_max = 0x7f0300e9; public static final int layout_constraintWidth_min = 0x7f0300ea; public static final int layout_constraintWidth_percent = 0x7f0300eb; public static final int layout_editor_absoluteX = 0x7f0300ed; public static final int layout_editor_absoluteY = 0x7f0300ee; public static final int layout_goneMarginBottom = 0x7f0300ef; public static final int layout_goneMarginEnd = 0x7f0300f0; public static final int layout_goneMarginLeft = 0x7f0300f1; public static final int layout_goneMarginRight = 0x7f0300f2; public static final int layout_goneMarginStart = 0x7f0300f3; public static final int layout_goneMarginTop = 0x7f0300f4; public static final int layout_optimizationLevel = 0x7f0300f7; } public static final class id { public static final int barrier = 0x7f080020; public static final int bottom = 0x7f080023; public static final int chains = 0x7f080029; public static final int dimensions = 0x7f08003b; public static final int direct = 0x7f08003c; public static final int end = 0x7f08003f; public static final int gone = 0x7f08004c; public static final int invisible = 0x7f080054; public static final int left = 0x7f080058; public static final int none = 0x7f080066; public static final int packed = 0x7f08006b; public static final int parent = 0x7f08006d; public static final int percent = 0x7f080070; public static final int right = 0x7f080075; public static final int spread = 0x7f080096; public static final int spread_inside = 0x7f080097; public static final int standard = 0x7f08009b; public static final int start = 0x7f08009c; public static final int top = 0x7f0800ae; public static final int wrap = 0x7f0800bc; } public static final class styleable { public static final int[] ConstraintLayout_Layout = { 0x010100c4, 0x0101011f, 0x01010120, 0x0101013f, 0x01010140, 0x7f030037, 0x7f030038, 0x7f03004e, 0x7f030063, 0x7f030064, 0x7f0300c3, 0x7f0300c4, 0x7f0300c5, 0x7f0300c6, 0x7f0300c7, 0x7f0300c8, 0x7f0300c9, 0x7f0300ca, 0x7f0300cb, 0x7f0300cc, 0x7f0300cd, 0x7f0300ce, 0x7f0300cf, 0x7f0300d0, 0x7f0300d1, 0x7f0300d2, 0x7f0300d3, 0x7f0300d4, 0x7f0300d5, 0x7f0300d6, 0x7f0300d7, 0x7f0300d8, 0x7f0300d9, 0x7f0300da, 0x7f0300db, 0x7f0300dc, 0x7f0300dd, 0x7f0300de, 0x7f0300df, 0x7f0300e0, 0x7f0300e1, 0x7f0300e2, 0x7f0300e3, 0x7f0300e4, 0x7f0300e5, 0x7f0300e6, 0x7f0300e7, 0x7f0300e8, 0x7f0300e9, 0x7f0300ea, 0x7f0300eb, 0x7f0300ed, 0x7f0300ee, 0x7f0300ef, 0x7f0300f0, 0x7f0300f1, 0x7f0300f2, 0x7f0300f3, 0x7f0300f4, 0x7f0300f7 }; public static final int ConstraintLayout_Layout_android_orientation = 0; public static final int ConstraintLayout_Layout_android_maxWidth = 1; public static final int ConstraintLayout_Layout_android_maxHeight = 2; public static final int ConstraintLayout_Layout_android_minWidth = 3; public static final int ConstraintLayout_Layout_android_minHeight = 4; public static final int ConstraintLayout_Layout_barrierAllowsGoneWidgets = 5; public static final int ConstraintLayout_Layout_barrierDirection = 6; public static final int ConstraintLayout_Layout_chainUseRtl = 7; public static final int ConstraintLayout_Layout_constraintSet = 8; public static final int ConstraintLayout_Layout_constraint_referenced_ids = 9; public static final int ConstraintLayout_Layout_layout_constrainedHeight = 10; public static final int ConstraintLayout_Layout_layout_constrainedWidth = 11; public static final int ConstraintLayout_Layout_layout_constraintBaseline_creator = 12; public static final int ConstraintLayout_Layout_layout_constraintBaseline_toBaselineOf = 13; public static final int ConstraintLayout_Layout_layout_constraintBottom_creator = 14; public static final int ConstraintLayout_Layout_layout_constraintBottom_toBottomOf = 15; public static final int ConstraintLayout_Layout_layout_constraintBottom_toTopOf = 16; public static final int ConstraintLayout_Layout_layout_constraintCircle = 17; public static final int ConstraintLayout_Layout_layout_constraintCircleAngle = 18; public static final int ConstraintLayout_Layout_layout_constraintCircleRadius = 19; public static final int ConstraintLayout_Layout_layout_constraintDimensionRatio = 20; public static final int ConstraintLayout_Layout_layout_constraintEnd_toEndOf = 21; public static final int ConstraintLayout_Layout_layout_constraintEnd_toStartOf = 22; public static final int ConstraintLayout_Layout_layout_constraintGuide_begin = 23; public static final int ConstraintLayout_Layout_layout_constraintGuide_end = 24; public static final int ConstraintLayout_Layout_layout_constraintGuide_percent = 25; public static final int ConstraintLayout_Layout_layout_constraintHeight_default = 26; public static final int ConstraintLayout_Layout_layout_constraintHeight_max = 27; public static final int ConstraintLayout_Layout_layout_constraintHeight_min = 28; public static final int ConstraintLayout_Layout_layout_constraintHeight_percent = 29; public static final int ConstraintLayout_Layout_layout_constraintHorizontal_bias = 30; public static final int ConstraintLayout_Layout_layout_constraintHorizontal_chainStyle = 31; public static final int ConstraintLayout_Layout_layout_constraintHorizontal_weight = 32; public static final int ConstraintLayout_Layout_layout_constraintLeft_creator = 33; public static final int ConstraintLayout_Layout_layout_constraintLeft_toLeftOf = 34; public static final int ConstraintLayout_Layout_layout_constraintLeft_toRightOf = 35; public static final int ConstraintLayout_Layout_layout_constraintRight_creator = 36; public static final int ConstraintLayout_Layout_layout_constraintRight_toLeftOf = 37; public static final int ConstraintLayout_Layout_layout_constraintRight_toRightOf = 38; public static final int ConstraintLayout_Layout_layout_constraintStart_toEndOf = 39; public static final int ConstraintLayout_Layout_layout_constraintStart_toStartOf = 40; public static final int ConstraintLayout_Layout_layout_constraintTop_creator = 41; public static final int ConstraintLayout_Layout_layout_constraintTop_toBottomOf = 42; public static final int ConstraintLayout_Layout_layout_constraintTop_toTopOf = 43; public static final int ConstraintLayout_Layout_layout_constraintVertical_bias = 44; public static final int ConstraintLayout_Layout_layout_constraintVertical_chainStyle = 45; public static final int ConstraintLayout_Layout_layout_constraintVertical_weight = 46; public static final int ConstraintLayout_Layout_layout_constraintWidth_default = 47; public static final int ConstraintLayout_Layout_layout_constraintWidth_max = 48; public static final int ConstraintLayout_Layout_layout_constraintWidth_min = 49; public static final int ConstraintLayout_Layout_layout_constraintWidth_percent = 50; public static final int ConstraintLayout_Layout_layout_editor_absoluteX = 51; public static final int ConstraintLayout_Layout_layout_editor_absoluteY = 52; public static final int ConstraintLayout_Layout_layout_goneMarginBottom = 53; public static final int ConstraintLayout_Layout_layout_goneMarginEnd = 54; public static final int ConstraintLayout_Layout_layout_goneMarginLeft = 55; public static final int ConstraintLayout_Layout_layout_goneMarginRight = 56; public static final int ConstraintLayout_Layout_layout_goneMarginStart = 57; public static final int ConstraintLayout_Layout_layout_goneMarginTop = 58; public static final int ConstraintLayout_Layout_layout_optimizationLevel = 59; public static final int[] ConstraintLayout_placeholder = { 0x7f030065, 0x7f030085 }; public static final int ConstraintLayout_placeholder_content = 0; public static final int ConstraintLayout_placeholder_emptyVisibility = 1; public static final int[] ConstraintSet = { 0x010100c4, 0x010100d0, 0x010100dc, 0x010100f4, 0x010100f5, 0x010100f7, 0x010100f8, 0x010100f9, 0x010100fa, 0x0101031f, 0x01010320, 0x01010321, 0x01010322, 0x01010323, 0x01010324, 0x01010325, 0x01010326, 0x01010327, 0x01010328, 0x010103b5, 0x010103b6, 0x010103fa, 0x01010440, 0x7f0300c3, 0x7f0300c4, 0x7f0300c5, 0x7f0300c6, 0x7f0300c7, 0x7f0300c8, 0x7f0300c9, 0x7f0300ca, 0x7f0300cb, 0x7f0300cc, 0x7f0300cd, 0x7f0300ce, 0x7f0300cf, 0x7f0300d0, 0x7f0300d1, 0x7f0300d2, 0x7f0300d3, 0x7f0300d4, 0x7f0300d5, 0x7f0300d6, 0x7f0300d7, 0x7f0300d8, 0x7f0300d9, 0x7f0300da, 0x7f0300db, 0x7f0300dc, 0x7f0300dd, 0x7f0300de, 0x7f0300df, 0x7f0300e0, 0x7f0300e1, 0x7f0300e2, 0x7f0300e3, 0x7f0300e4, 0x7f0300e5, 0x7f0300e6, 0x7f0300e7, 0x7f0300e8, 0x7f0300e9, 0x7f0300ea, 0x7f0300eb, 0x7f0300ed, 0x7f0300ee, 0x7f0300ef, 0x7f0300f0, 0x7f0300f1, 0x7f0300f2, 0x7f0300f3, 0x7f0300f4 }; public static final int ConstraintSet_android_orientation = 0; public static final int ConstraintSet_android_id = 1; public static final int ConstraintSet_android_visibility = 2; public static final int ConstraintSet_android_layout_width = 3; public static final int ConstraintSet_android_layout_height = 4; public static final int ConstraintSet_android_layout_marginLeft = 5; public static final int ConstraintSet_android_layout_marginTop = 6; public static final int ConstraintSet_android_layout_marginRight = 7; public static final int ConstraintSet_android_layout_marginBottom = 8; public static final int ConstraintSet_android_alpha = 9; public static final int ConstraintSet_android_transformPivotX = 10; public static final int ConstraintSet_android_transformPivotY = 11; public static final int ConstraintSet_android_translationX = 12; public static final int ConstraintSet_android_translationY = 13; public static final int ConstraintSet_android_scaleX = 14; public static final int ConstraintSet_android_scaleY = 15; public static final int ConstraintSet_android_rotation = 16; public static final int ConstraintSet_android_rotationX = 17; public static final int ConstraintSet_android_rotationY = 18; public static final int ConstraintSet_android_layout_marginStart = 19; public static final int ConstraintSet_android_layout_marginEnd = 20; public static final int ConstraintSet_android_translationZ = 21; public static final int ConstraintSet_android_elevation = 22; public static final int ConstraintSet_layout_constrainedHeight = 23; public static final int ConstraintSet_layout_constrainedWidth = 24; public static final int ConstraintSet_layout_constraintBaseline_creator = 25; public static final int ConstraintSet_layout_constraintBaseline_toBaselineOf = 26; public static final int ConstraintSet_layout_constraintBottom_creator = 27; public static final int ConstraintSet_layout_constraintBottom_toBottomOf = 28; public static final int ConstraintSet_layout_constraintBottom_toTopOf = 29; public static final int ConstraintSet_layout_constraintCircle = 30; public static final int ConstraintSet_layout_constraintCircleAngle = 31; public static final int ConstraintSet_layout_constraintCircleRadius = 32; public static final int ConstraintSet_layout_constraintDimensionRatio = 33; public static final int ConstraintSet_layout_constraintEnd_toEndOf = 34; public static final int ConstraintSet_layout_constraintEnd_toStartOf = 35; public static final int ConstraintSet_layout_constraintGuide_begin = 36; public static final int ConstraintSet_layout_constraintGuide_end = 37; public static final int ConstraintSet_layout_constraintGuide_percent = 38; public static final int ConstraintSet_layout_constraintHeight_default = 39; public static final int ConstraintSet_layout_constraintHeight_max = 40; public static final int ConstraintSet_layout_constraintHeight_min = 41; public static final int ConstraintSet_layout_constraintHeight_percent = 42; public static final int ConstraintSet_layout_constraintHorizontal_bias = 43; public static final int ConstraintSet_layout_constraintHorizontal_chainStyle = 44; public static final int ConstraintSet_layout_constraintHorizontal_weight = 45; public static final int ConstraintSet_layout_constraintLeft_creator = 46; public static final int ConstraintSet_layout_constraintLeft_toLeftOf = 47; public static final int ConstraintSet_layout_constraintLeft_toRightOf = 48; public static final int ConstraintSet_layout_constraintRight_creator = 49; public static final int ConstraintSet_layout_constraintRight_toLeftOf = 50; public static final int ConstraintSet_layout_constraintRight_toRightOf = 51; public static final int ConstraintSet_layout_constraintStart_toEndOf = 52; public static final int ConstraintSet_layout_constraintStart_toStartOf = 53; public static final int ConstraintSet_layout_constraintTop_creator = 54; public static final int ConstraintSet_layout_constraintTop_toBottomOf = 55; public static final int ConstraintSet_layout_constraintTop_toTopOf = 56; public static final int ConstraintSet_layout_constraintVertical_bias = 57; public static final int ConstraintSet_layout_constraintVertical_chainStyle = 58; public static final int ConstraintSet_layout_constraintVertical_weight = 59; public static final int ConstraintSet_layout_constraintWidth_default = 60; public static final int ConstraintSet_layout_constraintWidth_max = 61; public static final int ConstraintSet_layout_constraintWidth_min = 62; public static final int ConstraintSet_layout_constraintWidth_percent = 63; public static final int ConstraintSet_layout_editor_absoluteX = 64; public static final int ConstraintSet_layout_editor_absoluteY = 65; public static final int ConstraintSet_layout_goneMarginBottom = 66; public static final int ConstraintSet_layout_goneMarginEnd = 67; public static final int ConstraintSet_layout_goneMarginLeft = 68; public static final int ConstraintSet_layout_goneMarginRight = 69; public static final int ConstraintSet_layout_goneMarginStart = 70; public static final int ConstraintSet_layout_goneMarginTop = 71; public static final int[] LinearConstraintLayout = { 0x010100c4 }; public static final int LinearConstraintLayout_android_orientation = 0; } }
[ "m123" ]
m123
f8eb87ceed47cb4a86d0efd7d3473faff197adbc
9e5a398d20e1a7d485c0767fd38aca1ca6a1d7fb
/1_6.h12_dev/sonos.jad/src/ch/qos/logback/classic/spi/ThrowableProxyVO.java
e4561c636f661a5512dac46a21e89233ff6f4e40
[]
no_license
witokondoria/OpenWrt_Luci_Lua
6690e0f9cce38676ea93d176a7966546fd03fd32
07d1a20e1a950a330b51625b89cb6466ffaec84b
refs/heads/master
2021-06-01T18:25:09.937542
2016-08-26T13:14:10
2016-08-26T13:14:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,304
java
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) package ch.qos.logback.classic.spi; import java.io.Serializable; import java.util.Arrays; // Referenced classes of package ch.qos.logback.classic.spi: // IThrowableProxy, StackTraceElementProxy public class ThrowableProxyVO implements IThrowableProxy, Serializable { public ThrowableProxyVO() { } public static ThrowableProxyVO build(IThrowableProxy ithrowableproxy) { ThrowableProxyVO throwableproxyvo1; if(ithrowableproxy == null) { throwableproxyvo1 = null; } else { ThrowableProxyVO throwableproxyvo = new ThrowableProxyVO(); throwableproxyvo.className = ithrowableproxy.getClassName(); throwableproxyvo.message = ithrowableproxy.getMessage(); throwableproxyvo.commonFramesCount = ithrowableproxy.getCommonFrames(); throwableproxyvo.stackTraceElementProxyArray = ithrowableproxy.getStackTraceElementProxyArray(); IThrowableProxy ithrowableproxy1 = ithrowableproxy.getCause(); if(ithrowableproxy1 != null) throwableproxyvo.cause = build(ithrowableproxy1); IThrowableProxy aithrowableproxy[] = ithrowableproxy.getSuppressed(); if(aithrowableproxy != null) { throwableproxyvo.suppressed = new IThrowableProxy[aithrowableproxy.length]; for(int i = 0; i < aithrowableproxy.length; i++) throwableproxyvo.suppressed[i] = build(aithrowableproxy[i]); } throwableproxyvo1 = throwableproxyvo; } return throwableproxyvo1; } public boolean equals(Object obj) { boolean flag = true; if(this != obj) goto _L2; else goto _L1 _L1: return flag; _L2: if(obj == null) { flag = false; continue; /* Loop/switch isn't completed */ } if(getClass() != obj.getClass()) { flag = false; continue; /* Loop/switch isn't completed */ } ThrowableProxyVO throwableproxyvo = (ThrowableProxyVO)obj; if(className == null) { if(throwableproxyvo.className != null) { flag = false; continue; /* Loop/switch isn't completed */ } } else if(!className.equals(throwableproxyvo.className)) { flag = false; continue; /* Loop/switch isn't completed */ } if(!Arrays.equals(stackTraceElementProxyArray, throwableproxyvo.stackTraceElementProxyArray)) flag = false; else if(!Arrays.equals(suppressed, throwableproxyvo.suppressed)) flag = false; else if(cause == null) { if(throwableproxyvo.cause != null) flag = false; } else if(!cause.equals(throwableproxyvo.cause)) flag = false; if(true) goto _L1; else goto _L3 _L3: } public IThrowableProxy getCause() { return cause; } public String getClassName() { return className; } public int getCommonFrames() { return commonFramesCount; } public String getMessage() { return message; } public StackTraceElementProxy[] getStackTraceElementProxyArray() { return stackTraceElementProxyArray; } public IThrowableProxy[] getSuppressed() { return suppressed; } public int hashCode() { int i; if(className == null) i = 0; else i = className.hashCode(); return i + 31; } private static final long serialVersionUID = 0xf54432135b2763ddL; private IThrowableProxy cause; private String className; private int commonFramesCount; private String message; private StackTraceElementProxy stackTraceElementProxyArray[]; private IThrowableProxy suppressed[]; }
d7e27991a591ae13b31fec7395a4ce2615445be7
c59595ed3e142591f6668d6cf68267ee6378bf58
/android/src/main/java/org/apache/http/impl/client/RedirectLocations.java
e1820e5ba62bd053a609632a42b8c1e74741c87a
[]
no_license
BBPL/ardrone
4c713a2e4808ddc54ae23c3bcaa4252d0f7b4b36
712c277850477b1115d5245885a4c5a6de3d57dc
refs/heads/master
2021-04-30T05:08:05.372486
2018-02-13T16:46:48
2018-02-13T16:46:48
121,408,031
1
1
null
null
null
null
UTF-8
Java
false
false
998
java
package org.apache.http.impl.client; import java.net.URI; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; import org.apache.http.annotation.NotThreadSafe; @NotThreadSafe public class RedirectLocations { private final List<URI> all = new ArrayList(); private final Set<URI> unique = new HashSet(); public void add(URI uri) { this.unique.add(uri); this.all.add(uri); } public boolean contains(URI uri) { return this.unique.contains(uri); } public List<URI> getAll() { return new ArrayList(this.all); } public boolean remove(URI uri) { boolean remove = this.unique.remove(uri); if (remove) { Iterator it = this.all.iterator(); while (it.hasNext()) { if (((URI) it.next()).equals(uri)) { it.remove(); } } } return remove; } }
42c35570ee4f1a3f9e190420657c32541ec7a23f
c4499650b694dc67fe3aea328b8853c7829b3748
/src/main/java/com/simran/ShoppingCart/utils/CommonResponseEntity.java
823226d95aac72a6aec12b32d46311a22cde0492
[]
no_license
SimranKaur25/Mybasket-backend
64ef69009a526c06a62cadd685a7ae7bd9471b09
6cdb5c0ec35018fe192e3d6252f182a5ca214dce
refs/heads/master
2023-03-21T14:20:27.751875
2021-03-07T19:52:54
2021-03-07T19:52:54
345,438,089
0
0
null
null
null
null
UTF-8
Java
false
false
2,514
java
package com.simran.ShoppingCart.utils; import java.util.LinkedHashMap; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Service; /** * @author Gursimran kaur * */ @Service("commonResponseEntity") public class CommonResponseEntity { private static final Logger logger = LoggerFactory.getLogger(CommonResponseEntity.class); public LinkedHashMap<String, Object> ResponseEntity(Map<String, Object> result) { LinkedHashMap<String, Object> resultMap = null; resultMap = new LinkedHashMap<String, Object>(); resultMap.put(ConstantVariables.REQUEST_STATUS, result.get(ConstantVariables.REQUEST_STATUS)); resultMap.put(ConstantVariables.RESPONSE_MSG, result.get(ConstantVariables.RESPONSE_MSG)); resultMap.put(ConstantVariables.RESPONSE_CODE, result.get(ConstantVariables.RESPONSE_CODE)); logger.info("Result :::::: " + resultMap); logger.info("success"); return resultMap; } public LinkedHashMap<String, Object> ResponseEntityWithMap(Object status, Object msg, Object code) { LinkedHashMap<String, Object> resultMap = null; resultMap = new LinkedHashMap<String, Object>(); resultMap.put(ConstantVariables.REQUEST_STATUS, status); resultMap.put(ConstantVariables.RESPONSE_MSG, msg); resultMap.put(ConstantVariables.RESPONSE_CODE, code); logger.info("Result :::::: " + resultMap); logger.info("success"); return resultMap; } public LinkedHashMap<String, Object> ResponseEntityWithMapAndData(Object status, Object msg, Object data, Object code) { LinkedHashMap<String, Object> resultMap = null; resultMap = new LinkedHashMap<String, Object>(); resultMap.put(ConstantVariables.REQUEST_STATUS, status); resultMap.put(ConstantVariables.RESPONSE_MSG, msg); resultMap.put(ConstantVariables.RESPONSE_DATA, data); resultMap.put(ConstantVariables.RESPONSE_CODE, code); logger.info("Result :::::: " + resultMap); logger.info("success"); return resultMap; } public LinkedHashMap<String, Object> ResponseEntityForException() { LinkedHashMap<String, Object> resultMap = new LinkedHashMap<String, Object>(); resultMap.put(ConstantVariables.REQUEST_STATUS, HttpStatus.INTERNAL_SERVER_ERROR); resultMap.put(ConstantVariables.RESPONSE_MSG, ConstantVariables.EXCEPTION_OCCURED); resultMap.put(ConstantVariables.RESPONSE_CODE,ResponseCode.EXCEPTION_CODE); logger.info("Result :::::: " + resultMap); logger.info("success"); return resultMap; } }
d0deaab9b5b54dfda277bb23e7f06ace1a0a0f51
a8c006af9c965cf4ecc38319a5219d63534c3aad
/AlgorithmsLabs/lab01_abstraction with a class in Java/src/simpleList.java
19b18e7818f80b994a719c13aba668589d73f4b3
[]
no_license
curiousTauseef/Software-Structures-and-Models
0531aa2cd3f41614b7ed2aefac8a422e8c129b5d
0df630c027e95af2b98079393738351675081e57
refs/heads/master
2021-01-18T19:04:44.455247
2016-05-04T10:48:10
2016-05-04T10:48:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,649
java
import java.util.Scanner; public class simpleList<T extends Comparable<T>> { private static final int MAX = 10; private int count; private T[] array; private void compress(T[] array, int empty_slot, int n) { for (int i = empty_slot + 1; i < n; i++) { array[i - 1] = array[i]; } } public simpleList() { count = 0; array = (T[]) new Comparable[MAX]; } public boolean empty() { return count == 0; } public int size() { return count; } public T at(int i) { return array[i]; } public boolean insert_to_end(T item) { if (count < MAX) { array[count++] = item; return true; } else { return false; } } public boolean insert(T item) { if (count < MAX) { int index = 0; if (array[index] != null) { // System.out.println(item); // System.out.println(array[index]); while (array[index] != null && item.compareTo(array[index]) > 0) { index++; } for (int i = count - 1; i >= index; i--) { array[i + 1] = array[i]; } } array[index] = item; // System.out.println("index:" + index); // System.out.println(array[index]); count++; return true; } else { return false; } } public boolean insert_to_begin(T item) { for (int i = count - 1; i >= 0; i--) { array[i + 1] = array[i]; } array[0] = item; count++; return true; } public int find_pos(T item) { for (int i = 0; i < count; i++) { if (array[i].compareTo(item) == 0) { return i; } } return -1; } public boolean del(int orderNo) { if (orderNo >= 0 && orderNo < count) { compress(array, orderNo, count); count--; return true; } else { return false; } } public static void main(String[] args) { simpleList<Time> list = new simpleList(); Time item; Scanner s = new Scanner(System.in); int i = 0; try { item = new Time(); item.read("Enter item? "); while (item.compareTo(new Time(0, 0)) != 0) { list.insert_to_begin(item); item = new Time(); item.read("Enter item? "); } //Print the contents of the list for (i = 1; i <= list.size(); i++) { System.out.print("\n " + i + "th item was " + list.at(i - 1)); } item = new Time(); item.read("\nDelete list item ?"); while (item.compareTo(new Time(0, 0)) != 0) { i = list.find_pos(item); if (i >= 0) { System.out.print("\nThe position of the item in list is " + i); list.del(i); } else { System.out.print("\nItem not found"); } item = new Time(); item.read("\nDelete list item ?"); } //Print the contents of the list for (i = 1; i <= list.size(); i++) { System.out.print("\n " + i + "th item was " + list.at(i - 1)); } System.out.println(); } catch (Exception e) { e.printStackTrace(); } } }
93dd5612a137ef1ff7dfc86160622f0d86a66d0f
cb8e59744cec10f4833b2d67f3b0b67b0335dac0
/pxf/pxf-service/src/main/java/com/pivotal/pxf/service/rest/MetadataResource.java
368a7a545f6fd51c1779c18e745bc6ce071b1d4e
[ "Apache-2.0", "PostgreSQL" ]
permissive
jiny2/incubator-hawq
4349937b90e3883202a4d7ffe7335d35b0d78a48
d6ac62b7c4569e9320e395beaa04db24e9e3b011
refs/heads/master
2021-01-15T19:13:09.913306
2015-10-10T03:10:12
2015-10-10T03:10:12
43,993,714
1
0
null
2015-10-10T04:18:24
2015-10-10T04:18:24
null
UTF-8
Java
false
false
3,192
java
package com.pivotal.pxf.service.rest; import java.io.IOException; import javax.servlet.ServletContext; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.apache.catalina.connector.ClientAbortException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.pivotal.pxf.api.Metadata; import com.pivotal.pxf.api.MetadataFetcher; import com.pivotal.pxf.service.MetadataFetcherFactory; import com.pivotal.pxf.service.MetadataResponseFormatter; /** * Class enhances the API of the WEBHDFS REST server. * Returns the metadata of a given hcatalog table. * Example for querying API FRAGMENTER from a web client * curl -i "http://localhost:51200/pxf/v13/Metadata/getTableMetadata?table=t1" * /pxf/ is made part of the path when there is a webapp by that name in tcServer. */ @Path("/" + Version.PXF_PROTOCOL_VERSION + "/Metadata/") public class MetadataResource extends RestResource { private Log Log; public MetadataResource() throws IOException { Log = LogFactory.getLog(MetadataResource.class); } /** * This function queries the HiveMetaStore to get the given table's metadata: * Table name, field names, field types. * The types are converted from HCatalog types to HAWQ types. * Supported HCatalog types: * TINYINT, SMALLINT, INT, BIGINT, BOOLEAN, FLOAT, DOUBLE, * STRING, BINARY, TIMESTAMP, DATE, DECIMAL, VARCHAR, CHAR. * Unsupported types result in an error. * * Response Examples: * For a table default.t1 with 2 fields (a int, b float) will be returned as: * {"PXFMetadata":[{"table":{"dbName":"default","tableName":"t1"},"fields":[{"name":"a","type":"int"},{"name":"b","type":"float"}]}]} */ @GET @Path("getTableMetadata") @Produces("application/json") public Response read(@Context final ServletContext servletContext, @Context final HttpHeaders headers, @QueryParam("table") final String table) throws Exception { Log.debug("getTableMetadata started"); String jsonOutput; try { // 1. start MetadataFetcher MetadataFetcher metadataFetcher = MetadataFetcherFactory.create("com.pivotal.pxf.plugins.hive.HiveMetadataFetcher"); //TODO: nhorn - 09-03-15 - pass as param // 2. get Metadata Metadata metadata = metadataFetcher.getTableMetadata(table); // 3. serialize to JSON jsonOutput = MetadataResponseFormatter.formatResponseString(metadata); Log.debug("getTableMetadata output: " + jsonOutput); } catch (ClientAbortException e) { Log.error("Remote connection closed by HAWQ", e); throw e; } catch (java.io.IOException e) { Log.error("Unhandled exception thrown", e); throw e; } return Response.ok(jsonOutput, MediaType.APPLICATION_JSON_TYPE).build(); } }
599ed4dfa12959851a26b123193519b2f91e70ac
c5551e7bb3da21ec0a1529bd0423ffed0584df13
/src/edu/utsa/cs3443/lab2/BigIntegerTest.java
f15926084bef4c19918086c75cfef6df4718bb4c
[]
no_license
tanvir-irfan/CS3443_ClassActivity
49ff38e30fa5a04ffcd52cbe3a5b4b74c0b119b8
75725aac3f64917a1bcef8ceacf59d5bd097dbf1
refs/heads/master
2020-08-03T00:47:24.750689
2019-11-18T16:34:15
2019-11-18T16:34:15
211,570,204
2
0
null
null
null
null
UTF-8
Java
false
false
2,114
java
package edu.utsa.cs3443.lab2; public class BigIntegerTest{ public static void main(String[] args) { BigInteger first, second; String num = "99999999999"; BigInteger b = new BigInteger(); System.out.println(b.toString()); b.setBigInteger("99999999999"); System.out.println(b.toString()); String num2 = "1"; BigInteger c = new BigInteger(num2); BigInteger d = c.add(b); System.out.println(c.toString()); System.out.println(c.increment()); System.out.println(c.toString()); first = new BigInteger("123456789"); second = new BigInteger("123"); System.out.println(first.multiply(second).toString()); System.out.println(first.add(second).toString()); System.out.println(first.increment().toString()); System.out.println(first.multiply(second).toString()); System.out.println(first.add(second).toString()); System.out.println(first.increment().toString()); int res = second.compareTo(new BigInteger("1234")); System.out.println(res); first = new BigInteger("12345678901234567654632498739473"); second = new BigInteger("12345678901234561247612748612746"); System.out.println(first.multiply(second).toString()); first = new BigInteger( "123456789012345678901234567890123456789012345678901234567890123456789012345678901654632498739473"); second = new BigInteger( "123456789012345678901234567890123456789012345678901234567890123456789012345678961247612748612746"); System.out.println(first.multiply(second).toString()); // my BigInteger.java does not have any divide function, however, they should have implemented it. Uncomment the following lines for testing their code. /* BigInteger x = new BigInteger("12345"); BigInteger y = new BigInteger(10); BigInteger z; z = x.add(y); z.show(); //prints 12355 z = x.subtract(y); z.show(); //prints 12335 y.setBigInteger("00"); z = x.multiply(y); z.show(); //prints 1234500 z = x.divide(10000); z.show(); //prints 123 z = x.mod(10); z.show(); //prints 5 x.increment(); x.show(); //prints 12346 x.decrement(); x.show(); */ } }
23150d3299f75544b7bf3f7d264d2a9d4957c12d
31b7d2067274728a252574b2452e617e45a1c8fb
/jpa-connector-beehive-bdk/com_V2.0.1.0.0/oracle/beehive/rest/UnsupportedAcceptHeaderFailure.java
91382d6682257d0812600e2e706111f7de004a41
[]
no_license
ericschan/open-icom
c83ae2fa11dafb92c3210a32184deb5e110a5305
c4b15a2246d1b672a8225cbb21b75fdec7f66f22
refs/heads/master
2020-12-30T12:22:48.783144
2017-05-28T00:51:44
2017-05-28T00:51:44
91,422,338
0
0
null
null
null
null
UTF-8
Java
false
false
2,378
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.3-hudson-jaxb-ri-2.2.3-3- // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2011.02.27 at 04:52:46 PM PST // package com.oracle.beehive.rest; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for unsupportedAcceptHeaderFailure complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="unsupportedAcceptHeaderFailure"> * &lt;complexContent> * &lt;extension base="{http://www.oracle.com/beehive/rest}failure"> * &lt;sequence> * &lt;element name="acceptedValues" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/> * &lt;/sequence> * &lt;/extension> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "unsupportedAcceptHeaderFailure", propOrder = { "acceptedValues" }) @XmlRootElement(name = "unsupportedAcceptHeaderFailure") public class UnsupportedAcceptHeaderFailure extends Failure { protected List<String> acceptedValues; /** * Gets the value of the acceptedValues property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the acceptedValues property. * * <p> * For example, to add a new item, do as follows: * <pre> * getAcceptedValues().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link String } * * */ public List<String> getAcceptedValues() { if (acceptedValues == null) { acceptedValues = new ArrayList<String>(); } return this.acceptedValues; } }
886c16b7e23857ebb7cfd4294620ab4c6484fa98
674189107e0702d19106b84381bf588a45b762a3
/RemoteSystemsTempFiles/src/com/fr/adaming/Domain/DecisionBean.java
177c1e861f9d01dd85b0a63c023d7a2d7173d043
[]
no_license
SebastienBobbia/JSFProject
54c5076f210275431cca6289b9f30fcce966284e
582afa44ee7f539f2e176cf88f972ee006981bc3
refs/heads/master
2020-05-05T09:02:42.106086
2019-04-11T08:11:05
2019-04-11T08:11:05
179,888,815
1
0
null
null
null
null
UTF-8
Java
false
false
5,781
java
package com.fr.adaming.Domain; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.annotation.PostConstruct; import javax.faces.bean.ManagedBean; import javax.faces.view.ViewScoped; import org.apache.jasper.tagplugins.jstl.core.ForEach; import com.formation.domain.Pays; @ManagedBean @ViewScoped public class DecisionBean implements Serializable { /** * */ private static final long serialVersionUID = 1L; public String nomPays ="France"; ArrayList<Hotel> listHotel = new ArrayList<Hotel>(); @PostConstruct public void init(){ listHotel.add(new Hotel("Belle Vue ***", "France","Lannion",60,false,true,true)); listHotel.add(new Hotel("Hotel des Bains **","France","La Ciotat",59.99,false,true,true)); listHotel.add(new Hotel("Camping des Pins ***","France","Trebeurden",25,false,true,true)); listHotel.add(new Hotel("Le Victoria ***","France","Cassis",72.50,false,true,true)); listHotel.add(new Hotel("Le Golden Oak ****","France","Aubagne",80,true,false,true)); listHotel.add(new Hotel("Grand Hotel du parc ***","France","Marseille",75.50,false,false,true)); listHotel.add(new Hotel("Le Graziela ***","France","Doizieux",38,false,true,true)); listHotel.add(new Hotel("Le Longchamp ****","France","Biscarosse",45,false,false,true)); listHotel.add(new Hotel("Hotel de l'Océan ***","France","Martigues",28,false,true,true)); listHotel.add(new Hotel("Camping Les vagues ***","France","Bayonne",22,true,true,true)); listHotel.add(new Hotel("Les flots bleus ***","Tahiti","To'ahotu",45,false,true,true)); listHotel.add(new Hotel("Camping des cocotiers ***","Tahiti","Mahina",35,true,true,true)); listHotel.add(new Hotel("Village des cabanons ****","Tahiti","Mahina",75.5,true,true,true)); listHotel.add(new Hotel("Camping Chez Lou **","Tahiti","Mahaena",30,false,true,false)); listHotel.add(new Hotel("Le Marina ****","Tahiti","Mahina",89.90,true,true,true)); listHotel.add(new Hotel("Club Mediterranée***","Tahiti","Papeete",50,true,true,true)); listHotel.add(new Hotel("Tetiaroa****","Tahiti","Faaone",80,true,true,true)); listHotel.add(new Hotel("L'Hibiscus***","Tahiti","Papeete",48.90,false,true,true)); listHotel.add(new Hotel("Camping les tiarés***","Tahiti","Papeete",37.90,true,true,true)); listHotel.add(new Hotel("Manava***","Tahiti","Mahaena",53.2,false,true,true)); listHotel.add(new Hotel("Tianzi ***","Chine","Shangai",80.2,false,true,true)); listHotel.add(new Hotel("Love Hotel ****","Chine","Shangai",90.5,true,true,true)); listHotel.add(new Hotel("Batman ***","Chine","Taiwan",110,false,true,true)); listHotel.add(new Hotel("Royal View ****", "Chine","Taizhou",85,true,true,true)); listHotel.add(new Hotel("L'empereur **","Chine","Taizhou",60,false,true,true)); listHotel.add(new Hotel("Village vacances ***","Chine","Taiwan",70,false,true,true)); listHotel.add(new Hotel("Le Shenzen ***","Chine","Hong-Kong",55.5,false,true,true)); listHotel.add(new Hotel("Bonham Hotel ***","Chine","Hong-Kong",66,false,true,true)); listHotel.add(new Hotel("Shūshì de jiā **","Chine","Hong-Kong",55,false,true,true)); listHotel.add(new Hotel("Lǜsè lǐngyù ***","Chine","Hong-Kong",65.9,false,true,true)); listHotel.add(new Hotel("Kényelmes otthon ***","Autriche","Thumersbach",75,false,true,true)); listHotel.add(new Hotel("Fenyők ***","Autriche","Oggau am Neusiedler See",70,false,true,true)); listHotel.add(new Hotel("Le Rissman ****","Autriche","Oggau am Neusiedler See",85.50,false,true,true)); listHotel.add(new Hotel("Faház ***","Autriche","Salzbourg",55,true,true,true)); listHotel.add(new Hotel("A Homan ****","Autriche","Salzbourg",89.9,true,true,true)); listHotel.add(new Hotel("A Wagner ****","Autriche","Salzbourg",90.5,true,true,true)); listHotel.add(new Hotel("Camping des Sapins ***","Autriche","Vienne",55,false,true,true)); listHotel.add(new Hotel("Camping Zell am See **","Autriche","Zell am See",53.2,true,true,true)); listHotel.add(new Hotel("St Georg***","Autriche","Thumersbach",65,false,true,true)); listHotel.add(new Hotel("Seevilla****","Autriche","Vienne",80,false,true,true)); listHotel.add(new Hotel("L'Aguirre ****","Espagne","Bilbao",75,true,true,true)); listHotel.add(new Hotel("En Alcaraz ***","Espagne","Bilbao",62,true,false,true)); listHotel.add(new Hotel("La Casa di Mama ***","Espagne","Getxo",55.50,false,true,true)); listHotel.add(new Hotel("Camping Granada ***","Espagne","Torrent",45,true,true,true)); listHotel.add(new Hotel("Palatio de Ines ****","Espagne","Torrent",53.2,true,true,true)); listHotel.add(new Hotel("Torre del Toro **","Espagne","Port de Sagunt",42.5,false,true,true)); listHotel.add(new Hotel("Aparto di Jardines ***","Espagne","Cullera",58,true,true,true)); listHotel.add(new Hotel("Bahia di Maria ***","Espagne","Monte Faro",53.2,false,true,true)); listHotel.add(new Hotel("Madison","Espagne","Almeria ****",72.50,true,true,true)); listHotel.add(new Hotel("Camping Adriano **","Espagne","Getxo",30.2,false,true,true)); } public String getNomPays() { return nomPays; } public void showHotel(){ System.out.println(data); } public static long getSerialversionuid() { return serialVersionUID; } public void setNomPays(String nomPays) { this.nomPays = nomPays; } private String data; public String getData() { return data; } public void setData(String data) { this.data = data; } List<Hotel> result = new ArrayList<Hotel>(); public List<Hotel> test() { for (Object Hotel : listHotel); if (listHotel.contains(data)) { result.addAll(listHotel); } return result; } }
c9a6dd7bbd955ebfe364c4a6130dd75702614031
ab6141e399a4aa8b990a86c0c9e8a326b218e3f9
/src/day23_arraysAndNumbers/PrimeNumber.java
73b8845d8443d39ae64cf0842d11155927028cd3
[]
no_license
ethemsoylemez/JavaProgramingSpring2019
73027ca16d1ea38fda492ef39aaf2eabe82cbe04
61348862e9a10f6282be76e0e457f5c48983a602
refs/heads/master
2020-05-18T15:58:34.339214
2019-07-15T02:10:54
2019-07-15T02:10:54
184,358,599
0
0
null
null
null
null
UTF-8
Java
false
false
487
java
package day23_arraysAndNumbers; import java.util.Scanner; public class PrimeNumber { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Enter a number:"); int number = scan.nextInt(); int count=0; for (int i = 1; i < number; i++) { if (number % i == 0) { count++; } }if (count==1) { System.out.println(number + " is prime"); }else { System.out.println(number + " is not prime"); } scan.close(); } }
62ac4e0c4a88982d756bf9626965826dc4655b76
d6cf28d1b37216c657d23d8e512c15bdd9d3f226
/app/src/main/java/com/foreveross/atwork/modules/chat/component/chat/reference/RightReferencedStickerMessageChatItemView.java
927a4e08cbd3f1d79c970a51f3632014b6565759
[ "MIT" ]
permissive
AoEiuV020/w6s_lite_android
a2ec1ca8acdc848592266b548b9ac6b9a4117cd3
1c4ca5bdaea6d5230d851fb008cf2578a23b2ce5
refs/heads/master
2023-08-22T00:46:03.054115
2021-10-27T06:21:32
2021-10-27T07:45:41
421,650,297
1
0
null
null
null
null
UTF-8
Java
false
false
6,874
java
package com.foreveross.atwork.modules.chat.component.chat.reference; import android.content.Context; import android.content.Intent; import android.view.LayoutInflater; import android.view.View; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import androidx.annotation.NonNull; import com.foreverht.workplus.module.sticker.activity.StickerViewActivity; import com.foreveross.atwork.R; import com.foreveross.atwork.infrastructure.newmessage.post.ChatPostMessage; import com.foreveross.atwork.infrastructure.newmessage.post.chat.StickerChatMessage; import com.foreveross.atwork.infrastructure.newmessage.post.chat.reference.ReferenceMessage; import com.foreveross.atwork.modules.chat.component.ChatSendStatusView; import com.foreveross.atwork.modules.chat.component.chat.MessageSourceView; import com.foreveross.atwork.modules.chat.component.chat.SomeStatusView; import com.foreveross.atwork.modules.chat.component.chat.definition.IStickerChatView; import com.foreveross.atwork.modules.chat.data.AnchorInfo; import com.foreveross.atwork.modules.chat.presenter.StickerChatViewRefreshUIPresenter; import com.foreveross.atwork.modules.chat.util.AutoLinkHelper; import com.foreveross.atwork.support.AtworkBaseActivity; import com.foreveross.atwork.utils.ThemeResourceHelper; import org.jetbrains.annotations.NotNull; public class RightReferencedStickerMessageChatItemView extends RightBasicReferenceUserChatItemView implements IStickerChatView { private View mVRoot; private ImageView mIvAvatar; private LinearLayout mLlContent; private ImageView mIvSelect; private ChatSendStatusView mChatSendStatusView; private ReferenceMessage mReferencedChatMessage; private TextView mTvAuthorName; private FrameLayout mFlReply; private TextView mTvReply; private ImageView mIvContent; private LinearLayout mLlSomeStatusInfoWrapperParent; private LinearLayout mLlSomeStatusInfo; private TextView mTvTime; private ImageView mIvSomeStatus; public RightReferencedStickerMessageChatItemView(Context context) { super(context); findView(); registerListener(); mChatViewRefreshUIPresenter = new StickerChatViewRefreshUIPresenter(this); } @Override protected View getMessageRootView() { return mVRoot; } @Override protected ChatSendStatusView getChatSendStatusView() { return mChatSendStatusView; } @Override protected ImageView getAvatarView() { return mIvAvatar; } @Override protected ImageView getSelectView() { return mIvSelect; } @Override protected MessageSourceView getMessageSourceView() { return null; } @Override protected ChatPostMessage getMessage() { return mReferencedChatMessage; } @Override protected void registerListener() { super.registerListener(); mLlContent.setOnClickListener(v -> { AutoLinkHelper.getInstance().setLongClick(false); if (mSelectMode) { mReferencedChatMessage.select = !mReferencedChatMessage.select; select(mReferencedChatMessage.select); } else { mChatItemClickListener.referenceClick(mReferencedChatMessage); } }); mLlContent.setOnLongClickListener(v -> { AutoLinkHelper.getInstance().setLongClick(true); AnchorInfo anchorInfo = getAnchorInfo(); if (!mSelectMode) { mChatItemLongClickListener.referenceLongClick(mReferencedChatMessage, anchorInfo); return true; } return false; }); mIvContent.setOnClickListener(v -> { if(mReferencedChatMessage.mReferencingMessage instanceof StickerChatMessage) { Context context = getContext(); Intent intent = StickerViewActivity.Companion.getIntent(context, (StickerChatMessage) mReferencedChatMessage.mReferencingMessage); if(context instanceof AtworkBaseActivity) { ((AtworkBaseActivity)context).startActivity(intent, false); } else { context.startActivity(intent); } } }); } private void findView() { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.chat_right_referenced_sticker_message, this); mVRoot = view.findViewById(R.id.rl_root); mIvAvatar = view.findViewById(R.id.chat_right_text_avatar); mLlContent = view.findViewById(R.id.ll_chat_right_content); mTvAuthorName = view.findViewById(R.id.tv_title); mIvContent = view.findViewById(R.id.iv_content); mFlReply = view.findViewById(R.id.fl_reply); mTvReply = view.findViewById(R.id.tv_reply); mIvSelect = view.findViewById(R.id.right_text_select); mChatSendStatusView = view.findViewById(R.id.chat_right_text_send_status); mLlSomeStatusInfoWrapperParent = view.findViewById(R.id.ll_some_status_info_wrapper_parent); mLlSomeStatusInfo = view.findViewById(R.id.ll_some_status_info); mTvTime = view.findViewById(R.id.tv_time); mIvSomeStatus = view.findViewById(R.id.iv_some_status); } @Override protected SomeStatusView getSomeStatusView() { return SomeStatusView .newSomeStatusView() .setVgSomeStatusWrapperParent(mLlSomeStatusInfoWrapperParent) .setTvContentShow(mTvReply) .setIvStatus(mIvSomeStatus) .setIconDoubleTick(R.mipmap.icon_double_tick_white) .setIconOneTick(R.mipmap.icon_one_tick_white) .setTvTime(mTvTime) .setMaxTvContentWidthBaseOn(mFlReply, mLlSomeStatusInfo) .setLlSomeStatusInfo(mLlSomeStatusInfo); } @Override public void refreshItemView(ChatPostMessage message) { super.refreshItemView(message); mReferencedChatMessage = (ReferenceMessage) message; } @Override protected void burnSkin() { ThemeResourceHelper.setChatRightViewColorBg9Drawable(mLlContent); } @Override protected void themeSkin() { ThemeResourceHelper.setChatRightViewColorBg9Drawable(mLlContent); } @NonNull @Override protected View getContentRootView() { return mLlContent; } @Override TextView getAuthorNameView() { return mTvAuthorName; } @Override TextView getReplyView() { return mTvReply; } @NotNull @Override public ImageView contentView() { return mIvContent; } }
9b57b51e5964bf0b8d7b35e25d3d54cf8b389963
c670fe9624e7490e262e90716145fe1f966a9f60
/lib_util/src/main/java/com/leezp/lib/util/tuples/Tuple3.java
8f92d700c9c08b6b38aa7a8bcac493cd9bc01fd1
[]
no_license
15608447849/lbs_driver
8c747a15ae43555840c75dc8f168fa14fa54b949
f675232d5f51def0cad386c7cfa4574149d8ba49
refs/heads/master
2020-03-27T17:38:12.646649
2018-12-25T09:48:54
2018-12-25T09:48:54
146,863,268
3
0
null
null
null
null
UTF-8
Java
false
false
342
java
package com.leezp.lib.util.tuples; /** * Created by Leeping on 2018/4/8. * email: [email protected] */ public class Tuple3<A,B,C> extends Tuple2<A,B> implements Tuple.IValue2<C> { public Tuple3(A a, B b,C c) { super(new Object[]{a,b,c}); } @Override public C getValue2() { return (C)getValue(2); } }
9786bf6867d11975d4adf5f869e52194ddb71036
c3445da9eff3501684f1e22dd8709d01ff414a15
/LIS/sinosoft-parents/lis-business/src/main/java/com/sinosoft/lis/xbcheck/RnewUWSpecBL.java
6b101e7bb87d2542480c52f7ad152118f15e4973
[]
no_license
zhanght86/HSBC20171018
954403d25d24854dd426fa9224dfb578567ac212
c1095c58c0bdfa9d79668db9be4a250dd3f418c5
refs/heads/master
2021-05-07T03:30:31.905582
2017-11-08T08:54:46
2017-11-08T08:54:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
14,699
java
package com.sinosoft.lis.xbcheck; import org.apache.log4j.Logger; import com.sinosoft.lis.db.LCCSpecDB; import com.sinosoft.lis.db.RnewIndUWMasterDB; import com.sinosoft.lis.db.RnewIndUWSubDB; import com.sinosoft.lis.pubfun.GlobalInput; import com.sinosoft.lis.pubfun.MMap; import com.sinosoft.lis.pubfun.PubFun; import com.sinosoft.lis.pubfun.PubFun1; import com.sinosoft.lis.pubfun.PubSubmit; import com.sinosoft.lis.schema.LCCSpecSchema; import com.sinosoft.lis.schema.RnewIndUWMasterSchema; import com.sinosoft.lis.schema.RnewIndUWSubSchema; import com.sinosoft.lis.vschema.LCCSpecSet; import com.sinosoft.lis.vschema.RnewIndUWSubSet; import com.sinosoft.utility.CError; import com.sinosoft.utility.CErrors; import com.sinosoft.utility.SQLwithBindVariables; import com.sinosoft.utility.TransferData; import com.sinosoft.utility.VData; /** * <p> * Title: * </p> * <p> * Description: * </p> * <p> * Copyright: Copyright (c) 2004 * </p> * <p> * Company: * </p> * * @author zhangxing * @version 1.0 */ public class RnewUWSpecBL { private static Logger logger = Logger.getLogger(RnewUWSpecBL.class); /** 错误处理类,每个需要错误处理的类中都放置该类 */ public CErrors mErrors = new CErrors(); /** 往后面传输数据的容器 */ private VData mInputData; /** 往界面传输数据的容器 */ private VData mResult = new VData(); private TransferData mTransferData = new TransferData(); /** 传输数据的容器 */ private GlobalInput mGlobalInput = new GlobalInput(); // private VData mIputData = new VData(); /** 数据操作字符串 */ private String mOperater; private String mManageCom; private String mOperate; /** 业务数据操作字符串 */ private String mContNo; private String mPrtNo; private String mCustomerNo; private String mSpecReason; private String mRemark; private String mOperatetype; private String mProposalContNo; private String mSerialno; private String mCurrentDate = PubFun.getCurrentDate(); private String mCurrentTime = PubFun.getCurrentTime(); /** 被保人核保主表 */ private RnewIndUWMasterSchema mRnewIndUWMasterSchema = new RnewIndUWMasterSchema(); /** 被保人核保子表 */ private RnewIndUWSubSchema mRnewIndUWSubSchema = new RnewIndUWSubSchema(); /** 特约表 */ private LCCSpecSchema mLCCSpecSchema = new LCCSpecSchema(); private LCCSpecSchema tLCCSpecSchema = new LCCSpecSchema(); //private LBCSpecSet mLBCSpecSet = new LBCSpecSet(); public RnewUWSpecBL() { } /** * 传输数据的公共方法 * * @param: cInputData 输入的数据 cOperate 数据操作 * @return: */ public boolean submitData(VData cInputData, String cOperate) { // 得到外部传入的数据,将数据备份到本类中 if (!getInputData(cInputData, cOperate)) { return false; } // 校验是否有未打印的体检通知书 if (!checkData()) { return false; } // 进行业务处理 if (!dealData()) { return false; } // 准备往后台的数据 if (!prepareOutputData()) { return false; } PubSubmit tSubmit = new PubSubmit(); if (!tSubmit.submitData(mResult, "")) { // @@错误处理 this.mErrors.copyAllErrors(tSubmit.mErrors); CError.buildErr(this, "数据提交失败!"); return false; } return true; } /** * 根据前面的输入数据,进行BL逻辑处理 如果在处理过程中出错,则返回false,否则返回true */ private boolean dealData() { // 核保特约信息 if (prepareSpec() == false) { return false; } return true; } /** * 校验业务数据 * * @return */ private boolean checkData() { // 校验保单信息 // LCPolDB tLCPolDB = new LCPolDB(); // logger.debug("mPolNo check " + mPolNo); // tLCPolDB.setPolNo(mPolNo); // // mLCPolSchema.setSchema(tLCPolDB); // mPrtNo = mLCPolSchema.getPrtNo(); /* // // 处于未打印状态的核保通知书在打印队列中只能有一个 // // 条件:同一个单据类型,同一个其它号码,同一个其它号码类型 LOPRTManagerDB tLOPRTManagerDB = new LOPRTManagerDB(); tLOPRTManagerDB.setCode(PrintManagerBL.CODE_UW); // 核保通知书 tLOPRTManagerDB.setOtherNo(mContNo); tLOPRTManagerDB.setOtherNoType(PrintManagerBL.ONT_INDPOL); // 保单号 tLOPRTManagerDB.setStandbyFlag2(mLCPolSchema.getPrtNo()); tLOPRTManagerDB.setStateFlag("0"); LOPRTManagerSet tLOPRTManagerSet = tLOPRTManagerDB.query(); if (tLOPRTManagerSet == null) { // @@错误处理 CError tError = new CError(); tError.moduleName = "PRnewUWAutoHealthAfterInitService"; tError.functionName = "preparePrint"; tError.errorMessage = "查询打印管理表信息出错!"; this.mErrors.addOneError(tError); return false; } if (tLOPRTManagerSet.size() != 0) { // @@错误处理 CError tError = new CError(); tError.moduleName = "PRnewUWAutoHealthAfterInitService"; tError.functionName = "preparePrint"; tError.errorMessage = "在打印队列中已有一个处于未打印状态的核保通知书!"; this.mErrors.addOneError(tError); return false; } */ return true; } /** * 从输入数据中得到所有对象 输出:如果没有得到足够的业务数据对象,则返回false,否则返回true */ private boolean getInputData(VData cInputData, String cOperate) { // 从输入数据中得到所有对象 // 获得全局公共数据 mGlobalInput.setSchema((GlobalInput) cInputData.getObjectByObjectName( "GlobalInput", 0)); //tongmeng 2008-10-08 modify //启用合同特约 mLCCSpecSchema = (LCCSpecSchema) cInputData.getObjectByObjectName( "LCCSpecSchema", 0); mRnewIndUWMasterSchema = (RnewIndUWMasterSchema) cInputData .getObjectByObjectName("RnewIndUWMasterSchema", 0); mTransferData = (TransferData) cInputData.getObjectByObjectName( "TransferData", 0); mOperatetype = (String) mTransferData.getValueByName("Operatetype"); logger.debug("*****mOperatetype*****" + mOperatetype); mProposalContNo = (String) mTransferData.getValueByName("ProposalContNo"); logger.debug("*****mProposalContNo*****" + mProposalContNo); mSerialno = (String) mTransferData.getValueByName("Serialno"); logger.debug("*****mSerialno*****" + mSerialno); mContNo = (String) mTransferData.getValueByName("ContNo"); logger.debug("*****mContNo*****" + mContNo); if (mContNo == null || mContNo.trim().equals("")) { // @@错误处理 // this.mErrors.copyAllErrors( tLCPolDB.mErrors ); CError.buildErr(this,"前台传输数据ContNo失败"); return false; } mCustomerNo = (String) mTransferData.getValueByName("CustomerNo"); logger.debug("*****mCustomerNo*****" + mCustomerNo); if (mCustomerNo == null || mCustomerNo.trim().equals("")) { // @@错误处理 // this.mErrors.copyAllErrors( tLCPolDB.mErrors ); CError.buildErr(this,"前台传输数据CustomerNo失败"); return false; } mInputData = cInputData; if (mGlobalInput == null) { // @@错误处理 // this.mErrors.copyAllErrors( tLCPolDB.mErrors ); CError.buildErr(this,"前台传输全局公共数据失败"); return false; } if (mRnewIndUWMasterSchema == null) { // @@错误处理 // this.mErrors.copyAllErrors( tLCPolDB.mErrors ); CError.buildErr(this,"前台传输全局公共数据失败"); return false; } // 获得操作员编码 mOperater = mGlobalInput.Operator; if (mOperater == null || mOperater.trim().equals("")) { // @@错误处理 // this.mErrors.copyAllErrors( tLCPolDB.mErrors ); CError.buildErr(this,"前台传输全局公共数据Operate失败"); return false; } // 获得登陆机构编码 mManageCom = mGlobalInput.ManageCom; if (mManageCom == null || mManageCom.trim().equals("")) { // @@错误处理 // this.mErrors.copyAllErrors( tLCPolDB.mErrors ); CError.buildErr(this,"前台传输全局公共数据ManageCom失败"); return false; } mOperate = cOperate; return true; } /** * 准备特约资料信息 输出:如果发生错误则返回false,否则返回true */ private boolean prepareSpec() { // 准备续保核保主表信息 //取合同下的第一被保人的主险编码 // String tSQL = "select polno from lcpol where contno='"+this.mLCCSpecSchema.getContNo()+"' and insuredno='"+this.mLCCSpecSchema.getCustomerNo()+"' " // + " and (risksequence is null or risksequence='1') and polno=mainpolno "; // String tPolNo = ""; // ExeSQL tExeSQL = new ExeSQL(); // tPolNo = tExeSQL.getOneValue(tSQL); // if(tPolNo==null||tPolNo.equals("")) // { // CError.buildErr(this,"查询合同下的第一主险保单号失败!"); // return false; // } RnewIndUWMasterDB tRnewIndUWMasterDB = new RnewIndUWMasterDB(); tRnewIndUWMasterDB.setContNo(mContNo); tRnewIndUWMasterDB.setInsuredNo(mCustomerNo); if (tRnewIndUWMasterDB.getInfo() == false) { // @@错误处理 CError.buildErr(this,"查询被保人核保主表出错!"); return false; } //准备核保主表数据 mRnewIndUWMasterSchema.setSchema(tRnewIndUWMasterDB); String tSpecReason = mLCCSpecSchema.getSpecReason(); if (mOperatetype.equals("DELETE")) { mRnewIndUWMasterSchema.setSpecReason(""); LCCSpecDB tLCCSpecDB = new LCCSpecDB(); tLCCSpecDB.setContNo(mContNo); tLCCSpecDB.setCustomerNo(mCustomerNo); tLCCSpecDB.setNeedPrint("Y"); LCCSpecSet tLCCSpecSet = new LCCSpecSet(); tLCCSpecSet = tLCCSpecDB.query(); if (tLCCSpecSet == null) { CError.buildErr(this,"全部特约信息查询出错!"); return false; } mRnewIndUWMasterSchema.setSpecReason("删除一条特约"); // 特约原因 if(tLCCSpecSet.size()>1) mRnewIndUWMasterSchema.setSpecFlag("1"); // 特约标识 else mRnewIndUWMasterSchema.setSpecFlag("0"); // 特约标识 } else { if (tSpecReason != null && !tSpecReason.trim().equals("")) { mRnewIndUWMasterSchema.setSpecReason(tSpecReason); } else { mRnewIndUWMasterSchema.setSpecReason(""); } mRnewIndUWMasterSchema.setSpecFlag("1"); // 特约标识 } mRnewIndUWMasterSchema.setOperator(mOperater); mRnewIndUWMasterSchema.setManageCom(mManageCom); mRnewIndUWMasterSchema.setModifyDate(PubFun.getCurrentDate()); mRnewIndUWMasterSchema.setModifyTime(PubFun.getCurrentTime()); // 准备被保人核保子表数据 RnewIndUWSubDB tRnewIndUWSubDB = new RnewIndUWSubDB(); String tSql = "select * from RnewIndUWSub where contno='?mContNo?' and insuredno='?mCustomerNo?' order by uwno desc"; SQLwithBindVariables sqlbv=new SQLwithBindVariables(); sqlbv.sql(tSql); sqlbv.put("mContNo", mContNo); sqlbv.put("mCustomerNo", mCustomerNo); RnewIndUWSubSet tRnewIndUWSubSet = new RnewIndUWSubSet(); tRnewIndUWSubSet = tRnewIndUWSubDB.executeQuery(sqlbv); if(tRnewIndUWSubSet==null) { CError.buildErr(this,"查询被保人核保子表出错!"); return false; } mRnewIndUWSubSchema = tRnewIndUWSubSet.get(1); mRnewIndUWSubSchema.setProposalContNo(mRnewIndUWMasterSchema.getProposalContNo()); mRnewIndUWSubSchema.setUWNo(tRnewIndUWSubSet.get(1).getUWNo() + 1); mRnewIndUWSubSchema.setSpecReason(mRnewIndUWMasterSchema.getSpecReason()); mRnewIndUWSubSchema.setSpecFlag(mRnewIndUWMasterSchema.getSpecFlag()); mRnewIndUWSubSchema.setOperator(mOperater); // 操作员 mRnewIndUWSubSchema.setMakeDate(PubFun.getCurrentDate()); mRnewIndUWSubSchema.setMakeTime(PubFun.getCurrentTime()); mRnewIndUWSubSchema.setModifyDate(PubFun.getCurrentDate()); mRnewIndUWSubSchema.setModifyTime(PubFun.getCurrentTime()); // 准备特约的数据 if (mLCCSpecSchema != null) { //启用合同特约 LCCSpecDB tLCCSpecDB = new LCCSpecDB(); tLCCSpecDB.setSchema(this.mLCCSpecSchema); if(!this.mOperatetype.equals("INSERT")) { if (mSerialno == null || mSerialno == "") { CError.buildErr(this,"前台传送Serialno出错"); return false; } tLCCSpecDB.setProposalContNo(this.mProposalContNo); tLCCSpecDB.setSerialNo(this.mSerialno); if (!tLCCSpecDB.getInfo()) { CError.buildErr(this, "查询特约出错!"); } tLCCSpecSchema = tLCCSpecDB.getSchema(); } if (mOperatetype.equals("DELETE")) { } else if (mOperatetype.equals("UPDATE")) { if(!mLCCSpecSchema.getSpecContent().equals("")) tLCCSpecSchema.setSpecContent(mLCCSpecSchema.getSpecContent());//修改特约内容 if(!mLCCSpecSchema.getNeedPrint().equals("")) tLCCSpecSchema.setNeedPrint(mLCCSpecSchema.getNeedPrint());//修改下发标记 if(!mLCCSpecSchema.getSpecCode().equals("")) tLCCSpecSchema.setSpecCode(mLCCSpecSchema.getSpecCode()); if(!mLCCSpecSchema.getSpecType().equals("")) tLCCSpecSchema.setSpecType(mLCCSpecSchema.getSpecType()); if(!mLCCSpecSchema.getSpecReason().equals("")) tLCCSpecSchema.setSpecReason(mLCCSpecSchema.getSpecReason()); tLCCSpecSchema.setModifyDate(mCurrentDate); tLCCSpecSchema.setModifyTime(mCurrentTime); } else // INSERT { tLCCSpecSchema.setSerialNo(PubFun1.CreateMaxNo("SpecCode", PubFun.getNoLimit(mGlobalInput.ComCode))); tLCCSpecSchema.setGrpContNo(mRnewIndUWMasterSchema.getGrpContNo()); tLCCSpecSchema.setProposalContNo(mRnewIndUWMasterSchema.getProposalContNo()); tLCCSpecSchema.setContNo(mContNo); tLCCSpecSchema.setCustomerNo(mCustomerNo); //mLCCSpecSchema.setPrtFlag("1"); tLCCSpecSchema.setBackupType(""); tLCCSpecSchema.setSpecCode(mLCCSpecSchema.getSpecCode()); tLCCSpecSchema.setSpecType(mLCCSpecSchema.getSpecType()); tLCCSpecSchema.setSpecContent(mLCCSpecSchema.getSpecContent()); tLCCSpecSchema.setSpecReason(mLCCSpecSchema.getSpecReason()); tLCCSpecSchema.setNeedPrint(mLCCSpecSchema.getNeedPrint()); tLCCSpecSchema.setOperator(mOperater); tLCCSpecSchema.setMakeDate(mCurrentDate); tLCCSpecSchema.setMakeTime(mCurrentTime); tLCCSpecSchema.setModifyDate(mCurrentDate); tLCCSpecSchema.setModifyTime(mCurrentTime); } } return true; } /** * 准备返回前台统一存储数据 输出:如果发生错误则返回false,否则返回true */ private boolean prepareOutputData() { mResult.clear(); MMap map = new MMap(); // 添加本次续保特约数据 if (tLCCSpecSchema != null) { map.put(tLCCSpecSchema, mOperatetype); } // 添加续保批单核保主表通知书打印管理表数据 map.put(mRnewIndUWMasterSchema, "UPDATE"); map.put(mRnewIndUWSubSchema, "INSERT"); mResult.add(map); return true; } public VData getResult() { return mResult; } public CErrors getErrors() { return mErrors; } }
760f6d8c22961ca70917330a3b3ecfd7bf3e73f2
8810850a4aa6b5cf69580ce192ccc98b58a67448
/src/main/java/com/ziguar/wfengine/api/ComponentAPI.java
3d4aa90491b698ccaa504bb499f9847eb37a8d4b
[]
no_license
tanmaybinaykiya/WorkflowAPI
05200a0357dc8eb3545e3cd5621f9ec9072e6ae5
5fd6e44fcdbe5d86d47d4453a27eb4c6a47106e4
refs/heads/master
2020-04-19T04:17:21.870931
2019-01-28T12:35:25
2019-01-28T12:35:25
167,958,890
0
0
null
null
null
null
UTF-8
Java
false
false
282
java
package com.ziguar.wfengine.api; import javax.ws.rs.PUT; import javax.ws.rs.Path; import com.ziguar.wfengine.api.view.CreateComponentView; @Path("/api/v1/component") public interface ComponentAPI { @PUT public String createComponent(CreateComponentView createComponent); }
a18c5d1710169266c12382da47937f2736f27a6b
995fccc3026fa474da6af9cb87237ba4640a25e9
/src/main/java/com/lothrazar/cyclicmagic/enchantment/EnchantBase.java
d9fa05a4b5b32eb06be1aa4e781a30e888aa75b5
[ "MIT" ]
permissive
Aemande123/Cyclic
51c8f9d9068c95783dbb6c426e28e86a26bd58b5
f457d243104ab2495b06f7acca0fda453b401145
refs/heads/master
2021-04-09T16:19:24.329957
2018-03-18T03:24:45
2018-03-18T03:24:45
99,875,313
0
0
null
2017-08-10T03:06:18
2017-08-10T03:06:18
null
UTF-8
Java
false
false
2,850
java
/******************************************************************************* * The MIT License (MIT) * * Copyright (C) 2014-2018 Sam Bassett (aka Lothrazar) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. ******************************************************************************/ package com.lothrazar.cyclicmagic.enchantment; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.enchantment.EnumEnchantmentType; import net.minecraft.entity.EntityLivingBase; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemStack; public abstract class EnchantBase extends Enchantment { protected EnchantBase(String name, Rarity rarityIn, EnumEnchantmentType typeIn, EntityEquipmentSlot[] slots) { super(rarityIn, typeIn, slots); this.setName(name); } protected int getCurrentLevelTool(ItemStack stack) { if (stack.isEmpty() == false && EnchantmentHelper.getEnchantments(stack).containsKey(this)) return EnchantmentHelper.getEnchantments(stack).get(this); return -1; } protected int getCurrentLevelTool(EntityLivingBase player) { if (player == null) { return -1; } ItemStack main = player.getHeldItemMainhand(); ItemStack off = player.getHeldItemOffhand(); return Math.max(getCurrentLevelTool(main), getCurrentLevelTool(off)); } protected ItemStack getFirstArmorStackWithEnchant(EntityLivingBase player) { if (player == null) { return ItemStack.EMPTY; } for (ItemStack main : player.getArmorInventoryList()) { if ((main.isEmpty() == false) && EnchantmentHelper.getEnchantments(main).containsKey(this)) { return main;// EnchantmentHelper.getEnchantments(main).get(this); } } return ItemStack.EMPTY; } }
5589deb847480792db987a37d0522ef62ac6e71e
f7b8ba7da9e025bd84f004371602da0230d5a79f
/U5A_Question2.java
0c793c4be7157fa8baa92311e8f00051f471cabc
[]
no_license
Josh-Turman18/Week1-MCQ-Corrections
46b8777e69921f057727c55333ca50e67d034088
404ed2ee38f3722533e5b3c160ea7ce19184677d
refs/heads/master
2021-03-16T02:37:50.654778
2020-03-13T06:42:37
2020-03-13T06:42:37
246,897,010
0
0
null
null
null
null
UTF-8
Java
false
false
439
java
/** * Executes Unit 5A Question 2 and explains the solution * * @Josh Turman * @1.0 */ public class U5A_Question2 { public U5A_Question2() { } public void go() { System.out.println("\nQuestion 2: "); Q2_Thing run_Thing = new run_Thing("There is no output for Question 4,The class\nQ2_Thing was just created in the correct way"); run_Thing.helper(); } }
17b4ceeb7075aa91ff81ab577f531999abaee99c
642e90aa1c85330cee8bbe8660ca277655bc4f78
/gameserver/src/main/java/l2s/gameserver/stats/triggers/TriggerType.java
91776960fd20af528cc43083025fb90b56eccb1f
[]
no_license
BETAJIb/Studious
ac329f850d8c670d6e355ef68138c9e8fd525986
328e344c2eaa70238c403754566865e51629bd7b
refs/heads/master
2020-04-04T08:41:21.112223
2018-10-31T20:18:49
2018-10-31T20:18:49
155,790,706
0
0
null
null
null
null
UTF-8
Java
false
false
1,987
java
package l2s.gameserver.stats.triggers; /** * @author VISTALL * @date 15:05/22.01.2011 */ public enum TriggerType { ADD, // Срабатывает при добавлении скилла. ATTACK, RECEIVE_DAMAGE, // Срабатывает при получении урона CRIT, // Срабатывает при крите OFFENSIVE_PHYSICAL_SKILL_USE, // Срабатывает при юзе Физ скилов OFFENSIVE_MAGICAL_SKILL_USE, // Срабатывает при юзе Маг скилов SUPPORT_MAGICAL_SKILL_USE, // Срабатывает при юзе баффов UNDER_MISSED_ATTACK, DIE, // Срабатывает при смерти IDLE, // Срабатывает каждый раз через определенное время. В качестве таймера используется время отката умения, к которому привязан триггер. ON_REVIVE, // Срабатывает при воскрешении персонажа. ON_START_EFFECT, // Срабатывает при старте эффекта. ON_EXIT_EFFECT, // Срабатывает по завершению эффекта (любым способом: время вышло, принудительно и т.д.). ON_FINISH_EFFECT, // Срабатывает по завершению времени действия эффекта. ON_START_CAST, // Срабатывает при начале каста. ON_TICK_CAST, ON_END_CAST, // Срабатывает после завершения времени каста скилла. ON_FINISH_CAST, // Срабатывает после успешного использования скилла (учитывая c coolTime). ON_ENTER_WORLD, // Срабатывает при входе в игру. ON_KILL, // Срабатывает при убийстве противника. ON_CAST_SKILL; // Срабатывает при касте определенного скилла. }
12b8997544c873a1423af93df6b855718c052c69
97592d1c30ff55b164fdf34ce6ce459e68ce3793
/src/test/java/com/company/bloomfilter/BloomFilterDemoApplicationTests.java
4bf388676729949c80be91a4f691e7f58d1aa9e5
[]
no_license
Nguyen-Vm/bloom-filter-demo
46b0820d2597d0ee06b00732f62a06b0ed859b58
b08d8c83c130fc4a214896a3d6069b544a00636d
refs/heads/master
2023-07-09T04:45:52.342769
2021-08-20T02:24:34
2021-08-20T02:24:34
398,130,777
0
0
null
null
null
null
UTF-8
Java
false
false
858
java
package com.company.bloomfilter; import com.company.bloomfilter.repo.dao.po.User; import com.company.bloomfilter.repo.repository.UserRepository; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; import javax.annotation.Resource; @SpringBootTest @Slf4j class BloomFilterDemoApplicationTests { @Resource private UserRepository userRepository; @Test void contextLoads() { /*User user = new User(); user.setId(1L); user.setName("阮威敏"); user.setBirthday(LocalDate.of(1995, 9, 4)); user.setPhoneNumber("18621629072"); user.setGraduatedSchool("江西师范大学"); userRepository.save(user);*/ User userInfo = userRepository.getUserById(1L); log.info("user: {}", userInfo); } }
bed6dd282caad3fc2af00e3351afac54de3a2adc
df3f223a352365cd86823bffadddbb92b0e20b4d
/spring-cloud-user/src/main/java/com/duke/DukeTest.java
464fbfe3e8c82d90eb3d0316831bb7c92211ed05
[]
no_license
WeakyDuke/springCloud
bb4829fbfef8d0fd9a927bbc2688461c3b47ffb3
8ddb9a3d23c8b04ab97bc6b21300df9edd8323ce
refs/heads/master
2022-06-24T23:07:17.455480
2020-05-05T16:37:28
2020-05-05T16:37:28
197,032,985
0
0
null
2022-06-17T02:21:35
2019-07-15T16:15:44
Java
UTF-8
Java
false
false
2,058
java
package com.duke; import com.alibaba.fastjson.JSON; import org.aopalliance.intercept.MethodInvocation; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Pointcut; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint; import org.springframework.aop.framework.ReflectiveMethodInvocation; import org.springframework.stereotype.Component; import java.lang.reflect.Field; @Component @Aspect public class DukeTest { private static Logger log = LoggerFactory.getLogger(DukeTest.class); //@Pointcut("@annotation(com.duke.eureka.DukeAspect)") @Pointcut("execution(* com.duke.hello.HelloController.*hello(..))") public void test() { } // 匹配只有一个参数 name 的方法 /*@Around(value = "test()") public Object doSomething(ProceedingJoinPoint joinPoint) throws Throwable{ MethodInvocationProceedingJoinPoint methodPoint = (MethodInvocationProceedingJoinPoint) joinPoint; Field proxy = methodPoint.getClass().getDeclaredField("methodInvocation"); proxy.setAccessible(true); MethodInvocation invocation = (ReflectiveMethodInvocation) proxy.get(methodPoint); //Object argument = invocation.getArguments()[0]; log.info("HHHHHH {}", JSON.toJSONString(invocation.getMethod().getName())); return joinPoint.proceed(); }*/ // 匹配只有一个参数 name 的方法 @Before(value = "test()") public void doSomething(JoinPoint joinPoint) throws Throwable{ MethodInvocationProceedingJoinPoint methodPoint = (MethodInvocationProceedingJoinPoint) joinPoint; Field proxy = methodPoint.getClass().getDeclaredField("methodInvocation"); proxy.setAccessible(true); MethodInvocation invocation = (ReflectiveMethodInvocation) proxy.get(methodPoint); log.info("HHHHHH {}", JSON.toJSONString(invocation.getMethod().getName())); } }
590524faeb37b4eb2b201ac8866180abcb6b8966
ca701c73455e6d2a17da27ed502f5e2978f9cbc3
/example/src/main/java/com/dingfang/org/example/okhttp/OkHttpUtil.java
272b7d7bfef32ba8ad575fa413ef4b4c83e0fd24
[]
no_license
olysa/EasyLib
b36d2f2d2f5d899c23147dfc930d666c04db9ee9
4016da8434b8fbafeab1e748a0c5194c194239ef
refs/heads/master
2021-07-18T23:48:41.649093
2017-10-22T04:13:39
2017-10-22T04:13:39
105,329,587
4
1
null
null
null
null
UTF-8
Java
false
false
3,890
java
package com.dingfang.org.example.okhttp; import android.app.Application; import com.lzy.okgo.OkGo; import com.lzy.okgo.cache.CacheEntity; import com.lzy.okgo.cache.CacheMode; import com.lzy.okgo.interceptor.HttpLoggingInterceptor; import com.lzy.okgo.model.HttpHeaders; import com.lzy.okgo.model.HttpParams; import java.util.concurrent.TimeUnit; import java.util.logging.Level; import okhttp3.OkHttpClient; /** * OkHttp 全局配置 * Created by zuoqing on 2017/10/11. */ public class OkHttpUtil { public static final long TIME_OUT_MILLISECONDS = 20 * 1000; //请求的超时时间 public static final int RETRY_COUNT = 3; //请求的超时时间 private static class OkHttpUtilHolder { private static OkHttpUtil instance = null; public static OkHttpUtil getInstance() { if (instance == null) { instance = new OkHttpUtil(); } return instance; } } /** * 获得单例 * * @return */ public static OkHttpUtil getInstance() { return OkHttpUtilHolder.getInstance(); } /** * 全局配置信息 * * @param application */ public void init(Application application) { //---------这里给出的是示例代码,告诉你可以这么传,实际使用的时候,根据需要传,不需要就不传-------------// HttpHeaders headers = new HttpHeaders(); // headers.put("commonHeaderKey1", "commonHeaderValue1"); //header不支持中文,不允许有特殊字符 // headers.put("commonHeaderKey2", "commonHeaderValue2"); HttpParams params = new HttpParams(); // params.put("commonParamsKey1", "commonParamsValue1"); //param支持中文,直接传,不要自己编码 // params.put("commonParamsKey2", "这里支持中文参数"); //----------------------------------------------------------------------------------------// OkHttpClient.Builder builder = new OkHttpClient.Builder(); //log相关 HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor("OkGo"); loggingInterceptor.setPrintLevel(HttpLoggingInterceptor.Level.BODY); //log打印级别,决定了log显示的详细程度 loggingInterceptor.setColorLevel(Level.INFO); //log颜色级别,决定了log在控制台显示的颜色 builder.addInterceptor(loggingInterceptor); //添加OkGo默认debug日志 //超时时间设置,默认60秒 builder.readTimeout(TIME_OUT_MILLISECONDS, TimeUnit.MILLISECONDS); //全局的读取超时时间 builder.writeTimeout(TIME_OUT_MILLISECONDS, TimeUnit.MILLISECONDS); //全局的写入超时时间 builder.connectTimeout(TIME_OUT_MILLISECONDS, TimeUnit.MILLISECONDS); //全局的连接超时时间 // 其他统一的配置 // 详细说明看GitHub文档:https://github.com/jeasonlzy/ OkGo.getInstance().init(application) //必须调用初始化 .setOkHttpClient(builder.build()) //建议设置OkHttpClient,不设置会使用默认的 .setCacheMode(CacheMode.NO_CACHE) //全局统一缓存模式,默认不使用缓存,可以不传 .setCacheTime(CacheEntity.CACHE_NEVER_EXPIRE) //全局统一缓存时间,默认永不过期,可以不传 .setRetryCount(RETRY_COUNT) //全局统一超时重连次数,默认为三次,那么最差的情况会请求4次(一次原始请求,三次重连请求),不需要可以设置为0 .addCommonHeaders(headers) //全局公共头 .addCommonParams(params); //全局公共参数 } }
bc50d0dba498922befa861a59d32a21205317a5a
5eff0b435b4188a76e3b14f7748bfb6a6c5cbda5
/src/main/java/at/pavlov/ironclad/utils/IroncladUtil.java
4505e0fa9c8bbee11cc8f1293ed53639d9200b8c
[]
no_license
DerPavlov/Ironclad
0e8948e8495c8e51a511de4f9a445e4e5e3711f8
5fd565bafbc22bd9b51a95aa7932ec9c95bcb04f
refs/heads/master
2020-04-16T07:40:48.937630
2019-03-02T16:21:27
2019-03-02T16:21:27
165,395,686
0
0
null
null
null
null
UTF-8
Java
false
false
38,945
java
package at.pavlov.ironclad.utils; import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.util.*; import at.pavlov.ironclad.Ironclad; import at.pavlov.ironclad.container.*; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockTypes; import org.bukkit.*; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.data.Directional; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.*; import org.bukkit.inventory.ItemStack; import org.bukkit.material.Button; import org.bukkit.material.Torch; import org.bukkit.potion.PotionData; import org.bukkit.potion.PotionType; import org.bukkit.util.BlockIterator; public class IroncladUtil { // ################# CheckAttachedButton ########################### public static boolean CheckAttachedButton(Block block, BlockFace face) { Block attachedBlock = block.getRelative(face); if (attachedBlock.getType() == Material.STONE_BUTTON) { Button button = (Button) attachedBlock.getState().getData(); if (button.getAttachedFace() != null) { if (attachedBlock.getRelative(button.getAttachedFace()).equals(block)) { return true; } } // attached face not available else { return true; } } return false; } // ################# CheckAttachedTorch ########################### @Deprecated public static boolean CheckAttachedTorch(Block block) { Block attachedBlock = block.getRelative(BlockFace.UP); if (attachedBlock.getType() == Material.TORCH) { Torch torch = (Torch) attachedBlock.getState().getData(); if (torch.getAttachedFace() != null) { if (attachedBlock.getRelative(torch.getAttachedFace()).equals(block)) { return true; } } // attached face not available else { return true; } } return false; } /** * changes the extension of the a string (e.g. classic.yml to * classic.schematic) * * @param originalName * @param newExtension * @return */ public static String changeExtension(String originalName, String newExtension) { int lastDot = originalName.lastIndexOf("."); if (lastDot != -1) { return originalName.substring(0, lastDot) + newExtension; } else { return originalName + newExtension; } } /** * removes the extrions of a filename like classic.yml * @param str * @return */ public static String removeExtension(String str) { return str.substring(0, str.lastIndexOf('.')); } /** * return true if the folder is empty * @param folderPath * @return */ public static boolean isFolderEmpty(String folderPath) { File file = new File(folderPath); if (file.isDirectory()) { if (file.list().length > 0) { //folder is not empty return false; } } return true; } /** * copies a file form the .jar to the disk * @param in * @param file */ public static void copyFile(InputStream in, File file) { try { OutputStream out = new FileOutputStream(file); byte[] buf = new byte[1024]; int len; while((len=in.read(buf))>0){ out.write(buf,0,len); } out.close(); in.close(); } catch (Exception e) { e.printStackTrace(); } } /** * rotates the direction by 90° * @param face * @return */ public static BlockFace roatateFace(BlockFace face) { if (face.equals(BlockFace.NORTH)) return BlockFace.EAST; if (face.equals(BlockFace.EAST)) return BlockFace.SOUTH; if (face.equals(BlockFace.SOUTH)) return BlockFace.WEST; if (face.equals(BlockFace.WEST)) return BlockFace.NORTH; return BlockFace.UP; } /** * rotates the direction by -90° * @param face * @return */ public static BlockFace roatateFaceOpposite(BlockFace face) { if (face.equals(BlockFace.NORTH)) return BlockFace.WEST; if (face.equals(BlockFace.EAST)) return BlockFace.NORTH; if (face.equals(BlockFace.SOUTH)) return BlockFace.EAST; if (face.equals(BlockFace.WEST)) return BlockFace.SOUTH; return BlockFace.UP; } /** * returns a list of Material * @param stringList list of Materials as strings * @return list of MaterialHolders */ public static ArrayList<BlockState> toBlockDataList(List<String> stringList) { ArrayList<BlockState> blockDataList = new ArrayList<>(); for (String str : stringList) { BlockState material = BukkitAdapter.adapt(Bukkit.createBlockData(str)); blockDataList.add(material); } return blockDataList; } /** * returns a list of ItemHolder * @param stringList list of Materials as strings * @return list of ItemHolders */ public static List<ItemHolder> toItemHolderList(List<String> stringList) { List<ItemHolder> materialList = new ArrayList<>(); for (String str : stringList) { ItemHolder material = new ItemHolder(str); //if id == -1 the str was invalid materialList.add(material); } return materialList; } /** * get all block next to this block (UP, DOWN, SOUT, WEST, NORTH, EAST) * @param block * @return */ public static ArrayList<Block> getSurroundingBlocks(Block block) { ArrayList<Block> Blocks = new ArrayList<Block>(); Blocks.add(block.getRelative(BlockFace.UP)); Blocks.add(block.getRelative(BlockFace.DOWN)); Blocks.add(block.getRelative(BlockFace.SOUTH)); Blocks.add(block.getRelative(BlockFace.WEST)); Blocks.add(block.getRelative(BlockFace.NORTH)); Blocks.add(block.getRelative(BlockFace.EAST)); return Blocks; } /** * get all block in the horizontal plane next to this block (SOUTH, WEST, NORTH, EAST) * @param block * @return */ public static ArrayList<Block> getHorizontalSurroundingBlocks(Block block) { ArrayList<Block> Blocks = new ArrayList<Block>(); Blocks.add(block.getRelative(BlockFace.SOUTH)); Blocks.add(block.getRelative(BlockFace.WEST)); Blocks.add(block.getRelative(BlockFace.NORTH)); Blocks.add(block.getRelative(BlockFace.EAST)); return Blocks; } /** * returns the yaw of a given blockface * @param direction * @return */ public static int directionToYaw(BlockFace direction) { switch (direction) { case NORTH: return 180; case EAST: return 270; case SOUTH: return 0; case WEST: return 90; case NORTH_EAST: return 135; case NORTH_WEST: return 45; case SOUTH_EAST: return -135; case SOUTH_WEST: return -45; default: return 0; } } public static Vector3 rotateDirection(BlockFace startDirection, BlockFace endDirection, Vector3 vect){ // if both directions are the same, do nothing if (startDirection.equals(endDirection)) return vect; int diff = directionToYaw(startDirection) - directionToYaw(endDirection); while (diff < 0) diff += 360; Ironclad.getPlugin().logDebug("Blockface start: " + startDirection + " Blcokface end: " + endDirection + " vect " + vect + " diff " + diff); switch (diff){ case 90: // vect.setZ(vect.getX()); // vect.setX(-hz); Ironclad.getPlugin().logDebug("EndLoc " + Vector3.at(-vect.getZ(), vect.getY(), vect.getX())); return Vector3.at(-vect.getZ(), vect.getY(), vect.getX()); case 180: // vect.setZ(-vect.getX()); // vect.setX(-hz); Ironclad.getPlugin().logDebug("EndLoc " + Vector3.at(-vect.getZ(), vect.getY(), -vect.getX())); return Vector3.at(-vect.getZ(), vect.getY(), -vect.getX()); case 270: // vect.setZ(-vect.getX()); // vect.setX(hz); Ironclad.getPlugin().logDebug("EndLoc " + Vector3.at(vect.getZ(), vect.getY(), vect.getX())); return Vector3.at(vect.getZ(), vect.getY(), vect.getX()); default: Ironclad.getPlugin().logDebug("incorrect craft travel direction " + diff); } return vect; } public static BlockVector3 rotateDirection(BlockFace startDirection, BlockFace endDirection, BlockVector3 vect){ // if both directions are the same, do nothing if (startDirection.equals(endDirection)) return vect; int diff = directionToYaw(startDirection) - directionToYaw(endDirection); while (diff < 0) diff += 360; Ironclad.getPlugin().logDebug("Blockface start: " + startDirection + " Blcokface end: " + endDirection + " vect " + vect + " diff " + diff); switch (diff){ case 90: // vect.setZ(vect.getX()); // vect.setX(-hz); Ironclad.getPlugin().logDebug("EndLoc " + BlockVector3.at(-vect.getZ(), vect.getY(), vect.getX())); return BlockVector3.at(-vect.getZ(), vect.getY(), vect.getX()); case 180: // vect.setZ(-vect.getX()); // vect.setX(-hz); Ironclad.getPlugin().logDebug("EndLoc " + BlockVector3.at(-vect.getZ(), vect.getY(), -vect.getX())); return BlockVector3.at(-vect.getZ(), vect.getY(), -vect.getX()); case 270: // vect.setZ(-vect.getX()); // vect.setX(hz); Ironclad.getPlugin().logDebug("EndLoc " + BlockVector3.at(vect.getZ(), vect.getY(), vect.getX())); return BlockVector3.at(vect.getZ(), vect.getY(), vect.getX()); default: Ironclad.getPlugin().logDebug("incorrect craft travel direction " + diff); } return vect; } public static BlockStateHolder rotateBlockData(BlockFace startDirection, BlockFace endDirection, BlockState blockData) { // if both directions are the same, do nothing if (startDirection.equals(endDirection)) return blockData; int diff = directionToYaw(startDirection) - directionToYaw(endDirection); while (diff < 0) diff += 360; Ironclad.getPlugin().logDebug("Blockface start: " + startDirection + " Blcokface end: " + endDirection + " blockData " + blockData + " diff " + diff); switch (diff) { case 90: return IroncladUtil.roateBlockFacingClockwise(blockData); case 180: return IroncladUtil.roateBlockFacingClockwise(IroncladUtil.roateBlockFacingClockwise(blockData)); case 270: return IroncladUtil.rotateBlockFacingCouterClockwise(blockData); default: Ironclad.getPlugin().logSevere("incorrect craft travel direction " + diff); return blockData; } } public static Location rotateDirection(BlockFace startDirection, BlockFace endDirection, Location loc){ int diff = directionToYaw(startDirection) - directionToYaw(endDirection); if (diff < 0) diff += 360; double hz; Ironclad.getPlugin().logDebug("Blockface start: " + startDirection + " Blcokface end: " + endDirection + " Loc " + loc); switch (diff){ case 90: hz = loc.getZ(); loc.setZ(loc.getX()); loc.setX(-hz); if (loc.getYaw()+90 > 360) loc.setYaw(loc.getYaw()-270); //subtract 360 at the same time else loc.setYaw(loc.getYaw()+90); Ironclad.getPlugin().logDebug("EndLoc " + loc); return loc; case 180: hz = loc.getZ(); loc.setZ(-loc.getX()); loc.setX(-hz); if (loc.getYaw()+180 > 360) loc.setYaw(loc.getYaw()-180); //subtract 360 at the same time else loc.setYaw(loc.getYaw()+180); Ironclad.getPlugin().logDebug("EndLoc " + loc); return loc; case 270: hz = loc.getZ(); loc.setZ(-loc.getX()); loc.setX(hz); if (loc.getYaw()+270 > 360) loc.setYaw(loc.getYaw()-90); //subtract 360 at the same time else loc.setYaw(loc.getYaw()+270); Ironclad.getPlugin().logDebug("EndLoc " + loc); return loc; } return loc; } /** * Armor would reduce the damage the player receives * @param entity - the affected human player * @return - how much the damage is reduced by the armor */ public static double getArmorDamageReduced(HumanEntity entity) { // http://www.minecraftwiki.net/wiki/Armor#Armor_enchantment_effect_calculation if (entity == null) return 0.0; org.bukkit.inventory.PlayerInventory inv = entity.getInventory(); if (inv == null) return 0.0; ItemStack boots = inv.getBoots(); ItemStack helmet = inv.getHelmet(); ItemStack chest = inv.getChestplate(); ItemStack pants = inv.getLeggings(); double red = 0.0; if (helmet != null) { if(helmet.getType() == Material.LEATHER_HELMET)red = red + 0.04; else if(helmet.getType() == Material.GOLDEN_HELMET)red = red + 0.08; else if(helmet.getType() == Material.CHAINMAIL_HELMET)red = red + 0.08; else if(helmet.getType() == Material.IRON_HELMET)red = red + 0.08; else if(helmet.getType() == Material.DIAMOND_HELMET)red = red + 0.12; } // if (boots != null) { if(boots.getType() == Material.LEATHER_BOOTS)red = red + 0.04; else if(boots.getType() == Material.GOLDEN_BOOTS)red = red + 0.04; else if(boots.getType() == Material.CHAINMAIL_BOOTS)red = red + 0.04; else if(boots.getType() == Material.IRON_BOOTS)red = red + 0.08; else if(boots.getType() == Material.DIAMOND_BOOTS)red = red + 0.12; } // if (pants != null) { if(pants.getType() == Material.LEATHER_LEGGINGS)red = red + 0.08; else if(pants.getType() == Material.GOLDEN_LEGGINGS)red = red + 0.12; else if(pants.getType() == Material.CHAINMAIL_LEGGINGS)red = red + 0.16; else if(pants.getType() == Material.IRON_LEGGINGS)red = red + 0.20; else if(pants.getType() == Material.DIAMOND_LEGGINGS)red = red + 0.24; } // if (chest != null) { if(chest.getType() == Material.LEATHER_CHESTPLATE)red = red + 0.12; else if(chest.getType() == Material.GOLDEN_CHESTPLATE)red = red + 0.20; else if(chest.getType() == Material.CHAINMAIL_CHESTPLATE)red = red + 0.20; else if(chest.getType() == Material.IRON_CHESTPLATE)red = red + 0.24; else if(chest.getType() == Material.DIAMOND_CHESTPLATE)red = red + 0.32; } return red; } /** * returns the total blast protection of the player * @param entity - the affected human player */ public static double getBlastProtection(HumanEntity entity) { //http://www.minecraftwiki.net/wiki/Armor#Armor_enchantment_effect_calculation if (entity == null) return 0.0; org.bukkit.inventory.PlayerInventory inv = entity.getInventory(); if (inv == null) return 0.0; ItemStack boots = inv.getBoots(); ItemStack helmet = inv.getHelmet(); ItemStack chest = inv.getChestplate(); ItemStack pants = inv.getLeggings(); int lvl = 0; double reduction = 0.0; if (boots != null) { lvl = boots.getEnchantmentLevel(Enchantment.PROTECTION_EXPLOSIONS); if (lvl > 0) reduction += Math.floor((6 + lvl * lvl) * 1.5 / 3); lvl = boots.getEnchantmentLevel(Enchantment.PROTECTION_ENVIRONMENTAL); if (lvl > 0) reduction += Math.floor((6 + lvl * lvl) * 0.75 / 3); } if (helmet != null) { lvl = helmet.getEnchantmentLevel(Enchantment.PROTECTION_EXPLOSIONS); if (lvl > 0) reduction += Math.floor((6 + lvl * lvl) * 1.5 / 3); lvl = helmet.getEnchantmentLevel(Enchantment.PROTECTION_ENVIRONMENTAL); if (lvl > 0) reduction += Math.floor((6 + lvl * lvl) * 0.75 / 3); } if (chest != null) { lvl = chest.getEnchantmentLevel(Enchantment.PROTECTION_EXPLOSIONS); if (lvl > 0) reduction += Math.floor((6 + lvl * lvl) * 1.5 / 3); lvl = chest.getEnchantmentLevel(Enchantment.PROTECTION_ENVIRONMENTAL); if (lvl > 0) reduction += Math.floor((6 + lvl * lvl) * 0.75 / 3); } if (pants != null) { lvl = pants.getEnchantmentLevel(Enchantment.PROTECTION_EXPLOSIONS); if (lvl > 0) reduction += Math.floor((6 + lvl * lvl) * 1.5 / 3); lvl = pants.getEnchantmentLevel(Enchantment.PROTECTION_ENVIRONMENTAL); if (lvl > 0) reduction += Math.floor((6 + lvl * lvl) * 0.75 / 3); } //cap it to 25 if (reduction > 25) reduction = 25; //give it some randomness Random r = new Random(); reduction = reduction * (r.nextFloat()/2 + 0.5); //cap it to 20 if (reduction > 20) reduction = 20; //1 point is 4% return reduction*4/100; } /** * returns the total projectile protection of the player * @param entity - the affected human player */ public static double getProjectileProtection(HumanEntity entity) { //http://www.minecraftwiki.net/wiki/Armor#Armor_enchantment_effect_calculation if (entity == null) return 0.0; org.bukkit.inventory.PlayerInventory inv = entity.getInventory(); if (inv == null) return 0.0; ItemStack boots = inv.getBoots(); ItemStack helmet = inv.getHelmet(); ItemStack chest = inv.getChestplate(); ItemStack pants = inv.getLeggings(); int lvl = 1; double reduction = 0; if (boots != null) { lvl = boots.getEnchantmentLevel(Enchantment.PROTECTION_PROJECTILE); if (lvl > 0) reduction += Math.floor((6 + lvl * lvl) * 1.5 / 3); lvl = boots.getEnchantmentLevel(Enchantment.PROTECTION_ENVIRONMENTAL); if (lvl > 0) reduction += Math.floor((6 + lvl * lvl) * 0.75 / 3); } if (helmet != null) { lvl = helmet.getEnchantmentLevel(Enchantment.PROTECTION_PROJECTILE); if (lvl > 0) reduction += Math.floor((6 + lvl * lvl) * 1.5 / 3); lvl = helmet.getEnchantmentLevel(Enchantment.PROTECTION_ENVIRONMENTAL); if (lvl > 0) reduction += Math.floor((6 + lvl * lvl) * 0.75 / 3); } if (chest != null) { lvl = chest.getEnchantmentLevel(Enchantment.PROTECTION_PROJECTILE); if (lvl > 0) reduction += Math.floor((6 + lvl * lvl) * 1.5 / 3); lvl = chest.getEnchantmentLevel(Enchantment.PROTECTION_ENVIRONMENTAL); if (lvl > 0) reduction += Math.floor((6 + lvl * lvl) * 0.75 / 3); } if (pants != null) { lvl = pants.getEnchantmentLevel(Enchantment.PROTECTION_PROJECTILE); if (lvl > 0) reduction += Math.floor((6 + lvl * lvl) * 1.5 / 3); lvl = pants.getEnchantmentLevel(Enchantment.PROTECTION_ENVIRONMENTAL); if (lvl > 0) reduction += Math.floor((6 + lvl * lvl) * 0.75 / 3); } //cap it to 25 if (reduction > 25) reduction = 25; //give it some randomness Random r = new Random(); reduction = reduction * (r.nextFloat()/2 + 0.5); //cap it to 20 if (reduction > 20) reduction = 20; //1 point is 4% return reduction*4/100; } /** * reduces the durability of the player's armor * @param entity - the affected human player */ public static void reduceArmorDurability(HumanEntity entity) { org.bukkit.inventory.PlayerInventory inv = entity.getInventory(); if (inv == null) return; Random r = new Random(); for(ItemStack item : inv.getArmorContents()) { if(item != null) { int lvl = item.getEnchantmentLevel(Enchantment.DURABILITY); //chance of breaking in 0-1 double breakingChance = 0.6+0.4/(lvl+1); if (r.nextDouble() < breakingChance) { org.bukkit.inventory.meta.Damageable itemMeta = (org.bukkit.inventory.meta.Damageable) item.getItemMeta(); itemMeta.setDamage(itemMeta.getDamage() + 1); } } } } /** * returns a random block face * @return - random BlockFace */ public static BlockFace randomBlockFaceNoDown() { Random r = new Random(); switch (r.nextInt(5)) { case 0: return BlockFace.UP; case 1: return BlockFace.EAST; case 2: return BlockFace.SOUTH; case 3: return BlockFace.WEST; case 4: return BlockFace.NORTH; default: return BlockFace.SELF; } } /** * adds a little bit random to the location so the effects don't create at the same point. * @return - randomized location */ public static Location randomLocationOrthogonal(Location loc, BlockFace face) { Random r = new Random(); //this is the direction we want to avoid Vector3 vect = Vector3.at(face.getModX(),face.getModY(),face.getModZ()); //orthogonal vector - somehow vect = vect.multiply(vect).subtract(Vector3.ONE); loc.setX(loc.getX()+vect.getX()*(r.nextDouble()-0.5)); loc.setY(loc.getY()+vect.getY()*(r.nextDouble()-0.5)); loc.setZ(loc.getZ()+vect.getZ()*(r.nextDouble()-0.5)); return loc; } /** * creates a imitated explosion sound * @param loc location of the explosion * @param sound sound * @param maxDist maximum distance */ public static void imitateSound(Location loc, SoundHolder sound, int maxDist, float maxVolume) { //https://forums.bukkit.org/threads/playsound-parameters-volume-and-pitch.151517/ World w = loc.getWorld(); //w.playSound(loc, sound.getSound(), maxVolume*16f, sound.getPitch()); maxVolume = Math.max(0.0f, Math.min(0.95f, maxVolume)); for(Player p : w.getPlayers()) { Location pl = p.getLocation(); //readable code org.bukkit.util.Vector v = loc.clone().subtract(pl).toVector(); float d = (float) v.length(); if(d<=maxDist) { //float volume = 2.1f-(float)(d/maxDist); //float newPitch = sound.getPitch()/(float) Math.sqrt(d); float newPitch = sound.getPitch(); //p.playSound(p.getEyeLocation().add(v.normalize().multiply(16)), sound, volume, newPitch); //https://bukkit.org/threads/playsound-parameters-volume-and-pitch.151517/ float maxv = d/(1-maxVolume)/16f; maxv = Math.max(maxv, maxVolume); float setvol = Math.min(maxv, (float)maxDist/16f); //System.out.println("distance: " + d + "maxv: " + maxv + " (float)maxDist/16f: " + (float)maxDist/16f + " setvol: " + setvol); if (sound.isSoundEnum()) p.playSound(loc, sound.getSoundEnum(), setvol, newPitch); if (sound.isSoundString()) p.playSound(loc, sound.getSoundString(), setvol, newPitch); } } } /** * creates a imitated error sound (called when played doing something wrong) * @param p player */ public static void playErrorSound(final Player p) { if (p == null) return; playErrorSound(p.getLocation()); } /** * creates a imitated error sound (called when played doing something wrong) * @param location location of the error sound */ public static void playErrorSound(final Location location) { location.getWorld().playSound(location, Sound.BLOCK_NOTE_BLOCK_PLING , 0.25f, 0.75f); Bukkit.getScheduler().scheduleSyncDelayedTask(Ironclad.getPlugin(), new Runnable() { @Override public void run() { location.getWorld().playSound(location, Sound.BLOCK_NOTE_BLOCK_PLING , 0.25f, 0.1f); } } , 3); } /** * play a sound effect for the player * @param loc location of the sound * @param sound type of sound (sound, volume, pitch) */ public static void playSound(Location loc, SoundHolder sound) { if (!sound.isValid()) return; if (sound.isSoundString()) loc.getWorld().playSound(loc, sound.getSoundString(), sound.getVolume(), sound.getPitch()); if (sound.isSoundEnum()) loc.getWorld().playSound(loc, sound.getSoundEnum(), sound.getVolume(), sound.getPitch()); } /** * find the surface in the given direction * @param start starting point * @param direction direction * @return returns the the location of one block in front of the surface or (if the surface is not found) the start location */ public static Location findSurface(Location start, org.bukkit.util.Vector direction) { World world = start.getWorld(); Location surface = start.clone(); //see if there is a block already - then go back if necessary if (!start.getBlock().isEmpty()) surface.subtract(direction); //are we now in air - if not, something is wrong if (!start.getBlock().isEmpty()) return start; //int length = (int) (direction.length()*3); BlockIterator iter = new BlockIterator(world, start.toVector(), direction.clone().normalize(), 0, 10); //try to find a surface of the while (iter.hasNext()) { Block next = iter.next(); //if there is no block, go further until we hit the surface if (next.isEmpty()) surface = next.getLocation(); else return surface; } // no surface found return surface; } /** * find the first block on the surface in the given direction * @param start starting point * @param direction direction * @return returns the the location of one block in front of the surface or (if the surface is not found) the start location */ public static Location findFirstBlock(Location start, org.bukkit.util.Vector direction) { World world = start.getWorld(); Location surface = start.clone(); //see if there is a block already - then go back if necessary if (!start.getBlock().isEmpty()) surface.subtract(direction); //are we now in air - if not, something is wrong if (!start.getBlock().isEmpty()) return start; //int length = (int) (direction.length()*3); BlockIterator iter = new BlockIterator(world, start.toVector(), direction.clone().normalize(), 0, 10); //try to find a surface of the while (iter.hasNext()) { Block next = iter.next(); //if there is no block, go further until we hit the surface if (!next.isEmpty()) return next.getLocation(); } // no surface found return null; } /** * checks if the line of sight is clear * @param start start point * @param stop end point * @param ignoredBlocks how many solid non transparent blocks are acceptable * @return true if there is a line of sight */ public static boolean hasLineOfSight(Location start, Location stop, int ignoredBlocks){ org.bukkit.util.Vector dir = stop.clone().subtract(start).toVector().normalize(); BlockIterator iter = new BlockIterator(start.getWorld(), start.clone().add(dir).toVector(),dir, 0, (int) start.distance(stop)); int nontransparent = 0; while (iter.hasNext()) { Block next = iter.next(); // search for a solid non transparent block (liquids are ignored) if (next.getType().isSolid() && next.getType().isOccluding()) { nontransparent ++; } } //System.out.println("non transperent blocks: " + nontransparent); return nontransparent <= ignoredBlocks; } /** * returns a random point in a sphere * @param center center location * @param radius radius of the sphere * @return returns a random point in a sphere */ public static Location randomPointInSphere(Location center, double radius) { Random rand = new Random(); double r = radius*rand.nextDouble(); double polar = Math.PI*rand.nextDouble(); double azi = Math.PI*(rand.nextDouble()*2.0-1.0); //sphere coordinates double x = r*Math.sin(polar)*Math.cos(azi); double y = r*Math.sin(polar)*Math.sin(azi); double z = r*Math.cos(polar); return center.clone().add(x,z,y); } /** * returns a random number in the given range * @param min smallest value * @param max largest value * @return a integer in the given range */ public static int getRandomInt(int min, int max) { Random r = new Random(); return r.nextInt(max+1-min) + min; } /** * returns all entity in a given radius * @param l center location * @param maxRadius radius for search * @return array of Entities in area */ public static Set<Entity> getNearbyEntities(Location l, int maxRadius){ int chunkRadius = maxRadius < 16 ? 1 : (maxRadius - (maxRadius % 16))/16; Set<Entity> radiusEntities = new HashSet<>(); for (int chX = 0 -chunkRadius; chX <= chunkRadius; chX ++){ for (int chZ = 0 -chunkRadius; chZ <= chunkRadius; chZ++){ for (Entity e : new Location(l.getWorld(),l.getX()+(chX*16),l.getY(),l.getZ()+(chZ*16)).getChunk().getEntities()){ if (e.getLocation().distance(l) <= maxRadius) radiusEntities.add(e); } } } return radiusEntities; } /** * returns all entity in a given radius * @param l center location * @param sizeX size of the box in X * @param sizeY size of the box in Y * @param sizeZ size of the box in Z * @return array of Entities in area */ public static Set<Entity> getNearbyEntitiesInBox(Location l, double sizeX, double sizeY, double sizeZ){ int hX = (int) Math.ceil(sizeX/2.); int hZ = (int) Math.ceil(sizeY/2.); int chunkX = hX < 16 ? 1 : (hX - (hX % 16))/16; int chunkZ = hZ < 16 ? 1 : (hZ - (hZ % 16))/16; Set<Entity> radiusEntities = new HashSet<>(); for (int chX = 0 -chunkX; chX <= chunkX; chX ++){ for (int chZ = 0 -chunkZ; chZ <= chunkZ; chZ++){ for (Entity e : new Location(l.getWorld(),l.getX()+(chX*16),l.getY(),l.getZ()+(chZ*16)).getChunk().getEntities()){ if (e.getLocation().distanceSquared(l) <= (sizeX*sizeX + sizeY*sizeY + sizeZ*sizeZ)/2.) radiusEntities.add(e); } } } return radiusEntities; } public static double vectorToYaw(Vector3 vector){ return Math.atan2(-vector.getX(), vector.getZ())*180./Math.PI; } public static double vectorToPitch(Vector3 vector){ return -Math.asin(vector.normalize().getY())*180./Math.PI; } public static Vector3 directionToVector(double yaw, double pitch, double speed){ double rpitch = pitch * Math.PI / 180.; double ryaw = yaw * Math.PI / 180.; double hx = -Math.cos(rpitch)*Math.sin(ryaw); double hy = -Math.sin(rpitch); double hz = Math.cos(rpitch)*Math.cos(ryaw); // System.out.println("yaw: " + yaw + " pitch " + pitch); // System.out.println("vector: " + (new Vector(hx, hy, hz))); return Vector3.at(hx, hy, hz).multiply(speed); } /** * returns the offline player for a given player name if he played on the server * @param name name of the player * @return Offline player */ public static OfflinePlayer getOfflinePlayer(String name){ OfflinePlayer[] players = Bukkit.getOfflinePlayers(); for (OfflinePlayer player : players) { if (player.getName().equals(name)) { return player; } } return null; } /** * returns true if the player is playing or has been on this server before * @param uuid id if the player * @return true if player has played before */ public static boolean hasPlayedBefore(UUID uuid){ OfflinePlayer bPlayer = Bukkit.getOfflinePlayer(uuid); if (bPlayer == null) return false; if (bPlayer.isOnline()){ Player player = (Player) bPlayer; if (player.isOnline()) return true; } else{ if(bPlayer.hasPlayedBefore()) return true; } return false; } /** * converts a string to float * @param str string to convert * @return returns parsed number or default */ public static float parseFloat(String str, float default_value) { if (str != null) { try { return Float.parseFloat(str); } catch (Exception e) { throw new NumberFormatException(); } } return default_value; } /** * converts a string to int * @param str string to convert * @return returns parsed number or default */ public static int parseInt(String str, int default_value) { if (str != null) { try { return Integer.parseInt(str); } catch (Exception e) { throw new NumberFormatException(); } } return default_value; } /** * converts a string to color * @param str string to convert * @return returns parsed color or default */ public static Color parseColor(String str, Color default_value) { if (str != null) { try { return Color.fromRGB(Integer.parseInt(str)); } catch (Exception e) { throw new NumberFormatException(); } } return default_value; } /** * converts a string to Potion effect * @param str string to convert * @return returns parsed number or default */ public static PotionData parsePotionData(String str, PotionData default_value) { if (str != null) { str = str.toLowerCase(); for (PotionType pt : PotionType.values()) { if (str.contains(pt.toString().toLowerCase())) { boolean extended = str.contains("long"); boolean upgraded = str.contains("strong"); return new PotionData(pt, extended, upgraded); } } } return default_value; } /** * converts a string to float * @param str string to convert * @return returns parsed number or default */ public static Particle parseParticle(String str, Particle default_value) { if (str != null) { for (Particle pt : Particle.values()) if (str.equalsIgnoreCase(pt.toString())){ return pt; } } return default_value; } /** * converts a string to Itemstack * @param str string to convert * @return returns parsed number or default */ public static ItemStack parseItemstack(String str, ItemStack default_value) { if (str != null) { for (Material mt : Material.values()) if (str.equalsIgnoreCase(mt.toString())){ return new ItemStack(mt); } } return default_value; } /** * rotates the Facing of a BlockData clockwise * @param blockData blockData * @return rotated blockData */ public static BlockState roateBlockFacingClockwise(BlockState blockData){ if (blockData instanceof Directional){ ((Directional) blockData).setFacing(roatateFace(((Directional) blockData).getFacing())); } return blockData; } /** * rotates the Facing of a BlockData clockwise * @param blockData blockData * @return rotated blockData */ public static BlockStateHolder rotateBlockFacingCouterClockwise(BlockStateHolder blockData){ if (blockData instanceof Directional){ ((Directional) blockData).setFacing(roatateFaceOpposite(((Directional) blockData).getFacing())); } return blockData; } /** * create BlockData and checks if the result is valid * @param str Material name * @return BlockData or AIR if the block is not valid */ public static BlockState createBlockData(String str){ try{ return BukkitAdapter.adapt(Bukkit.createBlockData(str)); } catch(Exception e){ System.out.println("[Ironclad] block data '" + str + "' is not valid"); return BlockTypes.AIR.getDefaultState(); } } public static ArrayList<BlockVector3> subtractBlockVectorList(List<BlockVector3> blockVectorList, BlockVector3 sub){ ArrayList<BlockVector3> newList = new ArrayList<>(); for (BlockVector3 vect : blockVectorList) newList.add(vect.subtract(sub)); return newList; } }
874968b460e39c74fb824da3560ae15ed78f288b
17db191a4616015bdf0f50b70722eb22f7009b97
/src/main/java/com/kh/ibom/synthesis_actlog/model/vo/SynthesisActLog.java
7107e1c59efebc240d502cad90b0283ea8b53d1f
[]
no_license
khibom/ibom
3bd68eaa1013ffcc89740da7a50ded841b6a2c2c
9d0a69257c9ef55c2f7233ce0f1fb3fa346418f0
refs/heads/master
2022-12-23T17:42:15.775793
2021-12-14T12:22:09
2021-12-14T12:22:09
233,031,542
0
1
null
2022-12-16T15:24:16
2020-01-10T11:18:33
Java
UTF-8
Java
false
false
2,981
java
package com.kh.ibom.synthesis_actlog.model.vo; import java.io.Serializable; import java.sql.Date; import org.springframework.stereotype.Component; @Component public class SynthesisActLog implements Serializable{ private static final long serialVersionUID = 8140L; private String synthesis_no; private String service2_no; private String family_code; private String dol_id; private java.sql.Date create_date; private String cond_date; private String ac_time; private String ac_content; private String process_ctgry; private String cond_cnt; public SynthesisActLog () {} public SynthesisActLog(String synthesis_no, String service2_no, String family_code, String dol_id, Date create_date, String cond_date, String ac_time, String ac_content, String process_ctgry, String cond_cnt) { super(); this.synthesis_no = synthesis_no; this.service2_no = service2_no; this.family_code = family_code; this.dol_id = dol_id; this.create_date = create_date; this.cond_date = cond_date; this.ac_time = ac_time; this.ac_content = ac_content; this.process_ctgry = process_ctgry; this.cond_cnt = cond_cnt; } public String getSynthesis_no() { return synthesis_no; } public void setSynthesis_no(String synthesis_no) { this.synthesis_no = synthesis_no; } public String getService2_no() { return service2_no; } public void setService2_no(String service2_no) { this.service2_no = service2_no; } public String getFamily_code() { return family_code; } public void setFamily_code(String family_code) { this.family_code = family_code; } public String getDol_id() { return dol_id; } public void setDol_id(String dol_id) { this.dol_id = dol_id; } public java.sql.Date getCreate_date() { return create_date; } public void setCreate_date(java.sql.Date create_date) { this.create_date = create_date; } public String getCond_date() { return cond_date; } public void setCond_date(String cond_date) { this.cond_date = cond_date; } public String getAc_time() { return ac_time; } public void setAc_time(String ac_time) { this.ac_time = ac_time; } public String getAc_content() { return ac_content; } public void setAc_content(String ac_content) { this.ac_content = ac_content; } public String getProcess_ctgry() { return process_ctgry; } public void setProcess_ctgry(String process_ctgry) { this.process_ctgry = process_ctgry; } public String getCond_cnt() { return cond_cnt; } public void setCond_cnt(String cond_cnt) { this.cond_cnt = cond_cnt; } @Override public String toString() { return "SynthesisActLog [synthesis_no=" + synthesis_no + ", service2_no=" + service2_no + ", family_code=" + family_code + ", dol_id=" + dol_id + ", create_date=" + create_date + ", cond_date=" + cond_date + ", ac_time=" + ac_time + ", ac_content=" + ac_content + ", process_ctgry=" + process_ctgry + ", cond_cnt=" + cond_cnt + "]"; } }
c53ef28e47252b7a3d2926975b3b32986f2d44b3
1a5a65fbcf819cadc7a4c2beb16aa3829100f460
/src/test/TestIndexMaxPQ.java
3aa9a83c781a3390baa6e9697168986dca6a6780
[]
no_license
problemin/Algorithm
d2aab8ee6e9a2decdfff80e7bf47d5fc0a13b4e0
bda99d680db9c8b939c5b6139f22125b627e8d9c
refs/heads/master
2021-01-20T19:57:48.996590
2016-12-31T05:02:20
2016-12-31T05:02:20
65,500,489
0
0
null
null
null
null
UTF-8
Java
false
false
574
java
package test; import structure.IndexMaxPQ; public class TestIndexMaxPQ { public static void main(String []args){ Integer a[] = {2,7,4,6,5,9,4,51,48,62,98,75,65,21}; IndexMaxPQ<Integer> mp = new IndexMaxPQ<Integer>(10); for(int i = 0; i < a.length; i++){ mp.insert(i+1,a[i]); } for(int i = 0; i < a.length; i++){ System.out.print(mp.delMax()+"--"); } System.out.println(""); for(int i = 0; i < a.length; i++){ mp.insert(i+1,a[i]); } mp.change(1, 78); for(int i = 0; i < a.length; i++){ System.out.print(mp.delMax()+"--"); } } }
075106f063358ed1b6abed73087e52017a825ff4
7d68d11402b1625babc060c475cbfa5ea30b0bca
/app/src/main/java/WIP/mame056/vidhrdw/gberet.java
bb2dc4667e1578a467d6cd4472735d1dd59c477b
[ "Apache-2.0" ]
permissive
javaemus/ArcoFlexDroid
c94495059829decd8808f72ead0a12e639a5d474
e9ece569f14b65c906612e2574d15dacbf4bfc80
refs/heads/master
2023-04-25T15:18:28.719274
2021-05-05T10:46:10
2021-05-05T10:46:10
250,279,580
0
0
null
null
null
null
UTF-8
Java
false
false
9,694
java
/*************************************************************************** vidhrdw.c Functions to emulate the video hardware of the machine. ***************************************************************************/ /* * ported to v0.56 * using automatic conversion tool v0.01 */ package WIP.mame056.vidhrdw; import common.ptr.UBytePtr; import static arcadeflex056.fucPtr.*; import static common.ptr.*; import static mame056.commonH.*; import static mame056.mame.*; import static mame056.cpuexec.*; import static mame056.drawgfxH.*; import static mame056.drawgfx.*; import static mame056.tilemapH.*; import static mame056.tilemapC.*; //import static mame037b11.mame.tilemapC.*; import static mame056.vidhrdw.generic.*; public class gberet { public static UBytePtr gberet_videoram=new UBytePtr(),gberet_colorram=new UBytePtr(); public static UBytePtr gberet_spritebank=new UBytePtr(); public static UBytePtr gberet_scrollram=new UBytePtr(); public static struct_tilemap bg_tilemap; static int interruptenable; static int flipscreen; public static int TOTAL_COLORS(int gfxn){ return (Machine.gfx[gfxn].total_colors * Machine.gfx[gfxn].color_granularity); } public static void COLOR(int gfxn, int offs, char[] colortable, int value){ colortable[Machine.drv.gfxdecodeinfo[gfxn].color_codes_start + offs]=(char) value; } /*************************************************************************** Convert the color PROMs into a more useable format. Green Beret has a 32 bytes palette PROM and two 256 bytes color lookup table PROMs (one for sprites, one for characters). The palette PROM is connected to the RGB output, this way: bit 7 -- 220 ohm resistor -- BLUE -- 470 ohm resistor -- BLUE -- 220 ohm resistor -- GREEN -- 470 ohm resistor -- GREEN -- 1 kohm resistor -- GREEN -- 220 ohm resistor -- RED -- 470 ohm resistor -- RED bit 0 -- 1 kohm resistor -- RED ***************************************************************************/ public static VhConvertColorPromPtr gberet_vh_convert_color_prom = new VhConvertColorPromPtr() { public void handler(char[] palette, char[] colortable, UBytePtr color_prom) { int i; int _palette = 0; for (i = 0;i < Machine.drv.total_colors;i++) { int bit0,bit1,bit2; bit0 = (color_prom.read() >> 0) & 0x01; bit1 = (color_prom.read() >> 1) & 0x01; bit2 = (color_prom.read() >> 2) & 0x01; palette[_palette++] = (char) (0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2); bit0 = (color_prom.read() >> 3) & 0x01; bit1 = (color_prom.read() >> 4) & 0x01; bit2 = (color_prom.read() >> 5) & 0x01; palette[_palette++] = (char) (0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2); bit0 = 0; bit1 = (color_prom.read() >> 6) & 0x01; bit2 = (color_prom.read() >> 7) & 0x01; palette[_palette++] = (char) (0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2); color_prom.inc(); } for (i = 0;i < TOTAL_COLORS(1);i++) { if ((color_prom.read() & 0x0f)!=0) COLOR(1,i,colortable,(color_prom.read() & 0x0f)); else COLOR(1,i,colortable,0); color_prom.inc(); } for (i = 0;i < TOTAL_COLORS(0);i++) { COLOR(0,i,colortable,((color_prom.read()) & 0x0f) + 0x10); color_prom.inc(); } } }; /*************************************************************************** Callbacks for the TileMap code ***************************************************************************/ public static GetTileInfoPtr get_tile_info = new GetTileInfoPtr() { public void handler(int tile_index) { char attr = gberet_colorram.read(tile_index); SET_TILE_INFO( 0, gberet_videoram.read(tile_index) + ((attr & 0x40) << 2), attr & 0x0f, TILE_FLIPYX((attr & 0x30) >> 4) ); tile_info.priority = (attr & 0x80) >> 7; //tile_info.flags = (attr & 0x80) >> 7 | TILE_FLIPYX((attr & 0x30) >> 4); } }; /*************************************************************************** Start the video hardware emulation. ***************************************************************************/ public static VhStartPtr gberet_vh_start = new VhStartPtr() { public int handler() { bg_tilemap = tilemap_create(get_tile_info,tilemap_scan_rows,TILEMAP_TRANSPARENT_COLOR,8,8,64,32); if (bg_tilemap == null) return 0; tilemap_set_transparent_pen(bg_tilemap,0x10); //bg_tilemap.transparent_pen = 0x10; //bg_tilemap.u32_transmask[0] = 0x0001; /* split type 0 has pen 1 transparent in front half */ //bg_tilemap.u32_transmask[1] = 0xffff; /* split type 1 is totally transparent in front half */ tilemap_set_scroll_rows(bg_tilemap,32); return 0; } }; /*************************************************************************** Memory handlers ***************************************************************************/ public static WriteHandlerPtr gberet_videoram_w = new WriteHandlerPtr() {public void handler(int offset, int data) { if (gberet_videoram.read(offset) != data) { gberet_videoram.write(offset, data); tilemap_mark_tile_dirty(bg_tilemap,offset); } } }; public static WriteHandlerPtr gberet_colorram_w = new WriteHandlerPtr() {public void handler(int offset, int data) { if (gberet_colorram.read(offset) != data) { gberet_colorram.write(offset, data); tilemap_mark_tile_dirty(bg_tilemap,offset); } } }; public static WriteHandlerPtr gberet_e044_w = new WriteHandlerPtr() {public void handler(int offset, int data) { /* bit 0 enables interrupts */ interruptenable = data & 1; /* bit 3 flips screen */ flipscreen = data & 0x08; tilemap_set_flip(ALL_TILEMAPS,(flipscreen!=0) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); /* don't know about the other bits */ } }; public static WriteHandlerPtr gberet_scroll_w = new WriteHandlerPtr() {public void handler(int offset, int data) { int scroll; gberet_scrollram.write(offset, data); scroll = gberet_scrollram.read(offset & 0x1f) | (gberet_scrollram.read(offset | 0x20) << 8); tilemap_set_scrollx(bg_tilemap,offset & 0x1f,scroll); } }; public static WriteHandlerPtr gberetb_scroll_w = new WriteHandlerPtr() {public void handler(int offset, int data) { int scroll; scroll = data; if (offset != 0) scroll |= 0x100; for (offset = 6;offset < 29;offset++) tilemap_set_scrollx(bg_tilemap,offset,scroll + 64-8); } }; public static InterruptPtr gberet_interrupt = new InterruptPtr() { public int handler() { if (cpu_getiloops() == 0) return interrupt.handler(); else if ((cpu_getiloops() % 2)!=0) { if (interruptenable!=0) return nmi_interrupt.handler(); } return ignore_interrupt.handler(); } }; /*************************************************************************** Display refresh ***************************************************************************/ public static void draw_sprites(mame_bitmap bitmap) { int offs; UBytePtr sr; if ((gberet_spritebank.read() & 0x08)!=0) sr = spriteram_2; else sr = spriteram; for (offs = 0;offs < spriteram_size[0];offs += 4) { if (sr.read(offs+3) != 0) { int sx,sy,flipx,flipy; sx = sr.read(offs+2) - 2*(sr.read(offs+1) & 0x80); sy = sr.read(offs+3); flipx = sr.read(offs+1) & 0x10; flipy = sr.read(offs+1) & 0x20; if (flipscreen != 0) { sx = 240 - sx; sy = 240 - sy; flipx = (flipx!=0)?0:1; flipy = (flipy!=0)?0:1; } drawgfx(bitmap,Machine.gfx[1], sr.read(offs+0) + ((sr.read(offs+1) & 0x40) << 2), sr.read(offs+1) & 0x0f, flipx,flipy, sx,sy, Machine.visible_area,TRANSPARENCY_COLOR,0); } } } static void draw_sprites_bootleg(mame_bitmap bitmap) { int offs; UBytePtr sr; sr = new UBytePtr(spriteram); for (offs = spriteram_size[0] - 4;offs >= 0;offs -= 4) { if (sr.read(offs+1) != 0) { int sx,sy,flipx,flipy; sx = sr.read(offs+2) - 2*(sr.read(offs+3) & 0x80); sy = sr.read(offs+1); sy = 240 - sy; flipx = sr.read(offs+3) & 0x10; flipy = sr.read(offs+3) & 0x20; if (flipscreen != 0) { sx = 240 - sx; sy = 240 - sy; flipx = (flipx!=0)?0:1; flipy = (flipy!=0)?0:1; } drawgfx(bitmap,Machine.gfx[1], sr.read(offs+0) + ((sr.read(offs+3) & 0x40) << 2), sr.read(offs+3) & 0x0f, flipx,flipy, sx,sy, Machine.visible_area,TRANSPARENCY_COLOR,0); } } } public static VhUpdatePtr gberet_vh_screenrefresh = new VhUpdatePtr() { public void handler(mame_bitmap bitmap,int full_refresh) { //tilemap_update(ALL_TILEMAPS); //tilemap_render(ALL_TILEMAPS); tilemap_draw(bitmap,bg_tilemap,TILEMAP_IGNORE_TRANSPARENCY|0,0); tilemap_draw(bitmap,bg_tilemap,TILEMAP_IGNORE_TRANSPARENCY|1,0); draw_sprites(bitmap); tilemap_draw(bitmap,bg_tilemap,0,0); } }; public static VhUpdatePtr gberetb_vh_screenrefresh = new VhUpdatePtr() { public void handler(mame_bitmap bitmap,int full_refresh) { tilemap_draw(bitmap,bg_tilemap,TILEMAP_IGNORE_TRANSPARENCY|0,0); tilemap_draw(bitmap,bg_tilemap,TILEMAP_IGNORE_TRANSPARENCY|1,0); draw_sprites_bootleg(bitmap); tilemap_draw(bitmap,bg_tilemap,0,0); } }; }
41c1ebc03aa121a766e52bf881b1720357c3529c
e4d336c7ba393d83d63116fbfadf27616918c516
/app/src/main/java/com/gzrijing/workassistant/service/GetReportInfoProjectAmountSuppliesService.java
62fc7e227c687645dcc2d66094f5a0ce4ea3ac70
[]
no_license
GZRJ2525/WorkAssistant
fea81b415fc7b2fd28ed2d9f06b3dd5afcebe1cc
c60c86e23d79c6301b78b5743b41a57101c80407
refs/heads/master
2021-01-01T05:28:05.602548
2016-05-16T03:58:45
2016-05-16T03:58:45
56,556,292
0
0
null
null
null
null
UTF-8
Java
false
false
1,908
java
package com.gzrijing.workassistant.service; import android.app.Service; import android.content.Intent; import android.os.Handler; import android.os.IBinder; import android.util.Log; import android.widget.Toast; import com.gzrijing.workassistant.listener.HttpCallbackListener; import com.gzrijing.workassistant.util.HttpUtils; import com.gzrijing.workassistant.util.ToastUtil; public class GetReportInfoProjectAmountSuppliesService extends Service { private Handler handler = new Handler(); public GetReportInfoProjectAmountSuppliesService() { } @Override public IBinder onBind(Intent intent) { throw new UnsupportedOperationException("Not yet implemented"); } @Override public int onStartCommand(Intent intent, int flags, int startId) { String togetherid = intent.getStringExtra("togetherid"); String confirmid = intent.getStringExtra("confirmid"); String url = "?cmd=getsomeinstallconfirmdetail&togetherid=" + togetherid + "&confirmid=" + confirmid + "&fileno="; HttpUtils.sendHttpGetRequest(url, new HttpCallbackListener() { @Override public void onFinish(String response) { Log.e("response", response); Intent intent1 = new Intent("action.com.gzrijing.workassistant.ReportInfoProjectAmount"); intent1.putExtra("jsonData", response); sendBroadcast(intent1); } @Override public void onError(Exception e) { handler.post(new Runnable() { @Override public void run() { ToastUtil.showToast(GetReportInfoProjectAmountSuppliesService.this, "与服务器断开连接", Toast.LENGTH_SHORT); } }); } }); return super.onStartCommand(intent, flags, startId); } }
22199f9f9dce7d5844fb8a975c1643c8fe76dda6
0106ec741a4fb9154f236f4de0abd9f78c62e547
/app/src/main/java/com/teamdev/hinhnen4k/adapter/MyAdapterVideo.java
2809e67429bc3c76e984f85162d94b26298c0b7b
[]
no_license
hoangtusaobang998/hinhnen
3f5b1052af5d459971da932d0e116f8cb4947666
c0ca9cbc1c636ea85677d758dd3e363be65d660d
refs/heads/master
2020-11-26T21:09:56.980609
2019-12-20T06:44:23
2019-12-20T06:44:23
229,205,730
0
0
null
null
null
null
UTF-8
Java
false
false
3,636
java
package com.teamdev.hinhnen4k.adapter; import android.app.Activity; import android.content.Context; import android.graphics.Color; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.RelativeLayout; import androidx.annotation.NonNull; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.makeramen.roundedimageview.RoundedTransformationBuilder; import com.squareup.picasso.Callback; import com.squareup.picasso.Picasso; import com.squareup.picasso.Transformation; import com.teamdev.hinhnen4k.R; import com.teamdev.hinhnen4k.listen.ILoadMore; import com.teamdev.hinhnen4k.model.IMG; import com.teamdev.hinhnen4k.model.IMGGIF; import java.util.List; public class MyAdapterVideo extends RecyclerView.Adapter<ItemViewHolder> { List<IMGGIF> items; private int wid; private Click click; public void setItems(List<IMGGIF> items) { this.items = items; notifyDataSetChanged(); } public List<IMGGIF> getItems() { return items; } public MyAdapterVideo(int wid) { this.wid = wid; } public void setClick(Click click) { this.click = click; } @NonNull @Override public com.teamdev.hinhnen4k.adapter.ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()) .inflate(R.layout.item_view_recyclerview, parent, false); return new com.teamdev.hinhnen4k.adapter.ItemViewHolder(view); } @Override public void onBindViewHolder(@NonNull final com.teamdev.hinhnen4k.adapter.ItemViewHolder holder, final int position) { RelativeLayout relativeLayout = holder.layout.findViewById(R.id.layout); ViewGroup.LayoutParams layoutParams = relativeLayout.getLayoutParams(); layoutParams.width = wid / 2 - 12; layoutParams.height = (int) (wid / 1.5); holder.itemView.setLayoutParams(layoutParams); ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) relativeLayout.getLayoutParams(); marginLayoutParams.setMargins(5, 5, 5, 5); final IMGGIF img = items.get(position); holder.video.setVisibility(View.VISIBLE); Picasso.get().load(img.getImg_url()).fit().transform(boderIMG(0, 5)) .centerCrop().placeholder(R.drawable.shape_img).error(R.drawable.ic_launcher_background).into(holder.img, new Callback() { @Override public void onSuccess() { //code loading holder.spinKit.setVisibility(View.GONE); } @Override public void onError(Exception e) { } }); holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { click.clickItems(img, position); } }); } @Override public int getItemCount() { if (items == null) { return 0; } else return items.size(); } private Transformation boderIMG(int boderW, int boderConer) { return new RoundedTransformationBuilder() .borderColor(Color.BLACK) .borderWidthDp(boderW) .cornerRadiusDp(boderConer) .oval(false) .build(); } public interface Click { void clickItems(IMGGIF img, int position); } }
7fe5bddb938dbc41ec046d7a5500984f11171b42
6f2b40b21ce2186744f3fe44f8126506ceed0297
/JDS-ManagementApp/src/main/java/Model/DTO/Department.java
6d8a4c738081f0c42b5b1a063df0d55baf86bfb2
[]
no_license
huynhphat22/ManagementApp
bbd3b4150419c81702f9c70f512927db5978e425
24932b541659ffad98b299703676bd859bf15b45
refs/heads/master
2021-09-02T19:55:15.493332
2017-12-29T04:35:33
2017-12-29T04:35:33
109,262,357
0
0
null
2017-12-29T04:36:37
2017-11-02T12:32:41
JavaScript
UTF-8
Java
false
false
2,969
java
package Model.DTO; import static javax.persistence.GenerationType.IDENTITY; import java.util.HashSet; import java.util.Set; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; /** * Department generated by hbm2java */ @Entity @Table(name = "department", catalog = "restaurant") public class Department { private Integer departmentId; private String departmentName; private String address; private String phoneNumber; private short numberOfTable; private Boolean flags; @JsonIgnore private Set<MenuDepartment> menuDepartments = new HashSet<MenuDepartment>(0); public Department() { } public Department(String departmentName, String address, String phoneNumber, short numberOfTable) { this.departmentName = departmentName; this.address = address; this.phoneNumber = phoneNumber; this.numberOfTable = numberOfTable; } public Department(String departmentName, String address, String phoneNumber, short numberOfTable, Boolean flags) { this.departmentName = departmentName; this.address = address; this.phoneNumber = phoneNumber; this.numberOfTable = numberOfTable; this.flags = flags; } @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "departmentID", unique = true, nullable = false) public Integer getDepartmentId() { return this.departmentId; } public void setDepartmentId(Integer departmentId) { this.departmentId = departmentId; } @Column(name = "departmentName", nullable = false, length = 100) public String getDepartmentName() { return this.departmentName; } public void setDepartmentName(String departmentName) { this.departmentName = departmentName; } @Column(name = "address", nullable = false, length = 200) public String getAddress() { return this.address; } public void setAddress(String address) { this.address = address; } @Column(name = "phoneNumber", nullable = false, length = 20) public String getPhoneNumber() { return this.phoneNumber; } public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; } @Column(name = "numberOfTable", nullable = false) public short getNumberOfTable() { return this.numberOfTable; } public void setNumberOfTable(short numberOfTable) { this.numberOfTable = numberOfTable; } @Column(name = "flags") public Boolean getFlags() { return this.flags; } public void setFlags(Boolean flags) { this.flags = flags; } @OneToMany(fetch = FetchType.LAZY, mappedBy = "department") public Set<MenuDepartment> getMenuDepartments() { return this.menuDepartments; } public void setMenuDepartments(Set<MenuDepartment> menuDepartments) { this.menuDepartments = menuDepartments; } }
b0320f7cdd7e7c5b73a9be362fdecaaf10904113
0167f77a8364fe86aed16510c97ffc348c0d9132
/src/com/jetcms/core/action/front/LoginAct.java
b233dfaca25a89d6555eeb7868b145996636a2d1
[]
no_license
barrycom/kgmx
1bc379b7472ec11f8d807fbdf38644b59449410f
f2ad7902d06d36fdb908c6c098f36c978907b05f
refs/heads/master
2021-07-13T14:06:20.966837
2017-09-26T03:14:54
2017-09-26T03:16:42
104,827,608
2
0
null
null
null
null
UTF-8
Java
false
false
6,980
java
package com.jetcms.core.action.front; import static com.jetcms.core.manager.AuthenticationMng.AUTH_KEY; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import com.jetcms.common.security.BadCredentialsException; import com.jetcms.common.security.UsernameNotFoundException; import com.jetcms.common.web.RequestUtils; import com.jetcms.common.web.session.SessionProvider; import com.jetcms.core.entity.Authentication; import com.jetcms.core.manager.AuthenticationMng; import com.jetcms.core.web.WebCoreErrors; /** * 统一认证中心Action * * 统一认证中心由两个方面组成。 * <ul> * <li> * 用户信息来源。 可以有多种来源,最合适的来源是LDAP,也可以是数据库。本认证中心为实现更实用于互联网的、更轻量级的单点登录,使用数据库作为用户信息来源。 * 只要在同一数据库实例下,即可访问到用户信息。各系统可以自行实现注册、修改密码、禁用等功能。如果是用一体系下的应用,这些功能都提供了统一接口。 * <li> * 用户认证信息。用户登录成功后,需要保存登录信息,最合适的保存技术是memcached,也可以是其他集群缓存或数据库。本认证中心使用数据库保存登录信息。 * 只要在同一数据库实例下,即可访问。各系统可以自行实现退出登录。 * </ul> */ @Controller public class LoginAct { public static final String PROCESS_URL = "processUrl"; public static final String RETURN_URL = "returnUrl"; public static final String MESSAGE = "message"; public static final String LOGIN_INPUT = "/WEB-INF/t/jeecore/login.html"; public static final String LOGIN_SUCCESS = "/WEB-INF/t/jeecore/login_success.html"; /** * 统一登录入口 * * 入口有三种作用 * <ul> * <li>统一登录中心测试用。直接输入登录地址,登录成功后返回登录成功界面。如果processUrl为空,则认为使用该功能。</li> * <li>统一登录。其他系统使用该入口统一登录。使用此功能proseccUrl不能为空。</li> * <li>单点登录。多系统通过该入口实现单点登录。如果session中AUTH_KEY存在,则直接重定向至proseccUrl。</li> * </ul> * * @param processUrl * 登录成功后的处理地址。登录成功后即重定向到该页面,并将returnUrl、auth_key作为参数。 * @param returnUrl * 登录成功,并处理后,返回到该地址。 * @param message * 登录是提示的信息,比如:“您需要登录后才能继续刚才的操作”,该信息必须用UTF-8编码进行URLEncode。 * @param request * @param model * @return 重定向至processUrl,如prosessUrl不存在,则返回登录成功界面。 */ @RequestMapping(value = "/login.jspx", method = RequestMethod.GET) public String input(HttpServletRequest request, ModelMap model) { String processUrl = RequestUtils.getQueryParam(request, PROCESS_URL); String returnUrl = RequestUtils.getQueryParam(request, RETURN_URL); String message = RequestUtils.getQueryParam(request, MESSAGE); String authId = (String) session.getAttribute(request, AUTH_KEY); if (authId != null) { // 存在认证ID Authentication auth = authMng.retrieve(authId); // 存在认证信息,且未过期 if (auth != null) { String view = getView(processUrl, returnUrl, auth.getId()); if (view != null) { return view; } else { model.addAttribute("auth", auth); return LOGIN_SUCCESS; } } } if (!StringUtils.isBlank(processUrl)) { model.addAttribute(PROCESS_URL, processUrl); } if (!StringUtils.isBlank(returnUrl)) { model.addAttribute(RETURN_URL, returnUrl); } if (!StringUtils.isBlank(message)) { model.addAttribute(MESSAGE, message); } return LOGIN_INPUT; } @RequestMapping(value = "/login.jspx", method = RequestMethod.POST) public String submit(String username, String password, String processUrl, String returnUrl, String message, HttpServletRequest request, HttpServletResponse response, ModelMap model) { WebCoreErrors errors = validateSubmit(username, password, request); if (!errors.hasErrors()) { try { Authentication auth = authMng.login(username, password, RequestUtils.getIpAddr(request), request, response, session); String view = getView(processUrl, returnUrl, auth.getId()); if (view != null) { return view; } else { model.addAttribute("auth", auth); return LOGIN_SUCCESS; } } catch (UsernameNotFoundException e) { errors.addErrorString(e.getMessage()); } catch (BadCredentialsException e) { errors.addErrorString(e.getMessage()); } } errors.toModel(model); if (!StringUtils.isBlank(processUrl)) { model.addAttribute(PROCESS_URL, processUrl); } if (!StringUtils.isBlank(returnUrl)) { model.addAttribute(RETURN_URL, returnUrl); } if (!StringUtils.isBlank(message)) { model.addAttribute(MESSAGE, message); } return LOGIN_INPUT; } @RequestMapping(value = "/logout.jspx") public String logout(HttpServletRequest request, HttpServletResponse response) { String authId = (String) session.getAttribute(request, AUTH_KEY); if (authId != null) { authMng.deleteById(authId); session.logout(request, response); } return "redirect:index.jhtml"; } /** * 获得地址 * * @param processUrl * @param returnUrl * @param authId * @return */ private String getView(String processUrl, String returnUrl, String authId) { if (!StringUtils.isBlank(processUrl)) { StringBuilder sb = new StringBuilder("redirect:"); sb.append(processUrl).append("?").append(AUTH_KEY).append("=") .append(authId); if (!StringUtils.isBlank(returnUrl)) { sb.append("&").append(RETURN_URL).append("=").append(returnUrl); } return sb.toString(); } else if (!StringUtils.isBlank(returnUrl)) { StringBuilder sb = new StringBuilder("redirect:"); sb.append(returnUrl); if (!StringUtils.isBlank(authId)) { sb.append("?").append(AUTH_KEY).append("=").append(authId); } return sb.toString(); } else { return null; } } private WebCoreErrors validateSubmit(String username, String password, HttpServletRequest request) { WebCoreErrors errors = WebCoreErrors.create(request); if (errors.ifOutOfLength(username, "username", 3, 100)) { return errors; } if (errors.ifOutOfLength(password, "password", 3, 32)) { return errors; } return errors; } @Autowired private AuthenticationMng authMng; @Autowired private SessionProvider session; }
20386de9dcabc25a8edf58cc5edcb51ef7aa3e11
46f7a106d4a3634d522ad1ae370e97b5155d5a75
/app/src/androidTest/java/com/food/instant/instantfood/ApplicationTest.java
b8c0b1763f451b64d196b912a7ab3042d7133351
[]
no_license
darkspiriton/InstantFood
a01ef6bf3c52cc8c91f0297932ecceab758c7423
962fa8b428dfbb6849e64fb7ad2e1ae746de75b3
refs/heads/master
2020-04-15T22:49:32.440058
2014-11-09T03:33:21
2014-11-09T03:33:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
359
java
package com.food.instant.instantfood; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
ccad113f46ca14eae783557a030d7b48f306b076
231cd4dab39bdb7e02b74442e355e512b084f508
/app/build/generated/not_namespaced_r_class_sources/debug/r/androidx/legacy/coreui/R.java
dbfef09d0f37cf1070364c7a68f3329e4f57880b
[]
no_license
TedOnyango/NoteKeeper
3058bda605c3cf7a96b46ea010542cfa5da42b48
99a38283f7a824e337d2fca39afeb858e1374b28
refs/heads/master
2020-07-30T08:29:09.192986
2019-09-24T07:37:09
2019-09-24T07:37:09
210,154,909
0
0
null
null
null
null
UTF-8
Java
false
false
12,395
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package androidx.legacy.coreui; public final class R { private R() {} public static final class attr { private attr() {} public static final int alpha = 0x7f04002b; public static final int coordinatorLayoutStyle = 0x7f0400aa; public static final int font = 0x7f0400f3; public static final int fontProviderAuthority = 0x7f0400f5; public static final int fontProviderCerts = 0x7f0400f6; public static final int fontProviderFetchStrategy = 0x7f0400f7; public static final int fontProviderFetchTimeout = 0x7f0400f8; public static final int fontProviderPackage = 0x7f0400f9; public static final int fontProviderQuery = 0x7f0400fa; public static final int fontStyle = 0x7f0400fb; public static final int fontVariationSettings = 0x7f0400fc; public static final int fontWeight = 0x7f0400fd; public static final int keylines = 0x7f04012e; public static final int layout_anchor = 0x7f040133; public static final int layout_anchorGravity = 0x7f040134; public static final int layout_behavior = 0x7f040135; public static final int layout_dodgeInsetEdges = 0x7f040161; public static final int layout_insetEdge = 0x7f04016a; public static final int layout_keyline = 0x7f04016b; public static final int statusBarBackground = 0x7f0401e2; public static final int ttcIndex = 0x7f04024c; } public static final class color { private color() {} public static final int notification_action_color_filter = 0x7f06006a; public static final int notification_icon_bg_color = 0x7f06006b; public static final int ripple_material_light = 0x7f060078; public static final int secondary_text_default_material_light = 0x7f06007a; } public static final class dimen { private dimen() {} public static final int compat_button_inset_horizontal_material = 0x7f070053; public static final int compat_button_inset_vertical_material = 0x7f070054; public static final int compat_button_padding_horizontal_material = 0x7f070055; public static final int compat_button_padding_vertical_material = 0x7f070056; public static final int compat_control_corner_material = 0x7f070057; public static final int compat_notification_large_icon_max_height = 0x7f070058; public static final int compat_notification_large_icon_max_width = 0x7f070059; public static final int notification_action_icon_size = 0x7f0700c8; public static final int notification_action_text_size = 0x7f0700c9; public static final int notification_big_circle_margin = 0x7f0700ca; public static final int notification_content_margin_start = 0x7f0700cb; public static final int notification_large_icon_height = 0x7f0700cc; public static final int notification_large_icon_width = 0x7f0700cd; public static final int notification_main_column_padding_top = 0x7f0700ce; public static final int notification_media_narrow_margin = 0x7f0700cf; public static final int notification_right_icon_size = 0x7f0700d0; public static final int notification_right_side_padding_top = 0x7f0700d1; public static final int notification_small_icon_background_padding = 0x7f0700d2; public static final int notification_small_icon_size_as_large = 0x7f0700d3; public static final int notification_subtext_size = 0x7f0700d4; public static final int notification_top_pad = 0x7f0700d5; public static final int notification_top_pad_large_text = 0x7f0700d6; } public static final class drawable { private drawable() {} public static final int notification_action_background = 0x7f08007e; public static final int notification_bg = 0x7f08007f; public static final int notification_bg_low = 0x7f080080; public static final int notification_bg_low_normal = 0x7f080081; public static final int notification_bg_low_pressed = 0x7f080082; public static final int notification_bg_normal = 0x7f080083; public static final int notification_bg_normal_pressed = 0x7f080084; public static final int notification_icon_background = 0x7f080085; public static final int notification_template_icon_bg = 0x7f080086; public static final int notification_template_icon_low_bg = 0x7f080087; public static final int notification_tile_bg = 0x7f080088; public static final int notify_panel_notification_icon_bg = 0x7f080089; } public static final class id { private id() {} public static final int action_container = 0x7f090030; public static final int action_divider = 0x7f090032; public static final int action_image = 0x7f090033; public static final int action_text = 0x7f09003d; public static final int actions = 0x7f09003e; public static final int async = 0x7f090044; public static final int blocking = 0x7f090048; public static final int bottom = 0x7f090049; public static final int chronometer = 0x7f090053; public static final int end = 0x7f09006a; public static final int forever = 0x7f090077; public static final int icon = 0x7f09007e; public static final int icon_group = 0x7f090080; public static final int info = 0x7f090085; public static final int italic = 0x7f090087; public static final int left = 0x7f09008b; public static final int line1 = 0x7f09008c; public static final int line3 = 0x7f09008d; public static final int none = 0x7f0900a1; public static final int normal = 0x7f0900a2; public static final int notification_background = 0x7f0900a3; public static final int notification_main_column = 0x7f0900a4; public static final int notification_main_column_container = 0x7f0900a5; public static final int right = 0x7f0900b4; public static final int right_icon = 0x7f0900b5; public static final int right_side = 0x7f0900b6; public static final int start = 0x7f0900e2; public static final int tag_transition_group = 0x7f0900ee; public static final int tag_unhandled_key_event_manager = 0x7f0900ef; public static final int tag_unhandled_key_listeners = 0x7f0900f0; public static final int text = 0x7f0900f1; public static final int text2 = 0x7f0900f2; public static final int time = 0x7f0900fe; public static final int title = 0x7f0900ff; public static final int top = 0x7f090103; } public static final class integer { private integer() {} public static final int status_bar_notification_info_maxnum = 0x7f0a000f; } public static final class layout { private layout() {} public static final int notification_action = 0x7f0c0039; public static final int notification_action_tombstone = 0x7f0c003a; public static final int notification_template_custom_big = 0x7f0c0041; public static final int notification_template_icon_group = 0x7f0c0042; public static final int notification_template_part_chronometer = 0x7f0c0046; public static final int notification_template_part_time = 0x7f0c0047; } public static final class string { private string() {} public static final int status_bar_notification_info_overflow = 0x7f0f004d; } public static final class style { private style() {} public static final int TextAppearance_Compat_Notification = 0x7f10013a; public static final int TextAppearance_Compat_Notification_Info = 0x7f10013b; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f10013d; public static final int TextAppearance_Compat_Notification_Time = 0x7f100140; public static final int TextAppearance_Compat_Notification_Title = 0x7f100142; public static final int Widget_Compat_NotificationActionContainer = 0x7f1001ed; public static final int Widget_Compat_NotificationActionText = 0x7f1001ee; public static final int Widget_Support_CoordinatorLayout = 0x7f10021d; } public static final class styleable { private styleable() {} public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f04002b }; public static final int ColorStateListItem_android_color = 0; public static final int ColorStateListItem_android_alpha = 1; public static final int ColorStateListItem_alpha = 2; public static final int[] CoordinatorLayout = { 0x7f04012e, 0x7f0401e2 }; public static final int CoordinatorLayout_keylines = 0; public static final int CoordinatorLayout_statusBarBackground = 1; public static final int[] CoordinatorLayout_Layout = { 0x10100b3, 0x7f040133, 0x7f040134, 0x7f040135, 0x7f040161, 0x7f04016a, 0x7f04016b }; public static final int CoordinatorLayout_Layout_android_layout_gravity = 0; public static final int CoordinatorLayout_Layout_layout_anchor = 1; public static final int CoordinatorLayout_Layout_layout_anchorGravity = 2; public static final int CoordinatorLayout_Layout_layout_behavior = 3; public static final int CoordinatorLayout_Layout_layout_dodgeInsetEdges = 4; public static final int CoordinatorLayout_Layout_layout_insetEdge = 5; public static final int CoordinatorLayout_Layout_layout_keyline = 6; public static final int[] FontFamily = { 0x7f0400f5, 0x7f0400f6, 0x7f0400f7, 0x7f0400f8, 0x7f0400f9, 0x7f0400fa }; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f0400f3, 0x7f0400fb, 0x7f0400fc, 0x7f0400fd, 0x7f04024c }; public static final int FontFamilyFont_android_font = 0; public static final int FontFamilyFont_android_fontWeight = 1; public static final int FontFamilyFont_android_fontStyle = 2; public static final int FontFamilyFont_android_ttcIndex = 3; public static final int FontFamilyFont_android_fontVariationSettings = 4; public static final int FontFamilyFont_font = 5; public static final int FontFamilyFont_fontStyle = 6; public static final int FontFamilyFont_fontVariationSettings = 7; public static final int FontFamilyFont_fontWeight = 8; public static final int FontFamilyFont_ttcIndex = 9; public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 }; public static final int GradientColor_android_startColor = 0; public static final int GradientColor_android_endColor = 1; public static final int GradientColor_android_type = 2; public static final int GradientColor_android_centerX = 3; public static final int GradientColor_android_centerY = 4; public static final int GradientColor_android_gradientRadius = 5; public static final int GradientColor_android_tileMode = 6; public static final int GradientColor_android_centerColor = 7; public static final int GradientColor_android_startX = 8; public static final int GradientColor_android_startY = 9; public static final int GradientColor_android_endX = 10; public static final int GradientColor_android_endY = 11; public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 }; public static final int GradientColorItem_android_color = 0; public static final int GradientColorItem_android_offset = 1; } }
239bae98dd3a8f0d8d6b3b75c3b38a02ee2b894c
d89c40faccf1f0af50e7a1b8e1c790ea3729f1ef
/IDEAprojects/colour_cold/src/IO/Buffer07/BufferedWriterTest.java
be45889506058588ec6288acd1a5aa6f2e013d6d
[]
no_license
colour-cold/repo1
55e1939711f3720ef8ef3bbdf9cf050cae8d7e4a
b85eb9190d79f630bdeaf2c231542e48c02d116e
refs/heads/master
2022-06-28T12:40:48.563392
2020-03-27T09:50:37
2020-03-27T09:50:37
249,617,363
0
0
null
2022-06-21T03:03:12
2020-03-24T05:02:49
Java
UTF-8
Java
false
false
2,478
java
package IO.Buffer07; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; /* java.io.BufferedWriter extends Writer BufferedWriter:字符缓冲输出流 继承自父类的共性成员方法: void write(int c) 写入单个字符 void write(char[] chars) 写入字符数组 abstract void write(char[] chars,int off,int len) 写入字符数组的某一部分,off是数组的开始索引,len是写的字符个数 void writes(String str) 写入字符串 void write(String str,int off,int len) 写入字符串中的某一部分,off字符串的开始索引,len是写的字符个数 void flush() 刷新该流的缓冲 void close() 关闭此流,但要先刷新它 构造方法: BufferedWriter(Writer out) 创建一个使用默认大小输出缓冲区的缓冲字符输出流 BufferedWriter(Writer out,int size) 创建一个给定大小输出缓冲区的缓冲字符输出流 参数: Writer out:字符输出流 我们可以传递FileWriter,缓冲流会给FileWriter增加一个缓冲区,提高FileWriter的写入效率 int size:指定缓冲区的大小,不写则为默认大小 特有的成员方法: void newLine():写一个行分隔符,会根据不同的操作系统,获取不同行分隔符 使用步骤: 1.创建字符缓冲输出流对象,构造方法中传递字符输出流 2.调用字符缓冲输出流中的方法writer,把数据写入到内存缓冲区中 3.调用字符缓冲输出流中的方法flush,把内存缓冲区中的数据,刷新到文件中 4.释放资源 */ public class BufferedWriterTest { public static void main(String[] args) throws IOException { //1.创建字符缓冲输出流对象,构造方法中传递字符输出流 BufferedWriter bw = new BufferedWriter(new FileWriter("src\\IO\\e.txt")); //2.调用字符缓冲输出流中的方法writer,把数据写入到内存缓冲区中 for (int i = 0; i < 5; i++) { bw.write('a'); bw.newLine(); } //3.调用字符缓冲输出流中的方法flush,把内存缓冲区中的数据,刷新到文件中 bw.flush(); //4.释放资源 bw.close(); } }
a5c3f0e96f59e38e5ddce08ada3d66bf9218d475
dd80a584130ef1a0333429ba76c1cee0eb40df73
/external/robolectric/src/test/java/com/xtremelabs/robolectric/shadows/ImageViewTest.java
1519291541f161aafecabf3159c7bc37af71ef40
[ "MIT" ]
permissive
karunmatharu/Android-4.4-Pay-by-Data
466f4e169ede13c5835424c78e8c30ce58f885c1
fcb778e92d4aad525ef7a995660580f948d40bc9
refs/heads/master
2021-03-24T13:33:01.721868
2017-02-18T17:48:49
2017-02-18T17:48:49
81,847,777
0
2
MIT
2020-03-09T00:02:12
2017-02-13T16:47:00
null
UTF-8
Java
false
false
3,969
java
package com.xtremelabs.robolectric.shadows; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Matrix; import android.graphics.drawable.AnimationDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; import android.widget.ImageView; import com.xtremelabs.robolectric.R; import com.xtremelabs.robolectric.Robolectric; import com.xtremelabs.robolectric.WithTestDefaultsRunner; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import static com.xtremelabs.robolectric.Robolectric.shadowOf; import static com.xtremelabs.robolectric.Robolectric.visualize; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @RunWith(WithTestDefaultsRunner.class) public class ImageViewTest { private ImageView imageView; @Before public void setUp() throws Exception { Resources resources = Robolectric.application.getResources(); Bitmap bitmap = BitmapFactory.decodeResource(resources, R.drawable.an_image); imageView = new ImageView(Robolectric.application); imageView.setImageBitmap(bitmap); } @Test public void shouldDrawWithImageMatrix() throws Exception { imageView.setImageMatrix(new Matrix()); assertEquals("Bitmap for resource:drawable/an_image", visualize(imageView)); Matrix matrix = new Matrix(); matrix.setTranslate(15, 20); imageView.setImageMatrix(matrix); assertEquals("Bitmap for resource:drawable/an_image at (15,20)", visualize(imageView)); } @Test public void shouldCopyMatrixSetup() throws Exception { Matrix matrix = new Matrix(); matrix.setTranslate(15, 20); imageView.setImageMatrix(matrix); assertEquals("Bitmap for resource:drawable/an_image at (15,20)", visualize(imageView)); matrix.setTranslate(30, 40); assertEquals("Bitmap for resource:drawable/an_image at (15,20)", visualize(imageView)); imageView.setImageMatrix(matrix); assertEquals("Bitmap for resource:drawable/an_image at (30,40)", visualize(imageView)); } @Test public void testSetImageResource_drawable() { imageView.setImageResource(R.drawable.l0_red); assertTrue("Drawable", imageView.getDrawable() instanceof Drawable); assertFalse("LayerDrawable", imageView.getDrawable() instanceof LayerDrawable); } @Test public void testSetAnimatedImage_drawable() { imageView.setImageResource(R.drawable.animation_list); Drawable animation = imageView.getDrawable(); assertTrue(animation instanceof Drawable); assertTrue(animation instanceof AnimationDrawable); } @Test public void testSetAnimationItem() throws Exception { imageView.setImageResource(R.drawable.animation_list); AnimationDrawable animation = (AnimationDrawable) imageView.getDrawable(); assertEquals(3, animation.getNumberOfFrames()); } @Test public void testSetImageResource_layerDrawable() { imageView.setImageResource(R.drawable.rainbow); assertTrue("Drawable", imageView.getDrawable() instanceof Drawable); assertTrue("LayerDrawable", imageView.getDrawable() instanceof LayerDrawable); assertThat(shadowOf(imageView.getDrawable()).getLoadedFromResourceId(), is(R.drawable.rainbow)); } @Test public void testSetImageLevel() throws Exception { imageView.setImageLevel(2); assertThat(shadowOf(imageView).getImageLevel(), equalTo(2)); } }
fb54fc13eb67e8fff4234cd0a216c73ab32163ce
41fda93dd5b89f480d67cd27c84204425c76946d
/src/main/java/com/service/impl/SPBHServiceImpl.java
95a48ad83142dceba4638aa8773166024e15bae7
[]
no_license
NguyenHoang1996/JeeProject-ManageCellPhones
daf1d0c418ac7959e5d4a4207e7141735325e97f
a53d13d2fcca3f21337bac5dff2219870c53b52f
refs/heads/master
2020-03-24T09:48:34.930865
2018-07-28T02:02:56
2018-07-28T02:02:56
142,638,072
0
0
null
null
null
null
UTF-8
Java
false
false
3,100
java
package com.service.impl; import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.dao.KhachDAO; import com.dao.NguoiDAO; import com.dao.SPBHDAO; import com.domain.SPBHDTO; import com.model.Nguoi; import com.model.SanPhamBaoHanh; import com.service.SPBHService; @Service @Transactional public class SPBHServiceImpl implements SPBHService { @Autowired private SPBHDAO spbhdao; @Autowired private KhachDAO khachDAO; @Autowired private NguoiDAO nguoiDAO; public void addSPBH(SPBHDTO sPBHDTO) { SanPhamBaoHanh spbh = new SanPhamBaoHanh(); spbh.setKhach(khachDAO.getKHByID(sPBHDTO.getKhachID())); spbh.setNgayNhan(sPBHDTO.getNgayNhan()); spbh.setNgayTra(sPBHDTO.getNgayTra()); spbh.setNoiDung(sPBHDTO.getNoiDung()); spbh.setPhi(sPBHDTO.getPhi()); spbh.setTen(sPBHDTO.getTen()); spbhdao.addSPBH(spbh); sPBHDTO.setId(spbh.getId()); } public void editSPBH(SPBHDTO sPBHDTO) { SanPhamBaoHanh spbh = spbhdao.getSPBHByID(sPBHDTO.getId()); spbh.setKhach(khachDAO.getKHByID(sPBHDTO.getKhachID())); spbh.setNgayNhan(sPBHDTO.getNgayNhan()); spbh.setNgayTra(sPBHDTO.getNgayTra()); spbh.setNoiDung(sPBHDTO.getNoiDung()); spbh.setPhi(sPBHDTO.getPhi()); spbh.setTen(sPBHDTO.getTen()); spbhdao.editSPBH(spbh); } public void deleteSPBH(int id) { SanPhamBaoHanh spbh = spbhdao.getSPBHByID(id); if (spbh != null) { spbhdao.deleteSPBH(spbh); } } public List<SPBHDTO> getAllSPBH() { List<SanPhamBaoHanh> list = spbhdao.getAllSPBH(); List<SPBHDTO> spbhdtos = new ArrayList<SPBHDTO>(); List<Nguoi> listNguoi = nguoiDAO.getAllNguoi(); for (SanPhamBaoHanh sanPhamBaoHanh : list) { SPBHDTO spbhdto = new SPBHDTO(); spbhdto.setId(sanPhamBaoHanh.getId()); spbhdto.setKhachID(sanPhamBaoHanh.getKhach().getId()); for (Nguoi nguoi : listNguoi) { if(nguoi.getId() == sanPhamBaoHanh.getKhach().getKhNguoiID()){ spbhdto.setKhachTen(nguoi.getTen()); } } spbhdto.setNgayNhan(sanPhamBaoHanh.getNgayNhan()); spbhdto.setNgayTra(sanPhamBaoHanh.getNgayTra()); spbhdto.setNoiDung(sanPhamBaoHanh.getNoiDung()); spbhdto.setPhi(sanPhamBaoHanh.getPhi()); spbhdto.setTen(sanPhamBaoHanh.getTen()); spbhdtos.add(spbhdto); } return spbhdtos; } public SPBHDTO getSPBHByID(int id) { SanPhamBaoHanh sanPhamBaoHanh = spbhdao.getSPBHByID(id); List<Nguoi> listNguoi = nguoiDAO.getAllNguoi(); SPBHDTO spbhdto = new SPBHDTO(); spbhdto.setId(sanPhamBaoHanh.getId()); spbhdto.setKhachID(sanPhamBaoHanh.getKhach().getId()); for (Nguoi nguoi : listNguoi) { if(nguoi.getId() == sanPhamBaoHanh.getKhach().getKhNguoiID()){ spbhdto.setKhachTen(nguoi.getTen()); } } spbhdto.setNgayNhan(sanPhamBaoHanh.getNgayNhan()); spbhdto.setNgayTra(sanPhamBaoHanh.getNgayTra()); spbhdto.setNoiDung(sanPhamBaoHanh.getNoiDung()); spbhdto.setPhi(sanPhamBaoHanh.getPhi()); spbhdto.setTen(sanPhamBaoHanh.getTen()); return spbhdto; } }
63e5d9d8a0b18cf4e9f7871d6802a6ebefa549fd
2006c39d84d2a3704f48e647d826287a35b6174d
/src/test/java/testcoding/HotelBookingTest.java
3290371f06876a7a7a589a1c261f54f790b8edd5
[]
no_license
chanukya510/codingRound-master
ced3480ecf55fa6b1fe14f7a16032a31f43594dd
b92a44f3118bce590904ae045394f586728dd9a6
refs/heads/master
2020-03-13T11:34:11.116132
2018-04-26T10:08:43
2018-04-26T10:08:43
131,103,822
0
0
null
null
null
null
UTF-8
Java
false
false
1,270
java
package testcoding; import com.sun.javafx.PlatformUtil; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; import org.openqa.selenium.support.ui.Select; import org.testng.annotations.Test; public class HotelBookingTest { WebDriver driver; Basecode base = new Basecode(); @FindBy(linkText = "Hotels") private WebElement hotelLink; @FindBy(id = "Tags") private WebElement localityTextBox; @FindBy(id = "SearchHotelsButton") private WebElement searchButton; @FindBy(id = "travellersOnhome") private WebElement travellerSelection; @Test public void shouldBeAbleToSearchForHotels() { base.setDriverPath(); driver = new ChromeDriver(); driver.get("https://www.cleartrip.com"); try { Thread.sleep(5000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } PageFactory.initElements(driver, this); hotelLink.click(); localityTextBox.sendKeys("Indiranagar, Bangalore"); new Select(travellerSelection).selectByVisibleText("1 room, 2 adults"); searchButton.click(); driver.quit(); } }